Merge branch 'draw-instanced'
authorBrian Paul <brianp@vmware.com>
Sat, 15 Jan 2011 17:24:08 +0000 (10:24 -0700)
committerBrian Paul <brianp@vmware.com>
Sat, 15 Jan 2011 17:24:08 +0000 (10:24 -0700)
Conflicts:
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/glsl/ir_set_program_inouts.cpp
src/mesa/tnl/t_vb_program.c

1130 files changed:
Makefile
SConstruct
bin/mklib
common.py
configs/autoconf.in
configs/default
configs/linux-llvm
configure.ac
docs/GL3.txt
docs/MESA_drm_image.spec
docs/egl.html
docs/opengles.html
docs/relnotes-7.10.html
docs/relnotes-7.11.html [new file with mode: 0644]
docs/relnotes-7.9.1.html [new file with mode: 0644]
docs/relnotes.html
include/GL/gl_mangle.h
include/GL/glext.h
include/GL/internal/dri_interface.h
include/VG/openvg.h
include/VG/vgext.h
include/VG/vgplatform.h
include/VG/vgu.h
src/SConscript
src/egl/Makefile
src/egl/drivers/Makefile.template
src/egl/drivers/dri2/Makefile
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/glx/Makefile
src/egl/drivers/glx/egl_glx.c
src/egl/main/Makefile
src/egl/main/SConscript
src/egl/main/eglapi.c
src/egl/main/eglapi.h
src/egl/main/eglarray.c
src/egl/main/eglarray.h
src/egl/main/eglconfig.c
src/egl/main/eglcurrent.c
src/egl/main/egldisplay.h
src/egl/main/egldriver.c
src/egl/main/egldriver.h
src/egl/main/eglmisc.c
src/egl/main/eglstring.h
src/gallium/SConscript
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/SConscript
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_llvm.h
src/gallium/auxiliary/draw/draw_llvm_sample.c
src/gallium/auxiliary/draw/draw_llvm_translate.c
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c
src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
src/gallium/auxiliary/draw/draw_vs.c
src/gallium/auxiliary/draw/draw_vs.h
src/gallium/auxiliary/draw/draw_vs_aos.c
src/gallium/auxiliary/draw/draw_vs_aos.h
src/gallium/auxiliary/draw/draw_vs_exec.c
src/gallium/auxiliary/draw/draw_vs_llvm.c
src/gallium/auxiliary/draw/draw_vs_ppc.c
src/gallium/auxiliary/draw/draw_vs_sse.c
src/gallium/auxiliary/draw/draw_vs_varient.c
src/gallium/auxiliary/gallivm/lp_bld.h
src/gallium/auxiliary/gallivm/lp_bld_arit.c
src/gallium/auxiliary/gallivm/lp_bld_assert.c
src/gallium/auxiliary/gallivm/lp_bld_assert.h
src/gallium/auxiliary/gallivm/lp_bld_bitarit.c
src/gallium/auxiliary/gallivm/lp_bld_const.c
src/gallium/auxiliary/gallivm/lp_bld_const.h
src/gallium/auxiliary/gallivm/lp_bld_conv.c
src/gallium/auxiliary/gallivm/lp_bld_conv.h
src/gallium/auxiliary/gallivm/lp_bld_debug.h
src/gallium/auxiliary/gallivm/lp_bld_flow.c
src/gallium/auxiliary/gallivm/lp_bld_flow.h
src/gallium/auxiliary/gallivm/lp_bld_format.h
src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
src/gallium/auxiliary/gallivm/lp_bld_gather.c
src/gallium/auxiliary/gallivm/lp_bld_gather.h
src/gallium/auxiliary/gallivm/lp_bld_init.c
src/gallium/auxiliary/gallivm/lp_bld_init.h
src/gallium/auxiliary/gallivm/lp_bld_intr.c
src/gallium/auxiliary/gallivm/lp_bld_intr.h
src/gallium/auxiliary/gallivm/lp_bld_logic.c
src/gallium/auxiliary/gallivm/lp_bld_logic.h
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
src/gallium/auxiliary/gallivm/lp_bld_pack.c
src/gallium/auxiliary/gallivm/lp_bld_pack.h
src/gallium/auxiliary/gallivm/lp_bld_printf.c
src/gallium/auxiliary/gallivm/lp_bld_printf.h
src/gallium/auxiliary/gallivm/lp_bld_quad.c
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/gallivm/lp_bld_sample.h
src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
src/gallium/auxiliary/gallivm/lp_bld_struct.c
src/gallium/auxiliary/gallivm/lp_bld_struct.h
src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
src/gallium/auxiliary/gallivm/lp_bld_swizzle.h
src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
src/gallium/auxiliary/gallivm/lp_bld_type.c
src/gallium/auxiliary/gallivm/lp_bld_type.h
src/gallium/auxiliary/target-helpers/inline_noop_helper.h [new file with mode: 0644]
src/gallium/auxiliary/tgsi/tgsi_dump.c
src/gallium/auxiliary/tgsi/tgsi_dump.h
src/gallium/auxiliary/tgsi/tgsi_parse.h
src/gallium/auxiliary/tgsi/tgsi_sanity.h
src/gallium/auxiliary/tgsi/tgsi_text.c
src/gallium/auxiliary/tgsi/tgsi_text.h
src/gallium/auxiliary/tgsi/tgsi_ureg.c
src/gallium/auxiliary/tgsi/tgsi_ureg.h
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_blit.h
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_blitter.h
src/gallium/auxiliary/util/u_box.h
src/gallium/auxiliary/util/u_debug.c
src/gallium/auxiliary/util/u_debug_describe.c
src/gallium/auxiliary/util/u_debug_stack.c
src/gallium/auxiliary/util/u_debug_symbol.c
src/gallium/auxiliary/util/u_dirty_flags.h
src/gallium/auxiliary/util/u_dirty_surfaces.h
src/gallium/auxiliary/util/u_dump_state.c
src/gallium/auxiliary/util/u_format.csv
src/gallium/auxiliary/util/u_gen_mipmap.c
src/gallium/auxiliary/util/u_gen_mipmap.h
src/gallium/auxiliary/util/u_index_modify.c
src/gallium/auxiliary/util/u_index_modify.h
src/gallium/auxiliary/util/u_inlines.h
src/gallium/auxiliary/util/u_mempool.c [deleted file]
src/gallium/auxiliary/util/u_mempool.h [deleted file]
src/gallium/auxiliary/util/u_resource.c
src/gallium/auxiliary/util/u_sampler.c
src/gallium/auxiliary/util/u_simple_screen.h
src/gallium/auxiliary/util/u_simple_shaders.c
src/gallium/auxiliary/util/u_simple_shaders.h
src/gallium/auxiliary/util/u_slab.c [new file with mode: 0644]
src/gallium/auxiliary/util/u_slab.h [new file with mode: 0644]
src/gallium/auxiliary/util/u_staging.c
src/gallium/auxiliary/util/u_staging.h
src/gallium/auxiliary/util/u_surface.c
src/gallium/auxiliary/util/u_surface.h
src/gallium/auxiliary/util/u_surfaces.c
src/gallium/auxiliary/util/u_surfaces.h
src/gallium/auxiliary/util/u_transfer.c
src/gallium/auxiliary/util/u_transfer.h
src/gallium/auxiliary/util/u_upload_mgr.c
src/gallium/auxiliary/util/u_upload_mgr.h
src/gallium/docs/d3d11ddi.txt
src/gallium/docs/source/context.rst
src/gallium/docs/source/glossary.rst
src/gallium/docs/source/screen.rst
src/gallium/docs/source/tgsi.rst
src/gallium/drivers/cell/ppu/cell_context.c
src/gallium/drivers/cell/ppu/cell_state_vertex.c
src/gallium/drivers/cell/ppu/cell_texture.c
src/gallium/drivers/failover/fo_context.c
src/gallium/drivers/failover/fo_state.c
src/gallium/drivers/galahad/glhd_context.c
src/gallium/drivers/galahad/glhd_objects.c
src/gallium/drivers/galahad/glhd_objects.h
src/gallium/drivers/galahad/glhd_screen.c
src/gallium/drivers/i915/TODO [new file with mode: 0644]
src/gallium/drivers/i915/i915_batch.h
src/gallium/drivers/i915/i915_batchbuffer.h
src/gallium/drivers/i915/i915_blit.c
src/gallium/drivers/i915/i915_context.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_debug.c
src/gallium/drivers/i915/i915_debug.h
src/gallium/drivers/i915/i915_fpc_translate.c
src/gallium/drivers/i915/i915_prim_vbuf.c
src/gallium/drivers/i915/i915_reg.h
src/gallium/drivers/i915/i915_resource.h
src/gallium/drivers/i915/i915_resource_buffer.c
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/drivers/i915/i915_state_sampler.c
src/gallium/drivers/i915/i915_surface.c
src/gallium/drivers/i915/i915_surface.h
src/gallium/drivers/i915/i915_winsys.h
src/gallium/drivers/i965/Makefile
src/gallium/drivers/i965/SConscript
src/gallium/drivers/i965/brw_batchbuffer.c
src/gallium/drivers/i965/brw_batchbuffer.h
src/gallium/drivers/i965/brw_clip.c
src/gallium/drivers/i965/brw_clip.h
src/gallium/drivers/i965/brw_clip_line.c
src/gallium/drivers/i965/brw_clip_state.c
src/gallium/drivers/i965/brw_clip_tri.c
src/gallium/drivers/i965/brw_clip_util.c
src/gallium/drivers/i965/brw_context.c
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/i965/brw_defines.h
src/gallium/drivers/i965/brw_disasm.c
src/gallium/drivers/i965/brw_disasm.h
src/gallium/drivers/i965/brw_draw_upload.c
src/gallium/drivers/i965/brw_eu_emit.c
src/gallium/drivers/i965/brw_gs.c
src/gallium/drivers/i965/brw_gs_state.c
src/gallium/drivers/i965/brw_misc_state.c
src/gallium/drivers/i965/brw_pipe_clear.c
src/gallium/drivers/i965/brw_pipe_rast.c
src/gallium/drivers/i965/brw_pipe_surface.c [new file with mode: 0644]
src/gallium/drivers/i965/brw_pipe_vertex.c
src/gallium/drivers/i965/brw_reg.h
src/gallium/drivers/i965/brw_resource_buffer.c
src/gallium/drivers/i965/brw_resource_texture.c
src/gallium/drivers/i965/brw_resource_texture_layout.c
src/gallium/drivers/i965/brw_screen.c
src/gallium/drivers/i965/brw_screen.h
src/gallium/drivers/i965/brw_screen_surface.c [deleted file]
src/gallium/drivers/i965/brw_sf_emit.c
src/gallium/drivers/i965/brw_sf_state.c
src/gallium/drivers/i965/brw_state.h
src/gallium/drivers/i965/brw_state_upload.c
src/gallium/drivers/i965/brw_structs.h
src/gallium/drivers/i965/brw_structs_dump.c
src/gallium/drivers/i965/brw_urb.c
src/gallium/drivers/i965/brw_vs.h
src/gallium/drivers/i965/brw_vs_emit.c
src/gallium/drivers/i965/brw_vs_state.c
src/gallium/drivers/i965/brw_winsys.h
src/gallium/drivers/i965/brw_winsys_debug.c
src/gallium/drivers/i965/brw_wm_emit.c
src/gallium/drivers/i965/brw_wm_fp.c
src/gallium/drivers/i965/brw_wm_glsl.c
src/gallium/drivers/i965/brw_wm_state.c
src/gallium/drivers/i965/intel_decode.c
src/gallium/drivers/i965/intel_decode.h
src/gallium/drivers/i965/intel_structs.h
src/gallium/drivers/identity/SConscript
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/identity/id_objects.c
src/gallium/drivers/identity/id_objects.h
src/gallium/drivers/identity/id_screen.c
src/gallium/drivers/llvmpipe/Makefile
src/gallium/drivers/llvmpipe/lp_bld_alpha.c
src/gallium/drivers/llvmpipe/lp_bld_alpha.h
src/gallium/drivers/llvmpipe/lp_bld_blend.h
src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
src/gallium/drivers/llvmpipe/lp_bld_depth.c
src/gallium/drivers/llvmpipe/lp_bld_depth.h
src/gallium/drivers/llvmpipe/lp_bld_interp.c
src/gallium/drivers/llvmpipe/lp_bld_interp.h
src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/llvmpipe/lp_flush.c
src/gallium/drivers/llvmpipe/lp_flush.h
src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_jit.h
src/gallium/drivers/llvmpipe/lp_perf.h
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_rast_priv.h
src/gallium/drivers/llvmpipe/lp_scene.c
src/gallium/drivers/llvmpipe/lp_scene_queue.h
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_screen.h
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup.h
src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_fs.h
src/gallium/drivers/llvmpipe/lp_state_setup.c
src/gallium/drivers/llvmpipe/lp_state_vertex.c
src/gallium/drivers/llvmpipe/lp_surface.c
src/gallium/drivers/llvmpipe/lp_test.h
src/gallium/drivers/llvmpipe/lp_test_blend.c
src/gallium/drivers/llvmpipe/lp_test_conv.c
src/gallium/drivers/llvmpipe/lp_test_format.c
src/gallium/drivers/llvmpipe/lp_test_main.c
src/gallium/drivers/llvmpipe/lp_test_printf.c
src/gallium/drivers/llvmpipe/lp_test_round.c
src/gallium/drivers/llvmpipe/lp_test_sincos.c
src/gallium/drivers/llvmpipe/lp_tex_sample.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_texture.h
src/gallium/drivers/noop/noop_pipe.c
src/gallium/drivers/noop/noop_public.h
src/gallium/drivers/noop/noop_state.c
src/gallium/drivers/nouveau/nouveau_screen.h
src/gallium/drivers/nouveau/nouveau_winsys.h
src/gallium/drivers/nouveau/nv_object.xml.h
src/gallium/drivers/nv50/nv50_buffer.c
src/gallium/drivers/nv50/nv50_context.c
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_resource.c
src/gallium/drivers/nv50/nv50_resource.h
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_shader_state.c
src/gallium/drivers/nv50/nv50_state.c
src/gallium/drivers/nv50/nv50_state_validate.c
src/gallium/drivers/nv50/nv50_surface.c
src/gallium/drivers/nv50/nv50_tex.c
src/gallium/drivers/nv50/nv50_transfer.c
src/gallium/drivers/nv50/nv50_transfer.h
src/gallium/drivers/nv50/nv50_vbo.c
src/gallium/drivers/nvc0/Makefile [new file with mode: 0644]
src/gallium/drivers/nvc0/SConscript [new file with mode: 0644]
src/gallium/drivers/nvc0/nv50_defs.xml.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nv50_texture.xml.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_2d.xml.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_3d.xml.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_3ddefs.xml.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_buffer.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_context.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_context.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_draw.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_fence.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_fence.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_formats.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_graph_macros.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_m2mf.xml.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_miptree.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_mm.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_pc.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_pc.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_pc_emit.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_pc_optimize.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_pc_print.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_pc_regalloc.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_program.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_program.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_push.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_push2.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_query.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_resource.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_resource.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_screen.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_screen.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_shader_state.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_state.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_state_validate.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_stateobj.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_surface.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_tex.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_transfer.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_transfer.h [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_vbo.c [new file with mode: 0644]
src/gallium/drivers/nvc0/nvc0_winsys.h [new file with mode: 0644]
src/gallium/drivers/nvfx/nv04_2d.c
src/gallium/drivers/nvfx/nv30_fragtex.c
src/gallium/drivers/nvfx/nv40_fragtex.c
src/gallium/drivers/nvfx/nvfx_buffer.c
src/gallium/drivers/nvfx/nvfx_context.c
src/gallium/drivers/nvfx/nvfx_context.h
src/gallium/drivers/nvfx/nvfx_draw.c
src/gallium/drivers/nvfx/nvfx_fragprog.c
src/gallium/drivers/nvfx/nvfx_fragtex.c
src/gallium/drivers/nvfx/nvfx_miptree.c
src/gallium/drivers/nvfx/nvfx_push.c
src/gallium/drivers/nvfx/nvfx_query.c
src/gallium/drivers/nvfx/nvfx_resource.c
src/gallium/drivers/nvfx/nvfx_resource.h
src/gallium/drivers/nvfx/nvfx_screen.c
src/gallium/drivers/nvfx/nvfx_state.c
src/gallium/drivers/nvfx/nvfx_state_emit.c
src/gallium/drivers/nvfx/nvfx_state_fb.c
src/gallium/drivers/nvfx/nvfx_surface.c
src/gallium/drivers/nvfx/nvfx_transfer.c
src/gallium/drivers/nvfx/nvfx_transfer.h
src/gallium/drivers/nvfx/nvfx_vbo.c
src/gallium/drivers/nvfx/nvfx_vertprog.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_chipset.c
src/gallium/drivers/r300/r300_chipset.h
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_cs.h
src/gallium/drivers/r300/r300_debug.c
src/gallium/drivers/r300/r300_defines.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_emit.h
src/gallium/drivers/r300/r300_flush.c
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/r300/r300_fs.h
src/gallium/drivers/r300/r300_hyperz.c
src/gallium/drivers/r300/r300_query.c
src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_render_stencilref.c
src/gallium/drivers/r300/r300_render_translate.c
src/gallium/drivers/r300/r300_resource.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_screen.h
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_screen_buffer.h
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_state_derived.h [deleted file]
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture.h
src/gallium/drivers/r300/r300_texture_desc.c
src/gallium/drivers/r300/r300_texture_desc.h
src/gallium/drivers/r300/r300_tgsi_to_rc.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/r300/r300_transfer.h
src/gallium/drivers/r300/r300_vs.c
src/gallium/drivers/r300/r300_winsys.h
src/gallium/drivers/r600/Makefile
src/gallium/drivers/r600/SConscript
src/gallium/drivers/r600/eg_asm.c
src/gallium/drivers/r600/eg_state_inlines.h
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600.h
src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_asm.h
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_opcodes.h
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_resource.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/r600_shader.h
src/gallium/drivers/r600/r600_sq.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/r600/r600_state_inlines.h
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/r600/r600_translate.c
src/gallium/drivers/r600/r600_upload.c [new file with mode: 0644]
src/gallium/drivers/r600/r700_asm.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/drivers/rbug/rbug_core.c
src/gallium/drivers/rbug/rbug_objects.c
src/gallium/drivers/rbug/rbug_objects.h
src/gallium/drivers/rbug/rbug_screen.c
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_flush.c
src/gallium/drivers/softpipe/sp_flush.h
src/gallium/drivers/softpipe/sp_limits.h [new file with mode: 0644]
src/gallium/drivers/softpipe/sp_quad_blend.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/softpipe/sp_state.h
src/gallium/drivers/softpipe/sp_state_derived.c
src/gallium/drivers/softpipe/sp_state_sampler.c
src/gallium/drivers/softpipe/sp_state_shader.c
src/gallium/drivers/softpipe/sp_state_vertex.c
src/gallium/drivers/softpipe/sp_tex_sample.c
src/gallium/drivers/softpipe/sp_tex_sample.h
src/gallium/drivers/softpipe/sp_tex_tile_cache.c
src/gallium/drivers/softpipe/sp_tex_tile_cache.h
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/softpipe/sp_texture.h
src/gallium/drivers/softpipe/sp_tile_cache.c
src/gallium/drivers/softpipe/sp_tile_cache.h
src/gallium/drivers/svga/SConscript
src/gallium/drivers/svga/svga_cmd.c
src/gallium/drivers/svga/svga_context.c
src/gallium/drivers/svga/svga_context.h
src/gallium/drivers/svga/svga_draw.c
src/gallium/drivers/svga/svga_draw_arrays.c
src/gallium/drivers/svga/svga_draw_elements.c
src/gallium/drivers/svga/svga_pipe_blit.c
src/gallium/drivers/svga/svga_pipe_rasterizer.c
src/gallium/drivers/svga/svga_resource_buffer.c
src/gallium/drivers/svga/svga_resource_texture.c
src/gallium/drivers/svga/svga_resource_texture.h
src/gallium/drivers/svga/svga_screen.c
src/gallium/drivers/svga/svga_state_constants.c
src/gallium/drivers/svga/svga_state_fs.c
src/gallium/drivers/svga/svga_state_need_swtnl.c
src/gallium/drivers/svga/svga_state_tss.c
src/gallium/drivers/svga/svga_state_vdecl.c
src/gallium/drivers/svga/svga_state_vs.c
src/gallium/drivers/svga/svga_surface.c
src/gallium/drivers/svga/svga_surface.h
src/gallium/drivers/svga/svga_swtnl_backend.c
src/gallium/drivers/svga/svga_swtnl_draw.c
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_dump_state.c
src/gallium/drivers/trace/tr_dump_state.h
src/gallium/drivers/trace/tr_screen.c
src/gallium/drivers/trace/tr_texture.c
src/gallium/drivers/trace/tr_texture.h
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_format.h
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_shader_tokens.h
src/gallium/include/pipe/p_state.h
src/gallium/include/state_tracker/st_api.h
src/gallium/include/state_tracker/xlib_sw_winsys.h
src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
src/gallium/state_trackers/dri/common/dri_screen.c
src/gallium/state_trackers/dri/common/dri_screen.h
src/gallium/state_trackers/dri/drm/dri2.c
src/gallium/state_trackers/dri/sw/drisw.c
src/gallium/state_trackers/egl/SConscript
src/gallium/state_trackers/egl/common/egl_g3d.c
src/gallium/state_trackers/egl/common/egl_g3d.h
src/gallium/state_trackers/egl/common/egl_g3d_api.c
src/gallium/state_trackers/egl/common/egl_g3d_api.h
src/gallium/state_trackers/egl/common/egl_g3d_image.c
src/gallium/state_trackers/egl/common/egl_g3d_st.c
src/gallium/state_trackers/egl/common/native.h
src/gallium/state_trackers/egl/common/native_helper.c
src/gallium/state_trackers/egl/drm/native_drm.c
src/gallium/state_trackers/egl/fbdev/native_fbdev.c
src/gallium/state_trackers/egl/gdi/native_gdi.c
src/gallium/state_trackers/egl/x11/native_dri2.c
src/gallium/state_trackers/egl/x11/native_x11.c
src/gallium/state_trackers/egl/x11/native_ximage.c
src/gallium/state_trackers/glx/xlib/xm_st.c
src/gallium/state_trackers/python/p_context.i
src/gallium/state_trackers/python/p_state.i
src/gallium/state_trackers/python/p_texture.i
src/gallium/state_trackers/python/st_device.c
src/gallium/state_trackers/python/st_device.h
src/gallium/state_trackers/python/st_sample.c
src/gallium/state_trackers/vega/.gitignore [new file with mode: 0644]
src/gallium/state_trackers/vega/Makefile
src/gallium/state_trackers/vega/SConscript
src/gallium/state_trackers/vega/api.c
src/gallium/state_trackers/vega/api.h
src/gallium/state_trackers/vega/api_filters.c
src/gallium/state_trackers/vega/api_images.c
src/gallium/state_trackers/vega/api_masks.c
src/gallium/state_trackers/vega/api_misc.c
src/gallium/state_trackers/vega/api_params.c
src/gallium/state_trackers/vega/api_path.c
src/gallium/state_trackers/vega/api_text.c
src/gallium/state_trackers/vega/asm_fill.h
src/gallium/state_trackers/vega/asm_util.h
src/gallium/state_trackers/vega/image.c
src/gallium/state_trackers/vega/image.h
src/gallium/state_trackers/vega/mask.c
src/gallium/state_trackers/vega/matrix.h
src/gallium/state_trackers/vega/paint.c
src/gallium/state_trackers/vega/paint.h
src/gallium/state_trackers/vega/path.c
src/gallium/state_trackers/vega/path.h
src/gallium/state_trackers/vega/polygon.c
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/renderer.h
src/gallium/state_trackers/vega/shader.c
src/gallium/state_trackers/vega/shader.h
src/gallium/state_trackers/vega/shaders_cache.c
src/gallium/state_trackers/vega/shaders_cache.h
src/gallium/state_trackers/vega/st_inlines.h [deleted file]
src/gallium/state_trackers/vega/text.c [new file with mode: 0644]
src/gallium/state_trackers/vega/text.h [new file with mode: 0644]
src/gallium/state_trackers/vega/vg_context.c
src/gallium/state_trackers/vega/vg_context.h
src/gallium/state_trackers/vega/vg_manager.c
src/gallium/state_trackers/wgl/SConscript
src/gallium/state_trackers/wgl/stw_context.c
src/gallium/state_trackers/wgl/stw_device.c
src/gallium/state_trackers/wgl/stw_device.h
src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c
src/gallium/state_trackers/wgl/stw_ext_pbuffer.c [new file with mode: 0644]
src/gallium/state_trackers/wgl/stw_ext_pixelformat.c
src/gallium/state_trackers/wgl/stw_framebuffer.c
src/gallium/state_trackers/wgl/stw_framebuffer.h
src/gallium/state_trackers/wgl/stw_getprocaddress.c
src/gallium/state_trackers/wgl/stw_pixelformat.c
src/gallium/state_trackers/wgl/stw_st.c
src/gallium/state_trackers/wgl/stw_winsys.h
src/gallium/state_trackers/xorg/xorg_composite.c
src/gallium/state_trackers/xorg/xorg_crtc.c
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/state_trackers/xorg/xorg_driver.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/state_trackers/xorg/xorg_exa.h
src/gallium/state_trackers/xorg/xorg_renderer.c
src/gallium/state_trackers/xorg/xorg_tracker.h
src/gallium/state_trackers/xorg/xorg_xv.c
src/gallium/targets/dri-noop/Makefile [deleted file]
src/gallium/targets/dri-noop/SConscript [deleted file]
src/gallium/targets/dri-noop/swrast_drm_api.c [deleted file]
src/gallium/targets/dri-nouveau/Makefile
src/gallium/targets/dri-r600/Makefile
src/gallium/targets/dri-r600/target.c
src/gallium/targets/dri-vmwgfx/SConscript
src/gallium/targets/dri-vmwgfx/target.c
src/gallium/targets/egl-gdi/SConscript [deleted file]
src/gallium/targets/egl-gdi/egl-static.c [deleted file]
src/gallium/targets/egl-static/SConscript [new file with mode: 0644]
src/gallium/targets/egl-static/egl.c [new file with mode: 0644]
src/gallium/targets/egl-static/egl_pipe.c [new file with mode: 0644]
src/gallium/targets/egl-static/egl_pipe.h [new file with mode: 0644]
src/gallium/targets/egl-static/egl_st.c [new file with mode: 0644]
src/gallium/targets/egl-static/egl_st.h [new file with mode: 0644]
src/gallium/targets/egl/Makefile
src/gallium/targets/egl/egl.c
src/gallium/targets/egl/st_GLESv1_CM.c [deleted file]
src/gallium/targets/egl/st_GLESv2.c [deleted file]
src/gallium/targets/graw-null/graw_util.c
src/gallium/targets/libgl-gdi/libgl_gdi.c
src/gallium/targets/libgl-xlib/xlib.c
src/gallium/targets/xorg-vmwgfx/vmw_video.c
src/gallium/tests/graw/clear.c
src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/gs-test.c
src/gallium/tests/graw/quad-tex.c
src/gallium/tests/graw/shader-leak.c
src/gallium/tests/graw/tri-gs.c
src/gallium/tests/graw/tri-instanced.c
src/gallium/tests/graw/tri.c
src/gallium/tests/graw/vs-test.c
src/gallium/tests/python/retrace/interpreter.py
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c
src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
src/gallium/winsys/i915/drm/i915_drm_buffer.c
src/gallium/winsys/i915/drm/i915_drm_winsys.c
src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c
src/gallium/winsys/i915/sw/i915_sw_buffer.c
src/gallium/winsys/i915/sw/i915_sw_winsys.h
src/gallium/winsys/i965/drm/i965_drm_buffer.c
src/gallium/winsys/i965/xlib/xlib_i965.c
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
src/gallium/winsys/r600/drm/Makefile
src/gallium/winsys/r600/drm/SConscript
src/gallium/winsys/r600/drm/evergreen_hw_context.c
src/gallium/winsys/r600/drm/r600.c [deleted file]
src/gallium/winsys/r600/drm/r600_bo.c
src/gallium/winsys/r600/drm/r600_bomgr.c [new file with mode: 0644]
src/gallium/winsys/r600/drm/r600_drm.c
src/gallium/winsys/r600/drm/r600_hw_context.c
src/gallium/winsys/r600/drm/r600_priv.h
src/gallium/winsys/r600/drm/r600d.h
src/gallium/winsys/r600/drm/radeon_bo.c
src/gallium/winsys/r600/drm/radeon_bo_pb.c [deleted file]
src/gallium/winsys/r600/drm/radeon_pciid.c
src/gallium/winsys/radeon/drm/Makefile
src/gallium/winsys/radeon/drm/SConscript
src/gallium/winsys/radeon/drm/radeon_buffer.h [deleted file]
src/gallium/winsys/radeon/drm/radeon_drm.c [deleted file]
src/gallium/winsys/radeon/drm/radeon_drm.h [deleted file]
src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
src/gallium/winsys/radeon/drm/radeon_drm_buffer.h [new file with mode: 0644]
src/gallium/winsys/radeon/drm/radeon_drm_common.c [new file with mode: 0644]
src/gallium/winsys/radeon/drm/radeon_drm_cs.c [new file with mode: 0644]
src/gallium/winsys/radeon/drm/radeon_drm_cs.h [new file with mode: 0644]
src/gallium/winsys/radeon/drm/radeon_drm_public.h
src/gallium/winsys/radeon/drm/radeon_r300.c
src/gallium/winsys/radeon/drm/radeon_r300.h [deleted file]
src/gallium/winsys/radeon/drm/radeon_winsys.h
src/gallium/winsys/svga/drm/vmw_screen.c
src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
src/getopt/SConscript [new file with mode: 0644]
src/getopt/getopt.h [new file with mode: 0644]
src/getopt/getopt_long.c [new file with mode: 0644]
src/glsl/.gitignore
src/glsl/Makefile
src/glsl/SConscript
src/glsl/ast.h
src/glsl/ast_function.cpp
src/glsl/ast_to_hir.cpp
src/glsl/builtin_function.cpp [deleted file]
src/glsl/builtin_stubs.cpp [new file with mode: 0644]
src/glsl/builtin_types.h
src/glsl/builtins/ir/atan
src/glsl/builtins/ir/distance
src/glsl/builtins/ir/matrixCompMult
src/glsl/builtins/ir/modf
src/glsl/builtins/ir/noise2
src/glsl/builtins/ir/noise3
src/glsl/builtins/ir/noise4
src/glsl/builtins/ir/outerProduct
src/glsl/builtins/ir/refract
src/glsl/builtins/ir/smoothstep
src/glsl/builtins/ir/step
src/glsl/builtins/ir/transpose
src/glsl/builtins/tools/builtin_function.cpp [deleted file]
src/glsl/builtins/tools/generate_builtins.py
src/glsl/glcpp/glcpp-parse.c
src/glsl/glcpp/glcpp-parse.y
src/glsl/glcpp/tests/092-redefine-macro-error-2.c [new file with mode: 0644]
src/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected [new file with mode: 0644]
src/glsl/glcpp/tests/093-divide-by-zero.c [new file with mode: 0644]
src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c [new file with mode: 0644]
src/glsl/glcpp/tests/095-recursive-define.c [new file with mode: 0644]
src/glsl/glsl_lexer.cpp
src/glsl/glsl_lexer.lpp
src/glsl/glsl_parser.cpp
src/glsl/glsl_parser.h
src/glsl/glsl_parser.ypp
src/glsl/glsl_parser_extras.cpp
src/glsl/glsl_parser_extras.h
src/glsl/glsl_symbol_table.cpp
src/glsl/glsl_symbol_table.h
src/glsl/glsl_types.cpp
src/glsl/glsl_types.h
src/glsl/ir.cpp
src/glsl/ir.h
src/glsl/ir_clone.cpp
src/glsl/ir_function_can_inline.cpp
src/glsl/ir_import_prototypes.cpp
src/glsl/ir_optimization.h
src/glsl/ir_print_visitor.cpp
src/glsl/ir_reader.cpp
src/glsl/ir_set_program_inouts.cpp
src/glsl/ir_variable.cpp
src/glsl/link_functions.cpp
src/glsl/linker.cpp
src/glsl/loop_unroll.cpp
src/glsl/lower_discard.cpp [new file with mode: 0644]
src/glsl/lower_if_to_cond_assign.cpp
src/glsl/lower_instructions.cpp
src/glsl/lower_jumps.cpp
src/glsl/lower_variable_index_to_cond_assign.cpp
src/glsl/main.cpp
src/glsl/opt_algebraic.cpp
src/glsl/opt_discard_simplification.cpp [new file with mode: 0644]
src/glsl/s_expression.cpp
src/glsl/s_expression.h
src/glsl/strtod.c [new file with mode: 0644]
src/glsl/strtod.h [new file with mode: 0644]
src/glx/dri2_glx.c
src/glx/indirect.c
src/glx/indirect_size.c
src/glx/indirect_size.h
src/mapi/es1api/Makefile
src/mapi/glapi/Makefile
src/mapi/glapi/SConscript
src/mapi/glapi/gen/ARB_ES2_compatibility.xml [new file with mode: 0644]
src/mapi/glapi/gen/Makefile
src/mapi/glapi/gen/gl_API.xml
src/mapi/glapi/gen/gl_x86-64_asm.py
src/mapi/glapi/gen/gl_x86_asm.py
src/mapi/glapi/glapi.c [new file with mode: 0644]
src/mapi/glapi/glapi_getproc.c
src/mapi/glapi/glapi_sparc.S
src/mapi/glapi/glapi_x86-64.S
src/mapi/glapi/glapi_x86.S
src/mapi/glapi/glapitable.h
src/mapi/glapi/glapitemp.h
src/mapi/glapi/glprocs.h
src/mapi/glapi/sources.mak
src/mapi/mapi/entry.c
src/mapi/mapi/entry.h
src/mapi/mapi/entry_x86-64_tls.h
src/mapi/mapi/entry_x86_tls.h
src/mapi/mapi/entry_x86_tsd.h
src/mapi/mapi/mapi.c
src/mapi/mapi/mapi_abi.py
src/mapi/mapi/mapi_tmp.h
src/mapi/mapi/sources.mak
src/mapi/mapi/stub.c
src/mapi/mapi/stub.h
src/mapi/mapi/table.c
src/mapi/mapi/table.h
src/mapi/mapi/u_current.c
src/mapi/mapi/u_current.h
src/mapi/mapi/u_thread.c
src/mapi/mapi/u_thread.h
src/mapi/vgapi/Makefile
src/mapi/vgapi/SConscript
src/mapi/vgapi/vgapi.csv
src/mapi/vgapi/vgapi_defines.h [deleted file]
src/mesa/Makefile
src/mesa/SConscript
src/mesa/drivers/common/meta.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/spantmp2.h
src/mesa/drivers/dri/i915/i830_reg.h
src/mesa/drivers/dri/i915/i830_texstate.c
src/mesa/drivers/dri/i915/i830_vtbl.c
src/mesa/drivers/dri/i915/i915_context.c
src/mesa/drivers/dri/i915/i915_fragprog.c
src/mesa/drivers/dri/i915/i915_texstate.c
src/mesa/drivers/dri/i915/i915_vtbl.c
src/mesa/drivers/dri/i965/Makefile
src/mesa/drivers/dri/i965/brw_cc.c
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_curbe.c
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_disasm.c
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/brw_eu.c
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_emit.c
src/mesa/drivers/dri/i965/brw_fallback.c
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_queryobj.c
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_state_batch.c
src/mesa/drivers/dri/i965/brw_state_cache.c
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/brw_structs.h
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_vs.h
src/mesa/drivers/dri/i965/brw_vs_emit.c
src/mesa/drivers/dri/i965/brw_vs_surface_state.c
src/mesa/drivers/dri/i965/brw_vtbl.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/drivers/dri/i965/brw_wm_emit.c
src/mesa/drivers/dri/i965/brw_wm_fp.c
src/mesa/drivers/dri/i965/brw_wm_glsl.c [deleted file]
src/mesa/drivers/dri/i965/brw_wm_iz.c
src/mesa/drivers/dri/i965/brw_wm_pass0.c
src/mesa/drivers/dri/i965/brw_wm_pass1.c
src/mesa/drivers/dri/i965/brw_wm_pass2.c
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
src/mesa/drivers/dri/i965/brw_wm_state.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c
src/mesa/drivers/dri/i965/gen6_cc.c
src/mesa/drivers/dri/i965/gen6_clip_state.c
src/mesa/drivers/dri/i965/gen6_gs_state.c
src/mesa/drivers/dri/i965/gen6_sampler_state.c
src/mesa/drivers/dri/i965/gen6_scissor_state.c
src/mesa/drivers/dri/i965/gen6_sf_state.c
src/mesa/drivers/dri/i965/gen6_urb.c
src/mesa/drivers/dri/i965/gen6_viewport_state.c
src/mesa/drivers/dri/i965/gen6_vs_state.c
src/mesa/drivers/dri/i965/gen6_wm_state.c
src/mesa/drivers/dri/intel/intel_batchbuffer.c
src/mesa/drivers/dri/intel/intel_batchbuffer.h
src/mesa/drivers/dri/intel/intel_blit.c
src/mesa/drivers/dri/intel/intel_blit.h
src/mesa/drivers/dri/intel/intel_buffer_objects.c
src/mesa/drivers/dri/intel/intel_clear.c
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_context.h
src/mesa/drivers/dri/intel/intel_extensions.c
src/mesa/drivers/dri/intel/intel_extensions_es2.c
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.h
src/mesa/drivers/dri/intel/intel_reg.h
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/intel/intel_span.c
src/mesa/drivers/dri/intel/intel_span.h
src/mesa/drivers/dri/intel/intel_tex.c
src/mesa/drivers/dri/intel/intel_tex.h
src/mesa/drivers/dri/intel/intel_tex_copy.c
src/mesa/drivers/dri/intel/intel_tex_format.c
src/mesa/drivers/dri/intel/intel_tex_image.c
src/mesa/drivers/dri/intel/intel_tex_obj.h
src/mesa/drivers/dri/intel/intel_tex_validate.c
src/mesa/drivers/dri/mach64/mach64_context.h
src/mesa/drivers/dri/nouveau/nouveau_driver.c
src/mesa/drivers/dri/nouveau/nouveau_driver.h
src/mesa/drivers/dri/nouveau/nouveau_fbo.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r200/r200_maos_arrays.c
src/mesa/drivers/dri/r200/r200_tex.c
src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
src/mesa/drivers/dri/r300/compiler/radeon_compiler_util.c
src/mesa/drivers/dri/r300/compiler/radeon_compiler_util.h
src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c
src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c
src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h
src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
src/mesa/drivers/dri/r300/compiler/radeon_program.c
src/mesa/drivers/dri/r300/compiler/radeon_program.h
src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c
src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_tex.c
src/mesa/drivers/dri/r600/evergreen_blit.c
src/mesa/drivers/dri/r600/evergreen_state.c
src/mesa/drivers/dri/r600/r600_context.c
src/mesa/drivers/dri/r600/r600_tex.c
src/mesa/drivers/dri/r600/r700_assembler.c
src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h
src/mesa/drivers/dri/radeon/radeon_chipset.h
src/mesa/drivers/dri/radeon/radeon_common_context.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_fbo.c
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_tex.c
src/mesa/drivers/dri/radeon/radeon_texture.c
src/mesa/drivers/dri/radeon/radeon_texture.h
src/mesa/drivers/dri/sis/server/sis_dri.h
src/mesa/drivers/dri/tdfx/tdfx_context.h
src/mesa/drivers/dri/unichrome/server/via_dri.h
src/mesa/drivers/osmesa/osmesa.c
src/mesa/drivers/windows/gdi/InitCritSections.cpp
src/mesa/drivers/x11/glxheader.h
src/mesa/drivers/x11/xm_api.c
src/mesa/drivers/x11/xm_buffer.c
src/mesa/drivers/x11/xm_dd.c
src/mesa/drivers/x11/xm_glide.c
src/mesa/drivers/x11/xm_image.c
src/mesa/drivers/x11/xm_line.c
src/mesa/drivers/x11/xm_span.c
src/mesa/drivers/x11/xmesa.h
src/mesa/drivers/x11/xmesaP.h
src/mesa/gl.pc.in
src/mesa/main/APIspec.xml
src/mesa/main/accum.c
src/mesa/main/api_arrayelt.c
src/mesa/main/api_arrayelt.h
src/mesa/main/api_exec.c
src/mesa/main/api_noop.c
src/mesa/main/api_noop.h
src/mesa/main/arrayobj.c
src/mesa/main/atifragshader.c
src/mesa/main/attrib.c
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h
src/mesa/main/buffers.c
src/mesa/main/clear.c
src/mesa/main/colormac.h
src/mesa/main/colortab.c
src/mesa/main/compiler.h
src/mesa/main/condrender.c
src/mesa/main/config.h
src/mesa/main/context.c
src/mesa/main/convolve.c
src/mesa/main/cpuinfo.c
src/mesa/main/depth.c
src/mesa/main/depth.h
src/mesa/main/dlist.h
src/mesa/main/drawpix.c
src/mesa/main/drawtex.c
src/mesa/main/enable.c
src/mesa/main/enums.c
src/mesa/main/eval.c
src/mesa/main/eval.h
src/mesa/main/extensions.c
src/mesa/main/fbobject.c
src/mesa/main/fbobject.h
src/mesa/main/feedback.c
src/mesa/main/feedback.h
src/mesa/main/ffvertex_prog.c
src/mesa/main/formats.c
src/mesa/main/formats.h
src/mesa/main/framebuffer.c
src/mesa/main/framebuffer.h
src/mesa/main/get.c
src/mesa/main/getstring.c
src/mesa/main/glapidispatch.h
src/mesa/main/hint.c
src/mesa/main/histogram.c
src/mesa/main/image.c
src/mesa/main/imports.c
src/mesa/main/matrix.c
src/mesa/main/mipmap.c
src/mesa/main/mtypes.h
src/mesa/main/multisample.c
src/mesa/main/nvprogram.c
src/mesa/main/pack.c
src/mesa/main/pack.h
src/mesa/main/pixel.c
src/mesa/main/pixelstore.c
src/mesa/main/pixeltransfer.c
src/mesa/main/queryobj.c
src/mesa/main/queryobj.h
src/mesa/main/rastpos.c
src/mesa/main/readpix.c
src/mesa/main/remap_helper.h
src/mesa/main/renderbuffer.c
src/mesa/main/renderbuffer.h
src/mesa/main/scissor.c
src/mesa/main/shaderapi.c
src/mesa/main/shaderobj.c
src/mesa/main/shared.c
src/mesa/main/syncobj.c
src/mesa/main/texcompress.c
src/mesa/main/texcompress.h
src/mesa/main/texcompress_fxt1.c
src/mesa/main/texcompress_fxt1.h
src/mesa/main/texcompress_s3tc.c
src/mesa/main/texcompress_s3tc.h
src/mesa/main/texenv.c
src/mesa/main/texenvprogram.c
src/mesa/main/texenvprogram.h
src/mesa/main/texfetch.c
src/mesa/main/texfetch.h
src/mesa/main/texfetch_tmp.h
src/mesa/main/texformat.c
src/mesa/main/texformat.h
src/mesa/main/texgen.c
src/mesa/main/texgen.h
src/mesa/main/texgetimage.c
src/mesa/main/texgetimage.h
src/mesa/main/teximage.c
src/mesa/main/teximage.h
src/mesa/main/texobj.c
src/mesa/main/texobj.h
src/mesa/main/texpal.c
src/mesa/main/texparam.c
src/mesa/main/texrender.c
src/mesa/main/texrender.h
src/mesa/main/texstore.c
src/mesa/main/transformfeedback.c
src/mesa/main/transformfeedback.h
src/mesa/main/uniforms.c
src/mesa/main/varray.c
src/mesa/main/varray.h
src/mesa/main/version.c
src/mesa/main/version.h
src/mesa/main/viewport.c
src/mesa/main/viewport.h
src/mesa/main/vtxfmt.c
src/mesa/main/vtxfmt.h
src/mesa/math/m_debug_clip.c
src/mesa/program/arbprogparse.h
src/mesa/program/ir_to_mesa.cpp
src/mesa/program/ir_to_mesa.h
src/mesa/program/nvfragparse.h
src/mesa/program/nvvertparse.h
src/mesa/program/prog_cache.h
src/mesa/program/prog_execute.c
src/mesa/program/prog_instruction.h
src/mesa/program/prog_optimize.h
src/mesa/program/prog_statevars.c
src/mesa/program/prog_statevars.h
src/mesa/program/program.c
src/mesa/program/symbol_table.c
src/mesa/program/symbol_table.h
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom_constbuf.c
src/mesa/state_tracker/st_atom_framebuffer.c
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_cb_accum.c
src/mesa/state_tracker/st_cb_accum.h
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_bitmap.h
src/mesa/state_tracker/st_cb_blit.c
src/mesa/state_tracker/st_cb_blit.h
src/mesa/state_tracker/st_cb_bufferobjects.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_drawpixels.h
src/mesa/state_tracker/st_cb_drawtex.c
src/mesa/state_tracker/st_cb_drawtex.h
src/mesa/state_tracker/st_cb_eglimage.c
src/mesa/state_tracker/st_cb_eglimage.h
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_feedback.c
src/mesa/state_tracker/st_cb_feedback.h
src/mesa/state_tracker/st_cb_program.c
src/mesa/state_tracker/st_cb_program.h
src/mesa/state_tracker/st_cb_queryobj.c
src/mesa/state_tracker/st_cb_queryobj.h
src/mesa/state_tracker/st_cb_rasterpos.c
src/mesa/state_tracker/st_cb_rasterpos.h
src/mesa/state_tracker/st_cb_readpixels.c
src/mesa/state_tracker/st_cb_readpixels.h
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_cb_texture.h
src/mesa/state_tracker/st_cb_xformfb.c
src/mesa/state_tracker/st_cb_xformfb.h
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h
src/mesa/state_tracker/st_debug.c
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_draw.h
src/mesa/state_tracker/st_draw_feedback.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_format.c
src/mesa/state_tracker/st_format.h
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/state_tracker/st_gen_mipmap.h
src/mesa/state_tracker/st_manager.c
src/mesa/state_tracker/st_mesa_to_tgsi.c
src/mesa/state_tracker/st_mesa_to_tgsi.h
src/mesa/state_tracker/st_program.c
src/mesa/state_tracker/st_program.h
src/mesa/state_tracker/st_texture.c
src/mesa/swrast/s_aaline.h
src/mesa/swrast/s_aatriangle.h
src/mesa/swrast/s_accum.h
src/mesa/swrast/s_alpha.h
src/mesa/swrast/s_atifragshader.h
src/mesa/swrast/s_blend.c
src/mesa/swrast/s_blend.h
src/mesa/swrast/s_depth.h
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_fog.h
src/mesa/swrast/s_fragprog.h
src/mesa/swrast/s_logic.h
src/mesa/swrast/s_masking.h
src/mesa/swrast/s_readpix.c
src/mesa/swrast/s_span.h
src/mesa/swrast/s_texcombine.c
src/mesa/swrast/s_texcombine.h
src/mesa/swrast/s_texfilter.c
src/mesa/swrast/s_texfilter.h
src/mesa/swrast/s_triangle.c
src/mesa/swrast_setup/ss_triangle.h
src/mesa/swrast_setup/ss_vb.h
src/mesa/tnl/t_vb_program.c
src/mesa/tnl/t_vertex.h
src/mesa/tnl/t_vp_build.c
src/mesa/tnl/t_vp_build.h
src/mesa/tnl/tnl.h
src/mesa/vbo/vbo.h
src/mesa/vbo/vbo_context.c
src/mesa/vbo/vbo_context.h
src/mesa/vbo/vbo_exec.h
src/mesa/vbo/vbo_exec_api.c
src/mesa/vbo/vbo_exec_draw.c
src/mesa/vbo/vbo_save.c
src/mesa/vbo/vbo_save.h
src/mesa/vbo/vbo_save_api.c
src/mesa/vbo/vbo_save_draw.c
src/mesa/vbo/vbo_save_loopback.c
src/mesa/x86/mmx.h

index 30269194f4bde7e1d6a203d1e012bbc045c680c1..1bab521c599ab4510410a6a69e060ccf649366b1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -180,7 +180,7 @@ ultrix-gcc:
 
 # Rules for making release tarballs
 
-VERSION=7.10-devel
+VERSION=7.11-devel
 DIRECTORY = Mesa-$(VERSION)
 LIB_NAME = MesaLib-$(VERSION)
 GLUT_NAME = MesaGLUT-$(VERSION)
index c6198041fb0cff49b695423ac5eaece4fe2217ab..368ad83edf3f552bf837c9368784370c8e885d92 100644 (file)
@@ -32,7 +32,6 @@ import common
 
 opts = Variables('config.py')
 common.AddOptions(opts)
-opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
 
 env = Environment(
        options = opts,
@@ -119,6 +118,39 @@ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
 Export('env')
 
 
+#######################################################################
+# Invoke host SConscripts 
+# 
+# For things that are meant to be run on the native host build machine, instead
+# of the target machine.
+#
+
+# Create host environent
+if env['platform'] != common.host_platform:
+    host_env = Environment(
+        options = opts,
+        # no tool used
+        tools = [],
+        toolpath = ['#scons'],
+        ENV = os.environ,
+    )
+
+    # Override options
+    host_env['platform'] = common.host_platform
+    host_env['machine'] = common.host_machine
+    host_env['toolchain'] = 'default'
+    host_env['llvm'] = False
+
+    host_env.Tool('gallium')
+
+    SConscript(
+        'src/glsl/SConscript',
+        variant_dir = host_env['build_dir'],
+        duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
+        exports={'env':host_env},
+    )
+
+
 #######################################################################
 # Invoke SConscripts
 
index 2f9223ff3c1c94c6690baedc88e245b101acd03d..a511375e20e96ccb3e12732d06f24f43d81f6d41 100755 (executable)
--- a/bin/mklib
+++ b/bin/mklib
@@ -307,7 +307,7 @@ fi
 #
 case $ARCH in
 
-    'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*)
+    'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/* | 'NetBSD')
        # we assume gcc
 
        if [ "x$LINK" = "x" ] ; then
@@ -574,20 +574,6 @@ case $ARCH in
        fi
        ;;
 
-    'NetBSD')
-        if [ $STATIC = 1 ] ; then
-           LIBNAME="lib${LIBNAME}_pic.a"
-           echo "mklib: Making NetBSD PIC static library: " ${LIBNAME}
-           FINAL_LIBS=`make_ar_static_lib cq 1 ${LIBNAME} ${OBJECTS}`
-       else
-           LIBNAME="lib${LIBNAME}.so.${MAJOR}.${MINOR}"
-           echo "mklib: Making NetBSD PIC shared library: " ${LIBNAME}
-           rm -f ${LIBNAME}
-           ld -x -Bshareable -Bforcearchive -o ${LIBNAME} ${OBJECTS}
-           FINAL_LIBS=${LIBNAME}
-       fi
-       ;;
-
     'IRIX' | 'IRIX64')
         if [ $STATIC = 1 ] ; then
            LIBNAME="lib${LIBNAME}.a"
index b7749c925dfc3db0d7734cdd0462edc5016e15bd..76184d577a3433231885a10755ab4f0b73905e0d 100644 (file)
--- a/common.py
+++ b/common.py
@@ -19,17 +19,17 @@ _platform_map = {
        'win32': 'windows',
 }
 
-default_platform = sys.platform
-default_platform = _platform_map.get(default_platform, default_platform)
+host_platform = sys.platform
+host_platform = _platform_map.get(host_platform, host_platform)
 
 # Search sys.argv[] for a "platform=foo" argument since we don't have
 # an 'env' variable at this point.
 if 'platform' in SCons.Script.ARGUMENTS:
-    selected_platform = SCons.Script.ARGUMENTS['platform']
+    target_platform = SCons.Script.ARGUMENTS['platform']
 else:
-    selected_platform = default_platform
+    target_platform = host_platform
 
-cross_compiling = selected_platform != default_platform
+cross_compiling = target_platform != host_platform
 
 _machine_map = {
        'x86': 'x86',
@@ -42,15 +42,17 @@ _machine_map = {
 }
 
 
-# find default_machine value
+# find host_machine value
 if 'PROCESSOR_ARCHITECTURE' in os.environ:
-       default_machine = os.environ['PROCESSOR_ARCHITECTURE']
+       host_machine = os.environ['PROCESSOR_ARCHITECTURE']
 else:
-       default_machine = _platform.machine()
-default_machine = _machine_map.get(default_machine, 'generic')
+       host_machine = _platform.machine()
+host_machine = _machine_map.get(host_machine, 'generic')
+
+default_machine = host_machine
 default_toolchain = 'default'
 
-if selected_platform == 'windows' and cross_compiling:
+if target_platform == 'windows' and cross_compiling:
     default_machine = 'x86'
     default_toolchain = 'crossmingw'
 
@@ -61,7 +63,7 @@ if 'LLVM' in os.environ:
 else:
     default_llvm = 'no'
     try:
-        if selected_platform != 'windows' and \
+        if target_platform != 'windows' and \
            subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
             default_llvm = 'yes'
     except:
@@ -85,9 +87,10 @@ def AddOptions(opts):
        opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
        opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
                                                                                         allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
-       opts.Add(EnumOption('platform', 'target platform', default_platform,
+       opts.Add(EnumOption('platform', 'target platform', host_platform,
                                                                                         allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos5', 'freebsd8')))
        opts.Add('toolchain', 'compiler toolchain', default_toolchain)
        opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
        opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
        opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
+       opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
index e2d70c63a12084deafd3843e4caaa643b7eb18a8..ff5ea6f86270f670e4ea7ea5a0e7cfb6e5c65ec1 100644 (file)
@@ -15,7 +15,6 @@ ASM_FLAGS = @ASM_FLAGS@
 PIC_FLAGS = @PIC_FLAGS@
 DEFINES = @DEFINES@
 API_DEFINES = @API_DEFINES@
-GLES_OVERLAY = @GLES_OVERLAY@
 CFLAGS = @CPPFLAGS@ @CFLAGS@ \
        $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
 CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
@@ -33,6 +32,7 @@ LLVM_LDFLAGS = @LLVM_LDFLAGS@
 LLVM_LIBS = @LLVM_LIBS@
 GLW_CFLAGS = @GLW_CFLAGS@
 GLUT_CFLAGS = @GLUT_CFLAGS@
+GLX_TLS = @GLX_TLS@
 
 TALLOC_LIBS = @TALLOC_LIBS@
 TALLOC_CFLAGS = @TALLOC_CFLAGS@
index 0301345b1fc0a0200228f01fa83417427a10f23b..b96941527875aa9760fd4bf8aee0e833bc297dc5 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_NAME = default
 
 # Version info
 MESA_MAJOR=7
-MESA_MINOR=10
+MESA_MINOR=11
 MESA_TINY=0
 MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
 
@@ -25,6 +25,7 @@ CXXFLAGS = -O
 LDFLAGS =
 HOST_CFLAGS = $(CFLAGS)
 GLU_CFLAGS = 
+GLX_TLS = no
 
 # Compiler for building demos/tests/etc
 APP_CC = $(CC)
@@ -107,7 +108,7 @@ EGL_DRIVERS_DIRS = glx
 # Gallium directories and 
 GALLIUM_DIRS = auxiliary drivers state_trackers
 GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
-GALLIUM_DRIVERS_DIRS = softpipe trace rbug identity galahad i915 i965 svga r300 nvfx nv50 failover
+GALLIUM_DRIVERS_DIRS = softpipe trace rbug noop identity galahad i915 i965 svga r300 nvfx nv50 failover
 GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
 GALLIUM_WINSYS_DIRS = sw sw/xlib
 GALLIUM_TARGET_DIRS = libgl-xlib
index 6aa434032dc46368a9069d784bcf2ae1f3bdb222..22de0662ee1b235708801efbe746422ff4ddf340 100644 (file)
@@ -15,7 +15,7 @@ ARCH_FLAGS = -mmmx -msse -msse2 -mstackrealign
 DEFINES += -DNDEBUG -DGALLIUM_LLVMPIPE -DHAVE_UDIS86
 
 # override -std=c99
-CFLAGS += -std=gnu99 -D__STDC_CONSTANT_MACROS
+CFLAGS += -std=gnu99
 
 LLVM_VERSION := $(shell llvm-config --version)
 
@@ -30,7 +30,7 @@ else
 endif
 
 ifeq ($(MESA_LLVM),1)
-#  LLVM_CFLAGS=`llvm-config --cflags`
+  LLVM_CFLAGS=`llvm-config --cppflags`
   LLVM_CXXFLAGS=`llvm-config --cxxflags backend bitreader engine ipo interpreter instrumentation` -Wno-long-long
   LLVM_LDFLAGS = $(shell llvm-config --ldflags backend bitreader engine ipo interpreter instrumentation)
   LLVM_LIBS = $(shell llvm-config --libs backend bitwriter bitreader engine ipo interpreter instrumentation)
index 77e7603520d3c4de739def1e631bdf4a126c475b..d9220c86b598ef26ee7eda65cccf9e1a5522cb9f 100644 (file)
@@ -18,11 +18,11 @@ AC_CONFIG_AUX_DIR([bin])
 AC_CANONICAL_HOST
 
 dnl Versions for external dependencies
-LIBDRM_REQUIRED=2.4.15
-LIBDRM_RADEON_REQUIRED=2.4.17
+LIBDRM_REQUIRED=2.4.23
+LIBDRM_RADEON_REQUIRED=2.4.23
 DRI2PROTO_REQUIRED=2.1
 GLPROTO_REQUIRED=1.4.11
-LIBDRM_XORG_REQUIRED=2.4.17
+LIBDRM_XORG_REQUIRED=2.4.23
 LIBKMS_XORG_REQUIRED=1.0.0
 
 dnl Check for progs
@@ -377,14 +377,14 @@ if test "x$enable_asm" = xyes; then
     case "$host_cpu" in
     i?86)
         case "$host_os" in
-        linux* | *freebsd* | dragonfly*)
+        linux* | *freebsd* | dragonfly* | *netbsd*)
             test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
             ;;
         esac
         ;;
     x86_64)
         case "$host_os" in
-        linux* | *freebsd* | dragonfly*)
+        linux* | *freebsd* | dragonfly* | *netbsd*)
             test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
             ;;
         esac
@@ -483,9 +483,9 @@ AC_ARG_ENABLE([gles2],
     [enable_gles2=no])
 AC_ARG_ENABLE([gles-overlay],
     [AS_HELP_STRING([--enable-gles-overlay],
-        [build separate OpenGL ES only libraries @<:@default=no@:>@])],
-    [enable_gles_overlay="$enableval"],
-    [enable_gles_overlay=no])
+        [DEPRECATED.  Same as --enable-gles1 and --enable-gles2])],
+    [enable_gles1="$enableval"; enable_gles2="$enableval"],
+    [])
 
 AC_ARG_ENABLE([openvg],
     [AS_HELP_STRING([--enable-openvg],
@@ -506,13 +506,11 @@ fi
 if test "x$enable_opengl" = xno -a \
         "x$enable_gles1" = xno -a \
         "x$enable_gles2" = xno -a \
-        "x$enable_gles_overlay" = xno -a \
         "x$enable_openvg" = xno; then
     AC_MSG_ERROR([at least one API should be enabled])
 fi
 
 API_DEFINES=""
-GLES_OVERLAY=0
 if test "x$enable_opengl" = xno; then
     API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
 else
@@ -524,11 +522,7 @@ fi
 if test "x$enable_gles2" = xyes; then
     API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
 fi
-if test "x$enable_gles_overlay" = xyes; then
-    GLES_OVERLAY=1
-fi
 AC_SUBST([API_DEFINES])
-AC_SUBST([GLES_OVERLAY])
 
 dnl
 dnl Driver configuration. Options are xlib, dri and osmesa right now.
@@ -542,7 +536,7 @@ linux*)
     i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
     esac
     ;;
-*freebsd* | dragonfly*)
+*freebsd* | dragonfly* | *netbsd*)
     case "$host_cpu" in
     i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
     esac
@@ -588,7 +582,7 @@ GLU_DIRS="sgi"
 GALLIUM_DIRS="auxiliary drivers state_trackers"
 GALLIUM_TARGET_DIRS=""
 GALLIUM_WINSYS_DIRS="sw"
-GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug identity"
+GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug noop identity"
 GALLIUM_STATE_TRACKERS_DIRS=""
 
 # build glapi if OpenGL is enabled
@@ -596,12 +590,15 @@ if test "x$enable_opengl" = xyes; then
     CORE_DIRS="$CORE_DIRS mapi/glapi"
 fi
 
-# build es1api and es2api if OpenGL ES is enabled
-case "x$enable_gles1$enable_gles2$enable_gles_overlay" in
-x*yes*)
-    CORE_DIRS="$CORE_DIRS mapi/es1api mapi/es2api"
-    ;;
-esac
+# build es1api if OpenGL ES 1.x is enabled
+if test "x$enable_gles1" = xyes; then
+    CORE_DIRS="$CORE_DIRS mapi/es1api"
+fi
+
+# build es2api if OpenGL ES 2.x is enabled
+if test "x$enable_gles2" = xyes; then
+    CORE_DIRS="$CORE_DIRS mapi/es2api"
+fi
 
 # build vgapi if OpenVG is enabled
 if test "x$enable_openvg" = xyes; then
@@ -609,7 +606,7 @@ if test "x$enable_openvg" = xyes; then
 fi
 
 # build glsl and mesa if OpenGL or OpenGL ES is enabled
-case "x$enable_opengl$enable_gles1$enable_gles2$enable_gles_overlay" in
+case "x$enable_opengl$enable_gles1$enable_gles2" in
 x*yes*)
     CORE_DIRS="$CORE_DIRS glsl mesa"
     ;;
@@ -811,13 +808,19 @@ if test "$mesa_driver" = xlib; then
 fi
 
 dnl
-dnl More DRI setup
+dnl TLS detection
 dnl
+
 AC_ARG_ENABLE([glx-tls],
     [AS_HELP_STRING([--enable-glx-tls],
         [enable TLS support in GLX @<:@default=disabled@:>@])],
     [GLX_USE_TLS="$enableval"],
     [GLX_USE_TLS=no])
+AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
+
+dnl
+dnl More DRI setup
+dnl
 dnl Directory for DRI drivers
 AC_ARG_WITH([dri-driverdir],
     [AS_HELP_STRING([--with-dri-driverdir=DIR],
@@ -909,16 +912,13 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
             ;;
         esac
         ;;
-    freebsd* | dragonfly*)
+    freebsd* | dragonfly* | *netbsd*)
         DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
         DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
         DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
         if test "x$driglx_direct" = xyes; then
             DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
         fi
-        if test "x$GXX" = xyes; then
-            CXXFLAGS="$CXXFLAGS -ansi -pedantic"
-        fi
 
         if test "x$DRI_DIRS" = "xyes"; then
             DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
@@ -972,7 +972,7 @@ AC_SUBST([DRI_LIB_DEPS])
 
 case $DRI_DIRS in
 *i915*|*i965*)
-    PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.21])
+    PKG_CHECK_MODULES([INTEL], [libdrm_intel >= 2.4.23])
     ;;
 esac
 
@@ -1352,7 +1352,7 @@ if test "x$enable_gallium_egl" = xauto; then
         enable_gallium_egl=$enable_egl
         ;;
     *)
-        enable_gallium_egl=no
+        enable_gallium_egl=$enable_openvg
         ;;
     esac
 fi
@@ -1454,9 +1454,6 @@ x*yes*)
     EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
     ;;
 esac
-if test "x$enable_gles_overlay" = xyes; then
-    EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
-fi
 if test "x$enable_openvg" = xyes; then
     EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
     VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
@@ -1467,10 +1464,6 @@ AC_SUBST([EGL_CLIENT_APIS])
 
 if test "x$HAVE_ST_EGL" = xyes; then
        GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
-       # define GLX_DIRECT_RENDERING even when the driver is not dri
-       if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
-            DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
-       fi
 fi
 
 if test "x$HAVE_ST_XORG" = xyes; then
@@ -1558,7 +1551,7 @@ AC_ARG_ENABLE([gallium-llvm],
 if test "x$enable_gallium_llvm" = xyes; then
     if test "x$LLVM_CONFIG" != xno; then
        LLVM_VERSION=`$LLVM_CONFIG --version`
-       LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
+       LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
        LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
 
        if test "x$HAS_UDIS86" != xno; then
@@ -1690,7 +1683,7 @@ AC_ARG_ENABLE([gallium-nouveau],
     [enable_gallium_nouveau="$enableval"],
     [enable_gallium_nouveau=no])
 if test "x$enable_gallium_nouveau" = xyes; then
-    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
+    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
     gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
 fi
 
@@ -1708,19 +1701,6 @@ if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xau
     fi
 fi
 
-dnl
-dnl Gallium noop configuration
-dnl
-AC_ARG_ENABLE([gallium-noop],
-    [AS_HELP_STRING([--enable-gallium-noop],
-        [build gallium radeon @<:@default=disabled@:>@])],
-    [enable_gallium_noop="$enableval"],
-    [enable_gallium_noop=auto])
-if test "x$enable_gallium_noop" = xyes; then
-    GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS noop"
-    GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-noop"
-fi
-
 dnl prepend CORE_DIRS to SRC_DIRS
 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
 
@@ -1753,7 +1733,6 @@ echo "        includedir:      $includedir"
 dnl API info
 echo ""
 echo "        OpenGL:          $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
-echo "        GLES overlay:    $enable_gles_overlay"
 echo "        OpenVG:          $enable_openvg"
 
 dnl Driver info
@@ -1790,7 +1769,7 @@ if test "$enable_egl" = yes; then
 
     egl_drivers=""
     for d in $EGL_DRIVERS_DIRS; do
-        egl_drivers="$egl_drivers egl_$d"
+        egl_drivers="$egl_drivers builtin:egl_$d"
     done
 
     if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
index fb22739b6c7c779fe18bc8d4fa2a29b776063a51..9106f439a17b7cb9a4ecb6983e6ec84a10eaf8be 100644 (file)
@@ -71,7 +71,7 @@ GL 3.3:
 GLSL 3.30                                             not started
 GL_ARB_blend_func_extended                            not started
 GL_ARB_explicit_attrib_location                       DONE (swrast, i915, i965)
-GL_ARB_occlusion_query2                               not started
+GL_ARB_occlusion_query2                               DONE (swrast, gallium)
 GL_ARB_sampler_objects                                not started
 GL_ARB_texture_rgb10_a2ui                             not started
 GL_ARB_texture_swizzle                                DONE (same as EXT version)
index 118501c3d3e833029d9bb48627ba92347be3ffd2..c9853a7fd0f1dd6e4a77453666b351d4b47f836c 100644 (file)
@@ -83,7 +83,7 @@ Additions to the EGL 1.4 Specification:
         EGLImageKHR eglCreateDRMImageMESA(EGLDisplay dpy,
                                           const EGLint *attrib_list);
 
-    In the attribute list, pass EGL_WIDTH, EGL_EIGHT and format and
+    In the attribute list, pass EGL_WIDTH, EGL_HEIGHT and format and
     use in the attrib list using EGL_DRM_BUFFER_FORMAT_MESA and
     EGL_DRM_BUFFER_USE_MESA.  The only format specified by this
     extension is EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, where each pixel
index ee9bf355d7c5f50e229b63425e4942d8a23366bc..fb15086679f5ba6310d063caa32fbe45e9060a68 100644 (file)
@@ -19,10 +19,7 @@ API entry points and helper functions for use by the drivers.  Drivers are
 dynamically loaded by the main library and most of the EGL API calls are
 directly dispatched to the drivers.</p>
 
-<p>The driver in use decides the window system to support.  For drivers that
-support hardware rendering, there are usually multiple drivers supporting the
-same window system.  Each one of of them supports a certain range of graphics
-cards.</p>
+<p>The driver in use decides the window system to support.</p>
 
 <h2>Build EGL</h2>
 
@@ -86,16 +83,8 @@ select the right platforms automatically.</p>
 
 <li><code>--enable-gles1</code> and <code>--enable-gles2</code>
 
-<p>These options enable OpenGL ES support in OpenGL.  The result is
-one big library that supports multiple APIs.</p>
-
-</li>
-
-<li><code>--enable-gles-overlay</code>
-
-<p>This option enables OpenGL ES as separate libraries.  This is an alternative
-approach to enable OpenGL ES.  It is only supported by
-<code>egl_gallium</code>.</p>
+<p>These options enable OpenGL ES support in OpenGL.  The result is one big
+internal library that supports multiple APIs.</p>
 
 </li>
 
@@ -134,13 +123,24 @@ colon-separated directories where the main library will look for drivers, in
 addition to the default directory.  This variable is ignored for setuid/setgid
 binaries.</p>
 
+<p>This variable is usually set to test an uninstalled build.  For example, one
+may set</p>
+
+<pre>
+  $ export LD_LIBRARY_PATH=$mesa/lib
+  $ export EGL_DRIVERS_PATH=$mesa/lib/egl
+</pre>
+
+<p>to test a build without installation</p>
+
 </li>
 
 <li><code>EGL_DRIVER</code>
 
-<p>This variable specifies a full path to an EGL driver and it forces the
-specified EGL driver to be loaded.  It comes in handy when one wants to test a
-specific driver.  This variable is ignored for setuid/setgid binaries.</p>
+<p>This variable specifies a full path to or the name of an EGL driver.  It
+forces the specified EGL driver to be loaded.  It comes in handy when one wants
+to test a specific driver.  This variable is ignored for setuid/setgid
+binaries.</p>
 
 </li>
 
@@ -180,8 +180,10 @@ variable to true forces the use of software rendering.</p>
 <li><code>egl_dri2</code>
 
 <p>This driver supports both <code>x11</code> and <code>drm</code> platforms.
-It functions as a DRI2 driver loader.  For <code>x11</code> support, it talks
-to the X server directly using (XCB-)DRI2 protocol.</p>
+It functions as a DRI driver loader.  For <code>x11</code> support, it talks to
+the X server directly using (XCB-)DRI2 protocol.</p>
+
+<p>This driver can share DRI drivers with <code>libGL</code>.</p>
 
 </li>
 
@@ -191,6 +193,10 @@ to the X server directly using (XCB-)DRI2 protocol.</p>
 hardwares supported by Gallium3D.  It is the only driver that supports OpenVG.
 The supported platforms are X11, DRM, FBDEV, and GDI.</p>
 
+<p>This driver comes with its own hardware drivers
+(<code>pipe_&lt;hw&gt;</code>) and client API modules
+(<code>st_&lt;api&gt;</code>).</p>
+
 </li>
 
 <li><code>egl_glx</code>
@@ -202,6 +208,21 @@ is not available in GLX or GLX extensions.</p>
 </li>
 </ul>
 
+<h2>Packaging</h2>
+
+<p>The ABI between the main library and its drivers are not stable.  Nor is
+there a plan to stabilize it at the moment.  Of the EGL drivers,
+<code>egl_gallium</code> has its own hardware drivers and client API modules.
+They are considered internal to <code>egl_gallium</code> and there is also no
+stable ABI between them.  These should be kept in mind when packaging for
+distribution.</p>
+
+<p>Generally, <code>egl_dri2</code> is preferred over <code>egl_gallium</code>
+when the system already has DRI drivers.  As <code>egl_gallium</code> is loaded
+before <code>egl_dri2</code> when both are available, <code>egl_gallium</code>
+may either be disabled with <code>--disable-gallium-egl</code> or packaged
+separately.</p>
+
 <h2>Developers</h2>
 
 <p>The sources of the main library and the classic drivers can be found at
index 63cc1146a2edfe91420269e51be105daf70bd7ac..742182e76a3ff483e5b760377103f5a547717a6e 100644 (file)
@@ -17,7 +17,7 @@ target="_parent"> http://www.khronos.org/opengles/</a>.</p>
 
 <h2>Build the Libraries</h2>
 <ol>
-<li>Run <code>configure</code> with <code>--enable-gles-overlay</code> and enable the Gallium driver for your hardware.</li>
+<li>Run <code>configure</code> with <code>--enable-gles1 --enable-gles2</code> and enable the Gallium driver for your hardware.</li>
 <li>Build and install Mesa as usual.</li>
 </ol>
 
@@ -53,8 +53,6 @@ your build.  For example,</p>
        <tr><td>Library Name</td><td>Used By</td><td>Enabled</td><td>OpenGL</td><td>OpenGL ES 1.x</td><td>OpenGL ES 2.x</td></tr>
        <tr><td><code>libmesa.a</td><td>Classic DRI drivers</td><td>y</td><td>y</td><td>--enable-gles1</td><td>--enable-gles2</td></tr>
        <tr><td><code>libmesagallium.a</td><td>Gallium EGL and DRI drivers</td><td>y</td><td>y</td><td>--enable-gles1</td><td>--enable-gles2</td></tr>
-       <tr><td><code>libes1gallium.a</td><td>Gallium EGL drivers</td><td>--enable-gles-overlay</td><td>n</td><td>y</td><td>n</td></tr>
-       <tr><td><code>libes2gallium.a</td><td>Gallium EGL drivers</td><td>--enable-gles-overlay</td><td>n</td><td>n</td><td>y</td></tr>
 </table>
 
 <h3>Dispatch Table</h3>
index 1f5570d71d3ecf4a397efa5b6c90ee9cd279c24c..3f4f229b0527b9c5f0e90d623dc7e24ffc2b49a2 100644 (file)
@@ -1,14 +1,16 @@
 <HTML>
 
+<head>
 <TITLE>Mesa Release Notes</TITLE>
-
-<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+<link rel="stylesheet" type="text/css" href="mesa.css">
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+</head>
 
 <BODY>
 
 <body bgcolor="#eeeeee">
 
-<H1>Mesa 7.10 Release Notes / tbd</H1>
+<H1>Mesa 7.10 Release Notes / January 7, 2011</H1>
 
 <p>
 Mesa 7.10 is a new development release.
@@ -28,7 +30,12 @@ for DRI hardware acceleration.
 
 <h2>MD5 checksums</h2>
 <pre>
-tbd
+0a70c15c135561824bdcae92bf232e43  MesaLib-7.10.tar.gz
+33fb94eccc02cbb4d8d1365615e38e46  MesaLib-7.10.tar.bz2
+5cafdc0eda0f9bf370b95c98df3338fa  MesaLib-7.10.zip
+bc644be551ed585fc4f66c16b64a91c9  MesaGLUT-7.10.tar.gz
+5c2677a155672352d62b177e4f0f92e8  MesaGLUT-7.10.tar.bz2
+2ce5001f74496d1ba719ef74d910a5cf  MesaGLUT-7.10.zip
 </pre>
 
 
@@ -38,19 +45,2751 @@ tbd
 <li>GL_ARB_texture_rg (Intel, software drivers, gallium drivers).
 <li>GL_EXT_separate_shader_objects extension (Intel and software drivers).
 <li>GL_NV_primitive_restart extension (Gallium softpipe, llvmpipe).
+<li>New fragment shader back-end for i965-class hardware.
+<li>Support for Sandybridge chipset in i965 DRI driver.
 </ul>
 
 
 <h2>Bug fixes</h2>
+<p>This list is likely incomplete.</p>
 <ul>
-<li>tbd</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28800">Bug 28800</a> - [r300c, r300g] Texture corruption with World of Warcraft</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29420">Bug 29420</a> - Amnesia / HPL2 RendererFeatTest - not rendering correctly</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29946">Bug 29946</a> - [swrast] piglit valgrind glsl-array-bounds-04 fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30261">Bug 30261</a> - [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30632">Bug 30632</a> - [softpipe] state_tracker/st_manager.c:489: st_context_notify_invalid_framebuffer: Assertion `stfb &amp;&amp; stfb-&gt;iface == stfbi' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30694">Bug 30694</a> - wincopy will crash on Gallium drivers when going to front buffer</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30771">Bug 30771</a> -  [r600g] vert-tex glsl demo</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30787">Bug 30787</a> - Invalid asm shader does not generate draw-time error when used with GLSL shader</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30974">Bug 30974</a> - [llvmpipe] SIGABRT src/gallium/drivers/llvmpipe/lp_state_fs.c:779</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30993">Bug 30993</a> - getFramebufferAttachmentParameteriv wrongly generates error</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31101">Bug 31101</a> -  [glsl2] abort() in ir_validate::visit_enter(ir_assignment *ir)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31193">Bug 31193</a> -  [regression] aa43176e break water reflections</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31194">Bug 31194</a> - The mesa meta save/restore code doesn't ref the current GLSL program</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31371">Bug 31371</a> - glslparsertest: ir.cpp:358: ir_constant::ir_constant(const glsl_type*, const ir_constant_data*): Assertion `(type->base_type &gt;= 0) &amp;&amp; (type->base_type &lt;= 3)' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31439">Bug 31439</a> - Crash in glBufferSubData() with size == 0</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31495">Bug 31495</a> - [i965 gles2c bisected] OpenGL ES 2.0 conformance GL2Tests_GetBIFD_input.run regressed</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31514">Bug 31514</a> - isBuffer returns true for unbound buffers</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31560">Bug 31560</a> - [tdfx] tdfx_tex.c:702: error: â€˜const struct gl_color_table’ has no member named â€˜Format’</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31617">Bug 31617</a> - Radeon/Compiz: 'failed to attach dri2 front buffer', error case not handled</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31648">Bug 31648</a> -  [GLSL] array-struct-array gets assertion: `(size &gt;= 1) && (size &lt;= 4)' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31650">Bug 31650</a> - [GLSL] varying gl_TexCoord fails to be re-declared to different size in the second shader</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31673">Bug 31673</a> - GL_FRAGMENT_PRECISION_HIGH preprocessor macro undefined in GLSL ES</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31690">Bug 31690</a> -  i915 shader compiler fails to flatten if in Aquarium webgl demo.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31832">Bug 31832</a> - [i915] Bad renderbuffer format: 21</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31841">Bug 31841</a> - [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31894">Bug 31894</a> - Writing to gl_PointSize with GLES2 corrupts other varyings</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31909">Bug 31909</a> - [i965] brw_fs.cpp:1461: void fs_visitor::emit_bool_to_cond_code(ir_rvalue*): Assertion `expr-&gt;operands[i]-&gt;type-&gt;is_scalar()' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31934">Bug 31934</a> - [gallium] Mapping empty buffer object causes SIGSEGV</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31983">Bug 31983</a> -  [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31985">Bug 31985</a> - [GLSL 1.20] initialized uniform array considered as "unsized"</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31987">Bug 31987</a> - [gles2] if input a wrong pname(GL_NONE) to glGetBoolean, it will not case GL_INVALID_ENUM</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32035">Bug 32035</a> - [GLSL bisected] comparing unsized array gets segfault</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32070">Bug 32070</a> - llvmpipe renders stencil demo incorrectly</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32273">Bug 32273</a> - assertion fails when starting vdrift 2010 release with shaders enabled</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32287">Bug 32287</a> - [bisected GLSL] float-int failure</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32311">Bug 32311</a> - [965 bisected] Array look-ups broken on GM45</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32520">Bug 32520</a> -  [gles2] glBlendFunc(GL_ZERO, GL_DST_COLOR) will result in GL_INVALID_ENUM</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32825">Bug 32825</a> - egl_glx driver completely broken in 7.9 branch [fix in master]</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li>
+
 </ul>
 
 
 <h2>Changes</h2>
+<p>Adam Jackson (2):
 <ul>
-<li>Upgraded glext.h to version 66</li>
-</ul>
+  <li>i965: Update renderer strings for sandybridge</li>
+  <li>drivers/x11: unifdef XFree86Server</li>
+</ul></p>
+
+<p>Alex Deucher (30):
+<ul>
+  <li>r600c: fix mipmap stride on evergreen</li>
+  <li>r600c: add reloc for CB_COLOR0_ATTRIB</li>
+  <li>r600c: pull over 6xx/7xx vertex fixes for evergreen</li>
+  <li>r600c: fix segfault in evergreen stencil code</li>
+  <li>r100: revalidate after radeon_update_renderbuffers</li>
+  <li>r600c: add missing radeon_prepare_render() call on evergreen</li>
+  <li>r600c: properly align mipmaps to group size</li>
+  <li>egl_dri2: Add radeon chip ids</li>
+  <li>r600c/evergreen: texture align is group_bytes just like 6xx/7xx</li>
+  <li>r600g: fix buffer alignment</li>
+  <li>r600g: All EVENT_WRITE packets need the EVENT_INDEX field</li>
+  <li>r600g: translate ARR instruction for evergreen</li>
+  <li>r600g: use meaningful defines for chiprev</li>
+  <li>r600g: use full range of VS resources for vertex samplers</li>
+  <li>r600g: fix additional EVENT_WRITE packet</li>
+  <li>r600g: fix some winsys functions to deal properly with evergreen</li>
+  <li>r600c: add Ontario Fusion APU support</li>
+  <li>r600g: add support for ontario APUs</li>
+  <li>r600c: fix VC flush on cedar and palm</li>
+  <li>gallium/egl: fix r300 vs r600 loading</li>
+  <li>r600c: fix some opcodes on evergreen</li>
+  <li>r600c: bump texture limits to hw limits</li>
+  <li>r600g: bump texture/cb limits appropriately for evergreen</li>
+  <li>radeon: bump mip tree levels to 15</li>
+  <li>r600g: fix rendering with a vertex attrib having a zero stride</li>
+  <li>r600g: remove useless switch statements</li>
+  <li>r600g: add support for NI (northern islands) asics</li>
+  <li>r600c: add support for NI asics</li>
+  <li>r600g: support up to 64 shader constants</li>
+  <li>r600c: fix up SQ setup in blit code for Ontario/NI</li>
+</ul></p>
+
+<p>Andre Maasikas (3):
+<ul>
+  <li>r600c: fix buffer height setting in dri2 case</li>
+  <li>r600g: break alu clause earlier</li>
+  <li>r600g: fix evergreen interpolation setup</li>
+</ul></p>
+
+<p>Andrew Randrianasulu (2):
+<ul>
+  <li>dri/nv04: Don't expose ARB_texture_env_combine/dot3.</li>
+  <li>dri/nv04: Enable eng3dm for A8/L8 textures.</li>
+</ul></p>
+
+<p>Aras Pranckevicius (2):
+<ul>
+  <li>glsl: fix crash in loop analysis when some controls can't be determined</li>
+  <li>glsl: fix matrix type check in ir_algebraic</li>
+</ul></p>
+
+<p>Bas Nieuwenhuizen (3):
+<ul>
+  <li>r600g: set ENABLE_KILL in the shader state in the new design</li>
+  <li>r600g: set ENABLE_KILL on evergreen too</li>
+  <li>r600g: use dirty list to track dirty blocks</li>
+</ul></p>
+
+<p>Ben Skeggs (3):
+<ul>
+  <li>nv50: DST</li>
+  <li>nv50: DPH</li>
+  <li>nv50: silence some unknown get_param warnings</li>
+</ul></p>
+
+<p>Benjamin Franzke (2):
+<ul>
+  <li>st/egl image: multiply drm buf-stride with blocksize</li>
+  <li>r600g: implement texture_get_handle (needed for eglExportDRMImageMESA)</li>
+</ul></p>
+
+<p>Brian Paul (296):
+<ul>
+  <li>glx: add const qualifiers to __indirect_glMultiDrawArraysEXT()</li>
+  <li>glsl2: fix signed/unsigned comparison warning</li>
+  <li>llvmpipe: cast to silence warning</li>
+  <li>llvmpipe: s/boolean/unsigned/ in bitfield to silence warning</li>
+  <li>nv50: use unsigned int for bitfields to silence warnings</li>
+  <li>tgsi: fix incorrect usage_mask for shadow tex instructions</li>
+  <li>gallivm: expand AoS sampling to cover all filtering modes</li>
+  <li>gallivm: fix incorrect vector shuffle datatype</li>
+  <li>gallivm: move i32_vec_type inside the #ifdef</li>
+  <li>mesa: include mfeatures.h in formats.c</li>
+  <li>gallivm: fix wrong return value in bitwise functions</li>
+  <li>tgsi/sse: fix aos_to_soa() loop to handle num_inputs==0</li>
+  <li>gallivm: added missing case for PIPE_TEXTURE_RECT</li>
+  <li>gallium: better docs for pipe_rasterizer_state::sprite_coord_enable</li>
+  <li>gallium: rework handling of sprite_coord_enable state</li>
+  <li>gallium/docs: added new pipeline.txt diagram</li>
+  <li>mesa: don't call valid_texture_object() in non-debug builds</li>
+  <li>glsl2: silence compiler warnings in printf() calls</li>
+  <li>docs: remove old broken link</li>
+  <li>docs: mark as obsolete, remove dead links</li>
+  <li>llvmpipe: fix query bug when no there's no scene</li>
+  <li>gallivm: remove debug code</li>
+  <li>llvmpipe: maintain fragment shader state for draw module</li>
+  <li>llvmpipe: indentation fix</li>
+  <li>llvmpipe: reformatting, remove trailing whitespace, etc</li>
+  <li>llvmpipe: clean-up, comments in setup_point_coefficient()</li>
+  <li>llvmpipe: rename sprite field, add sprite_coord_origin</li>
+  <li>llvmpipe: implement sprite coord origin modes</li>
+  <li>draw: fix test for using the wide-point stage</li>
+  <li>llvmpipe: check bitshift against PIPE_MAX_SHADER_OUTPUTS</li>
+  <li>draw: check bitshift against PIPE_MAX_SHADER_OUTPUS</li>
+  <li>Merge branch 'sprite-coord'</li>
+  <li>draw: new draw_fs.[ch] files</li>
+  <li>glsl2: fix typo in error msg</li>
+  <li>gallivm: fix lp_build_sample_compare()</li>
+  <li>softpipe: add missing calls to set draw vertex samplers/views</li>
+  <li>mesa: don't advertise bogus GL_ARB_shading_language_120 extension</li>
+  <li>configs: remove egl-swrast target from linux-dri config</li>
+  <li>llvmpipe: fix sprite texcoord setup for non-projective texturing</li>
+  <li>mesa: fix assertions to handle srgb formats</li>
+  <li>st/mesa: add missing MESA_FORMAT_S8 case in st_mesa_format_to_pipe_format()</li>
+  <li>st/mesa: use the wrapped renderbuffer in CopyPixels()</li>
+  <li>llvmpipe: make min/max lod and lod bias dynamic state</li>
+  <li>llvmpipe: make texture border_color dynamic state</li>
+  <li>softpipe: fix repeat() function for NPOT textures</li>
+  <li>gallivm: fix repeat() function for NPOT textures</li>
+  <li>swrast: update comments for REMAINDER() macro</li>
+  <li>softpipe: rename sp_state_fs.c -&gt; sp_state_shader.c</li>
+  <li>softpipe: make shader-related functions static</li>
+  <li>softpipe: make blend/stencil/depth functions static</li>
+  <li>softpipe: make sampler state functions static</li>
+  <li>softpipe: make vertex state functions static</li>
+  <li>softpipe: make rasterizer state functions static</li>
+  <li>softpipe: make stream out state functions static</li>
+  <li>softpipe: make clip state functions static</li>
+  <li>softpipe: minor asst. clean-ups</li>
+  <li>softpipe: allocate tile data on demand</li>
+  <li>llvmpipe: fix swizzling of texture border color</li>
+  <li>softpipe: fix swizzling of texture border color</li>
+  <li>draw: pass sampler state down to llvm jit state</li>
+  <li>gallivm: check for level=0 case in lp_build_minify()</li>
+  <li>gallivm: added some comments</li>
+  <li>draw: check for null sampler pointers</li>
+  <li>swrast: fix choose_depth_texture_level() to respect mipmap filtering state</li>
+  <li>st/mesa: replace assertion w/ conditional in framebuffer invalidation</li>
+  <li>glsl2: fix signed/unsigned comparison warning</li>
+  <li>st/xlib: add some comments</li>
+  <li>ir_to_mesa: assorted clean-ups, const qualifiers, new comments</li>
+  <li>mesa: remove assertion w/ undeclared variable texelBytes</li>
+  <li>gallivm: remove newlines</li>
+  <li>draw/llvmpipe: replace DRAW_MAX_TEXTURE_LEVELS with PIPE_MAX_TEXTURE_LEVELS</li>
+  <li>mesa: reformatting, comments, code movement</li>
+  <li>x11: fix breakage from gl_config::visualType removal</li>
+  <li>gallivm: work-around trilinear mipmap filtering regression with LLVM 2.8</li>
+  <li>mesa: remove post-convolution width/height vars</li>
+  <li>gallivm: add compile-time option to emit inst addrs and/or line numbers</li>
+  <li>llvmpipe: code to dump bytecode to file (disabled)</li>
+  <li>gallivm: added lp_build_print_vec4()</li>
+  <li>gallivm: added lp_build_load_volatile()</li>
+  <li>glsl: add ir_unop_round_even case to silence unhandled enum warning</li>
+  <li>st/mesa: fix regressions in glDrawPixels(GL_STENCIL_INDEX)</li>
+  <li>st/mesa: reformatting in st_cb_drawpixels.c</li>
+  <li>st/mesa: use GLuint to avoid problem w/ uint not defined on mingw32</li>
+  <li>st/mesa: update function name, comments</li>
+  <li>gallivm: use util_snprintf()</li>
+  <li>llvmpipe: remove lp_setup_coef*.c files from Makefile</li>
+  <li>mesa: fix mesa version string construction</li>
+  <li>gallivm: fix incorrect type for zero vector in emit_kilp()</li>
+  <li>llvmpipe/draw: always enable LLVMAddInstructionCombiningPass()</li>
+  <li>draw: use float version of LLVM Mul/Add instructions</li>
+  <li>draw: fix typo in comment</li>
+  <li>mesa: add GL_RG case to _mesa_source_buffer_exists()</li>
+  <li>mesa: add missing cases for packing red/green images</li>
+  <li>st/mesa: added cases for GL_COMPRESSED_RED/RG in st_choose_format()</li>
+  <li>docs: update texture red/green support in GL3.txt</li>
+  <li>docs: add GL_ARB_texture_rg to release notes</li>
+  <li>mesa: driver hook for primitive restart</li>
+  <li>mesa: set/get primitive restart state</li>
+  <li>mesa: API spec for primitive restart</li>
+  <li>mesa: regenerated files with primitive restart</li>
+  <li>mesa: plug in primitive restart function</li>
+  <li>vbo: support for primitive restart</li>
+  <li>gallium: new CAP, state for primitive restart</li>
+  <li>st/mesa: support for primitive restart</li>
+  <li>draw: implement primitive splitting for primitive restart</li>
+  <li>softpipe: enable primitive restart</li>
+  <li>llvmpipe: enable primitive restart</li>
+  <li>docs: added GL_NV_primitive_restart extension</li>
+  <li>Merge branch 'primitive-restart-cleanup'</li>
+  <li>winsys/xlib: formatting fixes</li>
+  <li>winsys/xlib: use Bool type for shm field</li>
+  <li>winsys/xlib: fix up allocation/dealloction of XImage</li>
+  <li>winsys/xlib: rename xm-&gt;xlib</li>
+  <li>galahad: silence warnings</li>
+  <li>mesa: move declaration before code</li>
+  <li>docs: updated GL3 status for primitive restart</li>
+  <li>mesa: 80-column wrapping</li>
+  <li>mesa: simplify fbo format checking code</li>
+  <li>mesa: split up the image.c file</li>
+  <li>mesa: add pixel packing for unscaled integer types</li>
+  <li>mesa: _mesa_ClearColorIuiEXT() and _mesa_ClearColorIiEXT()</li>
+  <li>mesa: _mesa_is_format_integer() function</li>
+  <li>mesa: minor reformatting, clean-ups</li>
+  <li>mesa: added _mesa_is_fragment_shader_active() helper</li>
+  <li>mesa: new glDrawPixels error check for integer formats</li>
+  <li>softpipe: added some texture sample debug code (disabled)</li>
+  <li>mesa: added new gl_extensions::EXT_gpu_shader4 field</li>
+  <li>mesa: added new gl_framebuffer::_IntegerColor field</li>
+  <li>mesa: added glGet query for GL_RGBA_INTEGER_MODE_EXT</li>
+  <li>mesa: compute _IntegerColor field in _mesa_test_framebuffer_completeness()</li>
+  <li>mesa: added cases for GL_EXT_texture_integer formats</li>
+  <li>mesa: added cases for GL_EXT_texture_integer</li>
+  <li>st/mesa: add format selection for signed/unsigned integer formats</li>
+  <li>mesa: simplify target_can_be_compressed() function</li>
+  <li>glapi: GL_EXT_texture_integer API</li>
+  <li>glapi: include/build EXT_texture_integer.xml</li>
+  <li>mesa: regenerated API files for GL_EXT_texture_integer</li>
+  <li>mesa: plug in GL_EXT_texture_integer functions</li>
+  <li>mesa: display list support for GL_EXT_texture_integer</li>
+  <li>st/mesa: be smarter choosing texture format for glDrawPixels()</li>
+  <li>softpipe: remove &gt;32bpp color restriction</li>
+  <li>mesa: silence enum comparison warning</li>
+  <li>mesa: fix uninitialized var warning</li>
+  <li>xlib: silence unused var warning</li>
+  <li>util: use pointer_to_func() to silence warning</li>
+  <li>rtasm: use pointer_to_func() to silence warning</li>
+  <li>translate: use function typedefs, casts to silence warnings</li>
+  <li>translate: remove unused prototypes</li>
+  <li>mesa: additional glReadPixels error checks for GL_EXT_texture_integer</li>
+  <li>mesa: additional switch cases for GL_EXT_texture_integer</li>
+  <li>mesa: additional teximage error checks for GL_EXT_texture_integer</li>
+  <li>mesa: do integer FB / shader validation check in _mesa_valid_to_render()</li>
+  <li>mesa: call _mesa_valid_to_render() in glDrawPixels, glCopyPixels, glBitmap</li>
+  <li>mesa: remove the unused _mesa_is_fragment_shader_active() function</li>
+  <li>mesa: fix bug in _mesa_is_format_integer()</li>
+  <li>mesa: rename function to _mesa_is_format_integer_color()</li>
+  <li>mesa: remove 'normalized' parameter from _mesa_VertexAttribIPointer()</li>
+  <li>vbo: re-indent file</li>
+  <li>glapi: xml spec file for GL_EXT_gpu_shader4</li>
+  <li>glapi: include EXT_gpu_shader4.xml</li>
+  <li>glapi: regenerated API files</li>
+  <li>mesa: plug in stubs for glBindFragDataLocation(), glGetFragDataLocation()</li>
+  <li>mesa: add glGetUniformuiv(), plug in uint glUniform funcs</li>
+  <li>mesa: plug in more GL_EXT_gpu_shader4 functions</li>
+  <li>mesa: add new GLvertexformat entries for integer-valued attributes</li>
+  <li>mesa: implement integer-valued vertex attribute functions</li>
+  <li>mesa: add gl_client_array::Integer field and related vertex array state code</li>
+  <li>mesa: consolidate glVertex/Color/etcPointer() code</li>
+  <li>mesa: state/queries for GL_MIN/MAX_PROGRAM_TEXEL_OFFSET_EXT</li>
+  <li>mesa: glArrayElement support for integer-valued arrays</li>
+  <li>mesa: clean-up array element code</li>
+  <li>mesa: add extension table entry for GL_EXT_gpu_shader4</li>
+  <li>mesa: remove obsolete comment</li>
+  <li>mesa: fix incorrect type in _mesa_texstore_rgba_int16()</li>
+  <li>mesa: fix integer cases in _mesa_is_legal_format_and_type()</li>
+  <li>mesa: add const qualifier to _mesa_is_legal_format_and_type()</li>
+  <li>mesa: additional integer formats in _mesa_bytes_per_pixel()</li>
+  <li>mesa: pixel transfer ops do not apply to integer-valued textures</li>
+  <li>mesa: remove dead code</li>
+  <li>osmesa: fix renderbuffer memleak in OSMesaMakeCurrent()</li>
+  <li>mesa: use GLubyte for edge flag arrays</li>
+  <li>mesa: move the gl_config struct declaration</li>
+  <li>dri/util: add a bunch of comments</li>
+  <li>mesa: remove always-false conditional in check_compatible()</li>
+  <li>mesa: fix aux/accum comment and error message mixups</li>
+  <li>llvmpipe: assign context's frag shader pointer before using it</li>
+  <li>llvmpipe: add a cast</li>
+  <li>mesa: silence new warnings in texobj.c</li>
+  <li>egl/gdi: fix typo: xsurf-&gt;gsurf</li>
+  <li>mesa: code to unpack RGBA as uints</li>
+  <li>gallivm: implement scatter stores into temp register file</li>
+  <li>gallivm: add some LLVM var labels</li>
+  <li>gallivm: added debug code to dump temp registers</li>
+  <li>gallivm: add pixel offsets in scatter stores</li>
+  <li>gallivm: added lp_elem_type()</li>
+  <li>gallivm: implement execution mask for scatter stores</li>
+  <li>tgsi: remove unused function</li>
+  <li>llvmpipe: added some debug assertions, but disabled</li>
+  <li>gallivm: alloca() was called too often for temporary arrays</li>
+  <li>gallivm: add const qualifiers, fix comment string</li>
+  <li>softpipe: disable vertex texturing with draw/llvm</li>
+  <li>mesa: consolidate pixel packing/unpacking code</li>
+  <li>mesa: rename vars in pixel pack/unpack code</li>
+  <li>mesa: implement uint texstore code</li>
+  <li>mesa: remove stray GL_FLOAT case in _mesa_is_legal_format_and_type()</li>
+  <li>mesa: make fixed-pt and byte-valued arrays a runtime feature</li>
+  <li>softpipe: can't no-op depth test stage when occlusion query is enabled</li>
+  <li>mesa: no-op glBufferSubData() on size==0</li>
+  <li>mesa: #include mfeatures.h in enums.h</li>
+  <li>mesa: improve error message</li>
+  <li>mesa: add missing formats in _mesa_format_to_type_and_comps()</li>
+  <li>mesa: handle more pixel types in mipmap generation code</li>
+  <li>mesa: make glIsBuffer() return false for never bound buffers</li>
+  <li>mesa: fix glDeleteBuffers() regression</li>
+  <li>tdfx: s/Format/_BaseFormat/</li>
+  <li>mesa: consolidate assertions in teximage code</li>
+  <li>radeon: set gl_texture_image::TexFormat field in radeonSetTexBuffer2()</li>
+  <li>r600: set gl_texture_image::TexFormat field in r600SetTexBuffer2()</li>
+  <li>r200: set gl_texture_image::TexFormat field in r200SetTexBuffer2()</li>
+  <li>r300: set gl_texture_image::TexFormat field in r300SetTexBuffer2()</li>
+  <li>evergreen: set gl_texture_image::TexFormat field in evergreenSetTexBuffer()</li>
+  <li>st/mesa: fix glDrawPixels(depth/stencil) bugs</li>
+  <li>glsl: fix assorted MSVC warnings</li>
+  <li>mesa: add more work-arounds for acoshf(), asinhf(), atahf()</li>
+  <li>glsl: remove opt_constant_expression.cpp from SConscript</li>
+  <li>mesa: fix error messages and minor reindenting</li>
+  <li>mesa: whitespace cleanups</li>
+  <li>mesa: 80-column wrapping</li>
+  <li>mesa: reorder texture_error_check() params</li>
+  <li>mesa: minor clean-ups in context code</li>
+  <li>mesa: upgrade to glext.h version 66</li>
+  <li>mesa: pass gl_format to _mesa_init_teximage_fields()</li>
+  <li>mesa: fix error msg typo</li>
+  <li>glapi: rename GL3.xml to GL3x.xml as it covers all GL 3.x versions</li>
+  <li>mesa: hook up GL 3.x entrypoints</li>
+  <li>docs: update some GL 3.0 status</li>
+  <li>mesa: fix get_texture_dimensions() for texture array targets</li>
+  <li>swrast: init alpha value to 1.0 in opt_sample_rgb_2d()</li>
+  <li>glsl: fix off by one in register index assertion</li>
+  <li>glsl: use gl_register_file in a few places</li>
+  <li>mesa: rename, make _mesa_register_file_name() non-static</li>
+  <li>mesa: _mesa_valid_register_index() to validate register indexes</li>
+  <li>mesa: replace #defines with new gl_shader_type enum</li>
+  <li>mesa: use gl_shader_type enum</li>
+  <li>glsl: better handling of linker failures</li>
+  <li>glsl: start restoring some geometry shader code</li>
+  <li>mesa: add assertion and update comment in _mesa_format_image_size()</li>
+  <li>mesa: added _mesa_format_image_size64()</li>
+  <li>x11: remove test_proxy_teximage() function</li>
+  <li>st/mesa: fix mapping of zero-sized buffer objects</li>
+  <li>gallivm/llvmpipe: squash merge of the llvm-context branch</li>
+  <li>mesa: raise max texture sizes to 16K</li>
+  <li>softpipe: increase max texture size to 16K</li>
+  <li>mesa: replace large/MAX_WIDTH stack allocations with heap allocations</li>
+  <li>mesa: replace large/MAX_WIDTH stack allocations with heap allocations</li>
+  <li>swrast: avoid large stack allocations in blend code</li>
+  <li>swrast: avoid large stack allocations in tex combine code</li>
+  <li>st/mesa: avoid large stack allocations in readpixels code</li>
+  <li>mesa: replace more MAX_WIDTH stack allocations with heap allocations</li>
+  <li>gallivm/llvmpipe: remove lp_build_context::builder</li>
+  <li>gallivm: fix null builder pointers</li>
+  <li>mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query</li>
+  <li>mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type</li>
+  <li>llvmpipe: fix broken stencil writemask</li>
+  <li>mesa: consolidate some compiler -D flags</li>
+  <li>swrast: allow GL_RG format in glDrawPixels()</li>
+  <li>swrast: fix indentation</li>
+  <li>swrast: accept GL_RG in glReadPixels()</li>
+  <li>swrast: restructure some glReadPixels() code</li>
+  <li>mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM</li>
+  <li>mesa: remove unneeded cast</li>
+  <li>mesa: update comments, remove dead code</li>
+  <li>st/mesa: new comment about updating state vars</li>
+  <li>mesa: add error margin to clip mask debug/check code</li>
+  <li>gallium/util: minor formatting fixes</li>
+  <li>mesa/llvm: use llvm-config --cppflags</li>
+  <li>st/mesa: fix mipmap generation bug</li>
+  <li>mesa: test for cube map completeness in glGenerateMipmap()</li>
+  <li>mesa: set gl_texture_object::_Complete=FALSE in incomplete()</li>
+  <li>mesa: consolidate glTexImage1/2/3D() code</li>
+  <li>mesa: simplify proxy texture code in texture_error_check()</li>
+  <li>mesa: consolidate the glTexSubImage1/2/3D() functions</li>
+  <li>mesa: consolidate glCopyTexImage1/2D() code</li>
+  <li>mesa: consolidate glCopyTexSubImage1/2/3D() functions</li>
+  <li>mesa: consolidate glCompressedTexImage1/2/3D() functions</li>
+  <li>mesa: make _mesa_test_proxy_teximage() easier to read</li>
+  <li>configure: use llvm-config --cppflags instead of --cflags</li>
+  <li>mesa: revamp error checking for compressed texture images</li>
+  <li>mesa: simplify target checking for TexImage functions</li>
+  <li>draw/llvm: don't flush in vs_llvm_delete()</li>
+  <li>tnl: Initialize gl_program_machine memory in run_vp.</li>
+  <li>tnl: a better way to initialize the gl_program_machine memory</li>
+  <li>mesa, st/mesa: disable GL_ARB_geometry_shader4</li>
+  <li>mesa/meta: fix broken assertion, rename stack depth var</li>
+  <li>glsl: new glsl_strtod() wrapper to fix decimal point interpretation</li>
+  <li>st/mesa: fix renderbuffer pointer check in st_Clear()</li>
+</ul></p>
+
+<p>Brian Rogers (1):
+<ul>
+  <li>mesa: Add missing else in do_row_3D</li>
+</ul></p>
+
+<p>Chad Versace (25):
+<ul>
+  <li>intel_extensions: Add ability to set GLSL version via environment</li>
+  <li>glsl: Add glsl_type::uvecN_type for N=2,3</li>
+  <li>glsl: Add lexer rules for uint and uvecN (N=2..4)</li>
+  <li>glsl: Changes in generated file glsl_lexer.cpp</li>
+  <li>glsl: Add lexer rules for &lt&lt and &gt;&gt; in GLSL 1.30</li>
+  <li>glsl: Change generated file glsl_lexer.cpp</li>
+  <li>glsl: Implement ast-to-hir for binary shifts in GLSL 1.30</li>
+  <li>glsl: Implement constant expr evaluation for bitwise-not</li>
+  <li>glsl: Implement constant expr evaluation for bit-shift ops</li>
+  <li>glsl: Implement constant expr evaluation for bitwise logic ops</li>
+  <li>glsl: Fix ir validation for bit logic ops</li>
+  <li>glsl: Define shift_result_type() in ast_to_hir.cpp</li>
+  <li>glsl: Implement ast-to-hir for bit-shift-assignment</li>
+  <li>glsl: Define bit_logic_result_type() in ast_to_hir.cpp</li>
+  <li>glsl: Implement ast-to-hir for bit-logic ops</li>
+  <li>glsl: Fix lexer rule for ^=</li>
+  <li>glsl: Commit generated file glsl_lexer.cpp</li>
+  <li>glsl: Fix ast-to-hir for ARB_fragment_coord_conventions</li>
+  <li>mesa: Fix C++ includes in sampler.cpp</li>
+  <li>glsl: Fix ir_expression::constant_expression_value()</li>
+  <li>glsl: Fix erroneous cast in ast_jump_statement::hir()</li>
+  <li>glsl: Fix Doxygen tag file in recently renamed files</li>
+  <li>glsl: Improve usage message for glsl_compiler</li>
+  <li>glsl: Fix linker bug in cross_validate_globals()</li>
+  <li>glsl: In ast_to_hir, check sampler array indexing</li>
+</ul></p>
+
+<p>Chia-I Wu (149):
+<ul>
+  <li>glapi: Fix build errors for ES.</li>
+  <li>glapi: Fix ES build errors again.</li>
+  <li>mesa: Update ES APIspec.xml.</li>
+  <li>st/xlib: Notify the context when the front/back buffers are swapped.</li>
+  <li>targets/egl: Use C++ compiler to link GL/ES state trackers.</li>
+  <li>libgl-xlib: Remove unused st_api_create_OpenGL.</li>
+  <li>st/egl: Split modeset code support to modeset.c.</li>
+  <li>st/egl: Rename kms backend to drm.</li>
+  <li>st/egl: s/kms/drm/ on the drm backend.</li>
+  <li>egl: Enable drm platform by default.</li>
+  <li>egl: Check extensions.</li>
+  <li>st/egl: Skip single-buffered configs in EGL.</li>
+  <li>mapi: Fix compiler warnings.</li>
+  <li>st/egl: Drop context argument from egl_g3d_get_egl_image.</li>
+  <li>targets/egl: Fix linking with libdrm.</li>
+  <li>st/vega: Fix version check in context creation.</li>
+  <li>egl: Use attribute names as the _EGLConfig member names.</li>
+  <li>egl: Access config attributes directly.</li>
+  <li>st/egl: Access _EGLConfig directly.</li>
+  <li>st/egl: Do not finish a fence that is NULL.</li>
+  <li>mesa: Remove unused vtxfmt_tmp.h.</li>
+  <li>egl_dri2: Drop the use of _egl[SG]etConfigKey.</li>
+  <li>egl_glx: Drop the use of [SG]ET_CONFIG_ATTRIB.</li>
+  <li>egl_glx: Fix borken driver.</li>
+  <li>egl: Move attributes in _EGLImage to _EGLImageAttribs.</li>
+  <li>egl: Parse image attributes with _eglParseImageAttribList.</li>
+  <li>egl: Move fallback routines to eglfallbacks.c.</li>
+  <li>egl: Drop dpy argument from the link functions.</li>
+  <li>egl: Minor changes to the _EGLConfig interface.</li>
+  <li>egl: Minor changes to the _EGLScreen interface.</li>
+  <li>egl: Fix _eglModeLookup.</li>
+  <li>st/egl: Fix native_mode refresh mode.</li>
+  <li>egl: Add reference count for resources.</li>
+  <li>egl: Use reference counting to replace IsLinked or IsBound.</li>
+  <li>egl: Fix a false negative check in _eglCheckMakeCurrent.</li>
+  <li>st/egl: Use resource reference count for egl_g3d_sync.</li>
+  <li>egl_dri2: Fix a typo that make glFlush be called at wrong time.</li>
+  <li>glapi: Do not use glapidispatch.h.</li>
+  <li>glapi: Move glapidispatch.h to core mesa.</li>
+  <li>glapi: Do not use glapioffsets.h.</li>
+  <li>glapi: Merge glapioffsets.h into glapidispath.h.</li>
+  <li>vbo: Use CALL_* macros.</li>
+  <li>mesa: Remove unnecessary glapitable.h includes.</li>
+  <li>autoconf: Better client API selection.</li>
+  <li>docs: Update egl and openvg docs.</li>
+  <li>autoconf: Update configuration info.</li>
+  <li>Merge branch 'glapi-reorg'</li>
+  <li>targets: Add missing quotes to Makefile.xorg.</li>
+  <li>autoconf: st/vega requires --enable-openvg.</li>
+  <li>st/mesa: Unreference the sampler view in st_bind_surface.</li>
+  <li>autoconf: Tidy configure output for EGL.</li>
+  <li>targets/egl: Fix a warning with --disable-opengl build.</li>
+  <li>egl: Rework _eglGetSearchPath.</li>
+  <li>mesa: Select FEATURE_remap_table when multiple APIs are enabled.</li>
+  <li>mesa: Allow contexts of different APIs to coexist.</li>
+  <li>egl: Set up the pthread key even TLS is used.</li>
+  <li>st/egl: Add native_surface::present callback.</li>
+  <li>st/egl: Use native_surface::present callback.</li>
+  <li>d3d1x: Use native_surface::present.</li>
+  <li>st/egl: Remove flush_frontbuffer and swap_buffers.</li>
+  <li>st/egl: Add support for swap interval and swap behavior.</li>
+  <li>st/egl: Add support for EGL_MATCH_NATIVE_PIXMAP.</li>
+  <li>st/egl: Add extern "C" wrapper to native.h.</li>
+  <li>st/egl: Add native_display_buffer interface.</li>
+  <li>st/egl: Use native_display_buffer for EGL_MESA_drm_image.</li>
+  <li>autoconf: Add --enable-gallium-egl.</li>
+  <li>docs: Update egl docs.</li>
+  <li>st/dri: Add support for surfaceless current contexts.</li>
+  <li>egl_dri2: Fix __DRI_DRI2 version 1 support.</li>
+  <li>st/vega: Do not wait NULL fences.</li>
+  <li>gallium: Add st_api::name.</li>
+  <li>gallium: Add st_context_iface::share to st_api.</li>
+  <li>st/wgl: Use st_context_iface::share for DrvShareLists.</li>
+  <li>st/glx: Replace MESA_VERSION_STRING by xmesa_get_name.</li>
+  <li>mesa: Clean up core.h.</li>
+  <li>scons: Define IN_DRI_DRIVER.</li>
+  <li>tgsi: Add STENCIL to text parser.</li>
+  <li>st/vega: vegaLookupSingle should validate the state.</li>
+  <li>st/vega: Set wrap_r for mask and blend samplers.</li>
+  <li>st/vega: Fix vgReadPixels with a subrectangle.</li>
+  <li>egl_dri2: Fix one context, multiple surfaces.</li>
+  <li>auxiliary: util_blit_pixels_tex should restore the viewport.</li>
+  <li>st/vega: Fix a crash with empty paths.</li>
+  <li>st/vega: Masks and surfaces should share orientation.</li>
+  <li>st/vega: No flipping in vg_prepare_blend_surface.</li>
+  <li>st/vega: Fix a typo in EXTENDED_BLENDER_OVER_FUNC.</li>
+  <li>llvmpipe: Fix build errors on x86.</li>
+  <li>st/vega: Overhaul renderer with renderer states.</li>
+  <li>st/vega: Add DRAWTEX renderer state.</li>
+  <li>st/vega: Add SCISSOR renderer state.</li>
+  <li>st/vega: Add CLEAR renderer state for vgClear.</li>
+  <li>st/vega: Add FILTER renderer state for image filtering.</li>
+  <li>st/vega: Use the renderer for vgMask.</li>
+  <li>st/vega: Add POLYGON_STENCIL and POLYGON_FILL renderer state.</li>
+  <li>st/vega: Delay fb state update to vg_validate_state.</li>
+  <li>st/vega: Use st_framebuffer for fb width/height.</li>
+  <li>st/vega: Move g3d states to renderer.</li>
+  <li>st/vega: Make shader_bind call into the renderer.</li>
+  <li>st/vega: vg_manager should care about only the color buffer.</li>
+  <li>st/vega: Clean up vg_context fields and functions.</li>
+  <li>st/vega: Clean up renderer fields and functions.</li>
+  <li>st/vega: vg_copy_texture and vg_copy_surface should share code.</li>
+  <li>st/vega: Get rid of renderer_copy_texture.</li>
+  <li>st/vega: Update to latest headers.</li>
+  <li>st/vega: Fix image sampler views for alpha-only formats.</li>
+  <li>st/vega: Make path_render and path_stroke take a matrix.</li>
+  <li>st/vega: Make image_draw take a matrix.</li>
+  <li>st/vega: Add primitive text support.</li>
+  <li>st/vega: Revive mask layer support.</li>
+  <li>st/vega: More flexible shader selection.</li>
+  <li>st/vega: Add color transformation support.</li>
+  <li>st/vega: Bump version to 1.1.</li>
+  <li>st/vega: Fix paint coordinates transformations.</li>
+  <li>st/vega: Fix negated logic in image_draw.</li>
+  <li>st/vega: Fix degenerate paints.</li>
+  <li>st/vega: Simplify radial gradient.</li>
+  <li>st/vega: Remove st_inlines.h.</li>
+  <li>st/vega: Delay blend texture creation until needed.</li>
+  <li>st/vega: Create drawing surface mask as needed.</li>
+  <li>st/vega: Initialize pipe states with renderer.</li>
+  <li>st/vega: Avoid unnecessary constant bufer upload.</li>
+  <li>st/vega: Destroy the pipe context with vg_context.</li>
+  <li>st/vega: polygon_array requires a deep free.</li>
+  <li>st/egl: Set pipe_resource::array_size to 1.</li>
+  <li>st/vega: Set pipe_resource::array_size to 1.</li>
+  <li>st/vega: Move vertex transformation to shader.</li>
+  <li>st/vega: Add a missing break.</li>
+  <li>st/vega: Add some comments to pipeline shaders.</li>
+  <li>st/vega: Refactor blend shaders.</li>
+  <li>st/vega: Move masking after blending.</li>
+  <li>st/vega: Add support for per-channel alpha.</li>
+  <li>st/vega: Blending should use premultiplied alpha.</li>
+  <li>st/vega: Fix VG_BLEND_MULTIPLY.</li>
+  <li>st/vega: Add blend shaders for all blend modes.</li>
+  <li>st/vega: Fix pipe blend state for various blend modes.</li>
+  <li>egl: _eglFilterArray should not allocate.</li>
+  <li>mapi: Rewrite mapi_abi.py to get rid of preprocessor magic.</li>
+  <li>vbo: Drop second ATTR macro.</li>
+  <li>vbo: Fix GLES2 glVertexAttrib.</li>
+  <li>mesa: Do not advertise GL_OES_texture_3D.</li>
+  <li>mesa: Fix GL_FIXED arrays.</li>
+  <li>mesa: Fix glTexCoordPointer with type GL_FIXED.</li>
+  <li>st/egl: Plug pbuffer leaks.</li>
+  <li>st/egl: Fix eglCopyBuffers.</li>
+  <li>st/egl: Assorted fixes for dri2_display_get_configs.</li>
+  <li>docs/egl: Update egl.html.</li>
+  <li>st/egl: Fix eglChooseConfig when configs is NULL.</li>
+  <li>docs: Add an example for EGL_DRIVERS_PATH.</li>
+  <li>autoconf: Fix --with-driver=xlib --enable-openvg.</li>
+</ul></p>
+
+<p>Chris Wilson (2):
+<ul>
+  <li>i915g: Fix closure of full batch buffers</li>
+  <li>intel: Check for unsupported texture when finishing using as a render target</li>
+</ul></p>
+
+<p>Christoph Bumiller (80):
+<ul>
+  <li>nv50: import new compiler</li>
+  <li>nouveau: update nouveau_class.h</li>
+  <li>nv50: introduce the big formats table</li>
+  <li>nv50: don't produce MOV immediate to output reg in store opt</li>
+  <li>nv50: change back accidentally swapped UNORM,SNORM vertex type</li>
+  <li>nv50: add/fix some license headers</li>
+  <li>nv50: simple reload elimination and local CSE</li>
+  <li>nv50: fix constant_operand opt mul by 2 case</li>
+  <li>nv50: permit usage of undefined TGSI TEMPs</li>
+  <li>nv50: add missing 2nd source for POW multiplication</li>
+  <li>nv50: add signed RGTC1 to format table, allow 2_10_10_10 for vbufs</li>
+  <li>nv50: fix for empty BBs</li>
+  <li>nv50: insert MOVs also for PHI sources from dominating block</li>
+  <li>nv50: explicitly set src type for SET ops</li>
+  <li>nv50: fixes for nested IFs</li>
+  <li>nv50: don't eliminate loads to dedicated values</li>
+  <li>nv50: fix constbuf validation</li>
+  <li>nv50: build proper phi functions in the first place</li>
+  <li>nv50: fix reg count</li>
+  <li>nv50: begin implementing loops</li>
+  <li>nv50: more constant folding</li>
+  <li>nv50: loops part 2</li>
+  <li>nv50: flatten simple IF/ELSE/ENDIF constructs</li>
+  <li>nv50: fix thinko in store to output reg possible check</li>
+  <li>nv50: generate JOINs for outermost IF clauses</li>
+  <li>nv50: more TGSI opcodes (SIN, SCS, ARL, RET, KILP)</li>
+  <li>nv50: fix PSIZ and PRIMID mapping</li>
+  <li>nv50: check dst compatibility in CSE</li>
+  <li>nv50: initialize edgeflag input index</li>
+  <li>nv50: emit predicate for interp</li>
+  <li>Merge remote branch 'origin/master' into nv50-compiler</li>
+  <li>nv50: DP2, fix ARL</li>
+  <li>nv50: yet another case we need a nop.exit</li>
+  <li>nv50: fix check for sprite/point coord enable</li>
+  <li>nv50: handle TEXTURE_SWIZZLE and GEOMETRY_SHADER4 caps</li>
+  <li>nv50: set the FragDepth output index</li>
+  <li>nv50: turn off verbose debug output by default</li>
+  <li>nv50: attempt at making more complicated loops work</li>
+  <li>nv50: SSG</li>
+  <li>nv50: make FrontFacing -1 or +1</li>
+  <li>nv50: re-add proper TEXBIAS sequence</li>
+  <li>nv50: make use of TGSI immediate type</li>
+  <li>nv50: must join SELECT inputs before MOV inputs</li>
+  <li>nv50: fix XPD, was negated</li>
+  <li>nv50: fix find_dom_frontier</li>
+  <li>nv50: fix build-predicate function</li>
+  <li>Merge remote branch 'origin/master' into nv50-compiler</li>
+  <li>nv50: load address register before using it, not after</li>
+  <li>nv50: save tgsi instructions</li>
+  <li>nv50: prepare for having multiple functions</li>
+  <li>nv50: don't parse again in tgsi_2_nc</li>
+  <li>nv50: use actual loads/stores if TEMPs are accessed indirectly</li>
+  <li>nv50: create value references with the right type</li>
+  <li>nv50: duplicate interps in load_proj_tex_coords</li>
+  <li>nv50: address regs are 16 bit</li>
+  <li>nv50: fix can_load check for 3rd source</li>
+  <li>nv50: reduce bb_reachable_by runtime from pot to linear</li>
+  <li>nv50: minor compiler fixes and cleanups</li>
+  <li>nv50: cannot move from local mem to output reg directly</li>
+  <li>nv50: newlines in shader bincode printing</li>
+  <li>nv50: match TEMP limit with nv50 ir builder</li>
+  <li>nv50: handle TGSI EXP and LOG again</li>
+  <li>nv50: check for immediates when turning MUL ADD into MAD</li>
+  <li>nv50: interp cannot write flags reg</li>
+  <li>nv50: MOV TEMP[0], -CONST[0] must be float32 negation</li>
+  <li>nv50: fix indirect CONST access with large or negative offsets</li>
+  <li>nv50: fix TXP depth comparison value</li>
+  <li>nv50: consider address register in reload elimination</li>
+  <li>nv50: improve and fix modifier folding optimization</li>
+  <li>nv50: put low limit on REG_ALLOC_TEMP and FP_RESULT_COUNT</li>
+  <li>Merge remote branch 'origin/nv50-compiler'</li>
+  <li>nv50: don't segfault on shaders with 0 instructions</li>
+  <li>nv50: get shader fixups/relocations into working state</li>
+  <li>nv50: add relocs for stack and local mem buffers</li>
+  <li>nv50: emit constbuf relocs before uploading constants</li>
+  <li>nv50: fix typo in fifo packet length limit</li>
+  <li>nv50: use formats table in nv50_surface.c</li>
+  <li>nv50: use CLEAR_BUFFERS for surface fills</li>
+  <li>nv50: fix/handle a few more PIPE_CAPs</li>
+  <li>nv50: fix GP state bind and validate</li>
+</ul></p>
+
+<p>Corbin Simpson (8):
+<ul>
+  <li>r600g: Use align() instead of handrolled code.</li>
+  <li>r600g: Trivially deobfuscate r600_hw_states.</li>
+  <li>r600g: Deobfuscate and comment a few more functions in r600_hw_states.</li>
+  <li>r600g: Clean up some indentation and |= vs. | usage.</li>
+  <li>r600g: Fix false and true.</li>
+  <li>r600g: "tmp" is such a bad name for a texture.</li>
+  <li>r600g: Clean up PS setup.</li>
+  <li>r600g: Cleanup viewport floats.</li>
+</ul></p>
+
+<p>Daniel Lichtenberger (1):
+<ul>
+  <li>radeon: fix potential segfault in renderbuffer update</li>
+</ul></p>
+
+<p>Daniel Vetter (21):
+<ul>
+  <li>r200: revalidate after radeon_update_renderbuffers</li>
+  <li>i915g: rip out -&gt;sw_tiled</li>
+  <li>i915g: s/hw_tiled/tiling</li>
+  <li>i915g: add pineview pci ids</li>
+  <li>i915g: kill RGBA/X formats</li>
+  <li>i915g: kill buf-&gt;map_gtt</li>
+  <li>i915g: kill idws-&gt;pool</li>
+  <li>i915g: drop alignment parameter from iws-&gt;buffer_create</li>
+  <li>i915g: add winsys function to create tiled buffers</li>
+  <li>i915g: switch to tiled allocations, kill set_fence</li>
+  <li>i915g: prepare winsys/batchbuffer for execbuf2</li>
+  <li>i915g: return tiling in iws-&gt;buffer_from_handle</li>
+  <li>i915g: implement unfenced color&amp;depth buffer using tiling bits</li>
+  <li>i915g: implement unfenced relocs for textures using tiling bits</li>
+  <li>i915g: postpone mipmap/face offset calculation</li>
+  <li>i915g: don't pot-align stride for tiled buffers</li>
+  <li>i915g: enable X-tiling for textures</li>
+  <li>i915g: switch rendering to mipmapped textures to (x,y) offsets</li>
+  <li>i915g: enable x-tiling for render targets</li>
+  <li>i915g: assert(depth_surface-&gt;offset == 0)</li>
+  <li>i915g: track TODO items</li>
+</ul></p>
+
+<p>Dave Airlie (182):
+<ul>
+  <li>r300g: fix buffer reuse issue caused by previous commit</li>
+  <li>r600g: pull r600_draw struct out into header</li>
+  <li>r600g: use index min/max + index buffer offset.</li>
+  <li>r600g: add vgt dma src defines</li>
+  <li>r600g: fixup texture state on evergreen.</li>
+  <li>r600g: fix texture bos and avoid doing depth blit on evergreen</li>
+  <li>r600g: hide radeon_ctx inside winsys.</li>
+  <li>r600g: attempt to abstract kernel bos from pipe driver.</li>
+  <li>r600g: move constant buffer creation behind winsys abstraction.</li>
+  <li>r600g: use malloc bufmgr for constant buffers</li>
+  <li>r600g: add support for kernel bo</li>
+  <li>r600g: add winsys bo caching.</li>
+  <li>r600g: add upload manager support.</li>
+  <li>r600g: fixup map flushing.</li>
+  <li>r600g: use calloc for ctx bo allocations</li>
+  <li>r600g: oops got the use_mem_constant the wrong way around.</li>
+  <li>r600g; add uses waterfall to asm cf for r6xx.</li>
+  <li>r600g: only emit uses waterfall on r6xx hw.</li>
+  <li>util/r300g: split the r300 index buffer modifier functions out to util</li>
+  <li>r600g: modify index buffers for sizes the hw can't deal with.</li>
+  <li>r600g: send correct surface base update for multi-cbufs</li>
+  <li>r600g: fix fbo-drawbuffers-maxtargets</li>
+  <li>r600g: clean up valgrind issues on maxtargets test.</li>
+  <li>r600g: drop debugging that snuck in</li>
+  <li>r600g: fix tiling support for ddx supplied buffers</li>
+  <li>r600g: add z16 to color setup</li>
+  <li>r600g: add color/texture support for more depth formats.</li>
+  <li>r600g: fix r700 cube map sizing.</li>
+  <li>r600g: fixup r700 CB_SHADER_CONTROL register.</li>
+  <li>r600g: add missing BC_INST wrapper for evergreen</li>
+  <li>r600g: only flush for the correct colorbuffer, not all of them.</li>
+  <li>r600g: deal with overflow of VTX/TEX CF clauses.</li>
+  <li>r600g: set back to correct codepaths.</li>
+  <li>r600g: fixup evergreen miptree setup.</li>
+  <li>r600g: fix eg texture borders.</li>
+  <li>r600g: fix typo in struct member name</li>
+  <li>r600g: cleanup some of the DB blit code</li>
+  <li>r600g: make stencil readback work</li>
+  <li>r600g: disable dirty handling on texture from depth code.</li>
+  <li>r600g: use floats instead of hex for blit vbo</li>
+  <li>r600g: fix depth readback on rv610 and other quirky variants.</li>
+  <li>r600g: fix typo in evergreen register list</li>
+  <li>u_blitter: add a custom blitter call passing a dsa cso</li>
+  <li>r600g: use blitter to do db-&gt;cb flushing.</li>
+  <li>r600g: fix warnings since last commit.</li>
+  <li>egl: fix build since 17eace581d25a626a7d75d9d1205d012cbb14a6e</li>
+  <li>r300g: fix point sprite coord.</li>
+  <li>r600g: add vert support for 16/16 and 16/16/16 floats.</li>
+  <li>r600g: add some more vertex format support.</li>
+  <li>r600g: some more vertex formats</li>
+  <li>r600g: fix draw-elements and draw-elements-base-vertex</li>
+  <li>r600g: drop index_offset parameter to index buffer translate.</li>
+  <li>r600g: fixup tex wrapping.</li>
+  <li>r600g: fixup VP-&gt;FP output-&gt;input routing.</li>
+  <li>r600g: fix typo in r700 alu emit</li>
+  <li>r600g: fixup sprite coord enable.</li>
+  <li>r600g: fix polygon mode</li>
+  <li>mesa/mipmap: fix warning since 1acadebd6270d3604b026842b8a21360968618a0</li>
+  <li>r600g: add eg poly mode code.</li>
+  <li>r600g: make index bias fix for evergreen</li>
+  <li>r600g: add eg db count control register.</li>
+  <li>r300g: fix glsl-fs-pointcoord</li>
+  <li>r600g: add evergreen texture resource properly.</li>
+  <li>r600g: fix db flush breaking config state</li>
+  <li>r600g: on evergreen the centroid isn't set in this register.</li>
+  <li>r600g: add back evergreen name.</li>
+  <li>r600g: add evergreen texture border support to new path</li>
+  <li>r600g: move radeon.h members around to add back map flushing.</li>
+  <li>r600g: add initial vertex translate support.</li>
+  <li>r600g: remove old assert from new codepath</li>
+  <li>Revert "r600g: add initial vertex translate support."</li>
+  <li>r600g: port r300g fix for X* formats in texformat code</li>
+  <li>r600g: add L8A8 unorm.</li>
+  <li>r600g: clean up some code from move to new paths.</li>
+  <li>r600g: return string for chip family</li>
+  <li>r600g: use Elements macro instead of manual sizeofs</li>
+  <li>r600g: fix evergreen depth flushing.</li>
+  <li>r600g: add winsys support for CTL constants.</li>
+  <li>r600g: drop depth quirk on evergreen</li>
+  <li>r600g: add reloc for evergreen color attrib</li>
+  <li>r600g: realign evergreen code with r600 code.</li>
+  <li>r600g: add assembler support for other vtx fetch fields.</li>
+  <li>r600g: fixup vertex format picking.</li>
+  <li>r600g: sync vertex/texture cache on resources on evergreen</li>
+  <li>r600g: add cb flushing for extra buffers + depth buffer on r600/evergreen</li>
+  <li>r600g: fix evergreen draw-buffers</li>
+  <li>r600g: flush SH cache on constant change on evergreen</li>
+  <li>r600g: only set the Z export if shader exports it.</li>
+  <li>r600g: setup basic loop consts on r600 + evergreen.</li>
+  <li>mesa/st: initial attempt at RG support for gallium drivers</li>
+  <li>r600g: break out of search for reloc bo after finding it.</li>
+  <li>r600g: the code to check whether a new vertex shader is needed was wrong</li>
+  <li>r600g: fix wwarning in bo_map function</li>
+  <li>r600g: TODO domain management</li>
+  <li>r600g: add bo fenced list.</li>
+  <li>pb: don't keep checking buffers after first busy</li>
+  <li>r600g: add bo busy backoff.</li>
+  <li>r600g: drop mman allocator</li>
+  <li>r600g: drop use_mem_constant.</li>
+  <li>r600g: avoid unneeded bo wait</li>
+  <li>pb: fix numDelayed accounting</li>
+  <li>r600g: add evergreen stencil support.</li>
+  <li>r600g: use format from the sampler view not from the texture.</li>
+  <li>r600g: fix Z export enable bits.</li>
+  <li>r600g: add some RG texture format support.</li>
+  <li>r600g: drop width/height per level storage.</li>
+  <li>r600g: fix input/output Z export mixup for evergreen.</li>
+  <li>r600g: evergreen has no request size bit in texture word4</li>
+  <li>r600g: enable vertex samplers.</li>
+  <li>r600g: add TXL opcode support.</li>
+  <li>r600g: don't run with scissors.</li>
+  <li>r600g: fix typo in vertex sampling on r600</li>
+  <li>gallium/tgsi: add support for stencil writes.</li>
+  <li>gallium/format: add support for X24S8 and S8X24 formats.</li>
+  <li>gallium/format: add X32_S8X24_USCALED format.</li>
+  <li>gallium/util: add S8 tile sampling support.</li>
+  <li>mesa: add support for FRAG_RESULT_STENCIL.</li>
+  <li>mesa: improve texstore for 8/24 formats and add texstore for S8.</li>
+  <li>softpipe: add support for shader stencil export capability</li>
+  <li>st/mesa: add option to choose a texture format that we won't render to.</li>
+  <li>st/mesa: use shader stencil export to accelerate shader drawpixels.</li>
+  <li>r600g: add support for S8, X24S8 and S8X24 sampler formats.</li>
+  <li>r600g: add shader stencil export support.</li>
+  <li>glsl: add support for shader stencil export</li>
+  <li>st/mesa: enable stencil shader export extension if supported</li>
+  <li>r600g: fix depth0 setting</li>
+  <li>r600g: fix scissor/cliprect confusion</li>
+  <li>r600g: store samplers/views across blit when we need to modify them</li>
+  <li>r600g: reduce size of context structure.</li>
+  <li>r600g: the vs/ps const arrays weren't actually being used.</li>
+  <li>r600g: add copy into tiled texture</li>
+  <li>r600g: split out miptree setup like r300g</li>
+  <li>r600g: use common texture object create function</li>
+  <li>r600g: rename pitch in texture to pitch_in_bytes</li>
+  <li>r600g: remove bpt and start using pitch_in_bytes/pixels.</li>
+  <li>r600g: fix transfer stride.</li>
+  <li>r600g: drop all use of unsigned long</li>
+  <li>r600g: use blitter for hw copy region</li>
+  <li>r600g: evergreen add stencil export bit</li>
+  <li>r600g: add missing eg reg definition</li>
+  <li>r600g: fix stencil export for evergreen harder</li>
+  <li>r600g: drop unused context members</li>
+  <li>r600g: only pick centroid coordinate when asked.</li>
+  <li>r600g: fixup pos/face ena/address properly</li>
+  <li>r600g: fixup typo in macro name</li>
+  <li>r600g: select linear interpolate if tgsi input requests it</li>
+  <li>r300g: clean up warning due to unknown cap.</li>
+  <li>tgsi: add scanner support for centroid inputs</li>
+  <li>r600g: evergreen interpolation support.</li>
+  <li>r600g: add evergreen ARL support.</li>
+  <li>r600g: switch to a common formats.h file since they are in different regs</li>
+  <li>r600g: add defines for tiling</li>
+  <li>r600g: get tiling info from kernel</li>
+  <li>r600g: set tiling bits in hw state</li>
+  <li>r600g: do proper tracking of views/samplers.</li>
+  <li>r600g: fix typo in tiling setup cb code.</li>
+  <li>r600g: depth needs to bound to ds</li>
+  <li>r600g: attempt to cleanup depth blit</li>
+  <li>r600g: fix transfer function for tiling.</li>
+  <li>r600g: retrieve tiling info from kernel for shared buffers.</li>
+  <li>r600g: all non-0 mipmap levels need to be w/h aligned to POT.</li>
+  <li>r600g: move to per-miplevel array mode.</li>
+  <li>r600g: start adding hooks for aligning width/height for tiles.</li>
+  <li>r600g: add r600 surface to store the aligned height.</li>
+  <li>r600g: introduce a per-driver resource flag for transfers.</li>
+  <li>r600g: add texture tiling alignment support.</li>
+  <li>r600g: add texture tiling enable under a debug option.</li>
+  <li>r600g: initial translate state support</li>
+  <li>r600g: start splitting out common code from eg/r600.</li>
+  <li>r600g: not fatal if we can't get tiling info from kernel</li>
+  <li>r600g: merge more of the common r600/evergreen state handling</li>
+  <li>r600g: drop more common state handling code</li>
+  <li>r600g: fix magic 0x1 -&gt;flat shade ena</li>
+  <li>r600g: add assembler support for all the kcache fields.</li>
+  <li>gallium/noop: report GL 2.1</li>
+  <li>r600g: pick correct color swap for A8 fbos.</li>
+  <li>r300g/r600g: bump cache manager timeouts to 1s</li>
+  <li>r600g: it looks like r600 can handle dword offsets in the indices.</li>
+  <li>r300g: try and use all of vertex constant space</li>
+  <li>r300g: fixup rs690 tiling stride alignment calculations.</li>
+  <li>r600g: fix evergreen segfaults.</li>
+  <li>r600g: hack around property unknown issues.</li>
+</ul></p>
+
+<p>Eric Anholt (300):
+<ul>
+  <li>glsl: Add definition of gl_TextureMatrix inverse/transpose builtins.</li>
+  <li>i965: Share the KIL_NV implementation between glsl and non-glsl.</li>
+  <li>i965: Also enable CC statistics when doing OQs.</li>
+  <li>i965: Track the windowizer's dispatch for kill pixel, promoted, and OQ</li>
+  <li>glsl: Rework assignments with write_masks to have LHS chan count match RHS.</li>
+  <li>glsl: Fix copy'n'wasted ir_noop_swizzle conditions.</li>
+  <li>ir_to_mesa: Only compare vector_elements present for any_nequal/all_equal</li>
+  <li>i965: Fix the vector/expression splitting for the write_mask change.</li>
+  <li>i965: When splitting vector variable assignment, ignore unset channels.</li>
+  <li>i965: Update expression splitting for the vector-result change to compares.</li>
+  <li>i965: Warning fix for vector result any_nequal/all_equal change.</li>
+  <li>mesa: Remove the non-required ARB_imaging extension.</li>
+  <li>mesa: Remove EXT_histogram.</li>
+  <li>mesa: Remove SGI_color_table.</li>
+  <li>mesa: Remove SGI_color_matrix.</li>
+  <li>mesa: Remove EXT_convolution.</li>
+  <li>intel: Remove disabled stencil drawpixels acceleration.</li>
+  <li>intel: Remove unnecessary minimum pitch alignment to 32 bytes.</li>
+  <li>intel: Replace my intel_texture_bitmap code with _mesa_meta_Bitmap.</li>
+  <li>radeon: Remove copied minimum pitch alignment code.</li>
+  <li>unichrome: Mostly revert my convolution removal changes.</li>
+  <li>intel: Remove dead intelIsTextureResident().</li>
+  <li>i915: Remove a dead if (0) block.</li>
+  <li>intel: Dead comment removal.</li>
+  <li>intel: Corresponding FinishRenderTexture debug to BeginRenderTexture.</li>
+  <li>i965: Add support for rendering to SARGB8 FBOs.</li>
+  <li>intel: Fix segfault on INTEL_DEBUG=fbo with unsupported framebuffers.</li>
+  <li>intel: Add fallback debug to glGenerateMipmap.</li>
+  <li>intel: More reverting of the sw fallback for depth texture border color.</li>
+  <li>intel: Improve some of the miptree debugging.</li>
+  <li>mesa: Fix type typo in glGenerateMipmap handling of GL_UNSIGNED_INT data.</li>
+  <li>glsl: Fix broadcast_index of lower_variable_index_to_cond_assign.</li>
+  <li>glsl: Add validation that a swizzle only references valid channels.</li>
+  <li>i965: Fix up writemasked assignments in the new FS.</li>
+  <li>i965: Remove swizzling of assignment to vector-splitting single-channel LHS.</li>
+  <li>i965: Handle all_equal/any_nequal in the new FS.</li>
+  <li>i965: Fix vector splitting RHS channel selection with sparse writemasks.</li>
+  <li>i965: Add support for dFdx()/dFdy() to the FS backend.</li>
+  <li>i965: Add support for attribute interpolation on Sandybridge.</li>
+  <li>i965: Set up inputs to the fragment shader according to FP InputsRead.</li>
+  <li>i965: Add support for POW in gen6 FS.</li>
+  <li>i965: Fix negation in the new FS backend.</li>
+  <li>i965: Actually track the "if" depth in loop in the new FS backend.</li>
+  <li>i965: Apply the same set of lowering passes to new FS as to Mesa IR.</li>
+  <li>i965: Fix valgrind complaint about base_ir for new FS debugging.</li>
+  <li>i965: Fix up the FS backend for the variable array indexing pass.</li>
+  <li>i965: Set the variable type when dereferencing an array.</li>
+  <li>i965: Add support for dereferencing structs to the new FS backend.</li>
+  <li>i965: Add support for struct, array, and matrix uniforms to FS backend.</li>
+  <li>i965: Fix all non-snb regression in the snb attribute interpolation commit.</li>
+  <li>i965: Fix up part of my Sandybridge attributes support patch.</li>
+  <li>i965: Add support for gl_FrontFacing to the new FS backend.</li>
+  <li>i965: Subtract instead of adding when computing y delta in new FS backend.</li>
+  <li>mesa: Pull ir_to_mesa's sampler number fetcher out to shared code.</li>
+  <li>i965: Set up sampler numbers in the FS backend.</li>
+  <li>i965: Add support for non-color render target write data to new FS backend.</li>
+  <li>i965: Add support for MRT to the new FS backend.</li>
+  <li>i965: Add support for ir_loop counters to the new FS backend.</li>
+  <li>i965: Add support for ARB_fragment_coord_conventions to the new FS backend.</li>
+  <li>glsl: Also update implicit sizes of varyings at link time.</li>
+  <li>i965: Do interpolation for varying matrices and arrays in the FS backend.</li>
+  <li>i965: Don't try to emit interpolation for unused varying slots.</li>
+  <li>i965: Fix array indexing of arrays of matrices.</li>
+  <li>i965: Clean up obsolete FINISHME comment.</li>
+  <li>mesa: Move the list of builtin uniform info from ir_to_mesa to shared code.</li>
+  <li>i965: Add support for builtin uniforms to the new FS backend.</li>
+  <li>i965: Fix use of undefined mem_ctx in vector splitting.</li>
+  <li>i956: Make new FS discard do its work in a temp, not the null reg!</li>
+  <li>i965: Clean up the virtual GRF handling.</li>
+  <li>ra: First cut at a graph-coloring register allocator for mesa.</li>
+  <li>i965: First cut at register allocation using graph coloring.</li>
+  <li>i965: Add live interval analysis and hook it up to the register allocator.</li>
+  <li>i965: Remove my "safety counter" code from loops.</li>
+  <li>i965: Fix whole-structure/array assignment in new FS.</li>
+  <li>mesa: Don't reference a W component in setting up a vec3 uniform component.</li>
+  <li>i965: Fix new FS handling of builtin uniforms with packed scalars in structs.</li>
+  <li>glsl: Add a lowering pass for texture projection.</li>
+  <li>i965: Use the lowering pass for texture projection.</li>
+  <li>i965: Split the gen4 and gen5 sampler handling apart.</li>
+  <li>i965: Add gen6 attribute interpolation to new FS backend.</li>
+  <li>i965: Fix the gen6 jump size for BREAK/CONT in new FS.</li>
+  <li>i965: Also increment attribute location when skipping unused slots.</li>
+  <li>i965: Pre-gen6, map VS outputs (not FS inputs) to URB setup in the new FS.</li>
+  <li>i965: Add real support for pre-gen5 texture sampling to the new FS.</li>
+  <li>i965: Fix up copy'n'pasteo from moving coordinate setup around for gen4.</li>
+  <li>i965: Restore the forcing of aligned pairs for delta_xy on chips with PLN.</li>
+  <li>i965: When producing a single channel swizzle, don't make a temporary.</li>
+  <li>i965: Add a sanity check for register allocation sizes.</li>
+  <li>i965: Fix off-by-ones in handling the last members of register classes.</li>
+  <li>i965: Don't try to emit code if we failed register allocation.</li>
+  <li>i965: Add support for EXT_texture_swizzle to the new FS backend.</li>
+  <li>i965: Set up swizzling of shadow compare results for GL_DEPTH_TEXTURE_MODE.</li>
+  <li>i965: Fix glean/texSwizzle regression in previous commit.</li>
+  <li>i965: Be more conservative on live interval calculation.</li>
+  <li>i965: Add trivial dead code elimination in the new FS backend.</li>
+  <li>i965: Add initial folding of constants into operand immediate slots.</li>
+  <li>i965: In disasm, gen6 fb writes don't put msg reg # in destreg_conditionalmod.</li>
+  <li>i965: Add support for gen6 FB writes to the new FS.</li>
+  <li>i965: Enable the constant propagation code.</li>
+  <li>i965: Also do constant propagation for the second operand of CMP.</li>
+  <li>i965: Add back gen6 headerless FB writes to the new FS backend.</li>
+  <li>i965: Gen6 no longer has the IFF instruction; always use IF.</li>
+  <li>i965: Fix up IF/ELSE/ENDIF for gen6.</li>
+  <li>i965: Fix botch in the header_present case in the new FS.</li>
+  <li>i965: Add some clarification of the WECtrl field.</li>
+  <li>i965: Don't do 1/w multiplication in new FS for gen6</li>
+  <li>i965: Gen6's sampler messages are the same as Ironlake.</li>
+  <li>i965: Refactor gl_FrontFacing setup out of general variable setup.</li>
+  <li>i965: Add support for gl_FrontFacing on gen6.</li>
+  <li>i965: Don't assume that WPOS is always provided on gen6 in the new FS.</li>
+  <li>i965: Fix gen6 pointsize handling to match pre-gen6.</li>
+  <li>i965: Disable emitting if () statements on gen6 until we really fix them.</li>
+  <li>i965: Normalize cubemap coordinates like is done in the Mesa IR path.</li>
+  <li>mesa: Simplify a bit of _mesa_add_state_reference using memcmp.</li>
+  <li>i965: Drop the check for duplicate _mesa_add_state_reference.</li>
+  <li>i965: Drop the check for YUV constants in the param list.</li>
+  <li>i965: Handle swizzles in the addition of YUV texture constants.</li>
+  <li>i965: Fix gen6 WM push constants updates.</li>
+  <li>i965: Fix new FS gen6 interpolation for sparsely-populated arrays.</li>
+  <li>i965: Enable attribute swizzling (repositioning) in the gen6 SF.</li>
+  <li>i965: Add register coalescing to the new FS backend.</li>
+  <li>i965: Split FS_OPCODE_DISCARD into two steps.</li>
+  <li>i965: Reduce register interference checks for changed FS_OPCODE_DISCARD.</li>
+  <li>i965: Move FS backend structures to a header.</li>
+  <li>i965: Give the math opcodes information on base mrf/mrf len.</li>
+  <li>i965: Give the FB write and texture opcodes the info on base MRF, like math.</li>
+  <li>i965: Compute to MRF in the new FS backend.</li>
+  <li>i965: Don't consider gen6 math instructions to write to MRFs.</li>
+  <li>i965: Add a couple of checks for gen6 math instruction limits.</li>
+  <li>i965: Don't compute-to-MRF in gen6 math instructions.</li>
+  <li>i965: Expand uniform args to gen6 math to full registers to get hstride == 1.</li>
+  <li>i965: Don't compute-to-MRF in gen6 VS math.</li>
+  <li>i965: Fix gen6 pixel_[xy] setup to avoid mixing int and float src operands.</li>
+  <li>i965: Always use the new FS backend on gen6.</li>
+  <li>i965: Fix missing "break;" in i2b/f2b, and missing AND of CMP result.</li>
+  <li>intel: Allow CopyTexSubImage to InternalFormat 3/4 textures, like RGB/RGBA.</li>
+  <li>i965: Don't rebase the index buffer to min 0 if any arrays are in VBOs.</li>
+  <li>i965: Add support for rescaling GL_TEXTURE_RECTANGLE coords to new FS.</li>
+  <li>i965: Set class_sizes[] for the aligned reg pair class.</li>
+  <li>i965: Update the live interval when coalescing regs.</li>
+  <li>i965: Add a pass to the FS to split virtual GRFs to float channels.</li>
+  <li>i965: Add a function for handling the move of boolean values to flag regs.</li>
+  <li>i965: Add peepholing of conditional mod generation from expressions.</li>
+  <li>i965: Enable the new FS backend on pre-gen6 as well.</li>
+  <li>i965: Fix texturing on pre-gen5.</li>
+  <li>i965: Set the type of the null register to fix gen6 FS comparisons.</li>
+  <li>i965: Disable the debug printf I added for FS disasm.</li>
+  <li>i965: Fix a weirdness in NOT handling.</li>
+  <li>i965: Fix assertion failure on gen6 BufferSubData to busy BO.</li>
+  <li>i965: Assert out on gen6 VS constant buffer reads that hang the GPU for now.</li>
+  <li>i965: Fix scissor-offscreen on gen6 like we did pre-gen6.</li>
+  <li>i965: Avoid blits in BufferCopySubdata on gen6.</li>
+  <li>i965: Tell the shader compiler when we expect depth writes for gen6.</li>
+  <li>i965: Remove the gen6 emit_mi_flushes I sprinkled around the driver.</li>
+  <li>i965: Disable thread dispatch when the FS doesn't do any work.</li>
+  <li>i965: Add EU emit support for gen6's new IF instruction with comparison.</li>
+  <li>i965: Set the source operand types for gen6 if/else/endif to integer.</li>
+  <li>i965: Use the new style of IF statement with embedded comparison on gen6.</li>
+  <li>i965: Split register allocation out of the ever-growing brw_fs.cpp.</li>
+  <li>i965: Fix gl_FrontFacing emit on pre-gen6.</li>
+  <li>i965: Add support for register spilling.</li>
+  <li>i965: Don't emit register spill offsets directly into g0.</li>
+  <li>i965: Correct scratch space allocation.</li>
+  <li>i965: Be more aggressive in tracking live/dead intervals within loops.</li>
+  <li>i965: Move the FS disasm/annotation printout to codegen time.</li>
+  <li>i965: Add support for pull constants to the new FS backend.</li>
+  <li>i965: Add EU code for dword scattered reads (constant buffer array indexing).</li>
+  <li>i965: Clarify an XXX comment in FB writes with real info.</li>
+  <li>i965: Use SENDC on the first render target write on gen6.</li>
+  <li>i965: Clear some undefined fields of g0 when using them for gen6 FB writes.</li>
+  <li>i965: Add disasm for the flag register.</li>
+  <li>i965: Add support for discard instructions on gen6.</li>
+  <li>i965: Handle new ir_unop_round_even in channel expression splitting.</li>
+  <li>i965: Fix typo in comment about state flags.</li>
+  <li>i965: Set up the constant buffer on gen6 when it's needed.</li>
+  <li>i965: Add support for constant buffer loads on gen6.</li>
+  <li>i965: Drop the eot argument to read messages, which can never be set.</li>
+  <li>i965: Fix VS URB entry sizing.</li>
+  <li>i965: Disable register spilling on gen6 until it's fixed.</li>
+  <li>i965: Make FS uniforms be the actual type of the uniform at upload time.</li>
+  <li>i965: Add user clip planes support to gen6.</li>
+  <li>i965: Update gen6 SF state when point state (sprite or attenuation) changes.</li>
+  <li>i965: Upload required gen6 VS push constants even when using pull constants.</li>
+  <li>i965: Update the gen6 stencil ref state when stencil state changes.</li>
+  <li>mesa: Make metaops use program refcounts instead of names.</li>
+  <li>mesa: Don't compute an unused texture completeness debug string.</li>
+  <li>intel: For batch, use GTT mapping instead of writing to a malloc and copying.</li>
+  <li>intel: Annotate debug printout checks with unlikely().</li>
+  <li>intel: Remove the magic unaligned memcpy code.</li>
+  <li>i965: Remove dead intel_structs.h file.</li>
+  <li>intel: Avoid taking logbase2 of several things that we max.</li>
+  <li>intel: Remove duplicated teximage miptree to object miptree promotion.</li>
+  <li>intel: Remove leftover dri1 locking fields in the context.</li>
+  <li>mesa: Fix delayed state flagging for EXT_sso-related program changes.</li>
+  <li>intel: Fix the client-side swapbuffers throttling.</li>
+  <li>Revert "intel: Fix the client-side swapbuffers throttling."</li>
+  <li>i965: Allow OPCODE_SWZ to put immediates in the first arg.</li>
+  <li>i965: Add support for math on constants in gen6 brw_wm_glsl.c path.</li>
+  <li>i965: Work around strangeness in swizzling/masking of gen6 math.</li>
+  <li>i965: re-enable gen6 IF statements in the fragment shader.</li>
+  <li>glsl: Free the loop state context when we free the loop state.</li>
+  <li>i965: Fix gl_FragCoord inversion when drawing to an FBO.</li>
+  <li>i965: Shut up spurious gcc warning about GLSL_TYPE enums.</li>
+  <li>mesa: Don't spam the console in a debug build unless some spam is requested.</li>
+  <li>i965: Add state dumping for sampler state.</li>
+  <li>i965: Add dumping of the sampler default color.</li>
+  <li>i965: Fail on loops on gen6 for now until we write the EU emit code for it.</li>
+  <li>i965: Eliminate dead code more aggressively.</li>
+  <li>mesa: Include C++ files in the makedepend of DRI drivers.</li>
+  <li>i965: Fix compute_to_mrf to not move a MRF write up into another live range.</li>
+  <li>i965: Just use memset() to clear most members in FS constructors.</li>
+  <li>i965: Remove extra n at the end of every instruction in INTEL_DEBUG=wm.</li>
+  <li>i965: Fold constants into the second arg of BRW_SEL as well.</li>
+  <li>glsl: Add a helper function for determining if an rvalue could be a saturate.</li>
+  <li>i965: Recognize saturates and turn them into a saturated mov.</li>
+  <li>ir_to_mesa: Detect and emit MOV_SATs for saturate constructs.</li>
+  <li>i965: Improve compute-to-mrf.</li>
+  <li>i965: Remove duplicate MRF writes in the FS backend.</li>
+  <li>i965: Move gen4 blend constant color to the gen4 blending file.</li>
+  <li>i965: Don't upload polygon stipple unless required.</li>
+  <li>i965: Don't upload line stipple pattern unless we're stippling.</li>
+  <li>i965: Don't upload line smooth params unless we're line smoothing.</li>
+  <li>i965: Use the new embedded compare in SEL on gen6 for VS MIN and MAX opcodes.</li>
+  <li>i965: Fix type of gl_FragData[] dereference for FB write.</li>
+  <li>glsl: Make the symbol table's add_function just use the function's name.</li>
+  <li>glsl: Make the symbol table's add_variable just use the variable's name.</li>
+  <li>glsl: Add a helper constructor for expressions that works out result type.</li>
+  <li>glsl: Fix structure and array comparisions.</li>
+  <li>glsl: Quiet unreachable no-return-from-function warning.</li>
+  <li>i965: Dump the WHILE jump distance on gen6.</li>
+  <li>i965: Add support for gen6 DO/WHILE ISA emit.</li>
+  <li>i965: Add support for gen6 BREAK ISA emit.</li>
+  <li>i965: Add support for gen6 CONTINUE instruction emit.</li>
+  <li>i965: Enable IF statements in the VS.</li>
+  <li>i965: Add support for loops in the VS.</li>
+  <li>glsl: Mark the array access for whole-array comparisons.</li>
+  <li>glsl: Fix flipped return of has_value() for array constants.</li>
+  <li>mesa: Add getters for the rest of the supported draw buffers.</li>
+  <li>mesa: Add getters for ARB_copy_buffer's attachment points.</li>
+  <li>intel: Add an env var override to execute for a different GPU revision.</li>
+  <li>i965: Update gen6 WM state on compiled program change, not just FP change.</li>
+  <li>i965: Update gen6 SF state on fragment program change too.</li>
+  <li>i965: Fix compile warning about missing opcodes.</li>
+  <li>i965: Move payload reg setup to compile, not lookup time.</li>
+  <li>i965: Provide delta_xy reg to gen6 non-GLSL path PINTERP.</li>
+  <li>i965: Fix up 16-wide gen6 FB writes after various refactoring.</li>
+  <li>i965: Don't smash a group of coordinates doing gen6 16-wide sampler headers.</li>
+  <li>i965: Fix gen6 interpolation setup for 16-wide.</li>
+  <li>i965: Fix up gen6 samplers for their usage by brw_wm_emit.c</li>
+  <li>i965: Make the sampler's implied move on gen6 be a raw move.</li>
+  <li>i965: Align gen6 push constant size to dispatch width.</li>
+  <li>i965: Add support for the instruction compression bits on gen6.</li>
+  <li>i965: Nuke brw_wm_glsl.c.</li>
+  <li>i965: Remove INTEL_DEBUG=glsl_force now that there's no brw_wm_glsl.c</li>
+  <li>i965: Fix comment about gen6_wm_constants.</li>
+  <li>i965: Handle saturates on gen6 math instructions.</li>
+  <li>i965: Always hand the absolute value to RSQ.</li>
+  <li>i965: Add disabled debug code for dumping out the WM constant payload.</li>
+  <li>i965: Work around gen6 ignoring source modifiers on math instructions.</li>
+  <li>i965: Fix flipped value of the not-embedded-in-if on gen6.</li>
+  <li>i965: Don't try to store gen6 (float) blend constant color in bytes.</li>
+  <li>i965: Set up the color masking for the first drawbuffer on gen6.</li>
+  <li>i965: Set up the per-render-target blend state on gen6.</li>
+  <li>i965: Set the render target index in gen6 fixed-function/ARB_fp path.</li>
+  <li>i965: Use the new pixel mask location for gen6 ARB_fp KIL instructions.</li>
+  <li>i965: Drop KIL_NV from the ff/ARB_fp path since it was only used for GLSL.</li>
+  <li>i965: Drop push-mode reladdr constant loading and always use constant_map.</li>
+  <li>i965: Fix VS constants regression pre-gen6.</li>
+  <li>i965: Clean up VS constant buffer location setup.</li>
+  <li>i965: Set up the correct texture border color state struct for Ironlake.</li>
+  <li>i965: Set render_cache_read_write surface state bit on gen6 constant surfs.</li>
+  <li>i965: remove unused variable since brw_wm_glsl.c removal.</li>
+  <li>intel: Use plain R8 and RG8 for COMPRESSED_RED and COMPRESSED_RG.</li>
+  <li>intel: Set the swizzling for depth textures using the GL_RED depth mode.</li>
+  <li>glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.</li>
+  <li>i965: Correct the dp_read message descriptor setup on g4x.</li>
+  <li>intel: Include stdbool so we can stop using GLboolean when we want to.</li>
+  <li>i965: Fix ARL to work on gen6.</li>
+  <li>i956: Fix the old FP path fragment position setup on gen6.</li>
+  <li>i965: Fix gl_FragCoord.z setup on gen6.</li>
+  <li>i965: Add support for using the BLT ring on gen6.</li>
+  <li>intel: Update renderbuffers before looking up CopyTexImage's read buffer.</li>
+  <li>intel: Drop commented intel_flush from copy_teximage.</li>
+  <li>intel: Try to sanely check that formats match for CopyTexImage.</li>
+  <li>intel: Support glCopyTexImage() from XRGB8888 to ARGB8888.</li>
+  <li>i965: Avoid using float type for raw moves, to work around SNB issue.</li>
+  <li>i965: Set the alternative floating point mode on gen6 VS and WM.</li>
+  <li>i965: Add support for gen6 constant-index constant loading.</li>
+  <li>i965: Add support for gen6 reladdr VS constant loading.</li>
+  <li>i965: Improve the hacks for ARB_fp scalar^scalar POW on gen6.</li>
+  <li>i965: Factor out the ir comparision to BRW_CONDITIONAL_* code.</li>
+  <li>i965: Fix regression in FS comparisons on original gen4 due to gen6 changes.</li>
+  <li>i965: Do lowering of array indexing of a vector in the FS.</li>
+  <li>intel: Only do frame throttling at glFlush time when using frontbuffer.</li>
+  <li>intel: Handle forced swrast clears before other clear bits.</li>
+  <li>intel: Use tri clears when we don't know how to blit clear the format.</li>
+  <li>intel: Add spans code for the ARB_texture_rg support.</li>
+  <li>intel: Add a couple of helper functions to reduce rb code duplication.</li>
+  <li>intel: Fix segfaults from trying to use _ColorDrawBuffers in FBO validation.</li>
+  <li>intel: When validating an FBO's combined depth/stencil, use the given FBO.</li>
+</ul></p>
+
+<p>Fabian Bieler (2):
+<ul>
+  <li>r600g: set address of pop instructions to next instruction</li>
+  <li>glsl: fix lowering conditional returns in subroutines</li>
+</ul></p>
+
+<p>Francisco Jerez (51):
+<ul>
+  <li>dri/nv04: Fix PGRAPH_ERRORs when running OA.</li>
+  <li>dri/nv04: Mipmapping fixes.</li>
+  <li>dri/nv04: Align SIFM transfer dimensions.</li>
+  <li>dri/nv04: Fix up color mask.</li>
+  <li>dri/nv04: Fix maximum texture size.</li>
+  <li>dri/nv04: Fix provoking vertex.</li>
+  <li>dri/nouveau: Update nouveau_class.h.</li>
+  <li>dri/nouveau: Add some more extensions.</li>
+  <li>dri/nouveau: Fix glRenderbufferStorage with DEPTH_COMPONENT as internal format.</li>
+  <li>dri/nouveau: Don't request a fake front unnecessarily.</li>
+  <li>dri/nouveau: Don't reemit the BO state in nouveau_state_emit().</li>
+  <li>dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().</li>
+  <li>meta: Don't bind the created texture object in init_temp_texture().</li>
+  <li>dri/nv10: Fix the CLAMP texture wrap mode.</li>
+  <li>dri/nv04: Use nvgl_wrap_mode().</li>
+  <li>dri/nouveau: Remove unnecessary assertion.</li>
+  <li>dri/nouveau: Cleanup more references to old FBOs and VBOs.</li>
+  <li>dri/nv10-nv20: Fix texturing in some cases after a base level change.</li>
+  <li>dri/nouveau: Fix software mipmap generation on 1x1 textures.</li>
+  <li>dri/nouveau: Have a smaller amount of larger scratch buffers.</li>
+  <li>dri/nouveau: Remove unnecessary flush.</li>
+  <li>dri/nv10: Use fast Z clears.</li>
+  <li>dri/nouveau: Minor cleanup.</li>
+  <li>dri/nv10: Fake fast Z clears for pre-nv17 cards.</li>
+  <li>dri/nouveau: Initialize tile_flags when allocating a render target.</li>
+  <li>nouveau: Get larger push buffers.</li>
+  <li>dri/nouveau: Force a "slow" Z clear if we're getting a new depth buffer.</li>
+  <li>dri/nv20: Clear with the 3D engine.</li>
+  <li>dri/nouveau: Don't assert(0) on compressed internal formats.</li>
+  <li>dri/nv25: Bind a hierarchical depth buffer.</li>
+  <li>dri/nouveau: Call _mesa_update_state() after framebuffer invalidation.</li>
+  <li>dri/nouveau: Honor the access flags in nouveau_bufferobj_map_range.</li>
+  <li>dri/nouveau: Tell the vbo module we want real hardware BOs.</li>
+  <li>dri/nouveau: Split out the scratch helpers to a separate file.</li>
+  <li>dri/nouveau: Avoid recursion in nouveau_bo_context_reset().</li>
+  <li>dri/nouveau: Use a macro to iterate over the bound vertex attributes.</li>
+  <li>dri/nouveau: Split out array handling to its own file.</li>
+  <li>dri/nouveau: Optimize VBO binding re-emission.</li>
+  <li>dri/nouveau: Keep small DYNAMIC_DRAW vertex buffers in system ram.</li>
+  <li>dri/nouveau: Pipeline glTexSubImage texture transfers.</li>
+  <li>dri/nouveau: Fix type promotion issue on 32bit platforms.</li>
+  <li>dri/nouveau: Validate the framebuffer state on read buffer changes.</li>
+  <li>dri/nouveau: Re-emit the BO state when coming back from a software fallback.</li>
+  <li>meta: Don't leak alpha function/reference value changes.</li>
+  <li>meta: Fix incorrect rendering of the bitmap alpha component.</li>
+  <li>vbo: Avoid unnecessary copy to/from current in vertex format upgrade.</li>
+  <li>meta: Don't try to disable cube maps if the driver doesn't expose the extension.</li>
+  <li>meta: Handle bitmaps with alpha test enabled.</li>
+  <li>dri/nouveau: Split hardware/software TNL instantiation more cleanly.</li>
+  <li>dri/nouveau: Fix typo.</li>
+  <li>dri/nouveau: Kill a bunch of ternary operators.</li>
+</ul></p>
+
+<p>Fredrik Höglund (2):
+<ul>
+  <li>r600g: Fix texture sampling with swizzled coords</li>
+  <li>r600g: fix pow(0, 0) evaluating to NaN</li>
+</ul></p>
+
+<p>Guillermo S. Romero (1):
+<ul>
+  <li>r300g: Do not use buf param before checking for NULL.</li>
+</ul></p>
+
+<p>Henri Verbeet (19):
+<ul>
+  <li>r600g: Flush upload buffers before draws instead of before flushes.</li>
+  <li>r600g: Check for other references before checking for existing mappings in radeon_bo_pb_map_internal().</li>
+  <li>r600g: Remove a redundant flush in r600_texture_transfer_map().</li>
+  <li>r600g: Buffer object maps imply a wait.</li>
+  <li>r600g: Respect PB_USAGE_UNSYNCHRONIZED in radeon_bo_pb_map_internal().</li>
+  <li>Revert "r600g: Flush upload buffers before draws instead of before flushes."</li>
+  <li>r600g: fix exports_ps to export a number not a mask.</li>
+  <li>r600g: Mention AMD in the renderer string.</li>
+  <li>r600g: Cleanup the fenced_bo list in r600_context_fini().</li>
+  <li>r600g: Evergreen has two extra frac_bits for the sampler LOD state.</li>
+  <li>r600: Evergreen has two extra frac_bits for the sampler LOD state.</li>
+  <li>r600g: Add PIPE_FORMAT_L8A8_UNORM for Evergreen as well.</li>
+  <li>r600g: Swizzle vertex data only once.</li>
+  <li>r600g: Synchronize supported color formats between Evergreen and r600/r700.</li>
+  <li>r600g: Fix the PIPE_FORMAT_L8A8_UNORM color swaps.</li>
+  <li>r600g: Fix the PIPE_FORMAT_A8_UNORM color swap for Evergreen as well.</li>
+  <li>r600g: Cleanup block bo references in r600_context_fini().</li>
+  <li>r600g: Cleanup fetch shader resources in r600_pipe_shader_destroy().</li>
+  <li>st/mesa: Handle wrapped depth buffers in st_copy_texsubimage().</li>
+</ul></p>
+
+<p>Hui Qi Tay (10):
+<ul>
+  <li>llvmpipe: minor changes in llvm coefficient calcs</li>
+  <li>draw: cliptest and viewport done in a single loop in vertex shader</li>
+  <li>draw: added viewport and cliptest flags</li>
+  <li>draw: sanitize llvm variant key</li>
+  <li>draw: corrections for w coordinate</li>
+  <li>draw: corrections to allow for different cliptest cases</li>
+  <li>llvmpipe: Moved draw pipeline twoside function to llvm setup code</li>
+  <li>llvmpipe: added llvm offset setup code</li>
+  <li>llvmpipe: clean up polygon offset function in lp setup code</li>
+  <li>llvmpipe: fix such that offset/twoside function only does in-place modification</li>
+</ul></p>
+
+<p>Ian Romanick (102):
+<ul>
+  <li>glsl2: Refactor testing for whether a deref is of a matrix or array</li>
+  <li>glsl2: Add flags to enable variable index lowering</li>
+  <li>glsl: Add doxygen comments</li>
+  <li>EGL DRI2: Silence piles of 'unused variable' warnings</li>
+  <li>EGL DRI2: Silence 'missing initializer' warnings</li>
+  <li>egl_glx: Silence piles of 'unused variable' warnings</li>
+  <li>egl: Fix several 'comparison between signed and unsigned integer' warnings</li>
+  <li>dri: Ensure that DRI driver cpp files are in tarballs</li>
+  <li>mesa: Force GL_ARB_copy_buffer to always be enabled</li>
+  <li>mesa: Force GL_SGIS_generate_mipmap to always be enabled</li>
+  <li>Remove GL_MESA_packed_depth_stencil</li>
+  <li>Remove GL_EXT_cull_vertex</li>
+  <li>Regenerate files changed by previous commit</li>
+  <li>Remove unnescessary initializations of UpdateTexturePalette</li>
+  <li>ARB_texture_rg: Add GLX protocol support</li>
+  <li>ARB_texture_rg: Correct some errors in RED / RG internal format handling</li>
+  <li>ARB_texture_rg: Add GL_TEXTURE_{RED,GREEN}_SIZE query support</li>
+  <li>ARB_texture_rg: Add GL_RED as a valid GL_DEPTH_TEXTURE_MODE</li>
+  <li>ARB_texture_rg: Handle RED and RG the same as RGB for tex env</li>
+  <li>ARB_texture_rg: Add R8, R16, RG88, and RG1616 internal formats</li>
+  <li>ARB_texture_rg: Allow RED and RG textures as FBO color buffer attachments</li>
+  <li>mesa: Enable GL_ARB_texture_rg in software paths</li>
+  <li>i965: Enable GL_ARB_texture_rg</li>
+  <li>mesa: Add ARB_texture_compression_rgtc as an alias for EXT_texture_compression_rgtc</li>
+  <li>ARB_texture_rg: Add GL_COMPRESSED_{RED,RG} cases in _mesa_is_color_format</li>
+  <li>mesa: Fix misplaced #endif</li>
+  <li>mesa: Trivial correction to comment</li>
+  <li>rgtc: Detect RGTC formats as color formats and as compressed formats</li>
+  <li>docs: Add list of bugs fixed in 7.9</li>
+  <li>docs: Import 7.9 release notes from 7.9 branch.</li>
+  <li>docs: Import 7.8.x release notes from 7.8 branch.</li>
+  <li>docs: download.html does not need to be updated for each release</li>
+  <li>docs: Update mailing lines from sf.net to freedesktop.org</li>
+  <li>docs: Import news updates from 7.9 branch</li>
+  <li>docs: added news item for 7.9 release</li>
+  <li>glsl: Fail linking if assign_attribute_locations fails</li>
+  <li>glsl: Refactor 'layout' grammar to match GLSL 1.60 spec grammar</li>
+  <li>glsl: Slight refactor of error / warning checking for ARB_fcc layout</li>
+  <li>glsl: Clear type_qualifier using memset</li>
+  <li>glsl: Wrap ast_type_qualifier contents in a struct in a union</li>
+  <li>glsl: Regenerate files modified by previous commits</li>
+  <li>glcpp: Add the define for ARB_explicit_attrib_location when present</li>
+  <li>glcpp: Regenerate files changes by previous commit</li>
+  <li>glsl: Add parser support for GL_ARB_explicit_attrib_location layouts</li>
+  <li>glsl: Regenerate files changes by previous commit</li>
+  <li>glsl: Track explicit location in AST to IR translation</li>
+  <li>glsl: Add linker support for explicit attribute locations</li>
+  <li>main: Enable GL_ARB_explicit_attrib_location for swrast</li>
+  <li>intel: Enable GL_ARB_explicit_attrib_location</li>
+  <li>glsl: Remove const decoration from inlined function parameters</li>
+  <li>docs: skeleton for 7.10 release notes</li>
+  <li>docs: Update status of GL 3.x related extensions</li>
+  <li>mesa: Validate assembly shaders when GLSL shaders are used</li>
+  <li>glsl: Fix incorrect assertion</li>
+  <li>linker: Reject shaders that have unresolved function calls</li>
+  <li>mesa: Silence unused variable warning</li>
+  <li>mesa: Refactor validation of shader targets</li>
+  <li>mesa: Clean up two 'comparison between signed and unsigned' warnings</li>
+  <li>mesa: Clean up various 'unused parameter' warnings in shaderapi</li>
+  <li>glsl: Slightly change the semantic of _LinkedShaders</li>
+  <li>linker: Trivial indention fix</li>
+  <li>i965: Fix indentation after commit 3322fbaf</li>
+  <li>linker: Improve handling of unread/unwritten shader inputs/outputs</li>
+  <li>glapi: Add GL_EXT_separate_shader_objects</li>
+  <li>glapi: Commit files changed by previous commit</li>
+  <li>mesa: Add infrastructure to track GL_EXT_separate_shader_objects</li>
+  <li>mesa: Skeletal support for GL_EXT_separate_shader_objects</li>
+  <li>mesa: Add display list support for GL_EXT_separate_shader_objects functions</li>
+  <li>mesa: Track an ActiveProgram distinct from CurrentProgram</li>
+  <li>Track separate programs for each stage</li>
+  <li>swrast: Enable GL_EXT_separate_shader_objects in software paths</li>
+  <li>intel: Enable GL_EXT_separate_shader_objects in Intel drivers</li>
+  <li>docs: add GL_EXT_separate_shader_objects to release notes</li>
+  <li>glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadow</li>
+  <li>ir_to_mesa: Refactor code for emitting DP instructions</li>
+  <li>mesa: Allow query of MAX_SAMPLES with EXT_framebuffer_multisample</li>
+  <li>glsl: Refactor is_vec_{zero,one} to be methods of ir_constant</li>
+  <li>glsl: Simplify generation of swizzle for vector constructors</li>
+  <li>glsl: Make is_zero and is_one virtual methods of ir_rvalue</li>
+  <li>ir_to_mesa: Generate smarter code for some conditional moves</li>
+  <li>glsl: Add ir_unop_sin_reduced and ir_unop_cos_reduced</li>
+  <li>glsl: Eliminate assumptions about size of ir_expression::operands</li>
+  <li>glsl: Add ir_rvalue::is_negative_one predicate</li>
+  <li>glsl: Add unary ir_expression constructor</li>
+  <li>glsl: Add ir_quadop_vector expression</li>
+  <li>glsl: Fix matrix constructors with vector parameters</li>
+  <li>i915: Disallow alpha, red, RG, and sRGB as render targets</li>
+  <li>glsl: Use M_LOG2E constant instead of calling log2</li>
+  <li>glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2</li>
+  <li>i915: Request that POW instructions be lowered</li>
+  <li>i915: Correctly generate unconditional KIL instructions</li>
+  <li>glsl: Ensure that equality comparisons don't return a NULL IR tree</li>
+  <li>i965: Correctly emit constants for aggregate types (array, matrix, struct)</li>
+  <li>glsl: Inherrit type of declared variable from initializer</li>
+  <li>linker: Ensure that unsized arrays have a size after linking</li>
+  <li>linker: Fix regressions caused by previous commit</li>
+  <li>glsl: Inherrit type of declared variable from initializer after processing assignment</li>
+  <li>linker: Allow built-in arrays to have different sizes between shader stages</li>
+  <li>ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors</li>
+  <li>Refresh autogenerated file builtin_function.cpp.</li>
+  <li>glsl: Allow less restrictive uses of sampler array indexing in GLSL &lt= 1.20</li>
+  <li>docs: Import 7.9.1 release notes from 7.9 branch</li>
+</ul></p>
+
+<p>Jakob Bornecrantz (27):
+<ul>
+  <li>rbug: Cast opcode to corrent int size</li>
+  <li>rbug: Add function to get opcode name string</li>
+  <li>scons: Link against talloc in the Gallium DRI drivers</li>
+  <li>i915g: Link with wrapper sw winsys with scons</li>
+  <li>tgsi: Actually care what check_soa_dependencies says</li>
+  <li>tgsi: Fix missing test before check</li>
+  <li>llvmpipe: Move makefile include to before targets</li>
+  <li>wrapper: Fix spelling</li>
+  <li>wrapper: Add a way to dewrap a pipe screen without destroying it</li>
+  <li>egl: Remove unnecessary headers</li>
+  <li>target-helpers: Remove per target software wrapper check</li>
+  <li>graw: Tidy graw xlib scons file a bit</li>
+  <li>scons: Remove old pipebuffer SConscript</li>
+  <li>scons: Detabify</li>
+  <li>scons: Check for pkg-config before trying to use it</li>
+  <li>scons: Check for libdrm_[intel|radeon] as well</li>
+  <li>scons: Move dependancy checks to the main gallium scons file</li>
+  <li>scons: Unify state tracker SConscripts</li>
+  <li>galahad: Correct the name of the scons library</li>
+  <li>graw: Use inline sw helper instead of roll your own loader</li>
+  <li>libgl-xlib: Use sw helper instead of roll your own</li>
+  <li>libgl-xlib: Use inline debug helper instead of non-inline version</li>
+  <li>graw: Use inline debug helper instead of non-inline version</li>
+  <li>gallium: Remove redundant sw and debug target helpers</li>
+  <li>i915g: Improve debug printing for textures</li>
+  <li>i915g: Make sure that new vbo gets updated</li>
+  <li>st/mesa: Unbind all constant buffers</li>
+</ul></p>
+
+<p>Jerome Glisse (75):
+<ul>
+  <li>r600g: alternative command stream building from context</li>
+  <li>r600g: move chip class to radeon common structure</li>
+  <li>r600g: use pipe context for flushing inside map</li>
+  <li>r600g: add back reference check when mapping buffer</li>
+  <li>r600g: directly allocate bo for user buffer</li>
+  <li>r600g: fix multi buffer rendering</li>
+  <li>r600g: occlusion query for new design</li>
+  <li>r600g: flush color buffer after draw command</li>
+  <li>r600g: disable shader rebuild optimization &amp; account cb flush packet</li>
+  <li>r600g: fix multiple occlusion query on same id</li>
+  <li>r600g: initial evergreen support in new path</li>
+  <li>r600g: fix typo in evergreen define (resource are in x range)</li>
+  <li>r600g: move use_mem_constants flags for new designs structure alignment</li>
+  <li>r600g: evergreen fix for new design</li>
+  <li>r600g: fix compilation after change to evergreend.h</li>
+  <li>r600g: fixup some evergreen register definitions</li>
+  <li>r600g: fix evergreen new path</li>
+  <li>r600g: fix reg definition</li>
+  <li>r600g: fix evergreen new path</li>
+  <li>r600g: bring over fix from old path to new path</li>
+  <li>r600g: fix vertex resource &amp; polygon offset</li>
+  <li>r600g: disable early cull optimization when occlusion query running</li>
+  <li>r600g: move around variables to share depth uncompression code</li>
+  <li>r600g: use depth decompression in new path</li>
+  <li>r600g: fix index buffer drawing</li>
+  <li>r600g: build packet header once</li>
+  <li>r600g: fix pointsprite &amp; resource unbinding</li>
+  <li>r600g: fix routing btw vertex &amp; pixel shader</li>
+  <li>r600g: fix occlusion query after change to block structure</li>
+  <li>r600g: use ptr for blit depth uncompress function</li>
+  <li>r600g: fix remaining piglit issue in new design</li>
+  <li>r600g: switch to new design</li>
+  <li>r600g: suspend/resume occlusion query around clear/copy</li>
+  <li>r600g: avoid rebuilding the vertex shader if no change to input format</li>
+  <li>r600g: use a hash table instead of group</li>
+  <li>r600g: delete old path</li>
+  <li>r600g: cleanup</li>
+  <li>r600g: more cleanup</li>
+  <li>r600g: use constant buffer instead of register for constant</li>
+  <li>r600g: fix constant &amp; literal src splitting, also fix mplayer gl2 shader</li>
+  <li>evergreeng: avoid overlapping border color btw VS &amp; PS</li>
+  <li>r600g: indentation fixes</li>
+  <li>r600g: rename radeon_ws_bo to r600_bo</li>
+  <li>r600g: allow r600_bo to be a sub allocation of a big bo</li>
+  <li>r600g: use r600_bo for relocation argument, simplify code</li>
+  <li>r600g: rename radeon_ws_bo to r600_bo</li>
+  <li>r600g: remove dead label &amp; fix indentation</li>
+  <li>r600g: store reloc information in bo structure</li>
+  <li>r600g: improve bo flushing</li>
+  <li>r600g: simplify block relocation</li>
+  <li>r600g: userspace fence to avoid kernel call for testing bo busy status</li>
+  <li>r600g: avoid segfault due to unintialized list pointer</li>
+  <li>r600g: fix dirty state handling</li>
+  <li>r600g: allow driver to work without submitting cmd to GPU</li>
+  <li>gallium/noop: no operation gallium driver</li>
+  <li>r600g: code cleanup (indent, trailing space, empty line ...)</li>
+  <li>r600g: fix occlusion query on evergreen (avoid lockup)</li>
+  <li>r600g: add fetch shader capabilities</li>
+  <li>r600g: dump raw shader output for debugging</li>
+  <li>r600g: update polygon offset only when rasterizer or zbuffer change</li>
+  <li>r600g: indentation fix</li>
+  <li>r600g: more indentation fix + warning silencing + dead code removal</li>
+  <li>r600g: build fetch shader from vertex elements</li>
+  <li>r600g: avoid useless shader rebuild at draw call</li>
+  <li>r600g: remove useless flush map</li>
+  <li>r600g: remove dead code</li>
+  <li>r600g: fix userspace fence against lastest kernel</li>
+  <li>r600g: avoid using pb* helper we are loosing previous cpu cycle with it</li>
+  <li>r600g: specialized upload manager</li>
+  <li>r600g: indentation cleanup</li>
+  <li>r600g: fix bo size when creating bo from handle</li>
+  <li>r600g: fix segfault when translating vertex buffer</li>
+  <li>r600g: need to reference upload buffer as the might still live accross flush</li>
+  <li>r600g: properly unset vertex buffer</li>
+  <li>r600g: avoid segfault</li>
+</ul></p>
+
+<p>Joakim Sindholt (3):
+<ul>
+  <li>util/u_blitter: fix leak</li>
+  <li>radeong: fix leaks</li>
+  <li>r300g: silence guard band cap errors</li>
+</ul></p>
+
+<p>Johann Rudloff (3):
+<ul>
+  <li>radeon: Implement EGL_MESA_no_surface_extension</li>
+  <li>radeon: Implement __DRI_IMAGE and EGL_MESA_image_drm</li>
+  <li>radeon: Implement GL_OES_EGL_image</li>
+</ul></p>
+
+<p>John Doe (3):
+<ul>
+  <li>r600g: misc cleanup</li>
+  <li>r600g: don't double count dirty block</li>
+  <li>r600g: keep a mapping around for each bo</li>
+</ul></p>
+
+<p>Jon TURNEY (1):
+<ul>
+  <li>Ensure -L$(TOP)/$(LIB_DIR) appears in link line before any -L in $LDFLAGS</li>
+</ul></p>
+
+<p>José Fonseca (128):
+<ul>
+  <li>gallivm: Fix address register swizzle.</li>
+  <li>gallivm: Start collecting bitwise arithmetic helpers in a new module.</li>
+  <li>gallivm: Clamp indirect register indices to file_max.</li>
+  <li>util: linearized sRGB values don't fit into 8bits</li>
+  <li>llvmpipe: Default to no threading on single processor systems.</li>
+  <li>tgsi: Don't ignore indirect registers in tgsi_check_soa_dependencies</li>
+  <li>llvmpipe: Describe how to profile llvmpipe.</li>
+  <li>llvmpipe: When failing free fs shader too.</li>
+  <li>util: Flush stdout on util_format.</li>
+  <li>gallivm: Add unorm support to lp_build_lerp()</li>
+  <li>llvmpipe: Special case complementary and identify blend factors in SoA.</li>
+  <li>llvmpipe: Make rgb/alpha bland func/factors match, when there is no alpha.</li>
+  <li>draw: Prevent clipped vertices overflow.</li>
+  <li>draw: Fullfil the new min_lod/max_lod/lod_bias/border_color dynamic state</li>
+  <li>gallivm: Fetch the lod from the dynamic state when min_lod == max_lod.</li>
+  <li>gallivm: Remove dead experimental code.</li>
+  <li>llvmpipe: Decouple sampler view and sampler state updates.</li>
+  <li>scons: New build= option, with support for checked builds.</li>
+  <li>scons: New build= option, with support for checked builds.</li>
+  <li>trace: Fix set_index_buffer and draw_vbo tracing.</li>
+  <li>python/retrace: Handle set_index_buffer and draw_vbo.</li>
+  <li>gallivm: Use SSE4.1's ROUNDSS/ROUNDSD for scalar rounding.</li>
+  <li>gallivm: More comprehensive border usage logic.</li>
+  <li>retrace: Handle clear_render_target and clear_depth_stencil.</li>
+  <li>llvmpipe: Dump a few missing shader key flags.</li>
+  <li>llvmpipe: Fix perspective interpolation for point sprites.</li>
+  <li>llvmpipe: Fix sprite coord perspective interpolation of Q.</li>
+  <li>gallivm: Take the type signedness in consideration in round/ceil/floor.</li>
+  <li>gallivm: Use a faster (and less accurate) log2 in lod computation.</li>
+  <li>gallivm: Fast implementation of iround(log2(x))</li>
+  <li>gallivm: Combined ifloor &amp; fract helper.</li>
+  <li>gallivm: Only apply min/max_lod when necessary.</li>
+  <li>gallivm: Compute lod as integer whenever possible.</li>
+  <li>util: Cleanup util_pack_z_stencil and friends.</li>
+  <li>llvmpipe: Cleanup depth-stencil clears.</li>
+  <li>gallivm: Vectorize the rho computation.</li>
+  <li>gallivm: Do not do mipfiltering when magnifying.</li>
+  <li>gallivm: Simplify lp_build_mipmap_level_sizes' interface.</li>
+  <li>gallivm: Don't compute the second mipmap level when frac(lod) == 0</li>
+  <li>gallivm: Use lp_build_ifloor_fract for lod computation.</li>
+  <li>gallivm: Clamp mipmap level and zero mip weight simultaneously.</li>
+  <li>gallivm: Fix copy'n'paste typo in previous commit.</li>
+  <li>gallivm: Implement brilinear filtering.</li>
+  <li>gallivm: Use the wrappers for SSE pack intrinsics.</li>
+  <li>gallivm: Avoid control flow for two-sided stencil test.</li>
+  <li>gallivm: Warn when doing inefficient integer comparisons.</li>
+  <li>gallivm: Move into the as much of the second level code as possible.</li>
+  <li>llvmpipe: First minify the texture size, then broadcast.</li>
+  <li>gallivm: Help for combined extraction and broadcasting.</li>
+  <li>gallivm: Do size computations simultanously for all dimensions (AoS).</li>
+  <li>llvmpipe: Prevent z &gt; 1.0</li>
+  <li>llvmpipe: Fix MSVC build. Enable the new SSE2 code on non SSE3 systems.</li>
+  <li>gallivm: Handle code have ret correctly.</li>
+  <li>util: Defined M_SQRT2 when not available.</li>
+  <li>gallivm: Less code duplication in log computation.</li>
+  <li>gallivm: Special bri-linear computation path for unmodified rho.</li>
+  <li>gallivm: Don't generate Phis for execution mask.</li>
+  <li>gallivm: Use varilables instead of Phis for cubemap selection.</li>
+  <li>gallivm: Remove support for Phi generation.</li>
+  <li>gallivm: Factor out the SI-&gt;FP texture size conversion for SoA path too</li>
+  <li>gallivm: Simplify if/then/else implementation.</li>
+  <li>gallivm: Cleanup the rest of the flow module.</li>
+  <li>gallivm: Fix a long standing bug with nested if-then-else emission.</li>
+  <li>gallivm: Allow to disable bri-linear filtering with GALLIVM_DEBUG=no_brilinear runtime option</li>
+  <li>gallivm: Use variables instead of Phis in loops.</li>
+  <li>gallivm: Pass texture coords derivates as scalars.</li>
+  <li>llvmpipe: Remove outdated comment about stencil testing.</li>
+  <li>gallivm: Eliminate unsigned integer arithmetic from texture coordinates.</li>
+  <li>gallium: Define C99 restrict keyword where absent.</li>
+  <li>tgsi: Export some names for some tgsi enums.</li>
+  <li>gallivm: More detailed analysis of tgsi shaders.</li>
+  <li>llvmpipe: Use lp_tgsi_info.</li>
+  <li>llvmpipe: Do not dispose the execution engine.</li>
+  <li>llvmpipe: Fix MSVC build.</li>
+  <li>llmvpipe: improve mm_mullo_epi32</li>
+  <li>gallivm: Name anonymous union.</li>
+  <li>llvmpipe: Unbreak Z32_FLOAT.</li>
+  <li>gallivm: More accurate float -&gt; 24bit &amp; 32bit unorm conversion.</li>
+  <li>llvmpipe: Generalize the x8z24 fast path to all depth formats.</li>
+  <li>llvmpipe: Fix depth-stencil regression.</li>
+  <li>llvmpipe: Ensure z_shift and z_width is initialized.</li>
+  <li>gallivm: Fix SoA cubemap derivative computation.</li>
+  <li>llvmpipe: Fix bad refactoring.</li>
+  <li>llvmpipe: Initialize bld ctx via lp_build_context_init instead of ad-hoc and broken code.</li>
+  <li>gallivm: Comment lp_build_insert_new_block().</li>
+  <li>gallivm: Add a note about SSE4.1's nearest mode rounding.</li>
+  <li>llvmpipe: Don't test rounding of x.5 numbers.</li>
+  <li>gallium: Avoid using __doc__ in python scripts.</li>
+  <li>gallivm: always enable LLVMAddInstructionCombiningPass()</li>
+  <li>gallivm: Remove the EMMS opcodes.</li>
+  <li>mesa: Fix windows build (uint -&gt; GLuint).</li>
+  <li>scons: Revamp how to specify targets to build.</li>
+  <li>scons: Fix MinGW cross-compilation.</li>
+  <li>scons: Some pipe drivers are not portable for MSVC</li>
+  <li>scons: Restore x11 tool behavior for backwards compatability.</li>
+  <li>scons: Disable python state tracker when swig is not present.</li>
+  <li>r600g: List recently added files in SConscript.</li>
+  <li>scons: Add aliases for several pipe drivers.</li>
+  <li>scons: i915 can't build on MSVC either.</li>
+  <li>scons: Propagate installation targets.</li>
+  <li>xorg/vmwgfx: Add missing source file to SConscript.</li>
+  <li>st/xorg: Add missing n to error message.</li>
+  <li>st/xorg: Detect libkms with scons too.</li>
+  <li>xorg/vmwgfx: Link libkms when available.</li>
+  <li>r600g: Swap the util_blitter_destroy call order.</li>
+  <li>gallivm: Allocate TEMP/OUT arrays only once.</li>
+  <li>libgl-gdi: Allow to pick softpipe/llvmpipe on runtime.</li>
+  <li>scons: Use inline wrap helpers more consistently.</li>
+  <li>svga: Use consistent hexadecimal representation on debug output.</li>
+  <li>scons: Alias for svga</li>
+  <li>wgl: Stub WGL_ARB_pbuffer support.</li>
+  <li>wgl: More complete WGL_ARB_pbuffer support.</li>
+  <li>svga: Silence debug printf.</li>
+  <li>scons: Move MSVS_VERSION option to common module.</li>
+  <li>vega: Remove extraneous ;</li>
+  <li>retrace: Some fixes.</li>
+  <li>util: C++ safe.</li>
+  <li>wgl: Fix double free. Remove dead code.</li>
+  <li>util: Plug leaks in util_destroy_gen_mipmap.</li>
+  <li>util: __builtin_frame_address() doesn't work on mingw.</li>
+  <li>util: Don't try to use imagehlp on mingw.</li>
+  <li>wgl: Unreference the current framebuffer after the make_current call.</li>
+  <li>WIN32_THREADS -&gt; WIN32</li>
+  <li>mapi: Hack to avoid vgCreateFont being generated as vgCreateFontA.</li>
+  <li>wgl: Fix visual's buffer_mask configuration.</li>
+  <li>mesa: Temporary hack to prevent stack overflow on windows</li>
+  <li>mesa: Bump the number of bits in the register index.</li>
+  <li>llvmpipe: Plug fence leaks.</li>
+</ul></p>
+
+<p>Julien Cristau (1):
+<ul>
+  <li>Makefile: don't include the same files twice in the tarball</li>
+</ul></p>
+
+<p>Keith Whitwell (89):
+<ul>
+  <li>llvmpipe: brackets around macro arg</li>
+  <li>llvmpipe: remove duplicate code</li>
+  <li>llvmpipe: return zero from floor_pot(zero)</li>
+  <li>gallivm: make lp_build_sample_nop public</li>
+  <li>llvmpipe: add LP_PERF flag to disable various aspects of rasterization</li>
+  <li>llvmpipe: add DEBUG_FS to dump variant information</li>
+  <li>llvmpipe: use llvm for attribute interpolant calculation</li>
+  <li>graw: add frag-face shader</li>
+  <li>llvmpipe: fix flatshading in new line code</li>
+  <li>draw: don't apply flatshading to clipped tris with &lt3 verts</li>
+  <li>llvmpipe: handle FACING interpolants in line and point setup</li>
+  <li>llvmpipe: handle up to 8 planes in triangle binner</li>
+  <li>llvmpipe: make debug_fs_variant respect variant-&gt;nr_samplers</li>
+  <li>gallivm: don't apply zero lod_bias</li>
+  <li>llvmpipe: fail gracefully on oom in scene creation</li>
+  <li>llvmpipe: avoid overflow in triangle culling</li>
+  <li>gallivm: special case conversion 4x4f to 1x16ub</li>
+  <li>gallivm: round rather than truncate in new 4x4f-&gt;1x16ub conversion path</li>
+  <li>llvmpipe: clean up setup_tri a little</li>
+  <li>llvmpipe: add rast_tri_4_16 for small lines and points</li>
+  <li>llvmpipe: fix off-by-one in tri_16</li>
+  <li>llvmpipe: defer attribute interpolation until after mask and ztest</li>
+  <li>llvmpipe: use alloca for fs color outputs</li>
+  <li>llvmpipe: store zero into all alloca'd values</li>
+  <li>llvmpipe: dump fragment shader ir and asm when LP_DEBUG=fs</li>
+  <li>gallivm: specialized x8z24 depthtest path</li>
+  <li>gallivm: prefer blendvb for integer arguments</li>
+  <li>gallivm: simpler uint8-&gt;float conversions</li>
+  <li>llvmpipe: try to be sensible about whether to branch after mask updates</li>
+  <li>llvmpipe: clean up shader pre/postamble, try to catch more early-z</li>
+  <li>llvmpipe: simplified SSE2 swz/unswz routines</li>
+  <li>llvmpipe: try to do more of rast_tri_3_16 with intrinsics</li>
+  <li>llvmpipe: add debug helpers for epi32 etc</li>
+  <li>llvmpipe: try to keep plane c values small</li>
+  <li>llvmpipe: fix typo in last commit</li>
+  <li>gallium: move sse intrinsics debug helpers to u_sse.h</li>
+  <li>r600g: add missing file to sconscript</li>
+  <li>gallivm: don't branch on KILLs near end of shader</li>
+  <li>Revert "llvmpipe: try to keep plane c values small"</li>
+  <li>llvmpipe: make sure intrinsics code is guarded with PIPE_ARCH_SSE</li>
+  <li>llvmpipe: don't try to emit non-existent color outputs</li>
+  <li>r600/drm: fix segfaults in winsys create failure path</li>
+  <li>r600g: emit hardware linewidth</li>
+  <li>r600g: handle absolute modifier in shader translator</li>
+  <li>llvmpipe: reintroduce SET_STATE binner command</li>
+  <li>llvmpipe: don't pass frontfacing as a float</li>
+  <li>llvmpipe: slightly shrink the size of a binned triangle</li>
+  <li>llvmpipe: don't store plane.ei value in binned data</li>
+  <li>gallium: move some intrinsics helpers to u_sse.h</li>
+  <li>llvmpipe: do plane calculations with intrinsics</li>
+  <li>llvmpipe: use aligned loads/stores for plane values</li>
+  <li>llvmpipe: fix non-sse build after recent changes</li>
+  <li>llvmpipe: check shader outputs are non-null before using</li>
+  <li>llvmpipe: validate color outputs against key-&gt;nr_cbufs</li>
+  <li>llvmpipe: clean up fields in draw_llvm_variant_key</li>
+  <li>llvmpipe: remove setup fallback path</li>
+  <li>llvmpipe: fail cleanly on malloc failure in lp_setup_alloc_triangle</li>
+  <li>Merge remote branch 'origin/master' into lp-setup-llvm</li>
+  <li>llvmpipe: remove unused file</li>
+  <li>llvmpipe: remove unused arg from jit_setup_tri function</li>
+  <li>Merge branch 'llvm-cliptest-viewport'</li>
+  <li>draw: make sure viewport gets updated in draw llvm shader</li>
+  <li>llvmpipe: turn off draw offset/twoside when we can handle it</li>
+  <li>llvmpipe: avoid generating tri_16 for tris which extend past tile bounds</li>
+  <li>llvmpipe: guard against NULL task-&gt;query pointer</li>
+  <li>st/mesa: unbind constant buffer when not in use</li>
+  <li>r600g: propagate usage flags in texture transfers</li>
+  <li>r600g: propogate resource usage flags to winsys, use to choose bo domains</li>
+  <li>r600g: use a buffer in GTT as intermediate on texture up and downloads</li>
+  <li>r600g: remove unused flink, domain fields from r600_resource</li>
+  <li>r600g: set hardware pixel centers according to gl_rasterization_rules</li>
+  <li>evergreeng: protect against null constant buffers</li>
+  <li>r600g: don't call debug_get_bool_option for tiling more than once</li>
+  <li>evergreeng: respect linewidth state, use integer widths only</li>
+  <li>evergreeng: set hardware pixelcenters according to gl_rasterization_rules</li>
+  <li>r600g: avoid recursion with staged uploads</li>
+  <li>r600g: attempt to turn on DXTn formats</li>
+  <li>r600g: translate ARR instruction</li>
+  <li>r600: fix my pessimism about PIPE_TRANSFER_x flags</li>
+  <li>ws/r600: match bo_busy shared/fence logic in bo_wait</li>
+  <li>r600g: guard experimental s3tc code with R600_ENABLE_S3TC</li>
+  <li>r600g: do not try to use staging resource for depth textures</li>
+  <li>r600g: enforce minimum stride on render target texture images</li>
+  <li>llvmpipe: fix up twoside after recent changes</li>
+  <li>llvmpipe: twoside for specular color also</li>
+  <li>Merge branch 'lp-offset-twoside'</li>
+  <li>llvmpipe: raise dirty flag on transfers to bound constbuf</li>
+  <li>llvmpipe: remove misleading debug string</li>
+  <li>llvmpipe: shortcircuit some calls to set_scene_state</li>
+</ul></p>
+
+<p>Kenneth Graunke (94):
+<ul>
+  <li>glsl: Change from has_builtin_signature to has_user_signature.</li>
+  <li>glsl: Don't print blank (function ...) headers for built-ins.</li>
+  <li>glsl: Properly handle nested structure types.</li>
+  <li>glsl/builtins: Fix equal and notEqual builtins.</li>
+  <li>glsl/builtins: Switch comparison functions to just return an expression.</li>
+  <li>glsl: Add comments to clarify the types of comparison binops.</li>
+  <li>glsl: Fix broken handling of ir_binop_equal and ir_binop_nequal.</li>
+  <li>glsl: "Copyright", not "Constantright"</li>
+  <li>i965: Fix incorrect batchbuffer size in gen6 clip state command.</li>
+  <li>i965: Use logical-not when emitting ir_unop_ceil.</li>
+  <li>glsl: Add front-end support for the "trunc" built-in.</li>
+  <li>glsl: Refresh autogenerated file builtin_function.cpp.</li>
+  <li>i965: Use RNDZ for ir_unop_trunc in the new FS.</li>
+  <li>i965: Correctly emit the RNDZ instruction.</li>
+  <li>i965: Clean up a warning in the old fragment backend.</li>
+  <li>glsl: Add a new ir_unop_round_even opcode for GLSL 1.30's roundEven.</li>
+  <li>glsl: Add front-end support for GLSL 1.30's roundEven built-in.</li>
+  <li>i965: Add support for ir_unop_round_even via the RNDE instruction.</li>
+  <li>glsl: Add support for the 1.30 round() built-in.</li>
+  <li>glsl: Refresh autogenerated file builtin_function.cpp.</li>
+  <li>glsl: Don't return NULL IR for erroneous bit-shift operators.</li>
+  <li>i965: Add missing "break" statement.</li>
+  <li>glsl: Fix copy and paste error in ast_bit_and node creation.</li>
+  <li>glsl: Regenerate parser files.</li>
+  <li>i965: Remove unused variable.</li>
+  <li>glsl: Remove useless ir_shader enumeration value.</li>
+  <li>mesa: Remove FEATURE_ARB_shading_language_120 macro.</li>
+  <li>glcpp: Return NEWLINE token for newlines inside multi-line comments.</li>
+  <li>glcpp: Refresh autogenerated lexer file.</li>
+  <li>glsl: Add support for GLSL 1.30's modf built-in.</li>
+  <li>glsl: Refresh autogenerated file builtin_function.cpp.</li>
+  <li>generate_builtins.py: Output large strings as arrays of characters.</li>
+  <li>Refresh autogenerated file builtin_function.cpp.</li>
+  <li>glsl: Fix constant component count in vector constructor emitting.</li>
+  <li>Fix build on systems where "python" is python 3.</li>
+  <li>i965: Add bit operation support to the fragment shader backend.</li>
+  <li>glsl: Remove unused ARRAY_SIZE macro.</li>
+  <li>glsl/builtins: Rename 'x' to 'y_over_x' in atan(float) implementation.</li>
+  <li>glsl/builtins: Clean up some ugly autogenerated code in atan.</li>
+  <li>Refresh autogenerated file builtin_function.cpp.</li>
+  <li>glsl: Don't print a useless space at the end of an S-Expression list.</li>
+  <li>ir_reader: Return a specific ir_dereference variant.</li>
+  <li>ir_reader: Remove useless error check.</li>
+  <li>ir_reader: Fix some potential NULL pointer dereferences.</li>
+  <li>ir_dead_functions: Actually free dead functions and signatures.</li>
+  <li>glsl: Remove unnecessary "unused variable" warning suppression.</li>
+  <li>glsl: Remove GLSL_TYPE_FUNCTION define.</li>
+  <li>glsl: Convert glsl_type::base_type from #define'd constants to an enum.</li>
+  <li>glsl: Rework reserved word/keyword handling in the lexer.</li>
+  <li>glsl: Add new keywords and reserved words for GLSL 1.30.</li>
+  <li>glsl: Add support for the 'u' and 'U' unsigned integer suffixes.</li>
+  <li>glsl: Refresh autogenerated lexer and parser files.</li>
+  <li>generate_builtins.py: Fix inconsistent use of tabs and spaces warning.</li>
+  <li>glsl: Implement the asinh, acosh, and atanh built-in functions.</li>
+  <li>glsl: Refresh autogenerated file builtin_function.cpp.</li>
+  <li>glsl: Add constant expression handling for asinh, acosh, and atanh.</li>
+  <li>glsl: Remove unused and out of date Makefile.am.</li>
+  <li>glsl: Rename various ir_* files to lower_* and opt_*.</li>
+  <li>glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version &gt;= 1.30.</li>
+  <li>Refresh autogenerated glcpp parser.</li>
+  <li>glsl: Fix constant expression handling for &lt, &gt;, &lt=, &gt;= on vectors.</li>
+  <li>glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.</li>
+  <li>Regenerate glcpp parser.</li>
+  <li>glsl: Reimplement the "cross" built-in without ir_binop_cross.</li>
+  <li>Refresh autogenerated file builtin_function.cpp.</li>
+  <li>glsl: Remove the ir_binop_cross opcode.</li>
+  <li>glsl: Refactor get_num_operands.</li>
+  <li>glsl: Simplify a type check by using type-&gt;is_integer().</li>
+  <li>glsl: Combine many instruction lowering passes into one.</li>
+  <li>mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.</li>
+  <li>glsl: Don't inline function prototypes.</li>
+  <li>glsl: Use do_common_optimization in the standalone compiler.</li>
+  <li>glsl: Add a virtual as_discard() method.</li>
+  <li>glsl: Refactor out cloning of function prototypes.</li>
+  <li>glsl: Lazily import built-in function prototypes.</li>
+  <li>glsl: Remove anti-built-in hacks from the print visitor.</li>
+  <li>glsl/linker: Free any IR discarded by optimization passes.</li>
+  <li>glsl: Add an optimization pass to simplify discards.</li>
+  <li>glsl: Add a lowering pass to move discards out of if-statements.</li>
+  <li>glsl: Remove "discard" support from lower_jumps.</li>
+  <li>glsl: Add comments to lower_jumps (from the commit message).</li>
+  <li>ir_print_visitor: Print out constant structure values.</li>
+  <li>glsl: Factor out code which emits a new function into the IR stream.</li>
+  <li>symbol_table: Add support for adding a symbol at top-level/global scope.</li>
+  <li>glsl: Properly add functions during lazy built-in prototype importing.</li>
+  <li>glcpp: Don't emit SPACE tokens in conditional_tokens production.</li>
+  <li>Refresh autogenerated glcpp parser.</li>
+  <li>glsl: Clean up code by adding a new is_break() function.</li>
+  <li>glsl: Consider the "else" branch when looking for loop breaks.</li>
+  <li>Remove OES_compressed_paletted_texture from the ES2 extension list.</li>
+  <li>glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).</li>
+  <li>glsl: Support if-flattening beyond a given maximum nesting depth.</li>
+  <li>i965: Flatten if-statements beyond depth 16 on pre-gen6.</li>
+  <li>i965: Internally enable GL_NV_blend_square on ES2.</li>
+</ul></p>
+
+<p>Kristian Høgsberg (16):
+<ul>
+  <li>glx: Hold on to drawables if we're just switching to another context</li>
+  <li>intel: Fix GL_ARB_shading_language_120 commit</li>
+  <li>dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext</li>
+  <li>glx: Invalidate buffers after binding a drawable</li>
+  <li>dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup</li>
+  <li>glx: Only remove drawables from the hash when we actually delete them</li>
+  <li>gles2: Add GL_EXT_texture_format_BGRA8888 support</li>
+  <li>Get rid of GL/internal/glcore.h</li>
+  <li>gl: Remove unused GLcontextModes fields</li>
+  <li>Rename GLvisual and __GLcontextModes to struct gl_config</li>
+  <li>Drop GLframebuffer typedef and just use struct gl_framebuffer</li>
+  <li>Drop GLcontext typedef and use struct gl_context instead</li>
+  <li>Drop the "neutral" tnl module</li>
+  <li>Only install vtxfmt tables for OpenGL</li>
+  <li>i965: Don't write mrf assignment for pointsize output</li>
+  <li>docs: Fix MESA_drm_image typo</li>
+</ul></p>
+
+<p>Krzysztof Smiechowicz (1):
+<ul>
+  <li>nvfx: Pair os_malloc_aligned() with os_free_aligned().</li>
+</ul></p>
+
+<p>Luca Barbieri (84):
+<ul>
+  <li>auxiliary: fix unintended fallthrough</li>
+  <li>glsl: add pass to lower variable array indexing to conditional assignments</li>
+  <li>auxiliary: fix depth-only and stencil-only clears</li>
+  <li>gallium: avoid the C++ keyword "template" in sw_winsys.h</li>
+  <li>softpipe: make z/s test always pass if no zsbuf, instead of crashing</li>
+  <li>tgsi: add switch/case opcodes to tgsi_opcode_tmp.h</li>
+  <li>softpipe: fix whitespace</li>
+  <li>d3d1x: add new Direct3D 10/11 COM state tracker for Gallium</li>
+  <li>d3d1x: add blob and signature extraction APIs</li>
+  <li>d3d1x: fix compilation with recent Wine versions installed</li>
+  <li>d3d1x: add missing file</li>
+  <li>d3d1x: actually enable and fix blob apis</li>
+  <li>d3d1x: fix build with compilers other than GCC 4.5</li>
+  <li>d3d1x: add template parameters to base class ctor calls for GCC 4.4</li>
+  <li>d3d1x: fix GCC 4.1/4.2 build</li>
+  <li>d3d1x: ignore errors while building docs</li>
+  <li>d3d1x: attempt to fix/workaround bug #30322</li>
+  <li>nvfx: remove gl_PointCoord hack</li>
+  <li>glx: decouple dri2.c and GLX, fixing Gallium EGL and d3d1x build</li>
+  <li>winsys: automatically build sw winsys needed by EGL and d3d1x</li>
+  <li>d3d1x: don't build progs automatically</li>
+  <li>d3d1x: add missing memory barrier</li>
+  <li>d3d1x: link with CXXFLAGS</li>
+  <li>d3d1x: fix cf analysis</li>
+  <li>d3d1x: fix warning</li>
+  <li>d3d1x: fix segfault when hashing</li>
+  <li>d3d1x: destroy native_display on adapter destruction</li>
+  <li>d3d1x: fix GUID declarations</li>
+  <li>d3d1x: redesign the HWND resolver interface</li>
+  <li>d3d1x: fix API name</li>
+  <li>d3d1x: define GUIDs in the normal way</li>
+  <li>d3d1x: add Wine dlls (tri, tex working, but no other testing)</li>
+  <li>d3d1x: properly reference count the backend</li>
+  <li>d3d1x: fix deadlocks on non-recursive mutex</li>
+  <li>d3d1x: bind NULL CSOs before destroying default CSOs on context dtor</li>
+  <li>d3d1x: initialize the mutex</li>
+  <li>d3d1x: autogenerate shader enums and text from def files</li>
+  <li>d3d1x: s/tpf/sm4/g</li>
+  <li>d3d1x: normalize whitespace</li>
+  <li>d3d1x: remove specstrings</li>
+  <li>d3d1x: minifix</li>
+  <li>d3d1x: rename context params</li>
+  <li>d3d11: rename screen params</li>
+  <li>d3d1x: rename params in misc and objects</li>
+  <li>d3d1x: rename parameters in dxgi</li>
+  <li>d3d11: obliterate IDL parameter names</li>
+  <li>d3d1x: remove specstrings.h include</li>
+  <li>d3d1x: flush the pipe context when presenting</li>
+  <li>d3d1x: remove another include specstrings.h</li>
+  <li>d3d1x: flush properly</li>
+  <li>d3d1x: add missing guid.cpp</li>
+  <li>d3d1x: fix build without system EGL/egl.h</li>
+  <li>d3d1x: add autogenerated files as prerequisites, so make builds them</li>
+  <li>d3d1x: obliterate IDL parameter names from d3d10.idl from Wine too</li>
+  <li>d3d1x: add shader dumping</li>
+  <li>d3d1x: add untested support for geometry shader translation</li>
+  <li>d3d1x: don't assert on unsupported resource types</li>
+  <li>d3d1x: fix CheckMultisampleQualityLevels</li>
+  <li>d3d1x: draw to the correct buffer</li>
+  <li>d3d1x: fix linking of dxbc2tgsi</li>
+  <li>nvfx: allow setting NULL constant buffers</li>
+  <li>nvfx: add RGB framebuffer format support in addition to BGR</li>
+  <li>d3d1x: don't crash on drivers not supporting vertex or geometry sampling</li>
+  <li>d3d1x: assert if X visual is not among enumerated visuals</li>
+  <li>d3d1x: stop using GLX in demos, just use the default visual</li>
+  <li>d3d1x: CRLF -&gt; LF in progs</li>
+  <li>mesa: make makedepend an hard requirement</li>
+  <li>gallium: add $(PROGS_DEPS) as dependencies for $(PROGS)</li>
+  <li>d3d1x: fix parallel build</li>
+  <li>d3d1x: add private gitignore file</li>
+  <li>d3d1x: fix progs linking if not all EGL platforms are enabled</li>
+  <li>d3d1x: link progs with CXXFLAGS</li>
+  <li>d3d11: advertise IDXGIDevice1, not just IDXGIDevice</li>
+  <li>d3d11: ignore StructureByteStride</li>
+  <li>d3d1x: link to libdrm for X11 platform too</li>
+  <li>ureg: support centroid interpolation</li>
+  <li>d3d1x: support centroid interpolation</li>
+  <li>d3d1x: properly support specifying MipLevels as 0</li>
+  <li>d3d1x: put proper calling convention in headers, fixes 64-bit builds</li>
+  <li>d3d1x: rework DXGI for occlusion testing and default width/height</li>
+  <li>d3d1x: fix Map</li>
+  <li>d3d11: fix reference counting so devices get freed</li>
+  <li>d3d1x: work around crash in widl</li>
+  <li>glsl: Unroll loops with conditional breaks anywhere (not just the end)</li>
+</ul></p>
+
+<p>Lucas Stach (1):
+<ul>
+  <li>nvfx: fill PIPE_CAP_PRIMITIVE_RESTART and PIPE_CAP_SHADER_STENCIL_EXPORT</li>
+</ul></p>
+
+<p>Marek Olšák (100):
+<ul>
+  <li>r300g: prevent creating multiple winsys BOs for the same handle</li>
+  <li>r300g/swtcl: fix CS overrun</li>
+  <li>st/mesa: fix assertion failure in GetTexImage for cubemaps</li>
+  <li>util: make calling remove_from_list multiple times in a row safe</li>
+  <li>r300g: fixup long-lived BO maps being incorrectly unmapped when flushing</li>
+  <li>r300g: make accessing map_list and buffer_handles thread-safe</li>
+  <li>r300g: fix a copy-paste typo for logging</li>
+  <li>r300g: fix the border color for every format other than PIPE_FORMAT_B8G8R8A8</li>
+  <li>Build r300g by default</li>
+  <li>util: fix util_pack_color for B4G4R4A4</li>
+  <li>r300g: fix macrotiling on R350</li>
+  <li>r300g: code cleanups</li>
+  <li>r300/compiler: fix projective mapping of 2D NPOT textures</li>
+  <li>r300/compiler: do not use copy propagation if SaturateMode is used</li>
+  <li>r300/compiler: fix shadow sampling with swizzled coords</li>
+  <li>r300g: add support for 3D NPOT textures without mipmapping</li>
+  <li>r300g: fix swizzling of texture border color</li>
+  <li>configure.ac: look for libdrm_radeon before building gallium/r300,r600</li>
+  <li>configure.ac: do not build xorg-r300g by default</li>
+  <li>Makefile: ensure Gallium's Makefile.xorg and SConscript.dri are in the tarball</li>
+  <li>r300g: add support for formats beginning with X, like X8R8G8B8</li>
+  <li>r300g: fix conditional rendering in non-wait path</li>
+  <li>r300g: add support for R8G8 colorbuffers</li>
+  <li>r300g: add support for L8A8 colorbuffers</li>
+  <li>update release notes for Gallium</li>
+  <li>r300g: fix microtiling for 16-bits-per-channel formats</li>
+  <li>r300g: do not print get_param errors in non-debug build</li>
+  <li>r300g: say no to PIPE_CAP_STREAM_OUTPUT and PIPE_CAP_PRIMITIVE_RESTART</li>
+  <li>mesa: allow FBO attachments of formats LUMINANCE, LUMINANCE_ALPHA, and INTENSITY</li>
+  <li>r300g: fix texture border for 16-bits-per-channel formats</li>
+  <li>st/mesa: support RGBA16 and use it for RGBA12 as well</li>
+  <li>r300g: add a default channel ordering of texture border for unhandled formats</li>
+  <li>r300g: mention ATI in the renderer string</li>
+  <li>r300g: rename has_hyperz -&gt; can_hyperz</li>
+  <li>r300g: turn magic numbers into names in the hyperz code</li>
+  <li>gallium: add CAPs for indirect addressing and lower it in st/mesa when needed</li>
+  <li>tgsi: fill out CAPs for indirect addressing</li>
+  <li>i915g: fill out CAPs for indirect addressing</li>
+  <li>i965g: fill out CAPs for indirect addressing</li>
+  <li>nv50: fill out CAPs for indirect addressing</li>
+  <li>nvfx: fill out CAPs for indirect addressing</li>
+  <li>r300g: fill out CAPs for indirect addressing</li>
+  <li>r600g: fill out CAPs for indirect addressing</li>
+  <li>svga: fill out CAPs for indirect addressing</li>
+  <li>r300g: fix texture border color for all texture formats</li>
+  <li>r300g: clean up redundancy in draw functions</li>
+  <li>r300g: return shader caps from Draw for SWTCL vertex shaders</li>
+  <li>r300g: remove the hack with OPCODE_RET</li>
+  <li>r300g: print FS inputs uninitialized due to hardware limits to stderr</li>
+  <li>r300g: fix rendering with no vertex elements</li>
+  <li>st/mesa: enable ARB_explicit_attrib_location and EXT_separate_shader_objects</li>
+  <li>docs: add GL 4.1 status</li>
+  <li>gallium: add PIPE_SHADER_CAP_SUBROUTINES</li>
+  <li>st/mesa: set MaxUniformComponents</li>
+  <li>u_blitter: use PIPE_TRANSFER_DISCARD to prevent cpu/gpu stall</li>
+  <li>r300/compiler: fix rc_rewrite_depth_out for it to work with any instruction</li>
+  <li>r300/compiler: remove duplicate function rc_mask_to_swz</li>
+  <li>r300/compiler: add a function for swizzling a mask</li>
+  <li>r300/compiler: move util functions to radeon_compiler_util</li>
+  <li>u_blitter: interpolate clear color using a GENERIC varying instead of COLOR</li>
+  <li>st/mesa: fix texture border color for RED and RG base formats</li>
+  <li>util: rename u_mempool -&gt; u_slab</li>
+  <li>r300g: fix texture border color once again</li>
+  <li>r300/compiler: implement and lower OPCODE_CLAMP</li>
+  <li>ir_to_mesa: Add support for conditional discards.</li>
+  <li>r300g: fix texture swizzling with compressed textures on r400-r500</li>
+  <li>r300g: disable ARB_texture_swizzle if S3TC is enabled on r3xx-only</li>
+  <li>r300g: fix up cubemap texture offset computation</li>
+  <li>r300/compiler: disable the swizzle lowering pass in vertex shaders</li>
+  <li>r300g: fix build</li>
+  <li>r300g: use internal BO handle for add_buffer and write_reloc</li>
+  <li>r300g: implement simple transfer_inline_write for buffers</li>
+  <li>mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium</li>
+  <li>r300g: fix pointer arithmetic with void* in transfer_inline_write</li>
+  <li>r300g: do not remove unused constants if we are not near the limit</li>
+  <li>r300g: add capability bit index_bias_supported</li>
+  <li>r300g: one more r500_index_bias_supported leftover</li>
+  <li>r300g: do not use the index parameter in set_constant_buffer</li>
+  <li>r300g: cleanup winsys</li>
+  <li>r300g: optimize looping over atoms</li>
+  <li>st/mesa: initialize key in st_vp_varient</li>
+  <li>u_blitter: use util_is_format_compatible in the assert</li>
+  <li>r300g: cache packet dwords of 3D_LOAD_VBPNTR in a command buffer if possible</li>
+  <li>r300g: validate buffers only if any of bound buffers is changed</li>
+  <li>r300g: also revalidate the SWTCL vertex buffer after its reallocation</li>
+  <li>r300/compiler: don't terminate regalloc if we surpass max temps limit</li>
+  <li>r300/compiler: add a function to query program stats (alu, tex, temps..)</li>
+  <li>r300/compiler: cleanup rc_run_compiler</li>
+  <li>r300/compiler: do not print pair/tex/presub program stats for vertex shaders</li>
+  <li>r300/compiler: handle DPH and XPD in rc_compute_sources_for_writemask</li>
+  <li>r300/compiler: make lowering passes possibly use up to two less temps</li>
+  <li>r300/compiler: remove at least unused immediates if externals cannot be removed</li>
+  <li>r300/compiler: fix LIT in VS</li>
+  <li>r300/compiler: fix swizzle lowering with a presubtract source operand</li>
+  <li>r300g: fix rendering with a vertex attrib having a zero stride</li>
+  <li>r300g: finally fix the texture corruption on r3xx-r4xx</li>
+  <li>r300g/swtcl: re-enable LLVM</li>
+  <li>r300g: mark vertex arrays as dirty after a buffer_offset change</li>
+  <li>mesa: fix texel store functions for some float formats</li>
+  <li>r300/compiler: disable the rename_regs pass for loops</li>
+</ul></p>
+
+<p>Mario Kleiner (1):
+<ul>
+  <li>mesa/r300classic: Fix dri2Invalidate/radeon_prepare_render for page flipping.</li>
+</ul></p>
+
+<p>Mathias Fröhlich (3):
+<ul>
+  <li>r300g: Avoid returning values in a static array, fixing a potential race</li>
+  <li>r600g: Only compare active vertex elements</li>
+  <li>st/mesa: Set PIPE_TRANSFER_DISCARD for GL_MAP_INVALIDATE_RANGE/BUFFFER_BIT</li>
+</ul></p>
+
+<p>Michal Krol (10):
+<ul>
+  <li>svga: Fix relative addressing translation for pixel shaders.</li>
+  <li>svga: Integer constant register file has a separate namespace.</li>
+  <li>tgsi/exec: Cleanup the remaining arithmetic instructions.</li>
+  <li>tgsi/exec: Get rid of obsolete condition codes.</li>
+  <li>tgsi/build: Reduce interface clutter.</li>
+  <li>graw/gdi: Initial commit.</li>
+  <li>scons: Hook-up graw-gdi target.</li>
+  <li>graw/gdi: Fix window dimensions.</li>
+  <li>os: Open file streams in binary mode.</li>
+  <li>graw: Export graw_save_surface_to_file().</li>
+</ul></p>
+
+<p>Nicolas Kaiser (26):
+<ul>
+  <li>swrast: remove duplicated include</li>
+  <li>egl: remove duplicated include</li>
+  <li>gallium/rtasm: remove duplicated include</li>
+  <li>gallium/util: remove duplicated include</li>
+  <li>gallium/i915: remove duplicated include</li>
+  <li>gallium/llvmpipe: remove duplicated include</li>
+  <li>gallium/softpipe: remove duplicated include</li>
+  <li>gallium/st: remove duplicated includes</li>
+  <li>gallium/winsys: remove duplicated include</li>
+  <li>glx: remove duplicated include</li>
+  <li>dri/common: remove duplicated include</li>
+  <li>dri/i810: remove duplicated include</li>
+  <li>dri/i915: remove duplicated include</li>
+  <li>dri/i965: remove duplicated include</li>
+  <li>dri/intel: remove duplicated include</li>
+  <li>dri/mga: remove duplicated include</li>
+  <li>dri/r128: remove duplicated include</li>
+  <li>dri/r300: remove duplicated include</li>
+  <li>dri/r600: remove duplicated include</li>
+  <li>dri/radeon: remove duplicated includes</li>
+  <li>dri/savage: remove duplicated include</li>
+  <li>main: remove duplicated includes</li>
+  <li>math: remove duplicated includes</li>
+  <li>st: remove duplicated include</li>
+  <li>i965g: use Elements macro instead of manual sizeofs</li>
+  <li>nv50: fix always true conditional in shader optimization</li>
+</ul></p>
+
+<p>Orion Poplawski (1):
+<ul>
+  <li>osmesa: link against libtalloc</li>
+</ul></p>
+
+<p>Owen W. Taylor (1):
+<ul>
+  <li>r600g: Fix location for clip plane registers</li>
+</ul></p>
+
+<p>Peter Clifton (3):
+<ul>
+  <li>intel: Fix emit_linear_blit to use DWORD aligned width blits</li>
+  <li>intel: Add assert check for blitting alignment.</li>
+  <li>meta: Mask Stencil.Clear against stencilMax in _mesa_meta_Clear</li>
+</ul></p>
+
+<p>Robert Hooker (2):
+<ul>
+  <li>intel: Add a new B43 pci id.</li>
+  <li>egl_dri2: Add missing intel chip ids.</li>
+</ul></p>
+
+<p>Roland Scheidegger (16):
+<ul>
+  <li>gallivm: fix copy&amp;paste bug</li>
+  <li>gallivm: don't use URem/UDiv when calculating offsets for blocks</li>
+  <li>gallivm: optimize yuv decoding</li>
+  <li>gallivm: fix trunc/itrunc comment</li>
+  <li>gallivm: faster iround implementation for sse2</li>
+  <li>gallivm: replace sub/floor/ifloor combo with ifloor_fract</li>
+  <li>gallivm: optimize some tex wrap mode calculations a bit</li>
+  <li>gallivm: more linear tex wrap mode calculation simplification</li>
+  <li>gallivm: avoid unnecessary URem in linear wrap repeat case</li>
+  <li>gallivm: optimize soa linear clamp to edge wrap mode a bit</li>
+  <li>gallivm: make use of new iround code in lp_bld_conv.</li>
+  <li>gallivm: fix different handling of [non]normalized coords in linear soa path</li>
+  <li>gallivm: only use lp_build_conv 4x4f -&gt; 1x16 ub fastpath with sse2</li>
+  <li>r200: fix r200 large points</li>
+  <li>mesa: remove unneeded DD_POINT_SIZE and DD_LINE_WIDTH tricaps</li>
+  <li>gallium: support for array textures and related changes</li>
+</ul></p>
+
+<p>Shuang He (1):
+<ul>
+  <li>mesa: allow GLfixed arrays for OpenGL ES 2.0</li>
+</ul></p>
+
+<p>Stephan Schmid (1):
+<ul>
+  <li>r600g: fix relative addressing when splitting constant accesses</li>
+</ul></p>
+
+<p>Thomas Hellstrom (21):
+<ul>
+  <li>st/xorg: Don't try to use option values before processing options</li>
+  <li>xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers</li>
+  <li>st/xorg: Add a customizer option to get rid of annoying cursor update flicker</li>
+  <li>xorg/vmwgfx: Don't hide HW cursors when updating them</li>
+  <li>st/xorg: Don't try to remove invalid fbs</li>
+  <li>st/xorg: Fix typo</li>
+  <li>st/xorg, xorg/vmwgfx: Be a bit more frendly towards cross-compiling environments</li>
+  <li>st/xorg: Fix compilation errors for Xservers compiled without Composite</li>
+  <li>st/xorg: Don't use deprecated x*alloc / xfree functions</li>
+  <li>xorg/vmwgfx: Don't use deprecated x*alloc / xfree functions</li>
+  <li>st/xorg: Fix compilation for Xservers &gt;= 1.10</li>
+  <li>mesa: Make sure we have the talloc cflags when using the talloc headers</li>
+  <li>egl: Add an include for size_t</li>
+  <li>mesa: Add talloc includes for gles</li>
+  <li>st/egl: Fix build for include files in nonstandard places</li>
+  <li>svga/drm: Optionally resolve calls to powf during link-time</li>
+  <li>gallium/targets: Trivial crosscompiling fix</li>
+  <li>st/xorg: Add a function to flush pending rendering and damage</li>
+  <li>gallium/targets/xorg-vmwgfx: Xv fixes</li>
+  <li>xorg/vmwgfx: Flush even if we don't autopaint the color key</li>
+  <li>xorg/vmwgfx: Don't clip video to viewport</li>
+</ul></p>
+
+<p>Tilman Sauerbeck (35):
+<ul>
+  <li>r600g: Fixed a bo leak in r600_blit_state_ps_shader().</li>
+  <li>r600g: Use clamped math for RCP and RSQ.</li>
+  <li>r600g: Formatting fixes.</li>
+  <li>r600g: Added DB_SHADER_CONTROL defines.</li>
+  <li>r600g: Only set PA_SC_EDGERULE on rv770 and greater.</li>
+  <li>r600g: Enable PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED.</li>
+  <li>r600g: Fixed the shift in S_02880C_KILL_ENABLE.</li>
+  <li>glsl2: Empty functions can be inlined.</li>
+  <li>glsl2: Fixed cloning of ir_call error instructions.</li>
+  <li>r600g: Added support for TGSI_SEMANTIC_FACE.</li>
+  <li>gallium/docs: Fixed a typo in the SCS opcode description.</li>
+  <li>r600g: Honour destination operand's writemask in the SCS implementation.</li>
+  <li>r600g: Implemented the Z and W component write for the SCS opcode.</li>
+  <li>python/tests: Fixed tri.py for API and TGSI syntax changes.</li>
+  <li>r600g: Removed debug code.</li>
+  <li>gallium/docs: The RET opcode may appear anywhere in a subroutine.</li>
+  <li>r600g: Destroy the blitter.</li>
+  <li>r600g: Fixed two texture surface leaks in r600_blit_uncompress_depth().</li>
+  <li>r600g: Cleaned up index buffer reference handling in the draw module.</li>
+  <li>r600g: Fixed r600_vertex_element leak.</li>
+  <li>r600g: Added r600_pipe_shader_destroy().</li>
+  <li>r600g: Also clear bc data when we're destroying a shader.</li>
+  <li>r600g: In radeon_bo(), call LIST_INITHEAD early.</li>
+  <li>r600g: Destroy the blitter.</li>
+  <li>r600g: Removed unused 'ptr' argument from radeon_bo().</li>
+  <li>r600g: Made radeon_bo_pb_map_internal() actually call radeon_bo_map().</li>
+  <li>r600g: Fixed unmap condition in radeon_bo_pb_destroy().</li>
+  <li>r600g: Made radeon_bo::map_count signed.</li>
+  <li>r600g: We don't support PIPE_CAP_PRIMITIVE_RESTART.</li>
+  <li>r600g: Delete custom_dsa_flush on shutdown.</li>
+  <li>r600g: Fixed two memory leaks in winsys.</li>
+  <li>r600g: Destroy the winsys in r600_destroy_screen().</li>
+  <li>st/mesa: Reset the index buffer before destroying the pipe context.</li>
+  <li>st/mesa: Reset the constant buffers before destroying the pipe context.</li>
+  <li>r600g: Removed duplicated call to tgsi_split_literal_constant().</li>
+</ul></p>
+
+<p>Timo Wiren (1):
+<ul>
+  <li>Fix typos in comments and debug output strings.</li>
+</ul></p>
+
+<p>Tom Fogal (3):
+<ul>
+  <li>Implement x86_64 atomics for compilers w/o intrinsics.</li>
+  <li>Prefer intrinsics to handrolled atomic ops.</li>
+  <li>Revert "Prefer intrinsics to handrolled atomic ops."</li>
+</ul></p>
+
+<p>Tom Stellard (32):
+<ul>
+  <li>r300/compiler: Refactor the pair instruction data structures</li>
+  <li>r300g: Always try to build libr300compiler.a</li>
+  <li>r300/compiler: Fix two mistakes in the presubtract optimization pass.</li>
+  <li>r300/compiler: Add more helper functions for iterating through sources</li>
+  <li>r300/compiler: Print immediate values after "dead constants" pass</li>
+  <li>r300/compiler: radeon_remove_constants.c: fix indentation</li>
+  <li>r300/compiler: Use rc_for_all_reads_src() in "dead constants" pass</li>
+  <li>r300/compiler: Fix segfault in error path</li>
+  <li>r300/compiler: Don't use rc_error() unless the error is unrecoverable</li>
+  <li>r300/compiler: Don't merge instructions that write output regs and ALU result</li>
+  <li>r300/compiler: Create a helper function for merging presubtract sources</li>
+  <li>r300/compiler: Fix incorrect assumption</li>
+  <li>r300/compiler: Clear empty registers after constant folding</li>
+  <li>r300/compiler: Add a new function for more efficient dataflow analysis</li>
+  <li>r300g: Add new debug option for logging vertex/fragment program stats</li>
+  <li>r300/compiler: Use rc_get_readers_normal() for presubtract optimizations</li>
+  <li>r300/compiler: Don't clobber presubtract sources during optimizations</li>
+  <li>r300/compiler: Don't track readers into an IF block.</li>
+  <li>r300/compiler: Make sure presubtract sources use supported swizzles</li>
+  <li>r300/compiler: Fix register allocator's handling of loops</li>
+  <li>r300/compiler: Fix instruction scheduling within IF blocks</li>
+  <li>r300/compiler: Use zero as the register index for unused sources</li>
+  <li>r300/compiler: Ignore alpha dest register when replicating the result</li>
+  <li>r300/compiler: Add rc_get_readers()</li>
+  <li>r300/compiler: Handle BREAK and CONTINUE in rc_get_readers()</li>
+  <li>r300/compiler: Track readers through branches in rc_get_readers()</li>
+  <li>r300/compiler: Convert RGB to alpha in the scheduler</li>
+  <li>r300/compiler: Use presubtract operations as much as possible</li>
+  <li>r300/compiler: Enable rename_reg pass for r500 cards</li>
+  <li>r300/compiler: Add a more efficient version of rc_find_free_temporary()</li>
+  <li>r300/compiler: Don't allow presubtract sources to be remapped twice</li>
+  <li>r300/compiler: Fix black terrain in Civ4</li>
+</ul></p>
+
+<p>Victor Tseng (1):
+<ul>
+  <li>egl/i965: include inline_wrapper_sw_helper.h</li>
+</ul></p>
+
+<p>Viktor Novotný (6):
+<ul>
+  <li>dri/nouveau: Import headers from rules-ng-ng</li>
+  <li>dri/nouveau: nv04: Use rules-ng-ng headers</li>
+  <li>dri/nouveau: nv10: Use rules-ng-ng headers</li>
+  <li>dri/nouveau nv20: Use rules-ng-ng headers</li>
+  <li>dri/nouveau: Remove nouveau_class.h, finishing switch to rules-ng-ng headers</li>
+  <li>dri/nouveau: Clean up magic numbers in get_rt_format</li>
+</ul></p>
+
+<p>Vinson Lee (214):
+<ul>
+  <li>llvmpipe: Remove unnecessary header.</li>
+  <li>r600g: Remove unnecessary headers.</li>
+  <li>mesa: Include missing header in program.h.</li>
+  <li>glsl: Fix 'format not a string literal and no format arguments' warning.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>nvfx: Silence uninitialized variable warnings.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>r600g: Silence unused variable warning.</li>
+  <li>nv50: Update files in SConscript to match Makefile.</li>
+  <li>nv50: Remove unnecessary headers.</li>
+  <li>nv50: Silence uninitialized variable warning.</li>
+  <li>nv50: Silence uninitialized variable warning.</li>
+  <li>nv50: Silence uninitialized variable warning.</li>
+  <li>gallivm: Remove unnecessary headers.</li>
+  <li>draw: Remove unnecessary header.</li>
+  <li>nv50: Silence uninitialized variable warnings.</li>
+  <li>nv50: Fix 'control reaches end of non-void function' warning.</li>
+  <li>mesa/st: Silence uninitialized variable warning.</li>
+  <li>gallivm: Remove unnecessary header.</li>
+  <li>r600g: Remove unnecessary header.</li>
+  <li>r600g: Remove unnecessary headers.</li>
+  <li>r600g: Fix implicit declaration warning.</li>
+  <li>r600g: Fix memory leak on error path.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>r600g: Silence unused variable warnings.</li>
+  <li>mesa: bump version to 7.10</li>
+  <li>ir_to_mesa: Remove unused member array_indexed from struct statevar_element.</li>
+  <li>mesa: Silence "'valid_texture_object' defined but not used" warning.</li>
+  <li>x86: Silence unused variable warning on Mac OS X.</li>
+  <li>glsl: Fix 'control reaches end of non-void function' warning.</li>
+  <li>nvfx: Remove const qualifer from nvfx_vertprog_translate.</li>
+  <li>nvfx: Silence uninitialized variable warnings.</li>
+  <li>r600g: Remove unused variable.</li>
+  <li>nv50: Silence missing initializer warning.</li>
+  <li>nv50: Remove dead initialization.</li>
+  <li>nv50: Remove dead initialization.</li>
+  <li>tgsi: Remove duplicate case value.</li>
+  <li>glut: Define markWindowHidden for non-Windows only.</li>
+  <li>glut: Define eventParser for non-Windows only.</li>
+  <li>r300g: Silence uninitialized variable warning.</li>
+  <li>intel: Fix implicit declaration of function '_mesa_meta_Bitmap' warning.</li>
+  <li>mesa: Remove unnecessary headers.</li>
+  <li>r600g: Remove unnecessary header.</li>
+  <li>unichrome: Remove unnecessary header.</li>
+  <li>intel: Remove unnecessary headers.</li>
+  <li>r600g: Remove unused variable.</li>
+  <li>r600g: Disable unused variables.</li>
+  <li>r600g: Remove unused variable.</li>
+  <li>r600g: Silence 'control reaches end of non-void function' warning.</li>
+  <li>r600g: Remove unused variable.</li>
+  <li>r600g: Remove unused variable.</li>
+  <li>r600g: Disable unused variables.</li>
+  <li>intel: Remove unnecessary header.</li>
+  <li>st/dri: Remove unnecessary header.</li>
+  <li>r600g: Remove unused variable.</li>
+  <li>r300g: Remove unused variable.</li>
+  <li>r600g: Don't return a value in function returning void.</li>
+  <li>r600g: Remove unused variables.</li>
+  <li>r600g: Include p_compiler.h instead of malloc.h.</li>
+  <li>r600g: Silence uninitialized variable warnings.</li>
+  <li>scons: Add MinGW-w64 prefixes for MinGW build.</li>
+  <li>dri: Add GET_PROGRAM_NAME definition for Mac OS X.</li>
+  <li>scons: Add program/sampler.cpp to SCons build.</li>
+  <li>mesa: Fix printf format warning.</li>
+  <li>mesa: Fix printf format warning.</li>
+  <li>mesa: Fix printf format warning.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r600g: Update SConscript.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r600g: Update SConscript.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r600g: Update SConscript.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r600g: Fix SCons build.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Remove declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>glsl: Remove unnecessary header.</li>
+  <li>savage: Remove unnecessary header.</li>
+  <li>r600g: Remove unused variable.</li>
+  <li>r600g: Remove unnecessary headers.</li>
+  <li>r600g: Fix SCons build.</li>
+  <li>r600g: Remove unnecessary header.</li>
+  <li>gallivm: Remove unnecessary header.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>r600g: Silence uninitialized variable warning.</li>
+  <li>i915: Silence unused variable warning in non-debug builds.</li>
+  <li>i915: Silence unused variable warning in non-debug builds.</li>
+  <li>i965: Silence unused variable warning on non-debug builds.</li>
+  <li>i965: Silence unused variable warning on non-debug builds.</li>
+  <li>i965: Initialize member variables.</li>
+  <li>r300: Silence uninitialized variable warning.</li>
+  <li>tdfx: Silence unused variable warning on non-debug builds.</li>
+  <li>gallivm: Remove unnecessary header.</li>
+  <li>glsl: Initialize variable in ir_derefence_array::constant_expression_value</li>
+  <li>mesa: Add missing header to shaderobj.h.</li>
+  <li>llvmpipe: Return non-zero exit code for lp_test_round failures.</li>
+  <li>r300/compiler: Remove unused variable.</li>
+  <li>st/xorg: Fix memory leak on error path.</li>
+  <li>llvmpipe: Initialize state variable in debug_bin function.</li>
+  <li>llvmpipe: Initialize variable.</li>
+  <li>draw: Move loop variable declaration outside for loop.</li>
+  <li>r600g: Ensure r600_src is initialized in tgsi_exp function.</li>
+  <li>glsl: Add assert for unhandled ir_shader case.</li>
+  <li>swrast: Print out format on unexpected failure in _swrast_DrawPixels.</li>
+  <li>llvmpipe: Remove unnecessary header.</li>
+  <li>draw: Remove unnecessary header.</li>
+  <li>gallivm: Silence uninitialized variable warnings.</li>
+  <li>gallivm: Silence uninitialized variable warnings.</li>
+  <li>gallivm: Silence uninitialized variable warning.</li>
+  <li>r300g: Silence uninitialized variable warning.</li>
+  <li>mesa: Remove unnecessary headers.</li>
+  <li>r600g: Silence uninitialized variable warnings.</li>
+  <li>st/mesa: Remove unnecessary header.</li>
+  <li>mesa: Remove unnecessary header.</li>
+  <li>egl: Remove unnecessary headers.</li>
+  <li>swrast: Print out format on unexpected failure in _swrast_ReadPixels.</li>
+  <li>st/mesa: Silence uninitialized variable warning.</li>
+  <li>savage: Remove unnecessary header.</li>
+  <li>st/vega: Remove unnecessary headers.</li>
+  <li>dri/nouveau: Silence uninitialized variable warning.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>i965: Silence uninitialized variable warning.</li>
+  <li>i965: Silence uninitialized variable warning.</li>
+  <li>mesa: Clean up header file inclusion in accum.h.</li>
+  <li>mesa: Clean up header file inclusion in version.h.</li>
+  <li>mesa: Clean up header file inclusion in api_loopback.h.</li>
+  <li>mesa: Clean up header file inclusion in api_validate.h.</li>
+  <li>mesa: Include mfeatures.h in api_loopback for FEATURE_beginend.</li>
+  <li>mesa: Include mfeatures.h in api_validate.c for FEATURE_* symbols.</li>
+  <li>mesa: Clean up header file inclusion in arrayobj.h.</li>
+  <li>mesa: Clean up header file inclusion in atifragshader.h.</li>
+  <li>mesa: Clean up header file inclusion in attrib.h.</li>
+  <li>mesa: Clean up header file inclusion in blend.h.</li>
+  <li>mesa: Clean up header file inclusion in buffers.h.</li>
+  <li>mesa: Clean up header file inclusion in colortab.h.</li>
+  <li>mesa: Clean up header file inclusion in convolve.h.</li>
+  <li>mesa: Clean up header file inclusion in debug.h.</li>
+  <li>mesa: Clean up header file inclusion in depth.h.</li>
+  <li>mesa: Clean up header file inclusion in depthstencil.h.</li>
+  <li>mesa: Clean up header file inclusion in drawpix.h.</li>
+  <li>mesa: Clean up header file inclusion in drawtex.h.</li>
+  <li>mesa: Clean up header file inclusion in enable.h.</li>
+  <li>mesa: Clean up header file inclusion in extensions.h.</li>
+  <li>graw: Add struct pipe_surface forward declaration.</li>
+  <li>mesa: Clean up header file inclusion in fbobject.h.</li>
+  <li>mesa: Clean up header file inclusion in ffvertex_prog.h.</li>
+  <li>mesa: Clean up header file inclusion in fog.h.</li>
+  <li>mesa: Clean up header file inclusion in framebuffer.h.</li>
+  <li>mesa: Clean up header file inclusion in hint.h.</li>
+  <li>mesa: Clean up header file inclusion in histogram.h.</li>
+  <li>mesa: Clean up header file inclusion in image.h.</li>
+  <li>mesa: Add missing header and forward declarations in dd.h.</li>
+  <li>mesa: Clean up header file inclusion in light.h.</li>
+  <li>mesa: Clean up header file inclusion in lines.h.</li>
+  <li>mesa: Clean up header file inclusion in matrix.h.</li>
+  <li>mesa: Clean up header file inclusion in multisample.h.</li>
+  <li>mesa: Clean up header file inclusion in nvprogram.h.</li>
+  <li>winsys/xlib: Add cygwin to SConscript.</li>
+  <li>mesa: Clean up header file inclusion in pixel.h.</li>
+  <li>mesa: Clean up header file inclusion in pixelstore.h.</li>
+  <li>mesa: Fix printf format warnings.</li>
+  <li>mesa: Clean up header file inclusion in points.h.</li>
+  <li>i965: Silence uninitialized variable warning.</li>
+  <li>glsl: Add ir_constant_expression.cpp to SConscript.</li>
+  <li>mesa: Add definitions for inverse hyperbolic function on MSVC.</li>
+  <li>glsl: Fix 'control reaches end of non-void function' warning.</li>
+  <li>glsl: Add lower_vector.cpp to SConscript.</li>
+  <li>glsl: Fix type of label 'default' in switch statement.</li>
+  <li>st/mesa: Remove unnecessary headers.</li>
+  <li>swrast: Remove unnecessary header.</li>
+  <li>r600: Remove unnecesary header.</li>
+  <li>intel: Remove unnecessary header.</li>
+  <li>mesa: Clean up header file inclusion in polygon.h.</li>
+  <li>mesa: Clean up header file inclusion in rastpos.h.</li>
+  <li>mesa: Clean up header file inclusion in readpix.h.</li>
+  <li>mesa: Clean up header file inclusion in renderbuffer.h.</li>
+  <li>mesa: Clean up header file inclusion in scissor.h.</li>
+  <li>mesa: Clean up header file inclusion in shaderapi.h.</li>
+  <li>mesa: Clean up header file inclusion in shared.h.</li>
+  <li>mesa: Clean up header file inclusion in stencil.h.</li>
+  <li>r600: Remove unnecessary header.</li>
+  <li>llvmpipe: Remove unnecessary headers.</li>
+  <li>mesa: Clean up header file inclusion in syncobj.h.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>r300/compiler: Move declaration before code.</li>
+  <li>mesa: Clean up header file inclusion in texcompress.h.</li>
+  <li>st/vega: Silence uninitialized variable warning.</li>
+  <li>mesa: Clean up header file inclusion in texcompress_s3tc.h.</li>
+  <li>mesa: Clean up header file inclusion in texenvprogram.h.</li>
+  <li>mesa: Clean up header file inclusion in texformat.h.</li>
+  <li>mesa: Clean up header file inclusion in texgetimage.h.</li>
+  <li>mesa: Clean up header file inclusion in texobj.h.</li>
+  <li>gallium/noop: Add prototype for noop_init_state_functions.</li>
+  <li>mesa: Clean up header file inclusion in texrender.h.</li>
+  <li>mesa: Clean up header file inclusion in transformfeedback.h.</li>
+  <li>mesa: Clean up header file inclusion in varray.h.</li>
+  <li>mesa: Clean up header file inclusion in viewport.h.</li>
+  <li>r200: Silence uninitialized variable warning.</li>
+  <li>r600g: Fix SCons build.</li>
+  <li>i965: Silence uninitialized variable warning.</li>
+</ul></p>
+
+<p>Xavier Chantry (8):
+<ul>
+  <li>nv50: fix size of outputs_written array</li>
+  <li>nv50: apply layout_mask to tile_flags</li>
+  <li>nvfx: only expose one rt on nv30</li>
+  <li>nvfx: fb-&gt;nr_cbufs &lt= 1 on nv30</li>
+  <li>nvfx: reset nvfx-&gt;hw_zeta</li>
+  <li>nvfx: fixes after array textures merge</li>
+  <li>init ps-&gt;context with util_surfaces_get and do_get</li>
+  <li>gallium/trace: check bind_vertex_sampler_states and set_vertex_sampler_views</li>
+</ul></p>
+
+<p>Xiang, Haihao (10):
+<ul>
+  <li>mesa: fix regression from b4bb6680200b5a898583392f4c831c02f41e63f7</li>
+  <li>i965: add support for polygon mode on Sandybridge.</li>
+  <li>i965: fix for flat shading on Sandybridge</li>
+  <li>i965: set minimum/maximum Point Width on Sandybridge</li>
+  <li>meta: allow nested meta operations</li>
+  <li>i965: support for two-sided lighting on Sandybridge</li>
+  <li>i965: fix register region description</li>
+  <li>i965: use align1 access mode for instructions with execSize=1 in VS</li>
+  <li>i965: don't spawn GS thread for LINELOOP on Sandybridge</li>
+  <li>i965: use BLT to clear buffer if possible on Sandybridge</li>
+</ul></p>
+
+<p>Zack Rusin (8):
+<ul>
+  <li>rbug: fix rbug when contexts are being destroyed</li>
+  <li>llvmpipe: fix rasterization of vertical lines on pixel boundaries</li>
+  <li>scons: build the xorg state trackers only when env includes drm</li>
+  <li>gallivm: implement indirect addressing of the output registers</li>
+  <li>gallivm: implement indirect addressing over inputs</li>
+  <li>gallivm: fix storing of the addr register</li>
+  <li>scons: add alias for identity</li>
+  <li>gallium/util: add states relevant to geometry shaders</li>
+</ul></p>
+
+<p>Zhenyu Wang (40):
+<ul>
+  <li>i965: disasm quarter and write enable instruction control on sandybridge</li>
+  <li>i965: new state dump for sandybridge</li>
+  <li>i965: enable accumulator update in PS kernel too on sandybridge</li>
+  <li>i965: Fix color interpolation on sandybridge</li>
+  <li>i965: force zero in clipper to ignore RTAIndex on sandybridge</li>
+  <li>i965: fix point size setting in header on sandybridge</li>
+  <li>i965: ff sync message change for sandybridge</li>
+  <li>i965: ignore quads for GS kernel on sandybridge</li>
+  <li>i965: add sandybridge viewport state bo into validation list</li>
+  <li>i965: VS use SPF mode on sandybridge for now</li>
+  <li>i965: fix jump count on sandybridge</li>
+  <li>i965: Fix sampler on sandybridge</li>
+  <li>i965: fix const register count for sandybridge</li>
+  <li>i965: Add all device ids for sandybridge</li>
+  <li>i965: sandybridge pipe control workaround before write cache flush</li>
+  <li>i965: only allow SIMD8 kernel on sandybridge now</li>
+  <li>i965: don't do calculation for delta_xy on sandybridge</li>
+  <li>i965: fix pixel w interpolation on sandybridge</li>
+  <li>i965: enable polygon offset on sandybridge</li>
+  <li>i965: fix scissor state on sandybridge</li>
+  <li>i965: fix point sprite on sandybridge</li>
+  <li>i965: fix occlusion query on sandybridge</li>
+  <li>i965: fallback bitmap operation on sandybridge</li>
+  <li>i965: Always set tiling for depth buffer on sandybridge</li>
+  <li>i965: fallback lineloop on sandybridge for now</li>
+  <li>Revert "i965: Always set tiling for depth buffer on sandybridge"</li>
+  <li>i965: always set tiling for fbo depth buffer on sandybridge</li>
+  <li>i965: Fix GS hang on Sandybridge</li>
+  <li>Revert "i965: fallback lineloop on sandybridge for now"</li>
+  <li>i965: refresh wm push constant also for BRW_NEW_FRAMENT_PROGRAM on gen6</li>
+  <li>i965: fix dest type of 'endif' on sandybridge</li>
+  <li>Revert "i965: VS use SPF mode on sandybridge for now"</li>
+  <li>i965: also using align1 mode for math2 on sandybridge</li>
+  <li>i965: Fix GS state uploading on Sandybridge</li>
+  <li>i965: upload WM state for _NEW_POLYGON on sandybridge</li>
+  <li>i965: Use MI_FLUSH_DW for blt ring flush on sandybridge</li>
+  <li>i965: explicit tell header present for fb write on sandybridge</li>
+  <li>i965: Fix occlusion query on sandybridge</li>
+  <li>i965: Use last vertex convention for quad provoking vertex on sandybridge</li>
+  <li>i965: Fix provoking vertex select in clip state for sandybridge</li>
+</ul></p>
+
+<p>Zou Nan hai (1):
+<ul>
+  <li>i965: skip too small size mipmap</li>
+</ul></p>
+
+<p>delphi (2):
+<ul>
+  <li>draw: added userclip planes and updated variant_key</li>
+  <li>draw: some changes to allow for runtime changes to userclip planes</li>
+</ul></p>
+
+<p>nobled (3):
+<ul>
+  <li>r300g: Abort if atom allocations fail</li>
+  <li>r300g: Abort if draw_create() fails</li>
+  <li>r300g: Drop unnecessary cast</li>
+</ul></p>
+
+<p>pontus lidman (1):
+<ul>
+  <li>mesa: check for posix_memalign() errors</li>
+</ul></p>
+
+<p>richard (2):
+<ul>
+  <li>evergreen : fix z format setting, enable stencil.</li>
+  <li>r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well.</li>
+</ul></p>
 
 </body>
 </html>
diff --git a/docs/relnotes-7.11.html b/docs/relnotes-7.11.html
new file mode 100644 (file)
index 0000000..6999201
--- /dev/null
@@ -0,0 +1,53 @@
+<HTML>
+
+<head>
+<TITLE>Mesa Release Notes</TITLE>
+<link rel="stylesheet" type="text/css" href="mesa.css">
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+</head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.11 Release Notes / (release date TBD)</H1>
+
+<p>
+Mesa 7.11 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 7.11.1.
+</p>
+<p>
+Mesa 7.11 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+tbd
+</pre>
+
+
+<h2>New features</h2>
+<ul>
+</ul>
+
+
+<h2>Bug fixes</h2>
+<ul>
+</ul>
+
+
+<h2>Changes</h2>
+
+<p>tbd</p>
+
+
+</body>
+</html>
diff --git a/docs/relnotes-7.9.1.html b/docs/relnotes-7.9.1.html
new file mode 100644 (file)
index 0000000..bef4ef1
--- /dev/null
@@ -0,0 +1,406 @@
+<HTML>
+
+<head>
+<TITLE>Mesa Release Notes</TITLE>
+<link rel="stylesheet" type="text/css" href="mesa.css">
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+</head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.9.1 Release Notes / January 7, 2011</H1>
+
+<p>
+Mesa 7.9.1 is a bug fix release which fixes bugs found since the 7.9 release.
+</p>
+<p>
+Mesa 7.9.1 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+78422843ea875ad4eac35b9b8584032b  MesaLib-7.9.1.tar.gz
+07dc6cfb5928840b8b9df5bd1b3ae434  MesaLib-7.9.1.tar.bz2
+c8eaea5b3c3d6dee784bd8c2db91c80f  MesaLib-7.9.1.zip
+ee9ecae4ca56fbb2d14dc15e3a0a7640  MesaGLUT-7.9.1.tar.gz
+41fc477d524e7dc5c84da8ef22422bea  MesaGLUT-7.9.1.tar.bz2
+90b287229afdf19317aa989d19462e7a  MesaGLUT-7.9.1.zip
+</pre>
+
+
+<h2>New features</h2>
+<p>None.</p>
+
+<h2>Bug fixes</h2>
+<p>This list is likely incomplete.</p>
+<ul>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28800">Bug 28800</a> - [r300c, r300g] Texture corruption with World of Warcraft</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29420">Bug 29420</a> - Amnesia / HPL2 RendererFeatTest - not rendering correctly</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29946">Bug 29946</a> - [swrast] piglit valgrind glsl-array-bounds-04 fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30261">Bug 30261</a> - [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30632">Bug 30632</a> - [softpipe] state_tracker/st_manager.c:489: st_context_notify_invalid_framebuffer: Assertion `stfb &amp;&amp; stfb-&gt;iface == stfbi' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30694">Bug 30694</a> - wincopy will crash on Gallium drivers when going to front buffer</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30787">Bug 30787</a> - Invalid asm shader does not generate draw-time error when used with GLSL shader</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30993">Bug 30993</a> - getFramebufferAttachmentParameteriv wrongly generates error</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31101">Bug 31101</a> -  [glsl2] abort() in ir_validate::visit_enter(ir_assignment *ir)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31193">Bug 31193</a> -  [regression] aa43176e break water reflections</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31194">Bug 31194</a> - The mesa meta save/restore code doesn't ref the current GLSL program</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31371">Bug 31371</a> - glslparsertest: ir.cpp:358: ir_constant::ir_constant(const glsl_type*, const ir_constant_data*): Assertion `(type->base_type &gt;= 0) &amp;&amp; (type->base_type &lt;= 3)' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31439">Bug 31439</a> - Crash in glBufferSubData() with size == 0</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31495">Bug 31495</a> - [i965 gles2c bisected] OpenGL ES 2.0 conformance GL2Tests_GetBIFD_input.run regressed</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31514">Bug 31514</a> - isBuffer returns true for unbound buffers</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31560">Bug 31560</a> - [tdfx] tdfx_tex.c:702: error: â€˜const struct gl_color_table’ has no member named â€˜Format’</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31617">Bug 31617</a> - Radeon/Compiz: 'failed to attach dri2 front buffer', error case not handled</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31648">Bug 31648</a> -  [GLSL] array-struct-array gets assertion: `(size &gt;= 1) && (size &lt;= 4)' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31650">Bug 31650</a> - [GLSL] varying gl_TexCoord fails to be re-declared to different size in the second shader</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31673">Bug 31673</a> - GL_FRAGMENT_PRECISION_HIGH preprocessor macro undefined in GLSL ES</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31690">Bug 31690</a> -  i915 shader compiler fails to flatten if in Aquarium webgl demo.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31832">Bug 31832</a> - [i915] Bad renderbuffer format: 21</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31841">Bug 31841</a> - [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31894">Bug 31894</a> - Writing to gl_PointSize with GLES2 corrupts other varyings</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31909">Bug 31909</a> - [i965] brw_fs.cpp:1461: void fs_visitor::emit_bool_to_cond_code(ir_rvalue*): Assertion `expr-&gt;operands[i]-&gt;type-&gt;is_scalar()' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31934">Bug 31934</a> - [gallium] Mapping empty buffer object causes SIGSEGV</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31983">Bug 31983</a> -  [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31985">Bug 31985</a> - [GLSL 1.20] initialized uniform array considered as "unsized"</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31987">Bug 31987</a> - [gles2] if input a wrong pname(GL_NONE) to glGetBoolean, it will not case GL_INVALID_ENUM</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32035">Bug 32035</a> - [GLSL bisected] comparing unsized array gets segfault</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32070">Bug 32070</a> - llvmpipe renders stencil demo incorrectly</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32273">Bug 32273</a> - assertion fails when starting vdrift 2010 release with shaders enabled</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32287">Bug 32287</a> - [bisected GLSL] float-int failure</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32311">Bug 32311</a> - [965 bisected] Array look-ups broken on GM45</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32520">Bug 32520</a> -  [gles2] glBlendFunc(GL_ZERO, GL_DST_COLOR) will result in GL_INVALID_ENUM</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32825">Bug 32825</a> - egl_glx driver completely broken in 7.9 branch [fix in master]</li>
+</ul>
+
+
+<h2>Changes</h2>
+<p>The full set of changes can be viewed by using the following GIT command:</p>
+
+<pre>
+  git log mesa-7.9..mesa-7.9.1
+</pre>
+
+<p>Alex Deucher (5):
+<ul>
+  <li>r100: revalidate after radeon_update_renderbuffers</li>
+  <li>r600c: add missing radeon_prepare_render() call on evergreen</li>
+  <li>r600c: properly align mipmaps to group size</li>
+  <li>gallium/egl: fix r300 vs r600 loading</li>
+  <li>r600c: fix some opcodes on evergreen</li>
+</ul></p>
+
+<p>Aras Pranckevicius (2):
+<ul>
+  <li>glsl: fix crash in loop analysis when some controls can't be determined</li>
+  <li>glsl: fix matrix type check in ir_algebraic</li>
+</ul></p>
+
+<p>Brian Paul (27):
+<ul>
+  <li>swrast: fix choose_depth_texture_level() to respect mipmap filtering state</li>
+  <li>st/mesa: replace assertion w/ conditional in framebuffer invalidation</li>
+  <li>egl/i965: include inline_wrapper_sw_helper.h</li>
+  <li>mesa: Add missing else in do_row_3D</li>
+  <li>mesa: add missing formats in _mesa_format_to_type_and_comps()</li>
+  <li>mesa: handle more pixel types in mipmap generation code</li>
+  <li>mesa: make glIsBuffer() return false for never bound buffers</li>
+  <li>mesa: fix glDeleteBuffers() regression</li>
+  <li>swrast: init alpha value to 1.0 in opt_sample_rgb_2d()</li>
+  <li>meta: Mask Stencil.Clear against stencilMax in _mesa_meta_Clear</li>
+  <li>st/mesa: fix mapping of zero-sized buffer objects</li>
+  <li>mesa: check for posix_memalign() errors</li>
+  <li>llvmpipe: fix broken stencil writemask</li>
+  <li>mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query</li>
+  <li>mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type</li>
+  <li>mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM</li>
+  <li>mesa: test for cube map completeness in glGenerateMipmap()</li>
+  <li>tnl: Initialize gl_program_machine memory in run_vp.</li>
+  <li>tnl: a better way to initialize the gl_program_machine memory</li>
+  <li>mesa, st/mesa: disable GL_ARB_geometry_shader4</li>
+  <li>glsl: fix off by one in register index assertion</li>
+  <li>st/mesa: fix mipmap generation bug</li>
+  <li>glsl: new glsl_strtod() wrapper to fix decimal point interpretation</li>
+  <li>mesa: no-op glBufferSubData() on size==0</li>
+  <li>tdfx: s/Format/_BaseFormat/</li>
+  <li>st/mesa: fix renderbuffer pointer check in st_Clear()</li>
+  <li>mesa: Bump the number of bits in the register index.</li>
+</ul></p>
+
+<p>Chad Versace (5):
+<ul>
+  <li>glsl: Fix lexer rule for ^=</li>
+  <li>glsl: Fix ast-to-hir for ARB_fragment_coord_conventions</li>
+  <li>glsl: Fix ir_expression::constant_expression_value()</li>
+  <li>glsl: Fix erroneous cast in ast_jump_statement::hir()</li>
+  <li>glsl: Fix linker bug in cross_validate_globals()</li>
+</ul></p>
+
+<p>Chia-I Wu (10):
+<ul>
+  <li>targets/egl: Fix linking with libdrm.</li>
+  <li>st/vega: Fix version check in context creation.</li>
+  <li>st/egl: Do not finish a fence that is NULL.</li>
+  <li>egl: Fix a false negative check in _eglCheckMakeCurrent.</li>
+  <li>st/mesa: Unreference the sampler view in st_bind_surface.</li>
+  <li>egl_dri2: Fix __DRI_DRI2 version 1 support.</li>
+  <li>st/vega: Do not wait NULL fences.</li>
+  <li>mesa: Do not advertise GL_OES_texture_3D.</li>
+  <li>egl_glx: Fix borken driver.</li>
+  <li>egl: Check extensions.</li>
+</ul></p>
+
+<p>Daniel Lichtenberger (1):
+<ul>
+  <li>radeon: fix potential segfault in renderbuffer update</li>
+</ul></p>
+
+<p>Daniel Vetter (1):
+<ul>
+  <li>r200: revalidate after radeon_update_renderbuffers</li>
+</ul></p>
+
+<p>Dave Airlie (1):
+<ul>
+  <li>r300g: fixup rs690 tiling stride alignment calculations.</li>
+</ul></p>
+
+<p>Eric Anholt (13):
+<ul>
+  <li>intel: Allow CopyTexSubImage to InternalFormat 3/4 textures, like RGB/RGBA.</li>
+  <li>glsl: Free the loop state context when we free the loop state.</li>
+  <li>i965: Allow OPCODE_SWZ to put immediates in the first arg.</li>
+  <li>i965: Add support for rendering to SARGB8 FBOs.</li>
+  <li>glsl: Add a helper constructor for expressions that works out result type.</li>
+  <li>glsl: Fix structure and array comparisions.</li>
+  <li>glsl: Quiet unreachable no-return-from-function warning.</li>
+  <li>glsl: Mark the array access for whole-array comparisons.</li>
+  <li>glsl: Fix flipped return of has_value() for array constants.</li>
+  <li>mesa: Add getters for the rest of the supported draw buffers.</li>
+  <li>mesa: Add getters for ARB_copy_buffer's attachment points.</li>
+  <li>i965: Correct the dp_read message descriptor setup on g4x.</li>
+  <li>glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.</li>
+</ul></p>
+
+<p>Fabian Bieler (1):
+<ul>
+  <li>glsl: fix lowering conditional returns in subroutines</li>
+</ul></p>
+
+<p>Francisco Jerez (3):
+<ul>
+  <li>meta: Don't leak alpha function/reference value changes.</li>
+  <li>meta: Fix incorrect rendering of the bitmap alpha component.</li>
+  <li>meta: Don't try to disable cube maps if the driver doesn't expose the extension.</li>
+</ul></p>
+
+<p>Henri Verbeet (2):
+<ul>
+  <li>r600: Evergreen has two extra frac_bits for the sampler LOD state.</li>
+  <li>st/mesa: Handle wrapped depth buffers in st_copy_texsubimage().</li>
+</ul></p>
+
+<p>Ian Romanick (33):
+<ul>
+  <li>Add 7.9 md5sums</li>
+  <li>docs: Import 7.8.x release notes from 7.8 branch.</li>
+  <li>docs: download.html does not need to be updated for each release</li>
+  <li>docs: Update mailing lines from sf.net to freedesktop.org</li>
+  <li>docs: added news item for 7.9 release</li>
+  <li>mesa: Validate assembly shaders when GLSL shaders are used</li>
+  <li>linker: Reject shaders that have unresolved function calls</li>
+  <li>mesa: Refactor validation of shader targets</li>
+  <li>glsl: Slightly change the semantic of _LinkedShaders</li>
+  <li>linker: Improve handling of unread/unwritten shader inputs/outputs</li>
+  <li>glsl: Commit lexer files changed by previous cherry picking</li>
+  <li>mesa: Make metaops use program refcounts instead of names.</li>
+  <li>glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadow</li>
+  <li>mesa: Allow query of MAX_SAMPLES with EXT_framebuffer_multisample</li>
+  <li>glsl: better handling of linker failures</li>
+  <li>mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.</li>
+  <li>i915: Disallow alpha, red, RG, and sRGB as render targets</li>
+  <li>glsl/linker: Free any IR discarded by optimization passes.</li>
+  <li>glsl: Add an optimization pass to simplify discards.</li>
+  <li>glsl: Add a lowering pass to move discards out of if-statements.</li>
+  <li>i915: Correctly generate unconditional KIL instructions</li>
+  <li>glsl: Add unary ir_expression constructor</li>
+  <li>glsl: Ensure that equality comparisons don't return a NULL IR tree</li>
+  <li>glcpp: Commit changes in generated files cause by previous commit</li>
+  <li>glsl: Inherrit type of declared variable from initializer</li>
+  <li>glsl: Inherrit type of declared variable from initializer after processing assignment</li>
+  <li>linker: Ensure that unsized arrays have a size after linking</li>
+  <li>linker: Fix regressions caused by previous commit</li>
+  <li>linker: Allow built-in arrays to have different sizes between shader stages</li>
+  <li>ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors</li>
+  <li>Refresh autogenerated file builtin_function.cpp.</li>
+  <li>docs: Initial set of release notes for 7.9.1</li>
+  <li>mesa: set version string to 7.9.1</li>
+</ul></p>
+
+<p>Julien Cristau (1):
+<ul>
+  <li>Makefile: don't include the same files twice in the tarball</li>
+</ul></p>
+
+<p>Kenneth Graunke (19):
+<ul>
+  <li>glcpp: Return NEWLINE token for newlines inside multi-line comments.</li>
+  <li>generate_builtins.py: Output large strings as arrays of characters.</li>
+  <li>glsl: Fix constant component count in vector constructor emitting.</li>
+  <li>ir_dead_functions: Actually free dead functions and signatures.</li>
+  <li>glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version &gt;= 1.30.</li>
+  <li>glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.</li>
+  <li>glsl: Fix constant expression handling for &lt, &gt;, &lt=, &gt;= on vectors.</li>
+  <li>glsl: Use do_common_optimization in the standalone compiler.</li>
+  <li>glsl: Don't inline function prototypes.</li>
+  <li>glsl: Add a virtual as_discard() method.</li>
+  <li>glsl: Remove "discard" support from lower_jumps.</li>
+  <li>glsl: Refactor get_num_operands.</li>
+  <li>glcpp: Don't emit SPACE tokens in conditional_tokens production.</li>
+  <li>glsl: Clean up code by adding a new is_break() function.</li>
+  <li>glsl: Consider the "else" branch when looking for loop breaks.</li>
+  <li>Remove OES_compressed_paletted_texture from the ES2 extension list.</li>
+  <li>glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).</li>
+  <li>Fix build on systems where "python" is python 3.</li>
+  <li>i965: Internally enable GL_NV_blend_square on ES2.</li>
+</ul></p>
+
+<p>Kristian Høgsberg (1):
+<ul>
+  <li>i965: Don't write mrf assignment for pointsize output</li>
+</ul></p>
+
+<p>Luca Barbieri (1):
+<ul>
+  <li>glsl: Unroll loops with conditional breaks anywhere (not just the end)</li>
+</ul></p>
+
+<p>Marek Olšák (17):
+<ul>
+  <li>r300g: fix microtiling for 16-bits-per-channel formats</li>
+  <li>r300g: fix texture border for 16-bits-per-channel formats</li>
+  <li>r300g: add a default channel ordering of texture border for unhandled formats</li>
+  <li>r300g: fix texture border color for all texture formats</li>
+  <li>r300g: fix rendering with no vertex elements</li>
+  <li>r300/compiler: fix rc_rewrite_depth_out for it to work with any instruction</li>
+  <li>r300g: fix texture border color once again</li>
+  <li>r300g: fix texture swizzling with compressed textures on r400-r500</li>
+  <li>r300g: disable ARB_texture_swizzle if S3TC is enabled on r3xx-only</li>
+  <li>mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium</li>
+  <li>st/mesa: initialize key in st_vp_varient</li>
+  <li>r300/compiler: fix swizzle lowering with a presubtract source operand</li>
+  <li>r300g: fix rendering with a vertex attrib having a zero stride</li>
+  <li>ir_to_mesa: Add support for conditional discards.</li>
+  <li>r300g: finally fix the texture corruption on r3xx-r4xx</li>
+  <li>mesa: fix texel store functions for some float formats</li>
+  <li>r300/compiler: disable the rename_regs pass for loops</li>
+</ul></p>
+
+<p>Mario Kleiner (1):
+<ul>
+  <li>mesa/r300classic: Fix dri2Invalidate/radeon_prepare_render for page flipping.</li>
+</ul></p>
+
+<p>Peter Clifton (1):
+<ul>
+  <li>intel: Fix emit_linear_blit to use DWORD aligned width blits</li>
+</ul></p>
+
+<p>Robert Hooker (2):
+<ul>
+  <li>intel: Add a new B43 pci id.</li>
+  <li>egl_dri2: Add missing intel chip ids.</li>
+</ul></p>
+
+<p>Roland Scheidegger (1):
+<ul>
+  <li>r200: fix r200 large points</li>
+</ul></p>
+
+<p>Thomas Hellstrom (17):
+<ul>
+  <li>st/xorg: Don't try to use option values before processing options</li>
+  <li>xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers</li>
+  <li>st/xorg: Add a customizer option to get rid of annoying cursor update flicker</li>
+  <li>xorg/vmwgfx: Don't hide HW cursors when updating them</li>
+  <li>st/xorg: Don't try to remove invalid fbs</li>
+  <li>st/xorg: Fix typo</li>
+  <li>st/xorg, xorg/vmwgfx: Be a bit more frendly towards cross-compiling environments</li>
+  <li>st/xorg: Fix compilation errors for Xservers compiled without Composite</li>
+  <li>st/xorg: Don't use deprecated x*alloc / xfree functions</li>
+  <li>xorg/vmwgfx: Don't use deprecated x*alloc / xfree functions</li>
+  <li>st/xorg: Fix compilation for Xservers &gt;= 1.10</li>
+  <li>mesa: Make sure we have the talloc cflags when using the talloc headers</li>
+  <li>egl: Add an include for size_t</li>
+  <li>mesa: Add talloc includes for gles</li>
+  <li>st/egl: Fix build for include files in nonstandard places</li>
+  <li>svga/drm: Optionally resolve calls to powf during link-time</li>
+  <li>gallium/targets: Trivial crosscompiling fix</li>
+</ul></p>
+
+<p>Tom Stellard (7):
+<ul>
+  <li>r300/compiler: Make sure presubtract sources use supported swizzles</li>
+  <li>r300/compiler: Fix register allocator's handling of loops</li>
+  <li>r300/compiler: Fix instruction scheduling within IF blocks</li>
+  <li>r300/compiler: Use zero as the register index for unused sources</li>
+  <li>r300/compiler: Ignore alpha dest register when replicating the result</li>
+  <li>r300/compiler: Use correct swizzles for all presubtract sources</li>
+  <li>r300/compiler: Don't allow presubtract sources to be remapped twice</li>
+</ul></p>
+
+<p>Vinson Lee (1):
+<ul>
+  <li>glsl: Fix 'control reaches end of non-void function' warning.</li>
+</ul></p>
+
+<p>richard (1):
+<ul>
+  <li>r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well.</li>
+</ul></p>
+
+</body>
+</html>
index 4487af9dea6c9c38e45abdccbd227afe92baec8f..c57d03b2319599625a8f3e8ae49c5f9047205e3b 100644 (file)
@@ -13,6 +13,9 @@ The release notes summarize what's new or changed in each Mesa release.
 </p>
 
 <UL>
+<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
+<LI><A HREF="relnotes-7.10.html">7.10 release notes</A>
+<LI><A HREF="relnotes-7.9.1.html">7.9.1 release notes</A>
 <LI><A HREF="relnotes-7.9.html">7.9 release notes</A>
 <LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A>
 <LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
index 43d2e896b0b2ec1f2aceb363d54da077b25af6c4..3684803381785b70068426c8d5b83bb37d3b3756 100644 (file)
@@ -31,6 +31,7 @@
 
 #define glAccum                MANGLE(Accum)
 #define glActiveProgramEXT             MANGLE(ActiveProgramEXT)
+#define glActiveShaderProgram          MANGLE(ActiveShaderProgram)
 #define glActiveStencilFaceEXT         MANGLE(ActiveStencilFaceEXT)
 #define glActiveTextureARB             MANGLE(ActiveTextureARB)
 #define glActiveTexture                MANGLE(ActiveTexture)
@@ -56,6 +57,7 @@
 #define glBeginOcclusionQueryNV                MANGLE(BeginOcclusionQueryNV)
 #define glBeginPerfMonitorAMD          MANGLE(BeginPerfMonitorAMD)
 #define glBeginQueryARB                MANGLE(BeginQueryARB)
+#define glBeginQueryIndexed            MANGLE(BeginQueryIndexed)
 #define glBeginQuery           MANGLE(BeginQuery)
 #define glBeginTransformFeedbackEXT            MANGLE(BeginTransformFeedbackEXT)
 #define glBeginTransformFeedback               MANGLE(BeginTransformFeedback)
 #define glBindBufferRange              MANGLE(BindBufferRange)
 #define glBindBufferRangeNV            MANGLE(BindBufferRangeNV)
 #define glBindFragDataLocationEXT              MANGLE(BindFragDataLocationEXT)
+#define glBindFragDataLocationIndexed          MANGLE(BindFragDataLocationIndexed)
 #define glBindFragDataLocation         MANGLE(BindFragDataLocation)
 #define glBindFragmentShaderATI                MANGLE(BindFragmentShaderATI)
 #define glBindFramebufferEXT           MANGLE(BindFramebufferEXT)
 #define glBindFramebuffer              MANGLE(BindFramebuffer)
+#define glBindImageTextureEXT          MANGLE(BindImageTextureEXT)
 #define glBindLightParameterEXT                MANGLE(BindLightParameterEXT)
 #define glBindMaterialParameterEXT             MANGLE(BindMaterialParameterEXT)
 #define glBindMultiTextureEXT          MANGLE(BindMultiTextureEXT)
 #define glBindParameterEXT             MANGLE(BindParameterEXT)
 #define glBindProgramARB               MANGLE(BindProgramARB)
 #define glBindProgramNV                MANGLE(BindProgramNV)
+#define glBindProgramPipeline          MANGLE(BindProgramPipeline)
 #define glBindRenderbufferEXT          MANGLE(BindRenderbufferEXT)
 #define glBindRenderbuffer             MANGLE(BindRenderbuffer)
+#define glBindSampler          MANGLE(BindSampler)
 #define glBindTexGenParameterEXT               MANGLE(BindTexGenParameterEXT)
 #define glBindTextureEXT               MANGLE(BindTextureEXT)
 #define glBindTexture          MANGLE(BindTexture)
 #define glBindTextureUnitParameterEXT          MANGLE(BindTextureUnitParameterEXT)
+#define glBindTransformFeedback                MANGLE(BindTransformFeedback)
 #define glBindTransformFeedbackNV              MANGLE(BindTransformFeedbackNV)
 #define glBindVertexArrayAPPLE         MANGLE(BindVertexArrayAPPLE)
 #define glBindVertexArray              MANGLE(BindVertexArray)
 #define glBlendColorEXT                MANGLE(BlendColorEXT)
 #define glBlendColor           MANGLE(BlendColor)
 #define glBlendEquationEXT             MANGLE(BlendEquationEXT)
+#define glBlendEquationiARB            MANGLE(BlendEquationiARB)
 #define glBlendEquationi               MANGLE(BlendEquationi)
 #define glBlendEquationIndexedAMD              MANGLE(BlendEquationIndexedAMD)
 #define glBlendEquation                MANGLE(BlendEquation)
 #define glBlendEquationSeparateATI             MANGLE(BlendEquationSeparateATI)
 #define glBlendEquationSeparateEXT             MANGLE(BlendEquationSeparateEXT)
+#define glBlendEquationSeparateiARB            MANGLE(BlendEquationSeparateiARB)
 #define glBlendEquationSeparatei               MANGLE(BlendEquationSeparatei)
 #define glBlendEquationSeparateIndexedAMD              MANGLE(BlendEquationSeparateIndexedAMD)
 #define glBlendEquationSeparate                MANGLE(BlendEquationSeparate)
+#define glBlendFunciARB                MANGLE(BlendFunciARB)
 #define glBlendFunci           MANGLE(BlendFunci)
 #define glBlendFuncIndexedAMD          MANGLE(BlendFuncIndexedAMD)
 #define glBlendFunc            MANGLE(BlendFunc)
 #define glBlendFuncSeparateEXT         MANGLE(BlendFuncSeparateEXT)
+#define glBlendFuncSeparateiARB                MANGLE(BlendFuncSeparateiARB)
 #define glBlendFuncSeparatei           MANGLE(BlendFuncSeparatei)
 #define glBlendFuncSeparateIndexedAMD          MANGLE(BlendFuncSeparateIndexedAMD)
 #define glBlendFuncSeparateINGR                MANGLE(BlendFuncSeparateINGR)
 #define glClearColor           MANGLE(ClearColor)
 #define glClearDebugLogMESA            MANGLE(ClearDebugLogMESA)
 #define glClearDepthdNV                MANGLE(ClearDepthdNV)
+#define glClearDepthf          MANGLE(ClearDepthf)
 #define glClearDepth           MANGLE(ClearDepth)
 #define glClearIndex           MANGLE(ClearIndex)
 #define glClear                MANGLE(Clear)
 #define glColorMaskIndexedEXT          MANGLE(ColorMaskIndexedEXT)
 #define glColorMask            MANGLE(ColorMask)
 #define glColorMaterial                MANGLE(ColorMaterial)
+#define glColorP3ui            MANGLE(ColorP3ui)
+#define glColorP3uiv           MANGLE(ColorP3uiv)
+#define glColorP4ui            MANGLE(ColorP4ui)
+#define glColorP4uiv           MANGLE(ColorP4uiv)
 #define glColorPointerEXT              MANGLE(ColorPointerEXT)
 #define glColorPointerListIBM          MANGLE(ColorPointerListIBM)
 #define glColorPointer         MANGLE(ColorPointer)
 #define glCombinerParameterivNV                MANGLE(CombinerParameterivNV)
 #define glCombinerStageParameterfvNV           MANGLE(CombinerStageParameterfvNV)
 #define glCompileShaderARB             MANGLE(CompileShaderARB)
+#define glCompileShaderIncludeARB              MANGLE(CompileShaderIncludeARB)
 #define glCompileShader                MANGLE(CompileShader)
 #define glCompressedMultiTexImage1DEXT         MANGLE(CompressedMultiTexImage1DEXT)
 #define glCompressedMultiTexImage2DEXT         MANGLE(CompressedMultiTexImage2DEXT)
 #define glCreateShader         MANGLE(CreateShader)
 #define glCreateShaderObjectARB                MANGLE(CreateShaderObjectARB)
 #define glCreateShaderProgramEXT               MANGLE(CreateShaderProgramEXT)
+#define glCreateShaderProgramv         MANGLE(CreateShaderProgramv)
+#define glCreateSyncFromCLeventARB             MANGLE(CreateSyncFromCLeventARB)
 #define glCullFace             MANGLE(CullFace)
 #define glCullParameterdvEXT           MANGLE(CullParameterdvEXT)
 #define glCullParameterfvEXT           MANGLE(CullParameterfvEXT)
 #define glCurrentPaletteMatrixARB              MANGLE(CurrentPaletteMatrixARB)
+#define glDebugMessageCallbackAMD              MANGLE(DebugMessageCallbackAMD)
+#define glDebugMessageCallbackARB              MANGLE(DebugMessageCallbackARB)
+#define glDebugMessageControlARB               MANGLE(DebugMessageControlARB)
+#define glDebugMessageEnableAMD                MANGLE(DebugMessageEnableAMD)
+#define glDebugMessageInsertAMD                MANGLE(DebugMessageInsertAMD)
+#define glDebugMessageInsertARB                MANGLE(DebugMessageInsertARB)
 #define glDeformationMap3dSGIX         MANGLE(DeformationMap3dSGIX)
 #define glDeformationMap3fSGIX         MANGLE(DeformationMap3fSGIX)
 #define glDeformSGIX           MANGLE(DeformSGIX)
 #define glDeleteFramebuffersEXT                MANGLE(DeleteFramebuffersEXT)
 #define glDeleteFramebuffers           MANGLE(DeleteFramebuffers)
 #define glDeleteLists          MANGLE(DeleteLists)
+#define glDeleteNamedStringARB         MANGLE(DeleteNamedStringARB)
+#define glDeleteNamesAMD               MANGLE(DeleteNamesAMD)
 #define glDeleteObjectARB              MANGLE(DeleteObjectARB)
 #define glDeleteOcclusionQueriesNV             MANGLE(DeleteOcclusionQueriesNV)
 #define glDeletePerfMonitorsAMD                MANGLE(DeletePerfMonitorsAMD)
 #define glDeleteProgram                MANGLE(DeleteProgram)
+#define glDeleteProgramPipelines               MANGLE(DeleteProgramPipelines)
 #define glDeleteProgramsARB            MANGLE(DeleteProgramsARB)
 #define glDeleteProgramsNV             MANGLE(DeleteProgramsNV)
 #define glDeleteQueriesARB             MANGLE(DeleteQueriesARB)
 #define glDeleteQueries                MANGLE(DeleteQueries)
 #define glDeleteRenderbuffersEXT               MANGLE(DeleteRenderbuffersEXT)
 #define glDeleteRenderbuffers          MANGLE(DeleteRenderbuffers)
+#define glDeleteSamplers               MANGLE(DeleteSamplers)
 #define glDeleteShader         MANGLE(DeleteShader)
 #define glDeleteSync           MANGLE(DeleteSync)
 #define glDeleteTexturesEXT            MANGLE(DeleteTexturesEXT)
 #define glDeleteTextures               MANGLE(DeleteTextures)
+#define glDeleteTransformFeedbacks             MANGLE(DeleteTransformFeedbacks)
 #define glDeleteTransformFeedbacksNV           MANGLE(DeleteTransformFeedbacksNV)
 #define glDeleteVertexArraysAPPLE              MANGLE(DeleteVertexArraysAPPLE)
 #define glDeleteVertexArrays           MANGLE(DeleteVertexArrays)
 #define glDepthBoundsEXT               MANGLE(DepthBoundsEXT)
 #define glDepthFunc            MANGLE(DepthFunc)
 #define glDepthMask            MANGLE(DepthMask)
+#define glDepthRangeArrayv             MANGLE(DepthRangeArrayv)
 #define glDepthRangedNV                MANGLE(DepthRangedNV)
+#define glDepthRangef          MANGLE(DepthRangef)
+#define glDepthRangeIndexed            MANGLE(DepthRangeIndexed)
 #define glDepthRange           MANGLE(DepthRange)
 #define glDetachObjectARB              MANGLE(DetachObjectARB)
 #define glDetachShader         MANGLE(DetachShader)
 #define glDisableVertexAttribArrayARB          MANGLE(DisableVertexAttribArrayARB)
 #define glDisableVertexAttribArray             MANGLE(DisableVertexAttribArray)
 #define glDrawArraysEXT                MANGLE(DrawArraysEXT)
+#define glDrawArraysIndirect           MANGLE(DrawArraysIndirect)
 #define glDrawArraysInstancedARB               MANGLE(DrawArraysInstancedARB)
 #define glDrawArraysInstancedEXT               MANGLE(DrawArraysInstancedEXT)
 #define glDrawArraysInstanced          MANGLE(DrawArraysInstanced)
 #define glDrawElementArrayAPPLE                MANGLE(DrawElementArrayAPPLE)
 #define glDrawElementArrayATI          MANGLE(DrawElementArrayATI)
 #define glDrawElementsBaseVertex               MANGLE(DrawElementsBaseVertex)
+#define glDrawElementsIndirect         MANGLE(DrawElementsIndirect)
 #define glDrawElementsInstancedARB             MANGLE(DrawElementsInstancedARB)
 #define glDrawElementsInstancedBaseVertex              MANGLE(DrawElementsInstancedBaseVertex)
 #define glDrawElementsInstancedEXT             MANGLE(DrawElementsInstancedEXT)
 #define glDrawRangeElementsBaseVertex          MANGLE(DrawRangeElementsBaseVertex)
 #define glDrawRangeElementsEXT         MANGLE(DrawRangeElementsEXT)
 #define glDrawRangeElements            MANGLE(DrawRangeElements)
+#define glDrawTransformFeedback                MANGLE(DrawTransformFeedback)
 #define glDrawTransformFeedbackNV              MANGLE(DrawTransformFeedbackNV)
+#define glDrawTransformFeedbackStream          MANGLE(DrawTransformFeedbackStream)
 #define glEdgeFlagFormatNV             MANGLE(EdgeFlagFormatNV)
 #define glEdgeFlag             MANGLE(EdgeFlag)
 #define glEdgeFlagPointerEXT           MANGLE(EdgeFlagPointerEXT)
 #define glEndOcclusionQueryNV          MANGLE(EndOcclusionQueryNV)
 #define glEndPerfMonitorAMD            MANGLE(EndPerfMonitorAMD)
 #define glEndQueryARB          MANGLE(EndQueryARB)
+#define glEndQueryIndexed              MANGLE(EndQueryIndexed)
 #define glEndQuery             MANGLE(EndQuery)
 #define glEndTransformFeedbackEXT              MANGLE(EndTransformFeedbackEXT)
 #define glEndTransformFeedback         MANGLE(EndTransformFeedback)
 #define glFlush                MANGLE(Flush)
 #define glFlushMappedBufferRangeAPPLE          MANGLE(FlushMappedBufferRangeAPPLE)
 #define glFlushMappedBufferRange               MANGLE(FlushMappedBufferRange)
+#define glFlushMappedNamedBufferRangeEXT               MANGLE(FlushMappedNamedBufferRangeEXT)
 #define glFlushPixelDataRangeNV                MANGLE(FlushPixelDataRangeNV)
 #define glFlushRasterSGIX              MANGLE(FlushRasterSGIX)
 #define glFlushVertexArrayRangeAPPLE           MANGLE(FlushVertexArrayRangeAPPLE)
 #define glFramebufferTextureEXT                MANGLE(FramebufferTextureEXT)
 #define glFramebufferTextureFaceARB            MANGLE(FramebufferTextureFaceARB)
 #define glFramebufferTextureFaceEXT            MANGLE(FramebufferTextureFaceEXT)
-#define glFramebufferTextureFace               MANGLE(FramebufferTextureFace)
 #define glFramebufferTextureLayerARB           MANGLE(FramebufferTextureLayerARB)
 #define glFramebufferTextureLayerEXT           MANGLE(FramebufferTextureLayerEXT)
 #define glFramebufferTextureLayer              MANGLE(FramebufferTextureLayer)
 #define glGenFramebuffersEXT           MANGLE(GenFramebuffersEXT)
 #define glGenFramebuffers              MANGLE(GenFramebuffers)
 #define glGenLists             MANGLE(GenLists)
+#define glGenNamesAMD          MANGLE(GenNamesAMD)
 #define glGenOcclusionQueriesNV                MANGLE(GenOcclusionQueriesNV)
 #define glGenPerfMonitorsAMD           MANGLE(GenPerfMonitorsAMD)
+#define glGenProgramPipelines          MANGLE(GenProgramPipelines)
 #define glGenProgramsARB               MANGLE(GenProgramsARB)
 #define glGenProgramsNV                MANGLE(GenProgramsNV)
 #define glGenQueriesARB                MANGLE(GenQueriesARB)
 #define glGenQueries           MANGLE(GenQueries)
 #define glGenRenderbuffersEXT          MANGLE(GenRenderbuffersEXT)
 #define glGenRenderbuffers             MANGLE(GenRenderbuffers)
+#define glGenSamplers          MANGLE(GenSamplers)
 #define glGenSymbolsEXT                MANGLE(GenSymbolsEXT)
 #define glGenTexturesEXT               MANGLE(GenTexturesEXT)
 #define glGenTextures          MANGLE(GenTextures)
+#define glGenTransformFeedbacks                MANGLE(GenTransformFeedbacks)
 #define glGenTransformFeedbacksNV              MANGLE(GenTransformFeedbacksNV)
 #define glGenVertexArraysAPPLE         MANGLE(GenVertexArraysAPPLE)
 #define glGenVertexArrays              MANGLE(GenVertexArrays)
 #define glGenVertexShadersEXT          MANGLE(GenVertexShadersEXT)
 #define glGetActiveAttribARB           MANGLE(GetActiveAttribARB)
 #define glGetActiveAttrib              MANGLE(GetActiveAttrib)
+#define glGetActiveSubroutineName              MANGLE(GetActiveSubroutineName)
+#define glGetActiveSubroutineUniformiv         MANGLE(GetActiveSubroutineUniformiv)
+#define glGetActiveSubroutineUniformName               MANGLE(GetActiveSubroutineUniformName)
 #define glGetActiveUniformARB          MANGLE(GetActiveUniformARB)
 #define glGetActiveUniformBlockiv              MANGLE(GetActiveUniformBlockiv)
 #define glGetActiveUniformBlockName            MANGLE(GetActiveUniformBlockName)
 #define glGetConvolutionParameteriv            MANGLE(GetConvolutionParameteriv)
 #define glGetDebugLogLengthMESA                MANGLE(GetDebugLogLengthMESA)
 #define glGetDebugLogMESA              MANGLE(GetDebugLogMESA)
+#define glGetDebugMessageLogAMD                MANGLE(GetDebugMessageLogAMD)
+#define glGetDebugMessageLogARB                MANGLE(GetDebugMessageLogARB)
 #define glGetDetailTexFuncSGIS         MANGLE(GetDetailTexFuncSGIS)
 #define glGetDoubleIndexedvEXT         MANGLE(GetDoubleIndexedvEXT)
+#define glGetDoublei_v         MANGLE(GetDoublei_v)
 #define glGetDoublev           MANGLE(GetDoublev)
 #define glGetError             MANGLE(GetError)
 #define glGetFenceivNV         MANGLE(GetFenceivNV)
 #define glGetFinalCombinerInputParameterfvNV           MANGLE(GetFinalCombinerInputParameterfvNV)
 #define glGetFinalCombinerInputParameterivNV           MANGLE(GetFinalCombinerInputParameterivNV)
 #define glGetFloatIndexedvEXT          MANGLE(GetFloatIndexedvEXT)
+#define glGetFloati_v          MANGLE(GetFloati_v)
 #define glGetFloatv            MANGLE(GetFloatv)
 #define glGetFogFuncSGIS               MANGLE(GetFogFuncSGIS)
+#define glGetFragDataIndex             MANGLE(GetFragDataIndex)
 #define glGetFragDataLocationEXT               MANGLE(GetFragDataLocationEXT)
 #define glGetFragDataLocation          MANGLE(GetFragDataLocation)
 #define glGetFragmentLightfvSGIX               MANGLE(GetFragmentLightfvSGIX)
 #define glGetFramebufferAttachmentParameterivEXT               MANGLE(GetFramebufferAttachmentParameterivEXT)
 #define glGetFramebufferAttachmentParameteriv          MANGLE(GetFramebufferAttachmentParameteriv)
 #define glGetFramebufferParameterivEXT         MANGLE(GetFramebufferParameterivEXT)
+#define glGetGraphicsResetStatusARB            MANGLE(GetGraphicsResetStatusARB)
 #define glGetHandleARB         MANGLE(GetHandleARB)
 #define glGetHistogramEXT              MANGLE(GetHistogramEXT)
 #define glGetHistogram         MANGLE(GetHistogram)
 #define glGetNamedProgramLocalParameterIuivEXT         MANGLE(GetNamedProgramLocalParameterIuivEXT)
 #define glGetNamedProgramStringEXT             MANGLE(GetNamedProgramStringEXT)
 #define glGetNamedRenderbufferParameterivEXT           MANGLE(GetNamedRenderbufferParameterivEXT)
+#define glGetNamedStringARB            MANGLE(GetNamedStringARB)
+#define glGetNamedStringivARB          MANGLE(GetNamedStringivARB)
+#define glGetnColorTableARB            MANGLE(GetnColorTableARB)
+#define glGetnCompressedTexImageARB            MANGLE(GetnCompressedTexImageARB)
+#define glGetnConvolutionFilterARB             MANGLE(GetnConvolutionFilterARB)
+#define glGetnHistogramARB             MANGLE(GetnHistogramARB)
+#define glGetnMapdvARB         MANGLE(GetnMapdvARB)
+#define glGetnMapfvARB         MANGLE(GetnMapfvARB)
+#define glGetnMapivARB         MANGLE(GetnMapivARB)
+#define glGetnMinmaxARB                MANGLE(GetnMinmaxARB)
+#define glGetnPixelMapfvARB            MANGLE(GetnPixelMapfvARB)
+#define glGetnPixelMapuivARB           MANGLE(GetnPixelMapuivARB)
+#define glGetnPixelMapusvARB           MANGLE(GetnPixelMapusvARB)
+#define glGetnPolygonStippleARB                MANGLE(GetnPolygonStippleARB)
+#define glGetnSeparableFilterARB               MANGLE(GetnSeparableFilterARB)
+#define glGetnTexImageARB              MANGLE(GetnTexImageARB)
+#define glGetnUniformdvARB             MANGLE(GetnUniformdvARB)
+#define glGetnUniformfvARB             MANGLE(GetnUniformfvARB)
+#define glGetnUniformivARB             MANGLE(GetnUniformivARB)
+#define glGetnUniformuivARB            MANGLE(GetnUniformuivARB)
 #define glGetObjectBufferfvATI         MANGLE(GetObjectBufferfvATI)
 #define glGetObjectBufferivATI         MANGLE(GetObjectBufferivATI)
 #define glGetObjectParameterfvARB              MANGLE(GetObjectParameterfvARB)
 #define glGetPointervEXT               MANGLE(GetPointervEXT)
 #define glGetPointerv          MANGLE(GetPointerv)
 #define glGetPolygonStipple            MANGLE(GetPolygonStipple)
+#define glGetProgramBinary             MANGLE(GetProgramBinary)
 #define glGetProgramEnvParameterdvARB          MANGLE(GetProgramEnvParameterdvARB)
 #define glGetProgramEnvParameterfvARB          MANGLE(GetProgramEnvParameterfvARB)
 #define glGetProgramEnvParameterIivNV          MANGLE(GetProgramEnvParameterIivNV)
 #define glGetProgramNamedParameterfvNV         MANGLE(GetProgramNamedParameterfvNV)
 #define glGetProgramParameterdvNV              MANGLE(GetProgramParameterdvNV)
 #define glGetProgramParameterfvNV              MANGLE(GetProgramParameterfvNV)
+#define glGetProgramPipelineInfoLog            MANGLE(GetProgramPipelineInfoLog)
+#define glGetProgramPipelineiv         MANGLE(GetProgramPipelineiv)
 #define glGetProgramRegisterfvMESA             MANGLE(GetProgramRegisterfvMESA)
+#define glGetProgramStageiv            MANGLE(GetProgramStageiv)
 #define glGetProgramStringARB          MANGLE(GetProgramStringARB)
 #define glGetProgramStringNV           MANGLE(GetProgramStringNV)
+#define glGetProgramSubroutineParameteruivNV           MANGLE(GetProgramSubroutineParameteruivNV)
+#define glGetQueryIndexediv            MANGLE(GetQueryIndexediv)
 #define glGetQueryivARB                MANGLE(GetQueryivARB)
 #define glGetQueryiv           MANGLE(GetQueryiv)
 #define glGetQueryObjecti64vEXT                MANGLE(GetQueryObjecti64vEXT)
+#define glGetQueryObjecti64v           MANGLE(GetQueryObjecti64v)
 #define glGetQueryObjectivARB          MANGLE(GetQueryObjectivARB)
 #define glGetQueryObjectiv             MANGLE(GetQueryObjectiv)
 #define glGetQueryObjectui64vEXT               MANGLE(GetQueryObjectui64vEXT)
+#define glGetQueryObjectui64v          MANGLE(GetQueryObjectui64v)
 #define glGetQueryObjectuivARB         MANGLE(GetQueryObjectuivARB)
 #define glGetQueryObjectuiv            MANGLE(GetQueryObjectuiv)
 #define glGetRenderbufferParameterivEXT                MANGLE(GetRenderbufferParameterivEXT)
 #define glGetRenderbufferParameteriv           MANGLE(GetRenderbufferParameteriv)
+#define glGetSamplerParameterfv                MANGLE(GetSamplerParameterfv)
+#define glGetSamplerParameterIiv               MANGLE(GetSamplerParameterIiv)
+#define glGetSamplerParameterIuiv              MANGLE(GetSamplerParameterIuiv)
+#define glGetSamplerParameteriv                MANGLE(GetSamplerParameteriv)
 #define glGetSeparableFilterEXT                MANGLE(GetSeparableFilterEXT)
 #define glGetSeparableFilter           MANGLE(GetSeparableFilter)
 #define glGetShaderInfoLog             MANGLE(GetShaderInfoLog)
 #define glGetShaderiv          MANGLE(GetShaderiv)
+#define glGetShaderPrecisionFormat             MANGLE(GetShaderPrecisionFormat)
 #define glGetShaderSourceARB           MANGLE(GetShaderSourceARB)
 #define glGetShaderSource              MANGLE(GetShaderSource)
 #define glGetSharpenTexFuncSGIS                MANGLE(GetSharpenTexFuncSGIS)
 #define glGetStringi           MANGLE(GetStringi)
 #define glGetString            MANGLE(GetString)
+#define glGetSubroutineIndex           MANGLE(GetSubroutineIndex)
+#define glGetSubroutineUniformLocation         MANGLE(GetSubroutineUniformLocation)
 #define glGetSynciv            MANGLE(GetSynciv)
 #define glGetTexBumpParameterfvATI             MANGLE(GetTexBumpParameterfvATI)
 #define glGetTexBumpParameterivATI             MANGLE(GetTexBumpParameterivATI)
 #define glGetTransformFeedbackVaryingNV                MANGLE(GetTransformFeedbackVaryingNV)
 #define glGetUniformBlockIndex         MANGLE(GetUniformBlockIndex)
 #define glGetUniformBufferSizeEXT              MANGLE(GetUniformBufferSizeEXT)
+#define glGetUniformdv         MANGLE(GetUniformdv)
 #define glGetUniformfvARB              MANGLE(GetUniformfvARB)
 #define glGetUniformfv         MANGLE(GetUniformfv)
+#define glGetUniformi64vNV             MANGLE(GetUniformi64vNV)
 #define glGetUniformIndices            MANGLE(GetUniformIndices)
 #define glGetUniformivARB              MANGLE(GetUniformivARB)
 #define glGetUniformiv         MANGLE(GetUniformiv)
 #define glGetUniformLocationARB                MANGLE(GetUniformLocationARB)
 #define glGetUniformLocation           MANGLE(GetUniformLocation)
 #define glGetUniformOffsetEXT          MANGLE(GetUniformOffsetEXT)
+#define glGetUniformSubroutineuiv              MANGLE(GetUniformSubroutineuiv)
 #define glGetUniformui64vNV            MANGLE(GetUniformui64vNV)
 #define glGetUniformuivEXT             MANGLE(GetUniformuivEXT)
 #define glGetUniformuiv                MANGLE(GetUniformuiv)
 #define glGetVertexAttribivARB         MANGLE(GetVertexAttribivARB)
 #define glGetVertexAttribiv            MANGLE(GetVertexAttribiv)
 #define glGetVertexAttribivNV          MANGLE(GetVertexAttribivNV)
+#define glGetVertexAttribLdvEXT                MANGLE(GetVertexAttribLdvEXT)
+#define glGetVertexAttribLdv           MANGLE(GetVertexAttribLdv)
+#define glGetVertexAttribLi64vNV               MANGLE(GetVertexAttribLi64vNV)
+#define glGetVertexAttribLui64vNV              MANGLE(GetVertexAttribLui64vNV)
 #define glGetVertexAttribPointervARB           MANGLE(GetVertexAttribPointervARB)
 #define glGetVertexAttribPointerv              MANGLE(GetVertexAttribPointerv)
 #define glGetVertexAttribPointervNV            MANGLE(GetVertexAttribPointervNV)
 #define glIsFramebufferEXT             MANGLE(IsFramebufferEXT)
 #define glIsFramebuffer                MANGLE(IsFramebuffer)
 #define glIsList               MANGLE(IsList)
+#define glIsNameAMD            MANGLE(IsNameAMD)
 #define glIsNamedBufferResidentNV              MANGLE(IsNamedBufferResidentNV)
+#define glIsNamedStringARB             MANGLE(IsNamedStringARB)
 #define glIsObjectBufferATI            MANGLE(IsObjectBufferATI)
 #define glIsOcclusionQueryNV           MANGLE(IsOcclusionQueryNV)
 #define glIsProgramARB         MANGLE(IsProgramARB)
 #define glIsProgram            MANGLE(IsProgram)
 #define glIsProgramNV          MANGLE(IsProgramNV)
+#define glIsProgramPipeline            MANGLE(IsProgramPipeline)
 #define glIsQueryARB           MANGLE(IsQueryARB)
 #define glIsQuery              MANGLE(IsQuery)
 #define glIsRenderbufferEXT            MANGLE(IsRenderbufferEXT)
 #define glIsRenderbuffer               MANGLE(IsRenderbuffer)
+#define glIsSampler            MANGLE(IsSampler)
 #define glIsShader             MANGLE(IsShader)
 #define glIsSync               MANGLE(IsSync)
 #define glIsTextureEXT         MANGLE(IsTextureEXT)
 #define glIsTexture            MANGLE(IsTexture)
+#define glIsTransformFeedback          MANGLE(IsTransformFeedback)
 #define glIsTransformFeedbackNV                MANGLE(IsTransformFeedbackNV)
 #define glIsVariantEnabledEXT          MANGLE(IsVariantEnabledEXT)
 #define glIsVertexArrayAPPLE           MANGLE(IsVertexArrayAPPLE)
 #define glLogicOp              MANGLE(LogicOp)
 #define glMakeBufferNonResidentNV              MANGLE(MakeBufferNonResidentNV)
 #define glMakeBufferResidentNV         MANGLE(MakeBufferResidentNV)
+#define glMakeNamedBufferNonResidentNV         MANGLE(MakeNamedBufferNonResidentNV)
+#define glMakeNamedBufferResidentNV            MANGLE(MakeNamedBufferResidentNV)
 #define glMap1d                MANGLE(Map1d)
 #define glMap1f                MANGLE(Map1f)
 #define glMap2d                MANGLE(Map2d)
 #define glMapGrid2d            MANGLE(MapGrid2d)
 #define glMapGrid2f            MANGLE(MapGrid2f)
 #define glMapNamedBufferEXT            MANGLE(MapNamedBufferEXT)
+#define glMapNamedBufferRangeEXT               MANGLE(MapNamedBufferRangeEXT)
 #define glMapObjectBufferATI           MANGLE(MapObjectBufferATI)
 #define glMapParameterfvNV             MANGLE(MapParameterfvNV)
 #define glMapParameterivNV             MANGLE(MapParameterivNV)
 #define glMatrixScalefEXT              MANGLE(MatrixScalefEXT)
 #define glMatrixTranslatedEXT          MANGLE(MatrixTranslatedEXT)
 #define glMatrixTranslatefEXT          MANGLE(MatrixTranslatefEXT)
+#define glMemoryBarrierEXT             MANGLE(MemoryBarrierEXT)
 #define glMinmaxEXT            MANGLE(MinmaxEXT)
 #define glMinmax               MANGLE(Minmax)
+#define glMinSampleShadingARB          MANGLE(MinSampleShadingARB)
 #define glMinSampleShading             MANGLE(MinSampleShading)
 #define glMultiDrawArraysEXT           MANGLE(MultiDrawArraysEXT)
 #define glMultiDrawArrays              MANGLE(MultiDrawArrays)
 #define glMultiTexCoord4s              MANGLE(MultiTexCoord4s)
 #define glMultiTexCoord4svARB          MANGLE(MultiTexCoord4svARB)
 #define glMultiTexCoord4sv             MANGLE(MultiTexCoord4sv)
+#define glMultiTexCoordP1ui            MANGLE(MultiTexCoordP1ui)
+#define glMultiTexCoordP1uiv           MANGLE(MultiTexCoordP1uiv)
+#define glMultiTexCoordP2ui            MANGLE(MultiTexCoordP2ui)
+#define glMultiTexCoordP2uiv           MANGLE(MultiTexCoordP2uiv)
+#define glMultiTexCoordP3ui            MANGLE(MultiTexCoordP3ui)
+#define glMultiTexCoordP3uiv           MANGLE(MultiTexCoordP3uiv)
+#define glMultiTexCoordP4ui            MANGLE(MultiTexCoordP4ui)
+#define glMultiTexCoordP4uiv           MANGLE(MultiTexCoordP4uiv)
 #define glMultiTexCoordPointerEXT              MANGLE(MultiTexCoordPointerEXT)
 #define glMultiTexEnvfEXT              MANGLE(MultiTexEnvfEXT)
 #define glMultiTexEnvfvEXT             MANGLE(MultiTexEnvfvEXT)
 #define glMultTransposeMatrixf         MANGLE(MultTransposeMatrixf)
 #define glNamedBufferDataEXT           MANGLE(NamedBufferDataEXT)
 #define glNamedBufferSubDataEXT                MANGLE(NamedBufferSubDataEXT)
+#define glNamedCopyBufferSubDataEXT            MANGLE(NamedCopyBufferSubDataEXT)
 #define glNamedFramebufferRenderbufferEXT              MANGLE(NamedFramebufferRenderbufferEXT)
 #define glNamedFramebufferTexture1DEXT         MANGLE(NamedFramebufferTexture1DEXT)
 #define glNamedFramebufferTexture2DEXT         MANGLE(NamedFramebufferTexture2DEXT)
 #define glNamedFramebufferTextureEXT           MANGLE(NamedFramebufferTextureEXT)
 #define glNamedFramebufferTextureFaceEXT               MANGLE(NamedFramebufferTextureFaceEXT)
 #define glNamedFramebufferTextureLayerEXT              MANGLE(NamedFramebufferTextureLayerEXT)
-#define glNamedMakeBufferNonResidentNV         MANGLE(NamedMakeBufferNonResidentNV)
-#define glNamedMakeBufferResidentNV            MANGLE(NamedMakeBufferResidentNV)
 #define glNamedProgramLocalParameter4dEXT              MANGLE(NamedProgramLocalParameter4dEXT)
 #define glNamedProgramLocalParameter4dvEXT             MANGLE(NamedProgramLocalParameter4dvEXT)
 #define glNamedProgramLocalParameter4fEXT              MANGLE(NamedProgramLocalParameter4fEXT)
 #define glNamedRenderbufferStorageEXT          MANGLE(NamedRenderbufferStorageEXT)
 #define glNamedRenderbufferStorageMultisampleCoverageEXT               MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT)
 #define glNamedRenderbufferStorageMultisampleEXT               MANGLE(NamedRenderbufferStorageMultisampleEXT)
+#define glNamedStringARB               MANGLE(NamedStringARB)
 #define glNewList              MANGLE(NewList)
 #define glNewObjectBufferATI           MANGLE(NewObjectBufferATI)
 #define glNormal3b             MANGLE(Normal3b)
 #define glNormal3s             MANGLE(Normal3s)
 #define glNormal3sv            MANGLE(Normal3sv)
 #define glNormalFormatNV               MANGLE(NormalFormatNV)
+#define glNormalP3ui           MANGLE(NormalP3ui)
+#define glNormalP3uiv          MANGLE(NormalP3uiv)
 #define glNormalPointerEXT             MANGLE(NormalPointerEXT)
 #define glNormalPointerListIBM         MANGLE(NormalPointerListIBM)
 #define glNormalPointer                MANGLE(NormalPointer)
 #define glOrtho                MANGLE(Ortho)
 #define glPassTexCoordATI              MANGLE(PassTexCoordATI)
 #define glPassThrough          MANGLE(PassThrough)
+#define glPatchParameterfv             MANGLE(PatchParameterfv)
+#define glPatchParameteri              MANGLE(PatchParameteri)
+#define glPauseTransformFeedback               MANGLE(PauseTransformFeedback)
 #define glPauseTransformFeedbackNV             MANGLE(PauseTransformFeedbackNV)
 #define glPixelDataRangeNV             MANGLE(PixelDataRangeNV)
 #define glPixelMapfv           MANGLE(PixelMapfv)
 #define glPrimitiveRestartNV           MANGLE(PrimitiveRestartNV)
 #define glPrioritizeTexturesEXT                MANGLE(PrioritizeTexturesEXT)
 #define glPrioritizeTextures           MANGLE(PrioritizeTextures)
+#define glProgramBinary                MANGLE(ProgramBinary)
 #define glProgramBufferParametersfvNV          MANGLE(ProgramBufferParametersfvNV)
 #define glProgramBufferParametersIivNV         MANGLE(ProgramBufferParametersIivNV)
 #define glProgramBufferParametersIuivNV                MANGLE(ProgramBufferParametersIuivNV)
 #define glProgramParameters4dvNV               MANGLE(ProgramParameters4dvNV)
 #define glProgramParameters4fvNV               MANGLE(ProgramParameters4fvNV)
 #define glProgramStringARB             MANGLE(ProgramStringARB)
+#define glProgramSubroutineParametersuivNV             MANGLE(ProgramSubroutineParametersuivNV)
+#define glProgramUniform1dEXT          MANGLE(ProgramUniform1dEXT)
+#define glProgramUniform1d             MANGLE(ProgramUniform1d)
+#define glProgramUniform1dvEXT         MANGLE(ProgramUniform1dvEXT)
+#define glProgramUniform1dv            MANGLE(ProgramUniform1dv)
 #define glProgramUniform1fEXT          MANGLE(ProgramUniform1fEXT)
+#define glProgramUniform1f             MANGLE(ProgramUniform1f)
 #define glProgramUniform1fvEXT         MANGLE(ProgramUniform1fvEXT)
+#define glProgramUniform1fv            MANGLE(ProgramUniform1fv)
+#define glProgramUniform1i64NV         MANGLE(ProgramUniform1i64NV)
+#define glProgramUniform1i64vNV                MANGLE(ProgramUniform1i64vNV)
 #define glProgramUniform1iEXT          MANGLE(ProgramUniform1iEXT)
+#define glProgramUniform1i             MANGLE(ProgramUniform1i)
 #define glProgramUniform1ivEXT         MANGLE(ProgramUniform1ivEXT)
+#define glProgramUniform1iv            MANGLE(ProgramUniform1iv)
+#define glProgramUniform1ui64NV                MANGLE(ProgramUniform1ui64NV)
+#define glProgramUniform1ui64vNV               MANGLE(ProgramUniform1ui64vNV)
 #define glProgramUniform1uiEXT         MANGLE(ProgramUniform1uiEXT)
+#define glProgramUniform1ui            MANGLE(ProgramUniform1ui)
 #define glProgramUniform1uivEXT                MANGLE(ProgramUniform1uivEXT)
+#define glProgramUniform1uiv           MANGLE(ProgramUniform1uiv)
+#define glProgramUniform2dEXT          MANGLE(ProgramUniform2dEXT)
+#define glProgramUniform2d             MANGLE(ProgramUniform2d)
+#define glProgramUniform2dvEXT         MANGLE(ProgramUniform2dvEXT)
+#define glProgramUniform2dv            MANGLE(ProgramUniform2dv)
 #define glProgramUniform2fEXT          MANGLE(ProgramUniform2fEXT)
+#define glProgramUniform2f             MANGLE(ProgramUniform2f)
 #define glProgramUniform2fvEXT         MANGLE(ProgramUniform2fvEXT)
+#define glProgramUniform2fv            MANGLE(ProgramUniform2fv)
+#define glProgramUniform2i64NV         MANGLE(ProgramUniform2i64NV)
+#define glProgramUniform2i64vNV                MANGLE(ProgramUniform2i64vNV)
 #define glProgramUniform2iEXT          MANGLE(ProgramUniform2iEXT)
+#define glProgramUniform2i             MANGLE(ProgramUniform2i)
 #define glProgramUniform2ivEXT         MANGLE(ProgramUniform2ivEXT)
+#define glProgramUniform2iv            MANGLE(ProgramUniform2iv)
+#define glProgramUniform2ui64NV                MANGLE(ProgramUniform2ui64NV)
+#define glProgramUniform2ui64vNV               MANGLE(ProgramUniform2ui64vNV)
 #define glProgramUniform2uiEXT         MANGLE(ProgramUniform2uiEXT)
+#define glProgramUniform2ui            MANGLE(ProgramUniform2ui)
 #define glProgramUniform2uivEXT                MANGLE(ProgramUniform2uivEXT)
+#define glProgramUniform2uiv           MANGLE(ProgramUniform2uiv)
+#define glProgramUniform3dEXT          MANGLE(ProgramUniform3dEXT)
+#define glProgramUniform3d             MANGLE(ProgramUniform3d)
+#define glProgramUniform3dvEXT         MANGLE(ProgramUniform3dvEXT)
+#define glProgramUniform3dv            MANGLE(ProgramUniform3dv)
 #define glProgramUniform3fEXT          MANGLE(ProgramUniform3fEXT)
+#define glProgramUniform3f             MANGLE(ProgramUniform3f)
 #define glProgramUniform3fvEXT         MANGLE(ProgramUniform3fvEXT)
+#define glProgramUniform3fv            MANGLE(ProgramUniform3fv)
+#define glProgramUniform3i64NV         MANGLE(ProgramUniform3i64NV)
+#define glProgramUniform3i64vNV                MANGLE(ProgramUniform3i64vNV)
 #define glProgramUniform3iEXT          MANGLE(ProgramUniform3iEXT)
+#define glProgramUniform3i             MANGLE(ProgramUniform3i)
 #define glProgramUniform3ivEXT         MANGLE(ProgramUniform3ivEXT)
+#define glProgramUniform3iv            MANGLE(ProgramUniform3iv)
+#define glProgramUniform3ui64NV                MANGLE(ProgramUniform3ui64NV)
+#define glProgramUniform3ui64vNV               MANGLE(ProgramUniform3ui64vNV)
 #define glProgramUniform3uiEXT         MANGLE(ProgramUniform3uiEXT)
+#define glProgramUniform3ui            MANGLE(ProgramUniform3ui)
 #define glProgramUniform3uivEXT                MANGLE(ProgramUniform3uivEXT)
+#define glProgramUniform3uiv           MANGLE(ProgramUniform3uiv)
+#define glProgramUniform4dEXT          MANGLE(ProgramUniform4dEXT)
+#define glProgramUniform4d             MANGLE(ProgramUniform4d)
+#define glProgramUniform4dvEXT         MANGLE(ProgramUniform4dvEXT)
+#define glProgramUniform4dv            MANGLE(ProgramUniform4dv)
 #define glProgramUniform4fEXT          MANGLE(ProgramUniform4fEXT)
+#define glProgramUniform4f             MANGLE(ProgramUniform4f)
 #define glProgramUniform4fvEXT         MANGLE(ProgramUniform4fvEXT)
+#define glProgramUniform4fv            MANGLE(ProgramUniform4fv)
+#define glProgramUniform4i64NV         MANGLE(ProgramUniform4i64NV)
+#define glProgramUniform4i64vNV                MANGLE(ProgramUniform4i64vNV)
 #define glProgramUniform4iEXT          MANGLE(ProgramUniform4iEXT)
+#define glProgramUniform4i             MANGLE(ProgramUniform4i)
 #define glProgramUniform4ivEXT         MANGLE(ProgramUniform4ivEXT)
+#define glProgramUniform4iv            MANGLE(ProgramUniform4iv)
+#define glProgramUniform4ui64NV                MANGLE(ProgramUniform4ui64NV)
+#define glProgramUniform4ui64vNV               MANGLE(ProgramUniform4ui64vNV)
 #define glProgramUniform4uiEXT         MANGLE(ProgramUniform4uiEXT)
+#define glProgramUniform4ui            MANGLE(ProgramUniform4ui)
 #define glProgramUniform4uivEXT                MANGLE(ProgramUniform4uivEXT)
+#define glProgramUniform4uiv           MANGLE(ProgramUniform4uiv)
+#define glProgramUniformMatrix2dvEXT           MANGLE(ProgramUniformMatrix2dvEXT)
+#define glProgramUniformMatrix2dv              MANGLE(ProgramUniformMatrix2dv)
 #define glProgramUniformMatrix2fvEXT           MANGLE(ProgramUniformMatrix2fvEXT)
+#define glProgramUniformMatrix2fv              MANGLE(ProgramUniformMatrix2fv)
+#define glProgramUniformMatrix2x3dvEXT         MANGLE(ProgramUniformMatrix2x3dvEXT)
+#define glProgramUniformMatrix2x3dv            MANGLE(ProgramUniformMatrix2x3dv)
 #define glProgramUniformMatrix2x3fvEXT         MANGLE(ProgramUniformMatrix2x3fvEXT)
+#define glProgramUniformMatrix2x3fv            MANGLE(ProgramUniformMatrix2x3fv)
+#define glProgramUniformMatrix2x4dvEXT         MANGLE(ProgramUniformMatrix2x4dvEXT)
+#define glProgramUniformMatrix2x4dv            MANGLE(ProgramUniformMatrix2x4dv)
 #define glProgramUniformMatrix2x4fvEXT         MANGLE(ProgramUniformMatrix2x4fvEXT)
+#define glProgramUniformMatrix2x4fv            MANGLE(ProgramUniformMatrix2x4fv)
+#define glProgramUniformMatrix3dvEXT           MANGLE(ProgramUniformMatrix3dvEXT)
+#define glProgramUniformMatrix3dv              MANGLE(ProgramUniformMatrix3dv)
 #define glProgramUniformMatrix3fvEXT           MANGLE(ProgramUniformMatrix3fvEXT)
+#define glProgramUniformMatrix3fv              MANGLE(ProgramUniformMatrix3fv)
+#define glProgramUniformMatrix3x2dvEXT         MANGLE(ProgramUniformMatrix3x2dvEXT)
+#define glProgramUniformMatrix3x2dv            MANGLE(ProgramUniformMatrix3x2dv)
 #define glProgramUniformMatrix3x2fvEXT         MANGLE(ProgramUniformMatrix3x2fvEXT)
+#define glProgramUniformMatrix3x2fv            MANGLE(ProgramUniformMatrix3x2fv)
+#define glProgramUniformMatrix3x4dvEXT         MANGLE(ProgramUniformMatrix3x4dvEXT)
+#define glProgramUniformMatrix3x4dv            MANGLE(ProgramUniformMatrix3x4dv)
 #define glProgramUniformMatrix3x4fvEXT         MANGLE(ProgramUniformMatrix3x4fvEXT)
+#define glProgramUniformMatrix3x4fv            MANGLE(ProgramUniformMatrix3x4fv)
+#define glProgramUniformMatrix4dvEXT           MANGLE(ProgramUniformMatrix4dvEXT)
+#define glProgramUniformMatrix4dv              MANGLE(ProgramUniformMatrix4dv)
 #define glProgramUniformMatrix4fvEXT           MANGLE(ProgramUniformMatrix4fvEXT)
+#define glProgramUniformMatrix4fv              MANGLE(ProgramUniformMatrix4fv)
+#define glProgramUniformMatrix4x2dvEXT         MANGLE(ProgramUniformMatrix4x2dvEXT)
+#define glProgramUniformMatrix4x2dv            MANGLE(ProgramUniformMatrix4x2dv)
 #define glProgramUniformMatrix4x2fvEXT         MANGLE(ProgramUniformMatrix4x2fvEXT)
+#define glProgramUniformMatrix4x2fv            MANGLE(ProgramUniformMatrix4x2fv)
+#define glProgramUniformMatrix4x3dvEXT         MANGLE(ProgramUniformMatrix4x3dvEXT)
+#define glProgramUniformMatrix4x3dv            MANGLE(ProgramUniformMatrix4x3dv)
 #define glProgramUniformMatrix4x3fvEXT         MANGLE(ProgramUniformMatrix4x3fvEXT)
+#define glProgramUniformMatrix4x3fv            MANGLE(ProgramUniformMatrix4x3fv)
 #define glProgramUniformui64NV         MANGLE(ProgramUniformui64NV)
 #define glProgramUniformui64vNV                MANGLE(ProgramUniformui64vNV)
 #define glProgramVertexLimitNV         MANGLE(ProgramVertexLimitNV)
 #define glPushClientAttrib             MANGLE(PushClientAttrib)
 #define glPushMatrix           MANGLE(PushMatrix)
 #define glPushName             MANGLE(PushName)
+#define glQueryCounter         MANGLE(QueryCounter)
 #define glRasterPos2d          MANGLE(RasterPos2d)
 #define glRasterPos2dv         MANGLE(RasterPos2dv)
 #define glRasterPos2f          MANGLE(RasterPos2f)
 #define glRasterPos4sv         MANGLE(RasterPos4sv)
 #define glReadBuffer           MANGLE(ReadBuffer)
 #define glReadInstrumentsSGIX          MANGLE(ReadInstrumentsSGIX)
+#define glReadnPixelsARB               MANGLE(ReadnPixelsARB)
 #define glReadPixels           MANGLE(ReadPixels)
 #define glRectd                MANGLE(Rectd)
 #define glRectdv               MANGLE(Rectdv)
 #define glRects                MANGLE(Rects)
 #define glRectsv               MANGLE(Rectsv)
 #define glReferencePlaneSGIX           MANGLE(ReferencePlaneSGIX)
+#define glReleaseShaderCompiler                MANGLE(ReleaseShaderCompiler)
 #define glRenderbufferStorageEXT               MANGLE(RenderbufferStorageEXT)
 #define glRenderbufferStorage          MANGLE(RenderbufferStorage)
 #define glRenderbufferStorageMultisampleCoverageNV             MANGLE(RenderbufferStorageMultisampleCoverageNV)
 #define glResetMinmaxEXT               MANGLE(ResetMinmaxEXT)
 #define glResetMinmax          MANGLE(ResetMinmax)
 #define glResizeBuffersMESA            MANGLE(ResizeBuffersMESA)
+#define glResumeTransformFeedback              MANGLE(ResumeTransformFeedback)
 #define glResumeTransformFeedbackNV            MANGLE(ResumeTransformFeedbackNV)
 #define glRotated              MANGLE(Rotated)
 #define glRotatef              MANGLE(Rotatef)
 #define glSampleMaskSGIS               MANGLE(SampleMaskSGIS)
 #define glSamplePatternEXT             MANGLE(SamplePatternEXT)
 #define glSamplePatternSGIS            MANGLE(SamplePatternSGIS)
+#define glSamplerParameterf            MANGLE(SamplerParameterf)
+#define glSamplerParameterfv           MANGLE(SamplerParameterfv)
+#define glSamplerParameterIiv          MANGLE(SamplerParameterIiv)
+#define glSamplerParameteri            MANGLE(SamplerParameteri)
+#define glSamplerParameterIuiv         MANGLE(SamplerParameterIuiv)
+#define glSamplerParameteriv           MANGLE(SamplerParameteriv)
 #define glScaled               MANGLE(Scaled)
 #define glScalef               MANGLE(Scalef)
+#define glScissorArrayv                MANGLE(ScissorArrayv)
+#define glScissorIndexed               MANGLE(ScissorIndexed)
+#define glScissorIndexedv              MANGLE(ScissorIndexedv)
 #define glScissor              MANGLE(Scissor)
 #define glSecondaryColor3bEXT          MANGLE(SecondaryColor3bEXT)
 #define glSecondaryColor3b             MANGLE(SecondaryColor3b)
 #define glSecondaryColor3usvEXT                MANGLE(SecondaryColor3usvEXT)
 #define glSecondaryColor3usv           MANGLE(SecondaryColor3usv)
 #define glSecondaryColorFormatNV               MANGLE(SecondaryColorFormatNV)
+#define glSecondaryColorP3ui           MANGLE(SecondaryColorP3ui)
+#define glSecondaryColorP3uiv          MANGLE(SecondaryColorP3uiv)
 #define glSecondaryColorPointerEXT             MANGLE(SecondaryColorPointerEXT)
 #define glSecondaryColorPointerListIBM         MANGLE(SecondaryColorPointerListIBM)
 #define glSecondaryColorPointer                MANGLE(SecondaryColorPointer)
 #define glSetInvariantEXT              MANGLE(SetInvariantEXT)
 #define glSetLocalConstantEXT          MANGLE(SetLocalConstantEXT)
 #define glShadeModel           MANGLE(ShadeModel)
+#define glShaderBinary         MANGLE(ShaderBinary)
 #define glShaderOp1EXT         MANGLE(ShaderOp1EXT)
 #define glShaderOp2EXT         MANGLE(ShaderOp2EXT)
 #define glShaderOp3EXT         MANGLE(ShaderOp3EXT)
 #define glTexCoord4s           MANGLE(TexCoord4s)
 #define glTexCoord4sv          MANGLE(TexCoord4sv)
 #define glTexCoordFormatNV             MANGLE(TexCoordFormatNV)
+#define glTexCoordP1ui         MANGLE(TexCoordP1ui)
+#define glTexCoordP1uiv                MANGLE(TexCoordP1uiv)
+#define glTexCoordP2ui         MANGLE(TexCoordP2ui)
+#define glTexCoordP2uiv                MANGLE(TexCoordP2uiv)
+#define glTexCoordP3ui         MANGLE(TexCoordP3ui)
+#define glTexCoordP3uiv                MANGLE(TexCoordP3uiv)
+#define glTexCoordP4ui         MANGLE(TexCoordP4ui)
+#define glTexCoordP4uiv                MANGLE(TexCoordP4uiv)
 #define glTexCoordPointerEXT           MANGLE(TexCoordPointerEXT)
 #define glTexCoordPointerListIBM               MANGLE(TexCoordPointerListIBM)
 #define glTexCoordPointer              MANGLE(TexCoordPointer)
 #define glTextureSubImage3DEXT         MANGLE(TextureSubImage3DEXT)
 #define glTrackMatrixNV                MANGLE(TrackMatrixNV)
 #define glTransformFeedbackAttribsNV           MANGLE(TransformFeedbackAttribsNV)
+#define glTransformFeedbackStreamAttribsNV             MANGLE(TransformFeedbackStreamAttribsNV)
 #define glTransformFeedbackVaryingsEXT         MANGLE(TransformFeedbackVaryingsEXT)
 #define glTransformFeedbackVaryings            MANGLE(TransformFeedbackVaryings)
 #define glTransformFeedbackVaryingsNV          MANGLE(TransformFeedbackVaryingsNV)
 #define glTranslated           MANGLE(Translated)
 #define glTranslatef           MANGLE(Translatef)
+#define glUniform1d            MANGLE(Uniform1d)
+#define glUniform1dv           MANGLE(Uniform1dv)
 #define glUniform1fARB         MANGLE(Uniform1fARB)
 #define glUniform1f            MANGLE(Uniform1f)
 #define glUniform1fvARB                MANGLE(Uniform1fvARB)
 #define glUniform1fv           MANGLE(Uniform1fv)
+#define glUniform1i64NV                MANGLE(Uniform1i64NV)
+#define glUniform1i64vNV               MANGLE(Uniform1i64vNV)
 #define glUniform1iARB         MANGLE(Uniform1iARB)
 #define glUniform1i            MANGLE(Uniform1i)
 #define glUniform1ivARB                MANGLE(Uniform1ivARB)
 #define glUniform1iv           MANGLE(Uniform1iv)
+#define glUniform1ui64NV               MANGLE(Uniform1ui64NV)
+#define glUniform1ui64vNV              MANGLE(Uniform1ui64vNV)
 #define glUniform1uiEXT                MANGLE(Uniform1uiEXT)
 #define glUniform1ui           MANGLE(Uniform1ui)
 #define glUniform1uivEXT               MANGLE(Uniform1uivEXT)
 #define glUniform1uiv          MANGLE(Uniform1uiv)
+#define glUniform2d            MANGLE(Uniform2d)
+#define glUniform2dv           MANGLE(Uniform2dv)
 #define glUniform2fARB         MANGLE(Uniform2fARB)
 #define glUniform2f            MANGLE(Uniform2f)
 #define glUniform2fvARB                MANGLE(Uniform2fvARB)
 #define glUniform2fv           MANGLE(Uniform2fv)
+#define glUniform2i64NV                MANGLE(Uniform2i64NV)
+#define glUniform2i64vNV               MANGLE(Uniform2i64vNV)
 #define glUniform2iARB         MANGLE(Uniform2iARB)
 #define glUniform2i            MANGLE(Uniform2i)
 #define glUniform2ivARB                MANGLE(Uniform2ivARB)
 #define glUniform2iv           MANGLE(Uniform2iv)
+#define glUniform2ui64NV               MANGLE(Uniform2ui64NV)
+#define glUniform2ui64vNV              MANGLE(Uniform2ui64vNV)
 #define glUniform2uiEXT                MANGLE(Uniform2uiEXT)
 #define glUniform2ui           MANGLE(Uniform2ui)
 #define glUniform2uivEXT               MANGLE(Uniform2uivEXT)
 #define glUniform2uiv          MANGLE(Uniform2uiv)
+#define glUniform3d            MANGLE(Uniform3d)
+#define glUniform3dv           MANGLE(Uniform3dv)
 #define glUniform3fARB         MANGLE(Uniform3fARB)
 #define glUniform3f            MANGLE(Uniform3f)
 #define glUniform3fvARB                MANGLE(Uniform3fvARB)
 #define glUniform3fv           MANGLE(Uniform3fv)
+#define glUniform3i64NV                MANGLE(Uniform3i64NV)
+#define glUniform3i64vNV               MANGLE(Uniform3i64vNV)
 #define glUniform3iARB         MANGLE(Uniform3iARB)
 #define glUniform3i            MANGLE(Uniform3i)
 #define glUniform3ivARB                MANGLE(Uniform3ivARB)
 #define glUniform3iv           MANGLE(Uniform3iv)
+#define glUniform3ui64NV               MANGLE(Uniform3ui64NV)
+#define glUniform3ui64vNV              MANGLE(Uniform3ui64vNV)
 #define glUniform3uiEXT                MANGLE(Uniform3uiEXT)
 #define glUniform3ui           MANGLE(Uniform3ui)
 #define glUniform3uivEXT               MANGLE(Uniform3uivEXT)
 #define glUniform3uiv          MANGLE(Uniform3uiv)
+#define glUniform4d            MANGLE(Uniform4d)
+#define glUniform4dv           MANGLE(Uniform4dv)
 #define glUniform4fARB         MANGLE(Uniform4fARB)
 #define glUniform4f            MANGLE(Uniform4f)
 #define glUniform4fvARB                MANGLE(Uniform4fvARB)
 #define glUniform4fv           MANGLE(Uniform4fv)
+#define glUniform4i64NV                MANGLE(Uniform4i64NV)
+#define glUniform4i64vNV               MANGLE(Uniform4i64vNV)
 #define glUniform4iARB         MANGLE(Uniform4iARB)
 #define glUniform4i            MANGLE(Uniform4i)
 #define glUniform4ivARB                MANGLE(Uniform4ivARB)
 #define glUniform4iv           MANGLE(Uniform4iv)
+#define glUniform4ui64NV               MANGLE(Uniform4ui64NV)
+#define glUniform4ui64vNV              MANGLE(Uniform4ui64vNV)
 #define glUniform4uiEXT                MANGLE(Uniform4uiEXT)
 #define glUniform4ui           MANGLE(Uniform4ui)
 #define glUniform4uivEXT               MANGLE(Uniform4uivEXT)
 #define glUniform4uiv          MANGLE(Uniform4uiv)
 #define glUniformBlockBinding          MANGLE(UniformBlockBinding)
 #define glUniformBufferEXT             MANGLE(UniformBufferEXT)
+#define glUniformMatrix2dv             MANGLE(UniformMatrix2dv)
 #define glUniformMatrix2fvARB          MANGLE(UniformMatrix2fvARB)
 #define glUniformMatrix2fv             MANGLE(UniformMatrix2fv)
+#define glUniformMatrix2x3dv           MANGLE(UniformMatrix2x3dv)
 #define glUniformMatrix2x3fv           MANGLE(UniformMatrix2x3fv)
+#define glUniformMatrix2x4dv           MANGLE(UniformMatrix2x4dv)
 #define glUniformMatrix2x4fv           MANGLE(UniformMatrix2x4fv)
+#define glUniformMatrix3dv             MANGLE(UniformMatrix3dv)
 #define glUniformMatrix3fvARB          MANGLE(UniformMatrix3fvARB)
 #define glUniformMatrix3fv             MANGLE(UniformMatrix3fv)
+#define glUniformMatrix3x2dv           MANGLE(UniformMatrix3x2dv)
 #define glUniformMatrix3x2fv           MANGLE(UniformMatrix3x2fv)
+#define glUniformMatrix3x4dv           MANGLE(UniformMatrix3x4dv)
 #define glUniformMatrix3x4fv           MANGLE(UniformMatrix3x4fv)
+#define glUniformMatrix4dv             MANGLE(UniformMatrix4dv)
 #define glUniformMatrix4fvARB          MANGLE(UniformMatrix4fvARB)
 #define glUniformMatrix4fv             MANGLE(UniformMatrix4fv)
+#define glUniformMatrix4x2dv           MANGLE(UniformMatrix4x2dv)
 #define glUniformMatrix4x2fv           MANGLE(UniformMatrix4x2fv)
+#define glUniformMatrix4x3dv           MANGLE(UniformMatrix4x3dv)
 #define glUniformMatrix4x3fv           MANGLE(UniformMatrix4x3fv)
+#define glUniformSubroutinesuiv                MANGLE(UniformSubroutinesuiv)
 #define glUniformui64NV                MANGLE(Uniformui64NV)
 #define glUniformui64vNV               MANGLE(Uniformui64vNV)
 #define glUnlockArraysEXT              MANGLE(UnlockArraysEXT)
 #define glUpdateObjectBufferATI                MANGLE(UpdateObjectBufferATI)
 #define glUseProgram           MANGLE(UseProgram)
 #define glUseProgramObjectARB          MANGLE(UseProgramObjectARB)
+#define glUseProgramStages             MANGLE(UseProgramStages)
 #define glUseShaderProgramEXT          MANGLE(UseShaderProgramEXT)
 #define glValidateProgramARB           MANGLE(ValidateProgramARB)
 #define glValidateProgram              MANGLE(ValidateProgram)
+#define glValidateProgramPipeline              MANGLE(ValidateProgramPipeline)
 #define glVariantArrayObjectATI                MANGLE(VariantArrayObjectATI)
 #define glVariantbvEXT         MANGLE(VariantbvEXT)
 #define glVariantdvEXT         MANGLE(VariantdvEXT)
 #define glVariantubvEXT                MANGLE(VariantubvEXT)
 #define glVariantuivEXT                MANGLE(VariantuivEXT)
 #define glVariantusvEXT                MANGLE(VariantusvEXT)
+#define glVDPAUFiniNV          MANGLE(VDPAUFiniNV)
+#define glVDPAUGetSurfaceivNV          MANGLE(VDPAUGetSurfaceivNV)
+#define glVDPAUInitNV          MANGLE(VDPAUInitNV)
+#define glVDPAUIsSurfaceNV             MANGLE(VDPAUIsSurfaceNV)
+#define glVDPAUMapSurfacesNV           MANGLE(VDPAUMapSurfacesNV)
+#define glVDPAURegisterOutputSurfaceNV         MANGLE(VDPAURegisterOutputSurfaceNV)
+#define glVDPAURegisterVideoSurfaceNV          MANGLE(VDPAURegisterVideoSurfaceNV)
+#define glVDPAUSurfaceAccessNV         MANGLE(VDPAUSurfaceAccessNV)
+#define glVDPAUUnmapSurfacesNV         MANGLE(VDPAUUnmapSurfacesNV)
+#define glVDPAUUnregisterSurfaceNV             MANGLE(VDPAUUnregisterSurfaceNV)
 #define glVertex2d             MANGLE(Vertex2d)
 #define glVertex2dv            MANGLE(Vertex2dv)
 #define glVertex2f             MANGLE(Vertex2f)
 #define glVertexArrayParameteriAPPLE           MANGLE(VertexArrayParameteriAPPLE)
 #define glVertexArrayRangeAPPLE                MANGLE(VertexArrayRangeAPPLE)
 #define glVertexArrayRangeNV           MANGLE(VertexArrayRangeNV)
+#define glVertexArrayVertexAttribLOffsetEXT            MANGLE(VertexArrayVertexAttribLOffsetEXT)
 #define glVertexAttrib1dARB            MANGLE(VertexAttrib1dARB)
 #define glVertexAttrib1d               MANGLE(VertexAttrib1d)
 #define glVertexAttrib1dNV             MANGLE(VertexAttrib1dNV)
 #define glVertexAttrib4usv             MANGLE(VertexAttrib4usv)
 #define glVertexAttribArrayObjectATI           MANGLE(VertexAttribArrayObjectATI)
 #define glVertexAttribDivisorARB               MANGLE(VertexAttribDivisorARB)
+#define glVertexAttribDivisor          MANGLE(VertexAttribDivisor)
 #define glVertexAttribFormatNV         MANGLE(VertexAttribFormatNV)
 #define glVertexAttribI1iEXT           MANGLE(VertexAttribI1iEXT)
 #define glVertexAttribI1i              MANGLE(VertexAttribI1i)
 #define glVertexAttribIFormatNV                MANGLE(VertexAttribIFormatNV)
 #define glVertexAttribIPointerEXT              MANGLE(VertexAttribIPointerEXT)
 #define glVertexAttribIPointer         MANGLE(VertexAttribIPointer)
+#define glVertexAttribL1dEXT           MANGLE(VertexAttribL1dEXT)
+#define glVertexAttribL1d              MANGLE(VertexAttribL1d)
+#define glVertexAttribL1dvEXT          MANGLE(VertexAttribL1dvEXT)
+#define glVertexAttribL1dv             MANGLE(VertexAttribL1dv)
+#define glVertexAttribL1i64NV          MANGLE(VertexAttribL1i64NV)
+#define glVertexAttribL1i64vNV         MANGLE(VertexAttribL1i64vNV)
+#define glVertexAttribL1ui64NV         MANGLE(VertexAttribL1ui64NV)
+#define glVertexAttribL1ui64vNV                MANGLE(VertexAttribL1ui64vNV)
+#define glVertexAttribL2dEXT           MANGLE(VertexAttribL2dEXT)
+#define glVertexAttribL2d              MANGLE(VertexAttribL2d)
+#define glVertexAttribL2dvEXT          MANGLE(VertexAttribL2dvEXT)
+#define glVertexAttribL2dv             MANGLE(VertexAttribL2dv)
+#define glVertexAttribL2i64NV          MANGLE(VertexAttribL2i64NV)
+#define glVertexAttribL2i64vNV         MANGLE(VertexAttribL2i64vNV)
+#define glVertexAttribL2ui64NV         MANGLE(VertexAttribL2ui64NV)
+#define glVertexAttribL2ui64vNV                MANGLE(VertexAttribL2ui64vNV)
+#define glVertexAttribL3dEXT           MANGLE(VertexAttribL3dEXT)
+#define glVertexAttribL3d              MANGLE(VertexAttribL3d)
+#define glVertexAttribL3dvEXT          MANGLE(VertexAttribL3dvEXT)
+#define glVertexAttribL3dv             MANGLE(VertexAttribL3dv)
+#define glVertexAttribL3i64NV          MANGLE(VertexAttribL3i64NV)
+#define glVertexAttribL3i64vNV         MANGLE(VertexAttribL3i64vNV)
+#define glVertexAttribL3ui64NV         MANGLE(VertexAttribL3ui64NV)
+#define glVertexAttribL3ui64vNV                MANGLE(VertexAttribL3ui64vNV)
+#define glVertexAttribL4dEXT           MANGLE(VertexAttribL4dEXT)
+#define glVertexAttribL4d              MANGLE(VertexAttribL4d)
+#define glVertexAttribL4dvEXT          MANGLE(VertexAttribL4dvEXT)
+#define glVertexAttribL4dv             MANGLE(VertexAttribL4dv)
+#define glVertexAttribL4i64NV          MANGLE(VertexAttribL4i64NV)
+#define glVertexAttribL4i64vNV         MANGLE(VertexAttribL4i64vNV)
+#define glVertexAttribL4ui64NV         MANGLE(VertexAttribL4ui64NV)
+#define glVertexAttribL4ui64vNV                MANGLE(VertexAttribL4ui64vNV)
+#define glVertexAttribLFormatNV                MANGLE(VertexAttribLFormatNV)
+#define glVertexAttribLPointerEXT              MANGLE(VertexAttribLPointerEXT)
+#define glVertexAttribLPointer         MANGLE(VertexAttribLPointer)
+#define glVertexAttribP1ui             MANGLE(VertexAttribP1ui)
+#define glVertexAttribP1uiv            MANGLE(VertexAttribP1uiv)
+#define glVertexAttribP2ui             MANGLE(VertexAttribP2ui)
+#define glVertexAttribP2uiv            MANGLE(VertexAttribP2uiv)
+#define glVertexAttribP3ui             MANGLE(VertexAttribP3ui)
+#define glVertexAttribP3uiv            MANGLE(VertexAttribP3uiv)
+#define glVertexAttribP4ui             MANGLE(VertexAttribP4ui)
+#define glVertexAttribP4uiv            MANGLE(VertexAttribP4uiv)
 #define glVertexAttribPointerARB               MANGLE(VertexAttribPointerARB)
 #define glVertexAttribPointer          MANGLE(VertexAttribPointer)
 #define glVertexAttribPointerNV                MANGLE(VertexAttribPointerNV)
 #define glVertexBlendEnvfATI           MANGLE(VertexBlendEnvfATI)
 #define glVertexBlendEnviATI           MANGLE(VertexBlendEnviATI)
 #define glVertexFormatNV               MANGLE(VertexFormatNV)
+#define glVertexP2ui           MANGLE(VertexP2ui)
+#define glVertexP2uiv          MANGLE(VertexP2uiv)
+#define glVertexP3ui           MANGLE(VertexP3ui)
+#define glVertexP3uiv          MANGLE(VertexP3uiv)
+#define glVertexP4ui           MANGLE(VertexP4ui)
+#define glVertexP4uiv          MANGLE(VertexP4uiv)
 #define glVertexPointerEXT             MANGLE(VertexPointerEXT)
 #define glVertexPointerListIBM         MANGLE(VertexPointerListIBM)
 #define glVertexPointer                MANGLE(VertexPointer)
 #define glVideoCaptureStreamParameterdvNV              MANGLE(VideoCaptureStreamParameterdvNV)
 #define glVideoCaptureStreamParameterfvNV              MANGLE(VideoCaptureStreamParameterfvNV)
 #define glVideoCaptureStreamParameterivNV              MANGLE(VideoCaptureStreamParameterivNV)
+#define glViewportArrayv               MANGLE(ViewportArrayv)
+#define glViewportIndexedf             MANGLE(ViewportIndexedf)
+#define glViewportIndexedfv            MANGLE(ViewportIndexedfv)
 #define glViewport             MANGLE(Viewport)
 #define glWaitSync             MANGLE(WaitSync)
 #define glWeightbvARB          MANGLE(WeightbvARB)
index 9818cbc99c972624e682d2da10e9cb72237270f2..6e5e6a11180e2bd1bad2e2046f5ddea90bbeb599 100644 (file)
@@ -29,9 +29,9 @@ extern "C" {
 */
 
 /* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated $Date: 2010-11-03 18:59:30 -0700 (Wed, 03 Nov 2010) $ */
+/* glext.h last updated $Date: 2010-12-09 02:15:08 -0800 (Thu, 09 Dec 2010) $ */
 /* Current version at http://www.opengl.org/registry/ */
-#define GL_GLEXT_VERSION 66
+#define GL_GLEXT_VERSION 67
 /* Function declaration macros - to move into glplatform.h */
 
 #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@@ -5026,6 +5026,12 @@ extern "C" {
 #define GL_DEPTH_CLAMP_FAR_AMD            0x901F
 #endif
 
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_TEXTURE_SRGB_DECODE_EXT        0x8A48
+#define GL_DECODE_EXT                     0x8A49
+#define GL_SKIP_DECODE_EXT                0x8A4A
+#endif
+
 
 /*************************************************************/
 
@@ -11031,6 +11037,10 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons
 #define GL_AMD_depth_clamp_separate 1
 #endif
 
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_EXT_texture_sRGB_decode 1
+#endif
+
 
 #ifdef __cplusplus
 }
index 9ee039bd90b17ce7b623444c7db93096544f23b0..39aa68bc8ca1ff79951fa5cacca4a0dd349e661d 100644 (file)
@@ -251,6 +251,15 @@ struct __DRItexBufferExtensionRec {
                          GLint target,
                          GLint format,
                          __DRIdrawable *pDraw);
+    /**
+     * Method to release texture buffer in case some special platform
+     * need this.
+     *
+     * For GLX_EXT_texture_from_pixmap with AIGLX.
+     */
+    void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
+                       GLint target,
+                       __DRIdrawable *pDraw);
 };
 
 /**
index 60167e45d67fd26956b6b40d41b2126a29dfa0f4..86d54d6e01f4d368ea0c7089d7e5b09349da5a5d 100644 (file)
@@ -1,8 +1,8 @@
-/* $Revision: 6822 $ on $Date:: 2008-10-30 05:14:19 -0400 #$ */
+/* $Revision: 9203 $ on $Date:: 2009-10-07 02:21:52 -0700 #$ */
 
 /*------------------------------------------------------------------------
  *
- * OpenVG 1.0.1 Reference Implementation
+ * OpenVG 1.1 Reference Implementation
  * -------------------------------------
  *
  * Copyright (c) 2008 The Khronos Group Inc.
@@ -28,7 +28,7 @@
  *
  *//**
  * \file
- * \brief      OpenVG 1.0.1 API.
+ * \brief      OpenVG 1.1 API.
  *//*-------------------------------------------------------------------*/
 
 #ifndef _OPENVG_H
@@ -42,6 +42,7 @@ extern "C" {
 
 #define OPENVG_VERSION_1_0             1
 #define OPENVG_VERSION_1_0_1   1
+#define OPENVG_VERSION_1_1             2
 
 #ifndef VG_MAXSHORT
 #define VG_MAXSHORT 0x7FFF
@@ -55,10 +56,12 @@ extern "C" {
 #define VG_MAX_ENUM 0x7FFFFFFF
 #endif
 
-typedef long VGHandle;
+typedef VGuint VGHandle;
 
 typedef VGHandle VGPath;
 typedef VGHandle VGImage;
+typedef VGHandle VGMaskLayer;
+typedef VGHandle VGFont;
 typedef VGHandle VGPaint;
 
 #define VG_INVALID_HANDLE ((VGHandle)0)
@@ -96,6 +99,10 @@ typedef enum {
   /* Scissoring rectangles */
   VG_SCISSOR_RECTS                            = 0x1106,
 
+  /* Color Transformation */
+  VG_COLOR_TRANSFORM                          = 0x1170,
+  VG_COLOR_TRANSFORM_VALUES                   = 0x1171,
+
   /* Stroke parameters */
   VG_STROKE_LINE_WIDTH                        = 0x1110,
   VG_STROKE_CAP_STYLE                         = 0x1111,
@@ -111,6 +118,9 @@ typedef enum {
   /* Color for vgClear */
   VG_CLEAR_COLOR                              = 0x1121,
 
+  /* Glyph origin */
+  VG_GLYPH_ORIGIN                             = 0x1122,
+
   /* Enable/disable alpha masking and scissoring */
   VG_MASKING                                  = 0x1130,
   VG_SCISSORING                               = 0x1131,
@@ -165,6 +175,7 @@ typedef enum {
   VG_MATRIX_IMAGE_USER_TO_SURFACE             = 0x1401,
   VG_MATRIX_FILL_PAINT_TO_USER                = 0x1402,
   VG_MATRIX_STROKE_PAINT_TO_USER              = 0x1403,
+  VG_MATRIX_GLYPH_USER_TO_SURFACE             = 0x1404,
 
   VG_MATRIX_MODE_FORCE_SIZE                   = VG_MAX_ENUM
 } VGMatrixMode;
@@ -365,6 +376,8 @@ typedef enum {
   VG_lL_8                                     = 10,
   VG_A_8                                      = 11,
   VG_BW_1                                     = 12,
+  VG_A_1                                      = 13,
+  VG_A_4                                      = 14,
 
   /* {A,X}RGB channel ordering */
   VG_sXRGB_8888                               =  0 | (1 << 6),
@@ -448,6 +461,12 @@ typedef enum {
   VG_BLEND_MODE_FORCE_SIZE                    = VG_MAX_ENUM
 } VGBlendMode;
 
+typedef enum {
+  VG_FONT_NUM_GLYPHS                          = 0x2F00,
+
+  VG_FONT_PARAM_TYPE_FORCE_SIZE               = VG_MAX_ENUM
+} VGFontParamType;
+
 typedef enum {
   VG_IMAGE_FORMAT_QUERY                       = 0x2100,
   VG_PATH_DATATYPE_QUERY                      = 0x2101,
@@ -541,8 +560,22 @@ VG_API_CALL void VG_API_ENTRY vgShear(VGfloat shx, VGfloat shy) VG_API_EXIT;
 VG_API_CALL void VG_API_ENTRY vgRotate(VGfloat angle) VG_API_EXIT;
 
 /* Masking and Clearing */
-VG_API_CALL void VG_API_ENTRY vgMask(VGImage mask, VGMaskOperation operation,
-                        VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgMask(VGHandle mask, VGMaskOperation operation,
+                                     VGint x, VGint y,
+                                     VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgRenderToMask(VGPath path,
+                                            VGbitfield paintModes,
+                                            VGMaskOperation operation) VG_API_EXIT;
+VG_API_CALL VGMaskLayer VG_API_ENTRY vgCreateMaskLayer(VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDestroyMaskLayer(VGMaskLayer maskLayer) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgFillMaskLayer(VGMaskLayer maskLayer,
+                                             VGint x, VGint y,
+                                             VGint width, VGint height,
+                                             VGfloat value) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgCopyMask(VGMaskLayer maskLayer,
+                                        VGint dx, VGint dy,
+                                        VGint sx, VGint sy,
+                                        VGint width, VGint height) VG_API_EXIT;
 VG_API_CALL void VG_API_ENTRY vgClear(VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
 
 /* Paths */
@@ -636,6 +669,33 @@ VG_API_CALL void VG_API_ENTRY vgCopyPixels(VGint dx, VGint dy,
                               VGint sx, VGint sy,
                               VGint width, VGint height) VG_API_EXIT;
 
+/* Text */
+VG_API_CALL VGFont VG_API_ENTRY vgCreateFont(VGint glyphCapacityHint) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDestroyFont(VGFont font) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetGlyphToPath(VGFont font,
+                                              VGuint glyphIndex,
+                                              VGPath path,
+                                              VGboolean isHinted,
+                                              const VGfloat glyphOrigin [2],
+                                              const VGfloat escapement[2]) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetGlyphToImage(VGFont font,
+                                               VGuint glyphIndex,
+                                               VGImage image,
+                                               const VGfloat glyphOrigin [2],
+                                               const VGfloat escapement[2]) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgClearGlyph(VGFont font,VGuint glyphIndex) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDrawGlyph(VGFont font, 
+                                         VGuint glyphIndex,
+                                         VGbitfield paintModes,
+                                         VGboolean allowAutoHinting) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDrawGlyphs(VGFont font,
+                                          VGint glyphCount,
+                                          const VGuint *glyphIndices,
+                                          const VGfloat *adjustments_x,
+                                          const VGfloat *adjustments_y,
+                                          VGbitfield paintModes,
+                                          VGboolean allowAutoHinting) VG_API_EXIT;
+
 /* Image Filters */
 VG_API_CALL void VG_API_ENTRY vgColorMatrix(VGImage dst, VGImage src,
                                const VGfloat * matrix) VG_API_EXIT;
index 97e3e779e19c44772d9e31d4adf66c3825889372..9ff32344820d1707c91094d101534a254058880b 100644 (file)
-/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */\r
-\r
-/*------------------------------------------------------------------------\r
- * \r
- * VG extensions Reference Implementation\r
- * -------------------------------------\r
- *\r
- * Copyright (c) 2008 The Khronos Group Inc.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and /or associated documentation files\r
- * (the "Materials "), to deal in the Materials without restriction,\r
- * including without limitation the rights to use, copy, modify, merge,\r
- * publish, distribute, sublicense, and/or sell copies of the Materials,\r
- * and to permit persons to whom the Materials are furnished to do so,\r
- * subject to the following conditions: \r
- *\r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Materials. \r
- *\r
- * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\r
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\r
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR\r
- * THE USE OR OTHER DEALINGS IN THE MATERIALS.\r
- *\r
- *//**\r
- * \file\r
- * \brief      VG extensions\r
- *//*-------------------------------------------------------------------*/\r
-\r
-\r
-\r
-#ifndef _VGEXT_H\r
-#define _VGEXT_H\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#include <VG/openvg.h>\r
-#include <VG/vgu.h>\r
-\r
-#ifndef VG_API_ENTRYP\r
-#   define VG_API_ENTRYP VG_API_ENTRY*\r
-#endif\r
-\r
-#ifndef VGU_API_ENTRYP\r
-#   define VGU_API_ENTRYP VGU_API_ENTRY*\r
-#endif\r
-\r
-/*-------------------------------------------------------------------------------\r
- * KHR extensions\r
- *------------------------------------------------------------------------------*/\r
-\r
-typedef enum  {\r
-\r
-#ifndef VG_KHR_iterative_average_blur\r
-  VG_MAX_AVERAGE_BLUR_DIMENSION_KHR        = 0x116B,\r
-  VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C,\r
-  VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR       = 0x116D,\r
-#endif\r
-\r
-  VG_PARAM_TYPE_KHR_FORCE_SIZE             = VG_MAX_ENUM\r
-} VGParamTypeKHR;\r
-\r
-#ifndef VG_KHR_EGL_image\r
-#define VG_KHR_EGL_image 1\r
-/* VGEGLImageKHR is an opaque handle to an EGLImage */\r
-typedef void* VGeglImageKHR; \r
-\r
-#ifdef VG_VGEXT_PROTOTYPES\r
-VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image);\r
-#endif\r
-typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image);\r
-\r
-#endif\r
-\r
-\r
-#ifndef VG_KHR_iterative_average_blur\r
-#define VG_KHR_iterative_average_blur 1\r
-\r
-#ifdef VG_VGEXT_PROTOTYPES\r
-VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);\r
-#endif \r
-typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);\r
-\r
-#endif\r
-\r
-\r
-#ifndef VG_KHR_advanced_blending\r
-#define VG_KHR_advanced_blending 1\r
-\r
-typedef enum {\r
-  VG_BLEND_OVERLAY_KHR        = 0x2010,\r
-  VG_BLEND_HARDLIGHT_KHR      = 0x2011,\r
-  VG_BLEND_SOFTLIGHT_SVG_KHR  = 0x2012,\r
-  VG_BLEND_SOFTLIGHT_KHR      = 0x2013,\r
-  VG_BLEND_COLORDODGE_KHR     = 0x2014,\r
-  VG_BLEND_COLORBURN_KHR      = 0x2015,\r
-  VG_BLEND_DIFFERENCE_KHR     = 0x2016,\r
-  VG_BLEND_SUBTRACT_KHR       = 0x2017,\r
-  VG_BLEND_INVERT_KHR         = 0x2018,\r
-  VG_BLEND_EXCLUSION_KHR      = 0x2019,\r
-  VG_BLEND_LINEARDODGE_KHR    = 0x201a,\r
-  VG_BLEND_LINEARBURN_KHR     = 0x201b,\r
-  VG_BLEND_VIVIDLIGHT_KHR     = 0x201c,\r
-  VG_BLEND_LINEARLIGHT_KHR    = 0x201d,\r
-  VG_BLEND_PINLIGHT_KHR       = 0x201e,\r
-  VG_BLEND_HARDMIX_KHR        = 0x201f,\r
-  VG_BLEND_CLEAR_KHR          = 0x2020,\r
-  VG_BLEND_DST_KHR            = 0x2021,\r
-  VG_BLEND_SRC_OUT_KHR        = 0x2022,\r
-  VG_BLEND_DST_OUT_KHR        = 0x2023,\r
-  VG_BLEND_SRC_ATOP_KHR       = 0x2024,\r
-  VG_BLEND_DST_ATOP_KHR       = 0x2025,\r
-  VG_BLEND_XOR_KHR            = 0x2026,\r
-\r
-  VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM\r
-} VGBlendModeKHR;\r
-#endif\r
-\r
-#ifndef VG_KHR_parametric_filter\r
-#define VG_KHR_parametric_filter 1 \r
-\r
-typedef enum {\r
-  VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0),\r
-  VG_PF_KNOCKOUT_FLAG_KHR       = (1 << 1),\r
-  VG_PF_OUTER_FLAG_KHR          = (1 << 2),\r
-  VG_PF_INNER_FLAG_KHR          = (1 << 3),\r
-\r
-  VG_PF_TYPE_KHR_FORCE_SIZE     = VG_MAX_ENUM\r
-} VGPfTypeKHR;\r
-\r
-typedef enum {\r
-  VGU_IMAGE_IN_USE_ERROR           = 0xF010,\r
-\r
-  VGU_ERROR_CODE_KHR_FORCE_SIZE    = VG_MAX_ENUM\r
-} VGUErrorCodeKHR;\r
-\r
-#ifdef VG_VGEXT_PROTOTYPES\r
-VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ;\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);\r
-#endif\r
-typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);\r
-typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);\r
-typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA);\r
-typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);\r
-typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);\r
-typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);\r
-\r
-#endif\r
-\r
-\r
-/*-------------------------------------------------------------------------------\r
- * NDS extensions\r
- *------------------------------------------------------------------------------*/\r
-\r
-#ifndef VG_NDS_paint_generation\r
-#define VG_NDS_paint_generation 1\r
-\r
-typedef enum { \r
-  VG_PAINT_COLOR_RAMP_LINEAR_NDS            = 0x1A10,\r
-  VG_COLOR_MATRIX_NDS                       = 0x1A11,\r
-  VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS       = 0x1A12,\r
-\r
-  VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE        = VG_MAX_ENUM\r
-} VGPaintParamTypeNds;\r
-\r
-typedef enum {\r
-  VG_DRAW_IMAGE_COLOR_MATRIX_NDS            = 0x1F10,\r
-\r
-  VG_IMAGE_MODE_NDS_FORCE_SIZE              = VG_MAX_ENUM\r
-} VGImageModeNds;\r
-#endif \r
-\r
-\r
-#ifndef VG_NDS_projective_geometry\r
-#define VG_NDS_projective_geometry 1\r
-\r
-typedef enum {\r
-  VG_CLIP_MODE_NDS                          = 0x1180,\r
-  VG_CLIP_LINES_NDS                         = 0x1181,\r
-  VG_MAX_CLIP_LINES_NDS                     = 0x1182,\r
-\r
-  VG_PARAM_TYPE_NDS_FORCE_SIZE        = VG_MAX_ENUM\r
-} VGParamTypeNds;\r
-\r
-typedef enum {\r
-  VG_CLIPMODE_NONE_NDS                      = 0x3000,\r
-  VG_CLIPMODE_CLIP_CLOSED_NDS               = 0x3001,\r
-  VG_CLIPMODE_CLIP_OPEN_NDS                 = 0x3002,\r
-  VG_CLIPMODE_CULL_NDS                      = 0x3003,\r
-\r
-  VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM\r
-} VGClipModeNds;\r
-\r
-typedef enum {\r
-  VG_RQUAD_TO_NDS              = ( 13 << 1 ),\r
-  VG_RCUBIC_TO_NDS             = ( 14 << 1 ),\r
-  \r
-  VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM\r
-} VGPathSegmentNds;\r
-\r
-typedef enum {\r
-  VG_RQUAD_TO_ABS_NDS            = (VG_RQUAD_TO_NDS  | VG_ABSOLUTE),\r
-  VG_RQUAD_TO_REL_NDS            = (VG_RQUAD_TO_NDS  | VG_RELATIVE),\r
-  VG_RCUBIC_TO_ABS_NDS           = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE),\r
-  VG_RCUBIC_TO_REL_NDS           = (VG_RCUBIC_TO_NDS | VG_RELATIVE),\r
-\r
-  VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM\r
-} VGPathCommandNds;\r
-\r
-#ifdef VG_VGEXT_PROTOTYPES\r
-VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ;\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);\r
-#endif \r
-typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ;\r
-typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);\r
-\r
-#endif\r
-\r
-#ifdef __cplusplus \r
-} /* extern "C" */\r
-#endif\r
-\r
-#endif /* _VGEXT_H */\r
+/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
+
+/*------------------------------------------------------------------------
+ * 
+ * VG extensions Reference Implementation
+ * -------------------------------------
+ *
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are 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 Materials. 
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief      VG extensions
+ *//*-------------------------------------------------------------------*/
+
+
+
+#ifndef _VGEXT_H
+#define _VGEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <VG/openvg.h>
+#include <VG/vgu.h>
+
+#ifndef VG_API_ENTRYP
+#   define VG_API_ENTRYP VG_API_ENTRY*
+#endif
+
+#ifndef VGU_API_ENTRYP
+#   define VGU_API_ENTRYP VGU_API_ENTRY*
+#endif
+
+/*-------------------------------------------------------------------------------
+ * KHR extensions
+ *------------------------------------------------------------------------------*/
+
+typedef enum  {
+
+#ifndef VG_KHR_iterative_average_blur
+  VG_MAX_AVERAGE_BLUR_DIMENSION_KHR        = 0x116B,
+  VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C,
+  VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR       = 0x116D,
+#endif
+
+  VG_PARAM_TYPE_KHR_FORCE_SIZE             = VG_MAX_ENUM
+} VGParamTypeKHR;
+
+#ifndef VG_KHR_EGL_image
+#define VG_KHR_EGL_image 1
+/* VGEGLImageKHR is an opaque handle to an EGLImage */
+typedef void* VGeglImageKHR; 
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image);
+#endif
+typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image);
+
+#endif
+
+
+#ifndef VG_KHR_iterative_average_blur
+#define VG_KHR_iterative_average_blur 1
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
+#endif 
+typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
+
+#endif
+
+
+#ifndef VG_KHR_advanced_blending
+#define VG_KHR_advanced_blending 1
+
+typedef enum {
+  VG_BLEND_OVERLAY_KHR        = 0x2010,
+  VG_BLEND_HARDLIGHT_KHR      = 0x2011,
+  VG_BLEND_SOFTLIGHT_SVG_KHR  = 0x2012,
+  VG_BLEND_SOFTLIGHT_KHR      = 0x2013,
+  VG_BLEND_COLORDODGE_KHR     = 0x2014,
+  VG_BLEND_COLORBURN_KHR      = 0x2015,
+  VG_BLEND_DIFFERENCE_KHR     = 0x2016,
+  VG_BLEND_SUBTRACT_KHR       = 0x2017,
+  VG_BLEND_INVERT_KHR         = 0x2018,
+  VG_BLEND_EXCLUSION_KHR      = 0x2019,
+  VG_BLEND_LINEARDODGE_KHR    = 0x201a,
+  VG_BLEND_LINEARBURN_KHR     = 0x201b,
+  VG_BLEND_VIVIDLIGHT_KHR     = 0x201c,
+  VG_BLEND_LINEARLIGHT_KHR    = 0x201d,
+  VG_BLEND_PINLIGHT_KHR       = 0x201e,
+  VG_BLEND_HARDMIX_KHR        = 0x201f,
+  VG_BLEND_CLEAR_KHR          = 0x2020,
+  VG_BLEND_DST_KHR            = 0x2021,
+  VG_BLEND_SRC_OUT_KHR        = 0x2022,
+  VG_BLEND_DST_OUT_KHR        = 0x2023,
+  VG_BLEND_SRC_ATOP_KHR       = 0x2024,
+  VG_BLEND_DST_ATOP_KHR       = 0x2025,
+  VG_BLEND_XOR_KHR            = 0x2026,
+
+  VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM
+} VGBlendModeKHR;
+#endif
+
+#ifndef VG_KHR_parametric_filter
+#define VG_KHR_parametric_filter 1 
+
+typedef enum {
+  VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0),
+  VG_PF_KNOCKOUT_FLAG_KHR       = (1 << 1),
+  VG_PF_OUTER_FLAG_KHR          = (1 << 2),
+  VG_PF_INNER_FLAG_KHR          = (1 << 3),
+
+  VG_PF_TYPE_KHR_FORCE_SIZE     = VG_MAX_ENUM
+} VGPfTypeKHR;
+
+typedef enum {
+  VGU_IMAGE_IN_USE_ERROR           = 0xF010,
+
+  VGU_ERROR_CODE_KHR_FORCE_SIZE    = VG_MAX_ENUM
+} VGUErrorCodeKHR;
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ;
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
+#endif
+typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
+
+#endif
+
+
+/*-------------------------------------------------------------------------------
+ * NDS extensions
+ *------------------------------------------------------------------------------*/
+
+#ifndef VG_NDS_paint_generation
+#define VG_NDS_paint_generation 1
+
+typedef enum { 
+  VG_PAINT_COLOR_RAMP_LINEAR_NDS            = 0x1A10,
+  VG_COLOR_MATRIX_NDS                       = 0x1A11,
+  VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS       = 0x1A12,
+
+  VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE        = VG_MAX_ENUM
+} VGPaintParamTypeNds;
+
+typedef enum {
+  VG_DRAW_IMAGE_COLOR_MATRIX_NDS            = 0x1F10,
+
+  VG_IMAGE_MODE_NDS_FORCE_SIZE              = VG_MAX_ENUM
+} VGImageModeNds;
+#endif 
+
+
+#ifndef VG_NDS_projective_geometry
+#define VG_NDS_projective_geometry 1
+
+typedef enum {
+  VG_CLIP_MODE_NDS                          = 0x1180,
+  VG_CLIP_LINES_NDS                         = 0x1181,
+  VG_MAX_CLIP_LINES_NDS                     = 0x1182,
+
+  VG_PARAM_TYPE_NDS_FORCE_SIZE        = VG_MAX_ENUM
+} VGParamTypeNds;
+
+typedef enum {
+  VG_CLIPMODE_NONE_NDS                      = 0x3000,
+  VG_CLIPMODE_CLIP_CLOSED_NDS               = 0x3001,
+  VG_CLIPMODE_CLIP_OPEN_NDS                 = 0x3002,
+  VG_CLIPMODE_CULL_NDS                      = 0x3003,
+
+  VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGClipModeNds;
+
+typedef enum {
+  VG_RQUAD_TO_NDS              = ( 13 << 1 ),
+  VG_RCUBIC_TO_NDS             = ( 14 << 1 ),
+  
+  VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGPathSegmentNds;
+
+typedef enum {
+  VG_RQUAD_TO_ABS_NDS            = (VG_RQUAD_TO_NDS  | VG_ABSOLUTE),
+  VG_RQUAD_TO_REL_NDS            = (VG_RQUAD_TO_NDS  | VG_RELATIVE),
+  VG_RCUBIC_TO_ABS_NDS           = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE),
+  VG_RCUBIC_TO_REL_NDS           = (VG_RCUBIC_TO_NDS | VG_RELATIVE),
+
+  VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGPathCommandNds;
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ;
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
+#endif 
+typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ;
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
+
+#endif
+
+#ifdef __cplusplus 
+} /* extern "C" */
+#endif
+
+#endif /* _VGEXT_H */
index 71dee68b9d4c1cf4ab0885e85786daa5068cf12d..aa1829f6c707710c022c166a9a8df4190145e4a3 100644 (file)
@@ -1,92 +1,92 @@
-/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */\r
-\r
-/*------------------------------------------------------------------------\r
- *\r
- * VG platform specific header Reference Implementation\r
- * ----------------------------------------------------\r
- *\r
- * Copyright (c) 2008 The Khronos Group Inc.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and /or associated documentation files\r
- * (the "Materials "), to deal in the Materials without restriction,\r
- * including without limitation the rights to use, copy, modify, merge,\r
- * publish, distribute, sublicense, and/or sell copies of the Materials,\r
- * and to permit persons to whom the Materials are furnished to do so,\r
- * subject to the following conditions: \r
- *\r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Materials. \r
- *\r
- * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\r
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\r
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR\r
- * THE USE OR OTHER DEALINGS IN THE MATERIALS.\r
- *\r
- *//**\r
- * \file\r
- * \brief VG platform specific header\r
- *//*-------------------------------------------------------------------*/\r
-\r
-#ifndef _VGPLATFORM_H\r
-#define _VGPLATFORM_H\r
-\r
-#include <KHR/khrplatform.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#ifndef VG_API_CALL \r
-#if defined(OPENVG_STATIC_LIBRARY)\r
-#      define VG_API_CALL\r
-#else\r
-#      define VG_API_CALL KHRONOS_APICALL\r
-#endif /* defined OPENVG_STATIC_LIBRARY */\r
-#endif /* ifndef VG_API_CALL */\r
-\r
-#ifndef VGU_API_CALL \r
-#if defined(OPENVG_STATIC_LIBRARY)\r
-#      define VGU_API_CALL\r
-#else\r
-#      define VGU_API_CALL KHRONOS_APICALL\r
-#endif /* defined OPENVG_STATIC_LIBRARY */\r
-#endif /* ifndef VGU_API_CALL */\r
-\r
-\r
-#ifndef VG_API_ENTRY\r
-#define VG_API_ENTRY\r
-#endif\r
-\r
-#ifndef VG_API_EXIT\r
-#define VG_API_EXIT\r
-#endif\r
-\r
-#ifndef VGU_API_ENTRY\r
-#define VGU_API_ENTRY\r
-#endif\r
-\r
-#ifndef VGU_API_EXIT\r
-#define VGU_API_EXIT\r
-#endif\r
-\r
-typedef float          VGfloat;\r
-typedef signed char    VGbyte;\r
-typedef unsigned char  VGubyte;\r
-typedef signed short   VGshort;\r
-typedef signed int     VGint;\r
-typedef unsigned int   VGuint;\r
-typedef unsigned int   VGbitfield;\r
-\r
-#ifndef VG_VGEXT_PROTOTYPES\r
-#define VG_VGEXT_PROTOTYPES\r
-#endif \r
-\r
-#ifdef __cplusplus \r
-} /* extern "C" */\r
-#endif\r
-\r
-#endif /* _VGPLATFORM_H */\r
+/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
+
+/*------------------------------------------------------------------------
+ *
+ * VG platform specific header Reference Implementation
+ * ----------------------------------------------------
+ *
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are 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 Materials. 
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief VG platform specific header
+ *//*-------------------------------------------------------------------*/
+
+#ifndef _VGPLATFORM_H
+#define _VGPLATFORM_H
+
+#include <KHR/khrplatform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef VG_API_CALL 
+#if defined(OPENVG_STATIC_LIBRARY)
+#      define VG_API_CALL
+#else
+#      define VG_API_CALL KHRONOS_APICALL
+#endif /* defined OPENVG_STATIC_LIBRARY */
+#endif /* ifndef VG_API_CALL */
+
+#ifndef VGU_API_CALL 
+#if defined(OPENVG_STATIC_LIBRARY)
+#      define VGU_API_CALL
+#else
+#      define VGU_API_CALL KHRONOS_APICALL
+#endif /* defined OPENVG_STATIC_LIBRARY */
+#endif /* ifndef VGU_API_CALL */
+
+
+#ifndef VG_API_ENTRY
+#define VG_API_ENTRY
+#endif
+
+#ifndef VG_API_EXIT
+#define VG_API_EXIT
+#endif
+
+#ifndef VGU_API_ENTRY
+#define VGU_API_ENTRY
+#endif
+
+#ifndef VGU_API_EXIT
+#define VGU_API_EXIT
+#endif
+
+typedef float          VGfloat;
+typedef signed char    VGbyte;
+typedef unsigned char  VGubyte;
+typedef signed short   VGshort;
+typedef signed int     VGint;
+typedef unsigned int   VGuint;
+typedef unsigned int   VGbitfield;
+
+#ifndef VG_VGEXT_PROTOTYPES
+#define VG_VGEXT_PROTOTYPES
+#endif 
+
+#ifdef __cplusplus 
+} /* extern "C" */
+#endif
+
+#endif /* _VGPLATFORM_H */
index 2799684e5e7eb2c38e7fd2f0874ecb033595e704..da81da938d5c8c731f2c0006ceefa9e339e3f358 100644 (file)
-/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */\r
-\r
-/*------------------------------------------------------------------------\r
- * \r
- * VGU 1.0.1 Reference Implementation\r
- * -------------------------------------\r
- *\r
- * Copyright (c) 2008 The Khronos Group Inc.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and /or associated documentation files\r
- * (the "Materials "), to deal in the Materials without restriction,\r
- * including without limitation the rights to use, copy, modify, merge,\r
- * publish, distribute, sublicense, and/or sell copies of the Materials,\r
- * and to permit persons to whom the Materials are furnished to do so,\r
- * subject to the following conditions: \r
- *\r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Materials. \r
- *\r
- * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\r
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\r
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR\r
- * THE USE OR OTHER DEALINGS IN THE MATERIALS.\r
- *\r
- *//**\r
- * \file\r
- * \brief      VGU 1.0.1 API.\r
- *//*-------------------------------------------------------------------*/\r
-\r
-#ifndef _VGU_H\r
-#define _VGU_H\r
-\r
-#ifdef __cplusplus \r
-extern "C" { \r
-#endif\r
-\r
-#include <VG/openvg.h>\r
-\r
-#define VGU_VERSION_1_0 1\r
-\r
-#ifndef VGU_API_CALL\r
-#      error VGU_API_CALL must be defined\r
-#endif\r
-\r
-#ifndef VGU_API_ENTRY\r
-#   error VGU_API_ENTRY must be defined \r
-#endif\r
-\r
-#ifndef VGU_API_EXIT\r
-#   error VGU_API_EXIT must be defined \r
-#endif\r
-\r
-\r
-typedef enum {\r
-  VGU_NO_ERROR                                 = 0,\r
-  VGU_BAD_HANDLE_ERROR                         = 0xF000,\r
-  VGU_ILLEGAL_ARGUMENT_ERROR                   = 0xF001,\r
-  VGU_OUT_OF_MEMORY_ERROR                      = 0xF002,\r
-  VGU_PATH_CAPABILITY_ERROR                    = 0xF003,\r
-  VGU_BAD_WARP_ERROR                           = 0xF004,\r
-\r
-  VGU_ERROR_CODE_FORCE_SIZE                    = VG_MAX_ENUM\r
-} VGUErrorCode;\r
-\r
-typedef enum {\r
-  VGU_ARC_OPEN                                 = 0xF100,\r
-  VGU_ARC_CHORD                                = 0xF101,\r
-  VGU_ARC_PIE                                  = 0xF102,\r
-\r
-  VGU_ARC_TYPE_FORCE_SIZE                      = VG_MAX_ENUM\r
-} VGUArcType;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path,\r
-                                  VGfloat x0, VGfloat y0,\r
-                                  VGfloat x1, VGfloat y1) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path,\r
-                                     const VGfloat * points, VGint count,\r
-                                     VGboolean closed) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path,\r
-                                  VGfloat x, VGfloat y,\r
-                                  VGfloat width, VGfloat height) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path,\r
-                                       VGfloat x, VGfloat y,\r
-                                       VGfloat width, VGfloat height,\r
-                                       VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path,\r
-                                     VGfloat cx, VGfloat cy,\r
-                                     VGfloat width, VGfloat height) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path,\r
-                                 VGfloat x, VGfloat y,\r
-                                 VGfloat width, VGfloat height,\r
-                                 VGfloat startAngle, VGfloat angleExtent,\r
-                                 VGUArcType arcType) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,\r
-                                                     VGfloat sx1, VGfloat sy1,\r
-                                                     VGfloat sx2, VGfloat sy2,\r
-                                                     VGfloat sx3, VGfloat sy3,\r
-                                                     VGfloat * matrix) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,\r
-                                                     VGfloat dx1, VGfloat dy1,\r
-                                                     VGfloat dx2, VGfloat dy2,\r
-                                                     VGfloat dx3, VGfloat dy3,\r
-                                                     VGfloat * matrix) VGU_API_EXIT;\r
-\r
-VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,\r
-                                                   VGfloat dx1, VGfloat dy1,\r
-                                                   VGfloat dx2, VGfloat dy2,\r
-                                                   VGfloat dx3, VGfloat dy3,\r
-                                                   VGfloat sx0, VGfloat sy0,\r
-                                                   VGfloat sx1, VGfloat sy1,\r
-                                                   VGfloat sx2, VGfloat sy2,\r
-                                                   VGfloat sx3, VGfloat sy3,\r
-                                                   VGfloat * matrix) VGU_API_EXIT;\r
-\r
-#ifdef __cplusplus \r
-} /* extern "C" */\r
-#endif\r
-\r
-#endif /* #ifndef _VGU_H */\r
+/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
+
+/*------------------------------------------------------------------------
+ * 
+ * VGU 1.1 Reference Implementation
+ * -------------------------------------
+ *
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are 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 Materials. 
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief      VGU 1.1 API.
+ *//*-------------------------------------------------------------------*/
+
+#ifndef _VGU_H
+#define _VGU_H
+
+#ifdef __cplusplus 
+extern "C" { 
+#endif
+
+#include <VG/openvg.h>
+
+#define VGU_VERSION_1_0 1
+#define VGU_VERSION_1_1 2
+
+#ifndef VGU_API_CALL
+#      error VGU_API_CALL must be defined
+#endif
+
+#ifndef VGU_API_ENTRY
+#   error VGU_API_ENTRY must be defined 
+#endif
+
+#ifndef VGU_API_EXIT
+#   error VGU_API_EXIT must be defined 
+#endif
+
+
+typedef enum {
+  VGU_NO_ERROR                                 = 0,
+  VGU_BAD_HANDLE_ERROR                         = 0xF000,
+  VGU_ILLEGAL_ARGUMENT_ERROR                   = 0xF001,
+  VGU_OUT_OF_MEMORY_ERROR                      = 0xF002,
+  VGU_PATH_CAPABILITY_ERROR                    = 0xF003,
+  VGU_BAD_WARP_ERROR                           = 0xF004,
+
+  VGU_ERROR_CODE_FORCE_SIZE                    = VG_MAX_ENUM
+} VGUErrorCode;
+
+typedef enum {
+  VGU_ARC_OPEN                                 = 0xF100,
+  VGU_ARC_CHORD                                = 0xF101,
+  VGU_ARC_PIE                                  = 0xF102,
+
+  VGU_ARC_TYPE_FORCE_SIZE                      = VG_MAX_ENUM
+} VGUArcType;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path,
+                                  VGfloat x0, VGfloat y0,
+                                  VGfloat x1, VGfloat y1) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path,
+                                     const VGfloat * points, VGint count,
+                                     VGboolean closed) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path,
+                                  VGfloat x, VGfloat y,
+                                  VGfloat width, VGfloat height) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path,
+                                       VGfloat x, VGfloat y,
+                                       VGfloat width, VGfloat height,
+                                       VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path,
+                                     VGfloat cx, VGfloat cy,
+                                     VGfloat width, VGfloat height) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path,
+                                 VGfloat x, VGfloat y,
+                                 VGfloat width, VGfloat height,
+                                 VGfloat startAngle, VGfloat angleExtent,
+                                 VGUArcType arcType) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,
+                                                     VGfloat sx1, VGfloat sy1,
+                                                     VGfloat sx2, VGfloat sy2,
+                                                     VGfloat sx3, VGfloat sy3,
+                                                     VGfloat * matrix) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,
+                                                     VGfloat dx1, VGfloat dy1,
+                                                     VGfloat dx2, VGfloat dy2,
+                                                     VGfloat dx3, VGfloat dy3,
+                                                     VGfloat * matrix) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,
+                                                   VGfloat dx1, VGfloat dy1,
+                                                   VGfloat dx2, VGfloat dy2,
+                                                   VGfloat dx3, VGfloat dy3,
+                                                   VGfloat sx0, VGfloat sy0,
+                                                   VGfloat sx1, VGfloat sy1,
+                                                   VGfloat sx2, VGfloat sy2,
+                                                   VGfloat sx3, VGfloat sy3,
+                                                   VGfloat * matrix) VGU_API_EXIT;
+
+#ifdef __cplusplus 
+} /* extern "C" */
+#endif
+
+#endif /* #ifndef _VGU_H */
index c42d9bff2d7fcd36f90be02985f7f5987c7a6ca2..201812c5ac3f1199c79c50ff34c203724f28278a 100644 (file)
@@ -1,16 +1,20 @@
 Import('*')
 
-SConscript('mapi/vgapi/SConscript')
-
 if env['platform'] == 'windows':
-    SConscript('egl/main/SConscript')
+    SConscript('getopt/SConscript')
     SConscript('talloc/SConscript')
+else:
+    talloc = 'talloc'
+    Export('talloc')
 
 SConscript('glsl/SConscript')
 SConscript('mapi/glapi/SConscript')
 SConscript('mesa/SConscript')
 
+SConscript('mapi/vgapi/SConscript')
+
 if env['platform'] != 'embedded':
+    SConscript('egl/main/SConscript')
     SConscript('glut/glx/SConscript')
 
 SConscript('gallium/SConscript')
index 5b09e178c63b6f8a5fa09a5d617fbb0f7d96c56e..50f227f07dac1ea9865580231c8c051ae0150014 100644 (file)
@@ -3,7 +3,7 @@
 TOP = ../..
 include $(TOP)/configs/current
 
-SUBDIRS = main drivers
+SUBDIRS = drivers main
 
 
 default: subdirs
index 47709e3c59f5a93b21c4605ce2d3d5ea64f5bb44..76dbe260c6b77c8917c3549f67593679107720e0 100644 (file)
@@ -2,6 +2,7 @@
 #
 # Drivers should define
 #
+# EGL_BUILTIN, the driver is built-in or external
 # EGL_DRIVER, the driver name
 # EGL_SOURCES, the driver sources
 # EGL_INCLUDES, the include pathes
 #
 
 
-EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/egl/$(EGL_DRIVER)
+EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/egl/$(EGL_DRIVER).so
 EGL_OBJECTS = $(EGL_SOURCES:.c=.o)
 
+# built-in or external
+ifeq ($(EGL_BUILTIN),true)
+EGL_TARGET = lib$(EGL_DRIVER).a
+EGL_INSTALL =
+else
+EGL_TARGET = $(EGL_DRIVER_PATH)
+EGL_INSTALL = install-so
+endif
 
-default: depend $(EGL_DRIVER_PATH)
+default: depend $(EGL_TARGET)
 
-$(EGL_DRIVER_PATH): $(EGL_DRIVER)
+$(EGL_DRIVER_PATH): $(EGL_DRIVER).so
        @$(INSTALL) -d $(TOP)/$(LIB_DIR)/egl
        $(INSTALL) $< $(TOP)/$(LIB_DIR)/egl
 
-$(EGL_DRIVER): $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
-       @$(MKLIB) -o $(EGL_DRIVER) -noprefix \
+$(EGL_DRIVER).so: $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
+       @$(MKLIB) -o $(EGL_DRIVER).so -noprefix \
                -linker '$(CC)' -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
                $(MKLIB_OPTIONS) \
                $(EGL_OBJECTS) $(EGL_LIBS) -l$(EGL_LIB)
 
+lib$(EGL_DRIVER).a: $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
+       @$(MKLIB) -o $(EGL_DRIVER) -static $(EGL_OBJECTS)
+
 .c.o:
        $(CC) -c $(EGL_INCLUDES) $(CFLAGS) $(EGL_CFLAGS) $< -o $@
 
-
-install: $(EGL_DRIVER_PATH)
+install-so: $(EGL_DRIVER_PATH)
        $(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
        $(MINSTALL) $(EGL_DRIVER_PATH) $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
 
+install: $(EGL_INSTALL)
+
 clean:
-       rm -f $(EGL_DRIVER)
+       rm -f $(EGL_DRIVER).so
+       rm -f lib$(EGL_DRIVER).a
        rm -f $(EGL_OBJECTS)
        rm -f depend depend.bak
 
index 8a3c9b6a0aa9c7409c8b65d2a117a35f622c86be..553ee8771f8457a932e989a2438b3a670b3a896f 100644 (file)
@@ -3,7 +3,7 @@
 TOP = ../../../..
 include $(TOP)/configs/current
 
-EGL_DRIVER = egl_dri2.so
+EGL_DRIVER = egl_dri2
 EGL_SOURCES = egl_dri2.c
 
 EGL_INCLUDES = \
@@ -15,6 +15,9 @@ EGL_INCLUDES = \
        $(LIBUDEV_CFLAGS) \
        $(LIBDRM_CFLAGS)
 
-EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(LIBDRM_LIBS)
+EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
+
+EGL_CFLAGS = -D_EGL_MAIN=_eglBuiltInDriverDRI2
+EGL_BUILTIN = true
 
 include ../Makefile.template
index a83f32b0d1b7d9533b39c8959f7c1d1b07871f40..6fc1e49e773e08b8ed117d0b19c1401b32ea9a8f 100644 (file)
@@ -47,7 +47,6 @@
 #include <libudev.h>
 #endif
 
-#include <glapi/glapi.h>
 #include "eglconfig.h"
 #include "eglcontext.h"
 #include "egldisplay.h"
@@ -63,6 +62,7 @@ struct dri2_egl_driver
 {
    _EGLDriver base;
 
+   _EGLProc (*get_proc_address)(const char *procname);
    void (*glFlush)(void);
 };
 
@@ -260,8 +260,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
          base.BindToTextureRGBA = bind_to_texture_rgba;
    }
 
-   base.RenderableType = disp->ClientAPIsMask;
-   base.Conformant = disp->ClientAPIsMask;
+   base.RenderableType = disp->ClientAPIs;
+   base.Conformant = disp->ClientAPIs;
 
    if (!_eglValidateConfig(&base, EGL_FALSE)) {
       _eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
@@ -752,13 +752,13 @@ dri2_create_screen(_EGLDisplay *disp)
    else
       api_mask = 1 << __DRI_API_OPENGL;
 
-   disp->ClientAPIsMask = 0;
+   disp->ClientAPIs = 0;
    if (api_mask & (1 <<__DRI_API_OPENGL))
-      disp->ClientAPIsMask |= EGL_OPENGL_BIT;
+      disp->ClientAPIs |= EGL_OPENGL_BIT;
    if (api_mask & (1 <<__DRI_API_GLES))
-      disp->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
+      disp->ClientAPIs |= EGL_OPENGL_ES_BIT;
    if (api_mask & (1 << __DRI_API_GLES2))
-      disp->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
+      disp->ClientAPIs |= EGL_OPENGL_ES2_BIT;
 
    if (dri2_dpy->dri2->base.version >= 2) {
       disp->Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
@@ -775,8 +775,7 @@ dri2_create_screen(_EGLDisplay *disp)
 }
 
 static EGLBoolean
-dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp,
-                   EGLint *major, EGLint *minor)
+dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
 {
    struct dri2_egl_display *dri2_dpy;
 
@@ -855,8 +854,8 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp,
    disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
 
    /* we're supporting EGL 1.4 */
-   *major = 1;
-   *minor = 4;
+   disp->VersionMajor = 1;
+   disp->VersionMinor = 4;
 
    return EGL_TRUE;
 
@@ -1415,8 +1414,7 @@ dri2_get_driver_for_fd(int fd)
 }
 
 static EGLBoolean
-dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
-                   EGLint *major, EGLint *minor)
+dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
 {
    struct dri2_egl_display *dri2_dpy;
    int i;
@@ -1451,8 +1449,8 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
    disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
 
    /* we're supporting EGL 1.4 */
-   *major = 1;
-   *minor = 4;
+   disp->VersionMajor = 1;
+   disp->VersionMinor = 4;
 
    return EGL_TRUE;
 
@@ -1470,16 +1468,23 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
  * Called via eglInitialize(), GLX_drv->API.Initialize().
  */
 static EGLBoolean
-dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
-               EGLint *major, EGLint *minor)
+dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
 {
+   /* not until swrast_dri is supported */
+   if (disp->Options.UseFallback)
+      return EGL_FALSE;
+
    switch (disp->Platform) {
    case _EGL_PLATFORM_X11:
-      return dri2_initialize_x11(drv, disp, major, minor);
+      if (disp->Options.TestOnly)
+         return EGL_TRUE;
+      return dri2_initialize_x11(drv, disp);
 
 #ifdef HAVE_LIBUDEV
    case _EGL_PLATFORM_DRM:
-      return dri2_initialize_drm(drv, disp, major, minor);
+      if (disp->Options.TestOnly)
+         return EGL_TRUE;
+      return dri2_initialize_drm(drv, disp);
 #endif
 
    default:
@@ -1648,7 +1653,11 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
       dri2_destroy_surface(drv, disp, old_dsurf);
       dri2_destroy_surface(drv, disp, old_rsurf);
       if (old_ctx) {
-        dri2_dpy->core->unbindContext(dri2_egl_context(old_ctx)->dri_context);
+         /* unbind the old context only when there is no new context bound */
+         if (!ctx) {
+            __DRIcontext *old_cctx = dri2_egl_context(old_ctx)->dri_context;
+            dri2_dpy->core->unbindContext(old_cctx);
+         }
          /* no destroy? */
          _eglPutContext(old_ctx);
       }
@@ -1863,11 +1872,9 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
 static _EGLProc
 dri2_get_proc_address(_EGLDriver *drv, const char *procname)
 {
-   (void) drv;
-
-   /* FIXME: Do we need to support lookup of EGL symbols too? */
+   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
 
-   return (_EGLProc) _glapi_get_proc_address(procname);
+   return dri2_drv->get_proc_address(procname);
 }
 
 static EGLBoolean
@@ -1899,13 +1906,6 @@ dri2_wait_native(_EGLDriver *drv, _EGLDisplay *disp, EGLint engine)
    return EGL_TRUE;
 }
 
-static void
-dri2_unload(_EGLDriver *drv)
-{
-   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
-   free(dri2_drv);
-}
-
 static EGLBoolean
 dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
                  EGLNativePixmapType target)
@@ -1979,10 +1979,31 @@ static EGLBoolean
 dri2_release_tex_image(_EGLDriver *drv,
                       _EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
 {
-   (void) drv;
-   (void) disp;
-   (void) surf;
-   (void) buffer;
+#if __DRI_TEX_BUFFER_VERSION >= 3
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+   struct dri2_egl_context *dri2_ctx;
+   _EGLContext *ctx;
+   GLint  target;
+
+   ctx = _eglGetCurrentContext();
+   dri2_ctx = dri2_egl_context(ctx);
+
+   if (!_eglReleaseTexImage(drv, disp, surf, buffer))
+      return EGL_FALSE;
+
+   switch (dri2_surf->base.TextureTarget) {
+   case EGL_TEXTURE_2D:
+      target = GL_TEXTURE_2D;
+      break;
+   default:
+      assert(0);
+   }
+   if (dri2_dpy->tex_buffer->releaseTexBuffer!=NULL)
+    (*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context,
+                                             target,
+                                             dri2_surf->dri_drawable);
+#endif
 
    return EGL_TRUE;
 }
@@ -2312,12 +2333,51 @@ dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img,
    return EGL_TRUE;
 }
 
+static void
+dri2_unload(_EGLDriver *drv)
+{
+   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
+   free(dri2_drv);
+}
+
+static EGLBoolean
+dri2_load(_EGLDriver *drv)
+{
+   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
+   void *handle;
+
+   handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
+   if (handle) {
+      dri2_drv->get_proc_address = (_EGLProc (*)(const char *))
+         dlsym(handle, "_glapi_get_proc_address");
+      /* no need to keep a reference */
+      dlclose(handle);
+   }
+
+   /*
+    * If glapi is not available, loading DRI drivers will fail.  Ideally, we
+    * should load one of libGL, libGLESv1_CM, or libGLESv2 and go on.  But if
+    * the app has loaded another one of them with RTLD_LOCAL, there may be
+    * unexpected behaviors later because there will be two copies of glapi
+    * (with global variables of the same names!) in the memory.
+    */
+   if (!dri2_drv->get_proc_address) {
+      _eglLog(_EGL_WARNING, "DRI2: failed to find _glapi_get_proc_address");
+      return EGL_FALSE;
+   }
+
+   dri2_drv->glFlush = (void (*)(void))
+      dri2_drv->get_proc_address("glFlush");
+
+   return EGL_TRUE;
+}
+
 /**
  * This is the main entrypoint into the driver, called by libEGL.
  * Create a new _EGLDriver object and init its dispatch table.
  */
 _EGLDriver *
-_eglMain(const char *args)
+_EGL_MAIN(const char *args)
 {
    struct dri2_egl_driver *dri2_drv;
 
@@ -2328,6 +2388,10 @@ _eglMain(const char *args)
       return NULL;
 
    memset(dri2_drv, 0, sizeof *dri2_drv);
+
+   if (!dri2_load(&dri2_drv->base))
+      return NULL;
+
    _eglInitDriverFallbacks(&dri2_drv->base);
    dri2_drv->base.API.Initialize = dri2_initialize;
    dri2_drv->base.API.Terminate = dri2_terminate;
@@ -2353,8 +2417,5 @@ _eglMain(const char *args)
    dri2_drv->base.Name = "DRI2";
    dri2_drv->base.Unload = dri2_unload;
 
-   dri2_drv->glFlush =
-      (void (*)(void)) dri2_get_proc_address(&dri2_drv->base, "glFlush");
-
    return &dri2_drv->base;
 }
index d976b91a74ebb45610942ac2de2943a4e67e2ff5..a1e6b731fe9b819d073f01535488f572b5532577 100644 (file)
@@ -3,7 +3,7 @@
 TOP = ../../../..
 include $(TOP)/configs/current
 
-EGL_DRIVER = egl_glx.so
+EGL_DRIVER = egl_glx
 EGL_SOURCES = egl_glx.c
 
 EGL_INCLUDES = \
@@ -11,6 +11,9 @@ EGL_INCLUDES = \
        -I$(TOP)/src/egl/main
 
 EGL_CFLAGS = $(X11_CFLAGS)
-EGL_LIBS = $(X11_LIBS) -lGL
+EGL_LIBS = $(X11_LIBS) $(DLOPEN_LIBS)
+
+EGL_CFLAGS += -D_EGL_MAIN=_eglBuiltInDriverGLX
+EGL_BUILTIN = true
 
 include ../Makefile.template
index 8ec7c48c50e4b82ca197fb459553c6ac22006e02..c3c11c7b6eb1531ba59056e0b102fd0605254009 100644 (file)
@@ -36,8 +36,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <X11/Xlib.h>
-#include <GL/glx.h>
-#include <EGL/egl.h>
+#include <dlfcn.h>
+#include "GL/glx.h"
 
 #include "eglconfig.h"
 #include "eglcontext.h"
 #error "GL/glx.h must be equal to or greater than GLX 1.4"
 #endif
 
+/* GLX 1.0 */
+typedef GLXContext (*GLXCREATECONTEXTPROC)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
+typedef void (*GLXDESTROYCONTEXTPROC)( Display *dpy, GLXContext ctx );
+typedef Bool (*GLXMAKECURRENTPROC)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
+typedef void (*GLXSWAPBUFFERSPROC)( Display *dpy, GLXDrawable drawable );
+typedef GLXPixmap (*GLXCREATEGLXPIXMAPPROC)( Display *dpy, XVisualInfo *visual, Pixmap pixmap );
+typedef void (*GLXDESTROYGLXPIXMAPPROC)( Display *dpy, GLXPixmap pixmap );
+typedef Bool (*GLXQUERYVERSIONPROC)( Display *dpy, int *maj, int *min );
+typedef int (*GLXGETCONFIGPROC)( Display *dpy, XVisualInfo *visual, int attrib, int *value );
+typedef void (*GLXWAITGLPROC)( void );
+typedef void (*GLXWAITXPROC)( void );
+
+/* GLX 1.1 */
+typedef const char *(*GLXQUERYEXTENSIONSSTRINGPROC)( Display *dpy, int screen );
+typedef const char *(*GLXQUERYSERVERSTRINGPROC)( Display *dpy, int screen, int name );
+typedef const char *(*GLXGETCLIENTSTRINGPROC)( Display *dpy, int name );
+
 /** subclass of _EGLDriver */
 struct GLX_egl_driver
 {
    _EGLDriver Base;   /**< base class */
+
+   void *handle;
+
+   /* GLX 1.0 */
+   GLXCREATECONTEXTPROC glXCreateContext;
+   GLXDESTROYCONTEXTPROC glXDestroyContext;
+   GLXMAKECURRENTPROC glXMakeCurrent;
+   GLXSWAPBUFFERSPROC glXSwapBuffers;
+   GLXCREATEGLXPIXMAPPROC glXCreateGLXPixmap;
+   GLXDESTROYGLXPIXMAPPROC glXDestroyGLXPixmap;
+   GLXQUERYVERSIONPROC glXQueryVersion;
+   GLXGETCONFIGPROC glXGetConfig;
+   GLXWAITGLPROC glXWaitGL;
+   GLXWAITXPROC glXWaitX;
+
+   /* GLX 1.1 */
+   GLXQUERYEXTENSIONSSTRINGPROC glXQueryExtensionsString;
+   GLXQUERYSERVERSTRINGPROC glXQueryServerString;
+   GLXGETCLIENTSTRINGPROC glXGetClientString;
+
+   /* GLX 1.3 or (GLX_SGI_make_current_read and GLX_SGIX_fbconfig) */
+   PFNGLXGETFBCONFIGSPROC glXGetFBConfigs;
+   PFNGLXGETFBCONFIGATTRIBPROC glXGetFBConfigAttrib;
+   PFNGLXGETVISUALFROMFBCONFIGPROC glXGetVisualFromFBConfig;
+   PFNGLXCREATEWINDOWPROC glXCreateWindow;
+   PFNGLXDESTROYWINDOWPROC glXDestroyWindow;
+   PFNGLXCREATEPIXMAPPROC glXCreatePixmap;
+   PFNGLXDESTROYPIXMAPPROC glXDestroyPixmap;
+   PFNGLXCREATEPBUFFERPROC glXCreatePbuffer;
+   PFNGLXDESTROYPBUFFERPROC glXDestroyPbuffer;
+   PFNGLXCREATENEWCONTEXTPROC glXCreateNewContext;
+   PFNGLXMAKECONTEXTCURRENTPROC glXMakeContextCurrent;
+
+   /* GLX 1.4 or GLX_ARB_get_proc_address */
+   PFNGLXGETPROCADDRESSPROC glXGetProcAddress;
+
+   /* GLX_SGIX_pbuffer */
+   PFNGLXCREATEGLXPBUFFERSGIXPROC glXCreateGLXPbufferSGIX;
+   PFNGLXDESTROYGLXPBUFFERSGIXPROC glXDestroyGLXPbufferSGIX;
 };
 
 
@@ -76,14 +132,9 @@ struct GLX_egl_display
    EGLBoolean have_fbconfig;
    EGLBoolean have_pbuffer;
 
-   /* GLX_SGIX_pbuffer */
-   PFNGLXCREATEGLXPBUFFERSGIXPROC glXCreateGLXPbufferSGIX;
-   PFNGLXDESTROYGLXPBUFFERSGIXPROC glXDestroyGLXPbufferSGIX;
-
    /* workaround quirks of different GLX implementations */
    EGLBoolean single_buffered_quirk;
    EGLBoolean glx_window_quirk;
-
 };
 
 
@@ -168,19 +219,21 @@ static const struct {
 
 
 static EGLBoolean
-convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
+convert_fbconfig(struct GLX_egl_driver *GLX_drv,
+                 struct GLX_egl_display *GLX_dpy, GLXFBConfig fbconfig,
                  struct GLX_egl_config *GLX_conf)
 {
+   Display *dpy = GLX_dpy->dpy;
    int err, attr, val;
    unsigned i;
 
    /* must have rgba bit */
-   err = glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &val);
+   err = GLX_drv->glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &val);
    if (err || !(val & GLX_RGBA_BIT))
       return EGL_FALSE;
 
    /* must know whether it is double-buffered */
-   err = glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &val);
+   err = GLX_drv->glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &val);
    if (err)
       return EGL_FALSE;
    GLX_conf->double_buffered = val;
@@ -196,7 +249,7 @@ convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
       if (!egl_attr)
          continue;
 
-      err = glXGetFBConfigAttrib(dpy, fbconfig, attr, &val);
+      err = GLX_drv->glXGetFBConfigAttrib(dpy, fbconfig, attr, &val);
       if (err) {
          if (err == GLX_BAD_ATTRIBUTE) {
             err = 0;
@@ -303,21 +356,23 @@ static const struct {
 };
 
 static EGLBoolean
-convert_visual(Display *dpy, XVisualInfo *vinfo,
+convert_visual(struct GLX_egl_driver *GLX_drv,
+               struct GLX_egl_display *GLX_dpy, XVisualInfo *vinfo,
                struct GLX_egl_config *GLX_conf)
 {
+   Display *dpy = GLX_dpy->dpy;
    int err, attr, val;
    unsigned i;
 
    /* the visual must support OpenGL and RGBA buffer */
-   err = glXGetConfig(dpy, vinfo, GLX_USE_GL, &val);
+   err = GLX_drv->glXGetConfig(dpy, vinfo, GLX_USE_GL, &val);
    if (!err && val)
-      err = glXGetConfig(dpy, vinfo, GLX_RGBA, &val);
+      err = GLX_drv->glXGetConfig(dpy, vinfo, GLX_RGBA, &val);
    if (err || !val)
       return EGL_FALSE;
 
    /* must know whether it is double-buffered */
-   err = glXGetConfig(dpy, vinfo, GLX_DOUBLEBUFFER, &val);
+   err = GLX_drv->glXGetConfig(dpy, vinfo, GLX_DOUBLEBUFFER, &val);
    if (err)
       return EGL_FALSE;
    GLX_conf->double_buffered = val;
@@ -341,7 +396,7 @@ convert_visual(Display *dpy, XVisualInfo *vinfo,
       if (!egl_attr)
          continue;
 
-      err = glXGetConfig(dpy, vinfo, attr, &val);
+      err = GLX_drv->glXGetConfig(dpy, vinfo, attr, &val);
       if (err) {
          if (err == GLX_BAD_ATTRIBUTE) {
             err = 0;
@@ -406,14 +461,16 @@ fix_config(struct GLX_egl_display *GLX_dpy, struct GLX_egl_config *GLX_conf)
 
 
 static EGLBoolean
-create_configs(_EGLDisplay *dpy, struct GLX_egl_display *GLX_dpy,
-               EGLint screen)
+create_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint screen)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
+   struct GLX_egl_display *GLX_dpy = GLX_egl_display(dpy);
    EGLint num_configs = 0, i;
    EGLint id = 1;
 
    if (GLX_dpy->have_fbconfig) {
-      GLX_dpy->fbconfigs = glXGetFBConfigs(GLX_dpy->dpy, screen, &num_configs);
+      GLX_dpy->fbconfigs =
+         GLX_drv->glXGetFBConfigs(GLX_dpy->dpy, screen, &num_configs);
    }
    else {
       XVisualInfo vinfo_template;
@@ -434,10 +491,14 @@ create_configs(_EGLDisplay *dpy, struct GLX_egl_display *GLX_dpy,
 
       memset(&template, 0, sizeof(template));
       _eglInitConfig(&template.Base, dpy, id);
-      if (GLX_dpy->have_fbconfig)
-         ok = convert_fbconfig(GLX_dpy->dpy, GLX_dpy->fbconfigs[i], &template);
-      else
-         ok = convert_visual(GLX_dpy->dpy, &GLX_dpy->visuals[i], &template);
+      if (GLX_dpy->have_fbconfig) {
+         ok = convert_fbconfig(GLX_drv, GLX_dpy,
+               GLX_dpy->fbconfigs[i], &template);
+      }
+      else {
+         ok = convert_visual(GLX_drv, GLX_dpy,
+               &GLX_dpy->visuals[i], &template);
+      }
       if (!ok)
         continue;
 
@@ -462,13 +523,12 @@ create_configs(_EGLDisplay *dpy, struct GLX_egl_display *GLX_dpy,
 
 
 static void
-check_extensions(struct GLX_egl_display *GLX_dpy, EGLint screen)
+check_extensions(struct GLX_egl_driver *GLX_drv,
+                 struct GLX_egl_display *GLX_dpy, EGLint screen)
 {
    GLX_dpy->extensions =
-      glXQueryExtensionsString(GLX_dpy->dpy, screen);
+      GLX_drv->glXQueryExtensionsString(GLX_dpy->dpy, screen);
    if (GLX_dpy->extensions) {
-      /* glXGetProcAddress is assumed */
-
       if (strstr(GLX_dpy->extensions, "GLX_SGI_make_current_read")) {
          /* GLX 1.3 entry points are used */
          GLX_dpy->have_make_current_read = EGL_TRUE;
@@ -480,13 +540,8 @@ check_extensions(struct GLX_egl_display *GLX_dpy, EGLint screen)
       }
 
       if (strstr(GLX_dpy->extensions, "GLX_SGIX_pbuffer")) {
-         GLX_dpy->glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)
-            glXGetProcAddress((const GLubyte *) "glXCreateGLXPbufferSGIX");
-         GLX_dpy->glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)
-            glXGetProcAddress((const GLubyte *) "glXDestroyGLXPbufferSGIX");
-
-         if (GLX_dpy->glXCreateGLXPbufferSGIX &&
-             GLX_dpy->glXDestroyGLXPbufferSGIX &&
+         if (GLX_drv->glXCreateGLXPbufferSGIX &&
+             GLX_drv->glXDestroyGLXPbufferSGIX &&
              GLX_dpy->have_fbconfig)
             GLX_dpy->have_pbuffer = EGL_TRUE;
       }
@@ -502,16 +557,17 @@ check_extensions(struct GLX_egl_display *GLX_dpy, EGLint screen)
 
 
 static void
-check_quirks(struct GLX_egl_display *GLX_dpy, EGLint screen)
+check_quirks(struct GLX_egl_driver *GLX_drv,
+             struct GLX_egl_display *GLX_dpy, EGLint screen)
 {
    const char *vendor;
 
    GLX_dpy->single_buffered_quirk = EGL_TRUE;
    GLX_dpy->glx_window_quirk = EGL_TRUE;
 
-   vendor = glXGetClientString(GLX_dpy->dpy, GLX_VENDOR);
+   vendor = GLX_drv->glXGetClientString(GLX_dpy->dpy, GLX_VENDOR);
    if (vendor && strstr(vendor, "NVIDIA")) {
-      vendor = glXQueryServerString(GLX_dpy->dpy, screen, GLX_VENDOR);
+      vendor = GLX_drv->glXQueryServerString(GLX_dpy->dpy, screen, GLX_VENDOR);
       if (vendor && strstr(vendor, "NVIDIA")) {
          _eglLog(_EGL_DEBUG, "disable quirks");
          GLX_dpy->single_buffered_quirk = EGL_FALSE;
@@ -525,16 +581,21 @@ check_quirks(struct GLX_egl_display *GLX_dpy, EGLint screen)
  * Called via eglInitialize(), GLX_drv->API.Initialize().
  */
 static EGLBoolean
-GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
-                   EGLint *major, EGLint *minor)
+GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
    struct GLX_egl_display *GLX_dpy;
 
-   (void) drv;
-
    if (disp->Platform != _EGL_PLATFORM_X11)
       return EGL_FALSE;
 
+   /* this is a fallback driver */
+   if (!disp->Options.UseFallback)
+      return EGL_FALSE;
+
+   if (disp->Options.TestOnly)
+      return EGL_TRUE;
+
    GLX_dpy = CALLOC_STRUCT(GLX_egl_display);
    if (!GLX_dpy)
       return _eglError(EGL_BAD_ALLOC, "eglInitialize");
@@ -549,7 +610,8 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
       }
    }
 
-   if (!glXQueryVersion(GLX_dpy->dpy, &GLX_dpy->glx_maj, &GLX_dpy->glx_min)) {
+   if (!GLX_drv->glXQueryVersion(GLX_dpy->dpy,
+            &GLX_dpy->glx_maj, &GLX_dpy->glx_min)) {
       _eglLog(_EGL_WARNING, "GLX: glXQueryVersion failed");
       if (!disp->PlatformDisplay)
          XCloseDisplay(GLX_dpy->dpy);
@@ -557,10 +619,13 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
       return EGL_FALSE;
    }
 
-   check_extensions(GLX_dpy, DefaultScreen(GLX_dpy->dpy));
-   check_quirks(GLX_dpy, DefaultScreen(GLX_dpy->dpy));
+   disp->DriverData = (void *) GLX_dpy;
+   disp->ClientAPIs = EGL_OPENGL_BIT;
+
+   check_extensions(GLX_drv, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
+   check_quirks(GLX_drv, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
 
-   create_configs(disp, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
+   create_configs(drv, disp, DefaultScreen(GLX_dpy->dpy));
    if (!_eglGetArraySize(disp->Configs)) {
       _eglLog(_EGL_WARNING, "GLX: failed to create any config");
       if (!disp->PlatformDisplay)
@@ -569,16 +634,14 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
       return EGL_FALSE;
    }
 
-   disp->DriverData = (void *) GLX_dpy;
-   disp->ClientAPIsMask = EGL_OPENGL_BIT;
-
    /* we're supporting EGL 1.4 */
-   *major = 1;
-   *minor = 4;
+   disp->VersionMajor = 1;
+   disp->VersionMinor = 4;
 
    return EGL_TRUE;
 }
 
+
 /**
  * Called via eglTerminate(), drv->API.Terminate().
  */
@@ -612,12 +675,11 @@ static _EGLContext *
 GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
                       _EGLContext *share_list, const EGLint *attrib_list)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
    struct GLX_egl_context *GLX_ctx = CALLOC_STRUCT(GLX_egl_context);
    struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
    struct GLX_egl_context *GLX_ctx_shared = GLX_egl_context(share_list);
 
-   (void) drv;
-
    if (!GLX_ctx) {
       _eglError(EGL_BAD_ALLOC, "eglCreateContext");
       return NULL;
@@ -628,19 +690,19 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
       return NULL;
    }
 
-   if (GLX_dpy->have_fbconfig)
-      GLX_ctx->context =
-         glXCreateNewContext(GLX_dpy->dpy,
-                             GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
-                             GLX_RGBA_TYPE,
-                             GLX_ctx_shared ? GLX_ctx_shared->context : NULL,
-                             GL_TRUE);
-   else
-      GLX_ctx->context =
-         glXCreateContext(GLX_dpy->dpy,
-                          &GLX_dpy->visuals[GLX_egl_config_index(conf)],
-                          GLX_ctx_shared ? GLX_ctx_shared->context : NULL,
-                          GL_TRUE);
+   if (GLX_dpy->have_fbconfig) {
+      GLX_ctx->context = GLX_drv->glXCreateNewContext(GLX_dpy->dpy,
+            GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
+            GLX_RGBA_TYPE,
+            GLX_ctx_shared ? GLX_ctx_shared->context : NULL,
+            GL_TRUE);
+   }
+   else {
+      GLX_ctx->context = GLX_drv->glXCreateContext(GLX_dpy->dpy,
+            &GLX_dpy->visuals[GLX_egl_config_index(conf)],
+            GLX_ctx_shared ? GLX_ctx_shared->context : NULL,
+            GL_TRUE);
+   }
    if (!GLX_ctx->context) {
       free(GLX_ctx);
       return NULL;
@@ -673,6 +735,7 @@ static EGLBoolean
 GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
                    _EGLSurface *rsurf, _EGLContext *ctx)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
    struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
    struct GLX_egl_surface *GLX_dsurf = GLX_egl_surface(dsurf);
    struct GLX_egl_surface *GLX_rsurf = GLX_egl_surface(rsurf);
@@ -683,8 +746,6 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
    GLXContext cctx;
    EGLBoolean ret = EGL_FALSE;
 
-   (void) drv;
-
    /* make new bindings */
    if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf))
       return EGL_FALSE;
@@ -694,9 +755,9 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
    cctx = (GLX_ctx) ? GLX_ctx->context : NULL;
 
    if (GLX_dpy->have_make_current_read)
-      ret = glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
+      ret = GLX_drv->glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
    else if (ddraw == rdraw)
-      ret = glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
+      ret = GLX_drv->glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
 
    if (ret) {
       if (_eglPutSurface(old_dsurf))
@@ -747,12 +808,11 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp,
                            _EGLConfig *conf, EGLNativeWindowType window,
                            const EGLint *attrib_list)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
    struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
    struct GLX_egl_surface *GLX_surf;
    uint width, height;
 
-   (void) drv;
-
    GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
    if (!GLX_surf) {
       _eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface");
@@ -767,13 +827,14 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp,
 
    GLX_surf->drawable = window;
 
-   if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk)
-      GLX_surf->glx_drawable =
-         glXCreateWindow(GLX_dpy->dpy,
-                         GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
-                         GLX_surf->drawable, NULL);
-   else
+   if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk) {
+      GLX_surf->glx_drawable = GLX_drv->glXCreateWindow(GLX_dpy->dpy,
+            GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
+            GLX_surf->drawable, NULL);
+   }
+   else {
       GLX_surf->glx_drawable = GLX_surf->drawable;
+   }
 
    if (!GLX_surf->glx_drawable) {
       free(GLX_surf);
@@ -781,7 +842,7 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp,
    }
 
    if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk)
-      GLX_surf->destroy = glXDestroyWindow;
+      GLX_surf->destroy = GLX_drv->glXDestroyWindow;
 
    get_drawable_size(GLX_dpy->dpy, window, &width, &height);
    GLX_surf->Base.Width = width;
@@ -795,12 +856,11 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp,
                            _EGLConfig *conf, EGLNativePixmapType pixmap,
                            const EGLint *attrib_list)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
    struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
    struct GLX_egl_surface *GLX_surf;
    uint width, height;
 
-   (void) drv;
-
    GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
    if (!GLX_surf) {
       _eglError(EGL_BAD_ALLOC, "eglCreatePixmapSurface");
@@ -816,25 +876,25 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp,
    GLX_surf->drawable = pixmap;
 
    if (GLX_dpy->have_1_3) {
-      GLX_surf->glx_drawable =
-         glXCreatePixmap(GLX_dpy->dpy,
-                         GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
-                         GLX_surf->drawable, NULL);
+      GLX_surf->glx_drawable = GLX_drv->glXCreatePixmap(GLX_dpy->dpy,
+            GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
+            GLX_surf->drawable, NULL);
    }
    else if (GLX_dpy->have_fbconfig) {
       GLXFBConfig fbconfig = GLX_dpy->fbconfigs[GLX_egl_config_index(conf)];
-      XVisualInfo *vinfo = glXGetVisualFromFBConfig(GLX_dpy->dpy, fbconfig);
+      XVisualInfo *vinfo;
+
+      vinfo = GLX_drv->glXGetVisualFromFBConfig(GLX_dpy->dpy, fbconfig);
       if (vinfo) {
-         GLX_surf->glx_drawable =
-            glXCreateGLXPixmap(GLX_dpy->dpy, vinfo, GLX_surf->drawable);
+         GLX_surf->glx_drawable = GLX_drv->glXCreateGLXPixmap(GLX_dpy->dpy,
+               vinfo, GLX_surf->drawable);
          XFree(vinfo);
       }
    }
    else {
-      GLX_surf->glx_drawable =
-         glXCreateGLXPixmap(GLX_dpy->dpy,
-                            &GLX_dpy->visuals[GLX_egl_config_index(conf)],
-                            GLX_surf->drawable);
+      GLX_surf->glx_drawable = GLX_drv->glXCreateGLXPixmap(GLX_dpy->dpy,
+            &GLX_dpy->visuals[GLX_egl_config_index(conf)],
+            GLX_surf->drawable);
    }
 
    if (!GLX_surf->glx_drawable) {
@@ -843,7 +903,7 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp,
    }
 
    GLX_surf->destroy = (GLX_dpy->have_1_3) ?
-      glXDestroyPixmap : glXDestroyGLXPixmap;
+      GLX_drv->glXDestroyPixmap : GLX_drv->glXDestroyGLXPixmap;
 
    get_drawable_size(GLX_dpy->dpy, pixmap, &width, &height);
    GLX_surf->Base.Width = width;
@@ -856,13 +916,12 @@ static _EGLSurface *
 GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
                             _EGLConfig *conf, const EGLint *attrib_list)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
    struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
    struct GLX_egl_surface *GLX_surf;
    int attribs[5];
    int i;
 
-   (void) drv;
-
    GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
    if (!GLX_surf) {
       _eglError(EGL_BAD_ALLOC, "eglCreatePbufferSurface");
@@ -892,14 +951,11 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
       }
       attribs[i] = None;
 
-      GLX_surf->glx_drawable =
-         glXCreatePbuffer(GLX_dpy->dpy,
-                          GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
-                          attribs);
+      GLX_surf->glx_drawable = GLX_drv->glXCreatePbuffer(GLX_dpy->dpy,
+            GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], attribs);
    }
    else if (GLX_dpy->have_pbuffer) {
-      GLX_surf->glx_drawable = GLX_dpy->glXCreateGLXPbufferSGIX(
-            GLX_dpy->dpy,
+      GLX_surf->glx_drawable = GLX_drv->glXCreateGLXPbufferSGIX(GLX_dpy->dpy,
             GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
             GLX_surf->Base.Width,
             GLX_surf->Base.Height,
@@ -912,7 +968,7 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
    }
 
    GLX_surf->destroy = (GLX_dpy->have_1_3) ?
-      glXDestroyPbuffer : GLX_dpy->glXDestroyGLXPbufferSGIX;
+      GLX_drv->glXDestroyPbuffer : GLX_drv->glXDestroyGLXPbufferSGIX;
 
    return &GLX_surf->Base;
 }
@@ -933,12 +989,11 @@ GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
 static EGLBoolean
 GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
 {
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
    struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
    struct GLX_egl_surface *GLX_surf = GLX_egl_surface(draw);
 
-   (void) drv;
-
-   glXSwapBuffers(GLX_dpy->dpy, GLX_surf->glx_drawable);
+   GLX_drv->glXSwapBuffers(GLX_dpy->dpy, GLX_surf->glx_drawable);
 
    return EGL_TRUE;
 }
@@ -949,31 +1004,33 @@ GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
 static _EGLProc
 GLX_eglGetProcAddress(_EGLDriver *drv, const char *procname)
 {
-   (void) drv;
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
 
-   return (_EGLProc) glXGetProcAddress((const GLubyte *) procname);
+   return (_EGLProc) GLX_drv->glXGetProcAddress((const GLubyte *) procname);
 }
 
 static EGLBoolean
 GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
 {
-   (void) drv;
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
+
    (void) dpy;
    (void) ctx;
 
-   glXWaitGL();
+   GLX_drv->glXWaitGL();
    return EGL_TRUE;
 }
 
 static EGLBoolean
 GLX_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
 {
-   (void) drv;
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
+
    (void) dpy;
 
    if (engine != EGL_CORE_NATIVE_ENGINE)
       return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
-   glXWaitX();
+   GLX_drv->glXWaitX();
    return EGL_TRUE;
 }
 
@@ -981,16 +1038,90 @@ static void
 GLX_Unload(_EGLDriver *drv)
 {
    struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
+
+   if (GLX_drv->handle)
+      dlclose(GLX_drv->handle);
    free(GLX_drv);
 }
 
 
+static EGLBoolean
+GLX_Load(_EGLDriver *drv)
+{
+   struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
+   void *handle;
+
+   handle = dlopen("libGL.so", RTLD_LAZY | RTLD_LOCAL);
+   if (!handle)
+      goto fail;
+
+   GLX_drv->glXGetProcAddress = dlsym(handle, "glXGetProcAddress");
+   if (!GLX_drv->glXGetProcAddress)
+      GLX_drv->glXGetProcAddress = dlsym(handle, "glXGetProcAddressARB");
+   if (!GLX_drv->glXGetProcAddress)
+      goto fail;
+
+#define GET_PROC(proc_type, proc_name, check)                        \
+   do {                                                              \
+      GLX_drv->proc_name = (proc_type)                               \
+         GLX_drv->glXGetProcAddress((const GLubyte *) #proc_name);   \
+      if (check && !GLX_drv->proc_name) goto fail;                   \
+   } while (0)
+
+   /* GLX 1.0 */
+   GET_PROC(GLXCREATECONTEXTPROC, glXCreateContext, EGL_TRUE);
+   GET_PROC(GLXDESTROYCONTEXTPROC, glXDestroyContext, EGL_TRUE);
+   GET_PROC(GLXMAKECURRENTPROC, glXMakeCurrent, EGL_TRUE);
+   GET_PROC(GLXSWAPBUFFERSPROC, glXSwapBuffers, EGL_TRUE);
+   GET_PROC(GLXCREATEGLXPIXMAPPROC, glXCreateGLXPixmap, EGL_TRUE);
+   GET_PROC(GLXDESTROYGLXPIXMAPPROC, glXDestroyGLXPixmap, EGL_TRUE);
+   GET_PROC(GLXQUERYVERSIONPROC, glXQueryVersion, EGL_TRUE);
+   GET_PROC(GLXGETCONFIGPROC, glXGetConfig, EGL_TRUE);
+   GET_PROC(GLXWAITGLPROC, glXWaitGL, EGL_TRUE);
+   GET_PROC(GLXWAITXPROC, glXWaitX, EGL_TRUE);
+
+   /* GLX 1.1 */
+   GET_PROC(GLXQUERYEXTENSIONSSTRINGPROC, glXQueryExtensionsString, EGL_TRUE);
+   GET_PROC(GLXQUERYSERVERSTRINGPROC, glXQueryServerString, EGL_TRUE);
+   GET_PROC(GLXGETCLIENTSTRINGPROC, glXGetClientString, EGL_TRUE);
+
+   /* GLX 1.3 */
+   GET_PROC(PFNGLXGETFBCONFIGSPROC, glXGetFBConfigs, EGL_FALSE);
+   GET_PROC(PFNGLXGETFBCONFIGATTRIBPROC, glXGetFBConfigAttrib, EGL_FALSE);
+   GET_PROC(PFNGLXGETVISUALFROMFBCONFIGPROC, glXGetVisualFromFBConfig, EGL_FALSE);
+   GET_PROC(PFNGLXCREATEWINDOWPROC, glXCreateWindow, EGL_FALSE);
+   GET_PROC(PFNGLXDESTROYWINDOWPROC, glXDestroyWindow, EGL_FALSE);
+   GET_PROC(PFNGLXCREATEPIXMAPPROC, glXCreatePixmap, EGL_FALSE);
+   GET_PROC(PFNGLXDESTROYPIXMAPPROC, glXDestroyPixmap, EGL_FALSE);
+   GET_PROC(PFNGLXCREATEPBUFFERPROC, glXCreatePbuffer, EGL_FALSE);
+   GET_PROC(PFNGLXDESTROYPBUFFERPROC, glXDestroyPbuffer, EGL_FALSE);
+   GET_PROC(PFNGLXCREATENEWCONTEXTPROC, glXCreateNewContext, EGL_FALSE);
+   GET_PROC(PFNGLXMAKECONTEXTCURRENTPROC, glXMakeContextCurrent, EGL_FALSE);
+
+   /* GLX_SGIX_pbuffer */
+   GET_PROC(PFNGLXCREATEGLXPBUFFERSGIXPROC,
+         glXCreateGLXPbufferSGIX, EGL_FALSE);
+   GET_PROC(PFNGLXDESTROYGLXPBUFFERSGIXPROC,
+         glXDestroyGLXPbufferSGIX, EGL_FALSE);
+#undef GET_PROC
+
+   GLX_drv->handle = handle;
+
+   return EGL_TRUE;
+
+fail:
+   if (handle)
+      dlclose(handle);
+   return EGL_FALSE;
+}
+
+
 /**
  * This is the main entrypoint into the driver, called by libEGL.
  * Create a new _EGLDriver object and init its dispatch table.
  */
 _EGLDriver *
-_eglMain(const char *args)
+_EGL_MAIN(const char *args)
 {
    struct GLX_egl_driver *GLX_drv = CALLOC_STRUCT(GLX_egl_driver);
 
@@ -999,6 +1130,12 @@ _eglMain(const char *args)
    if (!GLX_drv)
       return NULL;
 
+   if (!GLX_Load(&GLX_drv->Base)) {
+      _eglLog(_EGL_WARNING, "GLX: failed to load GLX");
+      free(GLX_drv);
+      return NULL;
+   }
+
    _eglInitDriverFallbacks(&GLX_drv->Base);
    GLX_drv->Base.API.Initialize = GLX_eglInitialize;
    GLX_drv->Base.API.Terminate = GLX_eglTerminate;
index b4ca20c094a502cf73a64ddcbba3117c70292534..c710631688cbcadd549beb220315ec73b8d73bf7 100644 (file)
@@ -52,6 +52,19 @@ OBJECTS = $(SOURCES:.c=.o)
 
 # use dl*() to load drivers
 LOCAL_CFLAGS = -D_EGL_OS_UNIX=1
+LOCAL_LIBS =
+
+# egl_dri2 and egl_glx are built-ins
+ifeq ($(filter dri2, $(EGL_DRIVERS_DIRS)),dri2)
+LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2
+LOCAL_LIBS += $(TOP)/src/egl/drivers/dri2/libegl_dri2.a
+EGL_LIB_DEPS += $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
+endif
+ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx)
+LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
+LOCAL_LIBS += $(TOP)/src/egl/drivers/glx/libegl_glx.a
+EGL_LIB_DEPS += $(X11_LIBS) $(DLOPEN_LIBS)
+endif
 
 # translate --with-egl-platforms to _EGLPlatformType
 EGL_NATIVE_PLATFORM=_EGL_INVALID_PLATFORM
@@ -80,11 +93,12 @@ default: depend library
 # EGL Library
 library: $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME)
 
-$(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS)
+$(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS) $(LOCAL_LIBS)
        $(MKLIB) -o $(EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
                -major $(EGL_MAJOR) -minor $(EGL_MINOR) \
                -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
-               $(EGL_LIB_DEPS) $(OBJECTS)
+               -L$(TOP)/$(LIB_DIR) $(EGL_LIB_DEPS) \
+               $(OBJECTS) $(LOCAL_LIBS)
 
 install-headers:
        $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
index f001b81600fdcdcde9db8dabf1b58f0642a06a64..8c57ceaf20fb946456fa36d00b9c7404a587399b 100644 (file)
@@ -7,13 +7,23 @@ Import('*')
 env = env.Clone()
 
 env.Append(CPPDEFINES = [
-    '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
+    '_EGL_BUILT_IN_DRIVER_GALLIUM',
     '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
-    '_EGL_OS_WINDOWS',
-    '_EGL_GET_CORE_ADDRESSES',
-    'KHRONOS_DLL_EXPORTS',
 ])
 
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = [
+        '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
+        '_EGL_OS_WINDOWS',
+        '_EGL_GET_CORE_ADDRESSES',
+        'KHRONOS_DLL_EXPORTS',
+    ])
+else:
+    env.Append(CPPDEFINES = [
+        '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11',
+        '_EGL_OS_UNIX',
+    ])
+
 env.Append(CPPPATH = [
     '#/include',
 ])
@@ -38,15 +48,9 @@ egl_sources = [
     'eglsync.c',
 ]
 
-egl = env.SharedLibrary(
-    target = 'libEGL',
-    source = egl_sources + ['egl.def'],
+egl = env.ConvenienceLibrary(
+    target = 'egl',
+    source = egl_sources,
 )
 
-installed_egl = env.InstallSharedLibrary(egl, version=(1, 4, 0))
-
-env.Alias('egl', installed_egl)
-
-egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
-
 Export('egl')
index efa9e97346b127e093429aa2d8731ecee120100b..4e64ce6f7188108c9c4f44a75f8ba0702f7204ec 100644 (file)
@@ -57,7 +57,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "eglstring.h"
 #include "eglcontext.h"
 #include "egldisplay.h"
 #include "egltypedefs.h"
@@ -294,16 +293,14 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
       if (!_eglMatchDriver(disp, EGL_FALSE))
          RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
 
-      _eglsnprintf(disp->Version, sizeof(disp->Version), "%d.%d (%s)",
-            disp->APImajor, disp->APIminor, disp->Driver->Name);
       /* limit to APIs supported by core */
-      disp->ClientAPIsMask &= _EGL_API_ALL_BITS;
+      disp->ClientAPIs &= _EGL_API_ALL_BITS;
    }
 
    /* Update applications version of major and minor if not NULL */
    if ((major != NULL) && (minor != NULL)) {
-      *major = disp->APImajor;
-      *minor = disp->APIminor;
+      *major = disp->VersionMajor;
+      *minor = disp->VersionMinor;
    }
 
    RETURN_EGL_SUCCESS(disp, EGL_TRUE);
index 127becc9acdccebdeb2d22befb907483e5c1f9c0..01492082f66581ad14648d196771251fd59aa81d 100644 (file)
@@ -12,7 +12,7 @@ typedef void (*_EGLProc)(void);
  */
 
 /* driver funcs */
-typedef EGLBoolean (*Initialize_t)(_EGLDriver *, _EGLDisplay *dpy, EGLint *major, EGLint *minor);
+typedef EGLBoolean (*Initialize_t)(_EGLDriver *, _EGLDisplay *dpy);
 typedef EGLBoolean (*Terminate_t)(_EGLDriver *, _EGLDisplay *dpy);
 
 /* config funcs */
index d686fa162d5ecdbc3766bd176aea17f47efe4ca4..fe2f1a7f32fcd4988896d1dbf62b5f451f3d013d 100644 (file)
@@ -118,38 +118,39 @@ _eglFindArray(_EGLArray *array, void *elem)
 
 
 /**
- * Filter an array and return the filtered data.  The returned data pointer
- * should be freed.
+ * Filter an array and return the number of filtered elements.
  */
-void **
-_eglFilterArray(_EGLArray *array, EGLint *size,
+EGLint
+_eglFilterArray(_EGLArray *array, void **data, EGLint size,
                 _EGLArrayForEach filter, void *filter_data)
 {
-   void **data;
    EGLint count = 0, i;
 
-   if (!array) {
-      *size = 0;
-      return malloc(0);
-   }
-
-   data = malloc(array->Size * sizeof(array->Elements[0]));
-   if (!data)
-      return NULL;
+   if (!array)
+      return 0;
 
    if (filter) {
       for (i = 0; i < array->Size; i++) {
-         if (filter(array->Elements[i], filter_data))
-            data[count++] = array->Elements[i];
+         if (filter(array->Elements[i], filter_data)) {
+            if (data && count < size)
+               data[count] = array->Elements[i];
+            count++;
+         }
+         if (data && count >= size)
+            break;
       }
    }
    else {
-      memcpy(data, array->Elements, array->Size * sizeof(array->Elements[0]));
+      if (data) {
+         count = (size < array->Size) ? size : array->Size;
+         memcpy(data, array->Elements, count * sizeof(array->Elements[0]));
+      }
+      else {
+         count = array->Size;
+      }
    }
 
-   *size = count;
-
-   return data;
+   return count;
 }
 
 
index c8309fb066a760be3e0554ff01002382d4a31ae4..a88189a62524e921e0020ed4a36c8d66baf33aaa 100644 (file)
@@ -37,8 +37,8 @@ void *
 _eglFindArray(_EGLArray *array, void *elem);
 
 
-PUBLIC void **
-_eglFilterArray(_EGLArray *array, EGLint *size,
+PUBLIC EGLint
+_eglFilterArray(_EGLArray *array, void **data, EGLint size,
                 _EGLArrayForEach filter, void *filter_data);
 
 
index fec94fb20cd52f70086e39f27fa65d99961aa260..5b377b7f610d68be9a70654414a178079a47cb44 100644 (file)
@@ -697,11 +697,22 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
    if (!_eglParseConfigAttribList(&criteria, disp, attrib_list))
       return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
 
-   configList = (_EGLConfig **) _eglFilterArray(disp->Configs, &count,
+   /* get the number of matched configs */
+   count = _eglFilterArray(disp->Configs, NULL, 0,
          (_EGLArrayForEach) _eglMatchConfig, (void *) &criteria);
+   if (!count) {
+      *num_configs = count;
+      return EGL_TRUE;
+   }
+
+   configList = malloc(sizeof(*configList) * count);
    if (!configList)
       return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)");
 
+   /* get the matched configs */
+   _eglFilterArray(disp->Configs, (void **) configList, count,
+         (_EGLArrayForEach) _eglMatchConfig, (void *) &criteria);
+
    /* perform sorting of configs */
    if (configs && count) {
       _eglSortConfigs((const _EGLConfig **) configList, count,
index cbca9ff2c2f4c6a8e953aa148ec11de724b12d09..4221a9be3e1307d95027b040e12f154b686e4dff 100644 (file)
@@ -286,6 +286,9 @@ _eglError(EGLint errCode, const char *msg)
       case EGL_BAD_SURFACE:
          s = "EGL_BAD_SURFACE";
          break;
+      case EGL_NOT_INITIALIZED:
+         s = "EGL_NOT_INITIALIZED";
+         break;
 #ifdef EGL_MESA_screen_surface
       case EGL_BAD_SCREEN_MESA:
          s = "EGL_BAD_SCREEN_MESA";
@@ -295,7 +298,7 @@ _eglError(EGLint errCode, const char *msg)
          break;
 #endif
       default:
-         s = "other";
+         s = "other EGL error";
       }
       _eglLog(_EGL_DEBUG, "EGL user error 0x%x (%s) in %s\n", errCode, s, msg);
    }
index bcba05480a86676f9599a75e250c049f120a46d2..dbc5d32d910db654e1ecb46fa5eabbfd0c6b96ed 100644 (file)
@@ -74,8 +74,6 @@ struct _egl_extensions
 
    EGLBoolean NOK_swap_region;
    EGLBoolean NOK_texture_from_pixmap;
-
-   char String[_EGL_MAX_EXTENSIONS_LEN];
 };
 
 
@@ -86,21 +84,29 @@ struct _egl_display
 
    _EGLMutex Mutex;
 
-   _EGLPlatformType Platform;
-   void *PlatformDisplay;
-
-   EGLBoolean Initialized; /**< True if the display is initialized */
-   _EGLDriver *Driver;
-   void *DriverData; /* private to driver */
-
-   int APImajor, APIminor; /**< as returned by eglInitialize() */
-   char Version[1000];     /**< initialized from APImajor/minor, DriverName */
-
-   /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
-   EGLint ClientAPIsMask;
-   char ClientAPIs[1000];   /**< updated by eglQueryString */
-
-   _EGLExtensions Extensions;
+   _EGLPlatformType Platform; /**< The type of the platform display */
+   void *PlatformDisplay;     /**< A pointer to the platform display */
+
+   _EGLDriver *Driver;        /**< Matched driver of the display */
+   EGLBoolean Initialized;    /**< True if the display is initialized */
+
+   /* options that affect how the driver initializes the display */
+   struct {
+      EGLBoolean TestOnly;    /**< Driver should not set fields when true */
+      EGLBoolean UseFallback; /**< Use fallback driver (sw or less features) */
+   } Options;
+
+   /* these fields are set by the driver during init */
+   void *DriverData;          /**< Driver private data */
+   EGLint VersionMajor;       /**< EGL major version */
+   EGLint VersionMinor;       /**< EGL minor version */
+   EGLint ClientAPIs;         /**< Bitmask of APIs supported (EGL_xxx_BIT) */
+   _EGLExtensions Extensions; /**< Extensions supported */
+
+   /* these fields are derived from above */
+   char VersionString[1000];                       /**< EGL_VERSION */
+   char ClientAPIsString[1000];                    /**< EGL_CLIENT_APIS */
+   char ExtensionsString[_EGL_MAX_EXTENSIONS_LEN]; /**< EGL_EXTENSIONS */
 
    _EGLArray *Screens;
    _EGLArray *Configs;
index ff0011c4b15f3e0913e19a59b5061183daa5085c..e133c220f5ca8a6edd6ba953d97003f33ce4dcfe 100644 (file)
@@ -25,6 +25,7 @@
 
 typedef struct _egl_module {
    char *Path;
+   _EGLMain_t BuiltIn;
    void *Handle;
    _EGLDriver *Driver;
 } _EGLModule;
@@ -32,6 +33,21 @@ typedef struct _egl_module {
 static _EGL_DECLARE_MUTEX(_eglModuleMutex);
 static _EGLArray *_eglModules;
 
+const struct {
+   const char *name;
+   _EGLMain_t main;
+} _eglBuiltInDrivers[] = {
+#ifdef _EGL_BUILT_IN_DRIVER_GALLIUM
+   { "egl_gallium", _eglBuiltInDriverGALLIUM },
+#endif
+#ifdef _EGL_BUILT_IN_DRIVER_DRI2
+   { "egl_dri2", _eglBuiltInDriverDRI2 },
+#endif
+#ifdef _EGL_BUILT_IN_DRIVER_GLX
+   { "egl_glx", _eglBuiltInDriverGLX },
+#endif
+   { NULL, NULL }
+};
 
 /**
  * Wrappers for dlopen/dlclose()
@@ -128,9 +144,6 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle)
    if (!lib) {
       _eglLog(_EGL_WARNING, "Could not open driver %s (%s)",
               driverPath, error);
-      if (!getenv("EGL_DRIVER"))
-         _eglLog(_EGL_WARNING,
-                 "The driver can be overridden by setting EGL_DRIVER");
       return NULL;
    }
 
@@ -157,9 +170,18 @@ _eglLoadModule(_EGLModule *mod)
    lib_handle lib;
    _EGLDriver *drv;
 
-   mainFunc = _eglOpenLibrary(mod->Path, &lib);
-   if (!mainFunc)
-      return EGL_FALSE;
+   if (mod->Driver)
+      return EGL_TRUE;
+
+   if (mod->BuiltIn) {
+      lib = (lib_handle) NULL;
+      mainFunc = mod->BuiltIn;
+   }
+   else {
+      mainFunc = _eglOpenLibrary(mod->Path, &lib);
+      if (!mainFunc)
+         return EGL_FALSE;
+   }
 
    drv = mainFunc(NULL);
    if (!drv) {
@@ -186,11 +208,22 @@ _eglLoadModule(_EGLModule *mod)
 static void
 _eglUnloadModule(_EGLModule *mod)
 {
+#if defined(_EGL_OS_UNIX)
    /* destroy the driver */
    if (mod->Driver && mod->Driver->Unload)
       mod->Driver->Unload(mod->Driver);
+
+   /*
+    * XXX At this point (atexit), the module might be the last reference to
+    * libEGL.  Closing the module might unmap libEGL and give problems.
+    */
+#if 0
    if (mod->Handle)
       close_library(mod->Handle);
+#endif
+#elif defined(_EGL_OS_WINDOWS)
+   /* XXX Windows unloads DLLs before atexit */
+#endif
 
    mod->Driver = NULL;
    mod->Handle = NULL;
@@ -301,68 +334,6 @@ _eglLoaderFile(const char *dir, size_t len, void *loader_data)
 }
 
 
-/**
- * A loader function for use with _eglPreloadForEach.  The loader data is the
- * pattern (prefix) of the files to look for.
- */
-static EGLBoolean
-_eglLoaderPattern(const char *dir, size_t len, void *loader_data)
-{
-#if defined(_EGL_OS_UNIX)
-   const char *prefix, *suffix;
-   size_t prefix_len, suffix_len;
-   DIR *dirp;
-   struct dirent *dirent;
-   char path[1024];
-
-   if (len + 2 > sizeof(path))
-      return EGL_TRUE;
-   if (len) {
-      memcpy(path, dir, len);
-      path[len++] = '/';
-   }
-   path[len] = '\0';
-
-   dirp = opendir(path);
-   if (!dirp)
-      return EGL_TRUE;
-
-   prefix = (const char *) loader_data;
-   prefix_len = strlen(prefix);
-   suffix = library_suffix();
-   suffix_len = (suffix) ? strlen(suffix) : 0;
-
-   while ((dirent = readdir(dirp))) {
-      size_t dirent_len = strlen(dirent->d_name);
-      const char *p;
-
-      /* match the prefix */
-      if (strncmp(dirent->d_name, prefix, prefix_len) != 0)
-         continue;
-      /* match the suffix */
-      if (suffix) {
-         p = dirent->d_name + dirent_len - suffix_len;
-         if (p < dirent->d_name || strcmp(p, suffix) != 0)
-            continue;
-      }
-
-      /* make a full path and add it to the module array */
-      if (len + dirent_len + 1 <= sizeof(path)) {
-         strcpy(path + len, dirent->d_name);
-         _eglAddModule(path);
-      }
-   }
-
-   closedir(dirp);
-
-   return EGL_TRUE;
-#else /* _EGL_OS_UNIX */
-   /* stop immediately */
-   return EGL_FALSE;
-#endif
-}
-
-
 /**
  * Run the callback function on each driver directory.
  *
@@ -461,7 +432,7 @@ _eglGetSearchPath(void)
  *
  * The user driver is specified by EGL_DRIVER.
  */
-static void
+static EGLBoolean
 _eglAddUserDriver(void)
 {
    const char *search_path = _eglGetSearchPath();
@@ -478,34 +449,54 @@ _eglAddUserDriver(void)
       }
    }
 #endif /* _EGL_OS_UNIX */
-   if (env)
+   if (env) {
+      _EGLModule *mod;
+      EGLint i;
+
+      /* env can be a path */
       _eglPreloadForEach(search_path, _eglLoaderFile, (void *) env);
+      /* or the name of a built-in driver */
+      for (i = 0; _eglBuiltInDrivers[i].name; i++) {
+         if (!strcmp(_eglBuiltInDrivers[i].name, env)) {
+            mod = _eglAddModule(env);
+            if (mod)
+               mod->BuiltIn = _eglBuiltInDrivers[i].main;
+         }
+      }
+
+      return EGL_TRUE;
+   }
+
+   return EGL_FALSE;
 }
 
 
 /**
- * Add default drivers to the module array.
+ * Add egl_gallium to the module array.
  */
 static void
-_eglAddDefaultDrivers(void)
+_eglAddGalliumDriver(void)
 {
-   const char *search_path = _eglGetSearchPath();
-   EGLint i;
-#if defined(_EGL_OS_WINDOWS)
-   const char *DefaultDriverNames[] = {
-      "egl_gallium"
-   };
-#elif defined(_EGL_OS_UNIX)
-   const char *DefaultDriverNames[] = {
-      "egl_gallium",
-      "egl_dri2",
-      "egl_glx"
-   };
+#ifndef _EGL_BUILT_IN_DRIVER_GALLIUM
+   void *external = (void *) "egl_gallium";
+   _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external);
 #endif
+}
+
+
+/**
+ * Add built-in drivers to the module array.
+ */
+static void
+_eglAddBuiltInDrivers(void)
+{
+   _EGLModule *mod;
+   EGLint i;
 
-   for (i = 0; i < ARRAY_SIZE(DefaultDriverNames); i++) {
-      void *name = (void *) DefaultDriverNames[i];
-      _eglPreloadForEach(search_path, _eglLoaderFile, name);
+   for (i = 0; _eglBuiltInDrivers[i].name; i++) {
+      mod = _eglAddModule(_eglBuiltInDrivers[i].name);
+      if (mod)
+         mod->BuiltIn = _eglBuiltInDrivers[i].main;
    }
 }
 
@@ -520,113 +511,96 @@ _eglAddDrivers(void)
    if (_eglModules)
       return EGL_TRUE;
 
-   /* the order here decides the priorities of the drivers */
-   _eglAddUserDriver();
-   _eglAddDefaultDrivers();
-   _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderPattern, (void *) "egl_");
+   if (!_eglAddUserDriver()) {
+      /*
+       * Add other drivers only when EGL_DRIVER is not set.  The order here
+       * decides the priorities.
+       */
+      _eglAddGalliumDriver();
+      _eglAddBuiltInDrivers();
+   }
 
    return (_eglModules != NULL);
 }
 
 
 /**
- * Match a display to a driver.  The display is initialized unless use_probe is
- * true.
- *
- * The matching is done by finding the first driver that can initialize the
- * display, or when use_probe is true, the driver with highest score.
+ * A helper function for _eglMatchDriver.  It finds the first driver that can
+ * initialize the display and return.
  */
-_EGLDriver *
-_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean use_probe)
+static _EGLDriver *
+_eglMatchAndInitialize(_EGLDisplay *dpy)
 {
-   _EGLModule *mod;
-   _EGLDriver *best_drv = NULL;
-   EGLint best_score = 0;
-   EGLint major, minor, i;
-
-   _eglLockMutex(&_eglModuleMutex);
+   _EGLDriver *drv = NULL;
+   EGLint i = 0;
 
    if (!_eglAddDrivers()) {
-      _eglUnlockMutex(&_eglModuleMutex);
-      return EGL_FALSE;
+      _eglLog(_EGL_WARNING, "failed to find any driver");
+      return NULL;
    }
 
-   /* match the loaded modules */
-   for (i = 0; i < _eglModules->Size; i++) {
-      mod = (_EGLModule *) _eglModules->Elements[i];
-      if (!mod->Driver)
-         break;
+   if (dpy->Driver) {
+      drv = dpy->Driver;
+      /* no re-matching? */
+      if (!drv->API.Initialize(drv, dpy))
+         drv = NULL;
+      return drv;
+   }
 
-      if (use_probe) {
-         EGLint score = (mod->Driver->Probe) ?
-            mod->Driver->Probe(mod->Driver, dpy) : 1;
-         if (score > best_score) {
-            best_drv = mod->Driver;
-            best_score = score;
-         }
+   while (i < _eglModules->Size) {
+      _EGLModule *mod = (_EGLModule *) _eglModules->Elements[i];
+
+      if (!_eglLoadModule(mod)) {
+         /* remove invalid modules */
+         _eglEraseArray(_eglModules, i, _eglFreeModule);
+         continue;
+      }
+
+      if (mod->Driver->API.Initialize(mod->Driver, dpy)) {
+         drv = mod->Driver;
+         break;
       }
       else {
-         if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor)) {
-            best_drv = mod->Driver;
-            best_score = 100;
-         }
+         i++;
       }
-      /* perfect match */
-      if (best_score >= 100)
-         break;
    }
 
-   /* load more modules */
-   if (!best_drv) {
-      EGLint first_unloaded = i;
+   return drv;
+}
 
-      while (i < _eglModules->Size) {
-         mod = (_EGLModule *) _eglModules->Elements[i];
-         assert(!mod->Driver);
 
-         if (!_eglLoadModule(mod)) {
-            /* remove invalid modules */
-            _eglEraseArray(_eglModules, i, _eglFreeModule);
-            continue;
-         }
+/**
+ * Match a display to a driver.  The display is initialized unless test_only is
+ * true.  The matching is done by finding the first driver that can initialize
+ * the display.
+ */
+_EGLDriver *
+_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only)
+{
+   _EGLDriver *best_drv;
 
-         if (use_probe) {
-            best_score = (mod->Driver->Probe) ?
-               mod->Driver->Probe(mod->Driver, dpy) : 1;
-         }
-         else {
-            if (mod->Driver->API.Initialize(mod->Driver, dpy, &major, &minor))
-               best_score = 100;
-         }
+   assert(!dpy->Initialized);
 
-         if (best_score > 0) {
-            best_drv = mod->Driver;
-            /* loaded modules come before unloaded ones */
-            if (first_unloaded != i) {
-               void *tmp = _eglModules->Elements[i];
-               _eglModules->Elements[i] =
-                  _eglModules->Elements[first_unloaded];
-               _eglModules->Elements[first_unloaded] = tmp;
-            }
-            break;
-         }
-         else {
-            _eglUnloadModule(mod);
-            i++;
-         }
-      }
+   _eglLockMutex(&_eglModuleMutex);
+
+   /* set options */
+   dpy->Options.TestOnly = test_only;
+   dpy->Options.UseFallback = EGL_FALSE;
+
+   best_drv = _eglMatchAndInitialize(dpy);
+   if (!best_drv) {
+      dpy->Options.UseFallback = EGL_TRUE;
+      best_drv = _eglMatchAndInitialize(dpy);
    }
 
    _eglUnlockMutex(&_eglModuleMutex);
 
    if (best_drv) {
-      _eglLog(_EGL_DEBUG, "the best driver is %s (score %d)",
-            best_drv->Name, best_score);
-      if (!use_probe) {
+      _eglLog(_EGL_DEBUG, "the best driver is %s%s",
+            best_drv->Name, (test_only) ? " (test only) " : "");
+      if (!test_only) {
          dpy->Driver = best_drv;
          dpy->Initialized = EGL_TRUE;
-         dpy->APImajor = major;
-         dpy->APIminor = minor;
       }
    }
 
@@ -670,12 +644,7 @@ _eglUnloadDrivers(void)
 {
    /* this is called at atexit time */
    if (_eglModules) {
-#if defined(_EGL_OS_UNIX)
       _eglDestroyArray(_eglModules, _eglFreeModule);
-#elif defined(_EGL_OS_WINDOWS)
-      /* XXX Windows unloads DLLs before atexit */
-      _eglDestroyArray(_eglModules, NULL);
-#endif
       _eglModules = NULL;
    }
 }
index 1a0aaad1f8c2b27b9ad0b4041e3debbdc222f990..3cde102d12d0392c836f7b2078606c5fa2ce7334 100644 (file)
@@ -43,16 +43,6 @@ struct _egl_driver
 {
    const char *Name;  /**< name of this driver */
 
-   /**
-    * Probe a display and return a score.
-    *
-    * Roughly,
-    *  50 means the driver supports the display;
-    *  90 means the driver can accelerate the display;
-    * 100 means a perfect match.
-    */
-   EGLint (*Probe)(_EGLDriver *drv, _EGLDisplay *dpy);
-
    /**
     * Release the driver resource.
     *
@@ -64,12 +54,24 @@ struct _egl_driver
 };
 
 
+extern _EGLDriver *
+_eglBuiltInDriverGALLIUM(const char *args);
+
+
+extern _EGLDriver *
+_eglBuiltInDriverDRI2(const char *args);
+
+
+extern _EGLDriver *
+_eglBuiltInDriverGLX(const char *args);
+
+
 PUBLIC _EGLDriver *
 _eglMain(const char *args);
 
 
 extern _EGLDriver *
-_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean probe_only);
+_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only);
 
 
 extern __eglMustCastToProperFunctionPointerType
index bbb96a908e490cd88e9a36bb772c7ddb5e42c055..f8ba5f33eb949092e3a1f31b464fde920deceb52 100644 (file)
@@ -36,6 +36,8 @@
 #include "eglcurrent.h"
 #include "eglmisc.h"
 #include "egldisplay.h"
+#include "egldriver.h"
+#include "eglstring.h"
 
 
 /**
@@ -73,11 +75,11 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
    do {                                                                    \
       if (dpy->Extensions.ext) {                                           \
          _eglAppendExtension(&exts, "EGL_" #ext);                          \
-         assert(exts <= dpy->Extensions.String + _EGL_MAX_EXTENSIONS_LEN); \
+         assert(exts <= dpy->ExtensionsString + _EGL_MAX_EXTENSIONS_LEN);  \
       }                                                                    \
    } while (0)
 
-   char *exts = dpy->Extensions.String;
+   char *exts = dpy->ExtensionsString;
 
    if (exts[0])
       return;
@@ -114,24 +116,24 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
 static void
 _eglUpdateAPIsString(_EGLDisplay *dpy)
 {
-   char *apis = dpy->ClientAPIs;
+   char *apis = dpy->ClientAPIsString;
 
-   if (apis[0] || !dpy->ClientAPIsMask)
+   if (apis[0] || !dpy->ClientAPIs)
       return;
 
-   if (dpy->ClientAPIsMask & EGL_OPENGL_BIT)
+   if (dpy->ClientAPIs & EGL_OPENGL_BIT)
       strcat(apis, "OpenGL ");
 
-   if (dpy->ClientAPIsMask & EGL_OPENGL_ES_BIT)
+   if (dpy->ClientAPIs & EGL_OPENGL_ES_BIT)
       strcat(apis, "OpenGL_ES ");
 
-   if (dpy->ClientAPIsMask & EGL_OPENGL_ES2_BIT)
+   if (dpy->ClientAPIs & EGL_OPENGL_ES2_BIT)
       strcat(apis, "OpenGL_ES2 ");
 
-   if (dpy->ClientAPIsMask & EGL_OPENVG_BIT)
+   if (dpy->ClientAPIs & EGL_OPENVG_BIT)
       strcat(apis, "OpenVG ");
 
-   assert(strlen(apis) < sizeof(dpy->ClientAPIs));
+   assert(strlen(apis) < sizeof(dpy->ClientAPIsString));
 }
 
 
@@ -139,20 +141,21 @@ const char *
 _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name)
 {
    (void) drv;
-   (void) dpy;
+
    switch (name) {
    case EGL_VENDOR:
       return _EGL_VENDOR_STRING;
    case EGL_VERSION:
-      return dpy->Version;
+      _eglsnprintf(dpy->VersionString, sizeof(dpy->VersionString),
+              "%d.%d (%s)", dpy->VersionMajor, dpy->VersionMinor,
+              dpy->Driver->Name);
+      return dpy->VersionString;
    case EGL_EXTENSIONS:
       _eglUpdateExtensionsString(dpy);
-      return dpy->Extensions.String;
-#ifdef EGL_VERSION_1_2
+      return dpy->ExtensionsString;
    case EGL_CLIENT_APIS:
       _eglUpdateAPIsString(dpy);
-      return dpy->ClientAPIs;
-#endif
+      return dpy->ClientAPIsString;
    default:
       _eglError(EGL_BAD_PARAMETER, "eglQueryString");
       return NULL;
index f1d559b24a23362fc73e5aecea37bd2af6b42c47..d4c89541362b359b66ba41dc5bf6d319d9a59f11 100644 (file)
@@ -2,6 +2,7 @@
 #define EGLSTRING_INCLUDED
 
 #include <string.h>
+#include <stdio.h>
 
 #ifdef _EGL_OS_WINDOWS
 #define _eglstrcasecmp _stricmp
index 0efab834f66b4691a40efb6ab346d0e694dd48bd..2265f1de46c44a3242ce8e8e83499e9a0dd1d705 100644 (file)
@@ -55,6 +55,7 @@ SConscript('winsys/sw/null/SConscript')
 SConscript('state_trackers/python/SConscript')
 if env['platform'] != 'embedded':
     SConscript('state_trackers/vega/SConscript')
+    SConscript('state_trackers/egl/SConscript')
 
     if env['x11']:
         SConscript('state_trackers/glx/xlib/SConscript')
@@ -66,10 +67,7 @@ if env['platform'] != 'embedded':
         SConscript('state_trackers/xorg/SConscript')
 
 if env['platform'] == 'windows':
-    SConscript([
-        'state_trackers/egl/SConscript',
-        'state_trackers/wgl/SConscript',
-    ])
+    SConscript('state_trackers/wgl/SConscript')
 
 #
 # Winsys
@@ -85,6 +83,11 @@ SConscript([
     'targets/graw-null/SConscript',
 ])
 
+if env['platform'] != 'embedded':
+    SConscript([
+        'targets/egl-static/SConscript'
+    ])
+
 if env['x11']:
     SConscript([
         'targets/graw-xlib/SConscript',
@@ -95,7 +98,6 @@ if env['platform'] == 'windows':
     SConscript([
         'targets/graw-gdi/SConscript',
         'targets/libgl-gdi/SConscript',
-        #'egl-gdi/SConscript',
     ])
 
 if env['dri']:
index 53a0847f0320c87368fa83d41cbb05ebf0007f4a..ff355c47832677270a388ee6552bae101a13dbec 100644 (file)
@@ -128,12 +128,12 @@ C_SOURCES = \
        util/u_linkage.c \
        util/u_network.c \
        util/u_math.c \
-       util/u_mempool.c \
        util/u_mm.c \
        util/u_rect.c \
        util/u_ringbuffer.c \
        util/u_sampler.c \
        util/u_simple_shaders.c \
+       util/u_slab.c \
        util/u_snprintf.c \
        util/u_staging.c \
        util/u_surface.c \
@@ -185,7 +185,7 @@ GALLIVM_SOURCES = \
         draw/draw_pt_fetch_shade_pipeline_llvm.c
 
 GALLIVM_CPP_SOURCES = \
-    gallivm/lp_bld_misc.cpp
+       gallivm/lp_bld_misc.cpp
 
 GENERATED_SOURCES = \
        indices/u_indices_gen.c \
@@ -203,9 +203,6 @@ CPP_SOURCES += \
 endif
 
 
-LIBRARY_DEFINES += -D__STDC_CONSTANT_MACROS
-
-
 include ../Makefile.template
 
 
index 75c27dd242010b1c0baba73889db683b879ffbcd..fca7e5fd117a5ac73ddd94b7072e695a653d1aed 100644 (file)
@@ -175,13 +175,13 @@ source = [
     'util/u_linkage.c',
     'util/u_network.c',
     'util/u_math.c',
-    'util/u_mempool.c',
     'util/u_mm.c',
     'util/u_rect.c',
     'util/u_resource.c',
     'util/u_ringbuffer.c',
     'util/u_sampler.c',
     'util/u_simple_shaders.c',
+    'util/u_slab.c',
     'util/u_snprintf.c',
     'util/u_staging.c',
     'util/u_surface.c',
index 39d82f3289251ea2442d1b8789cc17059719f837..e045313b94fe1d1992d3fdefd567e08b9f9568d4 100644 (file)
@@ -35,6 +35,7 @@
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "util/u_cpu_detect.h"
+#include "util/u_inlines.h"
 #include "draw_context.h"
 #include "draw_vs.h"
 #include "draw_gs.h"
@@ -63,19 +64,32 @@ draw_get_option_use_llvm(void)
 }
 #endif
 
-struct draw_context *draw_create( struct pipe_context *pipe )
+
+
+/**
+ * Create new draw module context.
+ */
+struct draw_context *
+draw_create(struct pipe_context *pipe)
+{
+   return draw_create_gallivm(pipe, NULL);
+}
+
+
+
+/**
+ * Create new draw module context with gallivm state for LLVM JIT.
+ */
+struct draw_context *
+draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm)
 {
    struct draw_context *draw = CALLOC_STRUCT( draw_context );
    if (draw == NULL)
       goto fail;
 
 #if HAVE_LLVM
-   if(draw_get_option_use_llvm())
-   {
-      lp_build_init();
-      assert(lp_build_engine);
-      draw->engine = lp_build_engine;
-      draw->llvm = draw_llvm_create(draw);
+   if (draw_get_option_use_llvm() && gallivm) {
+      draw->llvm = draw_llvm_create(draw, gallivm);
    }
 #endif
 
@@ -91,6 +105,8 @@ fail:
    return NULL;
 }
 
+
+
 boolean draw_init(struct draw_context *draw)
 {
    /*
@@ -149,6 +165,10 @@ void draw_destroy( struct draw_context *draw )
       }
    }
 
+   for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
+      pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL);
+   }
+
    /* Not so fast -- we're just borrowing this at the moment.
     * 
    if (draw->render)
@@ -292,8 +312,9 @@ draw_set_vertex_buffers(struct draw_context *draw,
 {
    assert(count <= PIPE_MAX_ATTRIBS);
 
-   memcpy(draw->pt.vertex_buffer, buffers, count * sizeof(buffers[0]));
-   draw->pt.nr_vertex_buffers = count;
+   util_copy_vertex_buffers(draw->pt.vertex_buffer,
+                            &draw->pt.nr_vertex_buffers,
+                            buffers, count);
 }
 
 
index ff4f753604fb0072277bf7fc1465cad658f33c5e..a0b217e4d33b4c05a5d6a81e4c5cbfb741673d54 100644 (file)
@@ -48,10 +48,15 @@ struct draw_vertex_shader;
 struct draw_geometry_shader;
 struct draw_fragment_shader;
 struct tgsi_sampler;
+struct gallivm_state;
+
 
 
 struct draw_context *draw_create( struct pipe_context *pipe );
 
+struct draw_context *
+draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm);
+
 void draw_destroy( struct draw_context *draw );
 
 void draw_flush(struct draw_context *draw);
index eb162fb0f6263458063678f994d36d22b762d074..41269ee869d52c5fb3344e126af59616414f5992 100644 (file)
@@ -42,6 +42,7 @@
 #include "gallivm/lp_bld_printf.h"
 #include "gallivm/lp_bld_intr.h"
 #include "gallivm/lp_bld_init.h"
+#include "gallivm/lp_bld_type.h"
 
 #include "tgsi/tgsi_exec.h"
 #include "tgsi/tgsi_dump.h"
 #include "util/u_math.h"
 #include "util/u_pointer.h"
 #include "util/u_string.h"
+#include "util/u_simple_list.h"
 
-#include <llvm-c/Transforms/Scalar.h>
 
 #define DEBUG_STORE 0
 
-/* generates the draw jit function */
+
+/**
+ * This function is called by the gallivm "garbage collector" when
+ * the LLVM global data structures are freed.  We must free all LLVM-related
+ * data.  Specifically, all JIT'd shader variants.
+ */
+static void
+draw_llvm_garbage_collect_callback(void *cb_data)
+{
+   struct draw_llvm *llvm = (struct draw_llvm *) cb_data;
+   struct draw_llvm_variant_list_item *li;
+
+   /* free all shader variants */
+   li = first_elem(&llvm->vs_variants_list);
+   while (!at_end(&llvm->vs_variants_list, li)) {
+      struct draw_llvm_variant_list_item *next = next_elem(li);
+      draw_llvm_destroy_variant(li->base);
+      li = next;
+   }
+
+   /* Null-out these pointers so they get remade next time they're needed.
+    * See the accessor functions below.
+    */
+   llvm->context_ptr_type = NULL;
+   llvm->buffer_ptr_type = NULL;
+   llvm->vb_ptr_type = NULL;
+   llvm->vertex_header_ptr_type = NULL;
+}
+
+
 static void
 draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *var);
+
 static void
 draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *var);
 
-static void
-init_globals(struct draw_llvm *llvm)
+
+/**
+ * Create LLVM type for struct draw_jit_texture
+ */
+static LLVMTypeRef
+create_jit_texture_type(struct gallivm_state *gallivm)
 {
+   LLVMTargetDataRef target = gallivm->target;
    LLVMTypeRef texture_type;
+   LLVMTypeRef elem_types[DRAW_JIT_TEXTURE_NUM_FIELDS];
+   LLVMTypeRef int32_type = LLVMInt32TypeInContext(gallivm->context);
+
+   elem_types[DRAW_JIT_TEXTURE_WIDTH]  =
+   elem_types[DRAW_JIT_TEXTURE_HEIGHT] =
+   elem_types[DRAW_JIT_TEXTURE_DEPTH] =
+   elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = int32_type;
+   elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] =
+   elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
+      LLVMArrayType(int32_type, PIPE_MAX_TEXTURE_LEVELS);
+   elem_types[DRAW_JIT_TEXTURE_DATA] =
+      LLVMArrayType(LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0),
+                    PIPE_MAX_TEXTURE_LEVELS);
+   elem_types[DRAW_JIT_TEXTURE_MIN_LOD] =
+   elem_types[DRAW_JIT_TEXTURE_MAX_LOD] =
+   elem_types[DRAW_JIT_TEXTURE_LOD_BIAS] = LLVMFloatTypeInContext(gallivm->context);
+   elem_types[DRAW_JIT_TEXTURE_BORDER_COLOR] = 
+      LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
+
+   texture_type = LLVMStructTypeInContext(gallivm->context, elem_types,
+                                          Elements(elem_types), 0);
+
+   /* Make sure the target's struct layout cache doesn't return
+    * stale/invalid data.
+    */
+   LLVMInvalidateStructLayout(gallivm->target, texture_type);
+
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, width,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_WIDTH);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, height,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_HEIGHT);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, depth,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_DEPTH);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, last_level,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_LAST_LEVEL);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, row_stride,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_ROW_STRIDE);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, img_stride,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_IMG_STRIDE);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, data,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_DATA);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, min_lod,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_MIN_LOD);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, max_lod,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_MAX_LOD);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, lod_bias,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_LOD_BIAS);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, border_color,
+                          target, texture_type,
+                          DRAW_JIT_TEXTURE_BORDER_COLOR);
+
+   LP_CHECK_STRUCT_SIZE(struct draw_jit_texture, target, texture_type);
+
+   return texture_type;
+}
 
-   /* struct draw_jit_texture */
-   {
-      LLVMTypeRef elem_types[DRAW_JIT_TEXTURE_NUM_FIELDS];
-
-      elem_types[DRAW_JIT_TEXTURE_WIDTH]  = LLVMInt32Type();
-      elem_types[DRAW_JIT_TEXTURE_HEIGHT] = LLVMInt32Type();
-      elem_types[DRAW_JIT_TEXTURE_DEPTH] = LLVMInt32Type();
-      elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type();
-      elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] =
-         LLVMArrayType(LLVMInt32Type(), PIPE_MAX_TEXTURE_LEVELS);
-      elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
-         LLVMArrayType(LLVMInt32Type(), PIPE_MAX_TEXTURE_LEVELS);
-      elem_types[DRAW_JIT_TEXTURE_DATA] =
-         LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0),
-                       PIPE_MAX_TEXTURE_LEVELS);
-      elem_types[DRAW_JIT_TEXTURE_MIN_LOD] = LLVMFloatType();
-      elem_types[DRAW_JIT_TEXTURE_MAX_LOD] = LLVMFloatType();
-      elem_types[DRAW_JIT_TEXTURE_LOD_BIAS] = LLVMFloatType();
-      elem_types[DRAW_JIT_TEXTURE_BORDER_COLOR] = 
-         LLVMArrayType(LLVMFloatType(), 4);
-
-      texture_type = LLVMStructType(elem_types, Elements(elem_types), 0);
-
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, width,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_WIDTH);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, height,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_HEIGHT);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, depth,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_DEPTH);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, last_level,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_LAST_LEVEL);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, row_stride,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_ROW_STRIDE);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, img_stride,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_IMG_STRIDE);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, data,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_DATA);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, min_lod,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_MIN_LOD);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, max_lod,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_MAX_LOD);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, lod_bias,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_LOD_BIAS);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, border_color,
-                             llvm->target, texture_type,
-                             DRAW_JIT_TEXTURE_BORDER_COLOR);
-      LP_CHECK_STRUCT_SIZE(struct draw_jit_texture,
-                           llvm->target, texture_type);
-
-      LLVMAddTypeName(llvm->module, "texture", texture_type);
-   }
 
+/**
+ * Create LLVM type for struct draw_jit_texture
+ */
+static LLVMTypeRef
+create_jit_context_type(struct gallivm_state *gallivm,
+                        LLVMTypeRef texture_type)
+{
+   LLVMTargetDataRef target = gallivm->target;
+   LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
+   LLVMTypeRef elem_types[5];
+   LLVMTypeRef context_type;
+
+   elem_types[0] = LLVMPointerType(float_type, 0); /* vs_constants */
+   elem_types[1] = LLVMPointerType(float_type, 0); /* gs_constants */
+   elem_types[2] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), 12), 0); /* planes */
+   elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
+   elem_types[4] = LLVMArrayType(texture_type,
+                                 PIPE_MAX_VERTEX_SAMPLERS); /* textures */
+
+   context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
+                                          Elements(elem_types), 0);
+
+   LLVMInvalidateStructLayout(gallivm->target, context_type);
+
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, vs_constants,
+                          target, context_type, 0);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, gs_constants,
+                          target, context_type, 1);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes,
+                          target, context_type, 2);
+   LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, textures,
+                          target, context_type,
+                          DRAW_JIT_CTX_TEXTURES);
+   LP_CHECK_STRUCT_SIZE(struct draw_jit_context,
+                        target, context_type);
+
+   return context_type;
+}
 
-   /* struct draw_jit_context */
-   {
-      LLVMTypeRef elem_types[5];
-      LLVMTypeRef context_type;
-
-      elem_types[0] = LLVMPointerType(LLVMFloatType(), 0); /* vs_constants */
-      elem_types[1] = LLVMPointerType(LLVMFloatType(), 0); /* gs_constants */
-      elem_types[2] = LLVMPointerType(LLVMArrayType(LLVMArrayType(LLVMFloatType(), 4), 12), 0); /* planes */
-      elem_types[3] = LLVMPointerType(LLVMFloatType(), 0); /* viewport */
-      elem_types[4] = LLVMArrayType(texture_type,
-                                    PIPE_MAX_VERTEX_SAMPLERS); /* textures */
-
-      context_type = LLVMStructType(elem_types, Elements(elem_types), 0);
-
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, vs_constants,
-                             llvm->target, context_type, 0);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, gs_constants,
-                             llvm->target, context_type, 1);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes,
-                             llvm->target, context_type, 2);
-      LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, textures,
-                             llvm->target, context_type,
-                             DRAW_JIT_CTX_TEXTURES);
-      LP_CHECK_STRUCT_SIZE(struct draw_jit_context,
-                           llvm->target, context_type);
-
-      LLVMAddTypeName(llvm->module, "draw_jit_context", context_type);
-
-      llvm->context_ptr_type = LLVMPointerType(context_type, 0);
-   }
-   {
-      LLVMTypeRef buffer_ptr = LLVMPointerType(LLVMIntType(8), 0);
-      llvm->buffer_ptr_type = LLVMPointerType(buffer_ptr, 0);
-   }
-   /* struct pipe_vertex_buffer */
-   {
-      LLVMTypeRef elem_types[4];
-      LLVMTypeRef vb_type;
 
-      elem_types[0] = LLVMInt32Type();
-      elem_types[1] = LLVMInt32Type();
-      elem_types[2] = LLVMInt32Type();
-      elem_types[3] = LLVMPointerType(LLVMOpaqueType(), 0); /* vs_constants */
+/**
+ * Create LLVM type for struct pipe_vertex_buffer
+ */
+static LLVMTypeRef
+create_jit_vertex_buffer_type(struct gallivm_state *gallivm)
+{
+   LLVMTargetDataRef target = gallivm->target;
+   LLVMTypeRef elem_types[4];
+   LLVMTypeRef vb_type;
 
-      vb_type = LLVMStructType(elem_types, Elements(elem_types), 0);
+   elem_types[0] =
+   elem_types[1] =
+   elem_types[2] = LLVMInt32TypeInContext(gallivm->context);
+   elem_types[3] = LLVMPointerType(LLVMOpaqueTypeInContext(gallivm->context), 0); /* vs_constants */
 
-      LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, stride,
-                             llvm->target, vb_type, 0);
-      LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer_offset,
-                             llvm->target, vb_type, 2);
-      LP_CHECK_STRUCT_SIZE(struct pipe_vertex_buffer,
-                           llvm->target, vb_type);
+   vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
+                                     Elements(elem_types), 0);
 
-      LLVMAddTypeName(llvm->module, "pipe_vertex_buffer", vb_type);
+   LLVMInvalidateStructLayout(gallivm->target, vb_type);
 
-      llvm->vb_ptr_type = LLVMPointerType(vb_type, 0);
-   }
+   LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, stride,
+                          target, vb_type, 0);
+   LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer_offset,
+                          target, vb_type, 2);
+
+   LP_CHECK_STRUCT_SIZE(struct pipe_vertex_buffer, target, vb_type);
+
+   return vb_type;
 }
 
+
+/**
+ * Create LLVM type for struct vertex_header;
+ */
 static LLVMTypeRef
-create_vertex_header(struct draw_llvm *llvm, int data_elems)
+create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
 {
-   /* struct vertex_header */
+   LLVMTargetDataRef target = gallivm->target;
    LLVMTypeRef elem_types[3];
    LLVMTypeRef vertex_header;
    char struct_name[24];
 
    util_snprintf(struct_name, 23, "vertex_header%d", data_elems);
 
-   elem_types[0]  = LLVMIntType(32);
-   elem_types[1]  = LLVMArrayType(LLVMFloatType(), 4);
+   elem_types[0]  = LLVMIntTypeInContext(gallivm->context, 32);
+   elem_types[1]  = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
    elem_types[2]  = LLVMArrayType(elem_types[1], data_elems);
 
-   vertex_header = LLVMStructType(elem_types, Elements(elem_types), 0);
+   vertex_header = LLVMStructTypeInContext(gallivm->context, elem_types,
+                                           Elements(elem_types), 0);
+
+   LLVMInvalidateStructLayout(gallivm->target, vertex_header);
 
    /* these are bit-fields and we can't take address of them
       LP_CHECK_MEMBER_OFFSET(struct vertex_header, clipmask,
-      llvm->target, vertex_header,
+      target, vertex_header,
       DRAW_JIT_VERTEX_CLIPMASK);
       LP_CHECK_MEMBER_OFFSET(struct vertex_header, edgeflag,
-      llvm->target, vertex_header,
+      target, vertex_header,
       DRAW_JIT_VERTEX_EDGEFLAG);
       LP_CHECK_MEMBER_OFFSET(struct vertex_header, pad,
-      llvm->target, vertex_header,
+      target, vertex_header,
       DRAW_JIT_VERTEX_PAD);
       LP_CHECK_MEMBER_OFFSET(struct vertex_header, vertex_id,
-      llvm->target, vertex_header,
+      target, vertex_header,
       DRAW_JIT_VERTEX_VERTEX_ID);
    */
    LP_CHECK_MEMBER_OFFSET(struct vertex_header, clip,
-                          llvm->target, vertex_header,
+                          target, vertex_header,
                           DRAW_JIT_VERTEX_CLIP);
    LP_CHECK_MEMBER_OFFSET(struct vertex_header, data,
-                          llvm->target, vertex_header,
+                          target, vertex_header,
                           DRAW_JIT_VERTEX_DATA);
 
-   LLVMAddTypeName(llvm->module, struct_name, vertex_header);
+   LLVMAddTypeName(gallivm->module, struct_name, vertex_header);
 
-   return LLVMPointerType(vertex_header, 0);
+   return vertex_header;
 }
 
-struct draw_llvm *
-draw_llvm_create(struct draw_context *draw)
+
+/**
+ * Create LLVM types for various structures.
+ */
+static void
+create_jit_types(struct draw_llvm *llvm)
 {
-   struct draw_llvm *llvm;
+   struct gallivm_state *gallivm = llvm->gallivm;
+   LLVMTypeRef texture_type, context_type, buffer_type, vb_type;
 
-   llvm = CALLOC_STRUCT( draw_llvm );
-   if (!llvm)
-      return NULL;
+   texture_type = create_jit_texture_type(gallivm);
+   LLVMAddTypeName(gallivm->module, "texture", texture_type);
 
-   llvm->draw = draw;
-   llvm->engine = draw->engine;
+   context_type = create_jit_context_type(gallivm, texture_type);
+   LLVMAddTypeName(gallivm->module, "draw_jit_context", context_type);
+   llvm->context_ptr_type = LLVMPointerType(context_type, 0);
 
-   debug_assert(llvm->engine);
+   buffer_type = LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 8), 0);
+   LLVMAddTypeName(gallivm->module, "buffer", buffer_type);
+   llvm->buffer_ptr_type = LLVMPointerType(buffer_type, 0);
 
-   llvm->module = LLVMModuleCreateWithName("draw_llvm");
-   llvm->provider = LLVMCreateModuleProviderForExistingModule(llvm->module);
+   vb_type = create_jit_vertex_buffer_type(gallivm);
+   LLVMAddTypeName(gallivm->module, "pipe_vertex_buffer", vb_type);
+   llvm->vb_ptr_type = LLVMPointerType(vb_type, 0);
+}
 
-   LLVMAddModuleProvider(llvm->engine, llvm->provider);
 
-   llvm->target = LLVMGetExecutionEngineTargetData(llvm->engine);
+static LLVMTypeRef
+get_context_ptr_type(struct draw_llvm *llvm)
+{
+   if (!llvm->context_ptr_type)
+      create_jit_types(llvm);
+   return llvm->context_ptr_type;
+}
 
-   llvm->pass = LLVMCreateFunctionPassManager(llvm->provider);
-   LLVMAddTargetData(llvm->target, llvm->pass);
 
-   if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
-      /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-       * but there are more on SVN. */
-      /* TODO: Add more passes */
+static LLVMTypeRef
+get_buffer_ptr_type(struct draw_llvm *llvm)
+{
+   if (!llvm->buffer_ptr_type)
+      create_jit_types(llvm);
+   return llvm->buffer_ptr_type;
+}
 
-      LLVMAddCFGSimplificationPass(llvm->pass);
 
-      if (HAVE_LLVM >= 0x207 && sizeof(void*) == 4) {
-         /* For LLVM >= 2.7 and 32-bit build, use this order of passes to
-          * avoid generating bad code.
-          * Test with piglit glsl-vs-sqrt-zero test.
-          */
-         LLVMAddConstantPropagationPass(llvm->pass);
-         LLVMAddPromoteMemoryToRegisterPass(llvm->pass);
-      }
-      else {
-         LLVMAddPromoteMemoryToRegisterPass(llvm->pass);
-         LLVMAddConstantPropagationPass(llvm->pass);
-      }
+static LLVMTypeRef
+get_vb_ptr_type(struct draw_llvm *llvm)
+{
+   if (!llvm->vb_ptr_type)
+      create_jit_types(llvm);
+   return llvm->vb_ptr_type;
+}
 
-      LLVMAddInstructionCombiningPass(llvm->pass);
-      LLVMAddGVNPass(llvm->pass);
-   } else {
-      /* We need at least this pass to prevent the backends to fail in
-       * unexpected ways.
-       */
-      LLVMAddPromoteMemoryToRegisterPass(llvm->pass);
-   }
+static LLVMTypeRef
+get_vertex_header_ptr_type(struct draw_llvm *llvm)
+{
+   if (!llvm->vertex_header_ptr_type)
+      create_jit_types(llvm);
+   return llvm->vertex_header_ptr_type;
+}
 
-   init_globals(llvm);
+
+/**
+ * Create per-context LLVM info.
+ */
+struct draw_llvm *
+draw_llvm_create(struct draw_context *draw, struct gallivm_state *gallivm)
+{
+   struct draw_llvm *llvm;
+
+   llvm = CALLOC_STRUCT( draw_llvm );
+   if (!llvm)
+      return NULL;
+
+   lp_build_init();
+
+   llvm->draw = draw;
+   llvm->gallivm = gallivm;
 
    if (gallivm_debug & GALLIVM_DEBUG_IR) {
-      LLVMDumpModule(llvm->module);
+      LLVMDumpModule(llvm->gallivm->module);
    }
 
    llvm->nr_variants = 0;
    make_empty_list(&llvm->vs_variants_list);
 
+   gallivm_register_garbage_collector_callback(
+                              draw_llvm_garbage_collect_callback, llvm);
+
    return llvm;
 }
 
+
+/**
+ * Free per-context LLVM info.
+ */
 void
 draw_llvm_destroy(struct draw_llvm *llvm)
 {
-   LLVMDisposePassManager(llvm->pass);
+   gallivm_remove_garbage_collector_callback(
+                              draw_llvm_garbage_collect_callback, llvm);
 
+   /* XXX free other draw_llvm data? */
    FREE(llvm);
 }
 
+
+/**
+ * Create LLVM-generated code for a vertex shader.
+ */
 struct draw_llvm_variant *
 draw_llvm_create_variant(struct draw_llvm *llvm,
                         unsigned num_inputs,
@@ -310,6 +404,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
    struct draw_llvm_variant *variant;
    struct llvm_vertex_shader *shader =
       llvm_vertex_shader(llvm->draw->vs.vertex_shader);
+   LLVMTypeRef vertex_header;
 
    variant = MALLOC(sizeof *variant +
                    shader->variant_key_size -
@@ -321,7 +416,9 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
 
    memcpy(&variant->key, key, shader->variant_key_size);
 
-   llvm->vertex_header_ptr_type = create_vertex_header(llvm, num_inputs);
+   vertex_header = create_jit_vertex_header(llvm->gallivm, num_inputs);
+
+   llvm->vertex_header_ptr_type = LLVMPointerType(vertex_header, 0);
 
    draw_llvm_generate(llvm, variant);
    draw_llvm_generate_elts(llvm, variant);
@@ -346,7 +443,7 @@ generate_vs(struct draw_llvm *llvm,
 {
    const struct tgsi_token *tokens = llvm->draw->vs.vertex_shader->state.tokens;
    struct lp_type vs_type;
-   LLVMValueRef consts_ptr = draw_jit_context_vs_constants(builder, context_ptr);
+   LLVMValueRef consts_ptr = draw_jit_context_vs_constants(llvm->gallivm, context_ptr);
    struct lp_build_sampler_soa *sampler = 0;
 
    memset(&vs_type, 0, sizeof vs_type);
@@ -367,7 +464,7 @@ generate_vs(struct draw_llvm *llvm,
        llvm->draw->num_samplers)
       sampler = draw_sampler;
 
-   lp_build_tgsi_soa(builder,
+   lp_build_tgsi_soa(llvm->gallivm,
                      tokens,
                      vs_type,
                      NULL /*struct lp_build_mask_context *mask*/,
@@ -386,20 +483,20 @@ static void print_vectorf(LLVMBuilderRef builder,
 {
    LLVMValueRef val[4];
    val[0] = LLVMBuildExtractElement(builder, vec,
-                                    LLVMConstInt(LLVMInt32Type(), 0, 0), "");
+                                    lp_build_const_int32(gallivm, 0), "");
    val[1] = LLVMBuildExtractElement(builder, vec,
-                                    LLVMConstInt(LLVMInt32Type(), 1, 0), "");
+                                    lp_build_const_int32(gallivm, 1), "");
    val[2] = LLVMBuildExtractElement(builder, vec,
-                                    LLVMConstInt(LLVMInt32Type(), 2, 0), "");
+                                    lp_build_const_int32(gallivm, 2), "");
    val[3] = LLVMBuildExtractElement(builder, vec,
-                                    LLVMConstInt(LLVMInt32Type(), 3, 0), "");
+                                    lp_build_const_int32(gallivm, 3), "");
    lp_build_printf(builder, "vector = [%f, %f, %f, %f]\n",
                    val[0], val[1], val[2], val[3]);
 }
 #endif
 
 static void
-generate_fetch(LLVMBuilderRef builder,
+generate_fetch(struct gallivm_state *gallivm,
                LLVMValueRef vbuffers_ptr,
                LLVMValueRef *res,
                struct pipe_vertex_element *velem,
@@ -407,19 +504,22 @@ generate_fetch(LLVMBuilderRef builder,
                LLVMValueRef index,
                LLVMValueRef instance_id)
 {
-   LLVMValueRef indices = LLVMConstInt(LLVMInt64Type(), velem->vertex_buffer_index, 0);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMValueRef indices =
+      LLVMConstInt(LLVMInt64TypeInContext(gallivm->context),
+                   velem->vertex_buffer_index, 0);
    LLVMValueRef vbuffer_ptr = LLVMBuildGEP(builder, vbuffers_ptr,
                                            &indices, 1, "");
-   LLVMValueRef vb_stride = draw_jit_vbuffer_stride(builder, vbuf);
-   LLVMValueRef vb_max_index = draw_jit_vbuffer_max_index(builder, vbuf);
-   LLVMValueRef vb_buffer_offset = draw_jit_vbuffer_offset(builder, vbuf);
+   LLVMValueRef vb_stride = draw_jit_vbuffer_stride(gallivm, vbuf);
+   LLVMValueRef vb_max_index = draw_jit_vbuffer_max_index(gallivm, vbuf);
+   LLVMValueRef vb_buffer_offset = draw_jit_vbuffer_offset(gallivm, vbuf);
    LLVMValueRef cond;
    LLVMValueRef stride;
 
    if (velem->instance_divisor) {
       /* array index = instance_id / instance_divisor */
       index = LLVMBuildUDiv(builder, instance_id,
-                            LLVMConstInt(LLVMInt32Type(), velem->instance_divisor, 0),
+                            lp_build_const_int32(gallivm, velem->instance_divisor),
                             "instance_divisor");
    }
 
@@ -435,23 +535,24 @@ generate_fetch(LLVMBuilderRef builder,
                          vb_buffer_offset,
                          "");
    stride = LLVMBuildAdd(builder, stride,
-                         LLVMConstInt(LLVMInt32Type(), velem->src_offset, 0),
+                         lp_build_const_int32(gallivm, velem->src_offset),
                          "");
 
    /*lp_build_printf(builder, "vbuf index = %d, stride is %d\n", indices, stride);*/
    vbuffer_ptr = LLVMBuildGEP(builder, vbuffer_ptr, &stride, 1, "");
 
-   *res = draw_llvm_translate_from(builder, vbuffer_ptr, velem->src_format);
+   *res = draw_llvm_translate_from(gallivm, vbuffer_ptr, velem->src_format);
 }
 
 static LLVMValueRef
-aos_to_soa(LLVMBuilderRef builder,
+aos_to_soa(struct gallivm_state *gallivm,
            LLVMValueRef val0,
            LLVMValueRef val1,
            LLVMValueRef val2,
            LLVMValueRef val3,
            LLVMValueRef channel)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef ex, res;
 
    ex = LLVMBuildExtractElement(builder, val0,
@@ -459,38 +560,39 @@ aos_to_soa(LLVMBuilderRef builder,
    res = LLVMBuildInsertElement(builder,
                                 LLVMConstNull(LLVMTypeOf(val0)),
                                 ex,
-                                LLVMConstInt(LLVMInt32Type(), 0, 0),
+                                lp_build_const_int32(gallivm, 0),
                                 "");
 
    ex = LLVMBuildExtractElement(builder, val1,
                                 channel, "");
    res = LLVMBuildInsertElement(builder,
                                 res, ex,
-                                LLVMConstInt(LLVMInt32Type(), 1, 0),
+                                lp_build_const_int32(gallivm, 1),
                                 "");
 
    ex = LLVMBuildExtractElement(builder, val2,
                                 channel, "");
    res = LLVMBuildInsertElement(builder,
                                 res, ex,
-                                LLVMConstInt(LLVMInt32Type(), 2, 0),
+                                lp_build_const_int32(gallivm, 2),
                                 "");
 
    ex = LLVMBuildExtractElement(builder, val3,
                                 channel, "");
    res = LLVMBuildInsertElement(builder,
                                 res, ex,
-                                LLVMConstInt(LLVMInt32Type(), 3, 0),
+                                lp_build_const_int32(gallivm, 3),
                                 "");
 
    return res;
 }
 
 static void
-soa_to_aos(LLVMBuilderRef builder,
+soa_to_aos(struct gallivm_state *gallivm,
            LLVMValueRef soa[NUM_CHANNELS],
            LLVMValueRef aos[NUM_CHANNELS])
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef comp;
    int i = 0;
 
@@ -500,29 +602,29 @@ soa_to_aos(LLVMBuilderRef builder,
    aos[1] = aos[2] = aos[3] = aos[0];
 
    for (i = 0; i < NUM_CHANNELS; ++i) {
-      LLVMValueRef channel = LLVMConstInt(LLVMInt32Type(), i, 0);
+      LLVMValueRef channel = lp_build_const_int32(gallivm, i);
 
       comp = LLVMBuildExtractElement(builder, soa[i],
-                                     LLVMConstInt(LLVMInt32Type(), 0, 0), "");
+                                     lp_build_const_int32(gallivm, 0), "");
       aos[0] = LLVMBuildInsertElement(builder, aos[0], comp, channel, "");
 
       comp = LLVMBuildExtractElement(builder, soa[i],
-                                     LLVMConstInt(LLVMInt32Type(), 1, 0), "");
+                                     lp_build_const_int32(gallivm, 1), "");
       aos[1] = LLVMBuildInsertElement(builder, aos[1], comp, channel, "");
 
       comp = LLVMBuildExtractElement(builder, soa[i],
-                                     LLVMConstInt(LLVMInt32Type(), 2, 0), "");
+                                     lp_build_const_int32(gallivm, 2), "");
       aos[2] = LLVMBuildInsertElement(builder, aos[2], comp, channel, "");
 
       comp = LLVMBuildExtractElement(builder, soa[i],
-                                     LLVMConstInt(LLVMInt32Type(), 3, 0), "");
+                                     lp_build_const_int32(gallivm, 3), "");
       aos[3] = LLVMBuildInsertElement(builder, aos[3], comp, channel, "");
 
    }
 }
 
 static void
-convert_to_soa(LLVMBuilderRef builder,
+convert_to_soa(struct gallivm_state *gallivm,
                LLVMValueRef (*aos)[NUM_CHANNELS],
                LLVMValueRef (*soa)[NUM_CHANNELS],
                int num_attribs)
@@ -537,36 +639,37 @@ convert_to_soa(LLVMBuilderRef builder,
       LLVMValueRef val2 = aos[i][2];
       LLVMValueRef val3 = aos[i][3];
 
-      soa[i][0] = aos_to_soa(builder, val0, val1, val2, val3,
-                             LLVMConstInt(LLVMInt32Type(), 0, 0));
-      soa[i][1] = aos_to_soa(builder, val0, val1, val2, val3,
-                             LLVMConstInt(LLVMInt32Type(), 1, 0));
-      soa[i][2] = aos_to_soa(builder, val0, val1, val2, val3,
-                             LLVMConstInt(LLVMInt32Type(), 2, 0));
-      soa[i][3] = aos_to_soa(builder, val0, val1, val2, val3,
-                             LLVMConstInt(LLVMInt32Type(), 3, 0));
+      soa[i][0] = aos_to_soa(gallivm, val0, val1, val2, val3,
+                             lp_build_const_int32(gallivm, 0));
+      soa[i][1] = aos_to_soa(gallivm, val0, val1, val2, val3,
+                             lp_build_const_int32(gallivm, 1));
+      soa[i][2] = aos_to_soa(gallivm, val0, val1, val2, val3,
+                             lp_build_const_int32(gallivm, 2));
+      soa[i][3] = aos_to_soa(gallivm, val0, val1, val2, val3,
+                             lp_build_const_int32(gallivm, 3));
    }
 }
 
 static void
-store_aos(LLVMBuilderRef builder,
+store_aos(struct gallivm_state *gallivm,
           LLVMValueRef io_ptr,
           LLVMValueRef index,
           LLVMValueRef value,
           LLVMValueRef clipmask)
 {
-   LLVMValueRef id_ptr = draw_jit_header_id(builder, io_ptr);
-   LLVMValueRef data_ptr = draw_jit_header_data(builder, io_ptr);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMValueRef id_ptr = draw_jit_header_id(gallivm, io_ptr);
+   LLVMValueRef data_ptr = draw_jit_header_data(gallivm, io_ptr);
    LLVMValueRef indices[3];
    LLVMValueRef val, shift;
 
-   indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   indices[0] = lp_build_const_int32(gallivm, 0);
    indices[1] = index;
-   indices[2] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   indices[2] = lp_build_const_int32(gallivm, 0);
 
    /* initialize vertex id:16 = 0xffff, pad:3 = 0, edgeflag:1 = 1 */
-   val = LLVMConstInt(LLVMInt32Type(), 0xffff1, 0); 
-   shift  = LLVMConstInt(LLVMInt32Type(), 12, 0);          
+   val = lp_build_const_int32(gallivm, 0xffff1);
+   shift = lp_build_const_int32(gallivm, 12);
    val = LLVMBuildShl(builder, val, shift, "");
    /* add clipmask:12 */   
    val = LLVMBuildOr(builder, val, clipmask, "");               
@@ -582,7 +685,7 @@ store_aos(LLVMBuilderRef builder,
    /*lp_build_printf(builder, " ---- %p storing at %d (%p)  ", io_ptr, index, data_ptr);
      print_vectorf(builder, value);*/
    data_ptr = LLVMBuildBitCast(builder, data_ptr,
-                               LLVMPointerType(LLVMArrayType(LLVMVectorType(LLVMFloatType(), 4), 0), 0),
+                               LLVMPointerType(LLVMArrayType(LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4), 0), 0),
                                "datavec");
    data_ptr = LLVMBuildGEP(builder, data_ptr, indices, 2, "");
 
@@ -594,10 +697,10 @@ store_aos(LLVMBuilderRef builder,
       LLVMValueRef gep0, gep1, gep2, gep3;
       data_ptr = LLVMBuildGEP(builder, data_ptr, indices, 3, "");
 
-      idx0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
-      idx1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
-      idx2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
-      idx3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
+      idx0 = lp_build_const_int32(gallivm, 0);
+      idx1 = lp_build_const_int32(gallivm, 1);
+      idx2 = lp_build_const_int32(gallivm, 2);
+      idx3 = lp_build_const_int32(gallivm, 3);
 
       x = LLVMBuildExtractElement(builder, value,
                                   idx0, "");
@@ -624,18 +727,19 @@ store_aos(LLVMBuilderRef builder,
 }
 
 static void
-store_aos_array(LLVMBuilderRef builder,
+store_aos_array(struct gallivm_state *gallivm,
                 LLVMValueRef io_ptr,
                 LLVMValueRef aos[NUM_CHANNELS],
                 int attrib,
                 int num_outputs,
                 LLVMValueRef clipmask)
 {
-   LLVMValueRef attr_index = LLVMConstInt(LLVMInt32Type(), attrib, 0);
-   LLVMValueRef ind0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   LLVMValueRef ind1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
-   LLVMValueRef ind2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
-   LLVMValueRef ind3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMValueRef attr_index = lp_build_const_int32(gallivm, attrib);
+   LLVMValueRef ind0 = lp_build_const_int32(gallivm, 0);
+   LLVMValueRef ind1 = lp_build_const_int32(gallivm, 1);
+   LLVMValueRef ind2 = lp_build_const_int32(gallivm, 2);
+   LLVMValueRef ind3 = lp_build_const_int32(gallivm, 3);
    LLVMValueRef io0_ptr, io1_ptr, io2_ptr, io3_ptr;
    LLVMValueRef clipmask0, clipmask1, clipmask2, clipmask3;
    
@@ -664,20 +768,21 @@ store_aos_array(LLVMBuilderRef builder,
                    io_ptr, ind0, ind1, ind2, ind3, clipmask0, clipmask1, clipmask2, clipmask3);
 #endif
    /* store for each of the 4 vertices */
-   store_aos(builder, io0_ptr, attr_index, aos[0], clipmask0);
-   store_aos(builder, io1_ptr, attr_index, aos[1], clipmask1);
-   store_aos(builder, io2_ptr, attr_index, aos[2], clipmask2);
-   store_aos(builder, io3_ptr, attr_index, aos[3], clipmask3);
+   store_aos(gallivm, io0_ptr, attr_index, aos[0], clipmask0);
+   store_aos(gallivm, io1_ptr, attr_index, aos[1], clipmask1);
+   store_aos(gallivm, io2_ptr, attr_index, aos[2], clipmask2);
+   store_aos(gallivm, io3_ptr, attr_index, aos[3], clipmask3);
 }
 
 static void
-convert_to_aos(LLVMBuilderRef builder,
+convert_to_aos(struct gallivm_state *gallivm,
                LLVMValueRef io,
                LLVMValueRef (*outputs)[NUM_CHANNELS],
                LLVMValueRef clipmask,
                int num_outputs,
                int max_vertices)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    unsigned chan, attrib;
 
 #if DEBUG_STORE
@@ -698,8 +803,8 @@ convert_to_aos(LLVMBuilderRef builder,
          } else
             soa[chan] = 0;
       }
-      soa_to_aos(builder, soa, aos);
-      store_aos_array(builder,
+      soa_to_aos(gallivm, soa, aos);
+      store_aos_array(gallivm,
                       io,
                       aos,
                       attrib,
@@ -717,10 +822,11 @@ convert_to_aos(LLVMBuilderRef builder,
  * rather than extracting each element one by one.
  */
 static void
-store_clip(LLVMBuilderRef builder,
+store_clip(struct gallivm_state *gallivm,
            LLVMValueRef io_ptr,           
            LLVMValueRef (*outputs)[NUM_CHANNELS])
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef out[4];
    LLVMValueRef indices[2]; 
    LLVMValueRef io0_ptr, io1_ptr, io2_ptr, io3_ptr;
@@ -729,13 +835,13 @@ store_clip(LLVMBuilderRef builder,
    LLVMValueRef out0elem, out1elem, out2elem, out3elem;
    int i;
 
-   LLVMValueRef ind0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   LLVMValueRef ind1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
-   LLVMValueRef ind2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
-   LLVMValueRef ind3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
+   LLVMValueRef ind0 = lp_build_const_int32(gallivm, 0);
+   LLVMValueRef ind1 = lp_build_const_int32(gallivm, 1);
+   LLVMValueRef ind2 = lp_build_const_int32(gallivm, 2);
+   LLVMValueRef ind3 = lp_build_const_int32(gallivm, 3);
    
-   indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   indices[1] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   indices[0] =
+   indices[1] = lp_build_const_int32(gallivm, 0);
    
    out[0] = LLVMBuildLoad(builder, outputs[0][0], ""); /*x0 x1 x2 x3*/
    out[1] = LLVMBuildLoad(builder, outputs[0][1], ""); /*y0 y1 y2 y3*/
@@ -747,29 +853,21 @@ store_clip(LLVMBuilderRef builder,
    io2_ptr = LLVMBuildGEP(builder, io_ptr, &ind2, 1, "");
    io3_ptr = LLVMBuildGEP(builder, io_ptr, &ind3, 1, "");
 
-   clip_ptr0 = draw_jit_header_clip(builder, io0_ptr);
-   clip_ptr1 = draw_jit_header_clip(builder, io1_ptr);
-   clip_ptr2 = draw_jit_header_clip(builder, io2_ptr);
-   clip_ptr3 = draw_jit_header_clip(builder, io3_ptr);
+   clip_ptr0 = draw_jit_header_clip(gallivm, io0_ptr);
+   clip_ptr1 = draw_jit_header_clip(gallivm, io1_ptr);
+   clip_ptr2 = draw_jit_header_clip(gallivm, io2_ptr);
+   clip_ptr3 = draw_jit_header_clip(gallivm, io3_ptr);
 
    for (i = 0; i<4; i++){
-      clip0_ptr = LLVMBuildGEP(builder, clip_ptr0,
-                               indices, 2, ""); //x0
-      clip1_ptr = LLVMBuildGEP(builder, clip_ptr1,
-                               indices, 2, ""); //x1
-      clip2_ptr = LLVMBuildGEP(builder, clip_ptr2,
-                               indices, 2, ""); //x2
-      clip3_ptr = LLVMBuildGEP(builder, clip_ptr3,
-                               indices, 2, ""); //x3
-
-      out0elem = LLVMBuildExtractElement(builder, out[i],
-                                         ind0, ""); //x0
-      out1elem = LLVMBuildExtractElement(builder, out[i],
-                                         ind1, ""); //x1
-      out2elem = LLVMBuildExtractElement(builder, out[i],
-                                         ind2, ""); //x2
-      out3elem = LLVMBuildExtractElement(builder, out[i],
-                                         ind3, ""); //x3
+      clip0_ptr = LLVMBuildGEP(builder, clip_ptr0, indices, 2, ""); /* x0 */
+      clip1_ptr = LLVMBuildGEP(builder, clip_ptr1, indices, 2, ""); /* x1 */
+      clip2_ptr = LLVMBuildGEP(builder, clip_ptr2, indices, 2, ""); /* x2 */
+      clip3_ptr = LLVMBuildGEP(builder, clip_ptr3, indices, 2, ""); /* x3 */
+
+      out0elem = LLVMBuildExtractElement(builder, out[i], ind0, ""); /* x0 */
+      out1elem = LLVMBuildExtractElement(builder, out[i], ind1, ""); /* x1 */
+      out2elem = LLVMBuildExtractElement(builder, out[i], ind2, ""); /* x2 */
+      out3elem = LLVMBuildExtractElement(builder, out[i], ind3, ""); /* x3 */
   
       LLVMBuildStore(builder, out0elem, clip0_ptr);
       LLVMBuildStore(builder, out1elem, clip1_ptr);
@@ -783,16 +881,19 @@ store_clip(LLVMBuilderRef builder,
 
 /* Equivalent of _mm_set1_ps(a)
  */
-static LLVMValueRef vec4f_from_scalar(LLVMBuilderRef bld,
-                                     LLVMValueRef a,
-                                     const char *name)
+static LLVMValueRef
+vec4f_from_scalar(struct gallivm_state *gallivm,
+                  LLVMValueRef a,
+                  const char *name)
 {
-   LLVMValueRef res = LLVMGetUndef(LLVMVectorType(LLVMFloatType(), 4));
+   LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
+   LLVMValueRef res = LLVMGetUndef(LLVMVectorType(float_type, 4));
    int i;
 
    for(i = 0; i < 4; ++i) {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
-      res = LLVMBuildInsertElement(bld, res, a, index, i == 3 ? name : "");
+      LLVMValueRef index = lp_build_const_int32(gallivm, i);
+      res = LLVMBuildInsertElement(gallivm->builder, res, a,
+                                   index, i == 3 ? name : "");
    }
 
    return res;
@@ -808,10 +909,11 @@ generate_viewport(struct draw_llvm *llvm,
                   LLVMValueRef context_ptr)
 {
    int i;
+   struct gallivm_state *gallivm = llvm->gallivm;
    struct lp_type f32_type = lp_type_float_vec(32);
    LLVMValueRef out3 = LLVMBuildLoad(builder, outputs[0][3], ""); /*w0 w1 w2 w3*/   
-   LLVMValueRef const1 = lp_build_const_vec(f32_type, 1.0);       /*1.0 1.0 1.0 1.0*/ 
-   LLVMValueRef vp_ptr = draw_jit_context_viewport(builder, context_ptr);
+   LLVMValueRef const1 = lp_build_const_vec(gallivm, f32_type, 1.0);       /*1.0 1.0 1.0 1.0*/ 
+   LLVMValueRef vp_ptr = draw_jit_context_viewport(gallivm, context_ptr);
 
    /* for 1/w convention*/
    out3 = LLVMBuildFDiv(builder, const1, out3, "");
@@ -826,14 +928,14 @@ generate_viewport(struct draw_llvm *llvm,
       LLVMValueRef trans_i;
       LLVMValueRef index;
       
-      index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      index = lp_build_const_int32(gallivm, i);
       scale_i = LLVMBuildGEP(builder, vp_ptr, &index, 1, "");
 
-      index = LLVMConstInt(LLVMInt32Type(), i+4, 0);
+      index = lp_build_const_int32(gallivm, i+4);
       trans_i = LLVMBuildGEP(builder, vp_ptr, &index, 1, "");
 
-      scale = vec4f_from_scalar(builder, LLVMBuildLoad(builder, scale_i, ""), "scale");
-      trans = vec4f_from_scalar(builder, LLVMBuildLoad(builder, trans_i, ""), "trans");
+      scale = vec4f_from_scalar(gallivm, LLVMBuildLoad(builder, scale_i, ""), "scale");
+      trans = vec4f_from_scalar(gallivm, LLVMBuildLoad(builder, trans_i, ""), "trans");
 
       /* divide by w */
       out = LLVMBuildFMul(builder, out, out3, "");
@@ -853,7 +955,7 @@ generate_viewport(struct draw_llvm *llvm,
  * Returns clipmask as 4xi32 bitmask for the 4 vertices
  */
 static LLVMValueRef 
-generate_clipmask(LLVMBuilderRef builder,
+generate_clipmask(struct gallivm_state *gallivm,
                   LLVMValueRef (*outputs)[NUM_CHANNELS],
                   boolean clip_xy,
                   boolean clip_z,
@@ -862,6 +964,7 @@ generate_clipmask(LLVMBuilderRef builder,
                   unsigned nr,
                   LLVMValueRef context_ptr)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef mask; /* stores the <4xi32> clipmasks */     
    LLVMValueRef test, temp; 
    LLVMValueRef zero, shift;
@@ -872,10 +975,10 @@ generate_clipmask(LLVMBuilderRef builder,
 
    struct lp_type f32_type = lp_type_float_vec(32); 
 
-   mask = lp_build_const_int_vec(lp_type_int_vec(32), 0);
-   temp = lp_build_const_int_vec(lp_type_int_vec(32), 0);
-   zero = lp_build_const_vec(f32_type, 0);                    /* 0.0f 0.0f 0.0f 0.0f */
-   shift = lp_build_const_int_vec(lp_type_int_vec(32), 1);    /* 1 1 1 1 */
+   mask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
+   temp = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
+   zero = lp_build_const_vec(gallivm, f32_type, 0);                    /* 0.0f 0.0f 0.0f 0.0f */
+   shift = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 1);    /* 1 1 1 1 */
 
    /* Assuming position stored at output[0] */
    pos_x = LLVMBuildLoad(builder, outputs[0][0], ""); /*x0 x1 x2 x3*/
@@ -886,92 +989,92 @@ generate_clipmask(LLVMBuilderRef builder,
    /* Cliptest, for hardwired planes */
    if (clip_xy){
       /* plane 1 */
-      test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, pos_x , pos_w);
+      test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_x , pos_w);
       temp = shift;
       test = LLVMBuildAnd(builder, test, temp, ""); 
       mask = test;
    
       /* plane 2 */
       test = LLVMBuildFAdd(builder, pos_x, pos_w, "");
-      test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, zero, test);
+      test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
       temp = LLVMBuildShl(builder, temp, shift, "");
       test = LLVMBuildAnd(builder, test, temp, ""); 
       mask = LLVMBuildOr(builder, mask, test, "");
    
       /* plane 3 */
-      test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, pos_y, pos_w);
+      test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_y, pos_w);
       temp = LLVMBuildShl(builder, temp, shift, "");
       test = LLVMBuildAnd(builder, test, temp, ""); 
       mask = LLVMBuildOr(builder, mask, test, "");
 
       /* plane 4 */
       test = LLVMBuildFAdd(builder, pos_y, pos_w, "");
-      test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, zero, test);
+      test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
       temp = LLVMBuildShl(builder, temp, shift, "");
       test = LLVMBuildAnd(builder, test, temp, ""); 
       mask = LLVMBuildOr(builder, mask, test, "");
    }
 
    if (clip_z){
-      temp = lp_build_const_int_vec(lp_type_int_vec(32), 16);
+      temp = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 16);
       if (clip_halfz){
          /* plane 5 */
-         test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, zero, pos_z);
+         test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, pos_z);
          test = LLVMBuildAnd(builder, test, temp, ""); 
          mask = LLVMBuildOr(builder, mask, test, "");
       }  
       else{
          /* plane 5 */
          test = LLVMBuildFAdd(builder, pos_z, pos_w, "");
-         test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, zero, test);
+         test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
          test = LLVMBuildAnd(builder, test, temp, ""); 
          mask = LLVMBuildOr(builder, mask, test, "");
       }
       /* plane 6 */
-      test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, pos_z, pos_w);
+      test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_z, pos_w);
       temp = LLVMBuildShl(builder, temp, shift, "");
       test = LLVMBuildAnd(builder, test, temp, ""); 
       mask = LLVMBuildOr(builder, mask, test, "");
    }   
 
    if (clip_user){
-      LLVMValueRef planes_ptr = draw_jit_context_planes(builder, context_ptr);
+      LLVMValueRef planes_ptr = draw_jit_context_planes(gallivm, context_ptr);
       LLVMValueRef indices[3];
-      temp = lp_build_const_int_vec(lp_type_int_vec(32), 32);
+      temp = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 32);
 
       /* userclip planes */
       for (i = 6; i < nr; i++) {
-         indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
-         indices[1] = LLVMConstInt(LLVMInt32Type(), i, 0);
+         indices[0] = lp_build_const_int32(gallivm, 0);
+         indices[1] = lp_build_const_int32(gallivm, i);
 
-         indices[2] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+         indices[2] = lp_build_const_int32(gallivm, 0);
          plane_ptr = LLVMBuildGEP(builder, planes_ptr, indices, 3, "");
          plane1 = LLVMBuildLoad(builder, plane_ptr, "plane_x");
-         planes = vec4f_from_scalar(builder, plane1, "plane4_x");
+         planes = vec4f_from_scalar(gallivm, plane1, "plane4_x");
          sum = LLVMBuildFMul(builder, planes, pos_x, "");
 
-         indices[2] = LLVMConstInt(LLVMInt32Type(), 1, 0);
+         indices[2] = lp_build_const_int32(gallivm, 1);
          plane_ptr = LLVMBuildGEP(builder, planes_ptr, indices, 3, "");
          plane1 = LLVMBuildLoad(builder, plane_ptr, "plane_y"); 
-         planes = vec4f_from_scalar(builder, plane1, "plane4_y");
+         planes = vec4f_from_scalar(gallivm, plane1, "plane4_y");
          test = LLVMBuildFMul(builder, planes, pos_y, "");
          sum = LLVMBuildFAdd(builder, sum, test, "");
          
-         indices[2] = LLVMConstInt(LLVMInt32Type(), 2, 0);
+         indices[2] = lp_build_const_int32(gallivm, 2);
          plane_ptr = LLVMBuildGEP(builder, planes_ptr, indices, 3, "");
          plane1 = LLVMBuildLoad(builder, plane_ptr, "plane_z"); 
-         planes = vec4f_from_scalar(builder, plane1, "plane4_z");
+         planes = vec4f_from_scalar(gallivm, plane1, "plane4_z");
          test = LLVMBuildFMul(builder, planes, pos_z, "");
          sum = LLVMBuildFAdd(builder, sum, test, "");
 
-         indices[2] = LLVMConstInt(LLVMInt32Type(), 3, 0);
+         indices[2] = lp_build_const_int32(gallivm, 3);
          plane_ptr = LLVMBuildGEP(builder, planes_ptr, indices, 3, "");
          plane1 = LLVMBuildLoad(builder, plane_ptr, "plane_w"); 
-         planes = vec4f_from_scalar(builder, plane1, "plane4_w");
+         planes = vec4f_from_scalar(gallivm, plane1, "plane4_w");
          test = LLVMBuildFMul(builder, planes, pos_w, "");
          sum = LLVMBuildFAdd(builder, sum, test, "");
 
-         test = lp_build_compare(builder, f32_type, PIPE_FUNC_GREATER, zero, sum);
+         test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, sum);
          temp = LLVMBuildShl(builder, temp, shift, "");
          test = LLVMBuildAnd(builder, test, temp, ""); 
          mask = LLVMBuildOr(builder, mask, test, "");
@@ -985,17 +1088,18 @@ generate_clipmask(LLVMBuilderRef builder,
  * Used zero/non-zero i32 value to represent boolean 
  */
 static void
-clipmask_bool(LLVMBuilderRef builder, 
+clipmask_bool(struct gallivm_state *gallivm,
               LLVMValueRef clipmask,
               LLVMValueRef ret_ptr)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef ret = LLVMBuildLoad(builder, ret_ptr, "");   
    LLVMValueRef temp;
    int i;
 
    for (i=0; i<4; i++){   
       temp = LLVMBuildExtractElement(builder, clipmask,
-                                     LLVMConstInt(LLVMInt32Type(), i, 0) , "");
+                                     lp_build_const_int32(gallivm, i) , "");
       ret = LLVMBuildOr(builder, ret, temp, "");
    }
    
@@ -1005,6 +1109,9 @@ clipmask_bool(LLVMBuilderRef builder,
 static void
 draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
 {
+   struct gallivm_state *gallivm = llvm->gallivm;
+   LLVMContextRef context = gallivm->context;
+   LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
    LLVMTypeRef arg_types[8];
    LLVMTypeRef func_type;
    LLVMValueRef context_ptr;
@@ -1029,18 +1136,19 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
                              variant->key.clip_z  ||
                              variant->key.clip_user;
    
-   arg_types[0] = llvm->context_ptr_type;           /* context */
-   arg_types[1] = llvm->vertex_header_ptr_type;     /* vertex_header */
-   arg_types[2] = llvm->buffer_ptr_type;            /* vbuffers */
-   arg_types[3] = LLVMInt32Type();                  /* start */
-   arg_types[4] = LLVMInt32Type();                  /* count */
-   arg_types[5] = LLVMInt32Type();                  /* stride */
-   arg_types[6] = llvm->vb_ptr_type;                /* pipe_vertex_buffer's */
-   arg_types[7] = LLVMInt32Type();                  /* instance_id */
-
-   func_type = LLVMFunctionType(LLVMInt32Type(), arg_types, Elements(arg_types), 0);
-
-   variant->function = LLVMAddFunction(llvm->module, "draw_llvm_shader", func_type);
+   arg_types[0] = get_context_ptr_type(llvm);       /* context */
+   arg_types[1] = get_vertex_header_ptr_type(llvm); /* vertex_header */
+   arg_types[2] = get_buffer_ptr_type(llvm);        /* vbuffers */
+   arg_types[3] = int32_type;                       /* start */
+   arg_types[4] = int32_type;                       /* count */
+   arg_types[5] = int32_type;                       /* stride */
+   arg_types[6] = get_vb_ptr_type(llvm);            /* pipe_vertex_buffer's */
+   arg_types[7] = int32_type;                       /* instance_id */
+
+   func_type = LLVMFunctionType(int32_type, arg_types, Elements(arg_types), 0);
+
+   variant->function = LLVMAddFunction(gallivm->module, "draw_llvm_shader",
+                                       func_type);
    LLVMSetFunctionCallConv(variant->function, LLVMCCallConv);
    for(i = 0; i < Elements(arg_types); ++i)
       if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
@@ -1068,22 +1176,23 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
     * Function body
     */
 
-   block = LLVMAppendBasicBlock(variant->function, "entry");
-   builder = LLVMCreateBuilder();
+   block = LLVMAppendBasicBlockInContext(gallivm->context, variant->function, "entry");
+   builder = gallivm->builder;
+   assert(builder);
    LLVMPositionBuilderAtEnd(builder, block);
 
-   lp_build_context_init(&bld, builder, lp_type_int(32));
+   lp_build_context_init(&bld, llvm->gallivm, lp_type_int(32));
 
-   system_values_array = lp_build_system_values_array(builder, vs_info,
+   system_values_array = lp_build_system_values_array(gallivm, vs_info,
                                                       instance_id, NULL);
 
    end = lp_build_add(&bld, start, count);
 
-   step = LLVMConstInt(LLVMInt32Type(), max_vertices, 0);
+   step = lp_build_const_int32(gallivm, max_vertices);
 
    /* function will return non-zero i32 value if any clipped vertices */     
-   ret_ptr = lp_build_alloca(builder, LLVMInt32Type(), "");   
-   LLVMBuildStore(builder, LLVMConstInt(LLVMInt32Type(), 0, 0), ret_ptr);
+   ret_ptr = lp_build_alloca(gallivm, int32_type, "");   
+   LLVMBuildStore(builder, lp_build_const_int32(gallivm, 0), ret_ptr);
 
    /* code generated texture sampling */
    sampler = draw_llvm_sampler_soa_create(
@@ -1094,7 +1203,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
    lp_build_printf(builder, "start = %d, end = %d, step = %d\n",
                    start, end, step);
 #endif
-   lp_build_loop_begin(builder, start, &lp_loop);
+   lp_build_loop_begin(&lp_loop, llvm->gallivm, start);
    {
       LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
       LLVMValueRef aos_attribs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS] = { { 0 } };
@@ -1112,20 +1221,18 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
          LLVMValueRef true_index = LLVMBuildAdd(
             builder,
             lp_loop.counter,
-            LLVMConstInt(LLVMInt32Type(), i, 0), "");
+            lp_build_const_int32(gallivm, i), "");
          for (j = 0; j < draw->pt.nr_vertex_elements; ++j) {
             struct pipe_vertex_element *velem = &draw->pt.vertex_element[j];
-            LLVMValueRef vb_index = LLVMConstInt(LLVMInt32Type(),
-                                                 velem->vertex_buffer_index,
-                                                 0);
+            LLVMValueRef vb_index = lp_build_const_int32(gallivm, velem->vertex_buffer_index);
             LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr,
                                            &vb_index, 1, "");
-            generate_fetch(builder, vbuffers_ptr,
+            generate_fetch(llvm->gallivm, vbuffers_ptr,
                            &aos_attribs[j][i], velem, vb, true_index,
                            instance_id);
          }
       }
-      convert_to_soa(builder, aos_attribs, inputs,
+      convert_to_soa(gallivm, aos_attribs, inputs,
                      draw->pt.nr_vertex_elements);
 
       ptr_aos = (const LLVMValueRef (*)[NUM_CHANNELS]) inputs;
@@ -1138,12 +1245,12 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
                   sampler);
 
       /* store original positions in clip before further manipulation */
-      store_clip(builder, io, outputs);
+      store_clip(gallivm, io, outputs);
 
       /* do cliptest */
       if (enable_cliptest){
          /* allocate clipmask, assign it integer type */
-         clipmask = generate_clipmask(builder, outputs,
+         clipmask = generate_clipmask(gallivm, outputs,
                                       variant->key.clip_xy,
                                       variant->key.clip_z, 
                                       variant->key.clip_user,
@@ -1151,10 +1258,10 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
                                       variant->key.nr_planes,
                                       context_ptr);
          /* return clipping boolean value for function */
-         clipmask_bool(builder, clipmask, ret_ptr);
+         clipmask_bool(gallivm, clipmask, ret_ptr);
       }
       else{
-         clipmask = lp_build_const_int_vec(lp_type_int_vec(32), 0);    
+         clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);    
       }
       
       /* do viewport mapping */
@@ -1163,19 +1270,17 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
       }
 
       /* store clipmask in vertex header and positions in data */
-      convert_to_aos(builder, io, outputs, clipmask,
+      convert_to_aos(gallivm, io, outputs, clipmask,
                      vs_info->num_outputs, max_vertices);
    }
 
-   lp_build_loop_end_cond(builder, end, step, LLVMIntUGE, &lp_loop);
+   lp_build_loop_end_cond(&lp_loop, end, step, LLVMIntUGE);
 
    sampler->destroy(sampler);
 
    ret = LLVMBuildLoad(builder, ret_ptr,"");
    LLVMBuildRet(builder, ret);
       
-   LLVMDisposeBuilder(builder);
-
    /*
     * Translate the LLVM IR into machine code.
     */
@@ -1186,14 +1291,14 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
    }
 #endif
 
-   LLVMRunFunctionPassManager(llvm->pass, variant->function);
+   LLVMRunFunctionPassManager(gallivm->passmgr, variant->function);
 
    if (gallivm_debug & GALLIVM_DEBUG_IR) {
       lp_debug_dump_value(variant->function);
       debug_printf("\n");
    }
 
-   code = LLVMGetPointerToGlobal(llvm->draw->engine, variant->function);
+   code = LLVMGetPointerToGlobal(gallivm->engine, variant->function);
    variant->jit_func = (draw_jit_vert_func)pointer_to_func(code);
 
    if (gallivm_debug & GALLIVM_DEBUG_ASM) {
@@ -1206,6 +1311,9 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
 static void
 draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
 {
+   struct gallivm_state *gallivm = llvm->gallivm;
+   LLVMContextRef context = gallivm->context;
+   LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
    LLVMTypeRef arg_types[8];
    LLVMTypeRef func_type;
    LLVMValueRef context_ptr;
@@ -1231,18 +1339,18 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
                              variant->key.clip_z  ||
                              variant->key.clip_user;
    
-   arg_types[0] = llvm->context_ptr_type;               /* context */
-   arg_types[1] = llvm->vertex_header_ptr_type;         /* vertex_header */
-   arg_types[2] = llvm->buffer_ptr_type;                /* vbuffers */
-   arg_types[3] = LLVMPointerType(LLVMInt32Type(), 0);  /* fetch_elts * */
-   arg_types[4] = LLVMInt32Type();                      /* fetch_count */
-   arg_types[5] = LLVMInt32Type();                      /* stride */
-   arg_types[6] = llvm->vb_ptr_type;                    /* pipe_vertex_buffer's */
-   arg_types[7] = LLVMInt32Type();                      /* instance_id */
-
-   func_type = LLVMFunctionType(LLVMInt32Type(), arg_types, Elements(arg_types), 0);
-
-   variant->function_elts = LLVMAddFunction(llvm->module, "draw_llvm_shader_elts", func_type);
+   arg_types[0] = get_context_ptr_type(llvm);           /* context */
+   arg_types[1] = get_vertex_header_ptr_type(llvm);     /* vertex_header */
+   arg_types[2] = get_buffer_ptr_type(llvm);            /* vbuffers */
+   arg_types[3] = LLVMPointerType(int32_type, 0);       /* fetch_elts * */
+   arg_types[4] = int32_type;                           /* fetch_count */
+   arg_types[5] = int32_type;                           /* stride */
+   arg_types[6] = get_vb_ptr_type(llvm);                /* pipe_vertex_buffer's */
+   arg_types[7] = int32_type;                           /* instance_id */
+
+   func_type = LLVMFunctionType(int32_type, arg_types, Elements(arg_types), 0);
+
+   variant->function_elts = LLVMAddFunction(gallivm->module, "draw_llvm_shader_elts", func_type);
    LLVMSetFunctionCallConv(variant->function_elts, LLVMCCallConv);
    for(i = 0; i < Elements(arg_types); ++i)
       if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
@@ -1271,17 +1379,17 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
     * Function body
     */
 
-   block = LLVMAppendBasicBlock(variant->function_elts, "entry");
-   builder = LLVMCreateBuilder();
+   block = LLVMAppendBasicBlockInContext(gallivm->context, variant->function_elts, "entry");
+   builder = gallivm->builder;
    LLVMPositionBuilderAtEnd(builder, block);
 
-   lp_build_context_init(&bld, builder, lp_type_int(32));
+   lp_build_context_init(&bld, gallivm, lp_type_int(32));
 
-   system_values_array = lp_build_system_values_array(builder, vs_info,
+   system_values_array = lp_build_system_values_array(gallivm, vs_info,
                                                       instance_id, NULL);
 
 
-   step = LLVMConstInt(LLVMInt32Type(), max_vertices, 0);
+   step = lp_build_const_int32(gallivm, max_vertices);
 
    /* code generated texture sampling */
    sampler = draw_llvm_sampler_soa_create(
@@ -1289,14 +1397,14 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
       context_ptr);
 
    fetch_max = LLVMBuildSub(builder, fetch_count,
-                            LLVMConstInt(LLVMInt32Type(), 1, 0),
+                            lp_build_const_int32(gallivm, 1),
                             "fetch_max");
 
    /* function returns non-zero i32 value if any clipped vertices */
-   ret_ptr = lp_build_alloca(builder, LLVMInt32Type(), ""); 
-   LLVMBuildStore(builder, LLVMConstInt(LLVMInt32Type(), 0, 0), ret_ptr);
+   ret_ptr = lp_build_alloca(gallivm, int32_type, ""); 
+   LLVMBuildStore(builder, lp_build_const_int32(gallivm, 0), ret_ptr);
 
-   lp_build_loop_begin(builder, LLVMConstInt(LLVMInt32Type(), 0, 0), &lp_loop);
+   lp_build_loop_begin(&lp_loop, gallivm, lp_build_const_int32(gallivm, 0));
    {
       LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
       LLVMValueRef aos_attribs[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS] = { { 0 } };
@@ -1314,7 +1422,7 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
          LLVMValueRef true_index = LLVMBuildAdd(
             builder,
             lp_loop.counter,
-            LLVMConstInt(LLVMInt32Type(), i, 0), "");
+            lp_build_const_int32(gallivm, i), "");
          LLVMValueRef fetch_ptr;
 
          /* make sure we're not out of bounds which can happen
@@ -1327,17 +1435,15 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
          true_index = LLVMBuildLoad(builder, fetch_ptr, "fetch_elt");
          for (j = 0; j < draw->pt.nr_vertex_elements; ++j) {
             struct pipe_vertex_element *velem = &draw->pt.vertex_element[j];
-            LLVMValueRef vb_index = LLVMConstInt(LLVMInt32Type(),
-                                                 velem->vertex_buffer_index,
-                                                 0);
+            LLVMValueRef vb_index = lp_build_const_int32(gallivm, velem->vertex_buffer_index);
             LLVMValueRef vb = LLVMBuildGEP(builder, vb_ptr,
                                            &vb_index, 1, "");
-            generate_fetch(builder, vbuffers_ptr,
+            generate_fetch(gallivm, vbuffers_ptr,
                            &aos_attribs[j][i], velem, vb, true_index,
                            instance_id);
          }
       }
-      convert_to_soa(builder, aos_attribs, inputs,
+      convert_to_soa(gallivm, aos_attribs, inputs,
                      draw->pt.nr_vertex_elements);
 
       ptr_aos = (const LLVMValueRef (*)[NUM_CHANNELS]) inputs;
@@ -1350,12 +1456,12 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
                   sampler);
 
       /* store original positions in clip before further manipulation */
-      store_clip(builder, io, outputs);
+      store_clip(gallivm, io, outputs);
 
       /* do cliptest */
       if (enable_cliptest){
          /* allocate clipmask, assign it integer type */
-         clipmask = generate_clipmask(builder, outputs,
+         clipmask = generate_clipmask(gallivm, outputs,
                                       variant->key.clip_xy,
                                       variant->key.clip_z, 
                                       variant->key.clip_user,
@@ -1363,10 +1469,10 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
                                       variant->key.nr_planes,
                                       context_ptr);
          /* return clipping boolean value for function */
-         clipmask_bool(builder, clipmask, ret_ptr);
+         clipmask_bool(gallivm, clipmask, ret_ptr);
       }
       else{
-         clipmask = lp_build_const_int_vec(lp_type_int_vec(32), 0);
+         clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
       }
       
       /* do viewport mapping */
@@ -1378,19 +1484,17 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
        * original positions in clip 
        * and transformed positions in data 
        */   
-      convert_to_aos(builder, io, outputs, clipmask,
+      convert_to_aos(gallivm, io, outputs, clipmask,
                      vs_info->num_outputs, max_vertices);
    }
 
-   lp_build_loop_end_cond(builder, fetch_count, step, LLVMIntUGE, &lp_loop);
+   lp_build_loop_end_cond(&lp_loop, fetch_count, step, LLVMIntUGE);
 
    sampler->destroy(sampler);
 
    ret = LLVMBuildLoad(builder, ret_ptr,"");   
    LLVMBuildRet(builder, ret);
    
-   LLVMDisposeBuilder(builder);
-
    /*
     * Translate the LLVM IR into machine code.
     */
@@ -1401,14 +1505,14 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
    }
 #endif
 
-   LLVMRunFunctionPassManager(llvm->pass, variant->function_elts);
+   LLVMRunFunctionPassManager(gallivm->passmgr, variant->function_elts);
 
    if (gallivm_debug & GALLIVM_DEBUG_IR) {
       lp_debug_dump_value(variant->function_elts);
       debug_printf("\n");
    }
 
-   code = LLVMGetPointerToGlobal(llvm->draw->engine, variant->function_elts);
+   code = LLVMGetPointerToGlobal(gallivm->engine, variant->function_elts);
    variant->jit_func_elts = (draw_jit_vert_func_elts)pointer_to_func(code);
 
    if (gallivm_debug & GALLIVM_DEBUG_ASM) {
@@ -1517,19 +1621,16 @@ void
 draw_llvm_destroy_variant(struct draw_llvm_variant *variant)
 {
    struct draw_llvm *llvm = variant->llvm;
-   struct draw_context *draw = llvm->draw;
 
    if (variant->function_elts) {
-      if (variant->function_elts)
-         LLVMFreeMachineCodeForFunction(draw->engine,
-                                        variant->function_elts);
+      LLVMFreeMachineCodeForFunction(llvm->gallivm->engine,
+                                     variant->function_elts);
       LLVMDeleteFunction(variant->function_elts);
    }
 
    if (variant->function) {
-      if (variant->function)
-         LLVMFreeMachineCodeForFunction(draw->engine,
-                                        variant->function);
+      LLVMFreeMachineCodeForFunction(llvm->gallivm->engine,
+                                     variant->function);
       LLVMDeleteFunction(variant->function);
    }
 
index c3c30c07c644d34396aab016bfe624b2d594245d..9f038f1f04d641f9e4d69f5ddbb154188eef20eb 100644 (file)
@@ -103,41 +103,41 @@ struct draw_jit_context
 };
 
 
-#define draw_jit_context_vs_constants(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 0, "vs_constants")
+#define draw_jit_context_vs_constants(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, 0, "vs_constants")
 
-#define draw_jit_context_gs_constants(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 1, "gs_constants")
+#define draw_jit_context_gs_constants(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, 1, "gs_constants")
 
-#define draw_jit_context_planes(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 2, "planes")
+#define draw_jit_context_planes(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, 2, "planes")
 
-#define draw_jit_context_viewport(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 3, "viewport")
+#define draw_jit_context_viewport(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, 3, "viewport")
 
 #define DRAW_JIT_CTX_TEXTURES 4
 
-#define draw_jit_context_textures(_builder, _ptr) \
-   lp_build_struct_get_ptr(_builder, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
+#define draw_jit_context_textures(_gallivm, _ptr) \
+   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
 
-#define draw_jit_header_id(_builder, _ptr)              \
-   lp_build_struct_get_ptr(_builder, _ptr, 0, "id")
+#define draw_jit_header_id(_gallivm, _ptr)              \
+   lp_build_struct_get_ptr(_gallivm, _ptr, 0, "id")
 
-#define draw_jit_header_clip(_builder, _ptr) \
-   lp_build_struct_get_ptr(_builder, _ptr, 1, "clip")
+#define draw_jit_header_clip(_gallivm, _ptr) \
+   lp_build_struct_get_ptr(_gallivm, _ptr, 1, "clip")
 
-#define draw_jit_header_data(_builder, _ptr)            \
-   lp_build_struct_get_ptr(_builder, _ptr, 2, "data")
+#define draw_jit_header_data(_gallivm, _ptr)            \
+   lp_build_struct_get_ptr(_gallivm, _ptr, 2, "data")
 
 
-#define draw_jit_vbuffer_stride(_builder, _ptr)         \
-   lp_build_struct_get(_builder, _ptr, 0, "stride")
+#define draw_jit_vbuffer_stride(_gallivm, _ptr)         \
+   lp_build_struct_get(_gallivm, _ptr, 0, "stride")
 
-#define draw_jit_vbuffer_max_index(_builder, _ptr)      \
-   lp_build_struct_get(_builder, _ptr, 1, "max_index")
+#define draw_jit_vbuffer_max_index(_gallivm, _ptr)      \
+   lp_build_struct_get(_gallivm, _ptr, 1, "max_index")
 
-#define draw_jit_vbuffer_offset(_builder, _ptr)         \
-   lp_build_struct_get(_builder, _ptr, 2, "buffer_offset")
+#define draw_jit_vbuffer_offset(_gallivm, _ptr)         \
+   lp_build_struct_get(_gallivm, _ptr, 2, "buffer_offset")
 
 
 typedef int
@@ -229,7 +229,6 @@ struct draw_llvm_variant
 
    /* key is variable-sized, must be last */
    struct draw_llvm_variant_key key;
-   /* key is variable-sized, must be last */
 };
 
 struct llvm_vertex_shader {
@@ -246,21 +245,19 @@ struct draw_llvm {
 
    struct draw_jit_context jit_context;
 
+   struct gallivm_state *gallivm;
+
    struct draw_llvm_variant_list_item vs_variants_list;
    int nr_variants;
 
-   LLVMModuleRef module;
-   LLVMExecutionEngineRef engine;
-   LLVMModuleProviderRef provider;
-   LLVMTargetDataRef target;
-   LLVMPassManagerRef pass;
-
+   /* LLVM JIT builder types */
    LLVMTypeRef context_ptr_type;
-   LLVMTypeRef vertex_header_ptr_type;
    LLVMTypeRef buffer_ptr_type;
    LLVMTypeRef vb_ptr_type;
+   LLVMTypeRef vertex_header_ptr_type;
 };
 
+
 static INLINE struct llvm_vertex_shader *
 llvm_vertex_shader(struct draw_vertex_shader *vs)
 {
@@ -269,7 +266,7 @@ llvm_vertex_shader(struct draw_vertex_shader *vs)
 
 
 struct draw_llvm *
-draw_llvm_create(struct draw_context *draw);
+draw_llvm_create(struct draw_context *draw, struct gallivm_state *gallivm);
 
 void
 draw_llvm_destroy(struct draw_llvm *llvm);
@@ -286,7 +283,7 @@ struct draw_llvm_variant_key *
 draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
 
 LLVMValueRef
-draw_llvm_translate_from(LLVMBuilderRef builder,
+draw_llvm_translate_from(struct gallivm_state *gallivm,
                          LLVMValueRef vbuffer,
                          enum pipe_format from_format);
 
index ac1fbb179c6b4a4b076d04d90d567557bc8e6035..574c7cc452f9d9d4c443ca9996d8a05ec45cd578 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
+#include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_debug.h"
 #include "gallivm/lp_bld_type.h"
 #include "gallivm/lp_bld_sample.h"
@@ -84,12 +85,13 @@ struct draw_llvm_sampler_soa
  */
 static LLVMValueRef
 draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
-                         LLVMBuilderRef builder,
+                         struct gallivm_state *gallivm,
                          unsigned unit,
                          unsigned member_index,
                          const char *member_name,
                          boolean emit_load)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct draw_llvm_sampler_dynamic_state *state =
       (struct draw_llvm_sampler_dynamic_state *)base;
    LLVMValueRef indices[4];
@@ -99,13 +101,13 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
    debug_assert(unit < PIPE_MAX_VERTEX_SAMPLERS);
 
    /* context[0] */
-   indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   indices[0] = lp_build_const_int32(gallivm, 0);
    /* context[0].textures */
-   indices[1] = LLVMConstInt(LLVMInt32Type(), DRAW_JIT_CTX_TEXTURES, 0);
+   indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_TEXTURES);
    /* context[0].textures[unit] */
-   indices[2] = LLVMConstInt(LLVMInt32Type(), unit, 0);
+   indices[2] = lp_build_const_int32(gallivm, unit);
    /* context[0].textures[unit].member */
-   indices[3] = LLVMConstInt(LLVMInt32Type(), member_index, 0);
+   indices[3] = lp_build_const_int32(gallivm, member_index);
 
    ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
 
@@ -132,10 +134,10 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
 #define DRAW_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load)  \
    static LLVMValueRef \
    draw_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \
-                              LLVMBuilderRef builder,                   \
+                              struct gallivm_state *gallivm,               \
                               unsigned unit)                            \
    { \
-      return draw_llvm_texture_member(base, builder, unit, _index, #_name, _emit_load ); \
+      return draw_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \
    }
 
 
@@ -165,7 +167,7 @@ draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
  */
 static void
 draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
-                                       LLVMBuilderRef builder,
+                                       struct gallivm_state *gallivm,
                                        struct lp_type type,
                                        unsigned unit,
                                        unsigned num_coords,
@@ -180,7 +182,7 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
 
    assert(unit < PIPE_MAX_VERTEX_SAMPLERS);
 
-   lp_build_sample_soa(builder,
+   lp_build_sample_soa(gallivm,
                        &sampler->dynamic_state.static_state[unit],
                        &sampler->dynamic_state.base,
                        type,
index 5171327ce2d2e5ccb6572b629113dfbaa66dc0aa..77d0af7473351217fcf36d7944bfb018837e1bb0 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "draw_llvm.h"
 
+#include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_struct.h"
 #include "gallivm/lp_bld_format.h"
 #include "gallivm/lp_bld_debug.h"
 #define DRAW_DBG 0
 
 static  LLVMValueRef
-from_64_float(LLVMBuilderRef builder, LLVMValueRef val)
+from_64_float(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMDoubleType(), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   return LLVMBuildFPTrunc(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMDoubleTypeInContext(gallivm->context), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   return LLVMBuildFPTrunc(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 }
 
 static LLVMValueRef
-from_32_float(LLVMBuilderRef builder, LLVMValueRef val)
+from_32_float(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMFloatType(), 0) , "");
-   return LLVMBuildLoad(builder, bc, "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMFloatTypeInContext(gallivm->context), 0) , "");
+   return LLVMBuildLoad(gallivm->builder, bc, "");
 }
 
 static INLINE LLVMValueRef
-from_8_uscaled(LLVMBuilderRef builder, LLVMValueRef val)
+from_8_uscaled(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, val, "");
-   return LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
+   return LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 }
 
 static INLINE LLVMValueRef
-from_16_uscaled(LLVMBuilderRef builder, LLVMValueRef val)
+from_16_uscaled(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(16), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   return LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   return LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 }
 
 static INLINE LLVMValueRef
-from_32_uscaled(LLVMBuilderRef builder, LLVMValueRef val)
+from_32_uscaled(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(32), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   return LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   return LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 }
 
 static INLINE LLVMValueRef
-from_8_sscaled(LLVMBuilderRef builder, LLVMValueRef val)
+from_8_sscaled(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, val, "");
-   return LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
+   return LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 }
 
 static INLINE LLVMValueRef
-from_16_sscaled(LLVMBuilderRef builder, LLVMValueRef val)
+from_16_sscaled(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(16), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   return LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   return LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 }
 
 static INLINE LLVMValueRef
-from_32_sscaled(LLVMBuilderRef builder, LLVMValueRef val)
+from_32_sscaled(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(32), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   return LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   return LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 }
 
 
 static INLINE LLVMValueRef
-from_8_unorm(LLVMBuilderRef builder, LLVMValueRef val)
+from_8_unorm(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, val, "");
-   LLVMValueRef uscaled = LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
-   return LLVMBuildFDiv(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 255.), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
+   LLVMValueRef uscaled = LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
+   return LLVMBuildFDiv(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 255.), "");
 }
 
 static INLINE LLVMValueRef
-from_16_unorm(LLVMBuilderRef builder, LLVMValueRef val)
+from_16_unorm(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(16), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   LLVMValueRef uscaled = LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
-   return LLVMBuildFDiv(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 65535.), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   LLVMValueRef uscaled = LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
+   return LLVMBuildFDiv(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 65535.), "");
 }
 
 static INLINE LLVMValueRef
-from_32_unorm(LLVMBuilderRef builder, LLVMValueRef val)
+from_32_unorm(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(32), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   LLVMValueRef uscaled = LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   LLVMValueRef uscaled = LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 
-   return LLVMBuildFDiv(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 4294967295.), "");
+   return LLVMBuildFDiv(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 4294967295.), "");
 }
 
 static INLINE LLVMValueRef
-from_8_snorm(LLVMBuilderRef builder, LLVMValueRef val)
+from_8_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, val, "");
-   LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
-   return LLVMBuildFDiv(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 127.0), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
+   LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
+   return LLVMBuildFDiv(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 127.0), "");
 }
 
 static INLINE LLVMValueRef
-from_16_snorm(LLVMBuilderRef builder, LLVMValueRef val)
+from_16_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(16), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
-   return LLVMBuildFDiv(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 32767.0f), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
+   return LLVMBuildFDiv(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 32767.0f), "");
 }
 
 static INLINE LLVMValueRef
-from_32_snorm(LLVMBuilderRef builder, LLVMValueRef val)
+from_32_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(32), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 
-   return LLVMBuildFDiv(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 2147483647.0), "");
+   return LLVMBuildFDiv(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 2147483647.0), "");
 }
 
 static INLINE LLVMValueRef
-from_32_fixed(LLVMBuilderRef builder, LLVMValueRef val)
+from_32_fixed(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef bc = LLVMBuildBitCast(builder, val,
-                                      LLVMPointerType(LLVMIntType(32), 0) , "");
-   LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
-   LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
+   LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
+                                      LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
+   LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
 
-   return LLVMBuildFDiv(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 65536.0), "");
+   return LLVMBuildFDiv(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 65536.0), "");
 }
 
 static LLVMValueRef
-to_64_float(LLVMBuilderRef builder, LLVMValueRef fp)
+to_64_float(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   return LLVMBuildFPExt(builder, l, LLVMDoubleType(), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   return LLVMBuildFPExt(gallivm->builder, l, LLVMDoubleTypeInContext(gallivm->context), "");
 }
 
 static LLVMValueRef
-to_32_float(LLVMBuilderRef builder, LLVMValueRef fp)
+to_32_float(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   return LLVMBuildLoad(builder, fp, "");
+   return LLVMBuildLoad(gallivm->builder, fp, "");
 }
 
 static INLINE LLVMValueRef
-to_8_uscaled(LLVMBuilderRef builder, LLVMValueRef fp)
+to_8_uscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   return LLVMBuildFPToUI(builder, l, LLVMIntType(8), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   return LLVMBuildFPToUI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 8), "");
 }
 
 static INLINE LLVMValueRef
-to_16_uscaled(LLVMBuilderRef builder, LLVMValueRef fp)
+to_16_uscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   return LLVMBuildFPToUI(builder, l, LLVMIntType(16), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   return LLVMBuildFPToUI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 16), "");
 }
 
 static INLINE LLVMValueRef
-to_32_uscaled(LLVMBuilderRef builder, LLVMValueRef fp)
+to_32_uscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   return LLVMBuildFPToUI(builder, l, LLVMIntType(32), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   return LLVMBuildFPToUI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 32), "");
 }
 
 static INLINE LLVMValueRef
-to_8_sscaled(LLVMBuilderRef builder, LLVMValueRef fp)
+to_8_sscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   return LLVMBuildFPToSI(builder, l, LLVMIntType(8), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   return LLVMBuildFPToSI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 8), "");
 }
 
 static INLINE LLVMValueRef
-to_16_sscaled(LLVMBuilderRef builder, LLVMValueRef fp)
+to_16_sscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   return LLVMBuildFPToSI(builder, l, LLVMIntType(16), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   return LLVMBuildFPToSI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 16), "");
 }
 
 static INLINE LLVMValueRef
-to_32_sscaled(LLVMBuilderRef builder, LLVMValueRef fp)
+to_32_sscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   return LLVMBuildFPToSI(builder, l, LLVMIntType(32), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   return LLVMBuildFPToSI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 32), "");
 }
 
 static INLINE LLVMValueRef
-to_8_unorm(LLVMBuilderRef builder, LLVMValueRef fp)
+to_8_unorm(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   LLVMValueRef uscaled = LLVMBuildFPToUI(builder, l, LLVMIntType(8), "");
-   return LLVMBuildFMul(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 255.), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   LLVMValueRef uscaled = LLVMBuildFPToUI(gallivm->builder, l,
+                                          LLVMIntTypeInContext(gallivm->context, 8), "");
+   return LLVMBuildFMul(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 255.), "");
 }
 
 static INLINE LLVMValueRef
-to_16_unorm(LLVMBuilderRef builder, LLVMValueRef fp)
+to_16_unorm(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   LLVMValueRef uscaled = LLVMBuildFPToUI(builder, l, LLVMIntType(32), "");
-   return LLVMBuildFMul(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 65535.), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   LLVMValueRef uscaled = LLVMBuildFPToUI(gallivm->builder, l,
+                                          LLVMIntTypeInContext(gallivm->context, 32), "");
+   return LLVMBuildFMul(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 65535.), "");
 }
 
 static INLINE LLVMValueRef
-to_32_unorm(LLVMBuilderRef builder, LLVMValueRef fp)
+to_32_unorm(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   LLVMValueRef uscaled = LLVMBuildFPToUI(builder, l, LLVMIntType(32), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   LLVMValueRef uscaled = LLVMBuildFPToUI(gallivm->builder, l,
+                                          LLVMIntTypeInContext(gallivm->context, 32), "");
 
-   return LLVMBuildFMul(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 4294967295.), "");
+   return LLVMBuildFMul(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 4294967295.), "");
 }
 
 static INLINE LLVMValueRef
-to_8_snorm(LLVMBuilderRef builder, LLVMValueRef val)
+to_8_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, val, "");
-   LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(8), "");
-   return LLVMBuildFMul(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 127.0), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
+   LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
+                                          LLVMIntTypeInContext(gallivm->context, 8), "");
+   return LLVMBuildFMul(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 127.0), "");
 }
 
 static INLINE LLVMValueRef
-to_16_snorm(LLVMBuilderRef builder, LLVMValueRef fp)
+to_16_snorm(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(16), "");
-   return LLVMBuildFMul(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 32767.0f), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
+                                          LLVMIntTypeInContext(gallivm->context, 16), "");
+   return LLVMBuildFMul(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 32767.0f), "");
 }
 
 static INLINE LLVMValueRef
-to_32_snorm(LLVMBuilderRef builder, LLVMValueRef fp)
+to_32_snorm(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(32), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
+                                          LLVMIntTypeInContext(gallivm->context, 32), "");
 
-   return LLVMBuildFMul(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 2147483647.0), "");
+   return LLVMBuildFMul(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 2147483647.0), "");
 }
 
 static INLINE LLVMValueRef
-to_32_fixed(LLVMBuilderRef builder, LLVMValueRef fp)
+to_32_fixed(struct gallivm_state *gallivm, LLVMValueRef fp)
 {
-   LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
-   LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(32), "");
+   LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
+   LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
+                                          LLVMIntTypeInContext(gallivm->context, 32), "");
 
-   return LLVMBuildFMul(builder, uscaled,
-                        LLVMConstReal(LLVMFloatType(), 65536.0), "");
+   return LLVMBuildFMul(gallivm->builder, uscaled,
+                        lp_build_const_float(gallivm, 65536.0), "");
 }
 
-typedef LLVMValueRef (*from_func)(LLVMBuilderRef, LLVMValueRef);
-typedef  LLVMValueRef (*to_func)(LLVMBuilderRef, LLVMValueRef);
+typedef LLVMValueRef (*from_func)(struct gallivm_state *, LLVMValueRef);
+typedef  LLVMValueRef (*to_func)(struct gallivm_state *, LLVMValueRef);
 
 /* so that underneath can avoid function calls which are prohibited
  * for static initialization we need this conversion */
@@ -294,21 +302,21 @@ enum ll_type {
 };
 
 static INLINE LLVMTypeRef
-ll_type_to_llvm(enum ll_type type)
+ll_type_to_llvm(struct gallivm_state *gallivm, enum ll_type type)
 {
    switch (type) {
    case LL_Double:
-      return LLVMDoubleType();
+      return LLVMDoubleTypeInContext(gallivm->context);
    case LL_Float:
-      return LLVMFloatType();
+      return LLVMFloatTypeInContext(gallivm->context);
    case LL_Int32:
-      return LLVMInt32Type();
+      return LLVMInt32TypeInContext(gallivm->context);
    case LL_Int16:
-      return LLVMIntType(16);
+      return LLVMIntTypeInContext(gallivm->context, 16);
    case LL_Int8:
-      return LLVMIntType(8);
+      return LLVMIntTypeInContext(gallivm->context, 8);
    }
-   return LLVMIntType(8);
+   return LLVMIntTypeInContext(gallivm->context, 8);
 }
 
 static INLINE int
@@ -414,42 +422,42 @@ struct draw_llvm_translate {
 
 
 static LLVMValueRef
-fetch(LLVMBuilderRef builder,
+fetch(struct gallivm_state *gallivm,
       LLVMValueRef ptr, int val_size, int nr_components,
       from_func func)
 {
    int i;
    int offset = 0;
-   LLVMValueRef res = LLVMConstNull(
-      LLVMVectorType(LLVMFloatType(), 4));
+   LLVMValueRef res =
+      LLVMConstNull(LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4));
    LLVMValueRef defaults[4];
 
-   defaults[0] = LLVMConstReal(LLVMFloatType(), 0);
-   defaults[1] = LLVMConstReal(LLVMFloatType(), 0);
-   defaults[2] = LLVMConstReal(LLVMFloatType(), 0);
-   defaults[3] = LLVMConstReal(LLVMFloatType(), 1);
+   defaults[0] =
+   defaults[1] =
+   defaults[2] = lp_build_const_float(gallivm, 0.0);
+   defaults[3] = lp_build_const_float(gallivm, 1.0);
 
    for (i = 0; i < nr_components; ++i) {
-      LLVMValueRef src_index = LLVMConstInt(LLVMInt32Type(), offset, 0);
-      LLVMValueRef dst_index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      LLVMValueRef src_index = lp_build_const_int32(gallivm, offset);
+      LLVMValueRef dst_index = lp_build_const_int32(gallivm, i);
       LLVMValueRef src_tmp;
       LLVMValueRef component;
 
-      src_tmp = LLVMBuildGEP(builder, ptr, &src_index, 1, "src_tmp");
+      src_tmp = LLVMBuildGEP(gallivm->builder, ptr, &src_index, 1, "src_tmp");
 
       /* convert src_tmp to float */
-      component = func(builder, src_tmp);
+      component = func(gallivm, src_tmp);
 
       /* vec.comp = component */
-      res = LLVMBuildInsertElement(builder,
+      res = LLVMBuildInsertElement(gallivm->builder,
                                    res,
                                    component,
                                    dst_index, "");
       offset += val_size;
    }
    for (; i < 4; ++i) {
-      LLVMValueRef dst_index = LLVMConstInt(LLVMInt32Type(), i, 0);
-      res = LLVMBuildInsertElement(builder,
+      LLVMValueRef dst_index = lp_build_const_int32(gallivm, i);
+      res = LLVMBuildInsertElement(gallivm->builder,
                                    res,
                                    defaults[i],
                                    dst_index, "");
@@ -459,7 +467,7 @@ fetch(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-draw_llvm_translate_from(LLVMBuilderRef builder,
+draw_llvm_translate_from(struct gallivm_state *gallivm,
                          LLVMValueRef vbuffer,
                          enum pipe_format from_format)
 {
@@ -476,7 +484,7 @@ draw_llvm_translate_from(LLVMBuilderRef builder,
    for (i = 0; i < Elements(translates); ++i) {
       if (translates[i].format == from_format) {
          /*LLVMTypeRef type = ll_type_to_llvm(translates[i].type);*/
-         return fetch(builder,
+         return fetch(gallivm,
                       vbuffer,
                       ll_type_size(translates[i].type),
                       translates[i].num_components,
@@ -493,6 +501,6 @@ draw_llvm_translate_from(LLVMBuilderRef builder,
     */
 
    format_desc = util_format_description(from_format);
-   zero = LLVMConstNull(LLVMInt32Type());
-   return lp_build_fetch_rgba_aos(builder, format_desc, type, vbuffer, zero, zero, zero);
+   zero = LLVMConstNull(LLVMInt32TypeInContext(gallivm->context));
+   return lp_build_fetch_rgba_aos(gallivm, format_desc, type, vbuffer, zero, zero, zero);
 }
index d1aba763098e9e4977edd19a9aac74d5e0fa9bbb..0851b9acc0d4db457260fdcc14ba9095d1a589d0 100644 (file)
@@ -406,6 +406,7 @@ aaline_create_texture(struct aaline_stage *aaline)
    texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
    texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
    texTemp.depth0 = 1;
+   texTemp.array_size = 1;
    texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    aaline->texture = screen->resource_create(screen, &texTemp);
@@ -441,10 +442,10 @@ aaline_create_texture(struct aaline_stage *aaline)
       /* This texture is new, no need to flush. 
        */
       transfer = pipe->get_transfer(pipe,
-                                   aaline->texture,
-                                   u_subresource(0, level), 
-                                   PIPE_TRANSFER_WRITE,
-                                   &box);
+                                    aaline->texture,
+                                    level,
+                                    PIPE_TRANSFER_WRITE,
+                                    &box);
 
       data = pipe->transfer_map(pipe, transfer);
       if (data == NULL)
index ed9a53e154dbe4bcf4aaff82dd98cf2c9afb7055..f5515c1df76c57161a7dc9cb6e5ce0b2010081e8 100644 (file)
@@ -393,8 +393,8 @@ pstip_update_texture(struct pstip_stage *pstip)
     */
    pipe->flush( pipe, PIPE_FLUSH_TEXTURE_CACHE, NULL );
 
-   transfer = pipe_get_transfer(pipe, pstip->texture, 0, 0, 0,
-                                   PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
+   transfer = pipe_get_transfer(pipe, pstip->texture, 0, 0,
+                                PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
    data = pipe->transfer_map(pipe, transfer);
 
    /*
@@ -440,6 +440,7 @@ pstip_create_texture(struct pstip_stage *pstip)
    texTemp.width0 = 32;
    texTemp.height0 = 32;
    texTemp.depth0 = 1;
+   texTemp.array_size = 1;
    texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    pstip->texture = screen->resource_create(screen, &texTemp);
index 54163d7f9ebdcd59bd896d608410a4f24053a563..06ed4d60ef287c34d2ae2a3ffd9660db0f80cabe 100644 (file)
@@ -286,7 +286,6 @@ struct draw_context
 
 #ifdef HAVE_LLVM
    struct draw_llvm *llvm;
-   LLVMExecutionEngineRef engine;
 #endif
 
    struct pipe_sampler_view *sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
index 7c198c6026d955659cc0a84501d7591709799c22..c98fb3d5205a9dd4ed518e727ff416a9370287bc 100644 (file)
@@ -58,8 +58,8 @@ struct fetch_shade_emit {
    const ubyte *src[PIPE_MAX_ATTRIBS];
    unsigned prim;
 
-   struct draw_vs_varient_key key;
-   struct draw_vs_varient *active;
+   struct draw_vs_variant_key key;
+   struct draw_vs_variant *active;
 
 
    const struct vertex_info *vinfo;
@@ -150,7 +150,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
    }
 
    
-   fse->active = draw_vs_lookup_varient( draw->vs.vertex_shader, 
+   fse->active = draw_vs_lookup_variant( draw->vs.vertex_shader, 
                                          &fse->key );
 
    if (!fse->active) {
index a53a768d02990e4d4d4b6ac787f39ae2478dd913..2e3afb22c4867d0359d6cb11219ae894f946ba4c 100644 (file)
@@ -34,6 +34,7 @@
 #include "draw/draw_pt.h"
 #include "draw/draw_vs.h"
 #include "draw/draw_llvm.h"
+#include "gallivm/lp_bld_init.h"
 
 
 struct llvm_middle_end {
@@ -72,19 +73,18 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
    struct draw_llvm_variant_list_item *li;
    unsigned i;
    unsigned instance_id_index = ~0;
-
-
-   unsigned out_prim = (draw->gs.geometry_shader ? 
-                        draw->gs.geometry_shader->output_primitive :
-                        in_prim);
+   const unsigned out_prim = (draw->gs.geometry_shader ? 
+                              draw->gs.geometry_shader->output_primitive :
+                              in_prim);
 
    /* Add one to num_outputs because the pipeline occasionally tags on
     * an additional texcoord, eg for AA lines.
     */
-   unsigned nr = MAX2( shader->base.info.num_inputs,
-                      shader->base.info.num_outputs + 1 );
+   const unsigned nr = MAX2( shader->base.info.num_inputs,
+                             shader->base.info.num_outputs + 1 );
 
    /* Scan for instanceID system value.
+    * XXX but we never use instance_id_index?!
     */
    for (i = 0; i < shader->base.info.num_inputs; i++) {
       if (shader->base.info.input_semantic_name[i] == TGSI_SEMANTIC_INSTANCEID) {
@@ -133,9 +133,10 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
    
    key = draw_llvm_make_variant_key(fpme->llvm, store);
 
+   /* Search shader's list of variants for the key */
    li = first_elem(&shader->variants);
-   while(!at_end(&shader->variants, li)) {
-      if(memcmp(&li->base->key, key, shader->variant_key_size) == 0) {
+   while (!at_end(&shader->variants, li)) {
+      if (memcmp(&li->base->key, key, shader->variant_key_size) == 0) {
          variant = li->base;
          break;
       }
@@ -143,10 +144,16 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
    }
 
    if (variant) {
+      /* found the variant, move to head of global list (for LRU) */
       move_to_head(&fpme->llvm->vs_variants_list, &variant->list_item_global);
    }
    else {
+      /* Need to create new variant */
       unsigned i;
+
+      /* First check if we've created too many variants.  If so, free
+       * 25% of the LRU to avoid using too much memory.
+       */
       if (fpme->llvm->nr_variants >= DRAW_MAX_SHADER_VARIANTS) {
          /*
           * XXX: should we flush here ?
@@ -422,7 +429,7 @@ draw_pt_fetch_pipeline_or_emit_llvm(struct draw_context *draw)
 {
    struct llvm_middle_end *fpme = 0;
 
-   if (!draw->engine)
+   if (!draw->llvm->gallivm->engine)
       return NULL;
 
    fpme = CALLOC_STRUCT( llvm_middle_end );
index 3f66f962e11e3358d0c9090d3f7ad5a9c0ac2749..75dba8c39a58dc7db6e770f91f2e9431c47ec0dc 100644 (file)
@@ -258,9 +258,10 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags,
    boolean use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0);
    unsigned nr = 0, i;
 
-   assert(icount + !!use_spoken <= vsplit->segment_size);
+   assert(icount <= vsplit->segment_size);
 
    if (use_spoken) {
+      /* replace istart by i0 */
       vsplit->fetch_elts[nr++] = i0;
       for (i = 1 ; i < icount; i++)
          vsplit->fetch_elts[nr++] = istart + i;
index fb665b08fffc78963fb7af005bcc1bcec60f4e98..7caad6f0053a77d2d0cfc76de426c7b40e490197 100644 (file)
@@ -165,10 +165,10 @@ draw_delete_vertex_shader(struct draw_context *draw,
 {
    unsigned i;
 
-   for (i = 0; i < dvs->nr_varients; i++) 
-      dvs->varient[i]->destroy( dvs->varient[i] );
+   for (i = 0; i < dvs->nr_variants; i++) 
+      dvs->variant[i]->destroy( dvs->variant[i] );
 
-   dvs->nr_varients = 0;
+   dvs->nr_variants = 0;
 
    dvs->delete( dvs );
 }
@@ -225,40 +225,40 @@ draw_vs_destroy( struct draw_context *draw )
 }
 
 
-struct draw_vs_varient *
-draw_vs_lookup_varient( struct draw_vertex_shader *vs,
-                        const struct draw_vs_varient_key *key )
+struct draw_vs_variant *
+draw_vs_lookup_variant( struct draw_vertex_shader *vs,
+                        const struct draw_vs_variant_key *key )
 {
-   struct draw_vs_varient *varient;
+   struct draw_vs_variant *variant;
    unsigned i;
 
-   /* Lookup existing varient: 
+   /* Lookup existing variant: 
     */
-   for (i = 0; i < vs->nr_varients; i++)
-      if (draw_vs_varient_key_compare(key, &vs->varient[i]->key) == 0)
-         return vs->varient[i];
+   for (i = 0; i < vs->nr_variants; i++)
+      if (draw_vs_variant_key_compare(key, &vs->variant[i]->key) == 0)
+         return vs->variant[i];
    
    /* Else have to create a new one: 
     */
-   varient = vs->create_varient( vs, key );
-   if (varient == NULL)
+   variant = vs->create_variant( vs, key );
+   if (variant == NULL)
       return NULL;
 
    /* Add it to our list, could be smarter: 
     */
-   if (vs->nr_varients < Elements(vs->varient)) {
-      vs->varient[vs->nr_varients++] = varient;
+   if (vs->nr_variants < Elements(vs->variant)) {
+      vs->variant[vs->nr_variants++] = variant;
    }
    else {
-      vs->last_varient++;
-      vs->last_varient %= Elements(vs->varient);
-      vs->varient[vs->last_varient]->destroy(vs->varient[vs->last_varient]);
-      vs->varient[vs->last_varient] = varient;
+      vs->last_variant++;
+      vs->last_variant %= Elements(vs->variant);
+      vs->variant[vs->last_variant]->destroy(vs->variant[vs->last_variant]);
+      vs->variant[vs->last_variant] = variant;
    }
 
    /* Done 
     */
-   return varient;
+   return variant;
 }
 
 
index f9a038788fba9856b94a6ff32c0a427d83a958f3..bfb72d50efab2e0f3fa0e197533d4cf6cb382d13 100644 (file)
@@ -38,7 +38,7 @@
 struct draw_context;
 struct pipe_shader_state;
 
-struct draw_varient_input 
+struct draw_variant_input 
 {
    enum pipe_format format;
    unsigned buffer;
@@ -46,19 +46,19 @@ struct draw_varient_input
    unsigned instance_divisor;
 };
 
-struct draw_varient_output
+struct draw_variant_output
 {
    enum pipe_format format;     /* output format */
    unsigned vs_output:8;        /* which vertex shader output is this? */
    unsigned offset:24;          /* offset into output vertex */
 };
 
-struct draw_varient_element {
-   struct draw_varient_input in;
-   struct draw_varient_output out;
+struct draw_variant_element {
+   struct draw_variant_input in;
+   struct draw_variant_output out;
 };
 
-struct draw_vs_varient_key {
+struct draw_vs_variant_key {
    unsigned output_stride;
    unsigned nr_elements:8;      /* max2(nr_inputs, nr_outputs) */
    unsigned nr_inputs:8;
@@ -66,34 +66,34 @@ struct draw_vs_varient_key {
    unsigned viewport:1;
    unsigned clip:1;
    unsigned const_vbuffers:5;
-   struct draw_varient_element element[PIPE_MAX_ATTRIBS];
+   struct draw_variant_element element[PIPE_MAX_ATTRIBS];
 };
 
-struct draw_vs_varient;
+struct draw_vs_variant;
 
 
-struct draw_vs_varient {
-   struct draw_vs_varient_key key;
+struct draw_vs_variant {
+   struct draw_vs_variant_key key;
 
    struct draw_vertex_shader *vs;
 
-   void (*set_buffer)( struct draw_vs_varient *,
+   void (*set_buffer)( struct draw_vs_variant *,
                       unsigned i,
                       const void *ptr,
                       unsigned stride,
                       unsigned max_stride );
 
-   void (PIPE_CDECL *run_linear)( struct draw_vs_varient *shader,
+   void (PIPE_CDECL *run_linear)( struct draw_vs_variant *shader,
                                   unsigned start,
                                   unsigned count,
                                   void *output_buffer );
 
-   void (PIPE_CDECL *run_elts)( struct draw_vs_varient *shader,
+   void (PIPE_CDECL *run_elts)( struct draw_vs_variant *shader,
                                 const unsigned *elts,
                                 unsigned count,
                                 void *output_buffer );
 
-   void (*destroy)( struct draw_vs_varient * );
+   void (*destroy)( struct draw_vs_variant * );
 };
 
 
@@ -117,11 +117,11 @@ struct draw_vertex_shader {
 
    /* 
     */
-   struct draw_vs_varient *varient[16];
-   unsigned nr_varients;
-   unsigned last_varient;
-   struct draw_vs_varient *(*create_varient)( struct draw_vertex_shader *shader,
-                                              const struct draw_vs_varient_key *key );
+   struct draw_vs_variant *variant[16];
+   unsigned nr_variants;
+   unsigned last_variant;
+   struct draw_vs_variant *(*create_variant)( struct draw_vertex_shader *shader,
+                                              const struct draw_vs_variant_key *key );
 
 
    void (*prepare)( struct draw_vertex_shader *shader,
@@ -144,9 +144,9 @@ struct draw_vertex_shader {
 };
 
 
-struct draw_vs_varient *
-draw_vs_lookup_varient( struct draw_vertex_shader *base,
-                        const struct draw_vs_varient_key *key );
+struct draw_vs_variant *
+draw_vs_lookup_variant( struct draw_vertex_shader *base,
+                        const struct draw_vs_variant_key *key );
 
 
 /********************************************************************************
@@ -166,12 +166,12 @@ draw_create_vs_ppc(struct draw_context *draw,
                   const struct pipe_shader_state *templ);
 
 
-struct draw_vs_varient_key;
+struct draw_vs_variant_key;
 struct draw_vertex_shader;
 
-struct draw_vs_varient *
-draw_vs_create_varient_aos_sse( struct draw_vertex_shader *vs,
-                                const struct draw_vs_varient_key *key );
+struct draw_vs_variant *
+draw_vs_create_variant_aos_sse( struct draw_vertex_shader *vs,
+                                const struct draw_vs_variant_key *key );
 
 #if HAVE_LLVM
 struct draw_vertex_shader *
@@ -181,7 +181,7 @@ draw_create_vs_llvm(struct draw_context *draw,
 
 
 /********************************************************************************
- * Helpers for vs implementations that don't do their own fetch/emit varients.
+ * Helpers for vs implementations that don't do their own fetch/emit variants.
  * Means these can be shared between shaders.
  */
 struct translate;
@@ -194,21 +194,21 @@ struct translate *draw_vs_get_fetch( struct draw_context *draw,
 struct translate *draw_vs_get_emit( struct draw_context *draw,
                                     struct translate_key *key );
 
-struct draw_vs_varient *
-draw_vs_create_varient_generic( struct draw_vertex_shader *vs,
-                                const struct draw_vs_varient_key *key );
+struct draw_vs_variant *
+draw_vs_create_variant_generic( struct draw_vertex_shader *vs,
+                                const struct draw_vs_variant_key *key );
 
 
 
-static INLINE int draw_vs_varient_keysize( const struct draw_vs_varient_key *key )
+static INLINE int draw_vs_variant_keysize( const struct draw_vs_variant_key *key )
 {
-   return 2 * sizeof(int) + key->nr_elements * sizeof(struct draw_varient_element);
+   return 2 * sizeof(int) + key->nr_elements * sizeof(struct draw_variant_element);
 }
 
-static INLINE int draw_vs_varient_key_compare( const struct draw_vs_varient_key *a,
-                                         const struct draw_vs_varient_key *b )
+static INLINE int draw_vs_variant_key_compare( const struct draw_vs_variant_key *a,
+                                         const struct draw_vs_variant_key *b )
 {
-   int keysize = draw_vs_varient_keysize(a);
+   int keysize = draw_vs_variant_keysize(a);
    return memcmp(a, b, keysize);
 }
 
index 19f49e34c8bd5a9f7683131110d2a6f8c34a62af..7b90dba0cd53d69004d5d4a7ad003e2ae8d1b66b 100644 (file)
@@ -1918,7 +1918,7 @@ static void find_last_write_outputs( struct aos_compilation *cp )
 #define ARG_OUTBUF     4
 
 
-static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient,
+static boolean build_vertex_program( struct draw_vs_variant_aos_sse *variant,
                                      boolean linear )
 { 
    struct tgsi_parse_context parse;
@@ -1927,14 +1927,14 @@ static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient,
 
    util_init_math();
 
-   tgsi_parse_init( &parse, varient->base.vs->state.tokens );
+   tgsi_parse_init( &parse, variant->base.vs->state.tokens );
 
    memset(&cp, 0, sizeof(cp));
 
    cp.insn_counter = 1;
-   cp.vaos = varient;
+   cp.vaos = variant;
    cp.have_sse2 = 1;
-   cp.func = &varient->func[ linear ? 0 : 1 ];
+   cp.func = &variant->func[ linear ? 0 : 1 ];
 
    cp.tmp_EAX       = x86_make_reg(file_REG32, reg_AX);
    cp.idx_EBX      = x86_make_reg(file_REG32, reg_BX);
@@ -2090,20 +2090,20 @@ static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient,
 
 
 /** cast wrapper */
-static INLINE struct draw_vs_varient_aos_sse *
-draw_vs_varient_aos_sse(struct draw_vs_varient *varient)
+static INLINE struct draw_vs_variant_aos_sse *
+draw_vs_variant_aos_sse(struct draw_vs_variant *variant)
 {
-   return (struct draw_vs_varient_aos_sse *) varient;
+   return (struct draw_vs_variant_aos_sse *) variant;
 }
 
 
-static void vaos_set_buffer( struct draw_vs_varient *varient,
+static void vaos_set_buffer( struct draw_vs_variant *variant,
                              unsigned buf,
                              const void *ptr,
                              unsigned stride,
                              unsigned max_stride)
 {
-   struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient);
+   struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant);
 
    if (buf < vaos->nr_vb) {
       vaos->buffer[buf].base_ptr = (char *)ptr;
@@ -2115,12 +2115,12 @@ static void vaos_set_buffer( struct draw_vs_varient *varient,
 
 
 
-static void PIPE_CDECL vaos_run_elts( struct draw_vs_varient *varient,
+static void PIPE_CDECL vaos_run_elts( struct draw_vs_variant *variant,
                                       const unsigned *elts,
                                       unsigned count,
                                       void *output_buffer )
 {
-   struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient);
+   struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant);
    struct aos_machine *machine = vaos->draw->vs.aos_machine;
    unsigned i;
 
@@ -2139,12 +2139,12 @@ static void PIPE_CDECL vaos_run_elts( struct draw_vs_varient *varient,
                        output_buffer );
 }
 
-static void PIPE_CDECL vaos_run_linear( struct draw_vs_varient *varient,
+static void PIPE_CDECL vaos_run_linear( struct draw_vs_variant *variant,
                                         unsigned start,
                                         unsigned count,
                                         void *output_buffer )
 {
-   struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient);
+   struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant);
    struct aos_machine *machine = vaos->draw->vs.aos_machine;
    unsigned i;
 
@@ -2171,9 +2171,9 @@ static void PIPE_CDECL vaos_run_linear( struct draw_vs_varient *varient,
 
 
 
-static void vaos_destroy( struct draw_vs_varient *varient )
+static void vaos_destroy( struct draw_vs_variant *variant )
 {
-   struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient);
+   struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant);
 
    FREE( vaos->buffer );
 
@@ -2185,11 +2185,11 @@ static void vaos_destroy( struct draw_vs_varient *varient )
 
 
 
-static struct draw_vs_varient *varient_aos_sse( struct draw_vertex_shader *vs,
-                                                 const struct draw_vs_varient_key *key )
+static struct draw_vs_variant *variant_aos_sse( struct draw_vertex_shader *vs,
+                                                 const struct draw_vs_variant_key *key )
 {
    unsigned i;
-   struct draw_vs_varient_aos_sse *vaos = CALLOC_STRUCT(draw_vs_varient_aos_sse);
+   struct draw_vs_variant_aos_sse *vaos = CALLOC_STRUCT(draw_vs_variant_aos_sse);
 
    if (!vaos)
       goto fail;
@@ -2249,17 +2249,17 @@ static struct draw_vs_varient *varient_aos_sse( struct draw_vertex_shader *vs,
 }
 
 
-struct draw_vs_varient *
-draw_vs_create_varient_aos_sse( struct draw_vertex_shader *vs,
-                                const struct draw_vs_varient_key *key )
+struct draw_vs_variant *
+draw_vs_create_variant_aos_sse( struct draw_vertex_shader *vs,
+                                const struct draw_vs_variant_key *key )
 {
-   struct draw_vs_varient *varient = varient_aos_sse( vs, key );
+   struct draw_vs_variant *variant = variant_aos_sse( vs, key );
 
-   if (varient == NULL) {
-      varient = draw_vs_create_varient_generic( vs, key );
+   if (variant == NULL) {
+      variant = draw_vs_create_variant_generic( vs, key );
    }
 
-   return varient;
+   return variant;
 }
 
 
index 68e8295b5e117e063d8aad9007350d2c3ae75b40..55e63d8b9fabbc68a8319e25b23a4abde062767d 100644 (file)
@@ -98,9 +98,9 @@ struct aos_buffer {
 
 
 
-/* This is the temporary storage used by all the aos_sse vs varients.
+/* This is the temporary storage used by all the aos_sse vs variants.
  * Create one per context and reuse by passing a pointer in at
- * vs_varient creation??
+ * vs_variant creation??
  */
 struct aos_machine {
    float input    [MAX_INPUTS    ][4];
@@ -134,7 +134,7 @@ struct aos_machine {
 
 struct aos_compilation {
    struct x86_function *func;
-   struct draw_vs_varient_aos_sse *vaos;
+   struct draw_vs_variant_aos_sse *vaos;
 
    unsigned insn_counter;
    unsigned num_immediates;
@@ -234,8 +234,8 @@ typedef void (PIPE_CDECL *vaos_run_linear_func)( struct aos_machine *,
                                                 void *output_buffer);
 
 
-struct draw_vs_varient_aos_sse {
-   struct draw_vs_varient base;
+struct draw_vs_variant_aos_sse {
+   struct draw_vs_variant base;
    struct draw_context *draw;
 
    struct aos_buffer *buffer;
index 08608b480e03f3617ef6f980efab08f93d8bcc96..c41d7c42a018e20ff58aafe47b89894210eec249 100644 (file)
@@ -209,7 +209,7 @@ draw_create_vs_exec(struct draw_context *draw,
    vs->base.prepare = vs_exec_prepare;
    vs->base.run_linear = vs_exec_run_linear;
    vs->base.delete = vs_exec_delete;
-   vs->base.create_varient = draw_vs_create_varient_generic;
+   vs->base.create_variant = draw_vs_create_variant_generic;
    vs->machine = draw->vs.machine;
 
    return &vs->base;
index fa9992db78324f9ffd2f6f595cc95c6a878530d7..54a5574f73ff25f07e75444f388bce9907e84253 100644 (file)
@@ -65,19 +65,7 @@ static void
 vs_llvm_delete( struct draw_vertex_shader *dvs )
 {
    struct llvm_vertex_shader *shader = llvm_vertex_shader(dvs);
-   struct pipe_fence_handle *fence = NULL;
    struct draw_llvm_variant_list_item *li;
-   struct pipe_context *pipe = dvs->draw->pipe;
-
-   /*
-    * XXX: This might be not neccessary at all.
-    */
-   pipe->flush(pipe, 0, &fence);
-   if (fence) {
-      pipe->screen->fence_finish(pipe->screen, fence, 0);
-      pipe->screen->fence_reference(pipe->screen, &fence, NULL);
-   }
-
 
    li = first_elem(&shader->variants);
    while(!at_end(&shader->variants, li)) {
@@ -119,7 +107,7 @@ draw_create_vs_llvm(struct draw_context *draw,
    vs->base.prepare = vs_llvm_prepare;
    vs->base.run_linear = vs_llvm_run_linear;
    vs->base.delete = vs_llvm_delete;
-   vs->base.create_varient = draw_vs_create_varient_generic;
+   vs->base.create_variant = draw_vs_create_variant_generic;
 
    make_empty_list(&vs->variants);
 
index 5df84916c5126698139e150e1bd4d1f9b47f56ed..cf894bbe8af8f58f6d58019ed297da7368ede233 100644 (file)
@@ -187,10 +187,10 @@ draw_create_vs_ppc(struct draw_context *draw,
    vs->base.draw = draw;
 #if 0
    if (1)
-      vs->base.create_varient = draw_vs_varient_aos_ppc;
+      vs->base.create_variant = draw_vs_variant_aos_ppc;
    else
 #endif
-      vs->base.create_varient = draw_vs_create_varient_generic;
+      vs->base.create_variant = draw_vs_create_variant_generic;
    vs->base.prepare = vs_ppc_prepare;
    vs->base.run_linear = vs_ppc_run_linear;
    vs->base.delete = vs_ppc_delete;
index 672efe25ccaa590b0e2a13fa483b269e80c2a92f..d55b9b0807021339e73cfc245c4665b6697d57d3 100644 (file)
@@ -172,9 +172,9 @@ draw_create_vs_sse(struct draw_context *draw,
 
    vs->base.draw = draw;
    if (1)
-      vs->base.create_varient = draw_vs_create_varient_aos_sse;
+      vs->base.create_variant = draw_vs_create_variant_aos_sse;
    else
-      vs->base.create_varient = draw_vs_create_varient_generic;
+      vs->base.create_variant = draw_vs_create_variant_generic;
    vs->base.prepare = vs_sse_prepare;
    vs->base.run_linear = vs_sse_run_linear;
    vs->base.delete = vs_sse_delete;
index eacd16018771bbe7da0785d0d7ad6263b02272a7..d8f030f61eb2f785d160d087107de45c98112690 100644 (file)
@@ -41,8 +41,8 @@
 
 /* A first pass at incorporating vertex fetch/emit functionality into 
  */
-struct draw_vs_varient_generic {
-   struct draw_vs_varient base;
+struct draw_vs_variant_generic {
+   struct draw_vs_variant base;
 
    struct draw_vertex_shader *shader;
    struct draw_context *draw;
@@ -63,13 +63,13 @@ struct draw_vs_varient_generic {
 
 
 
-static void vsvg_set_buffer( struct draw_vs_varient *varient,
+static void vsvg_set_buffer( struct draw_vs_variant *variant,
                              unsigned buffer,
                              const void *ptr,
                              unsigned stride,
                              unsigned max_index )
 {
-   struct draw_vs_varient_generic *vsvg = (struct draw_vs_varient_generic *)varient;
+   struct draw_vs_variant_generic *vsvg = (struct draw_vs_variant_generic *)variant;
 
    vsvg->fetch->set_buffer(vsvg->fetch, 
                            buffer, 
@@ -81,7 +81,7 @@ static void vsvg_set_buffer( struct draw_vs_varient *varient,
 
 /* Mainly for debug at this stage:
  */
-static void do_rhw_viewport( struct draw_vs_varient_generic *vsvg,
+static void do_rhw_viewport( struct draw_vs_variant_generic *vsvg,
                              unsigned count,
                              void *output_buffer )
 {
@@ -104,7 +104,7 @@ static void do_rhw_viewport( struct draw_vs_varient_generic *vsvg,
    }
 }
 
-static void do_viewport( struct draw_vs_varient_generic *vsvg,
+static void do_viewport( struct draw_vs_variant_generic *vsvg,
                          unsigned count,
                          void *output_buffer )
 {
@@ -126,12 +126,12 @@ static void do_viewport( struct draw_vs_varient_generic *vsvg,
 }
                          
 
-static void PIPE_CDECL vsvg_run_elts( struct draw_vs_varient *varient,
+static void PIPE_CDECL vsvg_run_elts( struct draw_vs_variant *variant,
                                       const unsigned *elts,
                                       unsigned count,
                                       void *output_buffer)
 {
-   struct draw_vs_varient_generic *vsvg = (struct draw_vs_varient_generic *)varient;
+   struct draw_vs_variant_generic *vsvg = (struct draw_vs_variant_generic *)variant;
    unsigned temp_vertex_stride = vsvg->temp_vertex_stride;
    void *temp_buffer = MALLOC( align(count,4) * temp_vertex_stride );
    
@@ -193,12 +193,12 @@ static void PIPE_CDECL vsvg_run_elts( struct draw_vs_varient *varient,
 }
 
 
-static void PIPE_CDECL vsvg_run_linear( struct draw_vs_varient *varient,
+static void PIPE_CDECL vsvg_run_linear( struct draw_vs_variant *variant,
                                         unsigned start,
                                         unsigned count,
                                         void *output_buffer )
 {
-   struct draw_vs_varient_generic *vsvg = (struct draw_vs_varient_generic *)varient;
+   struct draw_vs_variant_generic *vsvg = (struct draw_vs_variant_generic *)variant;
    unsigned temp_vertex_stride = vsvg->temp_vertex_stride;
    void *temp_buffer = MALLOC( align(count,4) * temp_vertex_stride );
        
@@ -259,20 +259,20 @@ static void PIPE_CDECL vsvg_run_linear( struct draw_vs_varient *varient,
 
 
 
-static void vsvg_destroy( struct draw_vs_varient *varient )
+static void vsvg_destroy( struct draw_vs_variant *variant )
 {
-   FREE(varient);
+   FREE(variant);
 }
 
 
-struct draw_vs_varient *
-draw_vs_create_varient_generic( struct draw_vertex_shader *vs,
-                                const struct draw_vs_varient_key *key )
+struct draw_vs_variant *
+draw_vs_create_variant_generic( struct draw_vertex_shader *vs,
+                                const struct draw_vs_variant_key *key )
 {
    unsigned i;
    struct translate_key fetch, emit;
 
-   struct draw_vs_varient_generic *vsvg = CALLOC_STRUCT( draw_vs_varient_generic );
+   struct draw_vs_variant_generic *vsvg = CALLOC_STRUCT( draw_vs_variant_generic );
    if (vsvg == NULL)
       return NULL;
 
index 8103bc917fc7f9d1a95f9e2b319c5c9cd2931445..ee05c6ba01d999ea271718dabc03d82d033c8ff8 100644 (file)
 #endif
 
 
+/**
+ * Redefine these LLVM entrypoints as invalid macros to make sure we
+ * don't accidentally use them.  We need to use the functions which
+ * take an explicit LLVMContextRef parameter.
+ */
+#define LLVMInt1Type ILLEGAL_LLVM_FUNCTION
+#define LLVMInt8Type ILLEGAL_LLVM_FUNCTION
+#define LLVMInt16Type ILLEGAL_LLVM_FUNCTION
+#define LLVMInt32Type ILLEGAL_LLVM_FUNCTION
+#define LLVMInt64Type ILLEGAL_LLVM_FUNCTION
+#define LLVMIntType ILLEGAL_LLVM_FUNCTION
+#define LLVMFloatType ILLEGAL_LLVM_FUNCTION
+#define LLVMDoubleType ILLEGAL_LLVM_FUNCTION
+#define LLVMX86FP80Type ILLEGAL_LLVM_FUNCTION
+#define LLVMFP128Type ILLEGAL_LLVM_FUNCTION
+#define LLVMPPCFP128Type ILLEGAL_LLVM_FUNCTION
+#define LLVMStructType ILLEGAL_LLVM_FUNCTION
+#define LLVMVoidType ILLEGAL_LLVM_FUNCTION
+#define LLVMLabelType ILLEGAL_LLVM_FUNCTION
+#define LLVMOpaqueType ILLEGAL_LLVM_FUNCTION
+#define LLVMUnionType ILLEGAL_LLVM_FUNCTION
+#define LLVMMDString ILLEGAL_LLVM_FUNCTION
+#define LLVMMDNode ILLEGAL_LLVM_FUNCTION
+#define LLVMConstString ILLEGAL_LLVM_FUNCTION
+#define LLVMConstStruct ILLEGAL_LLVM_FUNCTION
+#define LLVMAppendBasicBlock ILLEGAL_LLVM_FUNCTION
+#define LLVMInsertBasicBlock ILLEGAL_LLVM_FUNCTION
+#define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
+
 #endif /* LP_BLD_H */
index f9a12a41a1b6c4d669a4305d106506594c610a14..02b3bde789398d9eee014211c0075ff36f433931 100644 (file)
@@ -53,6 +53,7 @@
 
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
+#include "lp_bld_init.h"
 #include "lp_bld_intr.h"
 #include "lp_bld_logic.h"
 #include "lp_bld_pack.h"
@@ -74,6 +75,7 @@ lp_build_min_simple(struct lp_build_context *bld,
                     LLVMValueRef a,
                     LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    const char *intrinsic = NULL;
    LLVMValueRef cond;
@@ -107,7 +109,7 @@ lp_build_min_simple(struct lp_build_context *bld,
    }
 
    if(intrinsic)
-      return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b);
+      return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
 
    cond = lp_build_cmp(bld, PIPE_FUNC_LESS, a, b);
    return lp_build_select(bld, cond, a, b);
@@ -123,6 +125,7 @@ lp_build_max_simple(struct lp_build_context *bld,
                     LLVMValueRef a,
                     LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    const char *intrinsic = NULL;
    LLVMValueRef cond;
@@ -156,7 +159,7 @@ lp_build_max_simple(struct lp_build_context *bld,
    }
 
    if(intrinsic)
-      return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b);
+      return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
 
    cond = lp_build_cmp(bld, PIPE_FUNC_GREATER, a, b);
    return lp_build_select(bld, cond, a, b);
@@ -170,6 +173,7 @@ LLVMValueRef
 lp_build_comp(struct lp_build_context *bld,
               LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(lp_check_value(type, a));
@@ -183,7 +187,7 @@ lp_build_comp(struct lp_build_context *bld,
       if(LLVMIsConstant(a))
          return LLVMConstNot(a);
       else
-         return LLVMBuildNot(bld->builder, a, "");
+         return LLVMBuildNot(builder, a, "");
    }
 
    if(LLVMIsConstant(a))
@@ -193,9 +197,9 @@ lp_build_comp(struct lp_build_context *bld,
           return LLVMConstSub(bld->one, a);
    else
       if (type.floating)
-         return LLVMBuildFSub(bld->builder, bld->one, a, "");
+         return LLVMBuildFSub(builder, bld->one, a, "");
       else
-         return LLVMBuildSub(bld->builder, bld->one, a, "");
+         return LLVMBuildSub(builder, bld->one, a, "");
 }
 
 
@@ -207,6 +211,7 @@ lp_build_add(struct lp_build_context *bld,
              LLVMValueRef a,
              LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -236,7 +241,7 @@ lp_build_add(struct lp_build_context *bld,
       }
    
       if(intrinsic)
-         return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b);
+         return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
    }
 
    if(LLVMIsConstant(a) && LLVMIsConstant(b))
@@ -246,9 +251,9 @@ lp_build_add(struct lp_build_context *bld,
          res = LLVMConstAdd(a, b);
    else
       if (type.floating)
-         res = LLVMBuildFAdd(bld->builder, a, b, "");
+         res = LLVMBuildFAdd(builder, a, b, "");
       else
-         res = LLVMBuildAdd(bld->builder, a, b, "");
+         res = LLVMBuildAdd(builder, a, b, "");
 
    /* clamp to ceiling of 1.0 */
    if(bld->type.norm && (bld->type.floating || bld->type.fixed))
@@ -265,6 +270,7 @@ LLVMValueRef
 lp_build_sum_vector(struct lp_build_context *bld,
                     LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef index, res;
    unsigned i;
@@ -277,19 +283,19 @@ lp_build_sum_vector(struct lp_build_context *bld,
 
    assert(!bld->type.norm);
 
-   index = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   res = LLVMBuildExtractElement(bld->builder, a, index, "");
+   index = lp_build_const_int32(bld->gallivm, 0);
+   res = LLVMBuildExtractElement(builder, a, index, "");
 
    for (i = 1; i < type.length; i++) {
-      index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      index = lp_build_const_int32(bld->gallivm, i);
       if (type.floating)
-         res = LLVMBuildFAdd(bld->builder, res,
-                            LLVMBuildExtractElement(bld->builder,
+         res = LLVMBuildFAdd(builder, res,
+                            LLVMBuildExtractElement(builder,
                                                     a, index, ""),
                             "");
       else
-         res = LLVMBuildAdd(bld->builder, res,
-                            LLVMBuildExtractElement(bld->builder,
+         res = LLVMBuildAdd(builder, res,
+                            LLVMBuildExtractElement(builder,
                                                     a, index, ""),
                             "");
    }
@@ -306,6 +312,7 @@ lp_build_sub(struct lp_build_context *bld,
              LLVMValueRef a,
              LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -335,7 +342,7 @@ lp_build_sub(struct lp_build_context *bld,
       }
    
       if(intrinsic)
-         return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b);
+         return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
    }
 
    if(LLVMIsConstant(a) && LLVMIsConstant(b))
@@ -345,9 +352,9 @@ lp_build_sub(struct lp_build_context *bld,
          res = LLVMConstSub(a, b);
    else
       if (type.floating)
-         res = LLVMBuildFSub(bld->builder, a, b, "");
+         res = LLVMBuildFSub(builder, a, b, "");
       else
-         res = LLVMBuildSub(bld->builder, a, b, "");
+         res = LLVMBuildSub(builder, a, b, "");
 
    if(bld->type.norm && (bld->type.floating || bld->type.fixed))
       res = lp_build_max_simple(bld, res, bld->zero);
@@ -398,10 +405,11 @@ lp_build_sub(struct lp_build_context *bld,
  *     http://www.stereopsis.com/doubleblend.html
  */
 static LLVMValueRef
-lp_build_mul_u8n(LLVMBuilderRef builder,
+lp_build_mul_u8n(struct gallivm_state *gallivm,
                  struct lp_type i16_type,
                  LLVMValueRef a, LLVMValueRef b)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef c8;
    LLVMValueRef ab;
 
@@ -409,12 +417,12 @@ lp_build_mul_u8n(LLVMBuilderRef builder,
    assert(lp_check_value(i16_type, a));
    assert(lp_check_value(i16_type, b));
 
-   c8 = lp_build_const_int_vec(i16_type, 8);
+   c8 = lp_build_const_int_vec(gallivm, i16_type, 8);
    
 #if 0
    
    /* a*b/255 ~= (a*(b + 1)) >> 256 */
-   b = LLVMBuildAdd(builder, b, lp_build_const_int_vec(i16_type, 1), "");
+   b = LLVMBuildAdd(builder, b, lp_build_const_int_vec(gallium, i16_type, 1), "");
    ab = LLVMBuildMul(builder, a, b, "");
 
 #else
@@ -422,7 +430,7 @@ lp_build_mul_u8n(LLVMBuilderRef builder,
    /* ab/255 ~= (ab + (ab >> 8) + 0x80) >> 8 */
    ab = LLVMBuildMul(builder, a, b, "");
    ab = LLVMBuildAdd(builder, ab, LLVMBuildLShr(builder, ab, c8, ""), "");
-   ab = LLVMBuildAdd(builder, ab, lp_build_const_int_vec(i16_type, 0x80), "");
+   ab = LLVMBuildAdd(builder, ab, lp_build_const_int_vec(gallivm, i16_type, 0x80), "");
 
 #endif
    
@@ -440,6 +448,7 @@ lp_build_mul(struct lp_build_context *bld,
              LLVMValueRef a,
              LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef shift;
    LLVMValueRef res;
@@ -463,14 +472,14 @@ lp_build_mul(struct lp_build_context *bld,
          struct lp_type i16_type = lp_wider_type(type);
          LLVMValueRef al, ah, bl, bh, abl, abh, ab;
 
-         lp_build_unpack2(bld->builder, type, i16_type, a, &al, &ah);
-         lp_build_unpack2(bld->builder, type, i16_type, b, &bl, &bh);
+         lp_build_unpack2(bld->gallivm, type, i16_type, a, &al, &ah);
+         lp_build_unpack2(bld->gallivm, type, i16_type, b, &bl, &bh);
 
          /* PMULLW, PSRLW, PADDW */
-         abl = lp_build_mul_u8n(bld->builder, i16_type, al, bl);
-         abh = lp_build_mul_u8n(bld->builder, i16_type, ah, bh);
+         abl = lp_build_mul_u8n(bld->gallivm, i16_type, al, bl);
+         abh = lp_build_mul_u8n(bld->gallivm, i16_type, ah, bh);
 
-         ab = lp_build_pack2(bld->builder, i16_type, type, abl, abh);
+         ab = lp_build_pack2(bld->gallivm, i16_type, type, abl, abh);
          
          return ab;
       }
@@ -480,7 +489,7 @@ lp_build_mul(struct lp_build_context *bld,
    }
 
    if(type.fixed)
-      shift = lp_build_const_int_vec(type, type.width/2);
+      shift = lp_build_const_int_vec(bld->gallivm, type, type.width/2);
    else
       shift = NULL;
 
@@ -498,14 +507,14 @@ lp_build_mul(struct lp_build_context *bld,
    }
    else {
       if (type.floating)
-         res = LLVMBuildFMul(bld->builder, a, b, "");
+         res = LLVMBuildFMul(builder, a, b, "");
       else
-         res = LLVMBuildMul(bld->builder, a, b, "");
+         res = LLVMBuildMul(builder, a, b, "");
       if(shift) {
          if(type.sign)
-            res = LLVMBuildAShr(bld->builder, res, shift, "");
+            res = LLVMBuildAShr(builder, res, shift, "");
          else
-            res = LLVMBuildLShr(bld->builder, res, shift, "");
+            res = LLVMBuildLShr(builder, res, shift, "");
       }
    }
 
@@ -521,6 +530,7 @@ lp_build_mul_imm(struct lp_build_context *bld,
                  LLVMValueRef a,
                  int b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef factor;
 
    assert(lp_check_value(bld->type, a));
@@ -550,20 +560,20 @@ lp_build_mul_imm(struct lp_build_context *bld,
           * for Inf and NaN.
           */
          unsigned mantissa = lp_mantissa(bld->type);
-         factor = lp_build_const_int_vec(bld->type, (unsigned long long)shift << mantissa);
-         a = LLVMBuildBitCast(bld->builder, a, lp_build_int_vec_type(bld->type), "");
-         a = LLVMBuildAdd(bld->builder, a, factor, "");
-         a = LLVMBuildBitCast(bld->builder, a, lp_build_vec_type(bld->type), "");
+         factor = lp_build_const_int_vec(bld->gallivm, bld->type, (unsigned long long)shift << mantissa);
+         a = LLVMBuildBitCast(builder, a, lp_build_int_vec_type(bld->type), "");
+         a = LLVMBuildAdd(builder, a, factor, "");
+         a = LLVMBuildBitCast(builder, a, lp_build_vec_type(bld->gallivm, bld->type), "");
          return a;
 #endif
       }
       else {
-         factor = lp_build_const_vec(bld->type, shift);
-         return LLVMBuildShl(bld->builder, a, factor, "");
+         factor = lp_build_const_vec(bld->gallivm, bld->type, shift);
+         return LLVMBuildShl(builder, a, factor, "");
       }
    }
 
-   factor = lp_build_const_vec(bld->type, (double)b);
+   factor = lp_build_const_vec(bld->gallivm, bld->type, (double)b);
    return lp_build_mul(bld, a, factor);
 }
 
@@ -576,6 +586,7 @@ lp_build_div(struct lp_build_context *bld,
              LLVMValueRef a,
              LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(lp_check_value(type, a));
@@ -605,11 +616,11 @@ lp_build_div(struct lp_build_context *bld,
       return lp_build_mul(bld, a, lp_build_rcp(bld, b));
 
    if (type.floating)
-      return LLVMBuildFDiv(bld->builder, a, b, "");
+      return LLVMBuildFDiv(builder, a, b, "");
    else if (type.sign)
-      return LLVMBuildSDiv(bld->builder, a, b, "");
+      return LLVMBuildSDiv(builder, a, b, "");
    else
-      return LLVMBuildUDiv(bld->builder, a, b, "");
+      return LLVMBuildUDiv(builder, a, b, "");
 }
 
 
@@ -624,6 +635,7 @@ lp_build_lerp_simple(struct lp_build_context *bld,
                      LLVMValueRef v0,
                      LLVMValueRef v1)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef delta;
    LLVMValueRef res;
 
@@ -642,7 +654,7 @@ lp_build_lerp_simple(struct lp_build_context *bld,
        * but it will be wrong for other uses. Basically we need a more
        * powerful lp_type, capable of further distinguishing the values
        * interpretation from the value storage. */
-      res = LLVMBuildAnd(bld->builder, res, lp_build_const_int_vec(bld->type, (1 << bld->type.width/2) - 1), "");
+      res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(bld->gallivm, bld->type, (1 << bld->type.width/2) - 1), "");
    }
 
    return res;
@@ -658,6 +670,7 @@ lp_build_lerp(struct lp_build_context *bld,
               LLVMValueRef v0,
               LLVMValueRef v1)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -683,22 +696,22 @@ lp_build_lerp(struct lp_build_context *bld,
       wide_type.width  = type.width*2;
       wide_type.length = type.length/2;
 
-      lp_build_context_init(&wide_bld, bld->builder, wide_type);
+      lp_build_context_init(&wide_bld, bld->gallivm, wide_type);
 
-      lp_build_unpack2(bld->builder, type, wide_type, x,  &xl,  &xh);
-      lp_build_unpack2(bld->builder, type, wide_type, v0, &v0l, &v0h);
-      lp_build_unpack2(bld->builder, type, wide_type, v1, &v1l, &v1h);
+      lp_build_unpack2(bld->gallivm, type, wide_type, x,  &xl,  &xh);
+      lp_build_unpack2(bld->gallivm, type, wide_type, v0, &v0l, &v0h);
+      lp_build_unpack2(bld->gallivm, type, wide_type, v1, &v1l, &v1h);
 
       /*
        * Scale x from [0, 255] to [0, 256]
        */
 
-      shift = lp_build_const_int_vec(wide_type, type.width - 1);
+      shift = lp_build_const_int_vec(bld->gallivm, wide_type, type.width - 1);
 
       xl = lp_build_add(&wide_bld, xl,
-                        LLVMBuildAShr(bld->builder, xl, shift, ""));
+                        LLVMBuildAShr(builder, xl, shift, ""));
       xh = lp_build_add(&wide_bld, xh,
-                        LLVMBuildAShr(bld->builder, xh, shift, ""));
+                        LLVMBuildAShr(builder, xh, shift, ""));
 
       /*
        * Lerp both halves.
@@ -707,7 +720,7 @@ lp_build_lerp(struct lp_build_context *bld,
       resl = lp_build_lerp_simple(&wide_bld, xl, v0l, v1l);
       resh = lp_build_lerp_simple(&wide_bld, xh, v0h, v1h);
 
-      res = lp_build_pack2(bld->builder, wide_type, type, resl, resh);
+      res = lp_build_pack2(bld->gallivm, wide_type, type, resl, resh);
    } else {
       res = lp_build_lerp_simple(bld, x, v0, v1);
    }
@@ -820,8 +833,9 @@ LLVMValueRef
 lp_build_abs(struct lp_build_context *bld,
              LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef vec_type = lp_build_vec_type(type);
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
 
    assert(lp_check_value(type, a));
 
@@ -830,27 +844,27 @@ lp_build_abs(struct lp_build_context *bld,
 
    if(type.floating) {
       /* Mask out the sign bit */
-      LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+      LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
       unsigned long long absMask = ~(1ULL << (type.width - 1));
-      LLVMValueRef mask = lp_build_const_int_vec(type, ((unsigned long long) absMask));
-      a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
-      a = LLVMBuildAnd(bld->builder, a, mask, "");
-      a = LLVMBuildBitCast(bld->builder, a, vec_type, "");
+      LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type, ((unsigned long long) absMask));
+      a = LLVMBuildBitCast(builder, a, int_vec_type, "");
+      a = LLVMBuildAnd(builder, a, mask, "");
+      a = LLVMBuildBitCast(builder, a, vec_type, "");
       return a;
    }
 
    if(type.width*type.length == 128 && util_cpu_caps.has_ssse3) {
       switch(type.width) {
       case 8:
-         return lp_build_intrinsic_unary(bld->builder, "llvm.x86.ssse3.pabs.b.128", vec_type, a);
+         return lp_build_intrinsic_unary(builder, "llvm.x86.ssse3.pabs.b.128", vec_type, a);
       case 16:
-         return lp_build_intrinsic_unary(bld->builder, "llvm.x86.ssse3.pabs.w.128", vec_type, a);
+         return lp_build_intrinsic_unary(builder, "llvm.x86.ssse3.pabs.w.128", vec_type, a);
       case 32:
-         return lp_build_intrinsic_unary(bld->builder, "llvm.x86.ssse3.pabs.d.128", vec_type, a);
+         return lp_build_intrinsic_unary(builder, "llvm.x86.ssse3.pabs.d.128", vec_type, a);
       }
    }
 
-   return lp_build_max(bld, a, LLVMBuildNeg(bld->builder, a, ""));
+   return lp_build_max(bld, a, LLVMBuildNeg(builder, a, ""));
 }
 
 
@@ -858,14 +872,16 @@ LLVMValueRef
 lp_build_negate(struct lp_build_context *bld,
                 LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
+
    assert(lp_check_value(bld->type, a));
 
 #if HAVE_LLVM >= 0x0207
    if (bld->type.floating)
-      a = LLVMBuildFNeg(bld->builder, a, "");
+      a = LLVMBuildFNeg(builder, a, "");
    else
 #endif
-      a = LLVMBuildNeg(bld->builder, a, "");
+      a = LLVMBuildNeg(builder, a, "");
 
    return a;
 }
@@ -876,6 +892,7 @@ LLVMValueRef
 lp_build_sgn(struct lp_build_context *bld,
              LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef cond;
    LLVMValueRef res;
@@ -895,20 +912,20 @@ lp_build_sgn(struct lp_build_context *bld,
       LLVMValueRef one;
       unsigned long long maskBit = (unsigned long long)1 << (type.width - 1);
 
-      int_type = lp_build_int_vec_type(type);
-      vec_type = lp_build_vec_type(type);
-      mask = lp_build_const_int_vec(type, maskBit);
+      int_type = lp_build_int_vec_type(bld->gallivm, type);
+      vec_type = lp_build_vec_type(bld->gallivm, type);
+      mask = lp_build_const_int_vec(bld->gallivm, type, maskBit);
 
       /* Take the sign bit and add it to 1 constant */
-      sign = LLVMBuildBitCast(bld->builder, a, int_type, "");
-      sign = LLVMBuildAnd(bld->builder, sign, mask, "");
+      sign = LLVMBuildBitCast(builder, a, int_type, "");
+      sign = LLVMBuildAnd(builder, sign, mask, "");
       one = LLVMConstBitCast(bld->one, int_type);
-      res = LLVMBuildOr(bld->builder, sign, one, "");
-      res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
+      res = LLVMBuildOr(builder, sign, one, "");
+      res = LLVMBuildBitCast(builder, res, vec_type, "");
    }
    else
    {
-      LLVMValueRef minus_one = lp_build_const_vec(type, -1.0);
+      LLVMValueRef minus_one = lp_build_const_vec(bld->gallivm, type, -1.0);
       cond = lp_build_cmp(bld, PIPE_FUNC_GREATER, a, bld->zero);
       res = lp_build_select(bld, cond, bld->one, minus_one);
    }
@@ -931,11 +948,12 @@ LLVMValueRef
 lp_build_set_sign(struct lp_build_context *bld,
                   LLVMValueRef a, LLVMValueRef sign)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
-   LLVMTypeRef vec_type = lp_build_vec_type(type);
-   LLVMValueRef shift = lp_build_const_int_vec(type, type.width - 1);
-   LLVMValueRef mask = lp_build_const_int_vec(type,
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+   LLVMValueRef shift = lp_build_const_int_vec(bld->gallivm, type, type.width - 1);
+   LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type,
                              ~((unsigned long long) 1 << (type.width - 1)));
    LLVMValueRef val, res;
 
@@ -943,15 +961,15 @@ lp_build_set_sign(struct lp_build_context *bld,
    assert(lp_check_value(type, a));
 
    /* val = reinterpret_cast<int>(a) */
-   val = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+   val = LLVMBuildBitCast(builder, a, int_vec_type, "");
    /* val = val & mask */
-   val = LLVMBuildAnd(bld->builder, val, mask, "");
+   val = LLVMBuildAnd(builder, val, mask, "");
    /* sign = sign << shift */
-   sign = LLVMBuildShl(bld->builder, sign, shift, "");
+   sign = LLVMBuildShl(builder, sign, shift, "");
    /* res = val | sign */
-   res = LLVMBuildOr(bld->builder, val, sign, "");
+   res = LLVMBuildOr(builder, val, sign, "");
    /* res = reinterpret_cast<float>(res) */
-   res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
+   res = LLVMBuildBitCast(builder, res, vec_type, "");
 
    return res;
 }
@@ -964,12 +982,13 @@ LLVMValueRef
 lp_build_int_to_float(struct lp_build_context *bld,
                       LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef vec_type = lp_build_vec_type(type);
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
 
    assert(type.floating);
 
-   return LLVMBuildSIToFP(bld->builder, a, vec_type, "");
+   return LLVMBuildSIToFP(builder, a, vec_type, "");
 }
 
 
@@ -994,8 +1013,9 @@ lp_build_round_sse41(struct lp_build_context *bld,
                      LLVMValueRef a,
                      enum lp_build_round_sse41_mode mode)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef i32t = LLVMInt32Type();
+   LLVMTypeRef i32t = LLVMInt32TypeInContext(bld->gallivm->context);
    const char *intrinsic;
    LLVMValueRef res;
 
@@ -1027,13 +1047,13 @@ lp_build_round_sse41(struct lp_build_context *bld,
       undef = LLVMGetUndef(vec_type);
 
       args[0] = undef;
-      args[1] = LLVMBuildInsertElement(bld->builder, undef, a, index0, "");
+      args[1] = LLVMBuildInsertElement(builder, undef, a, index0, "");
       args[2] = LLVMConstInt(i32t, mode, 0);
 
-      res = lp_build_intrinsic(bld->builder, intrinsic,
+      res = lp_build_intrinsic(builder, intrinsic,
                                vec_type, args, Elements(args));
 
-      res = LLVMBuildExtractElement(bld->builder, res, index0, "");
+      res = LLVMBuildExtractElement(builder, res, index0, "");
    }
    else {
       assert(type.width*type.length == 128);
@@ -1050,7 +1070,7 @@ lp_build_round_sse41(struct lp_build_context *bld,
          return bld->undef;
       }
 
-      res = lp_build_intrinsic_binary(bld->builder, intrinsic,
+      res = lp_build_intrinsic_binary(builder, intrinsic,
                                       bld->vec_type, a,
                                       LLVMConstInt(i32t, mode, 0));
    }
@@ -1063,9 +1083,10 @@ static INLINE LLVMValueRef
 lp_build_iround_nearest_sse2(struct lp_build_context *bld,
                              LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef i32t = LLVMInt32Type();
-   LLVMTypeRef ret_type = lp_build_int_vec_type(type);
+   LLVMTypeRef i32t = LLVMInt32TypeInContext(bld->gallivm->context);
+   LLVMTypeRef ret_type = lp_build_int_vec_type(bld->gallivm, type);
    const char *intrinsic;
    LLVMValueRef res;
 
@@ -1089,9 +1110,9 @@ lp_build_iround_nearest_sse2(struct lp_build_context *bld,
 
       undef = LLVMGetUndef(vec_type);
 
-      arg = LLVMBuildInsertElement(bld->builder, undef, a, index0, "");
+      arg = LLVMBuildInsertElement(builder, undef, a, index0, "");
 
-      res = lp_build_intrinsic_unary(bld->builder, intrinsic,
+      res = lp_build_intrinsic_unary(builder, intrinsic,
                                      ret_type, arg);
    }
    else {
@@ -1099,7 +1120,7 @@ lp_build_iround_nearest_sse2(struct lp_build_context *bld,
 
       intrinsic = "llvm.x86.sse2.cvtps2dq";
 
-      res = lp_build_intrinsic_unary(bld->builder, intrinsic,
+      res = lp_build_intrinsic_unary(builder, intrinsic,
                                      ret_type, a);
    }
 
@@ -1116,6 +1137,7 @@ LLVMValueRef
 lp_build_trunc(struct lp_build_context *bld,
                LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(type.floating);
@@ -1126,11 +1148,11 @@ lp_build_trunc(struct lp_build_context *bld,
       return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_TRUNCATE);
    }
    else {
-      LLVMTypeRef vec_type = lp_build_vec_type(type);
-      LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+      LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
       LLVMValueRef res;
-      res = LLVMBuildFPToSI(bld->builder, a, int_vec_type, "");
-      res = LLVMBuildSIToFP(bld->builder, res, vec_type, "");
+      res = LLVMBuildFPToSI(builder, a, int_vec_type, "");
+      res = LLVMBuildSIToFP(builder, res, vec_type, "");
       return res;
    }
 }
@@ -1146,6 +1168,7 @@ LLVMValueRef
 lp_build_round(struct lp_build_context *bld,
                LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(type.floating);
@@ -1156,10 +1179,10 @@ lp_build_round(struct lp_build_context *bld,
       return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST);
    }
    else {
-      LLVMTypeRef vec_type = lp_build_vec_type(type);
+      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
       LLVMValueRef res;
       res = lp_build_iround(bld, a);
-      res = LLVMBuildSIToFP(bld->builder, res, vec_type, "");
+      res = LLVMBuildSIToFP(builder, res, vec_type, "");
       return res;
    }
 }
@@ -1174,6 +1197,7 @@ LLVMValueRef
 lp_build_floor(struct lp_build_context *bld,
                LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(type.floating);
@@ -1184,10 +1208,10 @@ lp_build_floor(struct lp_build_context *bld,
       return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR);
    }
    else {
-      LLVMTypeRef vec_type = lp_build_vec_type(type);
+      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
       LLVMValueRef res;
       res = lp_build_ifloor(bld, a);
-      res = LLVMBuildSIToFP(bld->builder, res, vec_type, "");
+      res = LLVMBuildSIToFP(builder, res, vec_type, "");
       return res;
    }
 }
@@ -1202,6 +1226,7 @@ LLVMValueRef
 lp_build_ceil(struct lp_build_context *bld,
               LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(type.floating);
@@ -1212,10 +1237,10 @@ lp_build_ceil(struct lp_build_context *bld,
       return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL);
    }
    else {
-      LLVMTypeRef vec_type = lp_build_vec_type(type);
+      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
       LLVMValueRef res;
       res = lp_build_iceil(bld, a);
-      res = LLVMBuildSIToFP(bld->builder, res, vec_type, "");
+      res = LLVMBuildSIToFP(builder, res, vec_type, "");
       return res;
    }
 }
@@ -1243,13 +1268,14 @@ LLVMValueRef
 lp_build_itrunc(struct lp_build_context *bld,
                 LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
 
    assert(type.floating);
    assert(lp_check_value(type, a));
 
-   return LLVMBuildFPToSI(bld->builder, a, int_vec_type, "");
+   return LLVMBuildFPToSI(builder, a, int_vec_type, "");
 }
 
 
@@ -1263,6 +1289,7 @@ LLVMValueRef
 lp_build_iround(struct lp_build_context *bld,
                 LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMTypeRef int_vec_type = bld->int_vec_type;
    LLVMValueRef res;
@@ -1282,27 +1309,28 @@ lp_build_iround(struct lp_build_context *bld,
    else {
       LLVMValueRef half;
 
-      half = lp_build_const_vec(type, 0.5);
+      half = lp_build_const_vec(bld->gallivm, type, 0.5);
 
       if (type.sign) {
          LLVMTypeRef vec_type = bld->vec_type;
-         LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
+         LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type,
+                                    (unsigned long long)1 << (type.width - 1));
          LLVMValueRef sign;
 
          /* get sign bit */
-         sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
-         sign = LLVMBuildAnd(bld->builder, sign, mask, "");
+         sign = LLVMBuildBitCast(builder, a, int_vec_type, "");
+         sign = LLVMBuildAnd(builder, sign, mask, "");
 
          /* sign * 0.5 */
-         half = LLVMBuildBitCast(bld->builder, half, int_vec_type, "");
-         half = LLVMBuildOr(bld->builder, sign, half, "");
-         half = LLVMBuildBitCast(bld->builder, half, vec_type, "");
+         half = LLVMBuildBitCast(builder, half, int_vec_type, "");
+         half = LLVMBuildOr(builder, sign, half, "");
+         half = LLVMBuildBitCast(builder, half, vec_type, "");
       }
 
-      res = LLVMBuildFAdd(bld->builder, a, half, "");
+      res = LLVMBuildFAdd(builder, a, half, "");
    }
 
-   res = LLVMBuildFPToSI(bld->builder, res, int_vec_type, "");
+   res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
 
    return res;
 }
@@ -1317,6 +1345,7 @@ LLVMValueRef
 lp_build_ifloor(struct lp_build_context *bld,
                 LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMTypeRef int_vec_type = bld->int_vec_type;
    LLVMValueRef res;
@@ -1335,29 +1364,34 @@ lp_build_ifloor(struct lp_build_context *bld,
          /* Take the sign bit and add it to 1 constant */
          LLVMTypeRef vec_type = bld->vec_type;
          unsigned mantissa = lp_mantissa(type);
-         LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
+         LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type,
+                                  (unsigned long long)1 << (type.width - 1));
          LLVMValueRef sign;
          LLVMValueRef offset;
 
          /* sign = a < 0 ? ~0 : 0 */
-         sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
-         sign = LLVMBuildAnd(bld->builder, sign, mask, "");
-         sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "ifloor.sign");
+         sign = LLVMBuildBitCast(builder, a, int_vec_type, "");
+         sign = LLVMBuildAnd(builder, sign, mask, "");
+         sign = LLVMBuildAShr(builder, sign,
+                              lp_build_const_int_vec(bld->gallivm, type,
+                                                     type.width - 1),
+                              "ifloor.sign");
 
          /* offset = -0.99999(9)f */
-         offset = lp_build_const_vec(type, -(double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
+         offset = lp_build_const_vec(bld->gallivm, type,
+                                     -(double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
          offset = LLVMConstBitCast(offset, int_vec_type);
 
          /* offset = a < 0 ? offset : 0.0f */
-         offset = LLVMBuildAnd(bld->builder, offset, sign, "");
-         offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "ifloor.offset");
+         offset = LLVMBuildAnd(builder, offset, sign, "");
+         offset = LLVMBuildBitCast(builder, offset, vec_type, "ifloor.offset");
 
-         res = LLVMBuildFAdd(bld->builder, res, offset, "ifloor.res");
+         res = LLVMBuildFAdd(builder, res, offset, "ifloor.res");
       }
    }
 
    /* round to nearest (toward zero) */
-   res = LLVMBuildFPToSI(bld->builder, res, int_vec_type, "ifloor.res");
+   res = LLVMBuildFPToSI(builder, res, int_vec_type, "ifloor.res");
 
    return res;
 }
@@ -1372,6 +1406,7 @@ LLVMValueRef
 lp_build_iceil(struct lp_build_context *bld,
                LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMTypeRef int_vec_type = bld->int_vec_type;
    LLVMValueRef res;
@@ -1389,29 +1424,34 @@ lp_build_iceil(struct lp_build_context *bld,
       LLVMValueRef offset;
 
       /* offset = 0.99999(9)f */
-      offset = lp_build_const_vec(type, (double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
+      offset = lp_build_const_vec(bld->gallivm, type,
+                                  (double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
 
       if (type.sign) {
-         LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
+         LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type,
+                                (unsigned long long)1 << (type.width - 1));
          LLVMValueRef sign;
 
          /* sign = a < 0 ? 0 : ~0 */
-         sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
-         sign = LLVMBuildAnd(bld->builder, sign, mask, "");
-         sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "iceil.sign");
-         sign = LLVMBuildNot(bld->builder, sign, "iceil.not");
+         sign = LLVMBuildBitCast(builder, a, int_vec_type, "");
+         sign = LLVMBuildAnd(builder, sign, mask, "");
+         sign = LLVMBuildAShr(builder, sign,
+                              lp_build_const_int_vec(bld->gallivm, type,
+                                                     type.width - 1),
+                              "iceil.sign");
+         sign = LLVMBuildNot(builder, sign, "iceil.not");
 
          /* offset = a < 0 ? 0.0 : offset */
          offset = LLVMConstBitCast(offset, int_vec_type);
-         offset = LLVMBuildAnd(bld->builder, offset, sign, "");
-         offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "iceil.offset");
+         offset = LLVMBuildAnd(builder, offset, sign, "");
+         offset = LLVMBuildBitCast(builder, offset, vec_type, "iceil.offset");
       }
 
-      res = LLVMBuildFAdd(bld->builder, a, offset, "iceil.res");
+      res = LLVMBuildFAdd(builder, a, offset, "iceil.res");
    }
 
    /* round to nearest (toward zero) */
-   res = LLVMBuildFPToSI(bld->builder, res, int_vec_type, "iceil.res");
+   res = LLVMBuildFPToSI(builder, res, int_vec_type, "iceil.res");
 
    return res;
 }
@@ -1429,6 +1469,7 @@ lp_build_ifloor_fract(struct lp_build_context *bld,
                       LLVMValueRef *out_ipart,
                       LLVMValueRef *out_fpart)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef ipart;
 
@@ -1442,8 +1483,8 @@ lp_build_ifloor_fract(struct lp_build_context *bld,
        */
 
       ipart = lp_build_floor(bld, a);
-      *out_fpart = LLVMBuildFSub(bld->builder, a, ipart, "fpart");
-      *out_ipart = LLVMBuildFPToSI(bld->builder, ipart, bld->int_vec_type, "ipart");
+      *out_fpart = LLVMBuildFSub(builder, a, ipart, "fpart");
+      *out_ipart = LLVMBuildFPToSI(builder, ipart, bld->int_vec_type, "ipart");
    }
    else {
       /*
@@ -1451,8 +1492,8 @@ lp_build_ifloor_fract(struct lp_build_context *bld,
        */
 
       *out_ipart = lp_build_ifloor(bld, a);
-      ipart = LLVMBuildSIToFP(bld->builder, *out_ipart, bld->vec_type, "ipart");
-      *out_fpart = LLVMBuildFSub(bld->builder, a, ipart, "fpart");
+      ipart = LLVMBuildSIToFP(builder, *out_ipart, bld->vec_type, "ipart");
+      *out_fpart = LLVMBuildFSub(builder, a, ipart, "fpart");
    }
 }
 
@@ -1461,8 +1502,9 @@ LLVMValueRef
 lp_build_sqrt(struct lp_build_context *bld,
               LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef vec_type = lp_build_vec_type(type);
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
    char intrinsic[32];
 
    assert(lp_check_value(type, a));
@@ -1473,7 +1515,7 @@ lp_build_sqrt(struct lp_build_context *bld,
    assert(type.floating);
    util_snprintf(intrinsic, sizeof intrinsic, "llvm.sqrt.v%uf%u", type.length, type.width);
 
-   return lp_build_intrinsic_unary(bld->builder, intrinsic, vec_type, a);
+   return lp_build_intrinsic_unary(builder, intrinsic, vec_type, a);
 }
 
 
@@ -1496,12 +1538,13 @@ lp_build_rcp_refine(struct lp_build_context *bld,
                     LLVMValueRef a,
                     LLVMValueRef rcp_a)
 {
-   LLVMValueRef two = lp_build_const_vec(bld->type, 2.0);
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMValueRef two = lp_build_const_vec(bld->gallivm, bld->type, 2.0);
    LLVMValueRef res;
 
-   res = LLVMBuildFMul(bld->builder, a, rcp_a, "");
-   res = LLVMBuildFSub(bld->builder, two, res, "");
-   res = LLVMBuildFMul(bld->builder, rcp_a, res, "");
+   res = LLVMBuildFMul(builder, a, rcp_a, "");
+   res = LLVMBuildFSub(builder, two, res, "");
+   res = LLVMBuildFMul(builder, rcp_a, res, "");
 
    return res;
 }
@@ -1511,6 +1554,7 @@ LLVMValueRef
 lp_build_rcp(struct lp_build_context *bld,
              LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(lp_check_value(type, a));
@@ -1545,7 +1589,7 @@ lp_build_rcp(struct lp_build_context *bld,
       LLVMValueRef res;
       unsigned i;
 
-      res = lp_build_intrinsic_unary(bld->builder, "llvm.x86.sse.rcp.ps", bld->vec_type, a);
+      res = lp_build_intrinsic_unary(builder, "llvm.x86.sse.rcp.ps", bld->vec_type, a);
 
       for (i = 0; i < num_iterations; ++i) {
          res = lp_build_rcp_refine(bld, a, res);
@@ -1554,7 +1598,7 @@ lp_build_rcp(struct lp_build_context *bld,
       return res;
    }
 
-   return LLVMBuildFDiv(bld->builder, bld->one, a, "");
+   return LLVMBuildFDiv(builder, bld->one, a, "");
 }
 
 
@@ -1571,15 +1615,16 @@ lp_build_rsqrt_refine(struct lp_build_context *bld,
                       LLVMValueRef a,
                       LLVMValueRef rsqrt_a)
 {
-   LLVMValueRef half = lp_build_const_vec(bld->type, 0.5);
-   LLVMValueRef three = lp_build_const_vec(bld->type, 3.0);
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMValueRef half = lp_build_const_vec(bld->gallivm, bld->type, 0.5);
+   LLVMValueRef three = lp_build_const_vec(bld->gallivm, bld->type, 3.0);
    LLVMValueRef res;
 
-   res = LLVMBuildFMul(bld->builder, rsqrt_a, rsqrt_a, "");
-   res = LLVMBuildFMul(bld->builder, a, res, "");
-   res = LLVMBuildFSub(bld->builder, three, res, "");
-   res = LLVMBuildFMul(bld->builder, rsqrt_a, res, "");
-   res = LLVMBuildFMul(bld->builder, half, res, "");
+   res = LLVMBuildFMul(builder, rsqrt_a, rsqrt_a, "");
+   res = LLVMBuildFMul(builder, a, res, "");
+   res = LLVMBuildFSub(builder, three, res, "");
+   res = LLVMBuildFMul(builder, rsqrt_a, res, "");
+   res = LLVMBuildFMul(builder, half, res, "");
 
    return res;
 }
@@ -1592,6 +1637,7 @@ LLVMValueRef
 lp_build_rsqrt(struct lp_build_context *bld,
                LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(lp_check_value(type, a));
@@ -1603,7 +1649,7 @@ lp_build_rsqrt(struct lp_build_context *bld,
       LLVMValueRef res;
       unsigned i;
 
-      res = lp_build_intrinsic_unary(bld->builder, "llvm.x86.sse.rsqrt.ps", bld->vec_type, a);
+      res = lp_build_intrinsic_unary(builder, "llvm.x86.sse.rsqrt.ps", bld->vec_type, a);
 
       for (i = 0; i < num_iterations; ++i) {
          res = lp_build_rsqrt_refine(bld, a, res);
@@ -1617,17 +1663,17 @@ lp_build_rsqrt(struct lp_build_context *bld,
 
 
 static inline LLVMValueRef
-lp_build_const_v4si(unsigned long value)
+lp_build_const_v4si(struct gallivm_state *gallivm, unsigned long value)
 {
-   LLVMValueRef element = LLVMConstInt(LLVMInt32Type(), value, 0);
+   LLVMValueRef element = lp_build_const_int32(gallivm, value);
    LLVMValueRef elements[4] = { element, element, element, element };
    return LLVMConstVector(elements, 4);
 }
 
 static inline LLVMValueRef
-lp_build_const_v4sf(float value)
+lp_build_const_v4sf(struct gallivm_state *gallivm, float value)
 {
-   LLVMValueRef element = LLVMConstReal(LLVMFloatType(), value);
+   LLVMValueRef element = lp_build_const_float(gallivm, value);
    LLVMValueRef elements[4] = { element, element, element, element };
    return LLVMConstVector(elements, 4);
 }
@@ -1640,17 +1686,19 @@ LLVMValueRef
 lp_build_sin(struct lp_build_context *bld,
              LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   struct gallivm_state *gallivm = bld->gallivm;
    struct lp_type int_type = lp_int_type(bld->type);
-   LLVMBuilderRef b = bld->builder;
-   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatType(), 4);
-   LLVMTypeRef v4si = LLVMVectorType(LLVMInt32Type(), 4);
+   LLVMBuilderRef b = builder;
+   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatTypeInContext(bld->gallivm->context), 4);
+   LLVMTypeRef v4si = LLVMVectorType(LLVMInt32TypeInContext(bld->gallivm->context), 4);
 
    /*
     *  take the absolute value,
     *  x = _mm_and_ps(x, *(v4sf*)_ps_inv_sign_mask);
     */
 
-   LLVMValueRef inv_sig_mask = lp_build_const_v4si(~0x80000000);
+   LLVMValueRef inv_sig_mask = lp_build_const_v4si(bld->gallivm, ~0x80000000);
    LLVMValueRef a_v4si = LLVMBuildBitCast(b, a, v4si, "a_v4si");
 
    LLVMValueRef absi = LLVMBuildAnd(b, a_v4si, inv_sig_mask, "absi");
@@ -1660,7 +1708,7 @@ lp_build_sin(struct lp_build_context *bld,
     * extract the sign bit (upper one)
     * sign_bit = _mm_and_ps(sign_bit, *(v4sf*)_ps_sign_mask);
     */
-   LLVMValueRef sig_mask = lp_build_const_v4si(0x80000000);
+   LLVMValueRef sig_mask = lp_build_const_v4si(bld->gallivm, 0x80000000);
    LLVMValueRef sign_bit_i = LLVMBuildAnd(b, a_v4si, sig_mask, "sign_bit_i");
 
    /*
@@ -1668,7 +1716,7 @@ lp_build_sin(struct lp_build_context *bld,
     * y = _mm_mul_ps(x, *(v4sf*)_ps_cephes_FOPI);
     */
    
-   LLVMValueRef FOPi = lp_build_const_v4sf(1.27323954473516);
+   LLVMValueRef FOPi = lp_build_const_v4sf(gallivm, 1.27323954473516);
    LLVMValueRef scale_y = LLVMBuildFMul(b, x_abs, FOPi, "scale_y");
 
    /*
@@ -1683,12 +1731,12 @@ lp_build_sin(struct lp_build_context *bld,
     * emm2 = _mm_add_epi32(emm2, *(v4si*)_pi32_1);
     */
 
-   LLVMValueRef all_one = lp_build_const_v4si(1);
+   LLVMValueRef all_one = lp_build_const_v4si(bld->gallivm, 1);
    LLVMValueRef emm2_add =  LLVMBuildAdd(b, emm2_i, all_one, "emm2_add");
    /*
     * emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_inv1);
     */
-   LLVMValueRef inv_one = lp_build_const_v4si(~1);
+   LLVMValueRef inv_one = lp_build_const_v4si(bld->gallivm, ~1);
    LLVMValueRef emm2_and =  LLVMBuildAnd(b, emm2_add, inv_one, "emm2_and");
 
    /*
@@ -1699,13 +1747,13 @@ lp_build_sin(struct lp_build_context *bld,
    /* get the swap sign flag
     * emm0 = _mm_and_si128(emm2, *(v4si*)_pi32_4);
     */
-   LLVMValueRef pi32_4 = lp_build_const_v4si(4);
+   LLVMValueRef pi32_4 = lp_build_const_v4si(bld->gallivm, 4);
    LLVMValueRef emm0_and =  LLVMBuildAnd(b, emm2_add, pi32_4, "emm0_and");
    
    /*
     * emm2 = _mm_slli_epi32(emm0, 29);
     */  
-   LLVMValueRef const_29 = lp_build_const_v4si(29);
+   LLVMValueRef const_29 = lp_build_const_v4si(bld->gallivm, 29);
    LLVMValueRef swap_sign_bit = LLVMBuildShl(b, emm0_and, const_29, "swap_sign_bit");
 
    /*
@@ -1718,10 +1766,11 @@ lp_build_sin(struct lp_build_context *bld,
     * emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());
     */
 
-   LLVMValueRef pi32_2 = lp_build_const_v4si(2);
+   LLVMValueRef pi32_2 = lp_build_const_v4si(bld->gallivm, 2);
    LLVMValueRef emm2_3 =  LLVMBuildAnd(b, emm2_and, pi32_2, "emm2_3");
-   LLVMValueRef poly_mask = lp_build_compare(b, int_type, PIPE_FUNC_EQUAL,
-                                             emm2_3, lp_build_const_v4si(0));
+   LLVMValueRef poly_mask = lp_build_compare(bld->gallivm,
+                                             int_type, PIPE_FUNC_EQUAL,
+                                             emm2_3, lp_build_const_v4si(bld->gallivm, 0));
    /*
     *   sign_bit = _mm_xor_ps(sign_bit, swap_sign_bit);
     */
@@ -1732,9 +1781,9 @@ lp_build_sin(struct lp_build_context *bld,
     * _PS_CONST(minus_cephes_DP2, -2.4187564849853515625e-4);
     * _PS_CONST(minus_cephes_DP3, -3.77489497744594108e-8);
     */
-   LLVMValueRef DP1 = lp_build_const_v4sf(-0.78515625);
-   LLVMValueRef DP2 = lp_build_const_v4sf(-2.4187564849853515625e-4);
-   LLVMValueRef DP3 = lp_build_const_v4sf(-3.77489497744594108e-8);
+   LLVMValueRef DP1 = lp_build_const_v4sf(gallivm, -0.78515625);
+   LLVMValueRef DP2 = lp_build_const_v4sf(gallivm, -2.4187564849853515625e-4);
+   LLVMValueRef DP3 = lp_build_const_v4sf(gallivm, -3.77489497744594108e-8);
 
    /*
     * The magic pass: "Extended precision modular arithmetic" 
@@ -1769,9 +1818,9 @@ lp_build_sin(struct lp_build_context *bld,
     * _PS_CONST(coscof_p1, -1.388731625493765E-003);
     * _PS_CONST(coscof_p2,  4.166664568298827E-002);
     */
-   LLVMValueRef coscof_p0 = lp_build_const_v4sf(2.443315711809948E-005);
-   LLVMValueRef coscof_p1 = lp_build_const_v4sf(-1.388731625493765E-003);
-   LLVMValueRef coscof_p2 = lp_build_const_v4sf(4.166664568298827E-002);
+   LLVMValueRef coscof_p0 = lp_build_const_v4sf(gallivm, 2.443315711809948E-005);
+   LLVMValueRef coscof_p1 = lp_build_const_v4sf(gallivm, -1.388731625493765E-003);
+   LLVMValueRef coscof_p2 = lp_build_const_v4sf(gallivm, 4.166664568298827E-002);
 
    /*
     * y = *(v4sf*)_ps_coscof_p0;
@@ -1790,10 +1839,10 @@ lp_build_sin(struct lp_build_context *bld,
     * y = _mm_sub_ps(y, tmp);
     * y = _mm_add_ps(y, *(v4sf*)_ps_1);
     */ 
-   LLVMValueRef half = lp_build_const_v4sf(0.5);
+   LLVMValueRef half = lp_build_const_v4sf(gallivm, 0.5);
    LLVMValueRef tmp = LLVMBuildFMul(b, z, half, "tmp");
    LLVMValueRef y_9 = LLVMBuildFSub(b, y_8, tmp, "y_8");
-   LLVMValueRef one = lp_build_const_v4sf(1.0);
+   LLVMValueRef one = lp_build_const_v4sf(gallivm, 1.0);
    LLVMValueRef y_10 = LLVMBuildFAdd(b, y_9, one, "y_9");
 
    /*
@@ -1801,9 +1850,9 @@ lp_build_sin(struct lp_build_context *bld,
     * _PS_CONST(sincof_p1,  8.3321608736E-3);
     * _PS_CONST(sincof_p2, -1.6666654611E-1);
     */
-   LLVMValueRef sincof_p0 = lp_build_const_v4sf(-1.9515295891E-4);
-   LLVMValueRef sincof_p1 = lp_build_const_v4sf(8.3321608736E-3);
-   LLVMValueRef sincof_p2 = lp_build_const_v4sf(-1.6666654611E-1);
+   LLVMValueRef sincof_p0 = lp_build_const_v4sf(gallivm, -1.9515295891E-4);
+   LLVMValueRef sincof_p1 = lp_build_const_v4sf(gallivm, 8.3321608736E-3);
+   LLVMValueRef sincof_p2 = lp_build_const_v4sf(gallivm, -1.6666654611E-1);
 
    /*
     * Evaluate the second polynom  (Pi/4 <= x <= 0)
@@ -1836,7 +1885,7 @@ lp_build_sin(struct lp_build_context *bld,
    LLVMValueRef y2_i = LLVMBuildBitCast(b, y2_9, v4si, "y2_i");
    LLVMValueRef y_i = LLVMBuildBitCast(b, y_10, v4si, "y_i");
    LLVMValueRef y2_and = LLVMBuildAnd(b, y2_i, poly_mask, "y2_and");
-   LLVMValueRef inv = lp_build_const_v4si(~0);
+   LLVMValueRef inv = lp_build_const_v4si(bld->gallivm, ~0);
    LLVMValueRef poly_mask_inv = LLVMBuildXor(b, poly_mask, inv, "poly_mask_inv");
    LLVMValueRef y_and = LLVMBuildAnd(b, y_i, poly_mask_inv, "y_and");
    LLVMValueRef y_combine = LLVMBuildAdd(b, y_and, y2_and, "y_combine");
@@ -1858,17 +1907,19 @@ LLVMValueRef
 lp_build_cos(struct lp_build_context *bld,
              LLVMValueRef a)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   struct gallivm_state *gallivm = bld->gallivm;
    struct lp_type int_type = lp_int_type(bld->type);
-   LLVMBuilderRef b = bld->builder;
-   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatType(), 4);
-   LLVMTypeRef v4si = LLVMVectorType(LLVMInt32Type(), 4);
+   LLVMBuilderRef b = builder;
+   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatTypeInContext(bld->gallivm->context), 4);
+   LLVMTypeRef v4si = LLVMVectorType(LLVMInt32TypeInContext(bld->gallivm->context), 4);
 
    /*
     *  take the absolute value,
     *  x = _mm_and_ps(x, *(v4sf*)_ps_inv_sign_mask);
     */
 
-   LLVMValueRef inv_sig_mask = lp_build_const_v4si(~0x80000000);
+   LLVMValueRef inv_sig_mask = lp_build_const_v4si(bld->gallivm, ~0x80000000);
    LLVMValueRef a_v4si = LLVMBuildBitCast(b, a, v4si, "a_v4si");
 
    LLVMValueRef absi = LLVMBuildAnd(b, a_v4si, inv_sig_mask, "absi");
@@ -1879,7 +1930,7 @@ lp_build_cos(struct lp_build_context *bld,
     * y = _mm_mul_ps(x, *(v4sf*)_ps_cephes_FOPI);
     */
    
-   LLVMValueRef FOPi = lp_build_const_v4sf(1.27323954473516);
+   LLVMValueRef FOPi = lp_build_const_v4sf(gallivm, 1.27323954473516);
    LLVMValueRef scale_y = LLVMBuildFMul(b, x_abs, FOPi, "scale_y");
 
    /*
@@ -1894,12 +1945,12 @@ lp_build_cos(struct lp_build_context *bld,
     * emm2 = _mm_add_epi32(emm2, *(v4si*)_pi32_1);
     */
 
-   LLVMValueRef all_one = lp_build_const_v4si(1);
+   LLVMValueRef all_one = lp_build_const_v4si(bld->gallivm, 1);
    LLVMValueRef emm2_add =  LLVMBuildAdd(b, emm2_i, all_one, "emm2_add");
    /*
     * emm2 = _mm_and_si128(emm2, *(v4si*)_pi32_inv1);
     */
-   LLVMValueRef inv_one = lp_build_const_v4si(~1);
+   LLVMValueRef inv_one = lp_build_const_v4si(bld->gallivm, ~1);
    LLVMValueRef emm2_and =  LLVMBuildAnd(b, emm2_add, inv_one, "emm2_and");
 
    /*
@@ -1911,22 +1962,22 @@ lp_build_cos(struct lp_build_context *bld,
    /*
     * emm2 = _mm_sub_epi32(emm2, *(v4si*)_pi32_2);
     */
-   LLVMValueRef const_2 = lp_build_const_v4si(2);
+   LLVMValueRef const_2 = lp_build_const_v4si(bld->gallivm, 2);
    LLVMValueRef emm2_2 = LLVMBuildSub(b, emm2_and, const_2, "emm2_2");
 
 
    /* get the swap sign flag
     * emm0 = _mm_andnot_si128(emm2, *(v4si*)_pi32_4);
     */
-   LLVMValueRef inv = lp_build_const_v4si(~0);
+   LLVMValueRef inv = lp_build_const_v4si(bld->gallivm, ~0);
    LLVMValueRef emm0_not = LLVMBuildXor(b, emm2_2, inv, "emm0_not");
-   LLVMValueRef pi32_4 = lp_build_const_v4si(4);
+   LLVMValueRef pi32_4 = lp_build_const_v4si(bld->gallivm, 4);
    LLVMValueRef emm0_and =  LLVMBuildAnd(b, emm0_not, pi32_4, "emm0_and");
    
    /*
     * emm2 = _mm_slli_epi32(emm0, 29);
     */  
-   LLVMValueRef const_29 = lp_build_const_v4si(29);
+   LLVMValueRef const_29 = lp_build_const_v4si(bld->gallivm, 29);
    LLVMValueRef sign_bit = LLVMBuildShl(b, emm0_and, const_29, "sign_bit");
 
    /*
@@ -1939,19 +1990,20 @@ lp_build_cos(struct lp_build_context *bld,
     * emm2 = _mm_cmpeq_epi32(emm2, _mm_setzero_si128());
     */
 
-   LLVMValueRef pi32_2 = lp_build_const_v4si(2);
+   LLVMValueRef pi32_2 = lp_build_const_v4si(bld->gallivm, 2);
    LLVMValueRef emm2_3 =  LLVMBuildAnd(b, emm2_2, pi32_2, "emm2_3");
-   LLVMValueRef poly_mask = lp_build_compare(b, int_type, PIPE_FUNC_EQUAL,
-                                            emm2_3, lp_build_const_v4si(0));
+   LLVMValueRef poly_mask = lp_build_compare(bld->gallivm,
+                                             int_type, PIPE_FUNC_EQUAL,
+                                            emm2_3, lp_build_const_v4si(bld->gallivm, 0));
 
    /*
     * _PS_CONST(minus_cephes_DP1, -0.78515625);
     * _PS_CONST(minus_cephes_DP2, -2.4187564849853515625e-4);
     * _PS_CONST(minus_cephes_DP3, -3.77489497744594108e-8);
     */
-   LLVMValueRef DP1 = lp_build_const_v4sf(-0.78515625);
-   LLVMValueRef DP2 = lp_build_const_v4sf(-2.4187564849853515625e-4);
-   LLVMValueRef DP3 = lp_build_const_v4sf(-3.77489497744594108e-8);
+   LLVMValueRef DP1 = lp_build_const_v4sf(gallivm, -0.78515625);
+   LLVMValueRef DP2 = lp_build_const_v4sf(gallivm, -2.4187564849853515625e-4);
+   LLVMValueRef DP3 = lp_build_const_v4sf(gallivm, -3.77489497744594108e-8);
 
    /*
     * The magic pass: "Extended precision modular arithmetic" 
@@ -1986,9 +2038,9 @@ lp_build_cos(struct lp_build_context *bld,
     * _PS_CONST(coscof_p1, -1.388731625493765E-003);
     * _PS_CONST(coscof_p2,  4.166664568298827E-002);
     */
-   LLVMValueRef coscof_p0 = lp_build_const_v4sf(2.443315711809948E-005);
-   LLVMValueRef coscof_p1 = lp_build_const_v4sf(-1.388731625493765E-003);
-   LLVMValueRef coscof_p2 = lp_build_const_v4sf(4.166664568298827E-002);
+   LLVMValueRef coscof_p0 = lp_build_const_v4sf(gallivm, 2.443315711809948E-005);
+   LLVMValueRef coscof_p1 = lp_build_const_v4sf(gallivm, -1.388731625493765E-003);
+   LLVMValueRef coscof_p2 = lp_build_const_v4sf(gallivm, 4.166664568298827E-002);
 
    /*
     * y = *(v4sf*)_ps_coscof_p0;
@@ -2007,10 +2059,10 @@ lp_build_cos(struct lp_build_context *bld,
     * y = _mm_sub_ps(y, tmp);
     * y = _mm_add_ps(y, *(v4sf*)_ps_1);
     */ 
-   LLVMValueRef half = lp_build_const_v4sf(0.5);
+   LLVMValueRef half = lp_build_const_v4sf(gallivm, 0.5);
    LLVMValueRef tmp = LLVMBuildFMul(b, z, half, "tmp");
    LLVMValueRef y_9 = LLVMBuildFSub(b, y_8, tmp, "y_8");
-   LLVMValueRef one = lp_build_const_v4sf(1.0);
+   LLVMValueRef one = lp_build_const_v4sf(gallivm, 1.0);
    LLVMValueRef y_10 = LLVMBuildFAdd(b, y_9, one, "y_9");
 
    /*
@@ -2018,9 +2070,9 @@ lp_build_cos(struct lp_build_context *bld,
     * _PS_CONST(sincof_p1,  8.3321608736E-3);
     * _PS_CONST(sincof_p2, -1.6666654611E-1);
     */
-   LLVMValueRef sincof_p0 = lp_build_const_v4sf(-1.9515295891E-4);
-   LLVMValueRef sincof_p1 = lp_build_const_v4sf(8.3321608736E-3);
-   LLVMValueRef sincof_p2 = lp_build_const_v4sf(-1.6666654611E-1);
+   LLVMValueRef sincof_p0 = lp_build_const_v4sf(gallivm, -1.9515295891E-4);
+   LLVMValueRef sincof_p1 = lp_build_const_v4sf(gallivm, 8.3321608736E-3);
+   LLVMValueRef sincof_p2 = lp_build_const_v4sf(gallivm, -1.6666654611E-1);
 
    /*
     * Evaluate the second polynom  (Pi/4 <= x <= 0)
@@ -2094,7 +2146,8 @@ lp_build_exp(struct lp_build_context *bld,
              LLVMValueRef x)
 {
    /* log2(e) = 1/log(2) */
-   LLVMValueRef log2e = lp_build_const_vec(bld->type, 1.4426950408889634);
+   LLVMValueRef log2e = lp_build_const_vec(bld->gallivm, bld->type,
+                                           1.4426950408889634);
 
    assert(lp_check_value(bld->type, x));
 
@@ -2110,7 +2163,8 @@ lp_build_log(struct lp_build_context *bld,
              LLVMValueRef x)
 {
    /* log(2) */
-   LLVMValueRef log2 = lp_build_const_vec(bld->type, 0.69314718055994529);
+   LLVMValueRef log2 = lp_build_const_vec(bld->gallivm, bld->type,
+                                          0.69314718055994529);
 
    assert(lp_check_value(bld->type, x));
 
@@ -2144,7 +2198,7 @@ lp_build_polynomial(struct lp_build_context *bld,
    for (i = num_coeffs; i--; ) {
       LLVMValueRef coeff;
 
-      coeff = lp_build_const_vec(type, coeffs[i]);
+      coeff = lp_build_const_vec(bld->gallivm, type, coeffs[i]);
 
       if(res)
          res = lp_build_add(bld, coeff, lp_build_mul(bld, x, res));
@@ -2198,9 +2252,10 @@ lp_build_exp2_approx(struct lp_build_context *bld,
                      LLVMValueRef *p_frac_part,
                      LLVMValueRef *p_exp2)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef vec_type = lp_build_vec_type(type);
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
    LLVMValueRef ipart = NULL;
    LLVMValueRef fpart = NULL;
    LLVMValueRef expipart = NULL;
@@ -2219,29 +2274,31 @@ lp_build_exp2_approx(struct lp_build_context *bld,
 
       assert(type.floating && type.width == 32);
 
-      x = lp_build_min(bld, x, lp_build_const_vec(type,  129.0));
-      x = lp_build_max(bld, x, lp_build_const_vec(type, -126.99999));
+      x = lp_build_min(bld, x, lp_build_const_vec(bld->gallivm, type,  129.0));
+      x = lp_build_max(bld, x, lp_build_const_vec(bld->gallivm, type, -126.99999));
 
       /* ipart = floor(x) */
       ipart = lp_build_floor(bld, x);
 
       /* fpart = x - ipart */
-      fpart = LLVMBuildFSub(bld->builder, x, ipart, "");
+      fpart = LLVMBuildFSub(builder, x, ipart, "");
    }
 
    if(p_exp2_int_part || p_exp2) {
       /* expipart = (float) (1 << ipart) */
-      ipart = LLVMBuildFPToSI(bld->builder, ipart, int_vec_type, "");
-      expipart = LLVMBuildAdd(bld->builder, ipart, lp_build_const_int_vec(type, 127), "");
-      expipart = LLVMBuildShl(bld->builder, expipart, lp_build_const_int_vec(type, 23), "");
-      expipart = LLVMBuildBitCast(bld->builder, expipart, vec_type, "");
+      ipart = LLVMBuildFPToSI(builder, ipart, int_vec_type, "");
+      expipart = LLVMBuildAdd(builder, ipart,
+                              lp_build_const_int_vec(bld->gallivm, type, 127), "");
+      expipart = LLVMBuildShl(builder, expipart,
+                              lp_build_const_int_vec(bld->gallivm, type, 23), "");
+      expipart = LLVMBuildBitCast(builder, expipart, vec_type, "");
    }
 
    if(p_exp2) {
       expfpart = lp_build_polynomial(bld, fpart, lp_build_exp2_polynomial,
                                      Elements(lp_build_exp2_polynomial));
 
-      res = LLVMBuildFMul(bld->builder, expipart, expfpart, "");
+      res = LLVMBuildFMul(builder, expipart, expfpart, "");
    }
 
    if(p_exp2_int_part)
@@ -2279,6 +2336,7 @@ lp_build_extract_exponent(struct lp_build_context *bld,
                           LLVMValueRef x,
                           int bias)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    unsigned mantissa = lp_mantissa(type);
    LLVMValueRef res;
@@ -2287,11 +2345,14 @@ lp_build_extract_exponent(struct lp_build_context *bld,
 
    assert(lp_check_value(bld->type, x));
 
-   x = LLVMBuildBitCast(bld->builder, x, bld->int_vec_type, "");
+   x = LLVMBuildBitCast(builder, x, bld->int_vec_type, "");
 
-   res = LLVMBuildLShr(bld->builder, x, lp_build_const_int_vec(type, mantissa), "");
-   res = LLVMBuildAnd(bld->builder, res, lp_build_const_int_vec(type, 255), "");
-   res = LLVMBuildSub(bld->builder, res, lp_build_const_int_vec(type, 127 - bias), "");
+   res = LLVMBuildLShr(builder, x,
+                       lp_build_const_int_vec(bld->gallivm, type, mantissa), "");
+   res = LLVMBuildAnd(builder, res,
+                      lp_build_const_int_vec(bld->gallivm, type, 255), "");
+   res = LLVMBuildSub(builder, res,
+                      lp_build_const_int_vec(bld->gallivm, type, 127 - bias), "");
 
    return res;
 }
@@ -2308,9 +2369,11 @@ LLVMValueRef
 lp_build_extract_mantissa(struct lp_build_context *bld,
                           LLVMValueRef x)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    unsigned mantissa = lp_mantissa(type);
-   LLVMValueRef mantmask = lp_build_const_int_vec(type, (1ULL << mantissa) - 1);
+   LLVMValueRef mantmask = lp_build_const_int_vec(bld->gallivm, type,
+                                                  (1ULL << mantissa) - 1);
    LLVMValueRef one = LLVMConstBitCast(bld->one, bld->int_vec_type);
    LLVMValueRef res;
 
@@ -2318,12 +2381,12 @@ lp_build_extract_mantissa(struct lp_build_context *bld,
 
    assert(type.floating);
 
-   x = LLVMBuildBitCast(bld->builder, x, bld->int_vec_type, "");
+   x = LLVMBuildBitCast(builder, x, bld->int_vec_type, "");
 
    /* res = x / 2**ipart */
-   res = LLVMBuildAnd(bld->builder, x, mantmask, "");
-   res = LLVMBuildOr(bld->builder, res, one, "");
-   res = LLVMBuildBitCast(bld->builder, res, bld->vec_type, "");
+   res = LLVMBuildAnd(builder, x, mantmask, "");
+   res = LLVMBuildOr(builder, res, one, "");
+   res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
 
    return res;
 }
@@ -2374,12 +2437,13 @@ lp_build_log2_approx(struct lp_build_context *bld,
                      LLVMValueRef *p_floor_log2,
                      LLVMValueRef *p_log2)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
-   LLVMTypeRef vec_type = lp_build_vec_type(type);
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
 
-   LLVMValueRef expmask = lp_build_const_int_vec(type, 0x7f800000);
-   LLVMValueRef mantmask = lp_build_const_int_vec(type, 0x007fffff);
+   LLVMValueRef expmask = lp_build_const_int_vec(bld->gallivm, type, 0x7f800000);
+   LLVMValueRef mantmask = lp_build_const_int_vec(bld->gallivm, type, 0x007fffff);
    LLVMValueRef one = LLVMConstBitCast(bld->one, int_vec_type);
 
    LLVMValueRef i = NULL;
@@ -2401,35 +2465,35 @@ lp_build_log2_approx(struct lp_build_context *bld,
 
       assert(type.floating && type.width == 32);
 
-      i = LLVMBuildBitCast(bld->builder, x, int_vec_type, "");
+      i = LLVMBuildBitCast(builder, x, int_vec_type, "");
 
       /* exp = (float) exponent(x) */
-      exp = LLVMBuildAnd(bld->builder, i, expmask, "");
+      exp = LLVMBuildAnd(builder, i, expmask, "");
    }
 
    if(p_floor_log2 || p_log2) {
-      logexp = LLVMBuildLShr(bld->builder, exp, lp_build_const_int_vec(type, 23), "");
-      logexp = LLVMBuildSub(bld->builder, logexp, lp_build_const_int_vec(type, 127), "");
-      logexp = LLVMBuildSIToFP(bld->builder, logexp, vec_type, "");
+      logexp = LLVMBuildLShr(builder, exp, lp_build_const_int_vec(bld->gallivm, type, 23), "");
+      logexp = LLVMBuildSub(builder, logexp, lp_build_const_int_vec(bld->gallivm, type, 127), "");
+      logexp = LLVMBuildSIToFP(builder, logexp, vec_type, "");
    }
 
    if(p_log2) {
       /* mant = (float) mantissa(x) */
-      mant = LLVMBuildAnd(bld->builder, i, mantmask, "");
-      mant = LLVMBuildOr(bld->builder, mant, one, "");
-      mant = LLVMBuildBitCast(bld->builder, mant, vec_type, "");
+      mant = LLVMBuildAnd(builder, i, mantmask, "");
+      mant = LLVMBuildOr(builder, mant, one, "");
+      mant = LLVMBuildBitCast(builder, mant, vec_type, "");
 
       logmant = lp_build_polynomial(bld, mant, lp_build_log2_polynomial,
                                     Elements(lp_build_log2_polynomial));
 
       /* This effectively increases the polynomial degree by one, but ensures that log2(1) == 0*/
-      logmant = LLVMBuildFMul(bld->builder, logmant, LLVMBuildFSub(bld->builder, mant, bld->one, ""), "");
+      logmant = LLVMBuildFMul(builder, logmant, LLVMBuildFSub(builder, mant, bld->one, ""), "");
 
-      res = LLVMBuildFAdd(bld->builder, logmant, logexp, "");
+      res = LLVMBuildFAdd(builder, logmant, logexp, "");
    }
 
    if(p_exp) {
-      exp = LLVMBuildBitCast(bld->builder, exp, vec_type, "");
+      exp = LLVMBuildBitCast(builder, exp, vec_type, "");
       *p_exp = exp;
    }
 
@@ -2465,6 +2529,7 @@ LLVMValueRef
 lp_build_fast_log2(struct lp_build_context *bld,
                    LLVMValueRef x)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef ipart;
    LLVMValueRef fpart;
 
@@ -2474,13 +2539,13 @@ lp_build_fast_log2(struct lp_build_context *bld,
 
    /* ipart = floor(log2(x)) - 1 */
    ipart = lp_build_extract_exponent(bld, x, -1);
-   ipart = LLVMBuildSIToFP(bld->builder, ipart, bld->vec_type, "");
+   ipart = LLVMBuildSIToFP(builder, ipart, bld->vec_type, "");
 
    /* fpart = x / 2**ipart */
    fpart = lp_build_extract_mantissa(bld, x);
 
    /* ipart + fpart */
-   return LLVMBuildFAdd(bld->builder, ipart, fpart, "");
+   return LLVMBuildFAdd(builder, ipart, fpart, "");
 }
 
 
@@ -2493,7 +2558,8 @@ LLVMValueRef
 lp_build_ilog2(struct lp_build_context *bld,
                LLVMValueRef x)
 {
-   LLVMValueRef sqrt2 = lp_build_const_vec(bld->type, M_SQRT2);
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMValueRef sqrt2 = lp_build_const_vec(bld->gallivm, bld->type, M_SQRT2);
    LLVMValueRef ipart;
 
    assert(bld->type.floating);
@@ -2501,7 +2567,7 @@ lp_build_ilog2(struct lp_build_context *bld,
    assert(lp_check_value(bld->type, x));
 
    /* x * 2^(0.5)   i.e., add 0.5 to the log2(x) */
-   x = LLVMBuildFMul(bld->builder, x, sqrt2, "");
+   x = LLVMBuildFMul(builder, x, sqrt2, "");
 
    /* ipart = floor(log2(x) + 0.5)  */
    ipart = lp_build_extract_exponent(bld, x, 0);
index f2ebd868a8daa280800e13d588b8f6613a2a5cb4..9de5e8e7b51459377ce252f11d4f689bd5751071 100644 (file)
@@ -56,20 +56,21 @@ lp_assert(int condition, const char *msg)
  * \param msg  a string to print if the assertion fails.
  */
 LLVMValueRef
-lp_build_assert(LLVMBuilderRef builder, LLVMValueRef condition,
+lp_build_assert(struct gallivm_state *gallivm,
+                LLVMValueRef condition,
                 const char *msg)
 {
-   LLVMModuleRef module;
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMContextRef context = gallivm->context;
+   LLVMModuleRef module = gallivm->module;
    LLVMTypeRef arg_types[2];
    LLVMValueRef msg_string, assert_func, params[2], r;
 
-   module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(
-                            LLVMGetInsertBlock(builder)));
+   msg_string = lp_build_const_string_variable(module, context,
+                                               msg, strlen(msg) + 1);
 
-   msg_string = lp_build_const_string_variable(module, msg, strlen(msg) + 1);
-
-   arg_types[0] = LLVMInt32Type();
-   arg_types[1] = LLVMPointerType(LLVMInt8Type(), 0);
+   arg_types[0] = LLVMInt32TypeInContext(context);
+   arg_types[1] = LLVMPointerType(LLVMInt8TypeInContext(context), 0);
 
    /* lookup the lp_assert function */
    assert_func = LLVMGetNamedFunction(module, "lp_assert");
@@ -77,12 +78,12 @@ lp_build_assert(LLVMBuilderRef builder, LLVMValueRef condition,
    /* Create the assertion function if not found */
    if (!assert_func) {
       LLVMTypeRef func_type =
-         LLVMFunctionType(LLVMVoidType(), arg_types, 2, 0);
+         LLVMFunctionType(LLVMVoidTypeInContext(context), arg_types, 2, 0);
 
       assert_func = LLVMAddFunction(module, "lp_assert", func_type);
       LLVMSetFunctionCallConv(assert_func, LLVMCCallConv);
       LLVMSetLinkage(assert_func, LLVMExternalLinkage);
-      LLVMAddGlobalMapping(lp_build_engine, assert_func,
+      LLVMAddGlobalMapping(gallivm->engine, assert_func,
                            func_to_pointer((func_pointer)lp_assert));
    }
    assert(assert_func);
index ddd879dc2c6a8b8a5851d7d8b514e4c7266754d3..1d2baab30a21e857c74ac8ce44c2e9b5540e6ddd 100644 (file)
 
 
 #include "lp_bld.h"
+#include "lp_bld_init.h"
 
 
 LLVMValueRef
-lp_build_assert(LLVMBuilderRef builder, LLVMValueRef condition,
+lp_build_assert(struct gallivm_state *gallivm,
+                LLVMValueRef condition,
                 const char *msg);
 
 
index 706479b4d5616c5b9ca1d27628f3c6b755c039b1..a9c57d682f2df649bbeabfb6baeb6fb2652ae4db 100644 (file)
@@ -40,6 +40,7 @@
 LLVMValueRef
 lp_build_or(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -48,14 +49,14 @@ lp_build_or(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 
    /* can't do bitwise ops on floating-point values */
    if (type.floating) {
-      a = LLVMBuildBitCast(bld->builder, a, bld->int_vec_type, "");
-      b = LLVMBuildBitCast(bld->builder, b, bld->int_vec_type, "");
+      a = LLVMBuildBitCast(builder, a, bld->int_vec_type, "");
+      b = LLVMBuildBitCast(builder, b, bld->int_vec_type, "");
    }
 
-   res = LLVMBuildOr(bld->builder, a, b, "");
+   res = LLVMBuildOr(builder, a, b, "");
 
    if (type.floating) {
-      res = LLVMBuildBitCast(bld->builder, res, bld->vec_type, "");
+      res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
    }
 
    return res;
@@ -68,6 +69,7 @@ lp_build_or(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 LLVMValueRef
 lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -76,14 +78,14 @@ lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 
    /* can't do bitwise ops on floating-point values */
    if (type.floating) {
-      a = LLVMBuildBitCast(bld->builder, a, bld->int_vec_type, "");
-      b = LLVMBuildBitCast(bld->builder, b, bld->int_vec_type, "");
+      a = LLVMBuildBitCast(builder, a, bld->int_vec_type, "");
+      b = LLVMBuildBitCast(builder, b, bld->int_vec_type, "");
    }
 
-   res = LLVMBuildAnd(bld->builder, a, b, "");
+   res = LLVMBuildAnd(builder, a, b, "");
 
    if (type.floating) {
-      res = LLVMBuildBitCast(bld->builder, res, bld->vec_type, "");
+      res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
    }
 
    return res;
@@ -96,6 +98,7 @@ lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 LLVMValueRef
 lp_build_andnot(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -104,15 +107,15 @@ lp_build_andnot(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 
    /* can't do bitwise ops on floating-point values */
    if (type.floating) {
-      a = LLVMBuildBitCast(bld->builder, a, bld->int_vec_type, "");
-      b = LLVMBuildBitCast(bld->builder, b, bld->int_vec_type, "");
+      a = LLVMBuildBitCast(builder, a, bld->int_vec_type, "");
+      b = LLVMBuildBitCast(builder, b, bld->int_vec_type, "");
    }
 
-   res = LLVMBuildNot(bld->builder, b, "");
-   res = LLVMBuildAnd(bld->builder, a, res, "");
+   res = LLVMBuildNot(builder, b, "");
+   res = LLVMBuildAnd(builder, a, res, "");
 
    if (type.floating) {
-      res = LLVMBuildBitCast(bld->builder, res, bld->vec_type, "");
+      res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
    }
 
    return res;
@@ -125,6 +128,7 @@ lp_build_andnot(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 LLVMValueRef
 lp_build_shl(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -133,7 +137,7 @@ lp_build_shl(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
    assert(lp_check_value(type, a));
    assert(lp_check_value(type, b));
 
-   res = LLVMBuildShl(bld->builder, a, b, "");
+   res = LLVMBuildShl(builder, a, b, "");
 
    return res;
 }
@@ -145,6 +149,7 @@ lp_build_shl(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 LLVMValueRef
 lp_build_shr(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -154,9 +159,9 @@ lp_build_shr(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
    assert(lp_check_value(type, b));
 
    if (type.sign) {
-      res = LLVMBuildAShr(bld->builder, a, b, "");
+      res = LLVMBuildAShr(builder, a, b, "");
    } else {
-      res = LLVMBuildLShr(bld->builder, a, b, "");
+      res = LLVMBuildLShr(builder, a, b, "");
    }
 
    return res;
@@ -169,7 +174,7 @@ lp_build_shr(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 LLVMValueRef
 lp_build_shl_imm(struct lp_build_context *bld, LLVMValueRef a, unsigned imm)
 {
-   LLVMValueRef b = lp_build_const_int_vec(bld->type, imm);
+   LLVMValueRef b = lp_build_const_int_vec(bld->gallivm, bld->type, imm);
    assert(imm <= bld->type.width);
    return lp_build_shl(bld, a, b);
 }
@@ -181,7 +186,7 @@ lp_build_shl_imm(struct lp_build_context *bld, LLVMValueRef a, unsigned imm)
 LLVMValueRef
 lp_build_shr_imm(struct lp_build_context *bld, LLVMValueRef a, unsigned imm)
 {
-   LLVMValueRef b = lp_build_const_int_vec(bld->type, imm);
+   LLVMValueRef b = lp_build_const_int_vec(bld->gallivm, bld->type, imm);
    assert(imm <= bld->type.width);
    return lp_build_shr(bld, a, b);
 }
index dd839c0bea56ce5f60bb01974140ef3f74dcef37..6d8b7c26fc8344f37e588dc9d3133e4bce26fb9e 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
+#include "lp_bld_init.h"
 
 
 unsigned
@@ -211,31 +212,31 @@ lp_const_eps(struct lp_type type)
 
 
 LLVMValueRef
-lp_build_undef(struct lp_type type)
+lp_build_undef(struct gallivm_state *gallivm, struct lp_type type)
 {
-   LLVMTypeRef vec_type = lp_build_vec_type(type);
+   LLVMTypeRef vec_type = lp_build_vec_type(gallivm, type);
    return LLVMGetUndef(vec_type);
 }
                
 
 LLVMValueRef
-lp_build_zero(struct lp_type type)
+lp_build_zero(struct gallivm_state *gallivm, struct lp_type type)
 {
    if (type.length == 1) {
       if (type.floating)
-         return LLVMConstReal(LLVMFloatType(), 0.0);
+         return lp_build_const_float(gallivm, 0.0);
       else
-         return LLVMConstInt(LLVMIntType(type.width), 0, 0);
+         return LLVMConstInt(LLVMIntTypeInContext(gallivm->context, type.width), 0, 0);
    }
    else {
-      LLVMTypeRef vec_type = lp_build_vec_type(type);
+      LLVMTypeRef vec_type = lp_build_vec_type(gallivm, type);
       return LLVMConstNull(vec_type);
    }
 }
                
 
 LLVMValueRef
-lp_build_one(struct lp_type type)
+lp_build_one(struct gallivm_state *gallivm, struct lp_type type)
 {
    LLVMTypeRef elem_type;
    LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
@@ -243,7 +244,7 @@ lp_build_one(struct lp_type type)
 
    assert(type.length <= LP_MAX_VECTOR_LENGTH);
 
-   elem_type = lp_build_elem_type(type);
+   elem_type = lp_build_elem_type(gallivm, type);
 
    if(type.floating)
       elems[0] = LLVMConstReal(elem_type, 1.0);
@@ -283,10 +284,11 @@ lp_build_one(struct lp_type type)
  * Build constant-valued element from a scalar value.
  */
 LLVMValueRef
-lp_build_const_elem(struct lp_type type,
+lp_build_const_elem(struct gallivm_state *gallivm,
+                    struct lp_type type,
                     double val)
 {
-   LLVMTypeRef elem_type = lp_build_elem_type(type);
+   LLVMTypeRef elem_type = lp_build_elem_type(gallivm, type);
    LLVMValueRef elem;
 
    if(type.floating) {
@@ -306,15 +308,15 @@ lp_build_const_elem(struct lp_type type,
  * Build constant-valued vector from a scalar value.
  */
 LLVMValueRef
-lp_build_const_vec(struct lp_type type,
+lp_build_const_vec(struct gallivm_state *gallivm, struct lp_type type,
                    double val)
 {
    if (type.length == 1) {
-      return lp_build_const_elem(type, val);
+      return lp_build_const_elem(gallivm, type, val);
    } else {
       LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
       unsigned i;
-      elems[0] = lp_build_const_elem(type, val);
+      elems[0] = lp_build_const_elem(gallivm, type, val);
       for(i = 1; i < type.length; ++i)
          elems[i] = elems[0];
       return LLVMConstVector(elems, type.length);
@@ -323,10 +325,10 @@ lp_build_const_vec(struct lp_type type,
 
 
 LLVMValueRef
-lp_build_const_int_vec(struct lp_type type,
-                          long long val)
+lp_build_const_int_vec(struct gallivm_state *gallivm, struct lp_type type,
+                       long long val)
 {
-   LLVMTypeRef elem_type = lp_build_int_elem_type(type);
+   LLVMTypeRef elem_type = lp_build_int_elem_type(gallivm, type);
    LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
    unsigned i;
 
@@ -343,7 +345,8 @@ lp_build_const_int_vec(struct lp_type type,
 
 
 LLVMValueRef
-lp_build_const_aos(struct lp_type type, 
+lp_build_const_aos(struct gallivm_state *gallivm,
+                   struct lp_type type, 
                    double r, double g, double b, double a, 
                    const unsigned char *swizzle)
 {
@@ -355,7 +358,7 @@ lp_build_const_aos(struct lp_type type,
    assert(type.length % 4 == 0);
    assert(type.length <= LP_MAX_VECTOR_LENGTH);
 
-   elem_type = lp_build_elem_type(type);
+   elem_type = lp_build_elem_type(gallivm, type);
 
    if(swizzle == NULL)
       swizzle = default_swizzle;
@@ -386,10 +389,11 @@ lp_build_const_aos(struct lp_type type,
  * @param mask TGSI_WRITEMASK_xxx
  */
 LLVMValueRef
-lp_build_const_mask_aos(struct lp_type type,
+lp_build_const_mask_aos(struct gallivm_state *gallivm,
+                        struct lp_type type,
                         unsigned mask)
 {
-   LLVMTypeRef elem_type = LLVMIntType(type.width);
+   LLVMTypeRef elem_type = LLVMIntTypeInContext(gallivm->context, type.width);
    LLVMValueRef masks[LP_MAX_VECTOR_LENGTH];
    unsigned i, j;
 
index 6b1fc590c177f8fbfb76186c3a5bb3501b6027d0..69718eb4b3d1116ec1da2e6ca0aeef5d302cb3db 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "pipe/p_compiler.h"
 #include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_init.h"
 
 
 
@@ -73,44 +74,71 @@ lp_const_eps(struct lp_type type);
 
 
 LLVMValueRef
-lp_build_undef(struct lp_type type);
+lp_build_undef(struct gallivm_state *gallivm, struct lp_type type);
 
 
 LLVMValueRef
-lp_build_zero(struct lp_type type);
+lp_build_zero(struct gallivm_state *gallivm, struct lp_type type);
 
 
 LLVMValueRef
-lp_build_one(struct lp_type type);
+lp_build_one(struct gallivm_state *gallivm, struct lp_type type);
 
 
 LLVMValueRef
-lp_build_const_elem(struct lp_type type,
+lp_build_const_elem(struct gallivm_state *gallivm, struct lp_type type,
                     double val);
 
 LLVMValueRef
-lp_build_const_vec(struct lp_type type, double val);
+lp_build_const_vec(struct gallivm_state *gallivm, struct lp_type type,
+                   double val);
 
 
 LLVMValueRef
-lp_build_const_int_vec(struct lp_type type, long long val);
+lp_build_const_int_vec(struct gallivm_state *gallivm,
+                       struct lp_type type, long long val);
 
 
 LLVMValueRef
-lp_build_const_aos(struct lp_type type, 
+lp_build_const_aos(struct gallivm_state *gallivm, struct lp_type type, 
                    double r, double g, double b, double a, 
                    const unsigned char *swizzle);
 
 
 LLVMValueRef
-lp_build_const_mask_aos(struct lp_type type,
+lp_build_const_mask_aos(struct gallivm_state *gallivm,
+                        struct lp_type type,
                         unsigned mask);
 
 
 static INLINE LLVMValueRef
-lp_build_const_int32(int i)
+lp_build_const_int32(struct gallivm_state *gallivm, int i)
 {
-   return LLVMConstInt(LLVMInt32Type(), i, 0);
+   return LLVMConstInt(LLVMInt32TypeInContext(gallivm->context), i, 0);
+}
+
+
+static INLINE LLVMValueRef
+lp_build_const_float(struct gallivm_state *gallivm, float x)
+{
+   return LLVMConstReal(LLVMFloatTypeInContext(gallivm->context), x);
+}
+
+
+/** Return constant-valued pointer to int */
+static INLINE LLVMValueRef
+lp_build_const_int_pointer(struct gallivm_state *gallivm, const void *ptr)
+{
+   LLVMTypeRef int_type;
+   LLVMValueRef v;
+
+   /* int type large enough to hold a pointer */
+   int_type = LLVMIntTypeInContext(gallivm->context, 8 * sizeof(void *));
+   v = LLVMConstInt(int_type, (uintptr_t) ptr, 0);
+   v = LLVMBuildIntToPtr(gallivm->builder, v,
+                         LLVMPointerType(int_type, 0),
+                         "cast int to ptr");
+   return v;
 }
 
 
index 6967dd26225a5dcb2750a190f1f80ccc6015f7de..c43ee8ac6388d3b918cc33181f4c222c4e0561b4 100644 (file)
  * return { i32, i32, i32, i32 } where each value is in [0, 2^dst_width-1].
  */
 LLVMValueRef
-lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
+lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm,
                                         struct lp_type src_type,
                                         unsigned dst_width,
                                         LLVMValueRef src)
 {
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(src_type);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(gallivm, src_type);
    LLVMValueRef res;
    unsigned mantissa;
 
@@ -122,10 +123,11 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
       scale = (double)mask/ubound;
       bias = (double)(1ULL << (mantissa - dst_width));
 
-      res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
-      res = LLVMBuildFAdd(builder, res, lp_build_const_vec(src_type, bias), "");
+      res = LLVMBuildFMul(builder, src, lp_build_const_vec(gallivm, src_type, scale), "");
+      res = LLVMBuildFAdd(builder, res, lp_build_const_vec(gallivm, src_type, bias), "");
       res = LLVMBuildBitCast(builder, res, int_vec_type, "");
-      res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), "");
+      res = LLVMBuildAnd(builder, res,
+                         lp_build_const_int_vec(gallivm, src_type, mask), "");
    }
    else if (dst_width == (mantissa + 1)) {
       /*
@@ -138,7 +140,8 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
 
       scale = (double)((1ULL << dst_width) - 1);
 
-      res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
+      res = LLVMBuildFMul(builder, src,
+                          lp_build_const_vec(gallivm, src_type, scale), "");
       res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
    }
    else {
@@ -166,7 +169,8 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
       LLVMValueRef lshifted;
       LLVMValueRef rshifted;
 
-      res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
+      res = LLVMBuildFMul(builder, src,
+                          lp_build_const_vec(gallivm, src_type, scale), "");
       res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
 
       /*
@@ -177,7 +181,8 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
        */
       if (lshift) {
          lshifted = LLVMBuildShl(builder, res,
-                                 lp_build_const_int_vec(src_type, lshift), "");
+                                 lp_build_const_int_vec(gallivm, src_type,
+                                                        lshift), "");
       } else {
          lshifted = res;
       }
@@ -186,7 +191,8 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
        * Align the most significant bit to the right.
        */
       rshifted =  LLVMBuildAShr(builder, res,
-                                lp_build_const_int_vec(src_type, rshift), "");
+                                lp_build_const_int_vec(gallivm, src_type, rshift),
+                                "");
 
       /*
        * Subtract the MSB to the LSB, therefore re-scaling from
@@ -206,13 +212,14 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
  * return {float, float, float, float} with values in range [0, 1].
  */
 LLVMValueRef
-lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
+lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
                                 unsigned src_width,
                                 struct lp_type dst_type,
                                 LLVMValueRef src)
 {
-   LLVMTypeRef vec_type = lp_build_vec_type(dst_type);
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(dst_type);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMTypeRef vec_type = lp_build_vec_type(gallivm, dst_type);
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(gallivm, dst_type);
    LLVMValueRef bias_;
    LLVMValueRef res;
    unsigned mantissa;
@@ -230,7 +237,8 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
    if (src_width == 8) {
       scale = 1.0/255.0;
       res = LLVMBuildSIToFP(builder, src, vec_type, "");
-      res = LLVMBuildFMul(builder, res, lp_build_const_vec(dst_type, scale), "");
+      res = LLVMBuildFMul(builder, res,
+                          lp_build_const_vec(gallivm, dst_type, scale), "");
       return res;
    }
 
@@ -247,10 +255,11 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
 
    if(src_width > mantissa) {
       int shift = src_width - mantissa;
-      res = LLVMBuildLShr(builder, res, lp_build_const_int_vec(dst_type, shift), "");
+      res = LLVMBuildLShr(builder, res,
+                          lp_build_const_int_vec(gallivm, dst_type, shift), "");
    }
 
-   bias_ = lp_build_const_vec(dst_type, bias);
+   bias_ = lp_build_const_vec(gallivm, dst_type, bias);
 
    res = LLVMBuildOr(builder,
                      res,
@@ -259,7 +268,7 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
    res = LLVMBuildBitCast(builder, res, vec_type, "");
 
    res = LLVMBuildFSub(builder, res, bias_, "");
-   res = LLVMBuildFMul(builder, res, lp_build_const_vec(dst_type, scale), "");
+   res = LLVMBuildFMul(builder, res, lp_build_const_vec(gallivm, dst_type, scale), "");
 
    return res;
 }
@@ -272,12 +281,13 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
  * to the lp_type union.
  */
 void
-lp_build_conv(LLVMBuilderRef builder,
+lp_build_conv(struct gallivm_state *gallivm,
               struct lp_type src_type,
               struct lp_type dst_type,
               const LLVMValueRef *src, unsigned num_srcs,
               LLVMValueRef *dst, unsigned num_dsts)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_type tmp_type;
    LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH];
    unsigned num_tmps;
@@ -342,12 +352,12 @@ lp_build_conv(LLVMBuilderRef builder,
          int32_type.length /= 4;
          int32_type.sign = 1;
 
-         src_vec_type   = lp_build_vec_type(src_type);
-         dst_vec_type   = lp_build_vec_type(dst_type);
-         int16_vec_type = lp_build_vec_type(int16_type);
-         int32_vec_type = lp_build_vec_type(int32_type);
+         src_vec_type   = lp_build_vec_type(gallivm, src_type);
+         dst_vec_type   = lp_build_vec_type(gallivm, dst_type);
+         int16_vec_type = lp_build_vec_type(gallivm, int16_type);
+         int32_vec_type = lp_build_vec_type(gallivm, int32_type);
 
-         const_255f = lp_build_const_vec(src_type, 255.0f);
+         const_255f = lp_build_const_vec(gallivm, src_type, 255.0f);
 
          a = LLVMBuildFMul(builder, src[0], const_255f, "");
          b = LLVMBuildFMul(builder, src[1], const_255f, "");
@@ -357,14 +367,14 @@ lp_build_conv(LLVMBuilderRef builder,
          {
             struct lp_build_context bld;
 
-            bld.builder = builder;
+            bld.gallivm = gallivm;
             bld.type = src_type;
             bld.vec_type = src_vec_type;
-            bld.int_elem_type = lp_build_elem_type(int32_type);
+            bld.int_elem_type = lp_build_elem_type(gallivm, int32_type);
             bld.int_vec_type = int32_vec_type;
-            bld.undef = lp_build_undef(src_type);
-            bld.zero = lp_build_zero(src_type);
-            bld.one = lp_build_one(src_type);
+            bld.undef = lp_build_undef(gallivm, src_type);
+            bld.zero = lp_build_zero(gallivm, src_type);
+            bld.one = lp_build_one(gallivm, src_type);
 
             src_int0 = lp_build_iround(&bld, a);
             src_int1 = lp_build_iround(&bld, b);
@@ -372,9 +382,9 @@ lp_build_conv(LLVMBuilderRef builder,
             src_int3 = lp_build_iround(&bld, d);
          }
          /* relying on clamping behavior of sse2 intrinsics here */
-         lo = lp_build_pack2(builder, int32_type, int16_type, src_int0, src_int1);
-         hi = lp_build_pack2(builder, int32_type, int16_type, src_int2, src_int3);
-         dst[i] = lp_build_pack2(builder, int16_type, dst_type, lo, hi);
+         lo = lp_build_pack2(gallivm, int32_type, int16_type, src_int0, src_int1);
+         hi = lp_build_pack2(gallivm, int32_type, int16_type, src_int2, src_int3);
+         dst[i] = lp_build_pack2(gallivm, int16_type, dst_type, lo, hi);
       }
       return; 
    }
@@ -391,13 +401,13 @@ lp_build_conv(LLVMBuilderRef builder,
       double dst_max = lp_const_max(dst_type);
       LLVMValueRef thres;
 
-      lp_build_context_init(&bld, builder, tmp_type);
+      lp_build_context_init(&bld, gallivm, tmp_type);
 
       if(src_min < dst_min) {
          if(dst_min == 0.0)
             thres = bld.zero;
          else
-            thres = lp_build_const_vec(src_type, dst_min);
+            thres = lp_build_const_vec(gallivm, src_type, dst_min);
          for(i = 0; i < num_tmps; ++i)
             tmp[i] = lp_build_max(&bld, tmp[i], thres);
       }
@@ -406,7 +416,7 @@ lp_build_conv(LLVMBuilderRef builder,
          if(dst_max == 1.0)
             thres = bld.one;
          else
-            thres = lp_build_const_vec(src_type, dst_max);
+            thres = lp_build_const_vec(gallivm, src_type, dst_max);
          for(i = 0; i < num_tmps; ++i)
             tmp[i] = lp_build_min(&bld, tmp[i], thres);
       }
@@ -422,7 +432,7 @@ lp_build_conv(LLVMBuilderRef builder,
    else if(tmp_type.floating) {
       if(!dst_type.fixed && !dst_type.sign && dst_type.norm) {
          for(i = 0; i < num_tmps; ++i) {
-            tmp[i] = lp_build_clamped_float_to_unsigned_norm(builder,
+            tmp[i] = lp_build_clamped_float_to_unsigned_norm(gallivm,
                                                              tmp_type,
                                                              dst_type.width,
                                                              tmp[i]);
@@ -434,14 +444,14 @@ lp_build_conv(LLVMBuilderRef builder,
          LLVMTypeRef tmp_vec_type;
 
          if (dst_scale != 1.0) {
-            LLVMValueRef scale = lp_build_const_vec(tmp_type, dst_scale);
+            LLVMValueRef scale = lp_build_const_vec(gallivm, tmp_type, dst_scale);
             for(i = 0; i < num_tmps; ++i)
                tmp[i] = LLVMBuildFMul(builder, tmp[i], scale, "");
          }
 
          /* Use an equally sized integer for intermediate computations */
          tmp_type.floating = FALSE;
-         tmp_vec_type = lp_build_vec_type(tmp_type);
+         tmp_vec_type = lp_build_vec_type(gallivm, tmp_type);
          for(i = 0; i < num_tmps; ++i) {
 #if 0
             if(dst_type.sign)
@@ -461,7 +471,8 @@ lp_build_conv(LLVMBuilderRef builder,
 
       /* FIXME: compensate different offsets too */
       if(src_shift > dst_shift) {
-         LLVMValueRef shift = lp_build_const_int_vec(tmp_type, src_shift - dst_shift);
+         LLVMValueRef shift = lp_build_const_int_vec(gallivm, tmp_type,
+                                                     src_shift - dst_shift);
          for(i = 0; i < num_tmps; ++i)
             if(src_type.sign)
                tmp[i] = LLVMBuildAShr(builder, tmp[i], shift, "");
@@ -485,7 +496,7 @@ lp_build_conv(LLVMBuilderRef builder,
       new_type.width  = dst_type.width;
       new_type.length = dst_type.length;
 
-      lp_build_resize(builder, tmp_type, new_type, tmp, num_srcs, tmp, num_dsts);
+      lp_build_resize(gallivm, tmp_type, new_type, tmp, num_srcs, tmp, num_dsts);
 
       tmp_type = new_type;
       num_tmps = num_dsts;
@@ -501,7 +512,7 @@ lp_build_conv(LLVMBuilderRef builder,
    else if(!src_type.floating && dst_type.floating) {
       if(!src_type.fixed && !src_type.sign && src_type.norm) {
          for(i = 0; i < num_tmps; ++i) {
-            tmp[i] = lp_build_unsigned_norm_to_float(builder,
+            tmp[i] = lp_build_unsigned_norm_to_float(gallivm,
                                                      src_type.width,
                                                      dst_type,
                                                      tmp[i]);
@@ -515,7 +526,7 @@ lp_build_conv(LLVMBuilderRef builder,
          /* Use an equally sized integer for intermediate computations */
          tmp_type.floating = TRUE;
          tmp_type.sign = TRUE;
-         tmp_vec_type = lp_build_vec_type(tmp_type);
+         tmp_vec_type = lp_build_vec_type(gallivm, tmp_type);
          for(i = 0; i < num_tmps; ++i) {
 #if 0
             if(dst_type.sign)
@@ -529,7 +540,7 @@ lp_build_conv(LLVMBuilderRef builder,
           }
 
           if (src_scale != 1.0) {
-             LLVMValueRef scale = lp_build_const_vec(tmp_type, 1.0/src_scale);
+             LLVMValueRef scale = lp_build_const_vec(gallivm, tmp_type, 1.0/src_scale);
              for(i = 0; i < num_tmps; ++i)
                 tmp[i] = LLVMBuildFMul(builder, tmp[i], scale, "");
           }
@@ -541,7 +552,7 @@ lp_build_conv(LLVMBuilderRef builder,
 
        /* FIXME: compensate different offsets too */
        if(src_shift < dst_shift) {
-          LLVMValueRef shift = lp_build_const_int_vec(tmp_type, dst_shift - src_shift);
+          LLVMValueRef shift = lp_build_const_int_vec(gallivm, tmp_type, dst_shift - src_shift);
           for(i = 0; i < num_tmps; ++i)
              tmp[i] = LLVMBuildShl(builder, tmp[i], shift, "");
        }
@@ -565,7 +576,7 @@ lp_build_conv(LLVMBuilderRef builder,
  * This is basically a very trimmed down version of lp_build_conv.
  */
 void
-lp_build_conv_mask(LLVMBuilderRef builder,
+lp_build_conv_mask(struct gallivm_state *gallivm,
                    struct lp_type src_type,
                    struct lp_type dst_type,
                    const LLVMValueRef *src, unsigned num_srcs,
@@ -599,11 +610,11 @@ lp_build_conv_mask(LLVMBuilderRef builder,
 
    if(src_type.width > dst_type.width) {
       assert(num_dsts == 1);
-      dst[0] = lp_build_pack(builder, src_type, dst_type, TRUE, src, num_srcs);
+      dst[0] = lp_build_pack(gallivm, src_type, dst_type, TRUE, src, num_srcs);
    }
    else if(src_type.width < dst_type.width) {
       assert(num_srcs == 1);
-      lp_build_unpack(builder, src_type, dst_type, src[0], dst, num_dsts);
+      lp_build_unpack(gallivm, src_type, dst_type, src[0], dst, num_dsts);
    }
    else {
       assert(num_srcs == num_dsts);
index 628831c3adab720fae2dced62cecb7411128f67b..cec655980faa9532531e346a6ec0e7144480ae90 100644 (file)
@@ -44,27 +44,27 @@ struct lp_type;
 
 
 LLVMValueRef
-lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
+lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm,
                                         struct lp_type src_type,
                                         unsigned dst_width,
                                         LLVMValueRef src);
 
 LLVMValueRef
-lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
+lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
                                 unsigned src_width,
                                 struct lp_type dst_type,
                                 LLVMValueRef src);
 
 
 void
-lp_build_conv(LLVMBuilderRef builder,
+lp_build_conv(struct gallivm_state *gallivm,
               struct lp_type src_type,
               struct lp_type dst_type,
               const LLVMValueRef *srcs, unsigned num_srcs,
               LLVMValueRef *dsts, unsigned num_dsts);
 
 void
-lp_build_conv_mask(LLVMBuilderRef builder,
+lp_build_conv_mask(struct gallivm_state *gallivm,
                    struct lp_type src_type,
                    struct lp_type dst_type,
                    const LLVMValueRef *src, unsigned num_srcs,
index eb11dcd4ef4de25455ca2547af8ba0d031312761..8a58f95b78f34c06b3e8e9b9989695de28fbaaef 100644 (file)
@@ -42,6 +42,7 @@
 #define GALLIVM_DEBUG_NO_OPT        (1 << 3)
 #define GALLIVM_DEBUG_PERF          (1 << 4)
 #define GALLIVM_DEBUG_NO_BRILINEAR  (1 << 5)
+#define GALLIVM_DEBUG_GC            (1 << 6)
 
 
 #ifdef DEBUG
index a2cee199a010c4fcfdf4fcaf81fdad1763400c8b..a9c9c7af10c2d046fe28124b853c40b06af4d047 100644 (file)
@@ -34,6 +34,7 @@
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 
+#include "lp_bld_init.h"
 #include "lp_bld_type.h"
 #include "lp_bld_flow.h"
 
  * be used elsewhere.
  */
 LLVMBasicBlockRef
-lp_build_insert_new_block(LLVMBuilderRef builder, const char *name)
+lp_build_insert_new_block(struct gallivm_state *gallivm, const char *name)
 {
    LLVMBasicBlockRef current_block;
    LLVMBasicBlockRef next_block;
    LLVMBasicBlockRef new_block;
 
    /* get current basic block */
-   current_block = LLVMGetInsertBlock(builder);
+   current_block = LLVMGetInsertBlock(gallivm->builder);
 
    /* check if there's another block after this one */
    next_block = LLVMGetNextBasicBlock(current_block);
    if (next_block) {
       /* insert the new block before the next block */
-      new_block = LLVMInsertBasicBlock(next_block, name);
+      new_block = LLVMInsertBasicBlockInContext(gallivm->context, next_block, name);
    }
    else {
       /* append new block after current block */
       LLVMValueRef function = LLVMGetBasicBlockParent(current_block);
-      new_block = LLVMAppendBasicBlock(function, name);
+      new_block = LLVMAppendBasicBlockInContext(gallivm->context, function, name);
    }
 
    return new_block;
@@ -82,12 +83,11 @@ lp_build_insert_new_block(LLVMBuilderRef builder, const char *name)
  */
 void
 lp_build_flow_skip_begin(struct lp_build_skip_context *skip,
-                         LLVMBuilderRef builder)
+                         struct gallivm_state *gallivm)
 {
-   skip->builder = builder;
-
+   skip->gallivm = gallivm;
    /* create new basic block */
-   skip->block = lp_build_insert_new_block(skip->builder, "skip");
+   skip->block = lp_build_insert_new_block(gallivm, "skip");
 }
 
 
@@ -101,12 +101,12 @@ lp_build_flow_skip_cond_break(struct lp_build_skip_context *skip,
 {
    LLVMBasicBlockRef new_block;
 
-   new_block = lp_build_insert_new_block(skip->builder, "");
+   new_block = lp_build_insert_new_block(skip->gallivm, "");
 
    /* if cond is true, goto skip->block, else goto new_block */
-   LLVMBuildCondBr(skip->builder, cond, skip->block, new_block);
+   LLVMBuildCondBr(skip->gallivm->builder, cond, skip->block, new_block);
 
-   LLVMPositionBuilderAtEnd(skip->builder, new_block);
+   LLVMPositionBuilderAtEnd(skip->gallivm->builder, new_block);
 }
 
 
@@ -114,8 +114,8 @@ void
 lp_build_flow_skip_end(struct lp_build_skip_context *skip)
 {
    /* goto block */
-   LLVMBuildBr(skip->builder, skip->block);
-   LLVMPositionBuilderAtEnd(skip->builder, skip->block);
+   LLVMBuildBr(skip->gallivm->builder, skip->block);
+   LLVMPositionBuilderAtEnd(skip->gallivm->builder, skip->block);
 }
 
 
@@ -125,7 +125,7 @@ lp_build_flow_skip_end(struct lp_build_skip_context *skip)
 void
 lp_build_mask_check(struct lp_build_mask_context *mask)
 {
-   LLVMBuilderRef builder = mask->skip.builder;
+   LLVMBuilderRef builder = mask->skip.gallivm->builder;
    LLVMValueRef value;
    LLVMValueRef cond;
 
@@ -152,27 +152,27 @@ lp_build_mask_check(struct lp_build_mask_context *mask)
  */
 void
 lp_build_mask_begin(struct lp_build_mask_context *mask,
-                    LLVMBuilderRef builder,
+                    struct gallivm_state *gallivm,
                     struct lp_type type,
                     LLVMValueRef value)
 {
    memset(mask, 0, sizeof *mask);
 
-   mask->reg_type = LLVMIntType(type.width * type.length);
-   mask->var = lp_build_alloca(builder,
-                               lp_build_int_vec_type(type),
+   mask->reg_type = LLVMIntTypeInContext(gallivm->context, type.width * type.length);
+   mask->var = lp_build_alloca(gallivm,
+                               lp_build_int_vec_type(gallivm, type),
                                "execution_mask");
 
-   LLVMBuildStore(builder, value, mask->var);
+   LLVMBuildStore(gallivm->builder, value, mask->var);
 
-   lp_build_flow_skip_begin(&mask->skip, builder);
+   lp_build_flow_skip_begin(&mask->skip, gallivm);
 }
 
 
 LLVMValueRef
 lp_build_mask_value(struct lp_build_mask_context *mask)
 {
-   return LLVMBuildLoad(mask->skip.builder, mask->var, "");
+   return LLVMBuildLoad(mask->skip.gallivm->builder, mask->var, "");
 }
 
 
@@ -185,10 +185,10 @@ void
 lp_build_mask_update(struct lp_build_mask_context *mask,
                      LLVMValueRef value)
 {
-   value = LLVMBuildAnd(mask->skip.builder,
+   value = LLVMBuildAnd(mask->skip.gallivm->builder,
                         lp_build_mask_value(mask),
                         value, "");
-   LLVMBuildStore(mask->skip.builder, value, mask->var);
+   LLVMBuildStore(mask->skip.gallivm->builder, value, mask->var);
 }
 
 
@@ -205,13 +205,17 @@ lp_build_mask_end(struct lp_build_mask_context *mask)
 
 
 void
-lp_build_loop_begin(LLVMBuilderRef builder,
-                    LLVMValueRef start,
-                    struct lp_build_loop_state *state)
+lp_build_loop_begin(struct lp_build_loop_state *state,
+                    struct gallivm_state *gallivm,
+                    LLVMValueRef start)
+                    
 {
-   state->block = lp_build_insert_new_block(builder, "loop_begin");
+   LLVMBuilderRef builder = gallivm->builder;
+
+   state->block = lp_build_insert_new_block(gallivm, "loop_begin");
 
-   state->counter_var = lp_build_alloca(builder, LLVMTypeOf(start), "loop_counter");
+   state->counter_var = lp_build_alloca(gallivm, LLVMTypeOf(start), "loop_counter");
+   state->gallivm = gallivm;
 
    LLVMBuildStore(builder, start, state->counter_var);
 
@@ -224,12 +228,12 @@ lp_build_loop_begin(LLVMBuilderRef builder,
 
 
 void
-lp_build_loop_end_cond(LLVMBuilderRef builder,
+lp_build_loop_end_cond(struct lp_build_loop_state *state,
                        LLVMValueRef end,
                        LLVMValueRef step,
-                       LLVMIntPredicate llvm_cond,
-                       struct lp_build_loop_state *state)
+                       LLVMIntPredicate llvm_cond)
 {
+   LLVMBuilderRef builder = state->gallivm->builder;
    LLVMValueRef next;
    LLVMValueRef cond;
    LLVMBasicBlockRef after_block;
@@ -243,7 +247,7 @@ lp_build_loop_end_cond(LLVMBuilderRef builder,
 
    cond = LLVMBuildICmp(builder, llvm_cond, next, end, "");
 
-   after_block = lp_build_insert_new_block(builder, "loop_end");
+   after_block = lp_build_insert_new_block(state->gallivm, "loop_end");
 
    LLVMBuildCondBr(builder, cond, after_block, state->block);
 
@@ -254,12 +258,11 @@ lp_build_loop_end_cond(LLVMBuilderRef builder,
 
 
 void
-lp_build_loop_end(LLVMBuilderRef builder,
+lp_build_loop_end(struct lp_build_loop_state *state,
                   LLVMValueRef end,
-                  LLVMValueRef step,
-                  struct lp_build_loop_state *state)
+                  LLVMValueRef step)
 {
-   lp_build_loop_end_cond(builder, end, step, LLVMIntNE, state);
+   lp_build_loop_end_cond(state, end, step, LLVMIntNE);
 }
 
 
@@ -296,24 +299,27 @@ lp_build_loop_end(LLVMBuilderRef builder,
  */
 void
 lp_build_if(struct lp_build_if_state *ifthen,
-            LLVMBuilderRef builder,
+            struct gallivm_state *gallivm,
             LLVMValueRef condition)
 {
-   LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
+   LLVMBasicBlockRef block = LLVMGetInsertBlock(gallivm->builder);
 
    memset(ifthen, 0, sizeof *ifthen);
-   ifthen->builder = builder;
+   ifthen->gallivm = gallivm;
    ifthen->condition = condition;
    ifthen->entry_block = block;
 
    /* create endif/merge basic block for the phi functions */
-   ifthen->merge_block = lp_build_insert_new_block(builder, "endif-block");
+   ifthen->merge_block = lp_build_insert_new_block(gallivm, "endif-block");
 
    /* create/insert true_block before merge_block */
-   ifthen->true_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-true-block");
+   ifthen->true_block =
+      LLVMInsertBasicBlockInContext(gallivm->context,
+                                    ifthen->merge_block,
+                                    "if-true-block");
 
    /* successive code goes into the true block */
-   LLVMPositionBuilderAtEnd(builder, ifthen->true_block);
+   LLVMPositionBuilderAtEnd(gallivm->builder, ifthen->true_block);
 }
 
 
@@ -323,14 +329,19 @@ lp_build_if(struct lp_build_if_state *ifthen,
 void
 lp_build_else(struct lp_build_if_state *ifthen)
 {
+   LLVMBuilderRef builder = ifthen->gallivm->builder;
+
    /* Append an unconditional Br(anch) instruction on the true_block */
-   LLVMBuildBr(ifthen->builder, ifthen->merge_block);
+   LLVMBuildBr(builder, ifthen->merge_block);
 
    /* create/insert false_block before the merge block */
-   ifthen->false_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-false-block");
+   ifthen->false_block =
+      LLVMInsertBasicBlockInContext(ifthen->gallivm->context,
+                                    ifthen->merge_block,
+                                    "if-false-block");
 
    /* successive code goes into the else block */
-   LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->false_block);
+   LLVMPositionBuilderAtEnd(builder, ifthen->false_block);
 }
 
 
@@ -340,28 +351,30 @@ lp_build_else(struct lp_build_if_state *ifthen)
 void
 lp_build_endif(struct lp_build_if_state *ifthen)
 {
+   LLVMBuilderRef builder = ifthen->gallivm->builder;
+
    /* Insert branch to the merge block from current block */
-   LLVMBuildBr(ifthen->builder, ifthen->merge_block);
+   LLVMBuildBr(builder, ifthen->merge_block);
 
    /*
     * Now patch in the various branch instructions.
     */
 
    /* Insert the conditional branch instruction at the end of entry_block */
-   LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->entry_block);
+   LLVMPositionBuilderAtEnd(builder, ifthen->entry_block);
    if (ifthen->false_block) {
       /* we have an else clause */
-      LLVMBuildCondBr(ifthen->builder, ifthen->condition,
+      LLVMBuildCondBr(builder, ifthen->condition,
                       ifthen->true_block, ifthen->false_block);
    }
    else {
       /* no else clause */
-      LLVMBuildCondBr(ifthen->builder, ifthen->condition,
+      LLVMBuildCondBr(builder, ifthen->condition,
                       ifthen->true_block, ifthen->merge_block);
    }
 
    /* Resume building code at end of the ifthen->merge_block */
-   LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->merge_block);
+   LLVMPositionBuilderAtEnd(builder, ifthen->merge_block);
 }
 
 
@@ -381,15 +394,16 @@ lp_build_endif(struct lp_build_if_state *ifthen)
  * - http://www.llvm.org/docs/tutorial/OCamlLangImpl7.html#memory
  */
 LLVMValueRef
-lp_build_alloca(LLVMBuilderRef builder,
+lp_build_alloca(struct gallivm_state *gallivm,
                 LLVMTypeRef type,
                 const char *name)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMBasicBlockRef current_block = LLVMGetInsertBlock(builder);
    LLVMValueRef function = LLVMGetBasicBlockParent(current_block);
    LLVMBasicBlockRef first_block = LLVMGetEntryBasicBlock(function);
    LLVMValueRef first_instr = LLVMGetFirstInstruction(first_block);
-   LLVMBuilderRef first_builder = LLVMCreateBuilder();
+   LLVMBuilderRef first_builder = LLVMCreateBuilderInContext(gallivm->context);
    LLVMValueRef res;
 
    if (first_instr) {
@@ -422,16 +436,17 @@ lp_build_alloca(LLVMBuilderRef builder,
  * - http://www.llvm.org/docs/tutorial/OCamlLangImpl7.html#memory
  */
 LLVMValueRef
-lp_build_array_alloca(LLVMBuilderRef builder,
+lp_build_array_alloca(struct gallivm_state *gallivm,
                       LLVMTypeRef type,
                       LLVMValueRef count,
                       const char *name)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMBasicBlockRef current_block = LLVMGetInsertBlock(builder);
    LLVMValueRef function = LLVMGetBasicBlockParent(current_block);
    LLVMBasicBlockRef first_block = LLVMGetEntryBasicBlock(function);
    LLVMValueRef first_instr = LLVMGetFirstInstruction(first_block);
-   LLVMBuilderRef first_builder = LLVMCreateBuilder();
+   LLVMBuilderRef first_builder = LLVMCreateBuilderInContext(gallivm->context);
    LLVMValueRef res;
 
    if (first_instr) {
index e729ee6eaac5b1733e59e6461b974cf0885f843b..3cd5a9f42a54bdb14bc6782490e88205b16bdfd5 100644 (file)
@@ -47,7 +47,7 @@ struct lp_type;
  */
 struct lp_build_skip_context
 {
-   LLVMBuilderRef builder;
+   struct gallivm_state *gallivm;
 
    /** Block to skip to */
    LLVMBasicBlockRef block;
@@ -55,7 +55,7 @@ struct lp_build_skip_context
 
 void
 lp_build_flow_skip_begin(struct lp_build_skip_context *ctx,
-                         LLVMBuilderRef builder);
+                         struct gallivm_state *gallivm);
 
 void
 lp_build_flow_skip_cond_break(struct lp_build_skip_context *ctx,
@@ -77,7 +77,7 @@ struct lp_build_mask_context
 
 void
 lp_build_mask_begin(struct lp_build_mask_context *mask,
-                    LLVMBuilderRef builder,
+                    struct gallivm_state *gallivm,
                     struct lp_type type,
                     LLVMValueRef value);
 
@@ -107,31 +107,28 @@ lp_build_mask_end(struct lp_build_mask_context *mask);
  */
 struct lp_build_loop_state
 {
-  LLVMBasicBlockRef block;
-  LLVMValueRef counter_var;
-  LLVMValueRef counter;
+   LLVMBasicBlockRef block;
+   LLVMValueRef counter_var;
+   LLVMValueRef counter;
+   struct gallivm_state *gallivm;
 };
 
 
 void
-lp_build_loop_begin(LLVMBuilderRef builder,
-                    LLVMValueRef start,
-                    struct lp_build_loop_state *state);
-
+lp_build_loop_begin(struct lp_build_loop_state *state,
+                    struct gallivm_state *gallivm,
+                    LLVMValueRef start);
 
 void
-lp_build_loop_end(LLVMBuilderRef builder,
+lp_build_loop_end(struct lp_build_loop_state *state,
                   LLVMValueRef end,
-                  LLVMValueRef step,
-                  struct lp_build_loop_state *state);
+                  LLVMValueRef step);
 
 void
-lp_build_loop_end_cond(LLVMBuilderRef builder,
+lp_build_loop_end_cond(struct lp_build_loop_state *state,
                        LLVMValueRef end,
                        LLVMValueRef step,
-                       LLVMIntPredicate cond,
-                       struct lp_build_loop_state *state);
-
+                       LLVMIntPredicate cond);
 
 
 
@@ -140,7 +137,7 @@ lp_build_loop_end_cond(LLVMBuilderRef builder,
  */
 struct lp_build_if_state
 {
-   LLVMBuilderRef builder;
+   struct gallivm_state *gallivm;
    LLVMValueRef condition;
    LLVMBasicBlockRef entry_block;
    LLVMBasicBlockRef true_block;
@@ -151,7 +148,7 @@ struct lp_build_if_state
 
 void
 lp_build_if(struct lp_build_if_state *ctx,
-            LLVMBuilderRef builder,
+            struct gallivm_state *gallivm,
             LLVMValueRef condition);
 
 void
@@ -161,15 +158,15 @@ void
 lp_build_endif(struct lp_build_if_state *ctx);
 
 LLVMBasicBlockRef
-lp_build_insert_new_block(LLVMBuilderRef builder, const char *name);
+lp_build_insert_new_block(struct gallivm_state *gallivm, const char *name);
 
 LLVMValueRef
-lp_build_alloca(LLVMBuilderRef builder,
+lp_build_alloca(struct gallivm_state *gallivm,
                 LLVMTypeRef type,
                 const char *name);
 
 LLVMValueRef
-lp_build_array_alloca(LLVMBuilderRef builder,
+lp_build_array_alloca(struct gallivm_state *gallivm,
                       LLVMTypeRef type,
                       LLVMValueRef count,
                       const char *name);
index 60e22d727ad456ef33b1117db1ed8057edee4ff3..04142d905b18ffc2ecbe3edbb4edfcd3ea58c7bd 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 #include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_init.h"
 
 #include "pipe/p_format.h"
 
@@ -53,12 +54,12 @@ lp_build_format_swizzle_aos(const struct util_format_description *desc,
                             LLVMValueRef unswizzled);
 
 LLVMValueRef
-lp_build_pack_rgba_aos(LLVMBuilderRef builder,
+lp_build_pack_rgba_aos(struct gallivm_state *gallivm,
                        const struct util_format_description *desc,
                        LLVMValueRef rgba);
 
 LLVMValueRef
-lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
+lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
                         const struct util_format_description *format_desc,
                         struct lp_type type,
                         LLVMValueRef base_ptr,
@@ -78,20 +79,20 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
                             LLVMValueRef swizzled_out[4]);
 
 void
-lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
+lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
                          const struct util_format_description *format_desc,
                          struct lp_type type,
                          LLVMValueRef packed,
                          LLVMValueRef rgba_out[4]);
 
 void
-lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder,
+lp_build_rgba8_to_f32_soa(struct gallivm_state *gallivm,
                           struct lp_type dst_type,
                           LLVMValueRef packed,
                           LLVMValueRef *rgba);
 
 void
-lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
+lp_build_fetch_rgba_soa(struct gallivm_state *gallivm,
                         const struct util_format_description *format_desc,
                         struct lp_type type,
                         LLVMValueRef base_ptr,
@@ -106,7 +107,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_fetch_subsampled_rgba_aos(LLVMBuilderRef builder,
+lp_build_fetch_subsampled_rgba_aos(struct gallivm_state *gallivm,
                                    const struct util_format_description *format_desc,
                                    unsigned n,
                                    LLVMValueRef base_ptr,
index 6b9189e1da5a06f3a44c5ee199c4606a66e63cd1..82ab19eda14ba199389ac7c040c357a9b1ac31ed 100644 (file)
@@ -36,6 +36,7 @@
 #include "util/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
+#include "util/u_pointer.h"
 #include "util/u_string.h"
 
 #include "lp_bld_arit.h"
@@ -145,10 +146,11 @@ format_matches_type(const struct util_format_description *desc,
  * @return RGBA in a float[4] or ubyte[4] or ushort[4] vector.
  */
 static INLINE LLVMValueRef
-lp_build_unpack_arith_rgba_aos(LLVMBuilderRef builder,
+lp_build_unpack_arith_rgba_aos(struct gallivm_state *gallivm,
                                const struct util_format_description *desc,
                                LLVMValueRef packed)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef shifted, casted, scaled, masked;
    LLVMValueRef shifts[4];
    LLVMValueRef masks[4];
@@ -167,21 +169,21 @@ lp_build_unpack_arith_rgba_aos(LLVMBuilderRef builder,
 
    /* Do the intermediate integer computations with 32bit integers since it
     * matches floating point size */
-   assert (LLVMTypeOf(packed) == LLVMInt32Type());
+   assert (LLVMTypeOf(packed) == LLVMInt32TypeInContext(gallivm->context));
 
    /* Broadcast the packed value to all four channels
     * before: packed = BGRA
     * after: packed = {BGRA, BGRA, BGRA, BGRA}
     */
    packed = LLVMBuildInsertElement(builder,
-                                   LLVMGetUndef(LLVMVectorType(LLVMInt32Type(), 4)),
+                                   LLVMGetUndef(LLVMVectorType(LLVMInt32TypeInContext(gallivm->context), 4)),
                                    packed,
-                                   LLVMConstNull(LLVMInt32Type()),
+                                   LLVMConstNull(LLVMInt32TypeInContext(gallivm->context)),
                                    "");
    packed = LLVMBuildShuffleVector(builder,
                                    packed,
-                                   LLVMGetUndef(LLVMVectorType(LLVMInt32Type(), 4)),
-                                   LLVMConstNull(LLVMVectorType(LLVMInt32Type(), 4)),
+                                   LLVMGetUndef(LLVMVectorType(LLVMInt32TypeInContext(gallivm->context), 4)),
+                                   LLVMConstNull(LLVMVectorType(LLVMInt32TypeInContext(gallivm->context), 4)),
                                    "");
 
    /* Initialize vector constants */
@@ -194,9 +196,9 @@ lp_build_unpack_arith_rgba_aos(LLVMBuilderRef builder,
       unsigned bits = desc->channel[i].size;
 
       if (desc->channel[i].type == UTIL_FORMAT_TYPE_VOID) {
-         shifts[i] = LLVMGetUndef(LLVMInt32Type());
-         masks[i] = LLVMConstNull(LLVMInt32Type());
-         scales[i] =  LLVMConstNull(LLVMFloatType());
+         shifts[i] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
+         masks[i] = LLVMConstNull(LLVMInt32TypeInContext(gallivm->context));
+         scales[i] =  LLVMConstNull(LLVMFloatTypeInContext(gallivm->context));
       }
       else {
          unsigned long long mask = (1ULL << bits) - 1;
@@ -207,15 +209,15 @@ lp_build_unpack_arith_rgba_aos(LLVMBuilderRef builder,
             needs_uitofp = TRUE;
          }
 
-         shifts[i] = LLVMConstInt(LLVMInt32Type(), shift, 0);
-         masks[i] = LLVMConstInt(LLVMInt32Type(), mask, 0);
+         shifts[i] = lp_build_const_int32(gallivm, shift);
+         masks[i] = lp_build_const_int32(gallivm, mask);
 
          if (desc->channel[i].normalized) {
-            scales[i] = LLVMConstReal(LLVMFloatType(), 1.0/mask);
+            scales[i] = lp_build_const_float(gallivm, 1.0 / mask);
             normalized = TRUE;
          }
          else
-            scales[i] =  LLVMConstReal(LLVMFloatType(), 1.0);
+            scales[i] =  lp_build_const_float(gallivm, 1.0);
       }
 
       shift += bits;
@@ -230,9 +232,9 @@ lp_build_unpack_arith_rgba_aos(LLVMBuilderRef builder,
 
    if (!needs_uitofp) {
       /* UIToFP can't be expressed in SSE2 */
-      casted = LLVMBuildSIToFP(builder, masked, LLVMVectorType(LLVMFloatType(), 4), "");
+      casted = LLVMBuildSIToFP(builder, masked, LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4), "");
    } else {
-      casted = LLVMBuildUIToFP(builder, masked, LLVMVectorType(LLVMFloatType(), 4), "");
+      casted = LLVMBuildUIToFP(builder, masked, LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4), "");
    }
 
    /* At this point 'casted' may be a vector of floats such as
@@ -258,10 +260,11 @@ lp_build_unpack_arith_rgba_aos(LLVMBuilderRef builder,
  * a time is rarely if ever needed.
  */
 LLVMValueRef
-lp_build_pack_rgba_aos(LLVMBuilderRef builder,
+lp_build_pack_rgba_aos(struct gallivm_state *gallivm,
                        const struct util_format_description *desc,
                        LLVMValueRef rgba)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMTypeRef type;
    LLVMValueRef packed = NULL;
    LLVMValueRef swizzles[4];
@@ -276,7 +279,7 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
    assert(desc->block.width == 1);
    assert(desc->block.height == 1);
 
-   type = LLVMIntType(desc->block.bits);
+   type = LLVMIntTypeInContext(gallivm->context, desc->block.bits);
 
    /* Unswizzle the color components into the source vector. */
    for (i = 0; i < 4; ++i) {
@@ -285,13 +288,13 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
             break;
       }
       if (j < 4)
-         swizzles[i] = LLVMConstInt(LLVMInt32Type(), j, 0);
+         swizzles[i] = lp_build_const_int32(gallivm, j);
       else
-         swizzles[i] = LLVMGetUndef(LLVMInt32Type());
+         swizzles[i] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
    }
 
    unswizzled = LLVMBuildShuffleVector(builder, rgba,
-                                       LLVMGetUndef(LLVMVectorType(LLVMFloatType(), 4)),
+                                       LLVMGetUndef(LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4)),
                                        LLVMConstVector(swizzles, 4), "");
 
    normalized = FALSE;
@@ -300,8 +303,8 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
       unsigned bits = desc->channel[i].size;
 
       if (desc->channel[i].type == UTIL_FORMAT_TYPE_VOID) {
-         shifts[i] = LLVMGetUndef(LLVMInt32Type());
-         scales[i] =  LLVMGetUndef(LLVMFloatType());
+         shifts[i] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
+         scales[i] =  LLVMGetUndef(LLVMFloatTypeInContext(gallivm->context));
       }
       else {
          unsigned mask = (1 << bits) - 1;
@@ -309,14 +312,14 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
          assert(desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED);
          assert(bits < 32);
 
-         shifts[i] = LLVMConstInt(LLVMInt32Type(), shift, 0);
+         shifts[i] = lp_build_const_int32(gallivm, shift);
 
          if (desc->channel[i].normalized) {
-            scales[i] = LLVMConstReal(LLVMFloatType(), mask);
+            scales[i] = lp_build_const_float(gallivm, mask);
             normalized = TRUE;
          }
          else
-            scales[i] =  LLVMConstReal(LLVMFloatType(), 1.0);
+            scales[i] = lp_build_const_float(gallivm, 1.0);
       }
 
       shift += bits;
@@ -327,14 +330,15 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
    else
       scaled = unswizzled;
 
-   casted = LLVMBuildFPToSI(builder, scaled, LLVMVectorType(LLVMInt32Type(), 4), "");
+   casted = LLVMBuildFPToSI(builder, scaled, LLVMVectorType(LLVMInt32TypeInContext(gallivm->context), 4), "");
 
    shifted = LLVMBuildShl(builder, casted, LLVMConstVector(shifts, 4), "");
    
    /* Bitwise or all components */
    for (i = 0; i < 4; ++i) {
       if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED) {
-         LLVMValueRef component = LLVMBuildExtractElement(builder, shifted, LLVMConstInt(LLVMInt32Type(), i, 0), "");
+         LLVMValueRef component = LLVMBuildExtractElement(builder, shifted,
+                                               lp_build_const_int32(gallivm, i), "");
          if (packed)
             packed = LLVMBuildOr(builder, packed, component, "");
          else
@@ -343,7 +347,7 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
    }
 
    if (!packed)
-      packed = LLVMGetUndef(LLVMInt32Type());
+      packed = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
 
    if (desc->block.bits < 32)
       packed = LLVMBuildTrunc(builder, packed, type, "");
@@ -364,7 +368,7 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
  * \return  a 4 element vector with the pixel's RGBA values.
  */
 LLVMValueRef
-lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
+lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
                         const struct util_format_description *format_desc,
                         struct lp_type type,
                         LLVMValueRef base_ptr,
@@ -372,13 +376,14 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
                         LLVMValueRef i,
                         LLVMValueRef j)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    unsigned num_pixels = type.length / 4;
    struct lp_build_context bld;
 
    assert(type.length <= LP_MAX_VECTOR_LENGTH);
    assert(type.length % 4 == 0);
 
-   lp_build_context_init(&bld, builder, type);
+   lp_build_context_init(&bld, gallivm, type);
 
    /*
     * Trivial case
@@ -397,13 +402,14 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
        * scaling or converting.
        */
 
-      packed = lp_build_gather(builder, type.length/4,
+      packed = lp_build_gather(gallivm, type.length/4,
                                format_desc->block.bits, type.width*4,
                                base_ptr, offset);
 
       assert(format_desc->block.bits <= type.width * type.length);
 
-      packed = LLVMBuildBitCast(builder, packed, lp_build_vec_type(type), "");
+      packed = LLVMBuildBitCast(gallivm->builder, packed,
+                                lp_build_vec_type(gallivm, type), "");
 
       return lp_build_format_swizzle_aos(format_desc, &bld, packed);
    }
@@ -435,11 +441,12 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
       for (k = 0; k < num_pixels; ++k) {
          LLVMValueRef packed;
 
-         packed = lp_build_gather_elem(builder, num_pixels,
+         packed = lp_build_gather_elem(gallivm, num_pixels,
                                        format_desc->block.bits, 32,
                                        base_ptr, offset, k);
 
-         tmps[k] = lp_build_unpack_arith_rgba_aos(builder, format_desc,
+         tmps[k] = lp_build_unpack_arith_rgba_aos(gallivm,
+                                                  format_desc,
                                                   packed);
       }
 
@@ -455,7 +462,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
                       __FUNCTION__, format_desc->short_name);
       }
 
-      lp_build_conv(builder,
+      lp_build_conv(gallivm,
                     lp_float32_vec4_type(),
                     type,
                     tmps, num_pixels, &res, 1);
@@ -476,14 +483,14 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
       tmp_type.length = num_pixels * 4;
       tmp_type.norm = TRUE;
 
-      tmp = lp_build_fetch_subsampled_rgba_aos(builder,
+      tmp = lp_build_fetch_subsampled_rgba_aos(gallivm,
                                                format_desc,
                                                num_pixels,
                                                base_ptr,
                                                offset,
                                                i, j);
 
-      lp_build_conv(builder,
+      lp_build_conv(gallivm,
                     tmp_type, type,
                     &tmp, 1, &tmp, 1);
 
@@ -505,51 +512,52 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
        * or incentive to optimize.
        */
 
-      LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
-      char name[256];
-      LLVMTypeRef i8t = LLVMInt8Type();
+      LLVMTypeRef i8t = LLVMInt8TypeInContext(gallivm->context);
       LLVMTypeRef pi8t = LLVMPointerType(i8t, 0);
-      LLVMTypeRef i32t = LLVMInt32Type();
+      LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
       LLVMValueRef function;
       LLVMValueRef tmp_ptr;
       LLVMValueRef tmp;
       LLVMValueRef res;
       unsigned k;
 
-      util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_8unorm",
-                    format_desc->short_name);
-
       if (gallivm_debug & GALLIVM_DEBUG_PERF) {
-         debug_printf("%s: falling back to %s\n", __FUNCTION__, name);
+         debug_printf("%s: falling back to util_format_%s_fetch_rgba_8unorm\n",
+                      __FUNCTION__, format_desc->short_name);
       }
 
       /*
        * Declare and bind format_desc->fetch_rgba_8unorm().
        */
 
-      function = LLVMGetNamedFunction(module, name);
-      if (!function) {
+      {
+         /*
+          * Function to call looks like:
+          *   fetch(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+          */
          LLVMTypeRef ret_type;
          LLVMTypeRef arg_types[4];
          LLVMTypeRef function_type;
 
-         ret_type = LLVMVoidType();
+         ret_type = LLVMVoidTypeInContext(gallivm->context);
          arg_types[0] = pi8t;
          arg_types[1] = pi8t;
-         arg_types[3] = arg_types[2] = LLVMIntType(sizeof(unsigned) * 8);
-         function_type = LLVMFunctionType(ret_type, arg_types, Elements(arg_types), 0);
-         function = LLVMAddFunction(module, name, function_type);
-
-         LLVMSetFunctionCallConv(function, LLVMCCallConv);
-         LLVMSetLinkage(function, LLVMExternalLinkage);
-
-         assert(LLVMIsDeclaration(function));
-
-         LLVMAddGlobalMapping(lp_build_engine, function,
-                              func_to_pointer((func_pointer)format_desc->fetch_rgba_8unorm));
+         arg_types[2] = i32t;
+         arg_types[3] = i32t;
+         function_type = LLVMFunctionType(ret_type, arg_types,
+                                          Elements(arg_types), 0);
+
+         /* make const pointer for the C fetch_rgba_8unorm function */
+         function = lp_build_const_int_pointer(gallivm,
+            func_to_pointer((func_pointer) format_desc->fetch_rgba_8unorm));
+
+         /* cast the callee pointer to the function's type */
+         function = LLVMBuildBitCast(builder, function,
+                                     LLVMPointerType(function_type, 0),
+                                     "cast callee");
       }
 
-      tmp_ptr = lp_build_alloca(builder, i32t, "");
+      tmp_ptr = lp_build_alloca(gallivm, i32t, "");
 
       res = LLVMGetUndef(LLVMVectorType(i32t, num_pixels));
 
@@ -559,11 +567,11 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
        */
 
       for (k = 0; k < num_pixels; ++k) {
-         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), k, 0);
+         LLVMValueRef index = lp_build_const_int32(gallivm, k);
          LLVMValueRef args[4];
 
          args[0] = LLVMBuildBitCast(builder, tmp_ptr, pi8t, "");
-         args[1] = lp_build_gather_elem_ptr(builder, num_pixels,
+         args[1] = lp_build_gather_elem_ptr(gallivm, num_pixels,
                                             base_ptr, offset, k);
 
          if (num_pixels == 1) {
@@ -608,51 +616,58 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
        * or incentive to optimize.
        */
 
-      LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
-      char name[256];
-      LLVMTypeRef f32t = LLVMFloatType();
+      LLVMTypeRef f32t = LLVMFloatTypeInContext(gallivm->context);
       LLVMTypeRef f32x4t = LLVMVectorType(f32t, 4);
       LLVMTypeRef pf32t = LLVMPointerType(f32t, 0);
+      LLVMTypeRef pi8t = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0);
+      LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
       LLVMValueRef function;
       LLVMValueRef tmp_ptr;
       LLVMValueRef tmps[LP_MAX_VECTOR_LENGTH/4];
       LLVMValueRef res;
       unsigned k;
 
-      util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_float",
-                    format_desc->short_name);
-
       if (gallivm_debug & GALLIVM_DEBUG_PERF) {
-         debug_printf("%s: falling back to %s\n", __FUNCTION__, name);
+         debug_printf("%s: falling back to util_format_%s_fetch_rgba_float\n",
+                      __FUNCTION__, format_desc->short_name);
       }
 
       /*
        * Declare and bind format_desc->fetch_rgba_float().
        */
 
-      function = LLVMGetNamedFunction(module, name);
-      if (!function) {
+      {
+         /*
+          * Function to call looks like:
+          *   fetch(float *dst, const uint8_t *src, unsigned i, unsigned j)
+          */
          LLVMTypeRef ret_type;
          LLVMTypeRef arg_types[4];
          LLVMTypeRef function_type;
 
-         ret_type = LLVMVoidType();
+         ret_type = LLVMVoidTypeInContext(gallivm->context);
          arg_types[0] = pf32t;
-         arg_types[1] = LLVMPointerType(LLVMInt8Type(), 0);
-         arg_types[3] = arg_types[2] = LLVMIntType(sizeof(unsigned) * 8);
-         function_type = LLVMFunctionType(ret_type, arg_types, Elements(arg_types), 0);
-         function = LLVMAddFunction(module, name, function_type);
+         arg_types[1] = pi8t;
+         arg_types[2] = i32t;
+         arg_types[3] = i32t;
+         function_type = LLVMFunctionType(ret_type, arg_types,
+                                          Elements(arg_types), 0);
 
-         LLVMSetFunctionCallConv(function, LLVMCCallConv);
-         LLVMSetLinkage(function, LLVMExternalLinkage);
+         /* Note: we're using this casting here instead of LLVMAddGlobalMapping()
+          * to work around a bug in LLVM 2.6, and for efficiency/simplicity.
+          */
 
-         assert(LLVMIsDeclaration(function));
+         /* make const pointer for the C fetch_rgba_float function */
+         function = lp_build_const_int_pointer(gallivm,
+            func_to_pointer((func_pointer) format_desc->fetch_rgba_float));
 
-         LLVMAddGlobalMapping(lp_build_engine, function,
-                              func_to_pointer((func_pointer)format_desc->fetch_rgba_float));
+         /* cast the callee pointer to the function's type */
+         function = LLVMBuildBitCast(builder, function,
+                                     LLVMPointerType(function_type, 0),
+                                     "cast callee");
       }
 
-      tmp_ptr = lp_build_alloca(builder, f32x4t, "");
+      tmp_ptr = lp_build_alloca(gallivm, f32x4t, "");
 
       /*
        * Invoke format_desc->fetch_rgba_float() for each pixel and insert the result
@@ -663,7 +678,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
          LLVMValueRef args[4];
 
          args[0] = LLVMBuildBitCast(builder, tmp_ptr, pf32t, "");
-         args[1] = lp_build_gather_elem_ptr(builder, num_pixels,
+         args[1] = lp_build_gather_elem_ptr(gallivm, num_pixels,
                                             base_ptr, offset, k);
 
          if (num_pixels == 1) {
@@ -671,7 +686,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
             args[3] = j;
          }
          else {
-            LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), k, 0);
+            LLVMValueRef index = lp_build_const_int32(gallivm, k);
             args[2] = LLVMBuildExtractElement(builder, i, index, "");
             args[3] = LLVMBuildExtractElement(builder, j, index, "");
          }
@@ -681,7 +696,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
          tmps[k] = LLVMBuildLoad(builder, tmp_ptr, "");
       }
 
-      lp_build_conv(builder,
+      lp_build_conv(gallivm,
                     lp_float32_vec4_type(),
                     type,
                     tmps, num_pixels, &res, 1);
@@ -690,5 +705,5 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
    }
 
    assert(0);
-   return lp_build_undef(type);
+   return lp_build_undef(gallivm, type);
 }
index ce7e54afc76a49be536fe39bdaa0f91dc1ef2792..0a57b3ce794c6a9680829f1208ac0144afafaab8 100644 (file)
@@ -97,12 +97,13 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
  * \param rgba_out  returns the SoA R,G,B,A vectors
  */
 void
-lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
+lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
                          const struct util_format_description *format_desc,
                          struct lp_type type,
                          LLVMValueRef packed,
                          LLVMValueRef rgba_out[4])
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_build_context bld;
    LLVMValueRef inputs[4];
    unsigned start;
@@ -116,7 +117,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
    assert(type.floating);
    assert(type.width == 32);
 
-   lp_build_context_init(&bld, builder, type);
+   lp_build_context_init(&bld, gallivm, type);
 
    /* Decode the input vector components */
    start = 0;
@@ -129,7 +130,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
 
       switch(format_desc->channel[chan].type) {
       case UTIL_FORMAT_TYPE_VOID:
-         input = lp_build_undef(type);
+         input = lp_build_undef(gallivm, type);
          break;
 
       case UTIL_FORMAT_TYPE_UNSIGNED:
@@ -138,7 +139,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
           */
 
          if (start) {
-            input = LLVMBuildLShr(builder, input, lp_build_const_int_vec(type, start), "");
+            input = LLVMBuildLShr(builder, input, lp_build_const_int_vec(gallivm, type, start), "");
          }
 
          /*
@@ -147,7 +148,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
 
          if (stop < format_desc->block.bits) {
             unsigned mask = ((unsigned long long)1 << width) - 1;
-            input = LLVMBuildAnd(builder, input, lp_build_const_int_vec(type, mask), "");
+            input = LLVMBuildAnd(builder, input, lp_build_const_int_vec(gallivm, type, mask), "");
          }
 
          /*
@@ -156,14 +157,15 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
 
          if (type.floating) {
             if(format_desc->channel[chan].normalized)
-               input = lp_build_unsigned_norm_to_float(builder, width, type, input);
+               input = lp_build_unsigned_norm_to_float(gallivm, width, type, input);
             else
-               input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
+               input = LLVMBuildSIToFP(builder, input,
+                                       lp_build_vec_type(gallivm, type), "");
          }
          else {
             /* FIXME */
             assert(0);
-            input = lp_build_undef(type);
+            input = lp_build_undef(gallivm, type);
          }
 
          break;
@@ -175,7 +177,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
 
          if (stop < type.width) {
             unsigned bits = type.width - stop;
-            LLVMValueRef bits_val = lp_build_const_int_vec(type, bits);
+            LLVMValueRef bits_val = lp_build_const_int_vec(gallivm, type, bits);
             input = LLVMBuildShl(builder, input, bits_val, "");
          }
 
@@ -185,7 +187,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
 
          if (format_desc->channel[chan].size < type.width) {
             unsigned bits = type.width - format_desc->channel[chan].size;
-            LLVMValueRef bits_val = lp_build_const_int_vec(type, bits);
+            LLVMValueRef bits_val = lp_build_const_int_vec(gallivm, type, bits);
             input = LLVMBuildAShr(builder, input, bits_val, "");
          }
 
@@ -194,17 +196,17 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
           */
 
          if (type.floating) {
-            input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
+            input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(gallivm, type), "");
             if (format_desc->channel[chan].normalized) {
                double scale = 1.0 / ((1 << (format_desc->channel[chan].size - 1)) - 1);
-               LLVMValueRef scale_val = lp_build_const_vec(type, scale);
+               LLVMValueRef scale_val = lp_build_const_vec(gallivm, type, scale);
                input = LLVMBuildFMul(builder, input, scale_val, "");
             }
          }
          else {
             /* FIXME */
             assert(0);
-            input = lp_build_undef(type);
+            input = lp_build_undef(gallivm, type);
          }
 
          break;
@@ -214,32 +216,32 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
             assert(start == 0);
             assert(stop == 32);
             assert(type.width == 32);
-            input = LLVMBuildBitCast(builder, input, lp_build_vec_type(type), "");
+            input = LLVMBuildBitCast(builder, input, lp_build_vec_type(gallivm, type), "");
          }
          else {
             /* FIXME */
             assert(0);
-            input = lp_build_undef(type);
+            input = lp_build_undef(gallivm, type);
          }
          break;
 
       case UTIL_FORMAT_TYPE_FIXED:
          if (type.floating) {
             double scale = 1.0 / ((1 << (format_desc->channel[chan].size/2)) - 1);
-            LLVMValueRef scale_val = lp_build_const_vec(type, scale);
-            input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
+            LLVMValueRef scale_val = lp_build_const_vec(gallivm, type, scale);
+            input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(gallivm, type), "");
             input = LLVMBuildFMul(builder, input, scale_val, "");
          }
          else {
             /* FIXME */
             assert(0);
-            input = lp_build_undef(type);
+            input = lp_build_undef(gallivm, type);
          }
          break;
 
       default:
          assert(0);
-         input = lp_build_undef(type);
+         input = lp_build_undef(gallivm, type);
          break;
       }
 
@@ -253,16 +255,17 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
 
 
 void
-lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder,
+lp_build_rgba8_to_f32_soa(struct gallivm_state *gallivm,
                           struct lp_type dst_type,
                           LLVMValueRef packed,
                           LLVMValueRef *rgba)
 {
-   LLVMValueRef mask = lp_build_const_int_vec(dst_type, 0xff);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMValueRef mask = lp_build_const_int_vec(gallivm, dst_type, 0xff);
    unsigned chan;
 
    packed = LLVMBuildBitCast(builder, packed,
-                             lp_build_int_vec_type(dst_type), "");
+                             lp_build_int_vec_type(gallivm, dst_type), "");
 
    /* Decode the input vector components */
    for (chan = 0; chan < 4; ++chan) {
@@ -274,12 +277,12 @@ lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder,
 
       if (start)
          input = LLVMBuildLShr(builder, input,
-                               lp_build_const_int_vec(dst_type, start), "");
+                               lp_build_const_int_vec(gallivm, dst_type, start), "");
 
       if (stop < 32)
          input = LLVMBuildAnd(builder, input, mask, "");
 
-      input = lp_build_unsigned_norm_to_float(builder, 8, dst_type, input);
+      input = lp_build_unsigned_norm_to_float(gallivm, 8, dst_type, input);
 
       rgba[chan] = input;
    }
@@ -303,7 +306,7 @@ lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder,
  *              be in [0, block_width-1] and j will be in [0, block_height-1].
  */
 void
-lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
+lp_build_fetch_rgba_soa(struct gallivm_state *gallivm,
                         const struct util_format_description *format_desc,
                         struct lp_type type,
                         LLVMValueRef base_ptr,
@@ -312,6 +315,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
                         LLVMValueRef j,
                         LLVMValueRef rgba_out[4])
 {
+   LLVMBuilderRef builder = gallivm->builder;
 
    if (format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN &&
        (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
@@ -334,7 +338,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
        * gather the texels from the texture
        * Ex: packed = {BGRA, BGRA, BGRA, BGRA}.
        */
-      packed = lp_build_gather(builder,
+      packed = lp_build_gather(gallivm,
                                type.length,
                                format_desc->block.bits,
                                type.width,
@@ -343,7 +347,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
       /*
        * convert texels to float rgba
        */
-      lp_build_unpack_rgba_soa(builder,
+      lp_build_unpack_rgba_soa(gallivm,
                                format_desc,
                                type,
                                packed, rgba_out);
@@ -364,10 +368,10 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
       tmp_type.length = type.length * 4;
       tmp_type.norm = TRUE;
 
-      tmp = lp_build_fetch_rgba_aos(builder, format_desc, tmp_type,
+      tmp = lp_build_fetch_rgba_aos(gallivm, format_desc, tmp_type,
                                     base_ptr, offset, i, j);
 
-      lp_build_rgba8_to_f32_soa(builder,
+      lp_build_rgba8_to_f32_soa(gallivm,
                                 type,
                                 tmp,
                                 rgba_out);
@@ -397,23 +401,24 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
       tmp_type.length = 4;
 
       for (chan = 0; chan < 4; ++chan) {
-         rgba_out[chan] = lp_build_undef(type);
+         rgba_out[chan] = lp_build_undef(gallivm, type);
       }
 
       /* loop over number of pixels */
       for(k = 0; k < type.length; ++k) {
-         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), k, 0);
+         LLVMValueRef index = lp_build_const_int32(gallivm, k);
          LLVMValueRef offset_elem;
          LLVMValueRef i_elem, j_elem;
          LLVMValueRef tmp;
 
-         offset_elem = LLVMBuildExtractElement(builder, offset, index, "");
+         offset_elem = LLVMBuildExtractElement(builder, offset,
+                                               index, "");
 
          i_elem = LLVMBuildExtractElement(builder, i, index, "");
          j_elem = LLVMBuildExtractElement(builder, j, index, "");
 
          /* Get a single float[4]={R,G,B,A} pixel */
-         tmp = lp_build_fetch_rgba_aos(builder, format_desc, tmp_type,
+         tmp = lp_build_fetch_rgba_aos(gallivm, format_desc, tmp_type,
                                        base_ptr, offset_elem,
                                        i_elem, j_elem);
 
@@ -422,7 +427,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
           * position = 'index'.
           */
          for (chan = 0; chan < 4; ++chan) {
-            LLVMValueRef chan_val = LLVMConstInt(LLVMInt32Type(), chan, 0),
+            LLVMValueRef chan_val = lp_build_const_int32(gallivm, chan),
             tmp_chan = LLVMBuildExtractElement(builder, tmp, chan_val, "");
             rgba_out[chan] = LLVMBuildInsertElement(builder, rgba_out[chan],
                                                     tmp_chan, index, "");
index 2bce2895551fb04e710141975d089f649230ec35..cdf1956c093ec6f5a6ada5451bc700634a0cf0ae 100644 (file)
@@ -43,6 +43,7 @@
 #include "lp_bld_conv.h"
 #include "lp_bld_gather.h"
 #include "lp_bld_format.h"
+#include "lp_bld_init.h"
 #include "lp_bld_logic.h"
 
 /**
@@ -51,7 +52,7 @@
  * @param i  is a <n x i32> vector with the x pixel coordinate (0 or 1)
  */
 static void
-uyvy_to_yuv_soa(LLVMBuilderRef builder,
+uyvy_to_yuv_soa(struct gallivm_state *gallivm,
                 unsigned n,
                 LLVMValueRef packed,
                 LLVMValueRef i,
@@ -59,6 +60,7 @@ uyvy_to_yuv_soa(LLVMBuilderRef builder,
                 LLVMValueRef *u,
                 LLVMValueRef *v)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_type type;
    LLVMValueRef mask;
 
@@ -86,25 +88,25 @@ uyvy_to_yuv_soa(LLVMBuilderRef builder,
       LLVMValueRef sel, tmp, tmp2;
       struct lp_build_context bld32;
 
-      lp_build_context_init(&bld32, builder, type);
+      lp_build_context_init(&bld32, gallivm, type);
 
-      tmp = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 8), "");
-      tmp2 = LLVMBuildLShr(builder, tmp, lp_build_const_int_vec(type, 16), "");
-      sel = lp_build_compare(builder, type, PIPE_FUNC_EQUAL, i, lp_build_const_int_vec(type, 0));
+      tmp = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 8), "");
+      tmp2 = LLVMBuildLShr(builder, tmp, lp_build_const_int_vec(gallivm, type, 16), "");
+      sel = lp_build_compare(gallivm, type, PIPE_FUNC_EQUAL, i, lp_build_const_int_vec(gallivm, type, 0));
       *y = lp_build_select(&bld32, sel, tmp, tmp2);
    } else
 #endif
    {
       LLVMValueRef shift;
-      shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(type, 16), "");
-      shift = LLVMBuildAdd(builder, shift, lp_build_const_int_vec(type, 8), "");
+      shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(gallivm, type, 16), "");
+      shift = LLVMBuildAdd(builder, shift, lp_build_const_int_vec(gallivm, type, 8), "");
       *y = LLVMBuildLShr(builder, packed, shift, "");
    }
 
    *u = packed;
-   *v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 16), "");
+   *v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 16), "");
 
-   mask = lp_build_const_int_vec(type, 0xff);
+   mask = lp_build_const_int_vec(gallivm, type, 0xff);
 
    *y = LLVMBuildAnd(builder, *y, mask, "y");
    *u = LLVMBuildAnd(builder, *u, mask, "u");
@@ -118,7 +120,7 @@ uyvy_to_yuv_soa(LLVMBuilderRef builder,
  * @param i  is a <n x i32> vector with the x pixel coordinate (0 or 1)
  */
 static void
-yuyv_to_yuv_soa(LLVMBuilderRef builder,
+yuyv_to_yuv_soa(struct gallivm_state *gallivm,
                 unsigned n,
                 LLVMValueRef packed,
                 LLVMValueRef i,
@@ -126,6 +128,7 @@ yuyv_to_yuv_soa(LLVMBuilderRef builder,
                 LLVMValueRef *u,
                 LLVMValueRef *v)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_type type;
    LLVMValueRef mask;
 
@@ -153,23 +156,23 @@ yuyv_to_yuv_soa(LLVMBuilderRef builder,
       LLVMValueRef sel, tmp;
       struct lp_build_context bld32;
 
-      lp_build_context_init(&bld32, builder, type);
+      lp_build_context_init(&bld32, gallivm, type);
 
-      tmp = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 16), "");
-      sel = lp_build_compare(builder, type, PIPE_FUNC_EQUAL, i, lp_build_const_int_vec(type, 0));
+      tmp = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 16), "");
+      sel = lp_build_compare(gallivm, type, PIPE_FUNC_EQUAL, i, lp_build_const_int_vec(gallivm, type, 0));
        *y = lp_build_select(&bld32, sel, packed, tmp);
    } else
 #endif
    {
       LLVMValueRef shift;
-      shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(type, 16), "");
+      shift = LLVMBuildMul(builder, i, lp_build_const_int_vec(gallivm, type, 16), "");
       *y = LLVMBuildLShr(builder, packed, shift, "");
    }
 
-   *u = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 8), "");
-   *v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(type, 24), "");
+   *u = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 8), "");
+   *v = LLVMBuildLShr(builder, packed, lp_build_const_int_vec(gallivm, type, 24), "");
 
-   mask = lp_build_const_int_vec(type, 0xff);
+   mask = lp_build_const_int_vec(gallivm, type, 0xff);
 
    *y = LLVMBuildAnd(builder, *y, mask, "y");
    *u = LLVMBuildAnd(builder, *u, mask, "u");
@@ -178,11 +181,12 @@ yuyv_to_yuv_soa(LLVMBuilderRef builder,
 
 
 static INLINE void
-yuv_to_rgb_soa(LLVMBuilderRef builder,
+yuv_to_rgb_soa(struct gallivm_state *gallivm,
                unsigned n,
                LLVMValueRef y, LLVMValueRef u, LLVMValueRef v,
                LLVMValueRef *r, LLVMValueRef *g, LLVMValueRef *b)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_type type;
    struct lp_build_context bld;
 
@@ -203,7 +207,7 @@ yuv_to_rgb_soa(LLVMBuilderRef builder,
    type.width = 32;
    type.length = n;
 
-   lp_build_context_init(&bld, builder, type);
+   lp_build_context_init(&bld, gallivm, type);
 
    assert(lp_check_value(type, y));
    assert(lp_check_value(type, u));
@@ -213,17 +217,17 @@ yuv_to_rgb_soa(LLVMBuilderRef builder,
     * Constants
     */
 
-   c0   = lp_build_const_int_vec(type,   0);
-   c8   = lp_build_const_int_vec(type,   8);
-   c16  = lp_build_const_int_vec(type,  16);
-   c128 = lp_build_const_int_vec(type, 128);
-   c255 = lp_build_const_int_vec(type, 255);
+   c0   = lp_build_const_int_vec(gallivm, type,   0);
+   c8   = lp_build_const_int_vec(gallivm, type,   8);
+   c16  = lp_build_const_int_vec(gallivm, type,  16);
+   c128 = lp_build_const_int_vec(gallivm, type, 128);
+   c255 = lp_build_const_int_vec(gallivm, type, 255);
 
-   cy  = lp_build_const_int_vec(type,  298);
-   cug = lp_build_const_int_vec(type, -100);
-   cub = lp_build_const_int_vec(type,  516);
-   cvr = lp_build_const_int_vec(type,  409);
-   cvg = lp_build_const_int_vec(type, -208);
+   cy  = lp_build_const_int_vec(gallivm, type,  298);
+   cug = lp_build_const_int_vec(gallivm, type, -100);
+   cub = lp_build_const_int_vec(gallivm, type,  516);
+   cvr = lp_build_const_int_vec(gallivm, type,  409);
+   cvg = lp_build_const_int_vec(gallivm, type, -208);
 
    /*
     *  y -= 16;
@@ -276,10 +280,11 @@ yuv_to_rgb_soa(LLVMBuilderRef builder,
 
 
 static LLVMValueRef
-rgb_to_rgba_aos(LLVMBuilderRef builder,
+rgb_to_rgba_aos(struct gallivm_state *gallivm,
                 unsigned n,
                 LLVMValueRef r, LLVMValueRef g, LLVMValueRef b)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_type type;
    LLVMValueRef a;
    LLVMValueRef rgba;
@@ -298,9 +303,9 @@ rgb_to_rgba_aos(LLVMBuilderRef builder,
     */
 
    r = r;
-   g = LLVMBuildShl(builder, g, lp_build_const_int_vec(type, 8), "");
-   b = LLVMBuildShl(builder, b, lp_build_const_int_vec(type, 16), "");
-   a = lp_build_const_int_vec(type, 0xff000000);
+   g = LLVMBuildShl(builder, g, lp_build_const_int_vec(gallivm, type, 8), "");
+   b = LLVMBuildShl(builder, b, lp_build_const_int_vec(gallivm, type, 16), "");
+   a = lp_build_const_int_vec(gallivm, type, 0xff000000);
 
    rgba = r;
    rgba = LLVMBuildOr(builder, rgba, g, "");
@@ -308,7 +313,7 @@ rgb_to_rgba_aos(LLVMBuilderRef builder,
    rgba = LLVMBuildOr(builder, rgba, a, "");
 
    rgba = LLVMBuildBitCast(builder, rgba,
-                           LLVMVectorType(LLVMInt8Type(), 4*n), "");
+                           LLVMVectorType(LLVMInt8TypeInContext(gallivm->context), 4*n), "");
 
    return rgba;
 }
@@ -318,7 +323,7 @@ rgb_to_rgba_aos(LLVMBuilderRef builder,
  * Convert from <n x i32> packed UYVY to <4n x i8> RGBA AoS
  */
 static LLVMValueRef
-uyvy_to_rgba_aos(LLVMBuilderRef builder,
+uyvy_to_rgba_aos(struct gallivm_state *gallivm,
                  unsigned n,
                  LLVMValueRef packed,
                  LLVMValueRef i)
@@ -327,9 +332,9 @@ uyvy_to_rgba_aos(LLVMBuilderRef builder,
    LLVMValueRef r, g, b;
    LLVMValueRef rgba;
 
-   uyvy_to_yuv_soa(builder, n, packed, i, &y, &u, &v);
-   yuv_to_rgb_soa(builder, n, y, u, v, &r, &g, &b);
-   rgba = rgb_to_rgba_aos(builder, n, r, g, b);
+   uyvy_to_yuv_soa(gallivm, n, packed, i, &y, &u, &v);
+   yuv_to_rgb_soa(gallivm, n, y, u, v, &r, &g, &b);
+   rgba = rgb_to_rgba_aos(gallivm, n, r, g, b);
 
    return rgba;
 }
@@ -339,7 +344,7 @@ uyvy_to_rgba_aos(LLVMBuilderRef builder,
  * Convert from <n x i32> packed YUYV to <4n x i8> RGBA AoS
  */
 static LLVMValueRef
-yuyv_to_rgba_aos(LLVMBuilderRef builder,
+yuyv_to_rgba_aos(struct gallivm_state *gallivm,
                  unsigned n,
                  LLVMValueRef packed,
                  LLVMValueRef i)
@@ -348,9 +353,9 @@ yuyv_to_rgba_aos(LLVMBuilderRef builder,
    LLVMValueRef r, g, b;
    LLVMValueRef rgba;
 
-   yuyv_to_yuv_soa(builder, n, packed, i, &y, &u, &v);
-   yuv_to_rgb_soa(builder, n, y, u, v, &r, &g, &b);
-   rgba = rgb_to_rgba_aos(builder, n, r, g, b);
+   yuyv_to_yuv_soa(gallivm, n, packed, i, &y, &u, &v);
+   yuv_to_rgb_soa(gallivm, n, y, u, v, &r, &g, &b);
+   rgba = rgb_to_rgba_aos(gallivm, n, r, g, b);
 
    return rgba;
 }
@@ -360,7 +365,7 @@ yuyv_to_rgba_aos(LLVMBuilderRef builder,
  * Convert from <n x i32> packed RG_BG to <4n x i8> RGBA AoS
  */
 static LLVMValueRef
-rgbg_to_rgba_aos(LLVMBuilderRef builder,
+rgbg_to_rgba_aos(struct gallivm_state *gallivm,
                  unsigned n,
                  LLVMValueRef packed,
                  LLVMValueRef i)
@@ -368,8 +373,8 @@ rgbg_to_rgba_aos(LLVMBuilderRef builder,
    LLVMValueRef r, g, b;
    LLVMValueRef rgba;
 
-   uyvy_to_yuv_soa(builder, n, packed, i, &g, &r, &b);
-   rgba = rgb_to_rgba_aos(builder, n, r, g, b);
+   uyvy_to_yuv_soa(gallivm, n, packed, i, &g, &r, &b);
+   rgba = rgb_to_rgba_aos(gallivm, n, r, g, b);
 
    return rgba;
 }
@@ -379,7 +384,7 @@ rgbg_to_rgba_aos(LLVMBuilderRef builder,
  * Convert from <n x i32> packed GR_GB to <4n x i8> RGBA AoS
  */
 static LLVMValueRef
-grgb_to_rgba_aos(LLVMBuilderRef builder,
+grgb_to_rgba_aos(struct gallivm_state *gallivm,
                  unsigned n,
                  LLVMValueRef packed,
                  LLVMValueRef i)
@@ -387,8 +392,8 @@ grgb_to_rgba_aos(LLVMBuilderRef builder,
    LLVMValueRef r, g, b;
    LLVMValueRef rgba;
 
-   yuyv_to_yuv_soa(builder, n, packed, i, &g, &r, &b);
-   rgba = rgb_to_rgba_aos(builder, n, r, g, b);
+   yuyv_to_yuv_soa(gallivm, n, packed, i, &g, &r, &b);
+   rgba = rgb_to_rgba_aos(gallivm, n, r, g, b);
 
    return rgba;
 }
@@ -401,7 +406,7 @@ grgb_to_rgba_aos(LLVMBuilderRef builder,
  * @return  a <4*n x i8> vector with the pixel RGBA values in AoS
  */
 LLVMValueRef
-lp_build_fetch_subsampled_rgba_aos(LLVMBuilderRef builder,
+lp_build_fetch_subsampled_rgba_aos(struct gallivm_state *gallivm,
                                    const struct util_format_description *format_desc,
                                    unsigned n,
                                    LLVMValueRef base_ptr,
@@ -417,26 +422,26 @@ lp_build_fetch_subsampled_rgba_aos(LLVMBuilderRef builder,
    assert(format_desc->block.width == 2);
    assert(format_desc->block.height == 1);
 
-   packed = lp_build_gather(builder, n, 32, 32, base_ptr, offset);
+   packed = lp_build_gather(gallivm, n, 32, 32, base_ptr, offset);
 
    (void)j;
 
    switch (format_desc->format) {
    case PIPE_FORMAT_UYVY:
-      rgba = uyvy_to_rgba_aos(builder, n, packed, i);
+      rgba = uyvy_to_rgba_aos(gallivm, n, packed, i);
       break;
    case PIPE_FORMAT_YUYV:
-      rgba = yuyv_to_rgba_aos(builder, n, packed, i);
+      rgba = yuyv_to_rgba_aos(gallivm, n, packed, i);
       break;
    case PIPE_FORMAT_R8G8_B8G8_UNORM:
-      rgba = rgbg_to_rgba_aos(builder, n, packed, i);
+      rgba = rgbg_to_rgba_aos(gallivm, n, packed, i);
       break;
    case PIPE_FORMAT_G8R8_G8B8_UNORM:
-      rgba = grgb_to_rgba_aos(builder, n, packed, i);
+      rgba = grgb_to_rgba_aos(gallivm, n, packed, i);
       break;
    default:
       assert(0);
-      rgba =  LLVMGetUndef(LLVMVectorType(LLVMInt8Type(), 4*n));
+      rgba =  LLVMGetUndef(LLVMVectorType(LLVMInt8TypeInContext(gallivm->context), 4*n));
       break;
    }
 
index d60472e06567385f324a70a73f4d0616f8af7488..0dc81b1abbedcb35077527a9c47ac296374fbd0b 100644 (file)
@@ -31,6 +31,7 @@
 #include "lp_bld_const.h"
 #include "lp_bld_format.h"
 #include "lp_bld_gather.h"
+#include "lp_bld_init.h"
 
 
 /**
@@ -39,7 +40,7 @@
  * @sa lp_build_gather()
  */
 LLVMValueRef
-lp_build_gather_elem_ptr(LLVMBuilderRef builder,
+lp_build_gather_elem_ptr(struct gallivm_state *gallivm,
                          unsigned length,
                          LLVMValueRef base_ptr,
                          LLVMValueRef offsets,
@@ -48,17 +49,17 @@ lp_build_gather_elem_ptr(LLVMBuilderRef builder,
    LLVMValueRef offset;
    LLVMValueRef ptr;
 
-   assert(LLVMTypeOf(base_ptr) == LLVMPointerType(LLVMInt8Type(), 0));
+   assert(LLVMTypeOf(base_ptr) == LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0));
 
    if (length == 1) {
       assert(i == 0);
       offset = offsets;
    } else {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
-      offset = LLVMBuildExtractElement(builder, offsets, index, "");
+      LLVMValueRef index = lp_build_const_int32(gallivm, i);
+      offset = LLVMBuildExtractElement(gallivm->builder, offsets, index, "");
    }
 
-   ptr = LLVMBuildGEP(builder, base_ptr, &offset, 1, "");
+   ptr = LLVMBuildGEP(gallivm->builder, base_ptr, &offset, 1, "");
 
    return ptr;
 }
@@ -70,7 +71,7 @@ lp_build_gather_elem_ptr(LLVMBuilderRef builder,
  * @sa lp_build_gather()
  */
 LLVMValueRef
-lp_build_gather_elem(LLVMBuilderRef builder,
+lp_build_gather_elem(struct gallivm_state *gallivm,
                      unsigned length,
                      unsigned src_width,
                      unsigned dst_width,
@@ -78,23 +79,23 @@ lp_build_gather_elem(LLVMBuilderRef builder,
                      LLVMValueRef offsets,
                      unsigned i)
 {
-   LLVMTypeRef src_type = LLVMIntType(src_width);
+   LLVMTypeRef src_type = LLVMIntTypeInContext(gallivm->context, src_width);
    LLVMTypeRef src_ptr_type = LLVMPointerType(src_type, 0);
-   LLVMTypeRef dst_elem_type = LLVMIntType(dst_width);
+   LLVMTypeRef dst_elem_type = LLVMIntTypeInContext(gallivm->context, dst_width);
    LLVMValueRef ptr;
    LLVMValueRef res;
 
-   assert(LLVMTypeOf(base_ptr) == LLVMPointerType(LLVMInt8Type(), 0));
+   assert(LLVMTypeOf(base_ptr) == LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0));
 
-   ptr = lp_build_gather_elem_ptr(builder, length, base_ptr, offsets, i);
-   ptr = LLVMBuildBitCast(builder, ptr, src_ptr_type, "");
-   res = LLVMBuildLoad(builder, ptr, "");
+   ptr = lp_build_gather_elem_ptr(gallivm, length, base_ptr, offsets, i);
+   ptr = LLVMBuildBitCast(gallivm->builder, ptr, src_ptr_type, "");
+   res = LLVMBuildLoad(gallivm->builder, ptr, "");
 
    assert(src_width <= dst_width);
    if (src_width > dst_width)
-      res = LLVMBuildTrunc(builder, res, dst_elem_type, "");
+      res = LLVMBuildTrunc(gallivm->builder, res, dst_elem_type, "");
    if (src_width < dst_width)
-      res = LLVMBuildZExt(builder, res, dst_elem_type, "");
+      res = LLVMBuildZExt(gallivm->builder, res, dst_elem_type, "");
 
    return res;
 }
@@ -112,7 +113,7 @@ lp_build_gather_elem(LLVMBuilderRef builder,
  * @param offsets vector with offsets
  */
 LLVMValueRef
-lp_build_gather(LLVMBuilderRef builder,
+lp_build_gather(struct gallivm_state *gallivm,
                 unsigned length,
                 unsigned src_width,
                 unsigned dst_width,
@@ -123,24 +124,24 @@ lp_build_gather(LLVMBuilderRef builder,
 
    if (length == 1) {
       /* Scalar */
-      return lp_build_gather_elem(builder, length,
+      return lp_build_gather_elem(gallivm, length,
                                   src_width, dst_width,
                                   base_ptr, offsets, 0);
    } else {
       /* Vector */
 
-      LLVMTypeRef dst_elem_type = LLVMIntType(dst_width);
+      LLVMTypeRef dst_elem_type = LLVMIntTypeInContext(gallivm->context, dst_width);
       LLVMTypeRef dst_vec_type = LLVMVectorType(dst_elem_type, length);
       unsigned i;
 
       res = LLVMGetUndef(dst_vec_type);
       for (i = 0; i < length; ++i) {
-         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+         LLVMValueRef index = lp_build_const_int32(gallivm, i);
          LLVMValueRef elem;
-         elem = lp_build_gather_elem(builder, length,
+         elem = lp_build_gather_elem(gallivm, length,
                                      src_width, dst_width,
                                      base_ptr, offsets, i);
-         res = LLVMBuildInsertElement(builder, res, elem, index, "");
+         res = LLVMBuildInsertElement(gallivm->builder, res, elem, index, "");
       }
    }
 
index 131af8ea07ec1bae4a40616b79f8ad7b74cc3fb1..5b0413173027a68c86b0975cf7ad700cc8257a92 100644 (file)
 
 
 LLVMValueRef
-lp_build_gather_elem_ptr(LLVMBuilderRef builder,
+lp_build_gather_elem_ptr(struct gallivm_state *gallivm,
                          unsigned length,
                          LLVMValueRef base_ptr,
                          LLVMValueRef offsets,
                          unsigned i);
 
 LLVMValueRef
-lp_build_gather_elem(LLVMBuilderRef builder,
+lp_build_gather_elem(struct gallivm_state *gallivm,
                      unsigned length,
                      unsigned src_width,
                      unsigned dst_width,
@@ -50,7 +50,7 @@ lp_build_gather_elem(LLVMBuilderRef builder,
                      unsigned i);
 
 LLVMValueRef
-lp_build_gather(LLVMBuilderRef builder,
+lp_build_gather(struct gallivm_state *gallivm,
                 unsigned length,
                 unsigned src_width,
                 unsigned dst_width,
index 0b9a6f745fb648365991495275f568c8c34c07e7..7504cb5cf2fae17468568d30dc26401ec67809e6 100644 (file)
@@ -29,6 +29,8 @@
 #include "pipe/p_compiler.h"
 #include "util/u_cpu_detect.h"
 #include "util/u_debug.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
 #include "lp_bld_debug.h"
 #include "lp_bld_init.h"
 
@@ -45,6 +47,7 @@ static const struct debug_named_value lp_bld_debug_flags[] = {
    { "nopt",   GALLIVM_DEBUG_NO_OPT, NULL },
    { "perf",   GALLIVM_DEBUG_PERF, NULL },
    { "no_brilinear", GALLIVM_DEBUG_NO_BRILINEAR, NULL },
+   { "gc",     GALLIVM_DEBUG_GC, NULL },
    DEBUG_NAMED_VALUE_END
 };
 
@@ -52,11 +55,7 @@ DEBUG_GET_ONCE_FLAGS_OPTION(gallivm_debug, "GALLIVM_DEBUG", lp_bld_debug_flags,
 #endif
 
 
-LLVMModuleRef lp_build_module = NULL;
-LLVMExecutionEngineRef lp_build_engine = NULL;
-LLVMModuleProviderRef lp_build_provider = NULL;
-LLVMTargetDataRef lp_build_target = NULL;
-LLVMPassManagerRef lp_build_pass = NULL;
+static boolean gallivm_initialized = FALSE;
 
 
 /*
@@ -82,6 +81,19 @@ enum LLVM_CodeGenOpt_Level {
 };
 
 
+/**
+ * LLVM 2.6 permits only one ExecutionEngine to be created.  This is it.
+ */
+static LLVMExecutionEngineRef GlobalEngine = NULL;
+
+/**
+ * Same gallivm state shared by all contexts.
+ */
+static struct gallivm_state *GlobalGallivm = NULL;
+
+
+
+
 extern void
 lp_register_oprofile_jit_event_listener(LLVMExecutionEngineRef EE);
 
@@ -89,26 +101,148 @@ extern void
 lp_set_target_options(void);
 
 
-void
-lp_build_init(void)
+
+/**
+ * Create the LLVM (optimization) pass manager and install
+ * relevant optimization passes.
+ * \return  TRUE for success, FALSE for failure
+ */
+static boolean
+create_pass_manager(struct gallivm_state *gallivm)
 {
-#ifdef DEBUG
-   gallivm_debug = debug_get_option_gallivm_debug();
+   assert(!gallivm->passmgr);
+
+   gallivm->passmgr = LLVMCreateFunctionPassManager(gallivm->provider);
+   if (!gallivm->passmgr)
+      return FALSE;
+
+   LLVMAddTargetData(gallivm->target, gallivm->passmgr);
+
+   if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
+      /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
+       * but there are more on SVN.
+       * TODO: Add more passes.
+       */
+      LLVMAddCFGSimplificationPass(gallivm->passmgr);
+
+      if (HAVE_LLVM >= 0x207 && sizeof(void*) == 4) {
+         /* For LLVM >= 2.7 and 32-bit build, use this order of passes to
+          * avoid generating bad code.
+          * Test with piglit glsl-vs-sqrt-zero test.
+          */
+         LLVMAddConstantPropagationPass(gallivm->passmgr);
+         LLVMAddPromoteMemoryToRegisterPass(gallivm->passmgr);
+      }
+      else {
+         LLVMAddPromoteMemoryToRegisterPass(gallivm->passmgr);
+         LLVMAddConstantPropagationPass(gallivm->passmgr);
+      }
+
+      if (util_cpu_caps.has_sse4_1) {
+         /* FIXME: There is a bug in this pass, whereby the combination
+          * of fptosi and sitofp (necessary for trunc/floor/ceil/round
+          * implementation) somehow becomes invalid code.
+          */
+         LLVMAddInstructionCombiningPass(gallivm->passmgr);
+      }
+      LLVMAddGVNPass(gallivm->passmgr);
+   }
+   else {
+      /* We need at least this pass to prevent the backends to fail in
+       * unexpected ways.
+       */
+      LLVMAddPromoteMemoryToRegisterPass(gallivm->passmgr);
+   }
+
+   return TRUE;
+}
+
+
+/**
+ * Free gallivm object's LLVM allocations, but not the gallivm object itself.
+ */
+static void
+free_gallivm_state(struct gallivm_state *gallivm)
+{
+#if HAVE_LLVM >= 0x207 /* XXX or 0x208? */
+   /* This leads to crashes w/ some versions of LLVM */
+   LLVMModuleRef mod;
+   char *error;
+
+   if (gallivm->engine && gallivm->provider)
+      LLVMRemoveModuleProvider(gallivm->engine, gallivm->provider,
+                               &mod, &error);
 #endif
 
-   lp_set_target_options();
+#if 0
+   /* XXX this seems to crash with all versions of LLVM */
+   if (gallivm->provider)
+      LLVMDisposeModuleProvider(gallivm->provider);
+#endif
 
-   LLVMInitializeNativeTarget();
+   if (gallivm->passmgr)
+      LLVMDisposePassManager(gallivm->passmgr);
 
-   LLVMLinkInJIT();
+#if HAVE_LLVM >= 0x207
+   if (gallivm->module)
+      LLVMDisposeModule(gallivm->module);
+#endif
+
+#if 0
+   /* Don't free the exec engine, it's a global/singleton */
+   if (gallivm->engine)
+      LLVMDisposeExecutionEngine(gallivm->engine);
+#endif
+
+#if 0
+   /* Don't free the TargetData, it's owned by the exec engine */
+   LLVMDisposeTargetData(gallivm->target);
+#endif
+
+   if (gallivm->context)
+      LLVMContextDispose(gallivm->context);
 
-   if (!lp_build_module)
-      lp_build_module = LLVMModuleCreateWithName("gallivm");
+   if (gallivm->builder)
+      LLVMDisposeBuilder(gallivm->builder);
+
+   gallivm->engine = NULL;
+   gallivm->target = NULL;
+   gallivm->module = NULL;
+   gallivm->provider = NULL;
+   gallivm->passmgr = NULL;
+   gallivm->context = NULL;
+   gallivm->builder = NULL;
+}
 
-   if (!lp_build_provider)
-      lp_build_provider = LLVMCreateModuleProviderForExistingModule(lp_build_module);
 
-   if (!lp_build_engine) {
+/**
+ * Allocate gallivm LLVM objects.
+ * \return  TRUE for success, FALSE for failure
+ */
+static boolean
+init_gallivm_state(struct gallivm_state *gallivm)
+{
+   assert(gallivm_initialized);
+   assert(!gallivm->context);
+   assert(!gallivm->module);
+   assert(!gallivm->provider);
+
+   gallivm->context = LLVMContextCreate();
+   if (!gallivm->context)
+      goto fail;
+
+   gallivm->module = LLVMModuleCreateWithNameInContext("gallivm",
+                                                       gallivm->context);
+   if (!gallivm->module)
+      goto fail;
+
+   gallivm->provider =
+      LLVMCreateModuleProviderForExistingModule(gallivm->module);
+   if (!gallivm->provider)
+      goto fail;
+
+   if (!GlobalEngine) {
+      /* We can only create one LLVMExecutionEngine (w/ LLVM 2.6 anyway) */
       enum LLVM_CodeGenOpt_Level optlevel;
       char *error = NULL;
 
@@ -119,43 +253,153 @@ lp_build_init(void)
          optlevel = Default;
       }
 
-      if (LLVMCreateJITCompiler(&lp_build_engine, lp_build_provider,
-                                (unsigned)optlevel, &error)) {
+      if (LLVMCreateJITCompiler(&GlobalEngine, gallivm->provider,
+                                (unsigned) optlevel, &error)) {
          _debug_printf("%s\n", error);
          LLVMDisposeMessage(error);
-         assert(0);
+         goto fail;
       }
 
 #if defined(DEBUG) || defined(PROFILE)
-      lp_register_oprofile_jit_event_listener(lp_build_engine);
+      lp_register_oprofile_jit_event_listener(GlobalEngine);
 #endif
    }
 
-   if (!lp_build_target)
-      lp_build_target = LLVMGetExecutionEngineTargetData(lp_build_engine);
-
-   if (!lp_build_pass) {
-      lp_build_pass = LLVMCreateFunctionPassManager(lp_build_provider);
-      LLVMAddTargetData(lp_build_target, lp_build_pass);
-
-      if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
-         /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-          * but there are more on SVN. */
-         /* TODO: Add more passes */
-         LLVMAddCFGSimplificationPass(lp_build_pass);
-         LLVMAddPromoteMemoryToRegisterPass(lp_build_pass);
-         LLVMAddConstantPropagationPass(lp_build_pass);
-         LLVMAddInstructionCombiningPass(lp_build_pass);
-         LLVMAddGVNPass(lp_build_pass);
-      } else {
-         /* We need at least this pass to prevent the backends to fail in
-          * unexpected ways.
-          */
-         LLVMAddPromoteMemoryToRegisterPass(lp_build_pass);
+   gallivm->engine = GlobalEngine;
+
+   LLVMAddModuleProvider(gallivm->engine, gallivm->provider);//new
+
+   gallivm->target = LLVMGetExecutionEngineTargetData(gallivm->engine);
+   if (!gallivm->target)
+      goto fail;
+
+   if (!create_pass_manager(gallivm))
+      goto fail;
+
+   gallivm->builder = LLVMCreateBuilderInContext(gallivm->context);
+   if (!gallivm->builder)
+      goto fail;
+
+   return TRUE;
+
+fail:
+   free_gallivm_state(gallivm);
+   return FALSE;
+}
+
+
+struct callback
+{
+   garbage_collect_callback_func func;
+   void *cb_data;
+   struct callback *prev, *next;
+};
+
+
+/** list of all garbage collector callbacks */
+static struct callback callback_list = {NULL, NULL, NULL, NULL};
+
+
+/**
+ * Register a function with gallivm which will be called when we
+ * do garbage collection.
+ */
+void
+gallivm_register_garbage_collector_callback(garbage_collect_callback_func func,
+                                            void *cb_data)
+{
+   struct callback *cb;
+
+   if (!callback_list.prev) {
+      make_empty_list(&callback_list);
+   }
+
+   /* see if already in list */
+   foreach(cb, &callback_list) {
+      if (cb->func == func && cb->cb_data == cb_data)
+         return;
+   }
+
+   /* add to list */
+   cb = CALLOC_STRUCT(callback);
+   if (cb) {
+      cb->func = func;
+      cb->cb_data = cb_data;
+      insert_at_head(&callback_list, cb);
+   }
+}
+
+
+/**
+ * Remove a callback.
+ */
+void
+gallivm_remove_garbage_collector_callback(garbage_collect_callback_func func,
+                                          void *cb_data)
+{
+   struct callback *cb;
+
+   /* search list */
+   foreach(cb, &callback_list) {
+      if (cb->func == func && cb->cb_data == cb_data) {
+         /* found, remove it */
+         remove_from_list(cb);
+         return;
       }
    }
+}
+
+
+/**
+ * Call the callback functions (which are typically in the
+ * draw module and llvmpipe driver.
+ */
+static void
+call_garbage_collector_callbacks(void)
+{
+   struct callback *cb;
+   foreach(cb, &callback_list) {
+      cb->func(cb->cb_data);
+   }
+}
+
+
+
+/**
+ * Other gallium components using gallivm should call this periodically
+ * to let us do garbage collection (or at least try to free memory
+ * accumulated by the LLVM libraries).
+ */
+void
+gallivm_garbage_collect(struct gallivm_state *gallivm)
+{
+   if (gallivm->context) {
+      if (gallivm_debug & GALLIVM_DEBUG_GC)
+         debug_printf("***** Doing LLVM garbage collection\n");
+
+      call_garbage_collector_callbacks();
+      free_gallivm_state(gallivm);
+      init_gallivm_state(gallivm);
+   }
+}
+
+
+void
+lp_build_init(void)
+{
+#ifdef DEBUG
+   gallivm_debug = debug_get_option_gallivm_debug();
+#endif
+
+   lp_set_target_options();
+
+   LLVMInitializeNativeTarget();
+
+   LLVMLinkInJIT();
 
    util_cpu_detect();
+   gallivm_initialized = TRUE;
 
 #if 0
    /* For simulating less capable machines */
@@ -166,6 +410,39 @@ lp_build_init(void)
 }
 
 
+
+/**
+ * Create a new gallivm_state object.
+ * Note that we return a singleton.
+ */
+struct gallivm_state *
+gallivm_create(void)
+{
+   if (!GlobalGallivm) {
+      GlobalGallivm = CALLOC_STRUCT(gallivm_state);
+      if (GlobalGallivm) {
+         if (!init_gallivm_state(GlobalGallivm)) {
+            FREE(GlobalGallivm);
+            GlobalGallivm = NULL;
+         }
+      }
+   }
+   return GlobalGallivm;
+}
+
+
+/**
+ * Destroy a gallivm_state object.
+ */
+void
+gallivm_destroy(struct gallivm_state *gallivm)
+{
+   /* No-op: don't destroy the singleton */
+   (void) gallivm;
+}
+
+
+
 /* 
  * Hack to allow the linking of release LLVM static libraries on a debug build.
  *
index 0b4b1ca7d11d1d94f7bc07342cbd27dee8ad5198..f68bf75a8515df54506f97430b8ff914c84bacb1 100644 (file)
 #define LP_BLD_INIT_H
 
 
+#include "pipe/p_compiler.h"
 #include "lp_bld.h"
 #include <llvm-c/ExecutionEngine.h>
 
 
-extern LLVMModuleRef lp_build_module;
-extern LLVMExecutionEngineRef lp_build_engine;
-extern LLVMModuleProviderRef lp_build_provider;
-extern LLVMTargetDataRef lp_build_target;
-extern LLVMPassManagerRef lp_build_pass;
+struct gallivm_state
+{
+   LLVMModuleRef module;
+   LLVMExecutionEngineRef engine;
+   LLVMModuleProviderRef provider;
+   LLVMTargetDataRef target;
+   LLVMPassManagerRef passmgr;
+   LLVMContextRef context;
+   LLVMBuilderRef builder;
+};
 
 
 void
 lp_build_init(void);
 
+
 extern void
 lp_func_delete_body(LLVMValueRef func);
 
 
+void
+gallivm_garbage_collect(struct gallivm_state *gallivm);
+
+
+typedef void (*garbage_collect_callback_func)(void *cb_data);
+
+void
+gallivm_register_garbage_collector_callback(garbage_collect_callback_func func,
+                                            void *cb_data);
+
+void
+gallivm_remove_garbage_collector_callback(garbage_collect_callback_func func,
+                                          void *cb_data);
+
+
+struct gallivm_state *
+gallivm_create(void);
+
+void
+gallivm_destroy(struct gallivm_state *gallivm);
+
+
 extern LLVMValueRef
 lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal,
                        const char *Name);
index 9895749d5686978930db5537b2cf0e7be64b0d38..518a01fdb9f1b7ecec1196ab3e3f7d648d6b1785 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "util/u_debug.h"
 
+#include "lp_bld_const.h"
 #include "lp_bld_intr.h"
 
 
@@ -136,12 +137,13 @@ lp_build_intrinsic_binary(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_intrinsic_map(LLVMBuilderRef builder,
+lp_build_intrinsic_map(struct gallivm_state *gallivm,
                        const char *name,
                        LLVMTypeRef ret_type,
                        LLVMValueRef *args,
                        unsigned num_args)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMTypeRef ret_elem_type = LLVMGetElementType(ret_type);
    unsigned n = LLVMGetVectorSize(ret_type);
    unsigned i, j;
@@ -151,7 +153,7 @@ lp_build_intrinsic_map(LLVMBuilderRef builder,
 
    res = LLVMGetUndef(ret_type);
    for(i = 0; i < n; ++i) {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      LLVMValueRef index = lp_build_const_int32(gallivm, i);
       LLVMValueRef arg_elems[LP_MAX_FUNC_ARGS];
       LLVMValueRef res_elem;
       for(j = 0; j < num_args; ++j)
@@ -165,17 +167,17 @@ lp_build_intrinsic_map(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_intrinsic_map_unary(LLVMBuilderRef builder,
+lp_build_intrinsic_map_unary(struct gallivm_state *gallivm,
                              const char *name,
                              LLVMTypeRef ret_type,
                              LLVMValueRef a)
 {
-   return lp_build_intrinsic_map(builder, name, ret_type, &a, 1);
+   return lp_build_intrinsic_map(gallivm, name, ret_type, &a, 1);
 }
 
 
 LLVMValueRef
-lp_build_intrinsic_map_binary(LLVMBuilderRef builder,
+lp_build_intrinsic_map_binary(struct gallivm_state *gallivm,
                               const char *name,
                               LLVMTypeRef ret_type,
                               LLVMValueRef a,
@@ -186,7 +188,7 @@ lp_build_intrinsic_map_binary(LLVMBuilderRef builder,
    args[0] = a;
    args[1] = b;
 
-   return lp_build_intrinsic_map(builder, name, ret_type, args, 2);
+   return lp_build_intrinsic_map(gallivm, name, ret_type, args, 2);
 }
 
 
index 977f7673228a0ba262cbbfb17c5b6bf0cadaeda8..b73dd700362b0f66a77e7535c82246058dfc6f48 100644 (file)
@@ -38,6 +38,7 @@
 
 
 #include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_init.h"
 
 
 /**
@@ -77,7 +78,7 @@ lp_build_intrinsic_binary(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_intrinsic_map(LLVMBuilderRef builder,
+lp_build_intrinsic_map(struct gallivm_state *gallivm,
                        const char *name,
                        LLVMTypeRef ret_type,
                        LLVMValueRef *args,
@@ -85,14 +86,14 @@ lp_build_intrinsic_map(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_intrinsic_map_unary(LLVMBuilderRef builder,
+lp_build_intrinsic_map_unary(struct gallivm_state *gallivm,
                              const char *name,
                              LLVMTypeRef ret_type,
                              LLVMValueRef a);
 
 
 LLVMValueRef
-lp_build_intrinsic_map_binary(LLVMBuilderRef builder,
+lp_build_intrinsic_map_binary(struct gallivm_state *gallivm,
                               const char *name,
                               LLVMTypeRef ret_type,
                               LLVMValueRef a,
index 026b60ac36ef28b872896c9ab8fc80d1e730990d..f7e6fbaff1a2aaad405167986db40fb0bcd1610a 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
+#include "lp_bld_init.h"
 #include "lp_bld_intr.h"
 #include "lp_bld_debug.h"
 #include "lp_bld_logic.h"
  * The result values will be 0 for false or ~0 for true.
  */
 LLVMValueRef
-lp_build_compare(LLVMBuilderRef builder,
+lp_build_compare(struct gallivm_state *gallivm,
                  const struct lp_type type,
                  unsigned func,
                  LLVMValueRef a,
                  LLVMValueRef b)
 {
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMTypeRef int_vec_type = lp_build_int_vec_type(gallivm, type);
    LLVMValueRef zeros = LLVMConstNull(int_vec_type);
    LLVMValueRef ones = LLVMConstAllOnes(int_vec_type);
    LLVMValueRef cond;
@@ -115,7 +117,7 @@ lp_build_compare(LLVMBuilderRef builder,
    if(type.width * type.length == 128) {
       if(type.floating && util_cpu_caps.has_sse) {
          /* float[4] comparison */
-         LLVMTypeRef vec_type = lp_build_vec_type(type);
+         LLVMTypeRef vec_type = lp_build_vec_type(gallivm, type);
          LLVMValueRef args[3];
          unsigned cc;
          boolean swap;
@@ -144,7 +146,7 @@ lp_build_compare(LLVMBuilderRef builder,
             break;
          default:
             assert(0);
-            return lp_build_undef(type);
+            return lp_build_undef(gallivm, type);
          }
 
          if(swap) {
@@ -156,7 +158,7 @@ lp_build_compare(LLVMBuilderRef builder,
             args[1] = b;
          }
 
-         args[2] = LLVMConstInt(LLVMInt8Type(), cc, 0);
+         args[2] = LLVMConstInt(LLVMInt8TypeInContext(gallivm->context), cc, 0);
          res = lp_build_intrinsic(builder,
                                   "llvm.x86.sse.cmp.ps",
                                   vec_type,
@@ -185,7 +187,7 @@ lp_build_compare(LLVMBuilderRef builder,
          const char *pcmpgt;
          LLVMValueRef args[2];
          LLVMValueRef res;
-         LLVMTypeRef vec_type = lp_build_vec_type(type);
+         LLVMTypeRef vec_type = lp_build_vec_type(gallivm, type);
 
          switch (type.width) {
          case 8:
@@ -202,14 +204,14 @@ lp_build_compare(LLVMBuilderRef builder,
             break;
          default:
             assert(0);
-            return lp_build_undef(type);
+            return lp_build_undef(gallivm, type);
          }
 
          /* There are no unsigned comparison instructions. So flip the sign bit
           * so that the results match.
           */
          if (table[func].gt && !type.sign) {
-            LLVMValueRef msb = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
+            LLVMValueRef msb = lp_build_const_int_vec(gallivm, type, (unsigned long long)1 << (type.width - 1));
             a = LLVMBuildXor(builder, a, msb, "");
             b = LLVMBuildXor(builder, b, msb, "");
          }
@@ -270,7 +272,7 @@ lp_build_compare(LLVMBuilderRef builder,
          break;
       default:
          assert(0);
-         return lp_build_undef(type);
+         return lp_build_undef(gallivm, type);
       }
 
 #if HAVE_LLVM >= 0x0207
@@ -289,7 +291,7 @@ lp_build_compare(LLVMBuilderRef builder,
          debug_printf("%s: warning: using slow element-wise float"
                       " vector comparison\n", __FUNCTION__);
          for (i = 0; i < type.length; ++i) {
-            LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+            LLVMValueRef index = lp_build_const_int32(gallivm, i);
             cond = LLVMBuildFCmp(builder, op,
                                  LLVMBuildExtractElement(builder, a, index, ""),
                                  LLVMBuildExtractElement(builder, b, index, ""),
@@ -326,7 +328,7 @@ lp_build_compare(LLVMBuilderRef builder,
          break;
       default:
          assert(0);
-         return lp_build_undef(type);
+         return lp_build_undef(gallivm, type);
       }
 
 #if HAVE_LLVM >= 0x0207
@@ -348,7 +350,7 @@ lp_build_compare(LLVMBuilderRef builder,
          }
 
          for(i = 0; i < type.length; ++i) {
-            LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+            LLVMValueRef index = lp_build_const_int32(gallivm, i);
             cond = LLVMBuildICmp(builder, op,
                                  LLVMBuildExtractElement(builder, a, index, ""),
                                  LLVMBuildExtractElement(builder, b, index, ""),
@@ -379,7 +381,7 @@ lp_build_cmp(struct lp_build_context *bld,
              LLVMValueRef a,
              LLVMValueRef b)
 {
-   return lp_build_compare(bld->builder, bld->type, func, a, b);
+   return lp_build_compare(bld->gallivm, bld->type, func, a, b);
 }
 
 
@@ -392,6 +394,7 @@ lp_build_select_bitwise(struct lp_build_context *bld,
                         LLVMValueRef a,
                         LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -403,25 +406,25 @@ lp_build_select_bitwise(struct lp_build_context *bld,
    }
 
    if(type.floating) {
-      LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
-      a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
-      b = LLVMBuildBitCast(bld->builder, b, int_vec_type, "");
+      LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
+      a = LLVMBuildBitCast(builder, a, int_vec_type, "");
+      b = LLVMBuildBitCast(builder, b, int_vec_type, "");
    }
 
-   a = LLVMBuildAnd(bld->builder, a, mask, "");
+   a = LLVMBuildAnd(builder, a, mask, "");
 
    /* This often gets translated to PANDN, but sometimes the NOT is
     * pre-computed and stored in another constant. The best strategy depends
     * on available registers, so it is not a big deal -- hopefully LLVM does
     * the right decision attending the rest of the program.
     */
-   b = LLVMBuildAnd(bld->builder, b, LLVMBuildNot(bld->builder, mask, ""), "");
+   b = LLVMBuildAnd(builder, b, LLVMBuildNot(builder, mask, ""), "");
 
-   res = LLVMBuildOr(bld->builder, a, b, "");
+   res = LLVMBuildOr(builder, a, b, "");
 
    if(type.floating) {
-      LLVMTypeRef vec_type = lp_build_vec_type(type);
-      res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
+      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+      res = LLVMBuildBitCast(builder, res, vec_type, "");
    }
 
    return res;
@@ -440,6 +443,8 @@ lp_build_select(struct lp_build_context *bld,
                 LLVMValueRef a,
                 LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMContextRef lc = bld->gallivm->context;
    struct lp_type type = bld->type;
    LLVMValueRef res;
 
@@ -450,8 +455,8 @@ lp_build_select(struct lp_build_context *bld,
       return a;
 
    if (type.length == 1) {
-      mask = LLVMBuildTrunc(bld->builder, mask, LLVMInt1Type(), "");
-      res = LLVMBuildSelect(bld->builder, mask, a, b, "");
+      mask = LLVMBuildTrunc(builder, mask, LLVMInt1TypeInContext(lc), "");
+      res = LLVMBuildSelect(builder, mask, a, b, "");
    }
    else if (util_cpu_caps.has_sse4_1 &&
             type.width * type.length == 128 &&
@@ -465,34 +470,34 @@ lp_build_select(struct lp_build_context *bld,
       if (type.floating &&
           type.width == 64) {
          intrinsic = "llvm.x86.sse41.blendvpd";
-         arg_type = LLVMVectorType(LLVMDoubleType(), 2);
+         arg_type = LLVMVectorType(LLVMDoubleTypeInContext(lc), 2);
       } else if (type.floating &&
                  type.width == 32) {
          intrinsic = "llvm.x86.sse41.blendvps";
-         arg_type = LLVMVectorType(LLVMFloatType(), 4);
+         arg_type = LLVMVectorType(LLVMFloatTypeInContext(lc), 4);
       } else {
          intrinsic = "llvm.x86.sse41.pblendvb";
-         arg_type = LLVMVectorType(LLVMInt8Type(), 16);
+         arg_type = LLVMVectorType(LLVMInt8TypeInContext(lc), 16);
       }
 
       if (arg_type != bld->int_vec_type) {
-         mask = LLVMBuildBitCast(bld->builder, mask, arg_type, "");
+         mask = LLVMBuildBitCast(builder, mask, arg_type, "");
       }
 
       if (arg_type != bld->vec_type) {
-         a = LLVMBuildBitCast(bld->builder, a, arg_type, "");
-         b = LLVMBuildBitCast(bld->builder, b, arg_type, "");
+         a = LLVMBuildBitCast(builder, a, arg_type, "");
+         b = LLVMBuildBitCast(builder, b, arg_type, "");
       }
 
       args[0] = b;
       args[1] = a;
       args[2] = mask;
 
-      res = lp_build_intrinsic(bld->builder, intrinsic,
+      res = lp_build_intrinsic(builder, intrinsic,
                                arg_type, args, Elements(args));
 
       if (arg_type != bld->vec_type) {
-         res = LLVMBuildBitCast(bld->builder, res, bld->vec_type, "");
+         res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
       }
    }
    else {
@@ -514,6 +519,7 @@ lp_build_select_aos(struct lp_build_context *bld,
                     LLVMValueRef a,
                     LLVMValueRef b)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    const unsigned n = type.length;
    unsigned i, j;
@@ -544,7 +550,7 @@ lp_build_select_aos(struct lp_build_context *bld,
       /*
        * Shuffle.
        */
-      LLVMTypeRef elem_type = LLVMInt32Type();
+      LLVMTypeRef elem_type = LLVMInt32TypeInContext(bld->gallivm->context);
       LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
 
       for(j = 0; j < n; j += 4)
@@ -553,7 +559,7 @@ lp_build_select_aos(struct lp_build_context *bld,
                                            (mask & (1 << i) ? 0 : n) + j + i,
                                            0);
 
-      return LLVMBuildShuffleVector(bld->builder, a, b, LLVMConstVector(shuffles, n), "");
+      return LLVMBuildShuffleVector(builder, a, b, LLVMConstVector(shuffles, n), "");
    }
    else {
 #if 0
@@ -567,9 +573,9 @@ lp_build_select_aos(struct lp_build_context *bld,
             cond_vec[j + i] = LLVMConstInt(elem_type,
                                            mask & (1 << i) ? 1 : 0, 0);
 
-      return LLVMBuildSelect(bld->builder, LLVMConstVector(cond_vec, n), a, b, "");
+      return LLVMBuildSelect(builder, LLVMConstVector(cond_vec, n), a, b, "");
 #else
-      LLVMValueRef mask_vec = lp_build_const_mask_aos(type, mask);
+      LLVMValueRef mask_vec = lp_build_const_mask_aos(bld->gallivm, type, mask);
       return lp_build_select(bld, mask_vec, a, b);
 #endif
    }
index 141fb92058a8d8ef6c568122671b656f0d05ef24..ef33a65368242a74d6bf793587ac119900020d30 100644 (file)
@@ -47,7 +47,7 @@ struct lp_build_context;
 
 
 LLVMValueRef
-lp_build_compare(LLVMBuilderRef builder,
+lp_build_compare(struct gallivm_state *gallivm,
                  const struct lp_type type,
                  unsigned func,
                  LLVMValueRef a,
index f56ddee7fd71c57f9b861418ca1db0678b8d8af9..46dd00d822441f29aff35416af598946817985aa 100644 (file)
@@ -144,6 +144,7 @@ lp_set_target_options(void)
    llvm::UnsafeFPMath = true;
 #endif
 
+#if HAVE_LLVM < 0x0209
    /*
     * LLVM will generate MMX instructions for vectors <= 64 bits, leading to
     * innefficient code, and in 32bit systems, to the corruption of the FPU
@@ -162,6 +163,7 @@ lp_set_target_options(void)
       llvm::cl::ParseCommandLineOptions(2, const_cast<char**>(options));
       first = FALSE;
    }
+#endif
 
    /*
     * By default LLVM adds a signal handler to output a pretty stack trace.
index f7eb7148ab8332866c84c2982b8d12cda18c523d..fde6bb594f17d64864cf970256caadafee3576ce 100644 (file)
@@ -72,6 +72,7 @@
 
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
+#include "lp_bld_init.h"
 #include "lp_bld_intr.h"
 #include "lp_bld_arit.h"
 #include "lp_bld_pack.h"
@@ -81,7 +82,8 @@
  * Build shuffle vectors that match PUNPCKLxx and PUNPCKHxx instructions.
  */
 static LLVMValueRef
-lp_build_const_unpack_shuffle(unsigned n, unsigned lo_hi)
+lp_build_const_unpack_shuffle(struct gallivm_state *gallivm,
+                              unsigned n, unsigned lo_hi)
 {
    LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
    unsigned i, j;
@@ -92,8 +94,8 @@ lp_build_const_unpack_shuffle(unsigned n, unsigned lo_hi)
    /* TODO: cache results in a static table */
 
    for(i = 0, j = lo_hi*n/2; i < n; i += 2, ++j) {
-      elems[i + 0] = LLVMConstInt(LLVMInt32Type(), 0 + j, 0);
-      elems[i + 1] = LLVMConstInt(LLVMInt32Type(), n + j, 0);
+      elems[i + 0] = lp_build_const_int32(gallivm, 0 + j);
+      elems[i + 1] = lp_build_const_int32(gallivm, n + j);
    }
 
    return LLVMConstVector(elems, n);
@@ -104,7 +106,7 @@ lp_build_const_unpack_shuffle(unsigned n, unsigned lo_hi)
  * Build shuffle vectors that match PACKxx instructions.
  */
 static LLVMValueRef
-lp_build_const_pack_shuffle(unsigned n)
+lp_build_const_pack_shuffle(struct gallivm_state *gallivm, unsigned n)
 {
    LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
    unsigned i;
@@ -112,7 +114,7 @@ lp_build_const_pack_shuffle(unsigned n)
    assert(n <= LP_MAX_VECTOR_LENGTH);
 
    for(i = 0; i < n; ++i)
-      elems[i] = LLVMConstInt(LLVMInt32Type(), 2*i, 0);
+      elems[i] = lp_build_const_int32(gallivm, 2*i);
 
    return LLVMConstVector(elems, n);
 }
@@ -124,7 +126,7 @@ lp_build_const_pack_shuffle(unsigned n)
  * Matches the PUNPCKLxx and PUNPCKHxx SSE instructions.
  */
 LLVMValueRef
-lp_build_interleave2(LLVMBuilderRef builder,
+lp_build_interleave2(struct gallivm_state *gallivm,
                      struct lp_type type,
                      LLVMValueRef a,
                      LLVMValueRef b,
@@ -132,9 +134,9 @@ lp_build_interleave2(LLVMBuilderRef builder,
 {
    LLVMValueRef shuffle;
 
-   shuffle = lp_build_const_unpack_shuffle(type.length, lo_hi);
+   shuffle = lp_build_const_unpack_shuffle(gallivm, type.length, lo_hi);
 
-   return LLVMBuildShuffleVector(builder, a, b, shuffle, "");
+   return LLVMBuildShuffleVector(gallivm->builder, a, b, shuffle, "");
 }
 
 
@@ -145,13 +147,14 @@ lp_build_interleave2(LLVMBuilderRef builder,
  * values themselves.
  */
 void
-lp_build_unpack2(LLVMBuilderRef builder,
+lp_build_unpack2(struct gallivm_state *gallivm,
                  struct lp_type src_type,
                  struct lp_type dst_type,
                  LLVMValueRef src,
                  LLVMValueRef *dst_lo,
                  LLVMValueRef *dst_hi)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef msb;
    LLVMTypeRef dst_vec_type;
 
@@ -162,24 +165,24 @@ lp_build_unpack2(LLVMBuilderRef builder,
 
    if(dst_type.sign && src_type.sign) {
       /* Replicate the sign bit in the most significant bits */
-      msb = LLVMBuildAShr(builder, src, lp_build_const_int_vec(src_type, src_type.width - 1), "");
+      msb = LLVMBuildAShr(builder, src, lp_build_const_int_vec(gallivm, src_type, src_type.width - 1), "");
    }
    else
       /* Most significant bits always zero */
-      msb = lp_build_zero(src_type);
+      msb = lp_build_zero(gallivm, src_type);
 
    /* Interleave bits */
 #ifdef PIPE_ARCH_LITTLE_ENDIAN
-      *dst_lo = lp_build_interleave2(builder, src_type, src, msb, 0);
-      *dst_hi = lp_build_interleave2(builder, src_type, src, msb, 1);
+   *dst_lo = lp_build_interleave2(gallivm, src_type, src, msb, 0);
+   *dst_hi = lp_build_interleave2(gallivm, src_type, src, msb, 1);
 #else
-      *dst_lo = lp_build_interleave2(builder, src_type, msb, src, 0);
-      *dst_hi = lp_build_interleave2(builder, src_type, msb, src, 1);
+   *dst_lo = lp_build_interleave2(gallivm, src_type, msb, src, 0);
+   *dst_hi = lp_build_interleave2(gallivm, src_type, msb, src, 1);
 #endif
 
    /* Cast the result into the new type (twice as wide) */
 
-   dst_vec_type = lp_build_vec_type(dst_type);
+   dst_vec_type = lp_build_vec_type(gallivm, dst_type);
 
    *dst_lo = LLVMBuildBitCast(builder, *dst_lo, dst_vec_type, "");
    *dst_hi = LLVMBuildBitCast(builder, *dst_hi, dst_vec_type, "");
@@ -193,7 +196,7 @@ lp_build_unpack2(LLVMBuilderRef builder,
  * values themselves.
  */
 void
-lp_build_unpack(LLVMBuilderRef builder,
+lp_build_unpack(struct gallivm_state *gallivm,
                 struct lp_type src_type,
                 struct lp_type dst_type,
                 LLVMValueRef src,
@@ -218,7 +221,7 @@ lp_build_unpack(LLVMBuilderRef builder,
       tmp_type.length /= 2;
 
       for(i = num_tmps; i--; ) {
-         lp_build_unpack2(builder, src_type, tmp_type, dst[i], &dst[2*i + 0], &dst[2*i + 1]);
+         lp_build_unpack2(gallivm, src_type, tmp_type, dst[i], &dst[2*i + 0], &dst[2*i + 1]);
       }
 
       src_type = tmp_type;
@@ -247,16 +250,17 @@ lp_build_unpack(LLVMBuilderRef builder,
  * lp_build_packs2 instead.
  */
 LLVMValueRef
-lp_build_pack2(LLVMBuilderRef builder,
+lp_build_pack2(struct gallivm_state *gallivm,
                struct lp_type src_type,
                struct lp_type dst_type,
                LLVMValueRef lo,
                LLVMValueRef hi)
 {
+   LLVMBuilderRef builder = gallivm->builder;
 #if HAVE_LLVM < 0x0207
-   LLVMTypeRef src_vec_type = lp_build_vec_type(src_type);
+   LLVMTypeRef src_vec_type = lp_build_vec_type(gallivm, src_type);
 #endif
-   LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type);
+   LLVMTypeRef dst_vec_type = lp_build_vec_type(gallivm, dst_type);
    LLVMValueRef shuffle;
    LLVMValueRef res = NULL;
 
@@ -318,7 +322,7 @@ lp_build_pack2(LLVMBuilderRef builder,
    lo = LLVMBuildBitCast(builder, lo, dst_vec_type, "");
    hi = LLVMBuildBitCast(builder, hi, dst_vec_type, "");
 
-   shuffle = lp_build_const_pack_shuffle(dst_type.length);
+   shuffle = lp_build_const_pack_shuffle(gallivm, dst_type.length);
 
    res = LLVMBuildShuffleVector(builder, lo, hi, shuffle, "");
 
@@ -334,7 +338,7 @@ lp_build_pack2(LLVMBuilderRef builder,
  * destination type.
  */
 LLVMValueRef
-lp_build_packs2(LLVMBuilderRef builder,
+lp_build_packs2(struct gallivm_state *gallivm,
                 struct lp_type src_type,
                 struct lp_type dst_type,
                 LLVMValueRef lo,
@@ -360,14 +364,14 @@ lp_build_packs2(LLVMBuilderRef builder,
    if(clamp) {
       struct lp_build_context bld;
       unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width;
-      LLVMValueRef dst_max = lp_build_const_int_vec(src_type, ((unsigned long long)1 << dst_bits) - 1);
-      lp_build_context_init(&bld, builder, src_type);
+      LLVMValueRef dst_max = lp_build_const_int_vec(gallivm, src_type, ((unsigned long long)1 << dst_bits) - 1);
+      lp_build_context_init(&bld, gallivm, src_type);
       lo = lp_build_min(&bld, lo, dst_max);
       hi = lp_build_min(&bld, hi, dst_max);
       /* FIXME: What about lower bound? */
    }
 
-   return lp_build_pack2(builder, src_type, dst_type, lo, hi);
+   return lp_build_pack2(gallivm, src_type, dst_type, lo, hi);
 }
 
 
@@ -377,13 +381,13 @@ lp_build_packs2(LLVMBuilderRef builder,
  * TODO: Handle saturation consistently.
  */
 LLVMValueRef
-lp_build_pack(LLVMBuilderRef builder,
+lp_build_pack(struct gallivm_state *gallivm,
               struct lp_type src_type,
               struct lp_type dst_type,
               boolean clamped,
               const LLVMValueRef *src, unsigned num_srcs)
 {
-   LLVMValueRef (*pack2)(LLVMBuilderRef builder,
+   LLVMValueRef (*pack2)(struct gallivm_state *gallivm,
                          struct lp_type src_type,
                          struct lp_type dst_type,
                          LLVMValueRef lo,
@@ -419,7 +423,8 @@ lp_build_pack(LLVMBuilderRef builder,
       num_srcs /= 2;
 
       for(i = 0; i < num_srcs; ++i)
-         tmp[i] = pack2(builder, src_type, tmp_type, tmp[2*i + 0], tmp[2*i + 1]);
+         tmp[i] = pack2(gallivm, src_type, tmp_type,
+                        tmp[2*i + 0], tmp[2*i + 1]);
 
       src_type = tmp_type;
    }
@@ -437,12 +442,13 @@ lp_build_pack(LLVMBuilderRef builder,
  * intrinsics that do saturation.
  */
 void
-lp_build_resize(LLVMBuilderRef builder,
+lp_build_resize(struct gallivm_state *gallivm,
                 struct lp_type src_type,
                 struct lp_type dst_type,
                 const LLVMValueRef *src, unsigned num_srcs,
                 LLVMValueRef *dst, unsigned num_dsts)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH];
    unsigned i;
 
@@ -482,7 +488,7 @@ lp_build_resize(LLVMBuilderRef builder,
          * Register width remains constant -- use vector packing intrinsics
          */
 
-         tmp[0] = lp_build_pack(builder, src_type, dst_type, TRUE, src, num_srcs);
+         tmp[0] = lp_build_pack(gallivm, src_type, dst_type, TRUE, src, num_srcs);
       }
       else {
          /*
@@ -490,11 +496,11 @@ lp_build_resize(LLVMBuilderRef builder,
           */
 
          assert(src_type.length == dst_type.length);
-         tmp[0] = lp_build_undef(dst_type);
+         tmp[0] = lp_build_undef(gallivm, dst_type);
          for (i = 0; i < dst_type.length; ++i) {
-            LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+            LLVMValueRef index = lp_build_const_int32(gallivm, i);
             LLVMValueRef val = LLVMBuildExtractElement(builder, src[0], index, "");
-            val = LLVMBuildTrunc(builder, val, lp_build_elem_type(dst_type), "");
+            val = LLVMBuildTrunc(builder, val, lp_build_elem_type(gallivm, dst_type), "");
             tmp[0] = LLVMBuildInsertElement(builder, tmp[0], val, index, "");
          }
       }
@@ -510,7 +516,7 @@ lp_build_resize(LLVMBuilderRef builder,
          /*
           * Register width remains constant -- use vector unpack intrinsics
           */
-         lp_build_unpack(builder, src_type, dst_type, src[0], tmp, num_dsts);
+         lp_build_unpack(gallivm, src_type, dst_type, src[0], tmp, num_dsts);
       }
       else {
          /*
@@ -518,15 +524,15 @@ lp_build_resize(LLVMBuilderRef builder,
           */
 
          assert(src_type.length == dst_type.length);
-         tmp[0] = lp_build_undef(dst_type);
+         tmp[0] = lp_build_undef(gallivm, dst_type);
          for (i = 0; i < dst_type.length; ++i) {
-            LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+            LLVMValueRef index = lp_build_const_int32(gallivm, i);
             LLVMValueRef val = LLVMBuildExtractElement(builder, src[0], index, "");
 
             if (src_type.sign && dst_type.sign) {
-               val = LLVMBuildSExt(builder, val, lp_build_elem_type(dst_type), "");
+               val = LLVMBuildSExt(builder, val, lp_build_elem_type(gallivm, dst_type), "");
             } else {
-               val = LLVMBuildZExt(builder, val, lp_build_elem_type(dst_type), "");
+               val = LLVMBuildZExt(builder, val, lp_build_elem_type(gallivm, dst_type), "");
             }
             tmp[0] = LLVMBuildInsertElement(builder, tmp[0], val, index, "");
          }
index e947b90d1642a2e3a880eb6d0c67d4886b701dee..d58da4f01b365f93ac47945dbbe7f7800bfd4baf 100644 (file)
@@ -46,7 +46,7 @@ struct lp_type;
 
 
 LLVMValueRef
-lp_build_interleave2(LLVMBuilderRef builder,
+lp_build_interleave2(struct gallivm_state *gallivm,
                      struct lp_type type,
                      LLVMValueRef a,
                      LLVMValueRef b,
@@ -54,7 +54,7 @@ lp_build_interleave2(LLVMBuilderRef builder,
 
 
 void
-lp_build_unpack2(LLVMBuilderRef builder,
+lp_build_unpack2(struct gallivm_state *gallivm,
                  struct lp_type src_type,
                  struct lp_type dst_type,
                  LLVMValueRef src,
@@ -63,7 +63,7 @@ lp_build_unpack2(LLVMBuilderRef builder,
 
 
 void
-lp_build_unpack(LLVMBuilderRef builder,
+lp_build_unpack(struct gallivm_state *gallivm,
                 struct lp_type src_type,
                 struct lp_type dst_type,
                 LLVMValueRef src,
@@ -71,7 +71,7 @@ lp_build_unpack(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_packs2(LLVMBuilderRef builder,
+lp_build_packs2(struct gallivm_state *gallivm,
                 struct lp_type src_type,
                 struct lp_type dst_type,
                 LLVMValueRef lo,
@@ -79,7 +79,7 @@ lp_build_packs2(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_pack2(LLVMBuilderRef builder,
+lp_build_pack2(struct gallivm_state *gallivm,
                struct lp_type src_type,
                struct lp_type dst_type,
                LLVMValueRef lo,
@@ -87,7 +87,7 @@ lp_build_pack2(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_pack(LLVMBuilderRef builder,
+lp_build_pack(struct gallivm_state *gallivm,
               struct lp_type src_type,
               struct lp_type dst_type,
               boolean clamped,
@@ -95,7 +95,7 @@ lp_build_pack(LLVMBuilderRef builder,
 
 
 void
-lp_build_resize(LLVMBuilderRef builder,
+lp_build_resize(struct gallivm_state *gallivm,
                 struct lp_type src_type,
                 struct lp_type dst_type,
                 const LLVMValueRef *src, unsigned num_srcs,
index f418e96aff4e0b7f169393eeda95c2ad1965f5f7..60cc6094f5a362f72defe1b18e96c6bd92a5d39f 100644 (file)
@@ -31,6 +31,8 @@
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "lp_bld_const.h"
+#include "lp_bld_init.h"
+#include "lp_bld_const.h"
 #include "lp_bld_printf.h"
 
 
@@ -65,12 +67,14 @@ lp_get_printf_arg_count(const char *fmt)
 }
 
 LLVMValueRef 
-lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len)
+lp_build_const_string_variable(LLVMModuleRef module,
+                               LLVMContextRef context,
+                               const char *str, int len)
 {
-   LLVMValueRef string = LLVMAddGlobal(module, LLVMArrayType(LLVMInt8Type(), len + 1), "");
+   LLVMValueRef string = LLVMAddGlobal(module, LLVMArrayType(LLVMInt8TypeInContext(context), len + 1), "");
    LLVMSetGlobalConstant(string, TRUE);
    LLVMSetLinkage(string, LLVMInternalLinkage);
-   LLVMSetInitializer(string, LLVMConstString(str, len + 1, TRUE));
+   LLVMSetInitializer(string, LLVMConstStringInContext(context, str, len + 1, TRUE));
    return string;
 }
  
@@ -83,15 +87,18 @@ lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len)
  * LLVMValueRef.
  */
 LLVMValueRef
-lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...)
+lp_build_printf(struct gallivm_state *gallivm, const char *fmt, ...)
 {
    va_list arglist;
    int i = 0;
    int argcount = lp_get_printf_arg_count(fmt);
-   LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMContextRef context = gallivm->context;
+   LLVMModuleRef module = gallivm->module;
    LLVMValueRef params[50];
-   LLVMValueRef fmtarg = lp_build_const_string_variable(module, fmt, strlen(fmt) + 1);
-   LLVMValueRef int0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   LLVMValueRef fmtarg = lp_build_const_string_variable(module, context,
+                                                        fmt, strlen(fmt) + 1);
+   LLVMValueRef int0 = lp_build_const_int32(gallivm, 0);
    LLVMValueRef index[2];
    LLVMValueRef func_printf = LLVMGetNamedFunction(module, "printf");
 
@@ -100,7 +107,7 @@ lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...)
    index[0] = index[1] = int0;
 
    if (!func_printf) {
-      LLVMTypeRef printf_type = LLVMFunctionType(LLVMIntType(32), NULL, 0, 1);
+      LLVMTypeRef printf_type = LLVMFunctionType(LLVMIntTypeInContext(context, 32), NULL, 0, 1);
       func_printf = LLVMAddFunction(module, "printf", printf_type);
    }
 
@@ -113,7 +120,7 @@ lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...)
       /* printf wants doubles, so lets convert so that
        * we can actually print them */
       if (LLVMGetTypeKind(type) == LLVMFloatTypeKind)
-         val = LLVMBuildFPExt(builder, val, LLVMDoubleType(), "");
+         val = LLVMBuildFPExt(builder, val, LLVMDoubleTypeInContext(context), "");
       params[i] = val;
    }
    va_end(arglist);
@@ -127,16 +134,18 @@ lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...)
  * Print a float[4] vector.
  */
 LLVMValueRef
-lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec)
+lp_build_print_vec4(struct gallivm_state *gallivm,
+                    const char *msg, LLVMValueRef vec)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    char format[1000];
    LLVMValueRef x, y, z, w;
 
-   x = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(0), "");
-   y = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(1), "");
-   z = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(2), "");
-   w = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(3), "");
+   x = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 0), "");
+   y = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 1), "");
+   z = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 2), "");
+   w = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 3), "");
 
    util_snprintf(format, sizeof(format), "%s %%f %%f %%f %%f\n", msg);
-   return lp_build_printf(builder, format, x, y, z, w);
+   return lp_build_printf(gallivm, format, x, y, z, w);
 }
index b6222c62ebede70151018b407c97d66dca0cbf0d..f6bb8348699e9c4231d61df3fc66fe27643c86ed 100644 (file)
 
 #include "pipe/p_compiler.h"
 #include "lp_bld.h"
+#include "lp_bld_init.h"
 
-LLVMValueRef lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len);
-LLVMValueRef lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...);
+
+LLVMValueRef lp_build_const_string_variable(LLVMModuleRef module,
+                                            LLVMContextRef context,
+                                            const char *str, int len);
+
+LLVMValueRef lp_build_printf(struct gallivm_state *gallivm,
+                             const char *fmt, ...);
 
 LLVMValueRef
-lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec);
+lp_build_print_vec4(struct gallivm_state *gallivm,
+                    const char *msg, LLVMValueRef vec);
 
 
 #endif
index c18c8b47100dc52bc8597dec07205b43024796fe..b0a5bc0267ff2a75dac13d95d4de8dfe9d7e2eea 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "lp_bld_type.h"
 #include "lp_bld_arit.h"
+#include "lp_bld_const.h"
 #include "lp_bld_swizzle.h"
 #include "lp_bld_quad.h"
 
@@ -81,15 +82,15 @@ LLVMValueRef
 lp_build_scalar_ddx(struct lp_build_context *bld,
                     LLVMValueRef a)
 {
-   LLVMTypeRef i32t = LLVMInt32Type();
-   LLVMValueRef idx_left  = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_LEFT, 0);
-   LLVMValueRef idx_right = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_RIGHT, 0);
-   LLVMValueRef a_left  = LLVMBuildExtractElement(bld->builder, a, idx_left, "left");
-   LLVMValueRef a_right = LLVMBuildExtractElement(bld->builder, a, idx_right, "right");
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMValueRef idx_left  = lp_build_const_int32(bld->gallivm, LP_BLD_QUAD_TOP_LEFT);
+   LLVMValueRef idx_right = lp_build_const_int32(bld->gallivm, LP_BLD_QUAD_TOP_RIGHT);
+   LLVMValueRef a_left  = LLVMBuildExtractElement(builder, a, idx_left, "left");
+   LLVMValueRef a_right = LLVMBuildExtractElement(builder, a, idx_right, "right");
    if (bld->type.floating)
-      return LLVMBuildFSub(bld->builder, a_right, a_left, "ddx");
+      return LLVMBuildFSub(builder, a_right, a_left, "ddx");
    else
-      return LLVMBuildSub(bld->builder, a_right, a_left, "ddx");
+      return LLVMBuildSub(builder, a_right, a_left, "ddx");
 }
 
 
@@ -97,13 +98,13 @@ LLVMValueRef
 lp_build_scalar_ddy(struct lp_build_context *bld,
                     LLVMValueRef a)
 {
-   LLVMTypeRef i32t = LLVMInt32Type();
-   LLVMValueRef idx_top    = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_LEFT, 0);
-   LLVMValueRef idx_bottom = LLVMConstInt(i32t, LP_BLD_QUAD_BOTTOM_LEFT, 0);
-   LLVMValueRef a_top    = LLVMBuildExtractElement(bld->builder, a, idx_top, "top");
-   LLVMValueRef a_bottom = LLVMBuildExtractElement(bld->builder, a, idx_bottom, "bottom");
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMValueRef idx_top    = lp_build_const_int32(bld->gallivm, LP_BLD_QUAD_TOP_LEFT);
+   LLVMValueRef idx_bottom = lp_build_const_int32(bld->gallivm, LP_BLD_QUAD_BOTTOM_LEFT);
+   LLVMValueRef a_top    = LLVMBuildExtractElement(builder, a, idx_top, "top");
+   LLVMValueRef a_bottom = LLVMBuildExtractElement(builder, a, idx_bottom, "bottom");
    if (bld->type.floating)
-      return LLVMBuildFSub(bld->builder, a_bottom, a_top, "ddy");
+      return LLVMBuildFSub(builder, a_bottom, a_top, "ddy");
    else
-      return LLVMBuildSub(bld->builder, a_bottom, a_top, "ddy");
+      return LLVMBuildSub(builder, a_bottom, a_top, "ddy");
 }
index 844d1d935b59c0a19a8157208b1ad57bebaa5d6e..8ad34598a92d94d25fa6975f051dd57d78c61393 100644 (file)
@@ -134,7 +134,7 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
    state->min_img_filter    = sampler->min_img_filter;
    state->mag_img_filter    = sampler->mag_img_filter;
 
-   if (view->last_level && sampler->max_lod > 0.0f) {
+   if (view->u.tex.last_level && sampler->max_lod > 0.0f) {
       state->min_mip_filter = sampler->min_mip_filter;
    } else {
       state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
@@ -155,7 +155,7 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
             state->apply_min_lod = 1;
          }
 
-         if (sampler->max_lod < (float)view->last_level) {
+         if (sampler->max_lod < (float)view->u.tex.last_level) {
             state->apply_max_lod = 1;
          }
       }
@@ -190,7 +190,8 @@ lp_build_rho(struct lp_build_sample_context *bld,
    struct lp_build_context *float_size_bld = &bld->float_size_bld;
    struct lp_build_context *float_bld = &bld->float_bld;
    const unsigned dims = bld->dims;
-   LLVMTypeRef i32t = LLVMInt32Type();
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMTypeRef i32t = LLVMInt32TypeInContext(bld->gallivm->context);
    LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
    LLVMValueRef index1 = LLVMConstInt(i32t, 1, 0);
    LLVMValueRef index2 = LLVMConstInt(i32t, 2, 0);
@@ -211,21 +212,21 @@ lp_build_rho(struct lp_build_sample_context *bld,
       rho_x = float_size_bld->undef;
       rho_y = float_size_bld->undef;
 
-      rho_x = LLVMBuildInsertElement(bld->builder, rho_x, dsdx, index0, "");
-      rho_y = LLVMBuildInsertElement(bld->builder, rho_y, dsdy, index0, "");
+      rho_x = LLVMBuildInsertElement(builder, rho_x, dsdx, index0, "");
+      rho_y = LLVMBuildInsertElement(builder, rho_y, dsdy, index0, "");
 
       dtdx = ddx[1];
       dtdy = ddy[1];
 
-      rho_x = LLVMBuildInsertElement(bld->builder, rho_x, dtdx, index1, "");
-      rho_y = LLVMBuildInsertElement(bld->builder, rho_y, dtdy, index1, "");
+      rho_x = LLVMBuildInsertElement(builder, rho_x, dtdx, index1, "");
+      rho_y = LLVMBuildInsertElement(builder, rho_y, dtdy, index1, "");
 
       if (dims >= 3) {
          drdx = ddx[2];
          drdy = ddy[2];
 
-         rho_x = LLVMBuildInsertElement(bld->builder, rho_x, drdx, index2, "");
-         rho_y = LLVMBuildInsertElement(bld->builder, rho_y, drdy, index2, "");
+         rho_x = LLVMBuildInsertElement(builder, rho_x, drdx, index2, "");
+         rho_y = LLVMBuildInsertElement(builder, rho_y, drdy, index2, "");
       }
    }
 
@@ -245,13 +246,13 @@ lp_build_rho(struct lp_build_sample_context *bld,
       if (dims >= 2) {
          LLVMValueRef rho_s, rho_t, rho_r;
 
-         rho_s = LLVMBuildExtractElement(bld->builder, rho_vec, index0, "");
-         rho_t = LLVMBuildExtractElement(bld->builder, rho_vec, index1, "");
+         rho_s = LLVMBuildExtractElement(builder, rho_vec, index0, "");
+         rho_t = LLVMBuildExtractElement(builder, rho_vec, index1, "");
 
          rho = lp_build_max(float_bld, rho_s, rho_t);
 
          if (dims >= 3) {
-            rho_r = LLVMBuildExtractElement(bld->builder, rho_vec, index0, "");
+            rho_r = LLVMBuildExtractElement(builder, rho_vec, index0, "");
             rho = lp_build_max(float_bld, rho, rho_r);
          }
       }
@@ -304,19 +305,19 @@ lp_build_brilinear_lod(struct lp_build_context *bld,
    double post_offset = 1 - factor;
 
    if (0) {
-      lp_build_printf(bld->builder, "lod = %f\n", lod);
+      lp_build_printf(bld->gallivm, "lod = %f\n", lod);
    }
 
    lod = lp_build_add(bld, lod,
-                      lp_build_const_vec(bld->type, pre_offset));
+                      lp_build_const_vec(bld->gallivm, bld->type, pre_offset));
 
    lp_build_ifloor_fract(bld, lod, out_lod_ipart, &lod_fpart);
 
    lod_fpart = lp_build_mul(bld, lod_fpart,
-                            lp_build_const_vec(bld->type, factor));
+                            lp_build_const_vec(bld->gallivm, bld->type, factor));
 
    lod_fpart = lp_build_add(bld, lod_fpart,
-                            lp_build_const_vec(bld->type, post_offset));
+                            lp_build_const_vec(bld->gallivm, bld->type, post_offset));
 
    /*
     * It's not necessary to clamp lod_fpart since:
@@ -327,8 +328,8 @@ lp_build_brilinear_lod(struct lp_build_context *bld,
    *out_lod_fpart = lod_fpart;
 
    if (0) {
-      lp_build_printf(bld->builder, "lod_ipart = %i\n", *out_lod_ipart);
-      lp_build_printf(bld->builder, "lod_fpart = %f\n\n", *out_lod_fpart);
+      lp_build_printf(bld->gallivm, "lod_ipart = %i\n", *out_lod_ipart);
+      lp_build_printf(bld->gallivm, "lod_fpart = %f\n\n", *out_lod_fpart);
    }
 }
 
@@ -363,7 +364,7 @@ lp_build_brilinear_rho(struct lp_build_context *bld,
     * part will not need any post adjustments.
     */
    rho = lp_build_mul(bld, rho,
-                      lp_build_const_vec(bld->type, pre_factor));
+                      lp_build_const_vec(bld->gallivm, bld->type, pre_factor));
 
    /* ipart = ifloor(log2(rho)) */
    lod_ipart = lp_build_extract_exponent(bld, rho, 0);
@@ -372,10 +373,10 @@ lp_build_brilinear_rho(struct lp_build_context *bld,
    lod_fpart = lp_build_extract_mantissa(bld, rho);
 
    lod_fpart = lp_build_mul(bld, lod_fpart,
-                            lp_build_const_vec(bld->type, factor));
+                            lp_build_const_vec(bld->gallivm, bld->type, factor));
 
    lod_fpart = lp_build_add(bld, lod_fpart,
-                            lp_build_const_vec(bld->type, post_offset));
+                            lp_build_const_vec(bld->gallivm, bld->type, post_offset));
 
    /*
     * Like lp_build_brilinear_lod, it's not necessary to clamp lod_fpart since:
@@ -413,6 +414,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
                       LLVMValueRef *out_lod_fpart)
 
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    struct lp_build_context *float_bld = &bld->float_bld;
    LLVMValueRef lod;
 
@@ -424,17 +426,17 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
        * This is hit during mipmap generation.
        */
       LLVMValueRef min_lod =
-         bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit);
+         bld->dynamic_state->min_lod(bld->dynamic_state, bld->gallivm, unit);
 
       lod = min_lod;
    }
    else {
       LLVMValueRef sampler_lod_bias =
-         bld->dynamic_state->lod_bias(bld->dynamic_state, bld->builder, unit);
-      LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+         bld->dynamic_state->lod_bias(bld->dynamic_state, bld->gallivm, unit);
+      LLVMValueRef index0 = lp_build_const_int32(bld->gallivm, 0);
 
       if (explicit_lod) {
-         lod = LLVMBuildExtractElement(bld->builder, explicit_lod,
+         lod = LLVMBuildExtractElement(builder, explicit_lod,
                                        index0, "");
       }
       else {
@@ -479,27 +481,27 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
 
          /* add shader lod bias */
          if (lod_bias) {
-            lod_bias = LLVMBuildExtractElement(bld->builder, lod_bias,
+            lod_bias = LLVMBuildExtractElement(builder, lod_bias,
                                                index0, "");
-            lod = LLVMBuildFAdd(bld->builder, lod, lod_bias, "shader_lod_bias");
+            lod = LLVMBuildFAdd(builder, lod, lod_bias, "shader_lod_bias");
          }
       }
 
       /* add sampler lod bias */
       if (bld->static_state->lod_bias_non_zero)
-         lod = LLVMBuildFAdd(bld->builder, lod, sampler_lod_bias, "sampler_lod_bias");
+         lod = LLVMBuildFAdd(builder, lod, sampler_lod_bias, "sampler_lod_bias");
 
 
       /* clamp lod */
       if (bld->static_state->apply_max_lod) {
          LLVMValueRef max_lod =
-            bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit);
+            bld->dynamic_state->max_lod(bld->dynamic_state, bld->gallivm, unit);
 
          lod = lp_build_min(float_bld, lod, max_lod);
       }
       if (bld->static_state->apply_min_lod) {
          LLVMValueRef min_lod =
-            bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit);
+            bld->dynamic_state->min_lod(bld->dynamic_state, bld->gallivm, unit);
 
          lod = lp_build_max(float_bld, lod, min_lod);
       }
@@ -542,10 +544,10 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
    struct lp_build_context *int_bld = &bld->int_bld;
    LLVMValueRef last_level, level;
 
-   LLVMValueRef zero = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   LLVMValueRef zero = lp_build_const_int32(bld->gallivm, 0);
 
    last_level = bld->dynamic_state->last_level(bld->dynamic_state,
-                                               bld->builder, unit);
+                                               bld->gallivm, unit);
 
    /* convert float lod to integer */
    level = lod_ipart;
@@ -568,7 +570,7 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
                            LLVMValueRef *level0_out,
                            LLVMValueRef *level1_out)
 {
-   LLVMBuilderRef builder = bld->builder;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    struct lp_build_context *int_bld = &bld->int_bld;
    struct lp_build_context *float_bld = &bld->float_bld;
    LLVMValueRef last_level;
@@ -579,7 +581,7 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
    *level1_out = lp_build_add(int_bld, lod_ipart, int_bld->one);
 
    last_level = bld->dynamic_state->last_level(bld->dynamic_state,
-                                               bld->builder, unit);
+                                               bld->gallivm, unit);
 
    /*
     * Clamp both lod_ipart and lod_ipart + 1 to [0, last_level], with the
@@ -630,11 +632,13 @@ LLVMValueRef
 lp_build_get_mipmap_level(struct lp_build_sample_context *bld,
                           LLVMValueRef level)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef indexes[2], data_ptr;
-   indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+
+   indexes[0] = lp_build_const_int32(bld->gallivm, 0);
    indexes[1] = level;
-   data_ptr = LLVMBuildGEP(bld->builder, bld->data_array, indexes, 2, "");
-   data_ptr = LLVMBuildLoad(bld->builder, data_ptr, "");
+   data_ptr = LLVMBuildGEP(builder, bld->data_array, indexes, 2, "");
+   data_ptr = LLVMBuildLoad(builder, data_ptr, "");
    return data_ptr;
 }
 
@@ -643,7 +647,7 @@ LLVMValueRef
 lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld,
                                 int level)
 {
-   LLVMValueRef lvl = LLVMConstInt(LLVMInt32Type(), level, 0);
+   LLVMValueRef lvl = lp_build_const_int32(bld->gallivm, level);
    return lp_build_get_mipmap_level(bld, lvl);
 }
 
@@ -657,6 +661,7 @@ lp_build_minify(struct lp_build_context *bld,
                 LLVMValueRef base_size,
                 LLVMValueRef level)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    assert(lp_check_value(bld->type, base_size));
    assert(lp_check_value(bld->type, level));
 
@@ -666,7 +671,7 @@ lp_build_minify(struct lp_build_context *bld,
    }
    else {
       LLVMValueRef size =
-         LLVMBuildLShr(bld->builder, base_size, level, "minify");
+         LLVMBuildLShr(builder, base_size, level, "minify");
       assert(bld->type.sign);
       size = lp_build_max(bld, size, bld->one);
       return size;
@@ -682,11 +687,12 @@ static LLVMValueRef
 lp_build_get_level_stride_vec(struct lp_build_sample_context *bld,
                               LLVMValueRef stride_array, LLVMValueRef level)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef indexes[2], stride;
-   indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   indexes[0] = lp_build_const_int32(bld->gallivm, 0);
    indexes[1] = level;
-   stride = LLVMBuildGEP(bld->builder, stride_array, indexes, 2, "");
-   stride = LLVMBuildLoad(bld->builder, stride, "");
+   stride = LLVMBuildGEP(builder, stride_array, indexes, 2, "");
+   stride = LLVMBuildLoad(builder, stride, "");
    stride = lp_build_broadcast_scalar(&bld->int_coord_bld, stride);
    return stride;
 }
@@ -747,21 +753,21 @@ lp_build_extract_image_sizes(struct lp_build_sample_context *bld,
                              LLVMValueRef *out_depth)
 {
    const unsigned dims = bld->dims;
-   LLVMTypeRef i32t = LLVMInt32Type();
+   LLVMTypeRef i32t = LLVMInt32TypeInContext(bld->gallivm->context);
 
-   *out_width = lp_build_extract_broadcast(bld->builder,
+   *out_width = lp_build_extract_broadcast(bld->gallivm,
                                            size_type,
                                            coord_type,
                                            size,
                                            LLVMConstInt(i32t, 0, 0));
    if (dims >= 2) {
-      *out_height = lp_build_extract_broadcast(bld->builder,
+      *out_height = lp_build_extract_broadcast(bld->gallivm,
                                                size_type,
                                                coord_type,
                                                size,
                                                LLVMConstInt(i32t, 1, 0));
       if (dims == 3) {
-         *out_depth = lp_build_extract_broadcast(bld->builder,
+         *out_depth = lp_build_extract_broadcast(bld->gallivm,
                                                  size_type,
                                                  coord_type,
                                                  size,
@@ -812,7 +818,7 @@ static LLVMValueRef
 lp_build_cube_ima(struct lp_build_context *coord_bld, LLVMValueRef coord)
 {
    /* ima = -0.5 / abs(coord); */
-   LLVMValueRef negHalf = lp_build_const_vec(coord_bld->type, -0.5);
+   LLVMValueRef negHalf = lp_build_const_vec(coord_bld->gallivm, coord_bld->type, -0.5);
    LLVMValueRef absCoord = lp_build_abs(coord_bld, coord);
    LLVMValueRef ima = lp_build_div(coord_bld, negHalf, absCoord);
    return ima;
@@ -831,7 +837,7 @@ lp_build_cube_coord(struct lp_build_context *coord_bld,
                     LLVMValueRef coord, LLVMValueRef ima)
 {
    /* return negate(coord) * ima * sign + 0.5; */
-   LLVMValueRef half = lp_build_const_vec(coord_bld->type, 0.5);
+   LLVMValueRef half = lp_build_const_vec(coord_bld->gallivm, coord_bld->type, 0.5);
    LLVMValueRef res;
 
    assert(negate_coord == +1 || negate_coord == -1);
@@ -859,12 +865,14 @@ lp_build_cube_face(struct lp_build_sample_context *bld,
                    LLVMValueRef major_coord,
                    unsigned pos_face, unsigned neg_face)
 {
-   LLVMValueRef cmp = LLVMBuildFCmp(bld->builder, LLVMRealUGE,
+   struct gallivm_state *gallivm = bld->gallivm;
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMValueRef cmp = LLVMBuildFCmp(builder, LLVMRealUGE,
                                     major_coord,
                                     bld->float_bld.zero, "");
-   LLVMValueRef pos = LLVMConstInt(LLVMInt32Type(), pos_face, 0);
-   LLVMValueRef neg = LLVMConstInt(LLVMInt32Type(), neg_face, 0);
-   LLVMValueRef res = LLVMBuildSelect(bld->builder, cmp, pos, neg, "");
+   LLVMValueRef pos = lp_build_const_int32(gallivm, pos_face);
+   LLVMValueRef neg = lp_build_const_int32(gallivm, neg_face);
+   LLVMValueRef res = LLVMBuildSelect(builder, cmp, pos, neg, "");
    return res;
 }
 
@@ -884,9 +892,10 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
 {
    struct lp_build_context *float_bld = &bld->float_bld;
    struct lp_build_context *coord_bld = &bld->coord_bld;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef rx, ry, rz;
    LLVMValueRef arx, ary, arz;
-   LLVMValueRef c25 = LLVMConstReal(LLVMFloatType(), 0.25);
+   LLVMValueRef c25 = lp_build_const_float(bld->gallivm, 0.25);
    LLVMValueRef arx_ge_ary, arx_ge_arz;
    LLVMValueRef ary_ge_arx, ary_ge_arz;
    LLVMValueRef arx_ge_ary_arz, ary_ge_arx_arz;
@@ -911,17 +920,17 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
    /*
     * Compare sign/magnitude of rx,ry,rz to determine face
     */
-   arx_ge_ary = LLVMBuildFCmp(bld->builder, LLVMRealUGE, arx, ary, "");
-   arx_ge_arz = LLVMBuildFCmp(bld->builder, LLVMRealUGE, arx, arz, "");
-   ary_ge_arx = LLVMBuildFCmp(bld->builder, LLVMRealUGE, ary, arx, "");
-   ary_ge_arz = LLVMBuildFCmp(bld->builder, LLVMRealUGE, ary, arz, "");
+   arx_ge_ary = LLVMBuildFCmp(builder, LLVMRealUGE, arx, ary, "");
+   arx_ge_arz = LLVMBuildFCmp(builder, LLVMRealUGE, arx, arz, "");
+   ary_ge_arx = LLVMBuildFCmp(builder, LLVMRealUGE, ary, arx, "");
+   ary_ge_arz = LLVMBuildFCmp(builder, LLVMRealUGE, ary, arz, "");
 
-   arx_ge_ary_arz = LLVMBuildAnd(bld->builder, arx_ge_ary, arx_ge_arz, "");
-   ary_ge_arx_arz = LLVMBuildAnd(bld->builder, ary_ge_arx, ary_ge_arz, "");
+   arx_ge_ary_arz = LLVMBuildAnd(builder, arx_ge_ary, arx_ge_arz, "");
+   ary_ge_arx_arz = LLVMBuildAnd(builder, ary_ge_arx, ary_ge_arz, "");
 
-   rx_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, rx, float_bld->zero, "");
-   ry_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, ry, float_bld->zero, "");
-   rz_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, rz, float_bld->zero, "");
+   rx_pos = LLVMBuildFCmp(builder, LLVMRealUGE, rx, float_bld->zero, "");
+   ry_pos = LLVMBuildFCmp(builder, LLVMRealUGE, ry, float_bld->zero, "");
+   rz_pos = LLVMBuildFCmp(builder, LLVMRealUGE, rz, float_bld->zero, "");
 
    {
       struct lp_build_if_state if_ctx;
@@ -929,11 +938,11 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
       LLVMValueRef face_t_var;
       LLVMValueRef face_var;
 
-      face_s_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_s_var");
-      face_t_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_t_var");
-      face_var = lp_build_alloca(bld->builder, bld->int_bld.vec_type, "face_var");
+      face_s_var = lp_build_alloca(bld->gallivm, bld->coord_bld.vec_type, "face_s_var");
+      face_t_var = lp_build_alloca(bld->gallivm, bld->coord_bld.vec_type, "face_t_var");
+      face_var = lp_build_alloca(bld->gallivm, bld->int_bld.vec_type, "face_var");
 
-      lp_build_if(&if_ctx, bld->builder, arx_ge_ary_arz);
+      lp_build_if(&if_ctx, bld->gallivm, arx_ge_ary_arz);
       {
          /* +/- X face */
          LLVMValueRef sign = lp_build_sgn(float_bld, rx);
@@ -943,17 +952,17 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
          *face = lp_build_cube_face(bld, rx,
                                     PIPE_TEX_FACE_POS_X,
                                     PIPE_TEX_FACE_NEG_X);
-         LLVMBuildStore(bld->builder, *face_s, face_s_var);
-         LLVMBuildStore(bld->builder, *face_t, face_t_var);
-         LLVMBuildStore(bld->builder, *face, face_var);
+         LLVMBuildStore(builder, *face_s, face_s_var);
+         LLVMBuildStore(builder, *face_t, face_t_var);
+         LLVMBuildStore(builder, *face, face_var);
       }
       lp_build_else(&if_ctx);
       {
          struct lp_build_if_state if_ctx2;
 
-         ary_ge_arx_arz = LLVMBuildAnd(bld->builder, ary_ge_arx, ary_ge_arz, "");
+         ary_ge_arx_arz = LLVMBuildAnd(builder, ary_ge_arx, ary_ge_arz, "");
 
-         lp_build_if(&if_ctx2, bld->builder, ary_ge_arx_arz);
+         lp_build_if(&if_ctx2, bld->gallivm, ary_ge_arx_arz);
          {
             /* +/- Y face */
             LLVMValueRef sign = lp_build_sgn(float_bld, ry);
@@ -963,9 +972,9 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
             *face = lp_build_cube_face(bld, ry,
                                        PIPE_TEX_FACE_POS_Y,
                                        PIPE_TEX_FACE_NEG_Y);
-            LLVMBuildStore(bld->builder, *face_s, face_s_var);
-            LLVMBuildStore(bld->builder, *face_t, face_t_var);
-            LLVMBuildStore(bld->builder, *face, face_var);
+            LLVMBuildStore(builder, *face_s, face_s_var);
+            LLVMBuildStore(builder, *face_t, face_t_var);
+            LLVMBuildStore(builder, *face, face_var);
          }
          lp_build_else(&if_ctx2);
          {
@@ -977,18 +986,18 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
             *face = lp_build_cube_face(bld, rz,
                                        PIPE_TEX_FACE_POS_Z,
                                        PIPE_TEX_FACE_NEG_Z);
-            LLVMBuildStore(bld->builder, *face_s, face_s_var);
-            LLVMBuildStore(bld->builder, *face_t, face_t_var);
-            LLVMBuildStore(bld->builder, *face, face_var);
+            LLVMBuildStore(builder, *face_s, face_s_var);
+            LLVMBuildStore(builder, *face_t, face_t_var);
+            LLVMBuildStore(builder, *face, face_var);
          }
          lp_build_endif(&if_ctx2);
       }
 
       lp_build_endif(&if_ctx);
 
-      *face_s = LLVMBuildLoad(bld->builder, face_s_var, "face_s");
-      *face_t = LLVMBuildLoad(bld->builder, face_t_var, "face_t");
-      *face   = LLVMBuildLoad(bld->builder, face_var, "face");
+      *face_s = LLVMBuildLoad(builder, face_s_var, "face_s");
+      *face_t = LLVMBuildLoad(builder, face_t_var, "face_t");
+      *face   = LLVMBuildLoad(builder, face_var, "face");
    }
 }
 
@@ -1011,6 +1020,7 @@ lp_build_sample_partial_offset(struct lp_build_context *bld,
                                LLVMValueRef *out_offset,
                                LLVMValueRef *out_subcoord)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef offset;
    LLVMValueRef subcoord;
 
@@ -1028,14 +1038,14 @@ lp_build_sample_partial_offset(struct lp_build_context *bld,
        */
 #if 0
       LLVMValueRef block_width = lp_build_const_int_vec(bld->type, block_length);
-      subcoord = LLVMBuildURem(bld->builder, coord, block_width, "");
-      coord    = LLVMBuildUDiv(bld->builder, coord, block_width, "");
+      subcoord = LLVMBuildURem(builder, coord, block_width, "");
+      coord    = LLVMBuildUDiv(builder, coord, block_width, "");
 #else
       unsigned logbase2 = util_unsigned_logbase2(block_length);
-      LLVMValueRef block_shift = lp_build_const_int_vec(bld->type, logbase2);
-      LLVMValueRef block_mask = lp_build_const_int_vec(bld->type, block_length - 1);
-      subcoord = LLVMBuildAnd(bld->builder, coord, block_mask, "");
-      coord = LLVMBuildLShr(bld->builder, coord, block_shift, "");
+      LLVMValueRef block_shift = lp_build_const_int_vec(bld->gallivm, bld->type, logbase2);
+      LLVMValueRef block_mask = lp_build_const_int_vec(bld->gallivm, bld->type, block_length - 1);
+      subcoord = LLVMBuildAnd(builder, coord, block_mask, "");
+      coord = LLVMBuildLShr(builder, coord, block_shift, "");
 #endif
    }
 
@@ -1071,7 +1081,8 @@ lp_build_sample_offset(struct lp_build_context *bld,
    LLVMValueRef x_stride;
    LLVMValueRef offset;
 
-   x_stride = lp_build_const_vec(bld->type, format_desc->block.bits/8);
+   x_stride = lp_build_const_vec(bld->gallivm, bld->type,
+                                 format_desc->block.bits/8);
 
    lp_build_sample_partial_offset(bld,
                                   format_desc->block.width,
index ffed27cee8302ee0b4902c434709fe102320e8b8..8c9d5df4e43aa9281002977747378a0bfe487f05 100644 (file)
@@ -105,64 +105,64 @@ struct lp_sampler_dynamic_state
    /** Obtain the base texture width (returns int32) */
    LLVMValueRef
    (*width)( const struct lp_sampler_dynamic_state *state,
-             LLVMBuilderRef builder,
+             struct gallivm_state *gallivm,
              unsigned unit);
 
    /** Obtain the base texture height (returns int32) */
    LLVMValueRef
    (*height)( const struct lp_sampler_dynamic_state *state,
-              LLVMBuilderRef builder,
+              struct gallivm_state *gallivm,
               unsigned unit);
 
    /** Obtain the base texture depth (returns int32) */
    LLVMValueRef
    (*depth)( const struct lp_sampler_dynamic_state *state,
-             LLVMBuilderRef builder,
+             struct gallivm_state *gallivm,
              unsigned unit);
 
    /** Obtain the number of mipmap levels minus one (returns int32) */
    LLVMValueRef
    (*last_level)( const struct lp_sampler_dynamic_state *state,
-                  LLVMBuilderRef builder,
+                  struct gallivm_state *gallivm,
                   unsigned unit);
 
    /** Obtain stride in bytes between image rows/blocks (returns int32) */
    LLVMValueRef
    (*row_stride)( const struct lp_sampler_dynamic_state *state,
-                  LLVMBuilderRef builder,
+                  struct gallivm_state *gallivm,
                   unsigned unit);
 
    /** Obtain stride in bytes between image slices (returns int32) */
    LLVMValueRef
    (*img_stride)( const struct lp_sampler_dynamic_state *state,
-                  LLVMBuilderRef builder,
+                  struct gallivm_state *gallivm,
                   unsigned unit);
 
    /** Obtain pointer to array of pointers to mimpap levels */
    LLVMValueRef
    (*data_ptr)( const struct lp_sampler_dynamic_state *state,
-                LLVMBuilderRef builder,
+                struct gallivm_state *gallivm,
                 unsigned unit);
 
    /** Obtain texture min lod (returns float) */
    LLVMValueRef
    (*min_lod)(const struct lp_sampler_dynamic_state *state,
-              LLVMBuilderRef builder, unsigned unit);
+              struct gallivm_state *gallivm, unsigned unit);
 
    /** Obtain texture max lod (returns float) */
    LLVMValueRef
    (*max_lod)(const struct lp_sampler_dynamic_state *state,
-              LLVMBuilderRef builder, unsigned unit);
+              struct gallivm_state *gallivm, unsigned unit);
 
    /** Obtain texture lod bias (returns float) */
    LLVMValueRef
    (*lod_bias)(const struct lp_sampler_dynamic_state *state,
-               LLVMBuilderRef builder, unsigned unit);
+               struct gallivm_state *gallivm, unsigned unit);
 
    /** Obtain texture border color (returns ptr to float[4]) */
    LLVMValueRef
    (*border_color)(const struct lp_sampler_dynamic_state *state,
-                   LLVMBuilderRef builder, unsigned unit);
+                   struct gallivm_state *gallivm, unsigned unit);
 };
 
 
@@ -171,7 +171,7 @@ struct lp_sampler_dynamic_state
  */
 struct lp_build_sample_context
 {
-   LLVMBuilderRef builder;
+   struct gallivm_state *gallivm;
 
    const struct lp_sampler_static_state *static_state;
 
@@ -385,7 +385,7 @@ lp_build_sample_offset(struct lp_build_context *bld,
 
 
 void
-lp_build_sample_soa(LLVMBuilderRef builder,
+lp_build_sample_soa(struct gallivm_state *gallivm,
                     const struct lp_sampler_static_state *static_state,
                     struct lp_sampler_dynamic_state *dynamic_state,
                     struct lp_type fp_type,
@@ -399,7 +399,7 @@ lp_build_sample_soa(LLVMBuilderRef builder,
                     LLVMValueRef texel_out[4]);
 
 void
-lp_build_sample_nop(struct lp_type type,
+lp_build_sample_nop(struct gallivm_state *gallivm, struct lp_type type,
                     LLVMValueRef texel_out[4]);
 
 
index d6831a580b3c8c6cc17e55bcfc19e3ebbb3fbebd..e61cf9541ea9cb50fd8c28f1939606c912ab3296 100644 (file)
@@ -52,6 +52,7 @@
 #include "lp_bld_flow.h"
 #include "lp_bld_gather.h"
 #include "lp_bld_format.h"
+#include "lp_bld_init.h"
 #include "lp_bld_sample.h"
 #include "lp_bld_sample_aos.h"
 #include "lp_bld_quad.h"
@@ -82,6 +83,7 @@ lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld,
                                  LLVMValueRef *out_i)
 {
    struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef length_minus_one;
 
    length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one);
@@ -89,12 +91,12 @@ lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld,
    switch(wrap_mode) {
    case PIPE_TEX_WRAP_REPEAT:
       if(is_pot)
-         coord = LLVMBuildAnd(bld->builder, coord, length_minus_one, "");
+         coord = LLVMBuildAnd(builder, coord, length_minus_one, "");
       else {
          /* Add a bias to the texcoord to handle negative coords */
          LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
-         coord = LLVMBuildAdd(bld->builder, coord, bias, "");
-         coord = LLVMBuildURem(bld->builder, coord, length, "");
+         coord = LLVMBuildAdd(builder, coord, bias, "");
+         coord = LLVMBuildURem(builder, coord, length, "");
       }
       break;
 
@@ -147,6 +149,7 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld,
                                 LLVMValueRef *i1)
 {
    struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef length_minus_one;
    LLVMValueRef lmask, umask, mask;
 
@@ -195,39 +198,39 @@ lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld,
    switch(wrap_mode) {
    case PIPE_TEX_WRAP_REPEAT:
       if (is_pot) {
-         coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, "");
+         coord0 = LLVMBuildAnd(builder, coord0, length_minus_one, "");
       }
       else {
          /* Add a bias to the texcoord to handle negative coords */
          LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
-         coord0 = LLVMBuildAdd(bld->builder, coord0, bias, "");
-         coord0 = LLVMBuildURem(bld->builder, coord0, length, "");
+         coord0 = LLVMBuildAdd(builder, coord0, bias, "");
+         coord0 = LLVMBuildURem(builder, coord0, length, "");
       }
 
-      mask = lp_build_compare(bld->builder, int_coord_bld->type,
+      mask = lp_build_compare(bld->gallivm, int_coord_bld->type,
                               PIPE_FUNC_NOTEQUAL, coord0, length_minus_one);
 
       *offset0 = lp_build_mul(int_coord_bld, coord0, stride);
-      *offset1 = LLVMBuildAnd(bld->builder,
+      *offset1 = LLVMBuildAnd(builder,
                               lp_build_add(int_coord_bld, *offset0, stride),
                               mask, "");
       break;
 
    case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
-      lmask = lp_build_compare(int_coord_bld->builder, int_coord_bld->type,
+      lmask = lp_build_compare(int_coord_bld->gallivm, int_coord_bld->type,
                                PIPE_FUNC_GEQUAL, coord0, int_coord_bld->zero);
-      umask = lp_build_compare(int_coord_bld->builder, int_coord_bld->type,
+      umask = lp_build_compare(int_coord_bld->gallivm, int_coord_bld->type,
                                PIPE_FUNC_LESS, coord0, length_minus_one);
 
       coord0 = lp_build_select(int_coord_bld, lmask, coord0, int_coord_bld->zero);
       coord0 = lp_build_select(int_coord_bld, umask, coord0, length_minus_one);
 
-      mask = LLVMBuildAnd(bld->builder, lmask, umask, "");
+      mask = LLVMBuildAnd(builder, lmask, umask, "");
 
       *offset0 = lp_build_mul(int_coord_bld, coord0, stride);
       *offset1 = lp_build_add(int_coord_bld,
                               *offset0,
-                              LLVMBuildAnd(bld->builder, stride, mask, ""));
+                              LLVMBuildAnd(builder, stride, mask, ""));
       break;
 
    case PIPE_TEX_WRAP_CLAMP:
@@ -263,7 +266,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
                               LLVMValueRef *colors_hi)
 {
    const unsigned dims = bld->dims;
-   LLVMBuilderRef builder = bld->builder;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    struct lp_build_context i32, h16, u8n;
    LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type;
    LLVMValueRef i32_c8;
@@ -273,13 +276,13 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
    LLVMValueRef x_offset, offset;
    LLVMValueRef x_subcoord, y_subcoord, z_subcoord;
 
-   lp_build_context_init(&i32, builder, lp_type_int_vec(32));
-   lp_build_context_init(&h16, builder, lp_type_ufixed(16));
-   lp_build_context_init(&u8n, builder, lp_type_unorm(8));
+   lp_build_context_init(&i32, bld->gallivm, lp_type_int_vec(32));
+   lp_build_context_init(&h16, bld->gallivm, lp_type_ufixed(16));
+   lp_build_context_init(&u8n, bld->gallivm, lp_type_unorm(8));
 
-   i32_vec_type = lp_build_vec_type(i32.type);
-   h16_vec_type = lp_build_vec_type(h16.type);
-   u8n_vec_type = lp_build_vec_type(u8n.type);
+   i32_vec_type = lp_build_vec_type(bld->gallivm, i32.type);
+   h16_vec_type = lp_build_vec_type(bld->gallivm, h16.type);
+   u8n_vec_type = lp_build_vec_type(bld->gallivm, u8n.type);
 
    lp_build_extract_image_sizes(bld,
                                 bld->int_size_type,
@@ -317,7 +320,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
       r = LLVMBuildFPToSI(builder, r, i32_vec_type, "");
 
    /* compute floor (shift right 8) */
-   i32_c8 = lp_build_const_int_vec(i32.type, 8);
+   i32_c8 = lp_build_const_int_vec(bld->gallivm, i32.type, 8);
    s_ipart = LLVMBuildAShr(builder, s, i32_c8, "");
    if (dims >= 2)
       t_ipart = LLVMBuildAShr(builder, t, i32_c8, "");
@@ -325,7 +328,8 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
       r_ipart = LLVMBuildAShr(builder, r, i32_c8, "");
 
    /* get pixel, row, image strides */
-   x_stride = lp_build_const_vec(bld->int_coord_bld.type,
+   x_stride = lp_build_const_vec(bld->gallivm,
+                                 bld->int_coord_bld.type,
                                  bld->format_desc->block.bits/8);
 
    /* Do texcoord wrapping, compute texel offset */
@@ -387,7 +391,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
           * Given the format is a rgba8, just read the pixels as is,
           * without any swizzling. Swizzling will be done later.
           */
-         rgba8 = lp_build_gather(bld->builder,
+         rgba8 = lp_build_gather(bld->gallivm,
                                  bld->texel_type.length,
                                  bld->format_desc->block.bits,
                                  bld->texel_type.width,
@@ -396,7 +400,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
          rgba8 = LLVMBuildBitCast(builder, rgba8, u8n_vec_type, "");
       }
       else {
-         rgba8 = lp_build_fetch_rgba_aos(bld->builder,
+         rgba8 = lp_build_fetch_rgba_aos(bld->gallivm,
                                          bld->format_desc,
                                          u8n.type,
                                          data_ptr, offset,
@@ -405,7 +409,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
       }
 
       /* Expand one 4*rgba8 to two 2*rgba16 */
-      lp_build_unpack2(builder, u8n.type, h16.type,
+      lp_build_unpack2(bld->gallivm, u8n.type, h16.type,
                        rgba8,
                        colors_lo, colors_hi);
    }
@@ -429,7 +433,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
                              LLVMValueRef *colors_hi)
 {
    const unsigned dims = bld->dims;
-   LLVMBuilderRef builder = bld->builder;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    struct lp_build_context i32, h16, u8n;
    LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type;
    LLVMValueRef i32_c8, i32_c128, i32_c255;
@@ -450,13 +454,13 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
    unsigned i, j, k;
    unsigned numj, numk;
 
-   lp_build_context_init(&i32, builder, lp_type_int_vec(32));
-   lp_build_context_init(&h16, builder, lp_type_ufixed(16));
-   lp_build_context_init(&u8n, builder, lp_type_unorm(8));
+   lp_build_context_init(&i32, bld->gallivm, lp_type_int_vec(32));
+   lp_build_context_init(&h16, bld->gallivm, lp_type_ufixed(16));
+   lp_build_context_init(&u8n, bld->gallivm, lp_type_unorm(8));
 
-   i32_vec_type = lp_build_vec_type(i32.type);
-   h16_vec_type = lp_build_vec_type(h16.type);
-   u8n_vec_type = lp_build_vec_type(u8n.type);
+   i32_vec_type = lp_build_vec_type(bld->gallivm, i32.type);
+   h16_vec_type = lp_build_vec_type(bld->gallivm, h16.type);
+   u8n_vec_type = lp_build_vec_type(bld->gallivm, u8n.type);
 
    lp_build_extract_image_sizes(bld,
                                 bld->int_size_type,
@@ -494,7 +498,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
       r = LLVMBuildFPToSI(builder, r, i32_vec_type, "");
 
    /* subtract 0.5 (add -128) */
-   i32_c128 = lp_build_const_int_vec(i32.type, -128);
+   i32_c128 = lp_build_const_int_vec(bld->gallivm, i32.type, -128);
    s = LLVMBuildAdd(builder, s, i32_c128, "");
    if (dims >= 2) {
       t = LLVMBuildAdd(builder, t, i32_c128, "");
@@ -504,7 +508,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
    }
 
    /* compute floor (shift right 8) */
-   i32_c8 = lp_build_const_int_vec(i32.type, 8);
+   i32_c8 = lp_build_const_int_vec(bld->gallivm, i32.type, 8);
    s_ipart = LLVMBuildAShr(builder, s, i32_c8, "");
    if (dims >= 2)
       t_ipart = LLVMBuildAShr(builder, t, i32_c8, "");
@@ -512,7 +516,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
       r_ipart = LLVMBuildAShr(builder, r, i32_c8, "");
 
    /* compute fractional part (AND with 0xff) */
-   i32_c255 = lp_build_const_int_vec(i32.type, 255);
+   i32_c255 = lp_build_const_int_vec(bld->gallivm, i32.type, 255);
    s_fpart = LLVMBuildAnd(builder, s, i32_c255, "");
    if (dims >= 2)
       t_fpart = LLVMBuildAnd(builder, t, i32_c255, "");
@@ -520,7 +524,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
       r_fpart = LLVMBuildAnd(builder, r, i32_c255, "");
 
    /* get pixel, row and image strides */
-   x_stride = lp_build_const_vec(bld->int_coord_bld.type,
+   x_stride = lp_build_const_vec(bld->gallivm, bld->int_coord_bld.type,
                                  bld->format_desc->block.bits/8);
    y_stride = row_stride_vec;
    z_stride = img_stride_vec;
@@ -612,7 +616,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
       r_fpart = LLVMBuildBitCast(builder, r_fpart, h16_vec_type, "");
 
    {
-      LLVMTypeRef elem_type = LLVMInt32Type();
+      LLVMTypeRef elem_type = LLVMInt32TypeInContext(bld->gallivm->context);
       LLVMValueRef shuffles_lo[LP_MAX_VECTOR_LENGTH];
       LLVMValueRef shuffles_hi[LP_MAX_VECTOR_LENGTH];
       LLVMValueRef shuffle_lo;
@@ -685,7 +689,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
                 * Given the format is a rgba8, just read the pixels as is,
                 * without any swizzling. Swizzling will be done later.
                 */
-               rgba8 = lp_build_gather(bld->builder,
+               rgba8 = lp_build_gather(bld->gallivm,
                                        bld->texel_type.length,
                                        bld->format_desc->block.bits,
                                        bld->texel_type.width,
@@ -694,7 +698,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
                rgba8 = LLVMBuildBitCast(builder, rgba8, u8n_vec_type, "");
             }
             else {
-               rgba8 = lp_build_fetch_rgba_aos(bld->builder,
+               rgba8 = lp_build_fetch_rgba_aos(bld->gallivm,
                                                bld->format_desc,
                                                u8n.type,
                                                data_ptr, offset[k][j][i],
@@ -703,7 +707,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
             }
 
             /* Expand one 4*rgba8 to two 2*rgba16 */
-            lp_build_unpack2(builder, u8n.type, h16.type,
+            lp_build_unpack2(bld->gallivm, u8n.type, h16.type,
                              rgba8,
                              &neighbors_lo[k][j][i], &neighbors_hi[k][j][i]);
          }
@@ -790,7 +794,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
                        LLVMValueRef colors_lo_var,
                        LLVMValueRef colors_hi_var)
 {
-   LLVMBuilderRef builder = bld->builder;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef size0;
    LLVMValueRef size1;
    LLVMValueRef row_stride0_vec;
@@ -802,7 +806,6 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
    LLVMValueRef colors0_lo, colors0_hi;
    LLVMValueRef colors1_lo, colors1_hi;
 
-
    /* sample the first mipmap level */
    lp_build_mipmap_level_sizes(bld, ilevel0,
                                &size0,
@@ -829,8 +832,8 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
    LLVMBuildStore(builder, colors0_hi, colors_hi_var);
 
    if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
-      LLVMValueRef h16_scale = LLVMConstReal(LLVMFloatType(), 256.0);
-      LLVMTypeRef i32_type = LLVMIntType(32);
+      LLVMValueRef h16_scale = lp_build_const_float(bld->gallivm, 256.0);
+      LLVMTypeRef i32_type = LLVMIntTypeInContext(bld->gallivm->context, 32);
       struct lp_build_if_state if_ctx;
       LLVMValueRef need_lerp;
 
@@ -842,11 +845,11 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
                                 lod_fpart, LLVMConstNull(i32_type),
                                 "need_lerp");
 
-      lp_build_if(&if_ctx, builder, need_lerp);
+      lp_build_if(&if_ctx, bld->gallivm, need_lerp);
       {
          struct lp_build_context h16_bld;
 
-         lp_build_context_init(&h16_bld, builder, lp_type_ufixed(16));
+         lp_build_context_init(&h16_bld, bld->gallivm, lp_type_ufixed(16));
 
          /* sample the second mipmap level */
          lp_build_mipmap_level_sizes(bld, ilevel1,
@@ -885,7 +888,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
             int i;
             assert(h16_bld.type.length <= Elements(shuffles));
             for (i = 0; i < h16_bld.type.length; i++)
-               shuffles[i] = lp_build_const_int32(2 * (i & 1));
+               shuffles[i] = lp_build_const_int32(bld->gallivm, 2 * (i & 1));
             shuffle = LLVMConstVector(shuffles, h16_bld.type.length);
             lod_fpart = LLVMBuildShuffleVector(builder,
                                                lod_fpart, lod_fpart,
@@ -925,7 +928,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
                     LLVMValueRef texel_out[4])
 {
    struct lp_build_context *int_bld = &bld->int_bld;
-   LLVMBuilderRef builder = bld->builder;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const unsigned mip_filter = bld->static_state->min_mip_filter;
    const unsigned min_filter = bld->static_state->min_img_filter;
    const unsigned mag_filter = bld->static_state->mag_img_filter;
@@ -936,8 +939,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
    LLVMValueRef unswizzled[4];
    LLVMValueRef face_ddx[4], face_ddy[4];
    struct lp_build_context h16_bld;
-   LLVMTypeRef i32t = LLVMInt32Type();
-   LLVMValueRef i32t_zero = LLVMConstInt(i32t, 0, 0);
+   LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
 
    /* we only support the common/simple wrap modes at this time */
    assert(lp_is_simple_wrap_mode(bld->static_state->wrap_s));
@@ -948,7 +950,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
 
 
    /* make 16-bit fixed-pt builder context */
-   lp_build_context_init(&h16_bld, builder, lp_type_ufixed(16));
+   lp_build_context_init(&h16_bld, bld->gallivm, lp_type_ufixed(16));
 
    /* cube face selection, compute pre-face coords, etc. */
    if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
@@ -1026,8 +1028,8 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
     * Get/interpolate texture colors.
     */
 
-   packed_lo = lp_build_alloca(builder, h16_bld.vec_type, "packed_lo");
-   packed_hi = lp_build_alloca(builder, h16_bld.vec_type, "packed_hi");
+   packed_lo = lp_build_alloca(bld->gallivm, h16_bld.vec_type, "packed_lo");
+   packed_hi = lp_build_alloca(bld->gallivm, h16_bld.vec_type, "packed_hi");
 
    if (min_filter == mag_filter) {
       /* no need to distinquish between minification and magnification */
@@ -1048,7 +1050,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
       minify = LLVMBuildICmp(builder, LLVMIntSGE,
                              lod_ipart, int_bld->zero, "");
 
-      lp_build_if(&if_ctx, builder, minify);
+      lp_build_if(&if_ctx, bld->gallivm, minify);
       {
          /* Use the minification filter */
          lp_build_sample_mipmap(bld,
@@ -1073,7 +1075,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
     * combine the values stored in 'packed_lo' and 'packed_hi' variables
     * into 'packed'
     */
-   packed = lp_build_pack2(builder,
+   packed = lp_build_pack2(bld->gallivm,
                            h16_bld.type, lp_type_unorm(8),
                            LLVMBuildLoad(builder, packed_lo, ""),
                            LLVMBuildLoad(builder, packed_hi, ""));
@@ -1081,7 +1083,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
    /*
     * Convert to SoA and swizzle.
     */
-   lp_build_rgba8_to_f32_soa(builder,
+   lp_build_rgba8_to_f32_soa(bld->gallivm,
                              bld->texel_type,
                              packed, unswizzled);
 
@@ -1096,6 +1098,4 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
       texel_out[2] = unswizzled[2];
       texel_out[3] = unswizzled[3];
    }
-
-   apply_sampler_swizzle(bld, texel_out);
 }
index 53cc0c5f34541c7c897a7e4509247ef1283fff72..e685f4b73f0ce7775ea42233ed2a2d4cce717990 100644 (file)
@@ -84,6 +84,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
    const struct lp_sampler_static_state *static_state = bld->static_state;
    const unsigned dims = bld->dims;
    struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef offset;
    LLVMValueRef i, j;
    LLVMValueRef use_border = NULL;
@@ -95,7 +96,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
       LLVMValueRef b1, b2;
       b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, x, int_coord_bld->zero);
       b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, x, width);
-      use_border = LLVMBuildOr(bld->builder, b1, b2, "b1_or_b2");
+      use_border = LLVMBuildOr(builder, b1, b2, "b1_or_b2");
    }
 
    if (dims >= 2 &&
@@ -106,11 +107,11 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
       b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, y, int_coord_bld->zero);
       b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, y, height);
       if (use_border) {
-         use_border = LLVMBuildOr(bld->builder, use_border, b1, "ub_or_b1");
-         use_border = LLVMBuildOr(bld->builder, use_border, b2, "ub_or_b2");
+         use_border = LLVMBuildOr(builder, use_border, b1, "ub_or_b1");
+         use_border = LLVMBuildOr(builder, use_border, b2, "ub_or_b2");
       }
       else {
-         use_border = LLVMBuildOr(bld->builder, b1, b2, "b1_or_b2");
+         use_border = LLVMBuildOr(builder, b1, b2, "b1_or_b2");
       }
    }
 
@@ -122,11 +123,11 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
       b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, z, int_coord_bld->zero);
       b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, z, depth);
       if (use_border) {
-         use_border = LLVMBuildOr(bld->builder, use_border, b1, "ub_or_b1");
-         use_border = LLVMBuildOr(bld->builder, use_border, b2, "ub_or_b2");
+         use_border = LLVMBuildOr(builder, use_border, b1, "ub_or_b1");
+         use_border = LLVMBuildOr(builder, use_border, b2, "ub_or_b2");
       }
       else {
-         use_border = LLVMBuildOr(bld->builder, b1, b2, "b1_or_b2");
+         use_border = LLVMBuildOr(builder, b1, b2, "b1_or_b2");
       }
    }
 
@@ -148,7 +149,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
       offset = lp_build_andnot(&bld->int_coord_bld, offset, use_border);
    }
 
-   lp_build_fetch_rgba_soa(bld->builder,
+   lp_build_fetch_rgba_soa(bld->gallivm,
                            bld->format_desc,
                            bld->texel_type,
                            data_ptr, offset,
@@ -174,20 +175,18 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
       /* select texel color or border color depending on use_border */
       LLVMValueRef border_color_ptr = 
          bld->dynamic_state->border_color(bld->dynamic_state,
-                                          bld->builder, unit);
+                                          bld->gallivm, unit);
       int chan;
       for (chan = 0; chan < 4; chan++) {
          LLVMValueRef border_chan =
-            lp_build_array_get(bld->builder, border_color_ptr,
-                               lp_build_const_int32(chan));
+            lp_build_array_get(bld->gallivm, border_color_ptr,
+                               lp_build_const_int32(bld->gallivm, chan));
          LLVMValueRef border_chan_vec =
             lp_build_broadcast_scalar(&bld->float_vec_bld, border_chan);
          texel_out[chan] = lp_build_select(&bld->texel_bld, use_border,
                                            border_chan_vec, texel_out[chan]);
       }
    }
-
-   apply_sampler_swizzle(bld, texel_out);
 }
 
 
@@ -205,7 +204,7 @@ lp_build_coord_mirror(struct lp_build_sample_context *bld,
    lp_build_ifloor_fract(coord_bld, coord, &flr, &fract);
 
    /* isOdd = flr & 1 */
-   isOdd = LLVMBuildAnd(bld->builder, flr, int_coord_bld->one, "");
+   isOdd = LLVMBuildAnd(bld->gallivm->builder, flr, int_coord_bld->one, "");
 
    /* make coord positive or negative depending on isOdd */
    coord = lp_build_set_sign(coord_bld, fract, isOdd);
@@ -239,7 +238,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
 {
    struct lp_build_context *coord_bld = &bld->coord_bld;
    struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
-   LLVMValueRef half = lp_build_const_vec(coord_bld->type, 0.5);
+   LLVMBuilderRef builder = bld->gallivm->builder;
+   LLVMValueRef half = lp_build_const_vec(bld->gallivm, coord_bld->type, 0.5);
    LLVMValueRef length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one);
    LLVMValueRef coord0, coord1, weight;
 
@@ -253,18 +253,18 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
       /* repeat wrap */
       if (is_pot) {
          coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
-         coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, "");
-         coord1 = LLVMBuildAnd(bld->builder, coord1, length_minus_one, "");
+         coord0 = LLVMBuildAnd(builder, coord0, length_minus_one, "");
+         coord1 = LLVMBuildAnd(builder, coord1, length_minus_one, "");
       }
       else {
          /* Add a bias to the texcoord to handle negative coords */
          LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
          LLVMValueRef mask;
-         coord0 = LLVMBuildAdd(bld->builder, coord0, bias, "");
-         coord0 = LLVMBuildURem(bld->builder, coord0, length, "");
-         mask = lp_build_compare(bld->builder, int_coord_bld->type,
+         coord0 = LLVMBuildAdd(builder, coord0, bias, "");
+         coord0 = LLVMBuildURem(builder, coord0, length, "");
+         mask = lp_build_compare(bld->gallivm, int_coord_bld->type,
                                  PIPE_FUNC_NOTEQUAL, coord0, length_minus_one);
-         coord1 = LLVMBuildAnd(bld->builder,
+         coord1 = LLVMBuildAnd(builder,
                               lp_build_add(int_coord_bld, coord0, int_coord_bld->one),
                               mask, "");
       }
@@ -318,7 +318,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
          }
          /* was: clamp to [-0.5, length + 0.5], then sub 0.5 */
          coord = lp_build_sub(coord_bld, coord, half);
-         min = lp_build_const_vec(coord_bld->type, -1.0F);
+         min = lp_build_const_vec(bld->gallivm, coord_bld->type, -1.0F);
          coord = lp_build_clamp(coord_bld, coord, min, length_f);
          /* convert to int, compute lerp weight */
          lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight);
@@ -437,6 +437,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
 {
    struct lp_build_context *coord_bld = &bld->coord_bld;
    struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one);
    LLVMValueRef icoord;
    
@@ -445,12 +446,12 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
       coord = lp_build_mul(coord_bld, coord, length_f);
       icoord = lp_build_ifloor(coord_bld, coord);
       if (is_pot)
-         icoord = LLVMBuildAnd(bld->builder, icoord, length_minus_one, "");
+         icoord = LLVMBuildAnd(builder, icoord, length_minus_one, "");
       else {
          /* Add a bias to the texcoord to handle negative coords */
          LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
-         icoord = LLVMBuildAdd(bld->builder, icoord, bias, "");
-         icoord = LLVMBuildURem(bld->builder, icoord, length, "");
+         icoord = LLVMBuildAdd(builder, icoord, bias, "");
+         icoord = LLVMBuildURem(builder, icoord, length, "");
       }
       break;
 
@@ -830,7 +831,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
                        LLVMValueRef lod_fpart,
                        LLVMValueRef *colors_out)
 {
-   LLVMBuilderRef builder = bld->builder;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef size0;
    LLVMValueRef size1;
    LLVMValueRef row_stride0_vec;
@@ -878,7 +879,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
                                 bld->float_bld.zero,
                                 "need_lerp");
 
-      lp_build_if(&if_ctx, builder, need_lerp);
+      lp_build_if(&if_ctx, bld->gallivm, need_lerp);
       {
          /* sample the second mipmap level */
          lp_build_mipmap_level_sizes(bld, ilevel1,
@@ -934,7 +935,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
                         LLVMValueRef *colors_out)
 {
    struct lp_build_context *int_bld = &bld->int_bld;
-   LLVMBuilderRef builder = bld->builder;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const unsigned mip_filter = bld->static_state->min_mip_filter;
    const unsigned min_filter = bld->static_state->min_img_filter;
    const unsigned mag_filter = bld->static_state->mag_img_filter;
@@ -942,8 +943,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
    LLVMValueRef ilevel0, ilevel1 = NULL;
    LLVMValueRef face_ddx[4], face_ddy[4];
    LLVMValueRef texels[4];
-   LLVMTypeRef i32t = LLVMInt32Type();
-   LLVMValueRef i32t_zero = LLVMConstInt(i32t, 0, 0);
+   LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
    unsigned chan;
 
    /*
@@ -1030,7 +1030,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
     */
 
    for (chan = 0; chan < 4; ++chan) {
-     texels[chan] = lp_build_alloca(builder, bld->texel_bld.vec_type, "");
+     texels[chan] = lp_build_alloca(bld->gallivm, bld->texel_bld.vec_type, "");
      lp_build_name(texels[chan], "sampler%u_texel_%c_var", unit, "xyzw"[chan]);
    }
 
@@ -1053,7 +1053,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
       minify = LLVMBuildICmp(builder, LLVMIntSGE,
                              lod_ipart, int_bld->zero, "");
 
-      lp_build_if(&if_ctx, builder, minify);
+      lp_build_if(&if_ctx, bld->gallivm, minify);
       {
          /* Use the minification filter */
          lp_build_sample_mipmap(bld, unit,
@@ -1092,6 +1092,7 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
                         LLVMValueRef texel[4])
 {
    struct lp_build_context *texel_bld = &bld->texel_bld;
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef res;
    const unsigned chan = 0;
 
@@ -1100,11 +1101,10 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
 
    /* debug code */
    if (0) {
-      LLVMValueRef indx = lp_build_const_int32(0);
-      LLVMValueRef coord = LLVMBuildExtractElement(bld->builder, p, indx, "");
-      LLVMValueRef tex = LLVMBuildExtractElement(bld->builder,
-                                                 texel[chan], indx, "");
-      lp_build_printf(bld->builder, "shadow compare coord %f to texture %f\n",
+      LLVMValueRef indx = lp_build_const_int32(bld->gallivm, 0);
+      LLVMValueRef coord = LLVMBuildExtractElement(builder, p, indx, "");
+      LLVMValueRef tex = LLVMBuildExtractElement(builder, texel[chan], indx, "");
+      lp_build_printf(bld->gallivm, "shadow compare coord %f to texture %f\n",
                       coord, tex);
    }
 
@@ -1126,10 +1126,10 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
  * For debugging.
  */
 void
-lp_build_sample_nop(struct lp_type type,
+lp_build_sample_nop(struct gallivm_state *gallivm, struct lp_type type,
                     LLVMValueRef texel_out[4])
 {
-   LLVMValueRef one = lp_build_one(type);
+   LLVMValueRef one = lp_build_one(gallivm, type);
    unsigned chan;
 
    for (chan = 0; chan < 4; chan++) {
@@ -1147,7 +1147,7 @@ lp_build_sample_nop(struct lp_type type,
  * \param ddy  partial derivatives of (s,t,r,q) with respect to y
  */
 void
-lp_build_sample_soa(LLVMBuilderRef builder,
+lp_build_sample_soa(struct gallivm_state *gallivm,
                     const struct lp_sampler_static_state *static_state,
                     struct lp_sampler_dynamic_state *dynamic_state,
                     struct lp_type type,
@@ -1162,8 +1162,8 @@ lp_build_sample_soa(LLVMBuilderRef builder,
 {
    unsigned dims = texture_dims(static_state->target);
    struct lp_build_sample_context bld;
-   LLVMTypeRef i32t = LLVMInt32Type();
-
+   LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef s;
    LLVMValueRef t;
    LLVMValueRef r;
@@ -1178,7 +1178,7 @@ lp_build_sample_soa(LLVMBuilderRef builder,
 
    /* Setup our build context */
    memset(&bld, 0, sizeof bld);
-   bld.builder = builder;
+   bld.gallivm = gallivm;
    bld.static_state = static_state;
    bld.dynamic_state = dynamic_state;
    bld.format_desc = util_format_description(static_state->format);
@@ -1195,22 +1195,22 @@ lp_build_sample_soa(LLVMBuilderRef builder,
 
    float_vec_type = lp_type_float_vec(32);
 
-   lp_build_context_init(&bld.float_bld, builder, bld.float_type);
-   lp_build_context_init(&bld.float_vec_bld, builder, float_vec_type);
-   lp_build_context_init(&bld.int_bld, builder, bld.int_type);
-   lp_build_context_init(&bld.coord_bld, builder, bld.coord_type);
-   lp_build_context_init(&bld.int_coord_bld, builder, bld.int_coord_type);
-   lp_build_context_init(&bld.int_size_bld, builder, bld.int_size_type);
-   lp_build_context_init(&bld.float_size_bld, builder, bld.float_size_type);
-   lp_build_context_init(&bld.texel_bld, builder, bld.texel_type);
+   lp_build_context_init(&bld.float_bld, gallivm, bld.float_type);
+   lp_build_context_init(&bld.float_vec_bld, gallivm, float_vec_type);
+   lp_build_context_init(&bld.int_bld, gallivm, bld.int_type);
+   lp_build_context_init(&bld.coord_bld, gallivm, bld.coord_type);
+   lp_build_context_init(&bld.int_coord_bld, gallivm, bld.int_coord_type);
+   lp_build_context_init(&bld.int_size_bld, gallivm, bld.int_size_type);
+   lp_build_context_init(&bld.float_size_bld, gallivm, bld.float_size_type);
+   lp_build_context_init(&bld.texel_bld, gallivm, bld.texel_type);
 
    /* Get the dynamic state */
-   bld.width = dynamic_state->width(dynamic_state, builder, unit);
-   bld.height = dynamic_state->height(dynamic_state, builder, unit);
-   bld.depth = dynamic_state->depth(dynamic_state, builder, unit);
-   bld.row_stride_array = dynamic_state->row_stride(dynamic_state, builder, unit);
-   bld.img_stride_array = dynamic_state->img_stride(dynamic_state, builder, unit);
-   bld.data_array = dynamic_state->data_ptr(dynamic_state, builder, unit);
+   bld.width = dynamic_state->width(dynamic_state, gallivm, unit);
+   bld.height = dynamic_state->height(dynamic_state, gallivm, unit);
+   bld.depth = dynamic_state->depth(dynamic_state, gallivm, unit);
+   bld.row_stride_array = dynamic_state->row_stride(dynamic_state, gallivm, unit);
+   bld.img_stride_array = dynamic_state->img_stride(dynamic_state, gallivm, unit);
+   bld.data_array = dynamic_state->data_ptr(dynamic_state, gallivm, unit);
    /* Note that data_array is an array[level] of pointers to texture images */
 
    s = coords[0];
@@ -1236,7 +1236,7 @@ lp_build_sample_soa(LLVMBuilderRef builder,
 
    if (0) {
       /* For debug: no-op texture sampling */
-      lp_build_sample_nop(bld.texel_type, texel_out);
+      lp_build_sample_nop(gallivm, bld.texel_type, texel_out);
    }
    else if (util_format_fits_8unorm(bld.format_desc) &&
             lp_is_simple_wrap_mode(static_state->wrap_s) &&
@@ -1266,4 +1266,6 @@ lp_build_sample_soa(LLVMBuilderRef builder,
    }
 
    lp_build_sample_compare(&bld, r, texel_out);
+
+   apply_sampler_swizzle(&bld, texel_out);
 }
index 4693c2de6f9c0bb0f604b995683c5ea3f7562a31..0dc2f24d10a2eb0695ede785e6a77de495f21450 100644 (file)
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 
+#include "lp_bld_const.h"
 #include "lp_bld_debug.h"
 #include "lp_bld_struct.h"
 
 
 LLVMValueRef
-lp_build_struct_get_ptr(LLVMBuilderRef builder,
+lp_build_struct_get_ptr(struct gallivm_state *gallivm,
                         LLVMValueRef ptr,
                         unsigned member,
                         const char *name)
@@ -51,16 +52,16 @@ lp_build_struct_get_ptr(LLVMBuilderRef builder,
    LLVMValueRef member_ptr;
    assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
    assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMStructTypeKind);
-   indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   indices[1] = LLVMConstInt(LLVMInt32Type(), member, 0);
-   member_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
+   indices[0] = lp_build_const_int32(gallivm, 0);
+   indices[1] = lp_build_const_int32(gallivm, member);
+   member_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, Elements(indices), "");
    lp_build_name(member_ptr, "%s.%s_ptr", LLVMGetValueName(ptr), name);
    return member_ptr;
 }
 
 
 LLVMValueRef
-lp_build_struct_get(LLVMBuilderRef builder,
+lp_build_struct_get(struct gallivm_state *gallivm,
                     LLVMValueRef ptr,
                     unsigned member,
                     const char *name)
@@ -69,15 +70,15 @@ lp_build_struct_get(LLVMBuilderRef builder,
    LLVMValueRef res;
    assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
    assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMStructTypeKind);
-   member_ptr = lp_build_struct_get_ptr(builder, ptr, member, name);
-   res = LLVMBuildLoad(builder, member_ptr, "");
+   member_ptr = lp_build_struct_get_ptr(gallivm, ptr, member, name);
+   res = LLVMBuildLoad(gallivm->builder, member_ptr, "");
    lp_build_name(res, "%s.%s", LLVMGetValueName(ptr), name);
    return res;
 }
 
 
 LLVMValueRef
-lp_build_array_get_ptr(LLVMBuilderRef builder,
+lp_build_array_get_ptr(struct gallivm_state *gallivm,
                        LLVMValueRef ptr,
                        LLVMValueRef index)
 {
@@ -85,9 +86,9 @@ lp_build_array_get_ptr(LLVMBuilderRef builder,
    LLVMValueRef element_ptr;
    assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
    assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind);
-   indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   indices[0] = lp_build_const_int32(gallivm, 0);
    indices[1] = index;
-   element_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
+   element_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, Elements(indices), "");
 #ifdef DEBUG
    lp_build_name(element_ptr, "&%s[%s]",
                  LLVMGetValueName(ptr), LLVMGetValueName(index));
@@ -97,7 +98,7 @@ lp_build_array_get_ptr(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_array_get(LLVMBuilderRef builder,
+lp_build_array_get(struct gallivm_state *gallivm,
                    LLVMValueRef ptr,
                    LLVMValueRef index)
 {
@@ -105,8 +106,8 @@ lp_build_array_get(LLVMBuilderRef builder,
    LLVMValueRef res;
    assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
    assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind);
-   element_ptr = lp_build_array_get_ptr(builder, ptr, index);
-   res = LLVMBuildLoad(builder, element_ptr, "");
+   element_ptr = lp_build_array_get_ptr(gallivm, ptr, index);
+   res = LLVMBuildLoad(gallivm->builder, element_ptr, "");
 #ifdef DEBUG
    lp_build_name(res, "%s[%s]", LLVMGetValueName(ptr), LLVMGetValueName(index));
 #endif
@@ -115,7 +116,7 @@ lp_build_array_get(LLVMBuilderRef builder,
 
 
 void
-lp_build_array_set(LLVMBuilderRef builder,
+lp_build_array_set(struct gallivm_state *gallivm,
                    LLVMValueRef ptr,
                    LLVMValueRef index,
                    LLVMValueRef value)
@@ -123,8 +124,8 @@ lp_build_array_set(LLVMBuilderRef builder,
    LLVMValueRef element_ptr;
    assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
    assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind);
-   element_ptr = lp_build_array_get_ptr(builder, ptr, index);
-   LLVMBuildStore(builder, value, element_ptr);
+   element_ptr = lp_build_array_get_ptr(gallivm, ptr, index);
+   LLVMBuildStore(gallivm->builder, value, element_ptr);
 }
 
 
index eb87a8eee9ee40a24fbf74d1c2f695be4f669eeb..11605c685f09d5b50b5a77879014ee72dc2f837f 100644 (file)
@@ -38,7 +38,7 @@
 
 
 #include "gallivm/lp_bld.h"
-#include <llvm-c/Target.h>
+#include "gallivm/lp_bld_init.h"
 
 #include "util/u_debug.h"
 #include "util/u_memory.h"
@@ -57,7 +57,7 @@
  * Get value pointer to a structure member.
  */
 LLVMValueRef
-lp_build_struct_get_ptr(LLVMBuilderRef builder,
+lp_build_struct_get_ptr(struct gallivm_state *gallivm,
                         LLVMValueRef ptr,
                         unsigned member,
                         const char *name);
@@ -66,7 +66,7 @@ lp_build_struct_get_ptr(LLVMBuilderRef builder,
  * Get the value of a structure member.
  */
 LLVMValueRef
-lp_build_struct_get(LLVMBuilderRef builder,
+lp_build_struct_get(struct gallivm_state *gallivm,
                     LLVMValueRef ptr,
                     unsigned member,
                     const char *name);
@@ -75,7 +75,7 @@ lp_build_struct_get(LLVMBuilderRef builder,
  * Get value pointer to an array element.
  */
 LLVMValueRef
-lp_build_array_get_ptr(LLVMBuilderRef builder,
+lp_build_array_get_ptr(struct gallivm_state *gallivm,
                        LLVMValueRef ptr,
                        LLVMValueRef index);
 
@@ -83,7 +83,7 @@ lp_build_array_get_ptr(LLVMBuilderRef builder,
  * Get the value of an array element.
  */
 LLVMValueRef
-lp_build_array_get(LLVMBuilderRef builder,
+lp_build_array_get(struct gallivm_state *gallivm,
                    LLVMValueRef ptr,
                    LLVMValueRef index);
 
@@ -91,7 +91,7 @@ lp_build_array_get(LLVMBuilderRef builder,
  * Set the value of an array element.
  */
 void
-lp_build_array_set(LLVMBuilderRef builder,
+lp_build_array_set(struct gallivm_state *gallivm,
                    LLVMValueRef ptr,
                    LLVMValueRef index,
                    LLVMValueRef value);
index 4685a90e41818a0e7be2f8caa3554a175f8099ef..71693603c12a9c873448e8d1c1ef34efc15a94a3 100644 (file)
 
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
+#include "lp_bld_init.h"
 #include "lp_bld_logic.h"
 #include "lp_bld_swizzle.h"
 
 
 LLVMValueRef
-lp_build_broadcast(LLVMBuilderRef builder,
+lp_build_broadcast(struct gallivm_state *gallivm,
                    LLVMTypeRef vec_type,
                    LLVMValueRef scalar)
 {
@@ -52,8 +53,8 @@ lp_build_broadcast(LLVMBuilderRef builder,
 
    res = LLVMGetUndef(vec_type);
    for(i = 0; i < n; ++i) {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
-      res = LLVMBuildInsertElement(builder, res, scalar, index, "");
+      LLVMValueRef index = lp_build_const_int32(gallivm, i);
+      res = LLVMBuildInsertElement(gallivm->builder, res, scalar, index, "");
    }
 
    return res;
@@ -67,6 +68,7 @@ LLVMValueRef
 lp_build_broadcast_scalar(struct lp_build_context *bld,
                           LLVMValueRef scalar)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
 
    assert(lp_check_elem_type(type, LLVMTypeOf(scalar)));
@@ -82,17 +84,17 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
       struct lp_type i32_vec_type = lp_type_int_vec(32);
       i32_vec_type.length = type.length;
 
-      res = LLVMBuildInsertElement(bld->builder, bld->undef, scalar,
-                                   LLVMConstInt(LLVMInt32Type(), 0, 0), "");
-      res = LLVMBuildShuffleVector(bld->builder, res, bld->undef,
-                                   lp_build_const_int_vec(i32_vec_type, 0), "");
+      res = LLVMBuildInsertElement(builder, bld->undef, scalar,
+                                   lp_build_const_int32(bld->gallivm, 0), "");
+      res = LLVMBuildShuffleVector(builder, res, bld->undef,
+                                   lp_build_const_int_vec(bld->gallivm, i32_vec_type, 0), "");
 #else
       /* XXX: The above path provokes a bug in LLVM 2.6 */
       unsigned i;
       res = bld->undef;
       for(i = 0; i < type.length; ++i) {
-         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
-         res = LLVMBuildInsertElement(bld->builder, res, scalar, index, "");
+         LLVMValueRef index = lp_build_const_int32(bld->gallivm, i);
+         res = LLVMBuildInsertElement(builder, res, scalar, index, "");
       }
 #endif
       return res;
@@ -104,13 +106,13 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
  * Combined extract and broadcast (or a mere shuffle when the two types match)
  */
 LLVMValueRef
-lp_build_extract_broadcast(LLVMBuilderRef builder,
+lp_build_extract_broadcast(struct gallivm_state *gallivm,
                            struct lp_type src_type,
                            struct lp_type dst_type,
                            LLVMValueRef vector,
                            LLVMValueRef index)
 {
-   LLVMTypeRef i32t = LLVMInt32Type();
+   LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
    LLVMValueRef res;
 
    assert(src_type.floating == dst_type.floating);
@@ -132,8 +134,8 @@ lp_build_extract_broadcast(LLVMBuilderRef builder,
           * Broadcast scalar -> vector.
           */
 
-         res = lp_build_broadcast(builder,
-                                  lp_build_vec_type(dst_type),
+         res = lp_build_broadcast(gallivm,
+                                  lp_build_vec_type(gallivm, dst_type),
                                   vector);
       }
    }
@@ -144,16 +146,16 @@ lp_build_extract_broadcast(LLVMBuilderRef builder,
           */
 
          LLVMValueRef shuffle;
-         shuffle = lp_build_broadcast(builder,
+         shuffle = lp_build_broadcast(gallivm,
                                       LLVMVectorType(i32t, dst_type.length),
                                       index);
-         res = LLVMBuildShuffleVector(builder, vector,
-                                      LLVMGetUndef(lp_build_vec_type(dst_type)),
+         res = LLVMBuildShuffleVector(gallivm->builder, vector,
+                                      LLVMGetUndef(lp_build_vec_type(gallivm, dst_type)),
                                       shuffle, "");
       }
       else {
          LLVMValueRef scalar;
-         scalar = LLVMBuildExtractElement(builder, vector, index, "");
+         scalar = LLVMBuildExtractElement(gallivm->builder, vector, index, "");
          if (dst_type.length == 1) {
             /*
              * Trivial extract scalar from vector.
@@ -166,8 +168,8 @@ lp_build_extract_broadcast(LLVMBuilderRef builder,
              * General case of different sized vectors.
              */
 
-            res = lp_build_broadcast(builder,
-                                     lp_build_vec_type(dst_type),
+            res = lp_build_broadcast(gallivm,
+                                     lp_build_vec_type(gallivm, dst_type),
                                      vector);
          }
       }
@@ -185,6 +187,7 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
                             LLVMValueRef a,
                             unsigned channel)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    const unsigned n = type.length;
    unsigned i, j;
@@ -199,14 +202,14 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
       /*
        * Shuffle.
        */
-      LLVMTypeRef elem_type = LLVMInt32Type();
+      LLVMTypeRef elem_type = LLVMInt32TypeInContext(bld->gallivm->context);
       LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
 
       for(j = 0; j < n; j += 4)
          for(i = 0; i < 4; ++i)
             shuffles[j + i] = LLVMConstInt(elem_type, j + channel, 0);
 
-      return LLVMBuildShuffleVector(bld->builder, a, bld->undef, LLVMConstVector(shuffles, n), "");
+      return LLVMBuildShuffleVector(builder, a, bld->undef, LLVMConstVector(shuffles, n), "");
    }
    else {
       /*
@@ -226,8 +229,9 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
       };
       unsigned i;
 
-      a = LLVMBuildAnd(bld->builder, a,
-                       lp_build_const_mask_aos(type, 1 << channel), "");
+      a = LLVMBuildAnd(builder, a,
+                       lp_build_const_mask_aos(bld->gallivm,
+                                               type, 1 << channel), "");
 
       /*
        * Build a type where each element is an integer that cover the four
@@ -239,7 +243,7 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
       type4.width *= 4;
       type4.length /= 4;
 
-      a = LLVMBuildBitCast(bld->builder, a, lp_build_vec_type(type4), "");
+      a = LLVMBuildBitCast(builder, a, lp_build_vec_type(bld->gallivm, type4), "");
 
       for(i = 0; i < 2; ++i) {
          LLVMValueRef tmp = NULL;
@@ -250,16 +254,16 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
 #endif
 
          if(shift > 0)
-            tmp = LLVMBuildLShr(bld->builder, a, lp_build_const_int_vec(type4, shift*type.width), "");
+            tmp = LLVMBuildLShr(builder, a, lp_build_const_int_vec(bld->gallivm, type4, shift*type.width), "");
          if(shift < 0)
-            tmp = LLVMBuildShl(bld->builder, a, lp_build_const_int_vec(type4, -shift*type.width), "");
+            tmp = LLVMBuildShl(builder, a, lp_build_const_int_vec(bld->gallivm, type4, -shift*type.width), "");
 
          assert(tmp);
          if(tmp)
-            a = LLVMBuildOr(bld->builder, a, tmp, "");
+            a = LLVMBuildOr(builder, a, tmp, "");
       }
 
-      return LLVMBuildBitCast(bld->builder, a, lp_build_vec_type(type), "");
+      return LLVMBuildBitCast(builder, a, lp_build_vec_type(bld->gallivm, type), "");
    }
 }
 
@@ -269,6 +273,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
                      LLVMValueRef a,
                      const unsigned char swizzles[4])
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const struct lp_type type = bld->type;
    const unsigned n = type.length;
    unsigned i, j;
@@ -303,8 +308,8 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
       /*
        * Shuffle.
        */
-      LLVMValueRef undef = LLVMGetUndef(lp_build_elem_type(type));
-      LLVMTypeRef i32t = LLVMInt32Type();
+      LLVMValueRef undef = LLVMGetUndef(lp_build_elem_type(bld->gallivm, type));
+      LLVMTypeRef i32t = LLVMInt32TypeInContext(bld->gallivm->context);
       LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
       LLVMValueRef aux[LP_MAX_VECTOR_LENGTH];
 
@@ -326,13 +331,13 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
             case PIPE_SWIZZLE_ZERO:
                shuffle = type.length + 0;
                if (!aux[0]) {
-                  aux[0] = lp_build_const_elem(type, 0.0);
+                  aux[0] = lp_build_const_elem(bld->gallivm, type, 0.0);
                }
                break;
             case PIPE_SWIZZLE_ONE:
                shuffle = type.length + 1;
                if (!aux[1]) {
-                  aux[1] = lp_build_const_elem(type, 1.0);
+                  aux[1] = lp_build_const_elem(bld->gallivm, type, 1.0);
                }
                break;
             }
@@ -346,7 +351,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
          }
       }
 
-      return LLVMBuildShuffleVector(bld->builder, a,
+      return LLVMBuildShuffleVector(builder, a,
                                     LLVMConstVector(aux, n),
                                     LLVMConstVector(shuffles, n), "");
    } else {
@@ -387,8 +392,8 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
       type4.width *= 4;
       type4.length /= 4;
 
-      a = LLVMBuildBitCast(bld->builder, a, lp_build_vec_type(type4), "");
-      res = LLVMBuildBitCast(bld->builder, res, lp_build_vec_type(type4), "");
+      a = LLVMBuildBitCast(builder, a, lp_build_vec_type(bld->gallivm, type4), "");
+      res = LLVMBuildBitCast(builder, res, lp_build_vec_type(bld->gallivm, type4), "");
 
       /*
        * Mask and shift the channels, trying to group as many channels in the
@@ -414,23 +419,24 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
             if (0)
                debug_printf("shift = %i, mask = 0x%08llx\n", shift, mask);
 
-            masked = LLVMBuildAnd(bld->builder, a,
-                                  lp_build_const_int_vec(type4, mask), "");
+            masked = LLVMBuildAnd(builder, a,
+                                  lp_build_const_int_vec(bld->gallivm, type4, mask), "");
             if (shift > 0) {
-               shifted = LLVMBuildShl(bld->builder, masked,
-                                      lp_build_const_int_vec(type4, shift*type.width), "");
+               shifted = LLVMBuildShl(builder, masked,
+                                      lp_build_const_int_vec(bld->gallivm, type4, shift*type.width), "");
             } else if (shift < 0) {
-               shifted = LLVMBuildLShr(bld->builder, masked,
-                                       lp_build_const_int_vec(type4, -shift*type.width), "");
+               shifted = LLVMBuildLShr(builder, masked,
+                                       lp_build_const_int_vec(bld->gallivm, type4, -shift*type.width), "");
             } else {
                shifted = masked;
             }
 
-            res = LLVMBuildOr(bld->builder, res, shifted, "");
+            res = LLVMBuildOr(builder, res, shifted, "");
          }
       }
 
-      return LLVMBuildBitCast(bld->builder, res, lp_build_vec_type(type), "");
+      return LLVMBuildBitCast(builder, res,
+                              lp_build_vec_type(bld->gallivm, type), "");
    }
 }
 
index fdea8442aef38eeb9cc28ee2791fcd3864e34b50..c366a65103ef5ebb85b25538a27957d9dc0870fa 100644 (file)
@@ -45,7 +45,7 @@ struct lp_build_context;
 
 
 LLVMValueRef
-lp_build_broadcast(LLVMBuilderRef builder,
+lp_build_broadcast(struct gallivm_state *gallivm,
                    LLVMTypeRef vec_type,
                    LLVMValueRef scalar);
 
@@ -56,7 +56,7 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
 
 
 LLVMValueRef
-lp_build_extract_broadcast(LLVMBuilderRef builder,
+lp_build_extract_broadcast(struct gallivm_state *gallivm,
                            struct lp_type src_type,
                            struct lp_type dst_type,
                            LLVMValueRef vector,
index 694818ccfb8350d7c3af96cebfcec64968f32a15..9713d100484c11d99d74ab7b46d567e272127a8e 100644 (file)
@@ -46,6 +46,7 @@ struct tgsi_shader_info;
 struct lp_type;
 struct lp_build_context;
 struct lp_build_mask_context;
+struct gallivm_state;
 
 
 enum lp_build_tex_modifier {
@@ -141,7 +142,7 @@ struct lp_build_sampler_soa
 
    void
    (*emit_fetch_texel)( const struct lp_build_sampler_soa *sampler,
-                        LLVMBuilderRef builder,
+                        struct gallivm_state *gallivm,
                         struct lp_type type,
                         unsigned unit,
                         unsigned num_coords,
@@ -174,7 +175,7 @@ lp_build_tgsi_info(const struct tgsi_token *tokens,
 
 
 void
-lp_build_tgsi_soa(LLVMBuilderRef builder,
+lp_build_tgsi_soa(struct gallivm_state *gallivm,
                   const struct tgsi_token *tokens,
                   struct lp_type type,
                   struct lp_build_mask_context *mask,
@@ -188,7 +189,7 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
 
 
 void
-lp_build_tgsi_aos(LLVMBuilderRef builder,
+lp_build_tgsi_aos(struct gallivm_state *gallivm,
                   const struct tgsi_token *tokens,
                   struct lp_type type,
                   const unsigned char swizzles[4],
@@ -200,7 +201,7 @@ lp_build_tgsi_aos(LLVMBuilderRef builder,
 
 
 LLVMValueRef
-lp_build_system_values_array(LLVMBuilderRef builder,
+lp_build_system_values_array(struct gallivm_state *gallivm,
                              const struct tgsi_shader_info *info,
                              LLVMValueRef instance_id,
                              LLVMValueRef facing);
index c3c082b2b95334d6d6ebd4d61a083c61ffe9c7c9..a021efd69ff8b15c1c45ccac55b577b2c4b32767 100644 (file)
@@ -151,6 +151,7 @@ emit_fetch(
    const struct tgsi_full_instruction *inst,
    unsigned src_op)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    struct lp_type type = bld->base.type;
    const struct tgsi_full_src_register *reg = &inst->Src[src_op];
    LLVMValueRef res;
@@ -175,14 +176,12 @@ emit_fetch(
          LLVMValueRef scalar;
          LLVMValueRef swizzle;
 
-         index = LLVMConstInt(LLVMInt32Type(),
-                              reg->Register.Index*4 + chan,
-                              0);
+         index = lp_build_const_int32(bld->base.gallivm, reg->Register.Index * 4 + chan);
 
-         scalar_ptr = LLVMBuildGEP(bld->base.builder, bld->consts_ptr,
+         scalar_ptr = LLVMBuildGEP(builder, bld->consts_ptr,
                                    &index, 1, "");
 
-         scalar = LLVMBuildLoad(bld->base.builder, scalar_ptr, "");
+         scalar = LLVMBuildLoad(builder, scalar_ptr, "");
 
          lp_build_name(scalar, "const[%u].%c", reg->Register.Index, "xyzw"[chan]);
 
@@ -190,9 +189,9 @@ emit_fetch(
           * NOTE: constants array is always assumed to be RGBA
           */
 
-         swizzle = LLVMConstInt(LLVMInt32Type(), chan, 0);
+         swizzle = lp_build_const_int32(bld->base.gallivm, chan);
 
-         res = LLVMBuildInsertElement(bld->base.builder, res, scalar, swizzle, "");
+         res = LLVMBuildInsertElement(builder, res, scalar, swizzle, "");
       }
 
       /*
@@ -206,14 +205,14 @@ emit_fetch(
          unsigned i;
 
          for (chan = 0; chan < 4; ++chan) {
-            shuffles[chan] = LLVMConstInt(LLVMInt32Type(), chan, 0);
+            shuffles[chan] = lp_build_const_int32(bld->base.gallivm, chan);
          }
 
          for (i = 4; i < type.length; ++i) {
             shuffles[i] = shuffles[i % 4];
          }
 
-         res = LLVMBuildShuffleVector(bld->base.builder,
+         res = LLVMBuildShuffleVector(builder,
                                       res, bld->base.undef,
                                       LLVMConstVector(shuffles, type.length),
                                       "");
@@ -234,7 +233,7 @@ emit_fetch(
       {
          LLVMValueRef temp_ptr;
          temp_ptr = bld->temps[reg->Register.Index];
-         res = LLVMBuildLoad(bld->base.builder, temp_ptr, "");
+         res = LLVMBuildLoad(builder, temp_ptr, "");
          if (!res)
             return bld->base.undef;
       }
@@ -281,6 +280,7 @@ emit_store(
    unsigned index,
    LLVMValueRef value)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    const struct tgsi_full_dst_register *reg = &inst->Dst[index];
    LLVMValueRef mask = NULL;
    LLVMValueRef ptr;
@@ -299,7 +299,7 @@ emit_store(
       break;
 
    case TGSI_SAT_MINUS_PLUS_ONE:
-      value = lp_build_max(&bld->base, value, lp_build_const_vec(bld->base.type, -1.0));
+      value = lp_build_max(&bld->base, value, lp_build_const_vec(bld->base.gallivm, bld->base.type, -1.0));
       value = lp_build_min(&bld->base, value, bld->base.one);
       break;
 
@@ -344,20 +344,20 @@ emit_store(
 
       assert(inst->Predicate.Index < LP_MAX_TGSI_PREDS);
 
-      pred = LLVMBuildLoad(bld->base.builder,
+      pred = LLVMBuildLoad(builder,
                            bld->preds[inst->Predicate.Index], "");
 
       /*
        * Convert the value to an integer mask.
        */
-      pred = lp_build_compare(bld->base.builder,
+      pred = lp_build_compare(bld->base.gallivm,
                                bld->base.type,
                                PIPE_FUNC_NOTEQUAL,
                                pred,
                                bld->base.zero);
 
       if (inst->Predicate.Negate) {
-         pred = LLVMBuildNot(bld->base.builder, pred, "");
+         pred = LLVMBuildNot(builder, pred, "");
       }
 
       pred = swizzle_aos(bld, pred,
@@ -367,7 +367,7 @@ emit_store(
                          inst->Predicate.SwizzleW);
 
       if (mask) {
-         mask = LLVMBuildAnd(bld->base.builder, mask, pred, "");
+         mask = LLVMBuildAnd(builder, mask, pred, "");
       } else {
          mask = pred;
       }
@@ -380,10 +380,11 @@ emit_store(
    if (reg->Register.WriteMask != TGSI_WRITEMASK_XYZW) {
       LLVMValueRef writemask;
 
-      writemask = lp_build_const_mask_aos(bld->base.type, reg->Register.WriteMask);
+      writemask = lp_build_const_mask_aos(bld->base.gallivm, bld->base.type,
+                                          reg->Register.WriteMask);
 
       if (mask) {
-         mask = LLVMBuildAnd(bld->base.builder, mask, writemask, "");
+         mask = LLVMBuildAnd(builder, mask, writemask, "");
       } else {
          mask = writemask;
       }
@@ -392,12 +393,12 @@ emit_store(
    if (mask) {
       LLVMValueRef orig_value;
 
-      orig_value = LLVMBuildLoad(bld->base.builder, ptr, "");
+      orig_value = LLVMBuildLoad(builder, ptr, "");
       value = lp_build_select(&bld->base,
                               mask, value, orig_value);
    }
 
-   LLVMBuildStore(bld->base.builder, value, ptr);
+   LLVMBuildStore(builder, value, ptr);
 }
 
 
@@ -454,7 +455,8 @@ emit_declaration(
    struct lp_build_tgsi_aos_context *bld,
    const struct tgsi_full_declaration *decl)
 {
-   LLVMTypeRef vec_type = lp_build_vec_type(bld->base.type);
+   struct gallivm_state *gallivm = bld->base.gallivm;
+   LLVMTypeRef vec_type = lp_build_vec_type(bld->base.gallivm, bld->base.type);
 
    unsigned first = decl->Range.First;
    unsigned last = decl->Range.Last;
@@ -465,31 +467,26 @@ emit_declaration(
       case TGSI_FILE_TEMPORARY:
          assert(idx < LP_MAX_TGSI_TEMPS);
          if (bld->indirect_files & (1 << TGSI_FILE_TEMPORARY)) {
-            LLVMValueRef array_size = LLVMConstInt(LLVMInt32Type(),
-                                                   last + 1, 0);
-            bld->temps_array = lp_build_array_alloca(bld->base.builder,
+            LLVMValueRef array_size = lp_build_const_int32(gallivm, last + 1);
+            bld->temps_array = lp_build_array_alloca(bld->base.gallivm,
                                                      vec_type, array_size, "");
          } else {
-            bld->temps[idx] = lp_build_alloca(bld->base.builder,
-                                              vec_type, "");
+            bld->temps[idx] = lp_build_alloca(gallivm, vec_type, "");
          }
          break;
 
       case TGSI_FILE_OUTPUT:
-         bld->outputs[idx] = lp_build_alloca(bld->base.builder,
-                                             vec_type, "");
+         bld->outputs[idx] = lp_build_alloca(gallivm, vec_type, "");
          break;
 
       case TGSI_FILE_ADDRESS:
          assert(idx < LP_MAX_TGSI_ADDRS);
-         bld->addr[idx] = lp_build_alloca(bld->base.builder,
-                                          vec_type, "");
+         bld->addr[idx] = lp_build_alloca(gallivm, vec_type, "");
          break;
 
       case TGSI_FILE_PREDICATE:
          assert(idx < LP_MAX_TGSI_PREDS);
-         bld->preds[idx] = lp_build_alloca(bld->base.builder,
-                                           vec_type, "");
+         bld->preds[idx] = lp_build_alloca(gallivm, vec_type, "");
          break;
 
       default:
@@ -644,7 +641,7 @@ emit_instruction(
       src0 = emit_fetch(bld, inst, 0);
       src1 = emit_fetch(bld, inst, 1);
       src2 = emit_fetch(bld, inst, 2);
-      tmp1 = lp_build_const_vec(bld->base.type, 0.5);
+      tmp1 = lp_build_const_vec(bld->base.gallivm, bld->base.type, 0.5);
       tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_GREATER, src2, tmp1);
       dst0 = lp_build_select(&bld->base, tmp0, src0, src1);
       break;
@@ -1039,7 +1036,7 @@ emit_instruction(
 
 
 void
-lp_build_tgsi_aos(LLVMBuilderRef builder,
+lp_build_tgsi_aos(struct gallivm_state *gallivm,
                   const struct tgsi_token *tokens,
                   struct lp_type type,
                   const unsigned char swizzles[4],
@@ -1058,8 +1055,8 @@ lp_build_tgsi_aos(LLVMBuilderRef builder,
 
    /* Setup build context */
    memset(&bld, 0, sizeof bld);
-   lp_build_context_init(&bld.base, builder, type);
-   lp_build_context_init(&bld.int_bld, builder, lp_int_type(type));
+   lp_build_context_init(&bld.base, gallivm, type);
+   lp_build_context_init(&bld.int_bld, gallivm, lp_int_type(type));
 
    for (chan = 0; chan < 4; ++chan) {
       bld.swizzles[chan] = swizzles[chan];
@@ -1131,7 +1128,7 @@ lp_build_tgsi_aos(LLVMBuilderRef builder,
                imm[swizzle] = parse.FullToken.FullImmediate.u[chan].Float;
             }
             bld.immediates[num_immediates] =
-                     lp_build_const_aos(type,
+                     lp_build_const_aos(gallivm, type,
                                         imm[0], imm[1], imm[2], imm[3],
                                         NULL);
             num_immediates++;
@@ -1156,7 +1153,7 @@ lp_build_tgsi_aos(LLVMBuilderRef builder,
    }
 
    if (0) {
-      LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
+      LLVMBasicBlockRef block = LLVMGetInsertBlock(gallivm->builder);
       LLVMValueRef function = LLVMGetBasicBlockParent(block);
       debug_printf("11111111111111111111111111111 \n");
       tgsi_dump(tokens, 0);
@@ -1167,7 +1164,7 @@ lp_build_tgsi_aos(LLVMBuilderRef builder,
 
    if (0) {
       LLVMModuleRef module = LLVMGetGlobalParent(
-         LLVMGetBasicBlockParent(LLVMGetInsertBlock(bld.base.builder)));
+         LLVMGetBasicBlockParent(LLVMGetInsertBlock(gallivm->builder)));
       LLVMDumpModule(module);
    }
 
index 3fdfac95a0a195dd66f0d92b66135c1ebf82f52c..d1585c8e2b7598a667140eedc82504f2a53d3f45 100644 (file)
@@ -51,6 +51,7 @@
 #include "lp_bld_arit.h"
 #include "lp_bld_bitarit.h"
 #include "lp_bld_gather.h"
+#include "lp_bld_init.h"
 #include "lp_bld_logic.h"
 #include "lp_bld_swizzle.h"
 #include "lp_bld_flow.h"
@@ -177,22 +178,24 @@ static void lp_exec_mask_init(struct lp_exec_mask *mask, struct lp_build_context
    mask->loop_stack_size = 0;
    mask->call_stack_size = 0;
 
-   mask->int_vec_type = lp_build_int_vec_type(mask->bld->type);
+   mask->int_vec_type = lp_build_int_vec_type(bld->gallivm, mask->bld->type);
    mask->exec_mask = mask->ret_mask = mask->break_mask = mask->cont_mask = mask->cond_mask =
          LLVMConstAllOnes(mask->int_vec_type);
 }
 
 static void lp_exec_mask_update(struct lp_exec_mask *mask)
 {
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
+
    if (mask->loop_stack_size) {
       /*for loops we need to update the entire mask at runtime */
       LLVMValueRef tmp;
       assert(mask->break_mask);
-      tmp = LLVMBuildAnd(mask->bld->builder,
+      tmp = LLVMBuildAnd(builder,
                          mask->cont_mask,
                          mask->break_mask,
                          "maskcb");
-      mask->exec_mask = LLVMBuildAnd(mask->bld->builder,
+      mask->exec_mask = LLVMBuildAnd(builder,
                                      mask->cond_mask,
                                      tmp,
                                      "maskfull");
@@ -200,7 +203,7 @@ static void lp_exec_mask_update(struct lp_exec_mask *mask)
       mask->exec_mask = mask->cond_mask;
 
    if (mask->call_stack_size) {
-      mask->exec_mask = LLVMBuildAnd(mask->bld->builder,
+      mask->exec_mask = LLVMBuildAnd(builder,
                                      mask->exec_mask,
                                      mask->ret_mask,
                                      "callmask");
@@ -214,13 +217,15 @@ static void lp_exec_mask_update(struct lp_exec_mask *mask)
 static void lp_exec_mask_cond_push(struct lp_exec_mask *mask,
                                    LLVMValueRef val)
 {
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
+
    assert(mask->cond_stack_size < LP_MAX_TGSI_NESTING);
    if (mask->cond_stack_size == 0) {
       assert(mask->cond_mask == LLVMConstAllOnes(mask->int_vec_type));
    }
    mask->cond_stack[mask->cond_stack_size++] = mask->cond_mask;
    assert(LLVMTypeOf(val) == mask->int_vec_type);
-   mask->cond_mask = LLVMBuildAnd(mask->bld->builder,
+   mask->cond_mask = LLVMBuildAnd(builder,
                                   mask->cond_mask,
                                   val,
                                   "");
@@ -229,6 +234,7 @@ static void lp_exec_mask_cond_push(struct lp_exec_mask *mask,
 
 static void lp_exec_mask_cond_invert(struct lp_exec_mask *mask)
 {
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
    LLVMValueRef prev_mask;
    LLVMValueRef inv_mask;
 
@@ -238,9 +244,9 @@ static void lp_exec_mask_cond_invert(struct lp_exec_mask *mask)
       assert(prev_mask == LLVMConstAllOnes(mask->int_vec_type));
    }
 
-   inv_mask = LLVMBuildNot(mask->bld->builder, mask->cond_mask, "");
+   inv_mask = LLVMBuildNot(builder, mask->cond_mask, "");
 
-   mask->cond_mask = LLVMBuildAnd(mask->bld->builder,
+   mask->cond_mask = LLVMBuildAnd(builder,
                                   inv_mask,
                                   prev_mask, "");
    lp_exec_mask_update(mask);
@@ -255,6 +261,8 @@ static void lp_exec_mask_cond_pop(struct lp_exec_mask *mask)
 
 static void lp_exec_bgnloop(struct lp_exec_mask *mask)
 {
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
+
    if (mask->loop_stack_size == 0) {
       assert(mask->loop_block == NULL);
       assert(mask->cont_mask == LLVMConstAllOnes(mask->int_vec_type));
@@ -270,25 +278,26 @@ static void lp_exec_bgnloop(struct lp_exec_mask *mask)
    mask->loop_stack[mask->loop_stack_size].break_var = mask->break_var;
    ++mask->loop_stack_size;
 
-   mask->break_var = lp_build_alloca(mask->bld->builder, mask->int_vec_type, "");
-   LLVMBuildStore(mask->bld->builder, mask->break_mask, mask->break_var);
+   mask->break_var = lp_build_alloca(mask->bld->gallivm, mask->int_vec_type, "");
+   LLVMBuildStore(builder, mask->break_mask, mask->break_var);
 
-   mask->loop_block = lp_build_insert_new_block(mask->bld->builder, "bgnloop");
-   LLVMBuildBr(mask->bld->builder, mask->loop_block);
-   LLVMPositionBuilderAtEnd(mask->bld->builder, mask->loop_block);
+   mask->loop_block = lp_build_insert_new_block(mask->bld->gallivm, "bgnloop");
+   LLVMBuildBr(builder, mask->loop_block);
+   LLVMPositionBuilderAtEnd(builder, mask->loop_block);
 
-   mask->break_mask = LLVMBuildLoad(mask->bld->builder, mask->break_var, "");
+   mask->break_mask = LLVMBuildLoad(builder, mask->break_var, "");
 
    lp_exec_mask_update(mask);
 }
 
 static void lp_exec_break(struct lp_exec_mask *mask)
 {
-   LLVMValueRef exec_mask = LLVMBuildNot(mask->bld->builder,
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
+   LLVMValueRef exec_mask = LLVMBuildNot(builder,
                                          mask->exec_mask,
                                          "break");
 
-   mask->break_mask = LLVMBuildAnd(mask->bld->builder,
+   mask->break_mask = LLVMBuildAnd(builder,
                                    mask->break_mask,
                                    exec_mask, "break_full");
 
@@ -297,11 +306,12 @@ static void lp_exec_break(struct lp_exec_mask *mask)
 
 static void lp_exec_continue(struct lp_exec_mask *mask)
 {
-   LLVMValueRef exec_mask = LLVMBuildNot(mask->bld->builder,
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
+   LLVMValueRef exec_mask = LLVMBuildNot(builder,
                                          mask->exec_mask,
                                          "");
 
-   mask->cont_mask = LLVMBuildAnd(mask->bld->builder,
+   mask->cont_mask = LLVMBuildAnd(builder,
                                   mask->cont_mask,
                                   exec_mask, "");
 
@@ -309,11 +319,14 @@ static void lp_exec_continue(struct lp_exec_mask *mask)
 }
 
 
-static void lp_exec_endloop(struct lp_exec_mask *mask)
+static void lp_exec_endloop(struct gallivm_state *gallivm,
+                            struct lp_exec_mask *mask)
 {
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
    LLVMBasicBlockRef endloop;
-   LLVMTypeRef reg_type = LLVMIntType(mask->bld->type.width*
-                                      mask->bld->type.length);
+   LLVMTypeRef reg_type = LLVMIntTypeInContext(gallivm->context,
+                                               mask->bld->type.width *
+                                               mask->bld->type.length);
    LLVMValueRef i1cond;
 
    assert(mask->break_mask);
@@ -329,21 +342,21 @@ static void lp_exec_endloop(struct lp_exec_mask *mask)
     * Unlike the continue mask, the break_mask must be preserved across loop
     * iterations
     */
-   LLVMBuildStore(mask->bld->builder, mask->break_mask, mask->break_var);
+   LLVMBuildStore(builder, mask->break_mask, mask->break_var);
 
    /* i1cond = (mask == 0) */
    i1cond = LLVMBuildICmp(
-      mask->bld->builder,
+      builder,
       LLVMIntNE,
-      LLVMBuildBitCast(mask->bld->builder, mask->exec_mask, reg_type, ""),
+      LLVMBuildBitCast(builder, mask->exec_mask, reg_type, ""),
       LLVMConstNull(reg_type), "");
 
-   endloop = lp_build_insert_new_block(mask->bld->builder, "endloop");
+   endloop = lp_build_insert_new_block(mask->bld->gallivm, "endloop");
 
-   LLVMBuildCondBr(mask->bld->builder,
+   LLVMBuildCondBr(builder,
                    i1cond, mask->loop_block, endloop);
 
-   LLVMPositionBuilderAtEnd(mask->bld->builder, endloop);
+   LLVMPositionBuilderAtEnd(builder, endloop);
 
    assert(mask->loop_stack_size);
    --mask->loop_stack_size;
@@ -365,10 +378,12 @@ static void lp_exec_mask_store(struct lp_exec_mask *mask,
                                LLVMValueRef val,
                                LLVMValueRef dst)
 {
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
+
    /* Mix the predicate and execution mask */
    if (mask->has_mask) {
       if (pred) {
-         pred = LLVMBuildAnd(mask->bld->builder, pred, mask->exec_mask, "");
+         pred = LLVMBuildAnd(builder, pred, mask->exec_mask, "");
       } else {
          pred = mask->exec_mask;
       }
@@ -377,14 +392,14 @@ static void lp_exec_mask_store(struct lp_exec_mask *mask,
    if (pred) {
       LLVMValueRef real_val, dst_val;
 
-      dst_val = LLVMBuildLoad(mask->bld->builder, dst, "");
+      dst_val = LLVMBuildLoad(builder, dst, "");
       real_val = lp_build_select(mask->bld,
                                  pred,
                                  val, dst_val);
 
-      LLVMBuildStore(mask->bld->builder, real_val, dst);
+      LLVMBuildStore(builder, real_val, dst);
    } else
-      LLVMBuildStore(mask->bld->builder, val, dst);
+      LLVMBuildStore(builder, val, dst);
 }
 
 static void lp_exec_mask_call(struct lp_exec_mask *mask,
@@ -400,6 +415,7 @@ static void lp_exec_mask_call(struct lp_exec_mask *mask,
 
 static void lp_exec_mask_ret(struct lp_exec_mask *mask, int *pc)
 {
+   LLVMBuilderRef builder = mask->bld->gallivm->builder;
    LLVMValueRef exec_mask;
 
    if (mask->call_stack_size == 0) {
@@ -407,11 +423,11 @@ static void lp_exec_mask_ret(struct lp_exec_mask *mask, int *pc)
       *pc = -1;
       return;
    }
-   exec_mask = LLVMBuildNot(mask->bld->builder,
+   exec_mask = LLVMBuildNot(builder,
                             mask->exec_mask,
                             "ret");
 
-   mask->ret_mask = LLVMBuildAnd(mask->bld->builder,
+   mask->ret_mask = LLVMBuildAnd(builder,
                                  mask->ret_mask,
                                  exec_mask, "ret_full");
 
@@ -443,10 +459,11 @@ get_temp_ptr(struct lp_build_tgsi_soa_context *bld,
              unsigned index,
              unsigned chan)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    assert(chan < 4);
    if (bld->indirect_files & (1 << TGSI_FILE_TEMPORARY)) {
-      LLVMValueRef lindex = lp_build_const_int32(index * 4 + chan);
-      return LLVMBuildGEP(bld->base.builder, bld->temps_array, &lindex, 1, "");
+      LLVMValueRef lindex = lp_build_const_int32(bld->base.gallivm, index * 4 + chan);
+      return LLVMBuildGEP(builder, bld->temps_array, &lindex, 1, "");
    }
    else {
       return bld->temps[index][chan];
@@ -464,10 +481,12 @@ get_output_ptr(struct lp_build_tgsi_soa_context *bld,
                unsigned index,
                unsigned chan)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    assert(chan < 4);
    if (bld->indirect_files & (1 << TGSI_FILE_OUTPUT)) {
-      LLVMValueRef lindex = lp_build_const_int32(index * 4 + chan);
-      return LLVMBuildGEP(bld->base.builder, bld->outputs_array, &lindex, 1, "");
+      LLVMValueRef lindex = lp_build_const_int32(bld->base.gallivm,
+                                                 index * 4 + chan);
+      return LLVMBuildGEP(builder, bld->outputs_array, &lindex, 1, "");
    }
    else {
       return bld->outputs[index][chan];
@@ -484,6 +503,7 @@ build_gather(struct lp_build_tgsi_soa_context *bld,
              LLVMValueRef base_ptr,
              LLVMValueRef indexes)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    LLVMValueRef res = bld->base.undef;
    unsigned i;
 
@@ -491,14 +511,14 @@ build_gather(struct lp_build_tgsi_soa_context *bld,
     * Loop over elements of index_vec, load scalar value, insert it into 'res'.
     */
    for (i = 0; i < bld->base.type.length; i++) {
-      LLVMValueRef ii = LLVMConstInt(LLVMInt32Type(), i, 0);
-      LLVMValueRef index = LLVMBuildExtractElement(bld->base.builder,
+      LLVMValueRef ii = lp_build_const_int32(bld->base.gallivm, i);
+      LLVMValueRef index = LLVMBuildExtractElement(builder,
                                                    indexes, ii, "");
-      LLVMValueRef scalar_ptr = LLVMBuildGEP(bld->base.builder, base_ptr,
+      LLVMValueRef scalar_ptr = LLVMBuildGEP(builder, base_ptr,
                                              &index, 1, "gather_ptr");
-      LLVMValueRef scalar = LLVMBuildLoad(bld->base.builder, scalar_ptr, "");
+      LLVMValueRef scalar = LLVMBuildLoad(builder, scalar_ptr, "");
 
-      res = LLVMBuildInsertElement(bld->base.builder, res, scalar, ii, "");
+      res = LLVMBuildInsertElement(builder, res, scalar, ii, "");
    }
 
    return res;
@@ -516,13 +536,14 @@ emit_mask_scatter(struct lp_build_tgsi_soa_context *bld,
                   struct lp_exec_mask *mask,
                   LLVMValueRef pred)
 {
-   LLVMBuilderRef builder = bld->base.builder;
+   struct gallivm_state *gallivm = bld->base.gallivm;
+   LLVMBuilderRef builder = gallivm->builder;
    unsigned i;
 
    /* Mix the predicate and execution mask */
    if (mask->has_mask) {
       if (pred) {
-         pred = LLVMBuildAnd(mask->bld->builder, pred, mask->exec_mask, "");
+         pred = LLVMBuildAnd(builder, pred, mask->exec_mask, "");
       }
       else {
          pred = mask->exec_mask;
@@ -533,7 +554,7 @@ emit_mask_scatter(struct lp_build_tgsi_soa_context *bld,
     * Loop over elements of index_vec, store scalar value.
     */
    for (i = 0; i < bld->base.type.length; i++) {
-      LLVMValueRef ii = LLVMConstInt(LLVMInt32Type(), i, 0);
+      LLVMValueRef ii = lp_build_const_int32(gallivm, i);
       LLVMValueRef index = LLVMBuildExtractElement(builder, indexes, ii, "");
       LLVMValueRef scalar_ptr = LLVMBuildGEP(builder, base_ptr, &index, 1, "scatter_ptr");
       LLVMValueRef val = LLVMBuildExtractElement(builder, values, ii, "scatter_val");
@@ -541,7 +562,7 @@ emit_mask_scatter(struct lp_build_tgsi_soa_context *bld,
          LLVMBuildExtractElement(builder, pred, ii, "scatter_pred") : NULL;
 
       if (0)
-         lp_build_printf(builder, "scatter %d: val %f at %d %p\n",
+         lp_build_printf(gallivm, "scatter %d: val %f at %d %p\n",
                          ii, val, index, scalar_ptr);
 
       if (scalar_pred) {
@@ -568,6 +589,7 @@ get_indirect_index(struct lp_build_tgsi_soa_context *bld,
                    unsigned reg_file, unsigned reg_index,
                    const struct tgsi_src_register *indirect_reg)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    struct lp_build_context *uint_bld = &bld->uint_bld;
    /* always use X component of address register */
    unsigned swizzle = indirect_reg->SwizzleX;
@@ -578,21 +600,22 @@ get_indirect_index(struct lp_build_tgsi_soa_context *bld,
 
    assert(bld->indirect_files & (1 << reg_file));
 
-   base = lp_build_const_int_vec(uint_bld->type, reg_index);
+   base = lp_build_const_int_vec(bld->base.gallivm, uint_bld->type, reg_index);
 
    assert(swizzle < 4);
-   rel = LLVMBuildLoad(bld->base.builder,
+   rel = LLVMBuildLoad(builder,
                         bld->addr[indirect_reg->Index][swizzle],
                         "load addr reg");
 
    /* for indexing we want integers */
-   rel = LLVMBuildFPToSI(bld->base.builder,
+   rel = LLVMBuildFPToSI(builder,
                          rel,
                          uint_bld->vec_type, "");
 
    index = lp_build_add(uint_bld, base, rel);
 
-   max_index = lp_build_const_int_vec(uint_bld->type,
+   max_index = lp_build_const_int_vec(bld->base.gallivm,
+                                      uint_bld->type,
                                       bld->info->file_max[reg_file]);
 
    assert(!uint_bld->type.sign);
@@ -612,6 +635,8 @@ emit_fetch(
    unsigned src_op,
    const unsigned chan_index )
 {
+   struct gallivm_state *gallivm = bld->base.gallivm;
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_build_context *uint_bld = &bld->uint_bld;
    const struct tgsi_full_src_register *reg = &inst->Src[src_op];
    const unsigned swizzle =
@@ -637,7 +662,7 @@ emit_fetch(
    case TGSI_FILE_CONSTANT:
       if (reg->Register.Indirect) {
          LLVMValueRef swizzle_vec =
-            lp_build_const_int_vec(uint_bld->type, swizzle);
+            lp_build_const_int_vec(bld->base.gallivm, uint_bld->type, swizzle);
          LLVMValueRef index_vec;  /* index into the const buffer */
 
          /* index_vec = indirect_index * 4 + swizzle */
@@ -651,11 +676,11 @@ emit_fetch(
          LLVMValueRef index;  /* index into the const buffer */
          LLVMValueRef scalar, scalar_ptr;
 
-         index = lp_build_const_int32(reg->Register.Index*4 + swizzle);
+         index = lp_build_const_int32(gallivm, reg->Register.Index*4 + swizzle);
 
-         scalar_ptr = LLVMBuildGEP(bld->base.builder, bld->consts_ptr,
+         scalar_ptr = LLVMBuildGEP(builder, bld->consts_ptr,
                                    &index, 1, "");
-         scalar = LLVMBuildLoad(bld->base.builder, scalar_ptr, "");
+         scalar = LLVMBuildLoad(builder, scalar_ptr, "");
 
          res = lp_build_broadcast_scalar(&bld->base, scalar);
       }
@@ -669,9 +694,9 @@ emit_fetch(
    case TGSI_FILE_INPUT:
       if (reg->Register.Indirect) {
          LLVMValueRef swizzle_vec =
-            lp_build_const_int_vec(uint_bld->type, swizzle);
+            lp_build_const_int_vec(gallivm, uint_bld->type, swizzle);
          LLVMValueRef length_vec =
-            lp_build_const_int_vec(uint_bld->type, bld->base.type.length);
+            lp_build_const_int_vec(gallivm, uint_bld->type, bld->base.type.length);
          LLVMValueRef index_vec;  /* index into the const buffer */
          LLVMValueRef inputs_array;
          LLVMTypeRef float4_ptr_type;
@@ -682,18 +707,19 @@ emit_fetch(
          index_vec = lp_build_mul(uint_bld, index_vec, length_vec);
 
          /* cast inputs_array pointer to float* */
-         float4_ptr_type = LLVMPointerType(LLVMFloatType(), 0);
-         inputs_array = LLVMBuildBitCast(uint_bld->builder, bld->inputs_array,
-                                        float4_ptr_type, "");
+         float4_ptr_type = LLVMPointerType(LLVMFloatTypeInContext(gallivm->context), 0);
+         inputs_array = LLVMBuildBitCast(builder, bld->inputs_array,
+                                         float4_ptr_type, "");
 
          /* Gather values from the temporary register array */
          res = build_gather(bld, inputs_array, index_vec);
       } else {
          if (bld->indirect_files & (1 << TGSI_FILE_INPUT)) {
-            LLVMValueRef lindex = lp_build_const_int32(reg->Register.Index * 4 + swizzle);
-            LLVMValueRef input_ptr =  LLVMBuildGEP(bld->base.builder,
+            LLVMValueRef lindex = lp_build_const_int32(gallivm,
+                                           reg->Register.Index * 4 + swizzle);
+            LLVMValueRef input_ptr =  LLVMBuildGEP(builder,
                                                    bld->inputs_array, &lindex, 1, "");
-            res = LLVMBuildLoad(bld->base.builder, input_ptr, "");
+            res = LLVMBuildLoad(builder, input_ptr, "");
          }
          else {
             res = bld->inputs[reg->Register.Index][swizzle];
@@ -705,9 +731,10 @@ emit_fetch(
    case TGSI_FILE_TEMPORARY:
       if (reg->Register.Indirect) {
          LLVMValueRef swizzle_vec =
-            lp_build_const_int_vec(uint_bld->type, swizzle);
+            lp_build_const_int_vec(bld->base.gallivm, uint_bld->type, swizzle);
          LLVMValueRef length_vec =
-            lp_build_const_int_vec(uint_bld->type, bld->base.type.length);
+            lp_build_const_int_vec(bld->base.gallivm, uint_bld->type,
+                                   bld->base.type.length);
          LLVMValueRef index_vec;  /* index into the const buffer */
          LLVMValueRef temps_array;
          LLVMTypeRef float4_ptr_type;
@@ -718,8 +745,8 @@ emit_fetch(
          index_vec = lp_build_mul(uint_bld, index_vec, length_vec);
 
          /* cast temps_array pointer to float* */
-         float4_ptr_type = LLVMPointerType(LLVMFloatType(), 0);
-         temps_array = LLVMBuildBitCast(uint_bld->builder, bld->temps_array,
+         float4_ptr_type = LLVMPointerType(LLVMFloatTypeInContext(bld->base.gallivm->context), 0);
+         temps_array = LLVMBuildBitCast(builder, bld->temps_array,
                                         float4_ptr_type, "");
 
          /* Gather values from the temporary register array */
@@ -728,7 +755,7 @@ emit_fetch(
       else {
          LLVMValueRef temp_ptr;
          temp_ptr = get_temp_ptr(bld, reg->Register.Index, swizzle);
-         res = LLVMBuildLoad(bld->base.builder, temp_ptr, "");
+         res = LLVMBuildLoad(builder, temp_ptr, "");
          if (!res)
             return bld->base.undef;
       }
@@ -740,11 +767,12 @@ emit_fetch(
          LLVMValueRef index;  /* index into the system value array */
          LLVMValueRef scalar, scalar_ptr;
 
-         index = lp_build_const_int32(reg->Register.Index * 4 + swizzle);
+         index = lp_build_const_int32(gallivm,
+                                      reg->Register.Index * 4 + swizzle);
 
-         scalar_ptr = LLVMBuildGEP(bld->base.builder, bld->system_values_array,
+         scalar_ptr = LLVMBuildGEP(builder, bld->system_values_array,
                                    &index, 1, "");
-         scalar = LLVMBuildLoad(bld->base.builder, scalar_ptr, "");
+         scalar = LLVMBuildLoad(builder, scalar_ptr, "");
 
          res = lp_build_broadcast_scalar(&bld->base, scalar);
       }
@@ -814,6 +842,7 @@ emit_fetch_predicate(
    const struct tgsi_full_instruction *inst,
    LLVMValueRef *pred)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    unsigned index;
    unsigned char swizzles[4];
    LLVMValueRef unswizzled[4] = {NULL, NULL, NULL, NULL};
@@ -843,7 +872,7 @@ emit_fetch_predicate(
        * in the swizzles
        */
       if (!unswizzled[swizzle]) {
-         value = LLVMBuildLoad(bld->base.builder,
+         value = LLVMBuildLoad(builder,
                                bld->preds[index][swizzle], "");
 
          /*
@@ -853,13 +882,13 @@ emit_fetch_predicate(
           * is needlessly causing two comparisons due to storing the intermediate
           * result as float vector instead of an integer mask vector.
           */
-         value = lp_build_compare(bld->base.builder,
+         value = lp_build_compare(bld->base.gallivm,
                                   bld->base.type,
                                   PIPE_FUNC_NOTEQUAL,
                                   value,
                                   bld->base.zero);
          if (inst->Predicate.Negate) {
-            value = LLVMBuildNot(bld->base.builder, value, "");
+            value = LLVMBuildNot(builder, value, "");
          }
 
          unswizzled[swizzle] = value;
@@ -884,6 +913,8 @@ emit_store(
    LLVMValueRef pred,
    LLVMValueRef value)
 {
+   struct gallivm_state *gallivm = bld->base.gallivm;
+   LLVMBuilderRef builder = gallivm->builder;
    const struct tgsi_full_dst_register *reg = &inst->Dst[index];
    struct lp_build_context *uint_bld = &bld->uint_bld;
    LLVMValueRef indirect_index = NULL;
@@ -898,7 +929,7 @@ emit_store(
       break;
 
    case TGSI_SAT_MINUS_PLUS_ONE:
-      value = lp_build_max(&bld->base, value, lp_build_const_vec(bld->base.type, -1.0));
+      value = lp_build_max(&bld->base, value, lp_build_const_vec(bld->base.gallivm, bld->base.type, -1.0));
       value = lp_build_min(&bld->base, value, bld->base.one);
       break;
 
@@ -918,11 +949,10 @@ emit_store(
    switch( reg->Register.File ) {
    case TGSI_FILE_OUTPUT:
       if (reg->Register.Indirect) {
-         LLVMBuilderRef builder = bld->base.builder;
          LLVMValueRef chan_vec =
-            lp_build_const_int_vec(uint_bld->type, chan_index);
+            lp_build_const_int_vec(gallivm, uint_bld->type, chan_index);
          LLVMValueRef length_vec =
-            lp_build_const_int_vec(uint_bld->type, bld->base.type.length);
+            lp_build_const_int_vec(gallivm, uint_bld->type, bld->base.type.length);
          LLVMValueRef index_vec;  /* indexes into the temp registers */
          LLVMValueRef outputs_array;
          LLVMValueRef pixel_offsets;
@@ -932,7 +962,7 @@ emit_store(
          /* build pixel offset vector: {0, 1, 2, 3, ...} */
          pixel_offsets = uint_bld->undef;
          for (i = 0; i < bld->base.type.length; i++) {
-            LLVMValueRef ii = lp_build_const_int32(i);
+            LLVMValueRef ii = lp_build_const_int32(gallivm, i);
             pixel_offsets = LLVMBuildInsertElement(builder, pixel_offsets,
                                                    ii, ii, "");
          }
@@ -943,7 +973,8 @@ emit_store(
          index_vec = lp_build_mul(uint_bld, index_vec, length_vec);
          index_vec = lp_build_add(uint_bld, index_vec, pixel_offsets);
 
-         float_ptr_type = LLVMPointerType(LLVMFloatType(), 0);
+         float_ptr_type =
+            LLVMPointerType(LLVMFloatTypeInContext(gallivm->context), 0);
          outputs_array = LLVMBuildBitCast(builder, bld->outputs_array,
                                           float_ptr_type, "");
 
@@ -960,11 +991,11 @@ emit_store(
 
    case TGSI_FILE_TEMPORARY:
       if (reg->Register.Indirect) {
-         LLVMBuilderRef builder = bld->base.builder;
          LLVMValueRef chan_vec =
-            lp_build_const_int_vec(uint_bld->type, chan_index);
+            lp_build_const_int_vec(gallivm, uint_bld->type, chan_index);
          LLVMValueRef length_vec =
-            lp_build_const_int_vec(uint_bld->type, bld->base.type.length);
+            lp_build_const_int_vec(gallivm, uint_bld->type,
+                                   bld->base.type.length);
          LLVMValueRef index_vec;  /* indexes into the temp registers */
          LLVMValueRef temps_array;
          LLVMValueRef pixel_offsets;
@@ -974,7 +1005,7 @@ emit_store(
          /* build pixel offset vector: {0, 1, 2, 3, ...} */
          pixel_offsets = uint_bld->undef; 
          for (i = 0; i < bld->base.type.length; i++) {
-            LLVMValueRef ii = lp_build_const_int32(i);
+            LLVMValueRef ii = lp_build_const_int32(gallivm, i);
             pixel_offsets = LLVMBuildInsertElement(builder, pixel_offsets,
                                                    ii, ii, "");
          }
@@ -985,7 +1016,8 @@ emit_store(
          index_vec = lp_build_mul(uint_bld, index_vec, length_vec);
          index_vec = lp_build_add(uint_bld, index_vec, pixel_offsets);
 
-         float_ptr_type = LLVMPointerType(LLVMFloatType(), 0);
+         float_ptr_type =
+            LLVMPointerType(LLVMFloatTypeInContext(gallivm->context), 0);
          temps_array = LLVMBuildBitCast(builder, bld->temps_array,
                                         float_ptr_type, "");
 
@@ -1002,7 +1034,7 @@ emit_store(
 
    case TGSI_FILE_ADDRESS:
       lp_exec_mask_store(&bld->exec_mask, pred, value,
-                         bld->addr[reg->Indirect.Index][chan_index]);
+                         bld->addr[reg->Register.Index][chan_index]);
       break;
 
    case TGSI_FILE_PREDICATE:
@@ -1026,6 +1058,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
           enum lp_build_tex_modifier modifier,
           LLVMValueRef *texel)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    unsigned unit;
    LLVMValueRef lod_bias, explicit_lod;
    LLVMValueRef oow = NULL;
@@ -1091,13 +1124,12 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
    }
 
    if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) {
-      LLVMTypeRef i32t = LLVMInt32Type();
-      LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
+      LLVMValueRef index0 = lp_build_const_int32(bld->base.gallivm, 0);
       for (i = 0; i < num_coords; i++) {
          LLVMValueRef src1 = emit_fetch( bld, inst, 1, i );
          LLVMValueRef src2 = emit_fetch( bld, inst, 2, i );
-         ddx[i] = LLVMBuildExtractElement(bld->base.builder, src1, index0, "");
-         ddy[i] = LLVMBuildExtractElement(bld->base.builder, src2, index0, "");
+         ddx[i] = LLVMBuildExtractElement(builder, src1, index0, "");
+         ddy[i] = LLVMBuildExtractElement(builder, src2, index0, "");
       }
       unit = inst->Src[3].Register.Index;
    }  else {
@@ -1113,7 +1145,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
    }
 
    bld->sampler->emit_fetch_texel(bld->sampler,
-                                  bld->base.builder,
+                                  bld->base.gallivm,
                                   bld->base.type,
                                   unit, num_coords, coords,
                                   ddx, ddy,
@@ -1168,6 +1200,7 @@ emit_kil(
    const struct tgsi_full_instruction *inst,
    int pc)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    const struct tgsi_full_src_register *reg = &inst->Src[0];
    LLVMValueRef terms[NUM_CHANNELS];
    LLVMValueRef mask;
@@ -1199,7 +1232,7 @@ emit_kil(
          chan_mask = lp_build_cmp(&bld->base, PIPE_FUNC_GEQUAL, terms[chan_index], bld->base.zero);
 
          if(mask)
-            mask = LLVMBuildAnd(bld->base.builder, mask, chan_mask, "");
+            mask = LLVMBuildAnd(builder, mask, chan_mask, "");
          else
             mask = chan_mask;
       }
@@ -1225,13 +1258,14 @@ emit_kilp(struct lp_build_tgsi_soa_context *bld,
           const struct tgsi_full_instruction *inst,
          int pc)
 {
+   LLVMBuilderRef builder = bld->base.gallivm->builder;
    LLVMValueRef mask;
 
    /* For those channels which are "alive", disable fragment shader
     * execution.
     */
    if (bld->exec_mask.has_mask) {
-      mask = LLVMBuildNot(bld->base.builder, bld->exec_mask.exec_mask, "kilp");
+      mask = LLVMBuildNot(builder, bld->exec_mask.exec_mask, "kilp");
    }
    else {
       LLVMValueRef zero = LLVMConstNull(bld->base.int_vec_type);
@@ -1252,38 +1286,39 @@ emit_kilp(struct lp_build_tgsi_soa_context *bld,
 static void
 emit_dump_temps(struct lp_build_tgsi_soa_context *bld)
 {
-   LLVMBuilderRef builder = bld->base.builder;
+   struct gallivm_state *gallivm = bld->base.gallivm;
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef temp_ptr;
-   LLVMValueRef i0 = lp_build_const_int32(0);
-   LLVMValueRef i1 = lp_build_const_int32(1);
-   LLVMValueRef i2 = lp_build_const_int32(2);
-   LLVMValueRef i3 = lp_build_const_int32(3);
+   LLVMValueRef i0 = lp_build_const_int32(gallivm, 0);
+   LLVMValueRef i1 = lp_build_const_int32(gallivm, 1);
+   LLVMValueRef i2 = lp_build_const_int32(gallivm, 2);
+   LLVMValueRef i3 = lp_build_const_int32(gallivm, 3);
    int index;
    int n = bld->info->file_max[TGSI_FILE_TEMPORARY];
 
    for (index = 0; index < n; index++) {
-      LLVMValueRef idx = lp_build_const_int32(index);
+      LLVMValueRef idx = lp_build_const_int32(gallivm, index);
       LLVMValueRef v[4][4], res;
       int chan;
 
-      lp_build_printf(builder, "TEMP[%d]:\n", idx);
+      lp_build_printf(gallivm, "TEMP[%d]:\n", idx);
 
       for (chan = 0; chan < 4; chan++) {
          temp_ptr = get_temp_ptr(bld, index, chan);
-         res = LLVMBuildLoad(bld->base.builder, temp_ptr, "");
+         res = LLVMBuildLoad(builder, temp_ptr, "");
          v[chan][0] = LLVMBuildExtractElement(builder, res, i0, "");
          v[chan][1] = LLVMBuildExtractElement(builder, res, i1, "");
          v[chan][2] = LLVMBuildExtractElement(builder, res, i2, "");
          v[chan][3] = LLVMBuildExtractElement(builder, res, i3, "");
       }
 
-      lp_build_printf(builder, "  X: %f %f %f %f\n",
+      lp_build_printf(gallivm, "  X: %f %f %f %f\n",
                       v[0][0], v[0][1], v[0][2], v[0][3]);
-      lp_build_printf(builder, "  Y: %f %f %f %f\n",
+      lp_build_printf(gallivm, "  Y: %f %f %f %f\n",
                       v[1][0], v[1][1], v[1][2], v[1][3]);
-      lp_build_printf(builder, "  Z: %f %f %f %f\n",
+      lp_build_printf(gallivm, "  Z: %f %f %f %f\n",
                       v[2][0], v[2][1], v[2][2], v[2][3]);
-      lp_build_printf(builder, "  W: %f %f %f %f\n",
+      lp_build_printf(gallivm, "  W: %f %f %f %f\n",
                       v[3][0], v[3][1], v[3][2], v[3][3]);
    }
 }
@@ -1295,6 +1330,7 @@ emit_declaration(
    struct lp_build_tgsi_soa_context *bld,
    const struct tgsi_full_declaration *decl)
 {
+   struct gallivm_state *gallivm = bld->base.gallivm;
    LLVMTypeRef vec_type = bld->base.vec_type;
    const unsigned first = decl->Range.First;
    const unsigned last = decl->Range.Last;
@@ -1307,15 +1343,14 @@ emit_declaration(
          assert(idx < LP_MAX_TGSI_TEMPS);
          if (!(bld->indirect_files & (1 << TGSI_FILE_TEMPORARY))) {
             for (i = 0; i < NUM_CHANNELS; i++)
-               bld->temps[idx][i] = lp_build_alloca(bld->base.builder,
-                                                    vec_type, "temp");
+               bld->temps[idx][i] = lp_build_alloca(gallivm, vec_type, "temp");
          }
          break;
 
       case TGSI_FILE_OUTPUT:
          if (!(bld->indirect_files & (1 << TGSI_FILE_OUTPUT))) {
             for (i = 0; i < NUM_CHANNELS; i++)
-               bld->outputs[idx][i] = lp_build_alloca(bld->base.builder,
+               bld->outputs[idx][i] = lp_build_alloca(gallivm,
                                                       vec_type, "output");
          }
          break;
@@ -1323,15 +1358,14 @@ emit_declaration(
       case TGSI_FILE_ADDRESS:
          assert(idx < LP_MAX_TGSI_ADDRS);
          for (i = 0; i < NUM_CHANNELS; i++)
-            bld->addr[idx][i] = lp_build_alloca(bld->base.builder,
-                                                vec_type, "addr");
+            bld->addr[idx][i] = lp_build_alloca(gallivm, vec_type, "addr");
          break;
 
       case TGSI_FILE_PREDICATE:
          assert(idx < LP_MAX_TGSI_PREDS);
          for (i = 0; i < NUM_CHANNELS; i++)
-            bld->preds[idx][i] = lp_build_alloca(bld->base.builder,
-                                                 vec_type, "predicate");
+            bld->preds[idx][i] = lp_build_alloca(gallivm, vec_type,
+                                                 "predicate");
          break;
 
       default:
@@ -1657,7 +1691,7 @@ emit_instruction(
          src0 = emit_fetch( bld, inst, 0, chan_index );
          src1 = emit_fetch( bld, inst, 1, chan_index );
          src2 = emit_fetch( bld, inst, 2, chan_index );
-         tmp1 = lp_build_const_vec(bld->base.type, 0.5);
+         tmp1 = lp_build_const_vec(bld->base.gallivm, bld->base.type, 0.5);
          tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_GREATER, src2, tmp1);
          dst0[chan_index] = lp_build_select( &bld->base, tmp0, src0, src1 );
       }
@@ -2169,7 +2203,7 @@ emit_instruction(
       break;
 
    case TGSI_OPCODE_ENDLOOP:
-      lp_exec_endloop(&bld->exec_mask);
+      lp_exec_endloop(bld->base.gallivm, &bld->exec_mask);
       break;
 
    case TGSI_OPCODE_ENDSUB:
@@ -2302,7 +2336,7 @@ emit_instruction(
 
 
 void
-lp_build_tgsi_soa(LLVMBuilderRef builder,
+lp_build_tgsi_soa(struct gallivm_state *gallivm,
                   const struct tgsi_token *tokens,
                   struct lp_type type,
                   struct lp_build_mask_context *mask,
@@ -2331,9 +2365,9 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
 
    /* Setup build context */
    memset(&bld, 0, sizeof bld);
-   lp_build_context_init(&bld.base, builder, type);
-   lp_build_context_init(&bld.uint_bld, builder, lp_uint_type(type));
-   lp_build_context_init(&bld.elem_bld, builder, lp_elem_type(type));
+   lp_build_context_init(&bld.base, gallivm, type);
+   lp_build_context_init(&bld.uint_bld, gallivm, lp_uint_type(type));
+   lp_build_context_init(&bld.elem_bld, gallivm, lp_elem_type(type));
    bld.mask = mask;
    bld.pos = pos;
    bld.inputs = inputs;
@@ -2353,17 +2387,19 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
    lp_exec_mask_init(&bld.exec_mask, &bld.base);
 
    if (bld.indirect_files & (1 << TGSI_FILE_TEMPORARY)) {
-      LLVMValueRef array_size = LLVMConstInt(LLVMInt32Type(),
-                                             info->file_max[TGSI_FILE_TEMPORARY]*4 + 4, 0);
-      bld.temps_array = lp_build_array_alloca(bld.base.builder,
+      LLVMValueRef array_size =
+         lp_build_const_int32(gallivm,
+                              info->file_max[TGSI_FILE_TEMPORARY] * 4 + 4);
+      bld.temps_array = lp_build_array_alloca(gallivm,
                                               bld.base.vec_type, array_size,
                                               "temp_array");
    }
 
    if (bld.indirect_files & (1 << TGSI_FILE_OUTPUT)) {
-      LLVMValueRef array_size = LLVMConstInt(LLVMInt32Type(),
-                                             info->file_max[TGSI_FILE_OUTPUT]*4 + 4, 0);
-      bld.outputs_array = lp_build_array_alloca(bld.base.builder,
+      LLVMValueRef array_size =
+         lp_build_const_int32(gallivm,
+                              info->file_max[TGSI_FILE_OUTPUT] * 4 + 4);
+      bld.outputs_array = lp_build_array_alloca(gallivm,
                                                 bld.base.vec_type, array_size,
                                                 "output_array");
    }
@@ -2373,9 +2409,9 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
    if (bld.indirect_files & (1 << TGSI_FILE_INPUT)) {
       unsigned index, chan;
       LLVMTypeRef vec_type = bld.base.vec_type;
-      LLVMValueRef array_size = LLVMConstInt(LLVMInt32Type(),
-                                             info->file_max[TGSI_FILE_INPUT]*4 + 4, 0);
-      bld.inputs_array = lp_build_array_alloca(bld.base.builder,
+      LLVMValueRef array_size =
+         lp_build_const_int32(gallivm, info->file_max[TGSI_FILE_INPUT]*4 + 4);
+      bld.inputs_array = lp_build_array_alloca(gallivm,
                                                vec_type, array_size,
                                                "input_array");
 
@@ -2383,13 +2419,14 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
 
       for (index = 0; index < info->num_inputs; ++index) {
          for (chan = 0; chan < NUM_CHANNELS; ++chan) {
-            LLVMValueRef lindex = lp_build_const_int32(index * 4 + chan);
+            LLVMValueRef lindex =
+               lp_build_const_int32(gallivm, index * 4 + chan);
             LLVMValueRef input_ptr =
-               LLVMBuildGEP(bld.base.builder, bld.inputs_array,
+               LLVMBuildGEP(gallivm->builder, bld.inputs_array,
                             &lindex, 1, "");
             LLVMValueRef value = bld.inputs[index][chan];
             if (value)
-               LLVMBuildStore(bld.base.builder, value, input_ptr);
+               LLVMBuildStore(gallivm->builder, value, input_ptr);
          }
       }
    }
@@ -2441,7 +2478,7 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
             assert(num_immediates < LP_MAX_TGSI_IMMEDIATES);
             for( i = 0; i < size; ++i )
                bld.immediates[num_immediates][i] =
-                  lp_build_const_vec(type, parse.FullToken.FullImmediate.u[i].Float);
+                  lp_build_const_vec(gallivm, type, parse.FullToken.FullImmediate.u[i].Float);
             for( i = size; i < 4; ++i )
                bld.immediates[num_immediates][i] = bld.base.undef;
             num_immediates++;
@@ -2478,7 +2515,7 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
    }
 
    if (0) {
-      LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
+      LLVMBasicBlockRef block = LLVMGetInsertBlock(gallivm->builder);
       LLVMValueRef function = LLVMGetBasicBlockParent(block);
       debug_printf("11111111111111111111111111111 \n");
       tgsi_dump(tokens, 0);
@@ -2489,7 +2526,7 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
 
    if (0) {
       LLVMModuleRef module = LLVMGetGlobalParent(
-         LLVMGetBasicBlockParent(LLVMGetInsertBlock(bld.base.builder)));
+         LLVMGetBasicBlockParent(LLVMGetInsertBlock(gallivm->builder)));
       LLVMDumpModule(module);
 
    }
@@ -2515,24 +2552,25 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
  * \return  LLVM float array (interpreted as float [][4])
  */
 LLVMValueRef
-lp_build_system_values_array(LLVMBuilderRef builder,
+lp_build_system_values_array(struct gallivm_state *gallivm,
                              const struct tgsi_shader_info *info,
                              LLVMValueRef instance_id,
                              LLVMValueRef facing)
 {
-   LLVMValueRef size = lp_build_const_int32(4 * info->num_system_values);
-   LLVMValueRef array = lp_build_array_alloca(builder, LLVMFloatType(),
+   LLVMValueRef size = lp_build_const_int32(gallivm, 4 * info->num_system_values);
+   LLVMTypeRef float_t = LLVMFloatTypeInContext(gallivm->context);
+   LLVMValueRef array = lp_build_array_alloca(gallivm, float_t,
                                               size, "sysvals_array");
    unsigned i;
 
    for (i = 0; i < info->num_system_values; i++) {
-      LLVMValueRef index = lp_build_const_int32(i * 4);
+      LLVMValueRef index = lp_build_const_int32(gallivm, i * 4);
       LLVMValueRef ptr, value;
 
       switch (info->system_value_semantic_name[i]) {
       case TGSI_SEMANTIC_INSTANCEID:
          /* convert instance ID from int to float */
-         value = LLVMBuildSIToFP(builder, instance_id, LLVMFloatType(),
+         value = LLVMBuildSIToFP(gallivm->builder, instance_id, float_t,
                                  "sysval_instanceid");
          break;
       case TGSI_SEMANTIC_FACE:
@@ -2541,8 +2579,8 @@ lp_build_system_values_array(LLVMBuilderRef builder,
          assert(0 && "unexpected semantic in build_system_values_array()");
       }
 
-      ptr = LLVMBuildGEP(builder, array, &index, 1, "");
-      LLVMBuildStore(builder, value, ptr);
+      ptr = LLVMBuildGEP(gallivm->builder, array, &index, 1, "");
+      LLVMBuildStore(gallivm->builder, value, ptr);
    }
       
    return array;
index 5205c7ada91ae284ce86a8ba7e58f81b7ab21529..c5cf6d4a6c4f85480287f7750304996b3e18fbf4 100644 (file)
 
 #include "lp_bld_type.h"
 #include "lp_bld_const.h"
+#include "lp_bld_init.h"
 
 
 LLVMTypeRef
-lp_build_elem_type(struct lp_type type)
+lp_build_elem_type(struct gallivm_state *gallivm, struct lp_type type)
 {
    if (type.floating) {
       switch(type.width) {
       case 32:
-         return LLVMFloatType();
+         return LLVMFloatTypeInContext(gallivm->context);
          break;
       case 64:
-         return LLVMDoubleType();
+         return LLVMDoubleTypeInContext(gallivm->context);
          break;
       default:
          assert(0);
-         return LLVMFloatType();
+         return LLVMFloatTypeInContext(gallivm->context);
       }
    }
    else {
-      return LLVMIntType(type.width);
+      return LLVMIntTypeInContext(gallivm->context, type.width);
    }
 }
 
 
 LLVMTypeRef
-lp_build_vec_type(struct lp_type type)
+lp_build_vec_type(struct gallivm_state *gallivm,struct lp_type type)
 {
-   LLVMTypeRef elem_type = lp_build_elem_type(type);
+   LLVMTypeRef elem_type = lp_build_elem_type(gallivm, type);
    if (type.length == 1)
       return elem_type;
    else
@@ -149,16 +150,16 @@ lp_check_value(struct lp_type type, LLVMValueRef val)
 
 
 LLVMTypeRef
-lp_build_int_elem_type(struct lp_type type)
+lp_build_int_elem_type(struct gallivm_state *gallivm, struct lp_type type)
 {
-   return LLVMIntType(type.width);
+   return LLVMIntTypeInContext(gallivm->context, type.width);
 }
 
 
 LLVMTypeRef
-lp_build_int_vec_type(struct lp_type type)
+lp_build_int_vec_type(struct gallivm_state *gallivm, struct lp_type type)
 {
-   LLVMTypeRef elem_type = lp_build_int_elem_type(type);
+   LLVMTypeRef elem_type = lp_build_int_elem_type(gallivm, type);
    if (type.length == 1)
       return elem_type;
    else
@@ -170,7 +171,7 @@ lp_build_int_vec_type(struct lp_type type)
  * Build int32[4] vector type
  */
 LLVMTypeRef
-lp_build_int32_vec4_type(void)
+lp_build_int32_vec4_type(struct gallivm_state *gallivm)
 {
    struct lp_type t;
    LLVMTypeRef type;
@@ -182,7 +183,7 @@ lp_build_int32_vec4_type(void)
    t.width = 32;       /* 32-bit int */
    t.length = 4;       /* 4 elements per vector */
 
-   type = lp_build_int_elem_type(t);
+   type = lp_build_int_elem_type(gallivm, t);
    return LLVMVectorType(type, t.length);
 }
 
@@ -383,15 +384,15 @@ lp_dump_llvmtype(LLVMTypeRef t)
 
 void
 lp_build_context_init(struct lp_build_context *bld,
-                      LLVMBuilderRef builder,
+                      struct gallivm_state *gallivm,
                       struct lp_type type)
 {
-   bld->builder = builder;
+   bld->gallivm = gallivm;
    bld->type = type;
 
-   bld->int_elem_type = lp_build_int_elem_type(type);
+   bld->int_elem_type = lp_build_int_elem_type(gallivm, type);
    if (type.floating)
-      bld->elem_type = lp_build_elem_type(type);
+      bld->elem_type = lp_build_elem_type(gallivm, type);
    else
       bld->elem_type = bld->int_elem_type;
 
@@ -406,5 +407,5 @@ lp_build_context_init(struct lp_build_context *bld,
 
    bld->undef = LLVMGetUndef(bld->vec_type);
    bld->zero = LLVMConstNull(bld->vec_type);
-   bld->one = lp_build_one(type);
+   bld->one = lp_build_one(gallivm, type);
 }
index a135d0df847d9885a024aea355ec8474c36ba0bc..5007e83ac5f28a1a0739a653170a3fd813cc390b 100644 (file)
@@ -120,7 +120,7 @@ struct lp_type {
  */
 struct lp_build_context
 {
-   LLVMBuilderRef builder;
+   struct gallivm_state *gallivm;
 
    /**
     * This not only describes the input/output LLVM types, but also whether
@@ -285,11 +285,11 @@ lp_type_ufixed(unsigned width)
 
 
 LLVMTypeRef
-lp_build_elem_type(struct lp_type type);
+lp_build_elem_type(struct gallivm_state *gallivm, struct lp_type type);
 
 
 LLVMTypeRef
-lp_build_vec_type(struct lp_type type);
+lp_build_vec_type(struct gallivm_state *gallivm, struct lp_type type);
 
 
 boolean
@@ -305,15 +305,15 @@ lp_check_value(struct lp_type type, LLVMValueRef val);
 
 
 LLVMTypeRef
-lp_build_int_elem_type(struct lp_type type);
+lp_build_int_elem_type(struct gallivm_state *gallivm, struct lp_type type);
 
 
 LLVMTypeRef
-lp_build_int_vec_type(struct lp_type type);
+lp_build_int_vec_type(struct gallivm_state *gallivm, struct lp_type type);
 
 
 LLVMTypeRef
-lp_build_int32_vec4_type(void);
+lp_build_int32_vec4_type(struct gallivm_state *gallivm);
 
 
 static INLINE struct lp_type
@@ -394,7 +394,7 @@ lp_dump_llvmtype(LLVMTypeRef t);
 
 void
 lp_build_context_init(struct lp_build_context *bld,
-                      LLVMBuilderRef builder,
+                      struct gallivm_state *gallivm,
                       struct lp_type type);
 
 
diff --git a/src/gallium/auxiliary/target-helpers/inline_noop_helper.h b/src/gallium/auxiliary/target-helpers/inline_noop_helper.h
new file mode 100644 (file)
index 0000000..77c7cfd
--- /dev/null
@@ -0,0 +1,51 @@
+
+#ifndef INLINE_DEBUG_HELPER_H
+#define INLINE_DEBUG_HELPER_H
+
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+
+
+/* Helper function to wrap a screen with
+ * one or more debug driver: rbug, trace.
+ */
+
+#ifdef GALLIUM_TRACE
+#include "trace/tr_public.h"
+#endif
+
+#ifdef GALLIUM_RBUG
+#include "rbug/rbug_public.h"
+#endif
+
+#ifdef GALLIUM_GALAHAD
+#include "galahad/glhd_public.h"
+#endif
+
+#ifdef GALLIUM_NOOP
+#include "noop/noop_public.h"
+#endif
+
+static INLINE struct pipe_screen *
+debug_screen_wrap(struct pipe_screen *screen)
+{
+#if defined(GALLIUM_RBUG)
+   screen = rbug_screen_create(screen);
+#endif
+
+#if defined(GALLIUM_TRACE)
+   screen = trace_screen_create(screen);
+#endif
+
+#if defined(GALLIUM_GALAHAD)
+   screen = galahad_screen_create(screen);
+#endif
+
+#if defined(GALLIUM_NOOP)
+   screen = noop_screen_create(screen);
+#endif
+
+   return screen;
+}
+
+#endif
index 77bde86684efc68f7608cf2bc83896fdb3d86177..82cd8eaa969b03f4236adf12aca127b0f23821df 100644 (file)
@@ -138,7 +138,7 @@ static const char *immediate_type_names[] =
 };
 
 const char *
-tgsi_swizzle_names[] =
+tgsi_swizzle_names[4] =
 {
    "x",
    "y",
@@ -147,7 +147,7 @@ tgsi_swizzle_names[] =
 };
 
 const char *
-tgsi_texture_names[] =
+tgsi_texture_names[TGSI_TEXTURE_COUNT] =
 {
    "UNKNOWN",
    "1D",
@@ -160,16 +160,17 @@ tgsi_texture_names[] =
    "SHADOWRECT"
 };
 
-static const char *property_names[] =
+const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
 {
    "GS_INPUT_PRIMITIVE",
    "GS_OUTPUT_PRIMITIVE",
    "GS_MAX_OUTPUT_VERTICES",
    "FS_COORD_ORIGIN",
-   "FS_COORD_PIXEL_CENTER"
+   "FS_COORD_PIXEL_CENTER",
+   "FS_COLOR0_WRITES_ALL_CBUFS",
 };
 
-static const char *primitive_names[] =
+const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
 {
    "POINTS",
    "LINES",
@@ -187,13 +188,13 @@ static const char *primitive_names[] =
    "TRIANGLE_STRIP_ADJACENCY"
 };
 
-static const char *fs_coord_origin_names[] =
+const char *tgsi_fs_coord_origin_names[2] =
 {
    "UPPER_LEFT",
    "LOWER_LEFT"
 };
 
-static const char *fs_coord_pixel_center_names[] =
+const char *tgsi_fs_coord_pixel_center_names[2] =
 {
    "HALF_INTEGER",
    "INTEGER"
@@ -484,10 +485,10 @@ iter_property(
    int i;
    struct dump_ctx *ctx = (struct dump_ctx *)iter;
 
-   assert(Elements(property_names) == TGSI_PROPERTY_COUNT);
+   assert(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
 
    TXT( "PROPERTY " );
-   ENM(prop->Property.PropertyName, property_names);
+   ENM(prop->Property.PropertyName, tgsi_property_names);
 
    if (prop->Property.NrTokens > 1)
       TXT(" ");
@@ -496,13 +497,13 @@ iter_property(
       switch (prop->Property.PropertyName) {
       case TGSI_PROPERTY_GS_INPUT_PRIM:
       case TGSI_PROPERTY_GS_OUTPUT_PRIM:
-         ENM(prop->u[i].Data, primitive_names);
+         ENM(prop->u[i].Data, tgsi_primitive_names);
          break;
       case TGSI_PROPERTY_FS_COORD_ORIGIN:
-         ENM(prop->u[i].Data, fs_coord_origin_names);
+         ENM(prop->u[i].Data, tgsi_fs_coord_origin_names);
          break;
       case TGSI_PROPERTY_FS_COORD_PIXEL_CENTER:
-         ENM(prop->u[i].Data, fs_coord_pixel_center_names);
+         ENM(prop->u[i].Data, tgsi_fs_coord_pixel_center_names);
          break;
       default:
          SID( prop->u[i].Data );
index fc0429ad8d9246adcce808c48c0abe2cf03f3b8b..2491e9198a2a09c76b183d271fcec25b0629a366 100644 (file)
@@ -29,6 +29,7 @@
 #define TGSI_DUMP_H
 
 #include "pipe/p_compiler.h"
+#include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
 
 #if defined __cplusplus
@@ -39,10 +40,22 @@ extern const char *
 tgsi_file_names[TGSI_FILE_COUNT];
 
 extern const char *
-tgsi_swizzle_names[];
+tgsi_swizzle_names[4];
 
 extern const char *
-tgsi_texture_names[];
+tgsi_texture_names[TGSI_TEXTURE_COUNT];
+
+extern const char *
+tgsi_property_names[TGSI_PROPERTY_COUNT];
+
+extern const char *
+tgsi_primitive_names[PIPE_PRIM_MAX];
+
+extern const char *
+tgsi_fs_coord_origin_names[2];
+
+extern const char *
+tgsi_fs_coord_pixel_center_names[2];
 
 void
 tgsi_dump_str(
index d4df5851764e91664e02747ad1c6635ab934767a..2aafa2a6e839a536f87569da924dbda812834e31 100644 (file)
@@ -136,7 +136,8 @@ tgsi_parse_token(
 static INLINE unsigned
 tgsi_num_tokens(const struct tgsi_token *tokens)
 {
-   struct tgsi_header header = *(const struct tgsi_header *) tokens;
+   struct tgsi_header header;
+   memcpy(&header, tokens, sizeof(header));
    return header.HeaderSize + header.BodySize;
 }
 
index 73f0f414e3f4756ffceb504145e53722e6829254..707d11ec6dd985b0a9f990ad241cfe6d83b873c9 100644 (file)
 #ifndef TGSI_SANITY_H
 #define TGSI_SANITY_H
 
-#include "pipe/p_shader_tokens.h"
-
 #if defined __cplusplus
 extern "C" {
 #endif
 
+#include "pipe/p_compiler.h"
+
+struct tgsi_token;
+
 /* Check the given token stream for errors and common mistakes.
  * Diagnostic messages are printed out to the debug output, and is
  * controlled by the debug option TGSI_PRINT_SANITY (default false).
index 9a38c37979cc34afc87f525ebdff14eb9f895323..819b0725a1faaea9e9edd354ea2c76fbb18c93ad 100644 (file)
@@ -36,6 +36,7 @@
 #include "tgsi_parse.h"
 #include "tgsi_sanity.h"
 #include "tgsi_util.h"
+#include "tgsi_dump.h"
 
 static boolean is_alpha_underscore( const char *cur )
 {
@@ -1258,42 +1259,6 @@ static boolean parse_immediate( struct translate_ctx *ctx )
    return TRUE;
 }
 
-static const char *property_names[] =
-{
-   "GS_INPUT_PRIMITIVE",
-   "GS_OUTPUT_PRIMITIVE",
-   "GS_MAX_OUTPUT_VERTICES",
-   "FS_COORD_ORIGIN",
-   "FS_COORD_PIXEL_CENTER"
-};
-
-static const char *primitive_names[] =
-{
-   "POINTS",
-   "LINES",
-   "LINE_LOOP",
-   "LINE_STRIP",
-   "TRIANGLES",
-   "TRIANGLE_STRIP",
-   "TRIANGLE_FAN",
-   "QUADS",
-   "QUAD_STRIP",
-   "POLYGON"
-};
-
-static const char *fs_coord_origin_names[] =
-{
-   "UPPER_LEFT",
-   "LOWER_LEFT"
-};
-
-static const char *fs_coord_pixel_center_names[] =
-{
-   "HALF_INTEGER",
-   "INTEGER"
-};
-
-
 static boolean
 parse_primitive( const char **pcur, uint *primitive )
 {
@@ -1302,7 +1267,7 @@ parse_primitive( const char **pcur, uint *primitive )
    for (i = 0; i < PIPE_PRIM_MAX; i++) {
       const char *cur = *pcur;
 
-      if (str_match_no_case( &cur, primitive_names[i])) {
+      if (str_match_no_case( &cur, tgsi_primitive_names[i])) {
          *primitive = i;
          *pcur = cur;
          return TRUE;
@@ -1316,10 +1281,10 @@ parse_fs_coord_origin( const char **pcur, uint *fs_coord_origin )
 {
    uint i;
 
-   for (i = 0; i < sizeof(fs_coord_origin_names) / sizeof(fs_coord_origin_names[0]); i++) {
+   for (i = 0; i < Elements(tgsi_fs_coord_origin_names); i++) {
       const char *cur = *pcur;
 
-      if (str_match_no_case( &cur, fs_coord_origin_names[i])) {
+      if (str_match_no_case( &cur, tgsi_fs_coord_origin_names[i])) {
          *fs_coord_origin = i;
          *pcur = cur;
          return TRUE;
@@ -1333,10 +1298,10 @@ parse_fs_coord_pixel_center( const char **pcur, uint *fs_coord_pixel_center )
 {
    uint i;
 
-   for (i = 0; i < sizeof(fs_coord_pixel_center_names) / sizeof(fs_coord_pixel_center_names[0]); i++) {
+   for (i = 0; i < Elements(tgsi_fs_coord_pixel_center_names); i++) {
       const char *cur = *pcur;
 
-      if (str_match_no_case( &cur, fs_coord_pixel_center_names[i])) {
+      if (str_match_no_case( &cur, tgsi_fs_coord_pixel_center_names[i])) {
          *fs_coord_pixel_center = i;
          *pcur = cur;
          return TRUE;
@@ -1364,7 +1329,7 @@ static boolean parse_property( struct translate_ctx *ctx )
    }
    for (property_name = 0; property_name < TGSI_PROPERTY_COUNT;
         ++property_name) {
-      if (streq_nocase_uprcase(property_names[property_name], id)) {
+      if (streq_nocase_uprcase(tgsi_property_names[property_name], id)) {
          break;
       }
    }
@@ -1398,6 +1363,7 @@ static boolean parse_property( struct translate_ctx *ctx )
          return FALSE;
       }
       break;
+   case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS:
    default:
       if (!parse_uint(&ctx->cur, &values[0] )) {
          report_error( ctx, "Expected unsigned integer as property!" );
index 8eeeeef1402800d726df9a8823f4b6dfa60e8ecb..5fe53cf007de2f6053bcfe0114ecff5845bb6053 100644 (file)
 #ifndef TGSI_TEXT_H
 #define TGSI_TEXT_H
 
-#include "pipe/p_shader_tokens.h"
-
 #if defined __cplusplus
 extern "C" {
 #endif
 
+#include "pipe/p_compiler.h"
+
+struct tgsi_token;
+
 boolean
 tgsi_text_translate(
    const char *text,
index 7d13a17bdbc35c3233b5a49c450411a732e00766..02de12d77d50d1bda18fed5b275b3c9a36818b57 100644 (file)
@@ -148,6 +148,7 @@ struct ureg_program
    unsigned property_gs_max_vertices;
    unsigned char property_fs_coord_origin; /* = TGSI_FS_COORD_ORIGIN_* */
    unsigned char property_fs_coord_pixel_center; /* = TGSI_FS_COORD_PIXEL_CENTER_* */
+   unsigned char property_fs_color0_writes_all_cbufs; /* = TGSI_FS_COLOR0_WRITES_ALL_CBUFS * */
 
    unsigned nr_addrs;
    unsigned nr_preds;
@@ -284,7 +285,12 @@ ureg_property_fs_coord_pixel_center(struct ureg_program *ureg,
    ureg->property_fs_coord_pixel_center = fs_coord_pixel_center;
 }
 
-
+void
+ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg,
+                            unsigned fs_color0_writes_all_cbufs)
+{
+   ureg->property_fs_color0_writes_all_cbufs = fs_color0_writes_all_cbufs;
+}
 
 struct ureg_src
 ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg,
@@ -1278,6 +1284,14 @@ static void emit_decls( struct ureg_program *ureg )
                     ureg->property_fs_coord_pixel_center);
    }
 
+   if (ureg->property_fs_color0_writes_all_cbufs) {
+      assert(ureg->processor == TGSI_PROCESSOR_FRAGMENT);
+
+      emit_property(ureg,
+                    TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS,
+                    ureg->property_fs_color0_writes_all_cbufs);
+   }
+
    if (ureg->processor == TGSI_PROCESSOR_VERTEX) {
       for (i = 0; i < UREG_MAX_INPUT; i++) {
          if (ureg->vs_inputs[i/32] & (1 << (i%32))) {
index acc463200a66a782345db355101750983e968235..807128a5e52d77fca870239f77575924b60ab9d5 100644 (file)
@@ -153,6 +153,10 @@ void
 ureg_property_fs_coord_pixel_center(struct ureg_program *ureg,
                             unsigned fs_coord_pixel_center);
 
+void
+ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg,
+                            unsigned fs_color0_writes_all_cbufs);
+
 /***********************************************************************
  * Build shader declarations:
  */
index dfb142b9e1cc92b8074b99b1fc36a5ff18c29ca6..c11f7d383db7e62b2c2fb301e6fd6815113fdb40 100644 (file)
@@ -291,7 +291,7 @@ regions_overlap(int srcX0, int srcY0,
 void
 util_blit_pixels_writemask(struct blit_state *ctx,
                            struct pipe_resource *src_tex,
-                           struct pipe_subresource srcsub,
+                           unsigned src_level,
                            int srcX0, int srcY0,
                            int srcX1, int srcY1,
                            int srcZ0,
@@ -316,13 +316,12 @@ util_blit_pixels_writemask(struct blit_state *ctx,
    assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
           filter == PIPE_TEX_MIPFILTER_LINEAR);
 
-   assert(srcsub.level <= src_tex->last_level);
+   assert(src_level <= src_tex->last_level);
 
    /* do the regions overlap? */
    overlap = src_tex == dst->texture &&
-             dst->face == srcsub.face &&
-             dst->level == srcsub.level &&
-             dst->zslice == srcZ0 &&
+             dst->u.tex.level == src_level &&
+             dst->u.tex.first_layer == srcZ0 &&
       regions_overlap(srcX0, srcY0, srcX1, srcY1,
                       dstX0, dstY0, dstX1, dstY1);
 
@@ -339,16 +338,19 @@ util_blit_pixels_writemask(struct blit_state *ctx,
        (dstX1 - dstX0) == (srcX1 - srcX0) &&
        (dstY1 - dstY0) == (srcY1 - srcY0) &&
        !overlap) {
-      struct pipe_subresource subdst;
-      subdst.face = dst->face;
-      subdst.level = dst->level;
+      struct pipe_box src_box;
+      src_box.x = srcX0;
+      src_box.y = srcY0;
+      src_box.z = srcZ0;
+      src_box.width = srcW;
+      src_box.height = srcH;
+      src_box.depth = 1;
       pipe->resource_copy_region(pipe,
-                                 dst->texture, subdst,
-                                 dstX0, dstY0, dst->zslice,/* dest */
-                                 src_tex, srcsub,
-                                 srcX0, srcY0, srcZ0,/* src */
-                                 srcW, srcH);       /* size */
-      return;
+                                 dst->texture, dst->u.tex.level,
+                                 dstX0, dstY0, dst->u.tex.first_layer,/* dest */
+                                 src_tex, src_level,
+                                 &src_box);
+       return;
    }
 
    /* Create a temporary texture when src and dest alias or when src
@@ -359,16 +361,16 @@ util_blit_pixels_writemask(struct blit_state *ctx,
     * This can still be improved upon.
     */
    if ((src_tex == dst->texture &&
-       dst->face == srcsub.face &&
-       dst->level == srcsub.level &&
-       dst->zslice == srcZ0) ||
+       dst->u.tex.level == src_level &&
+       dst->u.tex.first_layer == srcZ0) ||
        (src_tex->target != PIPE_TEXTURE_2D &&
+       src_tex->target != PIPE_TEXTURE_2D &&
        src_tex->target != PIPE_TEXTURE_RECT))
    {
       struct pipe_resource texTemp;
       struct pipe_resource *tex;
       struct pipe_sampler_view sv_templ;
-      struct pipe_subresource texsub;
+      struct pipe_box src_box;
       const int srcLeft = MIN2(srcX0, srcX1);
       const int srcTop = MIN2(srcY0, srcY1);
 
@@ -394,19 +396,23 @@ util_blit_pixels_writemask(struct blit_state *ctx,
       texTemp.width0 = srcW;
       texTemp.height0 = srcH;
       texTemp.depth0 = 1;
+      texTemp.array_size = 1;
       texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
       tex = screen->resource_create(screen, &texTemp);
       if (!tex)
          return;
 
-      texsub.face = 0;
-      texsub.level = 0;
+      src_box.x = srcLeft;
+      src_box.y = srcTop;
+      src_box.z = srcZ0;
+      src_box.width = srcW;
+      src_box.height = srcH;
+      src_box.depth = 1;
       /* load temp texture */
       pipe->resource_copy_region(pipe,
-                                 tex, texsub, 0, 0, 0,  /* dest */
-                                 src_tex, srcsub, srcLeft, srcTop, srcZ0, /* src */
-                                 srcW, srcH);     /* size */
+                                 tex, 0, 0, 0, 0,  /* dest */
+                                 src_tex, src_level, &src_box);
 
       normalized = tex->target != PIPE_TEXTURE_RECT;
       if(normalized) {
@@ -433,7 +439,6 @@ util_blit_pixels_writemask(struct blit_state *ctx,
    }
    else {
       u_sampler_view_default_template(&sv_templ, src_tex, src_tex->format);
-      sv_templ.first_level = sv_templ.last_level = srcsub.level;
       sampler_view = pipe->create_sampler_view(pipe, src_tex, &sv_templ);
 
       if (!sampler_view) {
@@ -447,10 +452,10 @@ util_blit_pixels_writemask(struct blit_state *ctx,
       normalized = sampler_view->texture->target != PIPE_TEXTURE_RECT;
       if(normalized)
       {
-         s0 /= (float)(u_minify(sampler_view->texture->width0, srcsub.level));
-         s1 /= (float)(u_minify(sampler_view->texture->width0, srcsub.level));
-         t0 /= (float)(u_minify(sampler_view->texture->height0, srcsub.level));
-         t1 /= (float)(u_minify(sampler_view->texture->height0, srcsub.level));
+         s0 /= (float)(u_minify(sampler_view->texture->width0, src_level));
+         s1 /= (float)(u_minify(sampler_view->texture->width0, src_level));
+         t0 /= (float)(u_minify(sampler_view->texture->height0, src_level));
+         t1 /= (float)(u_minify(sampler_view->texture->height0, src_level));
       }
    }
 
@@ -489,9 +494,8 @@ util_blit_pixels_writemask(struct blit_state *ctx,
    ctx->sampler.normalized_coords = normalized;
    ctx->sampler.min_img_filter = filter;
    ctx->sampler.mag_img_filter = filter;
-   /* we've limited this already with the sampler view but you never know... */
-   ctx->sampler.min_lod = srcsub.level;
-   ctx->sampler.max_lod = srcsub.level;
+   ctx->sampler.min_lod = src_level;
+   ctx->sampler.max_lod = src_level;
    cso_single_sampler(ctx->cso, 0, &ctx->sampler);
    cso_single_sampler_done(ctx->cso);
 
@@ -575,7 +579,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
 void
 util_blit_pixels(struct blit_state *ctx,
                  struct pipe_resource *src_tex,
-                 struct pipe_subresource srcsub,
+                 unsigned src_level,
                  int srcX0, int srcY0,
                  int srcX1, int srcY1,
                  int srcZ,
@@ -585,7 +589,7 @@ util_blit_pixels(struct blit_state *ctx,
                  float z, uint filter )
 {
    util_blit_pixels_writemask( ctx, src_tex,
-                               srcsub,
+                               src_level,
                                srcX0, srcY0,
                                srcX1, srcY1,
                                srcZ,
@@ -662,6 +666,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
    cso_save_rasterizer(ctx->cso);
    cso_save_samplers(ctx->cso);
    cso_save_fragment_sampler_views(ctx->cso);
+   cso_save_viewport(ctx->cso);
    cso_save_framebuffer(ctx->cso);
    cso_save_fragment_shader(ctx->cso);
    cso_save_vertex_shader(ctx->cso);
@@ -729,6 +734,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
    cso_restore_rasterizer(ctx->cso);
    cso_restore_samplers(ctx->cso);
    cso_restore_fragment_sampler_views(ctx->cso);
+   cso_restore_viewport(ctx->cso);
    cso_restore_framebuffer(ctx->cso);
    cso_restore_fragment_shader(ctx->cso);
    cso_restore_vertex_shader(ctx->cso);
index b8a0dfce13f443b5c4634f9d256897cf86053698..3009e25eca3d4107e40d0b94b80769c70a637e52 100644 (file)
@@ -42,7 +42,6 @@ struct cso_context;
 struct pipe_context;
 struct pipe_resource;
 struct pipe_sampler_view;
-struct pipe_subresource;
 struct pipe_surface;
 
 
@@ -55,7 +54,7 @@ util_destroy_blit(struct blit_state *ctx);
 extern void
 util_blit_pixels(struct blit_state *ctx,
                  struct pipe_resource *src_tex,
-                 struct pipe_subresource srcsub,
+                 unsigned src_level,
                  int srcX0, int srcY0,
                  int srcX1, int srcY1,
                  int srcZ0,
@@ -67,7 +66,7 @@ util_blit_pixels(struct blit_state *ctx,
 void
 util_blit_pixels_writemask(struct blit_state *ctx,
                            struct pipe_resource *src_tex,
-                           struct pipe_subresource srcsub,
+                           unsigned src_level,
                            int srcX0, int srcY0,
                            int srcX1, int srcY1,
                            int srcZ0,
index a163f93cb826fec91a99f1eb43c7a7c9756e33d6..545021d2642bb319bbe2e8d6c127997bd1f9aed1 100644 (file)
@@ -63,8 +63,7 @@ struct blitter_context_priv
 
    /* Constant state objects. */
    /* Vertex shaders. */
-   void *vs_col; /**< Vertex shader which passes {pos, color} to the output */
-   void *vs_tex; /**< Vertex shader which passes {pos, texcoord} to the output.*/
+   void *vs; /**< Vertex shader which passes {pos, generic} to the output.*/
 
    /* Fragment shaders. */
    /* The shader at index i outputs color to color buffers 0,1,...,i-1. */
@@ -211,20 +210,12 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
 
    /* fragment shaders are created on-demand */
 
-   /* vertex shaders */
-   {
-      const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
-                                      TGSI_SEMANTIC_COLOR };
-      const uint semantic_indices[] = { 0, 0 };
-      ctx->vs_col =
-         util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
-                                             semantic_indices);
-   }
+   /* vertex shader */
    {
       const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
                                       TGSI_SEMANTIC_GENERIC };
       const uint semantic_indices[] = { 0, 0 };
-      ctx->vs_tex =
+      ctx->vs =
          util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
                                              semantic_indices);
    }
@@ -257,8 +248,7 @@ void util_blitter_destroy(struct blitter_context *blitter)
    pipe->delete_depth_stencil_alpha_state(pipe, ctx->dsa_flush_depth_stencil);
 
    pipe->delete_rasterizer_state(pipe, ctx->rs_state);
-   pipe->delete_vs_state(pipe, ctx->vs_col);
-   pipe->delete_vs_state(pipe, ctx->vs_tex);
+   pipe->delete_vs_state(pipe, ctx->vs);
    pipe->delete_vertex_elements_state(pipe, ctx->velem_state);
 
    for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) {
@@ -419,17 +409,17 @@ static void blitter_set_clear_color(struct blitter_context_priv *ctx,
 }
 
 static void get_texcoords(struct pipe_resource *src,
-                                     struct pipe_subresource subsrc,
-                                     unsigned x1, unsigned y1,
-                                     unsigned x2, unsigned y2,
-                                     boolean normalized, float out[4])
+                          unsigned level,
+                          unsigned x1, unsigned y1,
+                          unsigned x2, unsigned y2,
+                          boolean normalized, float out[4])
 {
    if(normalized)
    {
-      out[0] = x1 / (float)u_minify(src->width0,  subsrc.level);
-      out[1] = y1 / (float)u_minify(src->height0, subsrc.level);
-      out[2] = x2 / (float)u_minify(src->width0,  subsrc.level);
-      out[3] = y2 / (float)u_minify(src->height0, subsrc.level);
+      out[0] = x1 / (float)u_minify(src->width0,  level);
+      out[1] = y1 / (float)u_minify(src->height0, level);
+      out[2] = x2 / (float)u_minify(src->width0,  level);
+      out[3] = y2 / (float)u_minify(src->height0, level);
    }
    else
    {
@@ -458,14 +448,14 @@ static void set_texcoords_in_vertices(const float coord[4],
 
 static void blitter_set_texcoords_2d(struct blitter_context_priv *ctx,
                                      struct pipe_resource *src,
-                                     struct pipe_subresource subsrc,
+                                     unsigned level,
                                      unsigned x1, unsigned y1,
                                      unsigned x2, unsigned y2)
 {
    unsigned i;
    float coord[4];
 
-   get_texcoords(src, subsrc, x1, y1, x2, y2, TRUE, coord);
+   get_texcoords(src, level, x1, y1, x2, y2, TRUE, coord);
    set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8);
 
    for (i = 0; i < 4; i++) {
@@ -476,15 +466,15 @@ static void blitter_set_texcoords_2d(struct blitter_context_priv *ctx,
 
 static void blitter_set_texcoords_3d(struct blitter_context_priv *ctx,
                                      struct pipe_resource *src,
-                                     struct pipe_subresource subsrc,
+                                     unsigned level,
                                      unsigned zslice,
                                      unsigned x1, unsigned y1,
                                      unsigned x2, unsigned y2)
 {
    int i;
-   float r = zslice / (float)u_minify(src->depth0, subsrc.level);
+   float r = zslice / (float)u_minify(src->depth0, level);
 
-   blitter_set_texcoords_2d(ctx, src, subsrc, x1, y1, x2, y2);
+   blitter_set_texcoords_2d(ctx, src, level, x1, y1, x2, y2);
 
    for (i = 0; i < 4; i++)
       ctx->vertices[i][1][2] = r; /*r*/
@@ -492,7 +482,7 @@ static void blitter_set_texcoords_3d(struct blitter_context_priv *ctx,
 
 static void blitter_set_texcoords_cube(struct blitter_context_priv *ctx,
                                        struct pipe_resource *src,
-                                       struct pipe_subresource subsrc,
+                                       unsigned level, unsigned face,
                                        unsigned x1, unsigned y1,
                                        unsigned x2, unsigned y2)
 {
@@ -500,10 +490,10 @@ static void blitter_set_texcoords_cube(struct blitter_context_priv *ctx,
    float coord[4];
    float st[4][2];
 
-   get_texcoords(src, subsrc, x1, y1, x2, y2, TRUE, coord);
+   get_texcoords(src, level, x1, y1, x2, y2, TRUE, coord);
    set_texcoords_in_vertices(coord, &st[0][0], 2);
 
-   util_map_texcoords2d_onto_cubemap(subsrc.face,
+   util_map_texcoords2d_onto_cubemap(face,
                                      /* pointer, stride in floats */
                                      &st[0][0], 2,
                                      &ctx->vertices[0][1][0], 8);
@@ -522,10 +512,13 @@ static void blitter_set_dst_dimensions(struct blitter_context_priv *ctx,
 static void blitter_draw_quad(struct blitter_context_priv *ctx)
 {
    struct pipe_context *pipe = ctx->base.pipe;
+   struct pipe_box box;
 
    /* write vertices and draw them */
-   pipe_buffer_write(pipe, ctx->vbuf,
-                     0, sizeof(ctx->vertices), ctx->vertices);
+   u_box_1d(0, sizeof(ctx->vertices), &box);
+   pipe->transfer_inline_write(pipe, ctx->vbuf, 0,
+                               PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
+                               &box, ctx->vertices, sizeof(ctx->vertices), 0);
 
    util_draw_vertex_buffer(pipe, ctx->vbuf, 0, PIPE_PRIM_TRIANGLE_FAN,
                            4,  /* verts */
@@ -566,7 +559,9 @@ void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs)
 
    if (!ctx->fs_col[num_cbufs])
       ctx->fs_col[num_cbufs] =
-         util_make_fragment_clonecolor_shader(pipe, num_cbufs);
+         util_make_fragment_cloneinput_shader(pipe, num_cbufs,
+                                              TGSI_SEMANTIC_GENERIC,
+                                              TGSI_INTERPOLATE_LINEAR);
 
    return ctx->fs_col[num_cbufs];
 }
@@ -697,7 +692,7 @@ void util_blitter_clear(struct blitter_context *blitter,
    pipe->bind_rasterizer_state(pipe, ctx->rs_state);
    pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
    pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, num_cbufs));
-   pipe->bind_vs_state(pipe, ctx->vs_col);
+   pipe->bind_vs_state(pipe, ctx->vs);
 
    blitter_set_dst_dimensions(ctx, width, height);
    blitter->draw_rectangle(blitter, 0, 0, width, height, depth,
@@ -714,21 +709,22 @@ boolean is_overlap(unsigned sx1, unsigned sx2, unsigned sy1, unsigned sy2,
 
 void util_blitter_copy_region(struct blitter_context *blitter,
                               struct pipe_resource *dst,
-                              struct pipe_subresource subdst,
+                              unsigned dstlevel,
                               unsigned dstx, unsigned dsty, unsigned dstz,
                               struct pipe_resource *src,
-                              struct pipe_subresource subsrc,
-                              unsigned srcx, unsigned srcy, unsigned srcz,
-                              unsigned width, unsigned height,
+                              unsigned srclevel,
+                              const struct pipe_box *srcbox,
                               boolean ignore_stencil)
 {
    struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
    struct pipe_context *pipe = ctx->base.pipe;
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *dstsurf;
+   struct pipe_surface *dstsurf, surf_templ;
    struct pipe_framebuffer_state fb_state;
    struct pipe_sampler_view viewTempl, *view;
    unsigned bind;
+   unsigned width = srcbox->width;
+   unsigned height = srcbox->height;
    boolean is_stencil, is_depth;
    boolean normalized;
 
@@ -739,12 +735,15 @@ void util_blitter_copy_region(struct blitter_context *blitter,
 
    /* Sanity checks. */
    if (dst == src) {
-      assert(!is_overlap(srcx, srcx + width, srcy, srcy + height,
+      assert(!is_overlap(srcbox->x, srcbox->x + width, srcbox->y, srcbox->y + height,
                          dstx, dstx + width, dsty, dsty + height));
    } else {
-      assert(dst->format == src->format);
+      assert(util_is_format_compatible(util_format_description(src->format),
+                                       util_format_description(dst->format)));
    }
    assert(src->target < PIPE_MAX_TEXTURE_TYPES);
+   /* XXX should handle 3d regions */
+   assert(srcbox->depth == 1);
 
    /* Is this a ZS format? */
    is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
@@ -762,15 +761,18 @@ void util_blitter_copy_region(struct blitter_context *blitter,
                                     dst->nr_samples, bind, 0) ||
        !screen->is_format_supported(screen, src->format, src->target,
                                     src->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)) {
-      util_resource_copy_region(pipe, dst, subdst, dstx, dsty, dstz,
-                                src, subsrc, srcx, srcy, srcz, width, height);
+      util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz,
+                                src, srclevel, srcbox);
       return;
    }
 
-   /* Get surfaces. */
-   dstsurf = screen->get_tex_surface(screen, dst,
-                                     subdst.face, subdst.level, dstz,
-                                     bind);
+   /* Get surface. */
+   memset(&surf_templ, 0, sizeof(surf_templ));
+   u_surface_default_template(&surf_templ, dst, bind);
+   surf_templ.u.tex.level = dstlevel;
+   surf_templ.u.tex.first_layer = dstz;
+   surf_templ.u.tex.last_layer = dstz;
+   dstsurf = pipe->create_surface(pipe, dst, &surf_templ);
 
    /* Check whether the states are properly saved. */
    blitter_check_saved_CSOs(ctx);
@@ -810,9 +812,9 @@ void util_blitter_copy_region(struct blitter_context *blitter,
 
    /* Set rasterizer state, shaders, and textures. */
    pipe->bind_rasterizer_state(pipe, ctx->rs_state);
-   pipe->bind_vs_state(pipe, ctx->vs_tex);
+   pipe->bind_vs_state(pipe, ctx->vs);
    pipe->bind_fragment_sampler_states(pipe, 1,
-                                      blitter_get_sampler_state(ctx, subsrc.level, normalized));
+                                      blitter_get_sampler_state(ctx, srclevel, normalized));
    pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
    pipe->set_fragment_sampler_views(pipe, 1, &view);
    pipe->set_framebuffer_state(pipe, &fb_state);
@@ -827,8 +829,8 @@ void util_blitter_copy_region(struct blitter_context *blitter,
          {
             /* Set texture coordinates. */
             float coord[4];
-            get_texcoords(src, subsrc, srcx, srcy,
-                                     srcx+width, srcy+height, normalized, coord);
+            get_texcoords(src, srclevel, srcbox->x, srcbox->y,
+                          srcbox->x+width, srcbox->y+height, normalized, coord);
 
             /* Draw. */
             blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
@@ -841,11 +843,13 @@ void util_blitter_copy_region(struct blitter_context *blitter,
       case PIPE_TEXTURE_CUBE:
          /* Set texture coordinates. */
          if (src->target == PIPE_TEXTURE_3D)
-            blitter_set_texcoords_3d(ctx, src, subsrc, srcz,
-                                     srcx, srcy, srcx+width, srcy+height);
+            blitter_set_texcoords_3d(ctx, src, srclevel, srcbox->z,
+                                     srcbox->x, srcbox->y,
+                                     srcbox->x + width, srcbox->y + height);
          else
-            blitter_set_texcoords_cube(ctx, src, subsrc,
-                                       srcx, srcy, srcx+width, srcy+height);
+            blitter_set_texcoords_cube(ctx, src, srclevel, srcbox->z,
+                                       srcbox->x, srcbox->y,
+                                       srcbox->x + width, srcbox->y + height);
 
          /* Draw. */
          blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, 0);
@@ -887,7 +891,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
    pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
    pipe->bind_rasterizer_state(pipe, ctx->rs_state);
    pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1));
-   pipe->bind_vs_state(pipe, ctx->vs_col);
+   pipe->bind_vs_state(pipe, ctx->vs);
    pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
 
    /* set a framebuffer state */
@@ -947,7 +951,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
 
    pipe->bind_rasterizer_state(pipe, ctx->rs_state);
    pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 0));
-   pipe->bind_vs_state(pipe, ctx->vs_col);
+   pipe->bind_vs_state(pipe, ctx->vs);
    pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
 
    /* set a framebuffer state */
@@ -988,7 +992,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
 
    pipe->bind_rasterizer_state(pipe, ctx->rs_state);
    pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 0));
-   pipe->bind_vs_state(pipe, ctx->vs_col);
+   pipe->bind_vs_state(pipe, ctx->vs);
    pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
 
    /* set a framebuffer state */
index f9f96f25c77e28cc1b2455173bb5f2a562b7d50a..922a8580ac15a3e68562034d0a247b79a3af0eb0 100644 (file)
@@ -164,12 +164,11 @@ void util_blitter_clear(struct blitter_context *blitter,
  */
 void util_blitter_copy_region(struct blitter_context *blitter,
                               struct pipe_resource *dst,
-                              struct pipe_subresource subdst,
+                              unsigned dstlevel,
                               unsigned dstx, unsigned dsty, unsigned dstz,
                               struct pipe_resource *src,
-                              struct pipe_subresource subsrc,
-                              unsigned srcx, unsigned srcy, unsigned srcz,
-                              unsigned width, unsigned height,
+                              unsigned srclevel,
+                              const struct pipe_box *srcbox,
                               boolean ignore_stencil);
 
 /**
@@ -319,21 +318,13 @@ util_blitter_save_vertex_buffers(struct blitter_context *blitter,
                                          int num_vertex_buffers,
                                          struct pipe_vertex_buffer *vertex_buffers)
 {
-   unsigned i;
    assert(num_vertex_buffers <= Elements(blitter->saved_vertex_buffers));
 
-   blitter->saved_num_vertex_buffers = num_vertex_buffers;
-
-   for (i = 0; i < num_vertex_buffers; i++) {
-      if (vertex_buffers[i].buffer) {
-         pipe_resource_reference(&blitter->saved_vertex_buffers[i].buffer,
-                                 vertex_buffers[i].buffer);
-      }
-   }
-
-   memcpy(blitter->saved_vertex_buffers,
-          vertex_buffers,
-          num_vertex_buffers * sizeof(struct pipe_vertex_buffer));
+   blitter->saved_num_vertex_buffers = 0;
+   util_copy_vertex_buffers(blitter->saved_vertex_buffers,
+                            (unsigned*)&blitter->saved_num_vertex_buffers,
+                            vertex_buffers,
+                            num_vertex_buffers);
 }
 
 #ifdef __cplusplus
index e9c71743fc89e62a723b8e5b112e4f88885cf66f..0b28d0f12c3530cde20aaa3bdc09d0a8af81e51b 100644 (file)
@@ -60,7 +60,6 @@ void u_box_2d_zslice( unsigned x,
    box->depth = 1;
 }
 
-
 static INLINE
 void u_box_3d( unsigned x,
               unsigned y,
@@ -78,15 +77,4 @@ void u_box_3d( unsigned x,
    box->depth = d;
 }
 
-
-static INLINE
-struct pipe_subresource u_subresource( unsigned face,
-                                      unsigned level )
-{
-   struct pipe_subresource subresource;
-   subresource.face = face;
-   subresource.level = level;
-   return subresource;
-}
-
 #endif
index 504e6d2a18ff1aa05346dc30af3ad4b3f42349e5..f4ad545bee73559b9db127ac31f5fd7b83346067 100644 (file)
 #include "util/u_string.h" 
 #include "util/u_math.h" 
 #include "util/u_tile.h" 
-#include "util/u_prim.h" 
+#include "util/u_prim.h"
+#include "util/u_surface.h"
 
 #include <limits.h> /* CHAR_BIT */
 
 void _debug_vprintf(const char *format, va_list ap)
 {
+#if defined(PIPE_OS_WINDOWS) || defined(PIPE_OS_EMBEDDED)
    /* We buffer until we find a newline. */
    static char buf[4096] = {'\0'};
    size_t len = strlen(buf);
@@ -54,6 +56,10 @@ void _debug_vprintf(const char *format, va_list ap)
       os_log_message(buf);
       buf[0] = '\0';
    }
+#else
+   /* Just print as-is to stderr */
+   vfprintf(stderr, format, ap);
+#endif
 }
 
 
@@ -453,9 +459,10 @@ void debug_dump_image(const char *prefix,
 #endif
 }
 
+/* FIXME: dump resources, not surfaces... */
 void debug_dump_surface(struct pipe_context *pipe,
-                       const char *prefix,
-                        struct pipe_surface *surface)     
+                        const char *prefix,
+                        struct pipe_surface *surface)
 {
    struct pipe_resource *texture;
    struct pipe_transfer *transfer;
@@ -472,23 +479,23 @@ void debug_dump_surface(struct pipe_context *pipe,
     */
    texture = surface->texture;
 
-   transfer = pipe_get_transfer(pipe, texture, surface->face,
-                                    surface->level, surface->zslice,
-                                    PIPE_TRANSFER_READ, 0, 0, surface->width,
-                                    surface->height);
-   
+   transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
+                                surface->u.tex.first_layer,
+                                PIPE_TRANSFER_READ,
+                                0, 0, surface->width, surface->height);
+
    data = pipe->transfer_map(pipe, transfer);
    if(!data)
       goto error;
-   
-   debug_dump_image(prefix, 
+
+   debug_dump_image(prefix,
                     texture->format,
-                    util_format_get_blocksize(texture->format), 
+                    util_format_get_blocksize(texture->format),
                     util_format_get_nblocksx(texture->format, surface->width),
                     util_format_get_nblocksy(texture->format, surface->height),
                     transfer->stride,
                     data);
-   
+
    pipe->transfer_unmap(pipe, transfer);
 error:
    pipe->transfer_destroy(pipe, transfer);
@@ -499,20 +506,18 @@ void debug_dump_texture(struct pipe_context *pipe,
                         const char *prefix,
                         struct pipe_resource *texture)
 {
-   struct pipe_surface *surface;
-   struct pipe_screen *screen;
+   struct pipe_surface *surface, surf_tmpl;
 
    if (!texture)
       return;
 
-   screen = texture->screen;
-
-   /* XXX for now, just dump image for face=0, level=0 */
-   surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
-                                     PIPE_BIND_SAMPLER_VIEW);
+   /* XXX for now, just dump image for layer=0, level=0 */
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   u_surface_default_template(&surf_tmpl, texture, 0 /* no bind flag - not a surface */);
+   surface = pipe->create_surface(pipe, texture, &surf_tmpl);
    if (surface) {
       debug_dump_surface(pipe, prefix, surface);
-      screen->tex_surface_destroy(surface);
+      pipe->surface_destroy(pipe, surface);
    }
 }
 
@@ -550,17 +555,16 @@ struct bmp_rgb_quad {
 
 void
 debug_dump_surface_bmp(struct pipe_context *pipe,
-                      const char *filename,
+                       const char *filename,
                        struct pipe_surface *surface)
 {
 #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
    struct pipe_transfer *transfer;
    struct pipe_resource *texture = surface->texture;
 
-   transfer = pipe_get_transfer(pipe, texture, surface->face,
-                               surface->level, surface->zslice,
-                               PIPE_TRANSFER_READ, 0, 0, surface->width,
-                               surface->height);
+   transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
+                                surface->u.tex.first_layer, PIPE_TRANSFER_READ,
+                                0, 0, surface->width, surface->height);
 
    debug_dump_transfer_bmp(pipe, filename, transfer);
 
index 1c90ff31069838443064ea0b94080a45c011a205..7ed8ee608a80577b93fd7b55ee57f9b0d492a0ab 100644 (file)
@@ -69,7 +69,7 @@ debug_describe_surface(char* buf, const struct pipe_surface *ptr)
 {
    char res[128];
    debug_describe_resource(res, ptr->texture);
-   util_sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->face, ptr->level, ptr->zslice);
+   util_sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->u.tex.level, ptr->u.tex.first_layer, ptr->u.tex.last_layer);
 }
 
 void
index 528a1c394befa0bf1dbb810f1c184cd968d9a5d7..24e039fd226aa2d5f3e6f5331808a9dc2a6f2a18 100644 (file)
@@ -48,7 +48,10 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
    if(!nr_frames)
       return;
 
-#if defined(PIPE_CC_GCC)
+#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
+   __asm__ __volatile__("mov (%%ebp),%0": "=r" (frame_pointer));
+   frame_pointer = (const void **)frame_pointer[0];
+#elif defined(PIPE_CC_GCC)
    frame_pointer = ((const void **)__builtin_frame_address(1));
 #elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
    __asm {
index 332952af88b85c4036a0f7866e3c93cb70775138..44d437747a1841c48c7dfefc46c594cb5405535a 100644 (file)
@@ -40,7 +40,7 @@
 #include "u_debug_symbol.h"
 #include "u_hash_table.h"
 
-#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
    
 #include <windows.h>
 #include <stddef.h>
@@ -165,7 +165,7 @@ debug_symbol_name_glibc(const void *addr, char* buf, unsigned size)
 void
 debug_symbol_name(const void *addr, char* buf, unsigned size)
 {
-#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
    debug_symbol_name_imagehlp(addr, buf, size);
    if(buf[0])
       return;
index 7e1be45ad5a6c4cf11301dfdc25b45b6777fc019..40539f0b0ea699d1d5ef919e78dbea43cf82ec7a 100644 (file)
@@ -24,5 +24,9 @@
 #define U_NEW_VERTEX_BUFFER         0x10000
 #define U_NEW_QUERY                 0x20000
 #define U_NEW_DEPTH_STENCIL         0x40000
+#define U_NEW_GS                    0x80000
+#define U_NEW_GS_CONSTANTS          0x100000
+#define U_NEW_GS_SAMPLER_VIEW       0x200000
+#define U_NEW_GS_SAMPLER_STATES     0x400000
 
 #endif
index fd1bbe5ffdf3d48c935872924c44f639b3b47247..f3618d9be74b080cad2209e44c8adf4d76ff4b33 100644 (file)
@@ -77,7 +77,7 @@ util_dirty_surfaces_use_levels_for_sampling(struct pipe_context *pipe, struct ut
       struct util_dirty_surface *ds = LIST_ENTRY(struct util_dirty_surface, p, dirty_list);
       next = p->next;
 
-      if(ds->base.level >= first && ds->base.level <= last)
+      if(ds->base.u.tex.level >= first && ds->base.u.tex.level <= last)
         flush(pipe, &ds->base);
    }
 }
@@ -86,7 +86,8 @@ static INLINE void
 util_dirty_surfaces_use_for_sampling_with(struct pipe_context *pipe, struct util_dirty_surfaces *dss, struct pipe_sampler_view *psv, struct pipe_sampler_state *pss, util_dirty_surface_flush_t flush)
 {
    if(!LIST_IS_EMPTY(&dss->dirty_list))
-      util_dirty_surfaces_use_levels_for_sampling(pipe, dss, (unsigned)pss->min_lod + psv->first_level, MIN2((unsigned)ceilf(pss->max_lod) + psv->first_level, psv->last_level), flush);
+      util_dirty_surfaces_use_levels_for_sampling(pipe, dss, (unsigned)pss->min_lod + psv->u.tex.first_level,
+                                                 MIN2((unsigned)ceilf(pss->max_lod) + psv->u.tex.first_level, psv->u.tex.last_level), flush);
 }
 
 static INLINE void
index cda5b8ba512881b06ea84535be8a2c590826f7fd..b471d59eebf35295fd6fe39c65e7abc38c709d67 100644 (file)
@@ -279,6 +279,10 @@ util_dump_template(struct os_stream *stream, const struct pipe_resource *templat
    util_dump_uint(stream, templat->depth0);
    util_dump_member_end(stream);
 
+   util_dump_member_begin(stream, "array_size");
+   util_dump_uint(stream, templat->array_size);
+   util_dump_member_end(stream);
+
    util_dump_member(stream, uint, templat, last_level);
    util_dump_member(stream, uint, templat, usage);
    util_dump_member(stream, uint, templat, bind);
@@ -633,14 +637,12 @@ util_dump_surface(struct os_stream *stream, const struct pipe_surface *state)
    util_dump_member(stream, uint, state, width);
    util_dump_member(stream, uint, state, height);
 
-   util_dump_member(stream, uint, state, layout);
-   util_dump_member(stream, uint, state, offset);
    util_dump_member(stream, uint, state, usage);
 
    util_dump_member(stream, ptr, state, texture);
-   util_dump_member(stream, uint, state, face);
-   util_dump_member(stream, uint, state, level);
-   util_dump_member(stream, uint, state, zslice);
+   util_dump_member(stream, uint, state, u.tex.level);
+   util_dump_member(stream, uint, state, u.tex.first_layer);
+   util_dump_member(stream, uint, state, u.tex.last_layer);
 
    util_dump_struct_end(stream);
 }
@@ -660,7 +662,7 @@ util_dump_transfer(struct os_stream *stream, const struct pipe_transfer *state)
    /*util_dump_member(stream, uint, state, box);*/
 
    util_dump_member(stream, uint, state, stride);
-   util_dump_member(stream, uint, state, slice_stride);
+   util_dump_member(stream, uint, state, layer_stride);
 
    /*util_dump_member(stream, ptr, state, data);*/
 
index 1fbd83841c1ee0bc991c1e28bcc1f67c0ac490ff..26a0eebc54483b724b1453becfa625c7d3e1b2b3 100644 (file)
@@ -76,6 +76,7 @@ PIPE_FORMAT_B4G4R4X4_UNORM        , plain, 1, 1, un4 , un4 , un4 , x4  , zyx1, r
 PIPE_FORMAT_B5G6R5_UNORM          , plain, 1, 1, un5 , un6 , un5 ,     , zyx1, rgb
 PIPE_FORMAT_R10G10B10A2_UNORM     , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb
 PIPE_FORMAT_B10G10R10A2_UNORM     , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb
+PIPE_FORMAT_B2G3R3_UNORM          , plain, 1, 1, un2 , un3 , un3 ,     , zyx1, rgb
 
 # Luminance/Intensity/Alpha formats
 PIPE_FORMAT_L8_UNORM              , plain, 1, 1, un8 ,     ,     ,     , xxx1, rgb
@@ -84,6 +85,9 @@ PIPE_FORMAT_I8_UNORM              , plain, 1, 1, un8 ,     ,     ,     , xxxx, r
 PIPE_FORMAT_L4A4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , xxxy, rgb
 PIPE_FORMAT_L8A8_UNORM            , plain, 1, 1, un8 , un8 ,     ,     , xxxy, rgb
 PIPE_FORMAT_L16_UNORM             , plain, 1, 1, un16,     ,     ,     , xxx1, rgb
+PIPE_FORMAT_A16_UNORM             , plain, 1, 1, un16,     ,     ,     , 000x, rgb
+PIPE_FORMAT_I16_UNORM             , plain, 1, 1, un16,     ,     ,     , xxxx, rgb
+PIPE_FORMAT_L16A16_UNORM          , plain, 1, 1, un16, un16,     ,     , xxxy, rgb
 
 # SRGB formats
 PIPE_FORMAT_L8_SRGB               , plain, 1, 1, un8 ,     ,     ,     , xxx1, srgb 
index 6a931a95819cdd690b074870212dab49986cbf55..d22ae8b375b8f828984f33391b52cb3c072831b5 100644 (file)
@@ -48,6 +48,8 @@
 #include "util/u_simple_shaders.h"
 #include "util/u_math.h"
 #include "util/u_texture.h"
+#include "util/u_half.h"
+#include "util/u_surface.h"
 
 #include "cso_cache/cso_context.h"
 
@@ -65,7 +67,7 @@ struct gen_mipmap_state
    struct pipe_vertex_element velem[2];
 
    void *vs;
-   void *fs2d, *fsCube;
+   void *fs1d, *fs2d, *fs3d, *fsCube;
 
    struct pipe_resource *vbuf;  /**< quad vertices */
    unsigned vbuf_slot;
@@ -89,24 +91,7 @@ enum dtype
 };
 
 
-typedef ushort half_float;
-
-
-static half_float
-float_to_half(float f)
-{
-   /* XXX fix this */
-   return 0;
-}
-
-static float
-half_to_float(half_float h)
-{
-   /* XXX fix this */
-   return 0.0f;
-}
-
-
+typedef uint16_t half_float;
 
 
 /**
@@ -145,7 +130,7 @@ half_to_float(half_float h)
                                 rowC[j][e], rowC[k][e], \
                                 rowD[j][e], rowD[k][e]); \
    } while(0)
-   
+
 #define FILTER_F_3D(e) \
    do { \
       dst[i][e] = (rowA[j][e] + rowA[k][e] \
@@ -156,15 +141,15 @@ half_to_float(half_float h)
 
 #define FILTER_HF_3D(e) \
    do { \
-      const float aj = half_to_float(rowA[j][e]); \
-      const float ak = half_to_float(rowA[k][e]); \
-      const float bj = half_to_float(rowB[j][e]); \
-      const float bk = half_to_float(rowB[k][e]); \
-      const float cj = half_to_float(rowC[j][e]); \
-      const float ck = half_to_float(rowC[k][e]); \
-      const float dj = half_to_float(rowD[j][e]); \
-      const float dk = half_to_float(rowD[k][e]); \
-      dst[i][e] = float_to_half((aj + ak + bj + bk + cj + ck + dj + dk) \
+      const float aj = util_half_to_float(rowA[j][e]); \
+      const float ak = util_half_to_float(rowA[k][e]); \
+      const float bj = util_half_to_float(rowB[j][e]); \
+      const float bk = util_half_to_float(rowB[k][e]); \
+      const float cj = util_half_to_float(rowC[j][e]); \
+      const float ck = util_half_to_float(rowC[k][e]); \
+      const float dj = util_half_to_float(rowD[j][e]); \
+      const float dk = util_half_to_float(rowD[k][e]); \
+      dst[i][e] = util_float_to_half((aj + ak + bj + bk + cj + ck + dj + dk) \
                                       * 0.125F); \
    } while(0)
 /*@}*/
@@ -343,8 +328,7 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
       }
    }
 
-#if 0
-   else if (datatype == HALF_DTYPE_FLOAT && comps == 4) {
+   else if (datatype == DTYPE_HALF_FLOAT && comps == 4) {
       uint i, j, k, comp;
       const half_float(*rowA)[4] = (const half_float(*)[4]) srcRowA;
       const half_float(*rowB)[4] = (const half_float(*)[4]) srcRowB;
@@ -353,11 +337,11 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
            i++, j += colStride, k += colStride) {
          for (comp = 0; comp < 4; comp++) {
             float aj, ak, bj, bk;
-            aj = half_to_float(rowA[j][comp]);
-            ak = half_to_float(rowA[k][comp]);
-            bj = half_to_float(rowB[j][comp]);
-            bk = half_to_float(rowB[k][comp]);
-            dst[i][comp] = float_to_half((aj + ak + bj + bk) * 0.25F);
+            aj = util_half_to_float(rowA[j][comp]);
+            ak = util_half_to_float(rowA[k][comp]);
+            bj = util_half_to_float(rowB[j][comp]);
+            bk = util_half_to_float(rowB[k][comp]);
+            dst[i][comp] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
          }
       }
    }
@@ -370,11 +354,11 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
            i++, j += colStride, k += colStride) {
          for (comp = 0; comp < 3; comp++) {
             float aj, ak, bj, bk;
-            aj = half_to_float(rowA[j][comp]);
-            ak = half_to_float(rowA[k][comp]);
-            bj = half_to_float(rowB[j][comp]);
-            bk = half_to_float(rowB[k][comp]);
-            dst[i][comp] = float_to_half((aj + ak + bj + bk) * 0.25F);
+            aj = util_half_to_float(rowA[j][comp]);
+            ak = util_half_to_float(rowA[k][comp]);
+            bj = util_half_to_float(rowB[j][comp]);
+            bk = util_half_to_float(rowB[k][comp]);
+            dst[i][comp] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
          }
       }
    }
@@ -387,11 +371,11 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
            i++, j += colStride, k += colStride) {
          for (comp = 0; comp < 2; comp++) {
             float aj, ak, bj, bk;
-            aj = half_to_float(rowA[j][comp]);
-            ak = half_to_float(rowA[k][comp]);
-            bj = half_to_float(rowB[j][comp]);
-            bk = half_to_float(rowB[k][comp]);
-            dst[i][comp] = float_to_half((aj + ak + bj + bk) * 0.25F);
+            aj = util_half_to_float(rowA[j][comp]);
+            ak = util_half_to_float(rowA[k][comp]);
+            bj = util_half_to_float(rowB[j][comp]);
+            bk = util_half_to_float(rowB[k][comp]);
+            dst[i][comp] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
          }
       }
    }
@@ -403,14 +387,13 @@ do_row(enum dtype datatype, uint comps, int srcWidth,
       for (i = j = 0, k = k0; i < (uint) dstWidth;
            i++, j += colStride, k += colStride) {
          float aj, ak, bj, bk;
-         aj = half_to_float(rowA[j]);
-         ak = half_to_float(rowA[k]);
-         bj = half_to_float(rowB[j]);
-         bk = half_to_float(rowB[k]);
-         dst[i] = float_to_half((aj + ak + bj + bk) * 0.25F);
+         aj = util_half_to_float(rowA[j]);
+         ak = util_half_to_float(rowA[k]);
+         bj = util_half_to_float(rowB[j]);
+         bk = util_half_to_float(rowB[k]);
+         dst[i] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
       }
    }
-#endif
 
    else if (datatype == DTYPE_UINT && comps == 1) {
       uint i, j, k;
@@ -1036,32 +1019,34 @@ reduce_2d(enum pipe_format pformat,
 static void
 reduce_3d(enum pipe_format pformat,
           int srcWidth, int srcHeight, int srcDepth,
-          int srcRowStride, const ubyte *srcPtr,
+          int srcRowStride, int srcImageStride, const ubyte *srcPtr,
           int dstWidth, int dstHeight, int dstDepth,
-          int dstRowStride, ubyte *dstPtr)
+          int dstRowStride, int dstImageStride, ubyte *dstPtr)
 {
    const int bpt = util_format_get_blocksize(pformat);
-   const int border = 0;
    int img, row;
-   int bytesPerSrcImage, bytesPerDstImage;
-   int bytesPerSrcRow, bytesPerDstRow;
    int srcImageOffset, srcRowOffset;
    enum dtype datatype;
    uint comps;
 
    format_to_type_comps(pformat, &datatype, &comps);
 
-   bytesPerSrcImage = srcWidth * srcHeight * bpt;
-   bytesPerDstImage = dstWidth * dstHeight * bpt;
+   /* XXX I think we should rather assert those strides */
+   if (!srcImageStride)
+      srcImageStride = srcWidth * srcHeight * bpt;
+   if (!dstImageStride)
+      dstImageStride = dstWidth * dstHeight * bpt;
 
-   bytesPerSrcRow = srcWidth * bpt;
-   bytesPerDstRow = dstWidth * bpt;
+   if (!srcRowStride)
+      srcRowStride = srcWidth * bpt;
+   if (!dstRowStride)
+      dstRowStride = dstWidth * bpt;
 
    /* Offset between adjacent src images to be averaged together */
-   srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage;
+   srcImageOffset = (srcDepth == dstDepth) ? 0 : srcImageStride;
 
    /* Offset between adjacent src rows to be averaged together */
-   srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt;
+   srcRowOffset = (srcHeight == dstHeight) ? 0 : srcRowStride;
 
    /*
     * Need to average together up to 8 src pixels for each dest pixel.
@@ -1077,16 +1062,13 @@ reduce_3d(enum pipe_format pformat,
    */
 
    for (img = 0; img < dstDepth; img++) {
-      /* first source image pointer, skipping border */
+      /* first source image pointer */
       const ubyte *imgSrcA = srcPtr
-         + (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border
-         + img * (bytesPerSrcImage + srcImageOffset);
-      /* second source image pointer, skipping border */
+         + img * (srcImageStride + srcImageOffset);
+      /* second source image pointer */
       const ubyte *imgSrcB = imgSrcA + srcImageOffset;
-      /* address of the dest image, skipping border */
-      ubyte *imgDst = dstPtr
-         + (bytesPerDstImage + bytesPerDstRow + border) * bpt * border
-         + img * bytesPerDstImage;
+      /* address of the dest image */
+      ubyte *imgDst = dstPtr + img * dstImageStride;
 
       /* setup the four source row pointers and the dest row pointer */
       const ubyte *srcImgARowA = imgSrcA;
@@ -1102,11 +1084,11 @@ reduce_3d(enum pipe_format pformat,
                    dstWidth, dstImgRow);
 
          /* advance to next rows */
-         srcImgARowA += bytesPerSrcRow + srcRowOffset;
-         srcImgARowB += bytesPerSrcRow + srcRowOffset;
-         srcImgBRowA += bytesPerSrcRow + srcRowOffset;
-         srcImgBRowB += bytesPerSrcRow + srcRowOffset;
-         dstImgRow += bytesPerDstRow;
+         srcImgARowA += srcRowStride + srcRowOffset;
+         srcImgARowB += srcRowStride + srcRowOffset;
+         srcImgBRowA += srcRowStride + srcRowOffset;
+         srcImgBRowB += srcRowStride + srcRowOffset;
+         dstImgRow += dstImageStride;
       }
    }
 }
@@ -1117,25 +1099,24 @@ reduce_3d(enum pipe_format pformat,
 static void
 make_1d_mipmap(struct gen_mipmap_state *ctx,
                struct pipe_resource *pt,
-               uint face, uint baseLevel, uint lastLevel)
+               uint layer, uint baseLevel, uint lastLevel)
 {
    struct pipe_context *pipe = ctx->pipe;
-   const uint zslice = 0;
    uint dstLevel;
 
    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
       const uint srcLevel = dstLevel - 1;
       struct pipe_transfer *srcTrans, *dstTrans;
       void *srcMap, *dstMap;
-      
-      srcTrans = pipe_get_transfer(pipe, pt, face, srcLevel, zslice,
-                                          PIPE_TRANSFER_READ, 0, 0,
-                                          u_minify(pt->width0, srcLevel),
-                                          u_minify(pt->height0, srcLevel));
-      dstTrans = pipe_get_transfer(pipe, pt, face, dstLevel, zslice,
-                                          PIPE_TRANSFER_WRITE, 0, 0,
-                                          u_minify(pt->width0, dstLevel),
-                                          u_minify(pt->height0, dstLevel));
+
+      srcTrans = pipe_get_transfer(pipe, pt, srcLevel, layer,
+                                   PIPE_TRANSFER_READ, 0, 0,
+                                   u_minify(pt->width0, srcLevel),
+                                   u_minify(pt->height0, srcLevel));
+      dstTrans = pipe_get_transfer(pipe, pt, dstLevel, layer,
+                                   PIPE_TRANSFER_WRITE, 0, 0,
+                                   u_minify(pt->width0, dstLevel),
+                                   u_minify(pt->height0, dstLevel));
 
       srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
       dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
@@ -1156,12 +1137,11 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
 static void
 make_2d_mipmap(struct gen_mipmap_state *ctx,
                struct pipe_resource *pt,
-               uint face, uint baseLevel, uint lastLevel)
+               uint layer, uint baseLevel, uint lastLevel)
 {
    struct pipe_context *pipe = ctx->pipe;
-   const uint zslice = 0;
    uint dstLevel;
-   
+
    assert(util_format_get_blockwidth(pt->format) == 1);
    assert(util_format_get_blockheight(pt->format) == 1);
 
@@ -1169,15 +1149,15 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
       const uint srcLevel = dstLevel - 1;
       struct pipe_transfer *srcTrans, *dstTrans;
       ubyte *srcMap, *dstMap;
-      
-      srcTrans = pipe_get_transfer(pipe, pt, face, srcLevel, zslice,
-                                  PIPE_TRANSFER_READ, 0, 0,
-                                  u_minify(pt->width0, srcLevel),
-                                  u_minify(pt->height0, srcLevel));
-      dstTrans = pipe_get_transfer(pipe, pt, face, dstLevel, zslice,
-                                  PIPE_TRANSFER_WRITE, 0, 0,
-                                  u_minify(pt->width0, dstLevel),
-                                  u_minify(pt->height0, dstLevel));
+
+      srcTrans = pipe_get_transfer(pipe, pt, srcLevel, layer,
+                                   PIPE_TRANSFER_READ, 0, 0,
+                                   u_minify(pt->width0, srcLevel),
+                                   u_minify(pt->height0, srcLevel));
+      dstTrans = pipe_get_transfer(pipe, pt, dstLevel, layer,
+                                   PIPE_TRANSFER_WRITE, 0, 0,
+                                   u_minify(pt->width0, dstLevel),
+                                   u_minify(pt->height0, dstLevel));
 
       srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
       dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
@@ -1197,41 +1177,49 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
 }
 
 
+/* XXX looks a bit more like it could work now but need to test */
 static void
 make_3d_mipmap(struct gen_mipmap_state *ctx,
                struct pipe_resource *pt,
                uint face, uint baseLevel, uint lastLevel)
 {
-#if 0
    struct pipe_context *pipe = ctx->pipe;
-   struct pipe_screen *screen = pipe->screen;
-   uint dstLevel, zslice = 0;
+   uint dstLevel;
+   struct pipe_box src_box, dst_box;
 
    assert(util_format_get_blockwidth(pt->format) == 1);
    assert(util_format_get_blockheight(pt->format) == 1);
 
+   src_box.x = src_box.y = src_box.z = 0;
+   dst_box.x = dst_box.y = dst_box.z = 0;
+
    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
       const uint srcLevel = dstLevel - 1;
       struct pipe_transfer *srcTrans, *dstTrans;
       ubyte *srcMap, *dstMap;
-      
-      srcTrans = pipe->get_transfer(pipe, pt, face, srcLevel, zslice,
-                                          PIPE_TRANSFER_READ, 0, 0,
-                                          u_minify(pt->width0, srcLevel),
-                                          u_minify(pt->height0, srcLevel));
-      dstTrans = pipe->get_transfer(pipe, pt, face, dstLevel, zslice,
-                                          PIPE_TRANSFER_WRITE, 0, 0,
-                                          u_minify(pt->width0, dstLevel),
-                                          u_minify(pt->height0, dstLevel));
+      struct pipe_box src_box, dst_box;
+      src_box.width = u_minify(pt->width0, srcLevel);
+      src_box.height = u_minify(pt->height0, srcLevel);
+      src_box.depth = u_minify(pt->depth0, srcLevel);
+      dst_box.width = u_minify(pt->width0, dstLevel);
+      dst_box.height = u_minify(pt->height0, dstLevel);
+      dst_box.depth = u_minify(pt->depth0, dstLevel);
+
+      srcTrans = pipe->get_transfer(pipe, pt, srcLevel,
+                                    PIPE_TRANSFER_READ,
+                                    &src_box);
+      dstTrans = pipe->get_transfer(pipe, pt, dstLevel,
+                                    PIPE_TRANSFER_WRITE,
+                                    &dst_box);
 
       srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
       dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
 
       reduce_3d(pt->format,
-                srcTrans->width, srcTrans->height,
-                srcTrans->stride, srcMap,
-                dstTrans->width, dstTrans->height,
-                dstTrans->stride, dstMap);
+                srcTrans->box.width, srcTrans->box.height, srcTrans->box.depth,
+                srcTrans->stride, srcTrans->layer_stride, srcMap,
+                dstTrans->box.width, dstTrans->box.height, dstTrans->box.depth,
+                dstTrans->stride, dstTrans->layer_stride, dstMap);
 
       pipe->transfer_unmap(pipe, srcTrans);
       pipe->transfer_unmap(pipe, dstTrans);
@@ -1239,28 +1227,25 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
       pipe->transfer_destroy(pipe, srcTrans);
       pipe->transfer_destroy(pipe, dstTrans);
    }
-#else
-   (void) reduce_3d;
-#endif
 }
 
 
 static void
 fallback_gen_mipmap(struct gen_mipmap_state *ctx,
                     struct pipe_resource *pt,
-                    uint face, uint baseLevel, uint lastLevel)
+                    uint layer, uint baseLevel, uint lastLevel)
 {
    switch (pt->target) {
    case PIPE_TEXTURE_1D:
-      make_1d_mipmap(ctx, pt, face, baseLevel, lastLevel);
+      make_1d_mipmap(ctx, pt, layer, baseLevel, lastLevel);
       break;
    case PIPE_TEXTURE_2D:
    case PIPE_TEXTURE_RECT:
    case PIPE_TEXTURE_CUBE:
-      make_2d_mipmap(ctx, pt, face, baseLevel, lastLevel);
+      make_2d_mipmap(ctx, pt, layer, baseLevel, lastLevel);
       break;
    case PIPE_TEXTURE_3D:
-      make_3d_mipmap(ctx, pt, face, baseLevel, lastLevel);
+      make_3d_mipmap(ctx, pt, layer, baseLevel, lastLevel);
       break;
    default:
       assert(0);
@@ -1328,8 +1313,12 @@ util_create_gen_mipmap(struct pipe_context *pipe,
    }
 
    /* fragment shader */
+   ctx->fs1d = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_1D,
+                                             TGSI_INTERPOLATE_LINEAR);
    ctx->fs2d = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D,
                                              TGSI_INTERPOLATE_LINEAR);
+   ctx->fs3d = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_3D,
+                                               TGSI_INTERPOLATE_LINEAR);
    ctx->fsCube = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_CUBE,
                                                TGSI_INTERPOLATE_LINEAR);
 
@@ -1371,7 +1360,7 @@ get_next_slot(struct gen_mipmap_state *ctx)
 static unsigned
 set_vertex_data(struct gen_mipmap_state *ctx,
                 enum pipe_texture_target tex_target,
-                uint face)
+                uint layer, float r)
 {
    unsigned offset;
 
@@ -1397,26 +1386,26 @@ set_vertex_data(struct gen_mipmap_state *ctx,
          {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
       };
 
-      util_map_texcoords2d_onto_cubemap(face, &st[0][0], 2,
+      util_map_texcoords2d_onto_cubemap(layer, &st[0][0], 2,
                                         &ctx->vertices[0][1][0], 8);
    }
    else {
-      /* 1D/2D */
+      /* 1D/2D/3D */
       ctx->vertices[0][1][0] = 0.0f; /*s*/
       ctx->vertices[0][1][1] = 0.0f; /*t*/
-      ctx->vertices[0][1][2] = 0.0f; /*r*/
+      ctx->vertices[0][1][2] = r;    /*r*/
 
       ctx->vertices[1][1][0] = 1.0f;
       ctx->vertices[1][1][1] = 0.0f;
-      ctx->vertices[1][1][2] = 0.0f;
+      ctx->vertices[1][1][2] = r;
 
       ctx->vertices[2][1][0] = 1.0f;
       ctx->vertices[2][1][1] = 1.0f;
-      ctx->vertices[2][1][2] = 0.0f;
+      ctx->vertices[2][1][2] = r;
 
       ctx->vertices[3][1][0] = 0.0f;
       ctx->vertices[3][1][1] = 1.0f;
-      ctx->vertices[3][1][2] = 0.0f;
+      ctx->vertices[3][1][2] = r;
    }
 
    offset = get_next_slot( ctx );
@@ -1437,9 +1426,11 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
 {
    struct pipe_context *pipe = ctx->pipe;
 
-   pipe->delete_vs_state(pipe, ctx->vs);
-   pipe->delete_fs_state(pipe, ctx->fs2d);
    pipe->delete_fs_state(pipe, ctx->fsCube);
+   pipe->delete_fs_state(pipe, ctx->fs3d);
+   pipe->delete_fs_state(pipe, ctx->fs2d);
+   pipe->delete_fs_state(pipe, ctx->fs1d);
+   pipe->delete_vs_state(pipe, ctx->vs);
 
    pipe_resource_reference(&ctx->vbuf, NULL);
 
@@ -1478,9 +1469,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
    struct pipe_screen *screen = pipe->screen;
    struct pipe_framebuffer_state fb;
    struct pipe_resource *pt = psv->texture;
-   void *fs = (pt->target == PIPE_TEXTURE_CUBE) ? ctx->fsCube : ctx->fs2d;
+   void *fs;
    uint dstLevel;
-   uint zslice = 0;
    uint offset;
 
    /* The texture object should have room for the levels which we're
@@ -1494,8 +1484,28 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
    assert(filter == PIPE_TEX_FILTER_LINEAR ||
           filter == PIPE_TEX_FILTER_NEAREST);
 
+   switch (pt->target) {
+   case PIPE_TEXTURE_1D:
+      fs = ctx->fs1d;
+      break;
+   case PIPE_TEXTURE_2D:
+      fs = ctx->fs2d;
+      break;
+   case PIPE_TEXTURE_3D:
+      fs = ctx->fs3d;
+      break;
+   case PIPE_TEXTURE_CUBE:
+      fs = ctx->fsCube;
+      break;
+   case PIPE_TEXTURE_1D_ARRAY:
+   case PIPE_TEXTURE_2D_ARRAY:
+   default:
+      assert(0);
+      fs = ctx->fs2d;
+   }
+
    /* check if we can render in the texture's format */
-   if (!screen->is_format_supported(screen, psv->format, PIPE_TEXTURE_2D,
+   if (!screen->is_format_supported(screen, psv->format, pt->target,
                                     pt->nr_samples, PIPE_BIND_RENDER_TARGET, 0)) {
       fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel);
       return;
@@ -1539,60 +1549,85 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
       const uint srcLevel = dstLevel - 1;
       struct pipe_viewport_state vp;
-
-      struct pipe_surface *surf = 
-         screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
-                                 PIPE_BIND_RENDER_TARGET);
-
-      /*
-       * Setup framebuffer / dest surface
-       */
-      fb.cbufs[0] = surf;
-      fb.width = u_minify(pt->width0, dstLevel);
-      fb.height = u_minify(pt->height0, dstLevel);
-      cso_set_framebuffer(ctx->cso, &fb);
-
-      /* viewport */
-      vp.scale[0] = 0.5f * fb.width;
-      vp.scale[1] = 0.5f * fb.height;
-      vp.scale[2] = 1.0f;
-      vp.scale[3] = 1.0f;
-      vp.translate[0] = 0.5f * fb.width;
-      vp.translate[1] = 0.5f * fb.height;
-      vp.translate[2] = 0.0f;
-      vp.translate[3] = 0.0f;
-      cso_set_viewport(ctx->cso, &vp);
-
-      /*
-       * Setup sampler state
-       * Note: we should only have to set the min/max LOD clamps to ensure
-       * we grab texels from the right mipmap level.  But some hardware
-       * has trouble with min clamping so we also set the lod_bias to
-       * try to work around that.
-       */
-      ctx->sampler.min_lod = ctx->sampler.max_lod = (float) srcLevel;
-      ctx->sampler.lod_bias = (float) srcLevel;
-      cso_single_sampler(ctx->cso, 0, &ctx->sampler);
-      cso_single_sampler_done(ctx->cso);
-
-      cso_set_fragment_sampler_views(ctx->cso, 1, &psv);
-
-      /* quad coords in clip coords */
-      offset = set_vertex_data(ctx,
-                               pt->target,
-                               face);
-
-      util_draw_vertex_buffer(ctx->pipe, 
-                              ctx->vbuf,
-                              offset,
-                              PIPE_PRIM_TRIANGLE_FAN,
-                              4,  /* verts */
-                              2); /* attribs/vert */
-
-      pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-
-      /* need to signal that the texture has changed _after_ rendering to it */
-      pipe_surface_reference( &surf, NULL );
+      unsigned nr_layers, layer, i;
+      float rcoord = 0.0f;
+
+      if (pt->target == PIPE_TEXTURE_3D)
+         nr_layers = u_minify(pt->depth0, dstLevel);
+      else
+         nr_layers = 1;
+
+      for (i = 0; i < nr_layers; i++) {
+         struct pipe_surface *surf, surf_templ;
+         if (pt->target == PIPE_TEXTURE_3D) {
+            /* in theory with geom shaders and driver with full layer support
+               could do that in one go. */
+            layer = i;
+            offset = 1.0f / (float)(nr_layers * 2);
+            /* XXX hmm really? */
+            rcoord = (float)layer / (float)nr_layers + 1.0f / (float)(nr_layers * 2);
+         }
+         else
+            layer = face;
+
+         memset(&surf_templ, 0, sizeof(surf_templ));
+         u_surface_default_template(&surf_templ, pt, PIPE_BIND_RENDER_TARGET);
+         surf_templ.u.tex.level = dstLevel;
+         surf_templ.u.tex.first_layer = layer;
+         surf_templ.u.tex.last_layer = layer;
+         surf = pipe->create_surface(pipe, pt, &surf_templ);
+
+         /*
+          * Setup framebuffer / dest surface
+          */
+         fb.cbufs[0] = surf;
+         fb.width = u_minify(pt->width0, dstLevel);
+         fb.height = u_minify(pt->height0, dstLevel);
+         cso_set_framebuffer(ctx->cso, &fb);
+
+         /* viewport */
+         vp.scale[0] = 0.5f * fb.width;
+         vp.scale[1] = 0.5f * fb.height;
+         vp.scale[2] = 1.0f;
+         vp.scale[3] = 1.0f;
+         vp.translate[0] = 0.5f * fb.width;
+         vp.translate[1] = 0.5f * fb.height;
+         vp.translate[2] = 0.0f;
+         vp.translate[3] = 0.0f;
+         cso_set_viewport(ctx->cso, &vp);
+
+         /*
+          * Setup sampler state
+          * Note: we should only have to set the min/max LOD clamps to ensure
+          * we grab texels from the right mipmap level.  But some hardware
+          * has trouble with min clamping so we also set the lod_bias to
+          * try to work around that.
+          */
+         ctx->sampler.min_lod = ctx->sampler.max_lod = (float) srcLevel;
+         ctx->sampler.lod_bias = (float) srcLevel;
+         cso_single_sampler(ctx->cso, 0, &ctx->sampler);
+         cso_single_sampler_done(ctx->cso);
+
+         cso_set_fragment_sampler_views(ctx->cso, 1, &psv);
+
+         /* quad coords in clip coords */
+         offset = set_vertex_data(ctx,
+                                  pt->target,
+                                  face,
+                                  rcoord);
+
+         util_draw_vertex_buffer(ctx->pipe, 
+                                 ctx->vbuf,
+                                 offset,
+                                 PIPE_PRIM_TRIANGLE_FAN,
+                                 4,  /* verts */
+                                 2); /* attribs/vert */
+
+         pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+         /* need to signal that the texture has changed _after_ rendering to it */
+         pipe_surface_reference( &surf, NULL );
+      }
    }
 
    /* restore state we changed */
index a7502b9982b082add8a550e36b61ff50bc5e835a..a10b6a4aba9e8caaf794adb7f05934c34dd76f3d 100644 (file)
@@ -60,7 +60,7 @@ util_gen_mipmap_flush( struct gen_mipmap_state *ctx );
 extern void
 util_gen_mipmap(struct gen_mipmap_state *ctx,
                 struct pipe_sampler_view *psv,
-                uint face, uint baseLevel, uint lastLevel, uint filter);
+                uint layer, uint baseLevel, uint lastLevel, uint filter);
 
 
 #ifdef __cplusplus
index 65b079ed5372ec6a3e0571e72adee2650461c2bb..f2c9db3caf1f8a830772a78f39dd5b48b87c3b1a 100644 (file)
 #include "util/u_index_modify.h"
 #include "util/u_inlines.h"
 
+/* Ubyte indices. */
+
+void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context,
+                                       struct pipe_resource *elts,
+                                       int index_bias,
+                                       unsigned start,
+                                       unsigned count,
+                                       void *out)
+{
+    struct pipe_transfer *src_transfer;
+    unsigned char *in_map;
+    unsigned short *out_map = out;
+    unsigned i;
+
+    in_map = pipe_buffer_map(context, elts, PIPE_TRANSFER_READ, &src_transfer);
+    in_map += start;
+
+    for (i = 0; i < count; i++) {
+        *out_map = (unsigned short)(*in_map + index_bias);
+        in_map++;
+        out_map++;
+    }
+
+    pipe_buffer_unmap(context, src_transfer);
+}
+
 void util_shorten_ubyte_elts(struct pipe_context *context,
                             struct pipe_resource **elts,
                             int index_bias,
                             unsigned start,
                             unsigned count)
 {
-    struct pipe_screen* screen = context->screen;
     struct pipe_resource* new_elts;
-    unsigned char *in_map;
     unsigned short *out_map;
-    struct pipe_transfer *src_transfer, *dst_transfer;
-    unsigned i;
+    struct pipe_transfer *dst_transfer;
 
-    new_elts = pipe_buffer_create(screen,
+    new_elts = pipe_buffer_create(context->screen,
                                   PIPE_BIND_INDEX_BUFFER,
                                   2 * count);
 
-    in_map = pipe_buffer_map(context, *elts, PIPE_TRANSFER_READ, &src_transfer);
-    out_map = pipe_buffer_map(context, new_elts, PIPE_TRANSFER_WRITE, &dst_transfer);
+    out_map = pipe_buffer_map(context, new_elts, PIPE_TRANSFER_WRITE,
+                              &dst_transfer);
+    util_shorten_ubyte_elts_to_userptr(context, *elts, index_bias,
+                                       start, count, out_map);
+    pipe_buffer_unmap(context, dst_transfer);
+
+    *elts = new_elts;
+}
+
+
+/* Ushort indices. */
 
+void util_rebuild_ushort_elts_to_userptr(struct pipe_context *context,
+                                        struct pipe_resource *elts,
+                                        int index_bias,
+                                        unsigned start, unsigned count,
+                                        void *out)
+{
+    struct pipe_transfer *in_transfer = NULL;
+    unsigned short *in_map;
+    unsigned short *out_map = out;
+    unsigned i;
+
+    in_map = pipe_buffer_map(context, elts, PIPE_TRANSFER_READ, &in_transfer);
     in_map += start;
 
     for (i = 0; i < count; i++) {
@@ -52,10 +96,7 @@ void util_shorten_ubyte_elts(struct pipe_context *context,
         out_map++;
     }
 
-    pipe_buffer_unmap(context, *elts, src_transfer);
-    pipe_buffer_unmap(context, new_elts, dst_transfer);
-
-    *elts = new_elts;
+    pipe_buffer_unmap(context, in_transfer);
 }
 
 void util_rebuild_ushort_elts(struct pipe_context *context,
@@ -63,33 +104,47 @@ void util_rebuild_ushort_elts(struct pipe_context *context,
                              int index_bias,
                              unsigned start, unsigned count)
 {
-    struct pipe_transfer *in_transfer = NULL;
     struct pipe_transfer *out_transfer = NULL;
     struct pipe_resource *new_elts;
-    unsigned short *in_map;
     unsigned short *out_map;
-    unsigned i;
 
     new_elts = pipe_buffer_create(context->screen,
                                   PIPE_BIND_INDEX_BUFFER,
                                   2 * count);
 
-    in_map = pipe_buffer_map(context, *elts,
-                             PIPE_TRANSFER_READ, &in_transfer);
     out_map = pipe_buffer_map(context, new_elts,
                               PIPE_TRANSFER_WRITE, &out_transfer);
+    util_rebuild_ushort_elts_to_userptr(context, *elts, index_bias,
+                                        start, count, out_map);
+    pipe_buffer_unmap(context, out_transfer);
+
+    *elts = new_elts;
+}
+
+
+/* Uint indices. */
 
+void util_rebuild_uint_elts_to_userptr(struct pipe_context *context,
+                                      struct pipe_resource *elts,
+                                      int index_bias,
+                                      unsigned start, unsigned count,
+                                      void *out)
+{
+    struct pipe_transfer *in_transfer = NULL;
+    unsigned int *in_map;
+    unsigned int *out_map = out;
+    unsigned i;
+
+    in_map = pipe_buffer_map(context, elts, PIPE_TRANSFER_READ, &in_transfer);
     in_map += start;
+
     for (i = 0; i < count; i++) {
-        *out_map = (unsigned short)(*in_map + index_bias);
+        *out_map = (unsigned int)(*in_map + index_bias);
         in_map++;
         out_map++;
     }
 
-    pipe_buffer_unmap(context, *elts, in_transfer);
-    pipe_buffer_unmap(context, new_elts, out_transfer);
-
-    *elts = new_elts;
+    pipe_buffer_unmap(context, in_transfer);
 }
 
 void util_rebuild_uint_elts(struct pipe_context *context,
@@ -97,31 +152,19 @@ void util_rebuild_uint_elts(struct pipe_context *context,
                            int index_bias,
                            unsigned start, unsigned count)
 {
-    struct pipe_transfer *in_transfer = NULL;
     struct pipe_transfer *out_transfer = NULL;
     struct pipe_resource *new_elts;
-    unsigned int *in_map;
     unsigned int *out_map;
-    unsigned i;
 
     new_elts = pipe_buffer_create(context->screen,
                                   PIPE_BIND_INDEX_BUFFER,
                                   2 * count);
 
-    in_map = pipe_buffer_map(context, *elts,
-                             PIPE_TRANSFER_READ, &in_transfer);
     out_map = pipe_buffer_map(context, new_elts,
                               PIPE_TRANSFER_WRITE, &out_transfer);
-
-    in_map += start;
-    for (i = 0; i < count; i++) {
-        *out_map = (unsigned int)(*in_map + index_bias);
-        in_map++;
-        out_map++;
-    }
-
-    pipe_buffer_unmap(context, *elts, in_transfer);
-    pipe_buffer_unmap(context, new_elts, out_transfer);
+    util_rebuild_uint_elts_to_userptr(context, *elts, index_bias,
+                                      start, count, out_map);
+    pipe_buffer_unmap(context, out_transfer);
 
     *elts = new_elts;
 }
index 01a6cae94fc5e8b0356c4a75e16065ab62fc6e99..1e9de3dfac883feb378dd439fa71580fe069a8c6 100644 (file)
 #ifndef UTIL_INDEX_MODIFY_H
 #define UTIL_INDEX_MODIFY_H
 
+struct pipe_context;
+struct pipe_resource;
+
+void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context,
+                                       struct pipe_resource *elts,
+                                       int index_bias,
+                                       unsigned start,
+                                       unsigned count,
+                                       void *out);
+
 void util_shorten_ubyte_elts(struct pipe_context *context,
                             struct pipe_resource **elts,
                             int index_bias,
                             unsigned start,
                             unsigned count);
 
+
+
+void util_rebuild_ushort_elts_to_userptr(struct pipe_context *context,
+                                        struct pipe_resource *elts,
+                                        int index_bias,
+                                        unsigned start, unsigned count,
+                                        void *out);
+
 void util_rebuild_ushort_elts(struct pipe_context *context,
                              struct pipe_resource **elts,
                              int index_bias,
                              unsigned start, unsigned count);
 
+
+
+void util_rebuild_uint_elts_to_userptr(struct pipe_context *context,
+                                      struct pipe_resource *elts,
+                                      int index_bias,
+                                      unsigned start, unsigned count,
+                                      void *out);
+
 void util_rebuild_uint_elts(struct pipe_context *context,
                            struct pipe_resource **elts,
                            int index_bias,
                            unsigned start, unsigned count);
+
 #endif
index 6ed39561fbe941aa56f238b4932c8fac262e4cf6..b4870bce9818e4347f83c396653daea9f00509d4 100644 (file)
@@ -109,7 +109,7 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
 
    if (pipe_reference_described(&(*ptr)->reference, &surf->reference, 
                                 (debug_reference_descriptor)debug_describe_surface))
-      old_surf->texture->screen->tex_surface_destroy(old_surf);
+      old_surf->context->surface_destroy(old_surf->context, old_surf);
    *ptr = surf;
 }
 
@@ -136,26 +136,28 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_
 }
 
 static INLINE void
-pipe_surface_reset(struct pipe_surface* ps, struct pipe_resource *pt,
-               unsigned face, unsigned level, unsigned zslice, unsigned flags)
+pipe_surface_reset(struct pipe_context *ctx, struct pipe_surface* ps,
+                   struct pipe_resource *pt, unsigned level, unsigned layer,
+                   unsigned flags)
 {
    pipe_resource_reference(&ps->texture, pt);
    ps->format = pt->format;
    ps->width = u_minify(pt->width0, level);
    ps->height = u_minify(pt->height0, level);
    ps->usage = flags;
-   ps->face = face;
-   ps->level = level;
-   ps->zslice = zslice;
+   ps->u.tex.level = level;
+   ps->u.tex.first_layer = ps->u.tex.last_layer = layer;
+   ps->context = ctx;
 }
 
 static INLINE void
-pipe_surface_init(struct pipe_surface* ps, struct pipe_resource *pt,
-                unsigned face, unsigned level, unsigned zslice, unsigned flags)
+pipe_surface_init(struct pipe_context *ctx, struct pipe_surface* ps,
+                  struct pipe_resource *pt, unsigned level, unsigned layer,
+                  unsigned flags)
 {
    ps->texture = 0;
    pipe_reference_init(&ps->reference, 1);
-   pipe_surface_reset(ps, pt, face, level, zslice, flags);
+   pipe_surface_reset(ctx, ps, pt, level, layer, flags);
 }
 
 /*
@@ -177,6 +179,7 @@ pipe_buffer_create( struct pipe_screen *screen,
    buffer.width0 = size;
    buffer.height0 = 1;
    buffer.depth0 = 1;
+   buffer.array_size = 1;
    return screen->resource_create(screen, &buffer);
 }
 
@@ -202,15 +205,15 @@ pipe_buffer_map_range(struct pipe_context *pipe,
    assert(offset < buffer->width0);
    assert(offset + length <= buffer->width0);
    assert(length);
-   
+
    u_box_1d(offset, length, &box);
 
    *transfer = pipe->get_transfer( pipe,
-                                  buffer,
-                                  u_subresource(0, 0),
-                                  usage,
-                                  &box);
-   
+                                   buffer,
+                                   0,
+                                   usage,
+                                   &box);
+
    if (*transfer == NULL)
       return NULL;
 
@@ -231,7 +234,7 @@ static INLINE void *
 pipe_buffer_map(struct pipe_context *pipe,
                 struct pipe_resource *buffer,
                 unsigned usage,
-               struct pipe_transfer **transfer)
+                struct pipe_transfer **transfer)
 {
    return pipe_buffer_map_range(pipe, buffer, 0, buffer->width0, usage, transfer);
 }
@@ -239,8 +242,7 @@ pipe_buffer_map(struct pipe_context *pipe,
 
 static INLINE void
 pipe_buffer_unmap(struct pipe_context *pipe,
-                  struct pipe_resource *buf,
-                 struct pipe_transfer *transfer)
+                  struct pipe_transfer *transfer)
 {
    if (transfer) {
       pipe->transfer_unmap(pipe, transfer);
@@ -250,7 +252,7 @@ pipe_buffer_unmap(struct pipe_context *pipe,
 
 static INLINE void
 pipe_buffer_flush_mapped_range(struct pipe_context *pipe,
-                              struct pipe_transfer *transfer,
+                               struct pipe_transfer *transfer,
                                unsigned offset,
                                unsigned length)
 {
@@ -266,7 +268,7 @@ pipe_buffer_flush_mapped_range(struct pipe_context *pipe,
     * mapped range.
     */
    transfer_offset = offset - transfer->box.x;
-   
+
    u_box_1d(transfer_offset, length, &box);
 
    pipe->transfer_flush_region(pipe, transfer, &box);
@@ -276,7 +278,7 @@ static INLINE void
 pipe_buffer_write(struct pipe_context *pipe,
                   struct pipe_resource *buf,
                   unsigned offset,
-                 unsigned size,
+                  unsigned size,
                   const void *data)
 {
    struct pipe_box box;
@@ -284,13 +286,13 @@ pipe_buffer_write(struct pipe_context *pipe,
    u_box_1d(offset, size, &box);
 
    pipe->transfer_inline_write( pipe,
-                               buf,
-                               u_subresource(0,0),
-                               PIPE_TRANSFER_WRITE,
-                               &box,
-                               data,
-                               size,
-                               0);
+                                buf,
+                                0,
+                                PIPE_TRANSFER_WRITE,
+                                &box,
+                                data,
+                                size,
+                                0);
 }
 
 /**
@@ -309,21 +311,21 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe,
 
    u_box_1d(offset, size, &box);
 
-   pipe->transfer_inline_write(pipe, 
-                              buf,
-                              u_subresource(0,0),
-                              (PIPE_TRANSFER_WRITE |
-                               PIPE_TRANSFER_NOOVERWRITE),
-                              &box,
-                              data,
-                              0, 0);
+   pipe->transfer_inline_write(pipe,
+                               buf,
+                               0,
+                               (PIPE_TRANSFER_WRITE |
+                                PIPE_TRANSFER_NOOVERWRITE),
+                               &box,
+                               data,
+                               0, 0);
 }
 
 static INLINE void
 pipe_buffer_read(struct pipe_context *pipe,
                  struct pipe_resource *buf,
                  unsigned offset,
-                unsigned size,
+                 unsigned size,
                  void *data)
 {
    struct pipe_transfer *src_transfer;
@@ -338,25 +340,24 @@ pipe_buffer_read(struct pipe_context *pipe,
    if (map)
       memcpy(data, map + offset, size);
 
-   pipe_buffer_unmap(pipe, buf, src_transfer);
+   pipe_buffer_unmap(pipe, src_transfer);
 }
 
 static INLINE struct pipe_transfer *
 pipe_get_transfer( struct pipe_context *context,
-                      struct pipe_resource *resource,
-                      unsigned face, unsigned level,
-                      unsigned zslice,
-                      enum pipe_transfer_usage usage,
-                      unsigned x, unsigned y,
-                      unsigned w, unsigned h)
+                   struct pipe_resource *resource,
+                   unsigned level, unsigned layer,
+                   enum pipe_transfer_usage usage,
+                   unsigned x, unsigned y,
+                   unsigned w, unsigned h)
 {
    struct pipe_box box;
-   u_box_2d_zslice( x, y, zslice, w, h, &box );
+   u_box_2d_zslice( x, y, layer, w, h, &box );
    return context->get_transfer( context,
-                                resource,
-                                u_subresource(face, level),
-                                usage,
-                                &box );
+                                 resource,
+                                 level,
+                                 usage,
+                                 &box );
 }
 
 static INLINE void *
@@ -376,7 +377,7 @@ pipe_transfer_unmap( struct pipe_context *context,
 
 static INLINE void
 pipe_transfer_destroy( struct pipe_context *context, 
-                      struct pipe_transfer *transfer )
+                       struct pipe_transfer *transfer )
 {
    context->transfer_destroy(context, transfer);
 }
@@ -399,6 +400,34 @@ static INLINE boolean util_get_offset(
    }
 }
 
+/**
+ * This function is used to copy an array of pipe_vertex_buffer structures,
+ * while properly referencing the pipe_vertex_buffer::buffer member.
+ *
+ * \sa util_copy_framebuffer_state
+ */
+static INLINE void util_copy_vertex_buffers(struct pipe_vertex_buffer *dst,
+                                            unsigned *dst_count,
+                                            const struct pipe_vertex_buffer *src,
+                                            unsigned src_count)
+{
+   unsigned i;
+
+   /* Reference the buffers of 'src' in 'dst'. */
+   for (i = 0; i < src_count; i++) {
+      pipe_resource_reference(&dst[i].buffer, src[i].buffer);
+   }
+   /* Unreference the rest of the buffers in 'dst'. */
+   for (; i < *dst_count; i++) {
+      pipe_resource_reference(&dst[i].buffer, NULL);
+   }
+
+   /* Update the size of 'dst' and copy over the other members
+    * of pipe_vertex_buffer. */
+   *dst_count = src_count;
+   memcpy(dst, src, src_count * sizeof(struct pipe_vertex_buffer));
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gallium/auxiliary/util/u_mempool.c b/src/gallium/auxiliary/util/u_mempool.c
deleted file mode 100644 (file)
index 1f336b3..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2010 Marek Olšák <maraeo@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include "util/u_mempool.h"
-
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "util/u_simple_list.h"
-
-#include <stdio.h>
-
-#define UTIL_MEMPOOL_MAGIC 0xcafe4321
-
-/* The block is either allocated memory or free space. */
-struct util_mempool_block {
-   /* The header. */
-   /* The first next free block. */
-   struct util_mempool_block *next_free;
-
-   intptr_t magic;
-
-   /* Memory after the last member is dedicated to the block itself.
-    * The allocated size is always larger than this structure. */
-};
-
-static struct util_mempool_block *
-util_mempool_get_block(struct util_mempool *pool,
-                       struct util_mempool_page *page, unsigned index)
-{
-   return (struct util_mempool_block*)
-          ((uint8_t*)page + sizeof(struct util_mempool_page) +
-           (pool->block_size * index));
-}
-
-static void util_mempool_add_new_page(struct util_mempool *pool)
-{
-   struct util_mempool_page *page;
-   struct util_mempool_block *block;
-   int i;
-
-   page = MALLOC(pool->page_size);
-   insert_at_tail(&pool->list, page);
-
-   /* Mark all blocks as free. */
-   for (i = 0; i < pool->num_blocks-1; i++) {
-      block = util_mempool_get_block(pool, page, i);
-      block->next_free = util_mempool_get_block(pool, page, i+1);
-      block->magic = UTIL_MEMPOOL_MAGIC;
-   }
-
-   block = util_mempool_get_block(pool, page, pool->num_blocks-1);
-   block->next_free = pool->first_free;
-   block->magic = UTIL_MEMPOOL_MAGIC;
-   pool->first_free = util_mempool_get_block(pool, page, 0);
-   pool->num_pages++;
-
-#if 0
-   fprintf(stderr, "New page! Num of pages: %i\n", pool->num_pages);
-#endif
-}
-
-static void *util_mempool_malloc_st(struct util_mempool *pool)
-{
-   struct util_mempool_block *block;
-
-   if (!pool->first_free)
-      util_mempool_add_new_page(pool);
-
-   block = pool->first_free;
-   assert(block->magic == UTIL_MEMPOOL_MAGIC);
-   pool->first_free = block->next_free;
-
-   return (uint8_t*)block + sizeof(struct util_mempool_block);
-}
-
-static void util_mempool_free_st(struct util_mempool *pool, void *ptr)
-{
-   struct util_mempool_block *block =
-         (struct util_mempool_block*)
-         ((uint8_t*)ptr - sizeof(struct util_mempool_block));
-
-   assert(block->magic == UTIL_MEMPOOL_MAGIC);
-   block->next_free = pool->first_free;
-   pool->first_free = block;
-}
-
-static void *util_mempool_malloc_mt(struct util_mempool *pool)
-{
-   void *mem;
-
-   pipe_mutex_lock(pool->mutex);
-   mem = util_mempool_malloc_st(pool);
-   pipe_mutex_unlock(pool->mutex);
-   return mem;
-}
-
-static void util_mempool_free_mt(struct util_mempool *pool, void *ptr)
-{
-   pipe_mutex_lock(pool->mutex);
-   util_mempool_free_st(pool, ptr);
-   pipe_mutex_unlock(pool->mutex);
-}
-
-void util_mempool_set_thread_safety(struct util_mempool *pool,
-                                    enum util_mempool_threading threading)
-{
-   pool->threading = threading;
-
-   if (threading) {
-      pool->malloc = util_mempool_malloc_mt;
-      pool->free = util_mempool_free_mt;
-   } else {
-      pool->malloc = util_mempool_malloc_st;
-      pool->free = util_mempool_free_st;
-   }
-}
-
-void util_mempool_create(struct util_mempool *pool,
-                         unsigned item_size,
-                         unsigned num_blocks,
-                         enum util_mempool_threading threading)
-{
-   item_size = align(item_size, sizeof(intptr_t));
-
-   pool->num_pages = 0;
-   pool->num_blocks = num_blocks;
-   pool->block_size = sizeof(struct util_mempool_block) + item_size;
-   pool->block_size = align(pool->block_size, sizeof(intptr_t));
-   pool->page_size = sizeof(struct util_mempool_page) +
-                     num_blocks * pool->block_size;
-   pool->first_free = NULL;
-
-   make_empty_list(&pool->list);
-
-   pipe_mutex_init(pool->mutex);
-
-   util_mempool_set_thread_safety(pool, threading);
-}
-
-void util_mempool_destroy(struct util_mempool *pool)
-{
-   struct util_mempool_page *page, *temp;
-
-   foreach_s(page, temp, &pool->list) {
-      remove_from_list(page);
-      FREE(page);
-   }
-
-   pipe_mutex_destroy(pool->mutex);
-}
diff --git a/src/gallium/auxiliary/util/u_mempool.h b/src/gallium/auxiliary/util/u_mempool.h
deleted file mode 100644 (file)
index a5b5d6a..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2010 Marek Olšák <maraeo@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-/**
- * @file
- * Simple memory pool for equally sized memory allocations.
- * util_mempool_malloc and util_mempool_free are in O(1).
- *
- * Good for allocations which have very low lifetime and are allocated
- * and freed very often. Use a profiler first!
- *
- * Candidates: get_transfer, user_buffer_create
- *
- * @author Marek Olšák
- */
-
-#ifndef U_MEMPOOL_H
-#define U_MEMPOOL_H
-
-#include "os/os_thread.h"
-
-enum util_mempool_threading {
-   UTIL_MEMPOOL_SINGLETHREADED = FALSE,
-   UTIL_MEMPOOL_MULTITHREADED = TRUE
-};
-
-/* The page is an array of blocks (allocations). */
-struct util_mempool_page {
-   /* The header (linked-list pointers). */
-   struct util_mempool_page *prev, *next;
-
-   /* Memory after the last member is dedicated to the page itself.
-    * The allocated size is always larger than this structure. */
-};
-
-struct util_mempool {
-   /* Public members. */
-   void *(*malloc)(struct util_mempool *pool);
-   void (*free)(struct util_mempool *pool, void *ptr);
-
-   /* Private members. */
-   struct util_mempool_block *first_free;
-
-   struct util_mempool_page list;
-
-   unsigned block_size;
-   unsigned page_size;
-   unsigned num_blocks;
-   unsigned num_pages;
-   enum util_mempool_threading threading;
-
-   pipe_mutex mutex;
-};
-
-void util_mempool_create(struct util_mempool *pool,
-                         unsigned item_size,
-                         unsigned num_blocks,
-                         enum util_mempool_threading threading);
-
-void util_mempool_destroy(struct util_mempool *pool);
-
-void util_mempool_set_thread_safety(struct util_mempool *pool,
-                                    enum util_mempool_threading threading);
-
-#define util_mempool_malloc(pool)    (pool)->malloc(pool)
-#define util_mempool_free(pool, ptr) (pool)->free(pool, ptr)
-
-#endif
index 9e6474b83de6f7a121204f86e995a9d1e00ccb76..443c9f8067ef53643bfe28c8f557aa4bc99d4428 100644 (file)
@@ -10,85 +10,85 @@ u_resource( struct pipe_resource *res )
 }
 
 boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
-                         struct pipe_resource *resource,
-                         struct winsys_handle *handle)
+                                   struct pipe_resource *resource,
+                                   struct winsys_handle *handle)
 {
    struct u_resource *ur = u_resource(resource);
    return ur->vtbl->resource_get_handle(screen, resource, handle);
 }
 
 void u_resource_destroy_vtbl(struct pipe_screen *screen,
-                   struct pipe_resource *resource)
+                             struct pipe_resource *resource)
 {
    struct u_resource *ur = u_resource(resource);
    ur->vtbl->resource_destroy(screen, resource);
 }
 
 unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe,
-                                       struct pipe_resource *resource,
-                                       unsigned face, unsigned level)
+                                        struct pipe_resource *resource,
+                                        unsigned level, int layer)
 {
    struct u_resource *ur = u_resource(resource);
-   return ur->vtbl->is_resource_referenced(pipe, resource, face, level);
+   return ur->vtbl->is_resource_referenced(pipe, resource, level, layer);
 }
 
 struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
-                                         struct pipe_resource *resource,
-                                         struct pipe_subresource sr,
-                                         enum pipe_transfer_usage usage,
-                                         const struct pipe_box *box)
+                                          struct pipe_resource *resource,
+                                          unsigned level,
+                                          enum pipe_transfer_usage usage,
+                                          const struct pipe_box *box)
 {
    struct u_resource *ur = u_resource(resource);
-   return ur->vtbl->get_transfer(context, resource, sr, usage, box);
+   return ur->vtbl->get_transfer(context, resource, level, usage, box);
 }
 
 void u_transfer_destroy_vtbl(struct pipe_context *pipe,
-                            struct pipe_transfer *transfer)
+                             struct pipe_transfer *transfer)
 {
    struct u_resource *ur = u_resource(transfer->resource);
    ur->vtbl->transfer_destroy(pipe, transfer);
 }
 
 void *u_transfer_map_vtbl( struct pipe_context *pipe,
-                          struct pipe_transfer *transfer )
+                           struct pipe_transfer *transfer )
 {
    struct u_resource *ur = u_resource(transfer->resource);
    return ur->vtbl->transfer_map(pipe, transfer);
 }
 
 void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
-                                  struct pipe_transfer *transfer,
-                                  const struct pipe_box *box)
+                                   struct pipe_transfer *transfer,
+                                   const struct pipe_box *box)
 {
    struct u_resource *ur = u_resource(transfer->resource);
    ur->vtbl->transfer_flush_region(pipe, transfer, box);
 }
 
 void u_transfer_unmap_vtbl( struct pipe_context *pipe,
-                           struct pipe_transfer *transfer )
+                            struct pipe_transfer *transfer )
 {
    struct u_resource *ur = u_resource(transfer->resource);
    ur->vtbl->transfer_unmap(pipe, transfer);
 }
 
 void u_transfer_inline_write_vtbl( struct pipe_context *pipe,
-                                  struct pipe_resource *resource,
-                                  struct pipe_subresource sr,
-                                  unsigned usage,
-                                  const struct pipe_box *box,
-                                  const void *data,
-                                  unsigned stride,
-                                  unsigned slice_stride)
+                                   struct pipe_resource *resource,
+                                   unsigned level,
+                                   unsigned usage,
+                                   const struct pipe_box *box,
+                                   const void *data,
+                                   unsigned stride,
+                                   unsigned layer_stride)
 {
    struct u_resource *ur = u_resource(resource);
-   ur->vtbl->transfer_inline_write(pipe, 
-                                  resource,
-                                  sr,
-                                  usage,
-                                  box,
-                                  data,
-                                  stride,
-                                  slice_stride);
+   ur->vtbl->transfer_inline_write(pipe,
+                                   resource,
+                                   level,
+                                   usage,
+                                   box,
+                                   data,
+                                   stride,
+                                   layer_stride);
 }
 
 
index e77f562ea222a2cec01a2f38636d14acad873b3d..bb26099b7e15febdb349ac1223abe3d62b3b5c90 100644 (file)
@@ -40,8 +40,11 @@ default_template(struct pipe_sampler_view *view,
     */
 
    view->format = format;
-   view->first_level = 0;
-   view->last_level = texture->last_level;
+   view->u.tex.first_level = 0;
+   view->u.tex.last_level = texture->last_level;
+   view->u.tex.first_layer = 0;
+   view->u.tex.last_layer = texture->target == PIPE_TEXTURE_3D ?
+                               texture->depth0 - 1 : texture->array_size - 1;
    view->swizzle_r = PIPE_SWIZZLE_RED;
    view->swizzle_g = PIPE_SWIZZLE_GREEN;
    view->swizzle_b = PIPE_SWIZZLE_BLUE;
index b52232f025c2e779b1ac094a28f5b0700c0fdc50..7139aaabc565b5d686c4c85ca0efff2516d46993 100644 (file)
@@ -57,7 +57,8 @@ struct pipe_winsys
     * displayed, eg copy fake frontbuffer.
     */
    void (*flush_frontbuffer)( struct pipe_winsys *ws,
-                              struct pipe_surface *surf,
+                              struct pipe_resource *resource,
+                              unsigned level, unsigned layer,
                               void *context_private );
 
 
index 58ef68377fcea467509125842e854c72cdf205ef..b0f2dd8aa29e8173c9620140c180fa2f6c5a4238 100644 (file)
@@ -204,7 +204,8 @@ util_make_fragment_tex_shader_writedepth(struct pipe_context *pipe,
 void *
 util_make_fragment_passthrough_shader(struct pipe_context *pipe)
 {
-   return util_make_fragment_clonecolor_shader(pipe, 1);
+   return util_make_fragment_cloneinput_shader(pipe, 1, TGSI_SEMANTIC_COLOR,
+                                               TGSI_INTERPOLATE_PERSPECTIVE);
 }
 
 
@@ -212,7 +213,9 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe)
  * Make a fragment shader that copies the input color to N output colors.
  */
 void *
-util_make_fragment_clonecolor_shader(struct pipe_context *pipe, int num_cbufs)
+util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
+                                     int input_semantic,
+                                     int input_interpolate)
 {
    struct ureg_program *ureg;
    struct ureg_src src;
@@ -225,8 +228,8 @@ util_make_fragment_clonecolor_shader(struct pipe_context *pipe, int num_cbufs)
    if (ureg == NULL)
       return NULL;
 
-   src = ureg_DECL_fs_input( ureg, TGSI_SEMANTIC_COLOR, 0, 
-                             TGSI_INTERPOLATE_PERSPECTIVE );
+   src = ureg_DECL_fs_input( ureg, input_semantic, 0,
+                             input_interpolate );
 
    for (i = 0; i < num_cbufs; i++)
       dst[i] = ureg_DECL_output( ureg, TGSI_SEMANTIC_COLOR, i );
index 4aa34bc47575289450e83ef12b9c94fe22536730..1bfec183e3471579adb3c4b85822efbf6da77fd0 100644 (file)
@@ -71,7 +71,9 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe);
 
 
 extern void *
-util_make_fragment_clonecolor_shader(struct pipe_context *pipe, int num_cbufs);
+util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
+                                     int input_semantic,
+                                     int input_interpolate);
 
 #ifdef __cplusplus
 }
diff --git a/src/gallium/auxiliary/util/u_slab.c b/src/gallium/auxiliary/util/u_slab.c
new file mode 100644 (file)
index 0000000..21bf2d7
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "util/u_slab.h"
+
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+
+#include <stdio.h>
+
+#define UTIL_SLAB_MAGIC 0xcafe4321
+
+/* The block is either allocated memory or free space. */
+struct util_slab_block {
+   /* The header. */
+   /* The first next free block. */
+   struct util_slab_block *next_free;
+
+   intptr_t magic;
+
+   /* Memory after the last member is dedicated to the block itself.
+    * The allocated size is always larger than this structure. */
+};
+
+static struct util_slab_block *
+util_slab_get_block(struct util_slab_mempool *pool,
+                    struct util_slab_page *page, unsigned index)
+{
+   return (struct util_slab_block*)
+          ((uint8_t*)page + sizeof(struct util_slab_page) +
+           (pool->block_size * index));
+}
+
+static void util_slab_add_new_page(struct util_slab_mempool *pool)
+{
+   struct util_slab_page *page;
+   struct util_slab_block *block;
+   int i;
+
+   page = MALLOC(pool->page_size);
+   insert_at_tail(&pool->list, page);
+
+   /* Mark all blocks as free. */
+   for (i = 0; i < pool->num_blocks-1; i++) {
+      block = util_slab_get_block(pool, page, i);
+      block->next_free = util_slab_get_block(pool, page, i+1);
+      block->magic = UTIL_SLAB_MAGIC;
+   }
+
+   block = util_slab_get_block(pool, page, pool->num_blocks-1);
+   block->next_free = pool->first_free;
+   block->magic = UTIL_SLAB_MAGIC;
+   pool->first_free = util_slab_get_block(pool, page, 0);
+   pool->num_pages++;
+
+#if 0
+   fprintf(stderr, "New page! Num of pages: %i\n", pool->num_pages);
+#endif
+}
+
+static void *util_slab_alloc_st(struct util_slab_mempool *pool)
+{
+   struct util_slab_block *block;
+
+   if (!pool->first_free)
+      util_slab_add_new_page(pool);
+
+   block = pool->first_free;
+   assert(block->magic == UTIL_SLAB_MAGIC);
+   pool->first_free = block->next_free;
+
+   return (uint8_t*)block + sizeof(struct util_slab_block);
+}
+
+static void util_slab_free_st(struct util_slab_mempool *pool, void *ptr)
+{
+   struct util_slab_block *block =
+         (struct util_slab_block*)
+         ((uint8_t*)ptr - sizeof(struct util_slab_block));
+
+   assert(block->magic == UTIL_SLAB_MAGIC);
+   block->next_free = pool->first_free;
+   pool->first_free = block;
+}
+
+static void *util_slab_alloc_mt(struct util_slab_mempool *pool)
+{
+   void *mem;
+
+   pipe_mutex_lock(pool->mutex);
+   mem = util_slab_alloc_st(pool);
+   pipe_mutex_unlock(pool->mutex);
+   return mem;
+}
+
+static void util_slab_free_mt(struct util_slab_mempool *pool, void *ptr)
+{
+   pipe_mutex_lock(pool->mutex);
+   util_slab_free_st(pool, ptr);
+   pipe_mutex_unlock(pool->mutex);
+}
+
+void util_slab_set_thread_safety(struct util_slab_mempool *pool,
+                                    enum util_slab_threading threading)
+{
+   pool->threading = threading;
+
+   if (threading) {
+      pool->alloc = util_slab_alloc_mt;
+      pool->free = util_slab_free_mt;
+   } else {
+      pool->alloc = util_slab_alloc_st;
+      pool->free = util_slab_free_st;
+   }
+}
+
+void util_slab_create(struct util_slab_mempool *pool,
+                      unsigned item_size,
+                      unsigned num_blocks,
+                      enum util_slab_threading threading)
+{
+   item_size = align(item_size, sizeof(intptr_t));
+
+   pool->num_pages = 0;
+   pool->num_blocks = num_blocks;
+   pool->block_size = sizeof(struct util_slab_block) + item_size;
+   pool->block_size = align(pool->block_size, sizeof(intptr_t));
+   pool->page_size = sizeof(struct util_slab_page) +
+                     num_blocks * pool->block_size;
+   pool->first_free = NULL;
+
+   make_empty_list(&pool->list);
+
+   pipe_mutex_init(pool->mutex);
+
+   util_slab_set_thread_safety(pool, threading);
+}
+
+void util_slab_destroy(struct util_slab_mempool *pool)
+{
+   struct util_slab_page *page, *temp;
+
+   foreach_s(page, temp, &pool->list) {
+      remove_from_list(page);
+      FREE(page);
+   }
+
+   pipe_mutex_destroy(pool->mutex);
+}
diff --git a/src/gallium/auxiliary/util/u_slab.h b/src/gallium/auxiliary/util/u_slab.h
new file mode 100644 (file)
index 0000000..6b9718d
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/**
+ * @file
+ * Simple slab allocator for equally sized memory allocations.
+ * util_slab_alloc and util_slab_free have time complexity in O(1).
+ *
+ * Good for allocations which have very low lifetime and are allocated
+ * and freed very often. Use a profiler first to know if it's worth using it!
+ *
+ * Candidates: get_transfer, user_buffer_create
+ *
+ * @author Marek Olšák
+ */
+
+#ifndef U_SLAB_H
+#define U_SLAB_H
+
+#include "os/os_thread.h"
+
+enum util_slab_threading {
+   UTIL_SLAB_SINGLETHREADED = FALSE,
+   UTIL_SLAB_MULTITHREADED = TRUE
+};
+
+/* The page is an array of blocks (allocations). */
+struct util_slab_page {
+   /* The header (linked-list pointers). */
+   struct util_slab_page *prev, *next;
+
+   /* Memory after the last member is dedicated to the page itself.
+    * The allocated size is always larger than this structure. */
+};
+
+struct util_slab_mempool {
+   /* Public members. */
+   void *(*alloc)(struct util_slab_mempool *pool);
+   void (*free)(struct util_slab_mempool *pool, void *ptr);
+
+   /* Private members. */
+   struct util_slab_block *first_free;
+
+   struct util_slab_page list;
+
+   unsigned block_size;
+   unsigned page_size;
+   unsigned num_blocks;
+   unsigned num_pages;
+   enum util_slab_threading threading;
+
+   pipe_mutex mutex;
+};
+
+void util_slab_create(struct util_slab_mempool *pool,
+                      unsigned item_size,
+                      unsigned num_blocks,
+                      enum util_slab_threading threading);
+
+void util_slab_destroy(struct util_slab_mempool *pool);
+
+void util_slab_set_thread_safety(struct util_slab_mempool *pool,
+                                 enum util_slab_threading threading);
+
+#define util_slab_alloc(pool)     (pool)->alloc(pool)
+#define util_slab_free(pool, ptr) (pool)->free(pool, ptr)
+
+#endif
index c5d68f8df8674aac26cbe8adc90194fa5438aae7..b6bf241a22a2d8ad96d4af04093bf065b11db14b 100644 (file)
@@ -41,6 +41,7 @@ util_staging_resource_template(struct pipe_resource *pt, unsigned width, unsigne
    template->width0 = width;
    template->height0 = height;
    template->depth0 = depth;
+   template->array_size = 1;
    template->last_level = 0;
    template->nr_samples = pt->nr_samples;
    template->bind = 0;
@@ -51,7 +52,7 @@ util_staging_resource_template(struct pipe_resource *pt, unsigned width, unsigne
 struct util_staging_transfer *
 util_staging_transfer_init(struct pipe_context *pipe,
            struct pipe_resource *pt,
-           struct pipe_subresource sr,
+           unsigned level,
            unsigned usage,
            const struct pipe_box *box,
            bool direct, struct util_staging_transfer *tx)
@@ -61,7 +62,7 @@ util_staging_transfer_init(struct pipe_context *pipe,
    struct pipe_resource staging_resource_template;
 
    pipe_resource_reference(&tx->base.resource, pt);
-   tx->base.sr = sr;
+   tx->base.level = level;
    tx->base.usage = usage;
    tx->base.box = *box;
 
@@ -82,12 +83,20 @@ util_staging_transfer_init(struct pipe_context *pipe,
 
    if (usage & PIPE_TRANSFER_READ)
    {
-      struct pipe_subresource dstsr;
+      /* XXX this looks wrong dst is always the same but looping over src z? */
       unsigned zi;
-      dstsr.face = 0;
-      dstsr.level = 0;
-      for(zi = 0; zi < box->depth; ++zi)
-         pipe->resource_copy_region(pipe, tx->staging_resource, dstsr, 0, 0, 0, tx->base.resource, sr, box->x, box->y, box->z + zi, box->width, box->height);
+      struct pipe_box sbox;
+      sbox.x = box->x;
+      sbox.y = box->y;
+      sbox.z = box->z;
+      sbox.width = box->width;
+      sbox.height = box->height;
+      sbox.depth = 1;
+      for(zi = 0; zi < box->depth; ++zi) {
+         sbox.z = sbox.z + zi;
+         pipe->resource_copy_region(pipe, tx->staging_resource, 0, 0, 0, 0,
+                                    tx->base.resource, level, &sbox);
+      }
    }
 
    return tx;
@@ -101,12 +110,18 @@ util_staging_transfer_destroy(struct pipe_context *pipe, struct pipe_transfer *p
    if (tx->staging_resource != tx->base.resource)
    {
       if(tx->base.usage & PIPE_TRANSFER_WRITE) {
-         struct pipe_subresource srcsr;
+         /* XXX this looks wrong src is always the same but looping over dst z? */
          unsigned zi;
-         srcsr.face = 0;
-         srcsr.level = 0;
+         struct pipe_box sbox;
+         sbox.x = 0;
+         sbox.y = 0;
+         sbox.z = 0;
+         sbox.width = tx->base.box.width;
+         sbox.height = tx->base.box.height;
+         sbox.depth = 1;
          for(zi = 0; zi < tx->base.box.depth; ++zi)
-            pipe->resource_copy_region(pipe, tx->base.resource, tx->base.sr, tx->base.box.x, tx->base.box.y, tx->base.box.z + zi, tx->staging_resource, srcsr, 0, 0, 0, tx->base.box.width, tx->base.box.height);
+            pipe->resource_copy_region(pipe, tx->base.resource, tx->base.level, tx->base.box.x, tx->base.box.y, tx->base.box.z + zi,
+                                       tx->staging_resource, 0, &sbox);
       }
 
       pipe_resource_reference(&tx->staging_resource, NULL);
index 1aab78cc88173fd47a0eb339e657be972bab73b1..49839d254396d1c6740fe75dec492f0d36d4d0f7 100644 (file)
@@ -52,7 +52,7 @@ struct util_staging_transfer {
 struct util_staging_transfer *
 util_staging_transfer_init(struct pipe_context *pipe,
            struct pipe_resource *pt,
-           struct pipe_subresource sr,
+           unsigned level,
            unsigned usage,
            const struct pipe_box *box,
            bool direct, struct util_staging_transfer *tx);
index f78b6838a72e53ca5907c13d4e0f5c279565fc33..4eddd3f519e8d430c5abdb52788162ed59d14375 100644 (file)
 #include "util/u_surface.h"
 #include "util/u_pack_color.h"
 
+void
+u_surface_default_template(struct pipe_surface *view,
+                           const struct pipe_resource *texture,
+                           unsigned bind)
+{
+   view->format = texture->format;
+   view->u.tex.level = 0;
+   view->u.tex.first_layer = 0;
+   view->u.tex.last_layer = 0;
+   /* XXX should filter out all non-rt/ds bind flags ? */
+   view->usage = bind;
+}
 
 /**
  * Helper to quickly create an RGBA rendering surface of a certain size.
@@ -50,9 +62,9 @@
  * \return TRUE for success, FALSE if failure
  */
 boolean
-util_create_rgba_surface(struct pipe_screen *screen,
+util_create_rgba_surface(struct pipe_context *pipe,
                          uint width, uint height,
-                        uint bind,
+                         uint bind,
                          struct pipe_resource **textureOut,
                          struct pipe_surface **surfaceOut)
 {
@@ -65,6 +77,8 @@ util_create_rgba_surface(struct pipe_screen *screen,
    const uint target = PIPE_TEXTURE_2D;
    enum pipe_format format = PIPE_FORMAT_NONE;
    struct pipe_resource templ;
+   struct pipe_surface surf_templ;
+   struct pipe_screen *screen = pipe->screen;
    uint i;
 
    /* Choose surface format */
@@ -86,17 +100,20 @@ util_create_rgba_surface(struct pipe_screen *screen,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = bind;
 
    *textureOut = screen->resource_create(screen, &templ);
    if (!*textureOut)
       return FALSE;
 
+   /* create surface */
+   memset(&surf_templ, 0, sizeof(surf_templ));
+   u_surface_default_template(&surf_templ, *textureOut, bind);
    /* create surface / view into texture */
-   *surfaceOut = screen->get_tex_surface(screen, 
-                                        *textureOut,
-                                        0, 0, 0,
-                                        bind);
+   *surfaceOut = pipe->create_surface(pipe,
+                                      *textureOut,
+                                      &surf_templ);
    if (!*surfaceOut) {
       pipe_resource_reference(textureOut, NULL);
       return FALSE;
@@ -126,17 +143,18 @@ util_destroy_rgba_surface(struct pipe_resource *texture,
 void
 util_resource_copy_region(struct pipe_context *pipe,
                           struct pipe_resource *dst,
-                          struct pipe_subresource subdst,
+                          unsigned dst_level,
                           unsigned dst_x, unsigned dst_y, unsigned dst_z,
                           struct pipe_resource *src,
-                          struct pipe_subresource subsrc,
-                          unsigned src_x, unsigned src_y, unsigned src_z,
-                          unsigned w, unsigned h)
+                          unsigned src_level,
+                          const struct pipe_box *src_box)
 {
    struct pipe_transfer *src_trans, *dst_trans;
    void *dst_map;
    const void *src_map;
    enum pipe_format src_format, dst_format;
+   unsigned w = src_box->width;
+   unsigned h = src_box->height;
 
    assert(src && dst);
    if (!src || !dst)
@@ -146,20 +164,18 @@ util_resource_copy_region(struct pipe_context *pipe,
    dst_format = dst->format;
 
    src_trans = pipe_get_transfer(pipe,
-                                src,
-                                subsrc.face,
-                                subsrc.level,
-                                src_z,
-                                PIPE_TRANSFER_READ,
-                                src_x, src_y, w, h);
+                                 src,
+                                 src_level,
+                                 src_box->z,
+                                 PIPE_TRANSFER_READ,
+                                 src_box->x, src_box->y, w, h);
 
    dst_trans = pipe_get_transfer(pipe,
-                                dst,
-                                subdst.face,
-                                subdst.level,
-                                src_z,
-                                PIPE_TRANSFER_WRITE,
-                                dst_x, dst_y, w, h);
+                                 dst,
+                                 dst_level,
+                                 dst_z,
+                                 PIPE_TRANSFER_WRITE,
+                                 dst_x, dst_y, w, h);
 
    assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format));
    assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format));
@@ -216,14 +232,13 @@ util_clear_render_target(struct pipe_context *pipe,
    assert(dst->texture);
    if (!dst->texture)
       return;
-
+   /* XXX: should handle multiple layers */
    dst_trans = pipe_get_transfer(pipe,
-                                dst->texture,
-                                dst->face,
-                                dst->level,
-                                dst->zslice,
-                                PIPE_TRANSFER_WRITE,
-                                dstx, dsty, width, height);
+                                 dst->texture,
+                                 dst->u.tex.level,
+                                 dst->u.tex.first_layer,
+                                 PIPE_TRANSFER_WRITE,
+                                 dstx, dsty, width, height);
 
    dst_map = pipe->transfer_map(pipe, dst_trans);
 
@@ -271,9 +286,8 @@ util_clear_depth_stencil(struct pipe_context *pipe,
       return;
    dst_trans = pipe_get_transfer(pipe,
                                  dst->texture,
-                                 dst->face,
-                                 dst->level,
-                                 dst->zslice,
+                                 dst->u.tex.level,
+                                 dst->u.tex.first_layer,
                                  (need_rmw ? PIPE_TRANSFER_READ_WRITE :
                                      PIPE_TRANSFER_WRITE),
                                  dstx, dsty, width, height);
index 6cd12af3a8b21a26545a13f4c037a12360959191..6a7cc82b0550710fc1dede3b7c686587b9d7b202 100644 (file)
 #include "pipe/p_state.h"
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern void
+u_surface_default_template(struct pipe_surface *view,
+                           const struct pipe_resource *texture,
+                           unsigned bind);
+
 extern boolean
-util_create_rgba_surface(struct pipe_screen *screen,
+util_create_rgba_surface(struct pipe_context *ctx,
                          uint width, uint height, uint bind,
                          struct pipe_resource **textureOut,
                          struct pipe_surface **surfaceOut);
@@ -49,12 +59,11 @@ util_destroy_rgba_surface(struct pipe_resource *texture,
 extern void
 util_resource_copy_region(struct pipe_context *pipe,
                           struct pipe_resource *dst,
-                          struct pipe_subresource subdst,
+                          unsigned dst_level,
                           unsigned dst_x, unsigned dst_y, unsigned dst_z,
                           struct pipe_resource *src,
-                          struct pipe_subresource subsrc,
-                          unsigned src_x, unsigned src_y, unsigned src_z,
-                          unsigned w, unsigned h);
+                          unsigned src_level,
+                          const struct pipe_box *src_box);
 
 extern void
 util_clear_render_target(struct pipe_context *pipe,
@@ -73,4 +82,9 @@ util_clear_depth_stencil(struct pipe_context *pipe,
                          unsigned width, unsigned height);
 
 
+#ifdef __cplusplus
+}
+#endif
+
+
 #endif /* U_SURFACE_H */
index 404e12199525681076c521076753d1bd2d117a12..b0cfec2a8260867d2f278e78a9b95d24f71e62e6 100644 (file)
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
-struct pipe_surface *
-util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags)
+boolean
+util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size,
+                     struct pipe_context *ctx, struct pipe_resource *pt,
+                     unsigned level, unsigned layer, unsigned flags,
+                     struct pipe_surface **res)
 {
    struct pipe_surface *ps;
 
@@ -39,7 +42,7 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, str
       if(!us->u.hash)
          us->u.hash = cso_hash_create();
 
-      ps = cso_hash_iter_data(cso_hash_find(us->u.hash, ((zslice + face) << 8) | level));
+      ps = cso_hash_iter_data(cso_hash_find(us->u.hash, (layer << 8) | level));
    }
    else
    {
@@ -48,25 +51,29 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, str
       ps = us->u.array[level];
    }
 
-   if(ps)
+   if(ps && ps->context == ctx)
    {
       p_atomic_inc(&ps->reference.count);
-      return ps;
+      *res = ps;
+      return FALSE;
    }
 
    ps = (struct pipe_surface *)CALLOC(1, surface_struct_size);
    if(!ps)
-      return NULL;
+   {
+      *res = NULL;
+      return FALSE;
+   }
 
-   pipe_surface_init(ps, pt, face, level, zslice, flags);
-   ps->offset = ~0;
+   pipe_surface_init(ctx, ps, pt, level, layer, flags);
 
    if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
-      cso_hash_insert(us->u.hash, ((zslice + face) << 8) | level, ps);
+      cso_hash_insert(us->u.hash, (layer << 8) | level, ps);
    else
       us->u.array[level] = ps;
 
-   return ps;
+   *res = ps;
+   return TRUE;
 }
 
 void
@@ -75,10 +82,10 @@ util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps)
    struct pipe_resource *pt = ps->texture;
    if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)
    {    /* or 2D array */
-      cso_hash_erase(us->u.hash, cso_hash_find(us->u.hash, ((ps->zslice + ps->face) << 8) | ps->level));
+      cso_hash_erase(us->u.hash, cso_hash_find(us->u.hash, (ps->u.tex.first_layer << 8) | ps->u.tex.level));
    }
    else
-      us->u.array[ps->level] = 0;
+      us->u.array[ps->u.tex.level] = 0;
 }
 
 void
index 17d8a5d3a5b6fc3e9908ae9b3a0be8ac5f7d38cf..9581feda7c814f00e46477040f8c49f1eb2924ee 100644 (file)
@@ -42,33 +42,42 @@ struct util_surfaces
    } u;
 };
 
-struct pipe_surface *util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags);
+/* Return value indicates if the pipe surface result is new */
+boolean
+util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size,
+                     struct pipe_context *ctx, struct pipe_resource *pt,
+                     unsigned level, unsigned layer, unsigned flags,
+                     struct pipe_surface **res);
 
 /* fast inline path for the very common case */
-static INLINE struct pipe_surface *
-util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags)
+static INLINE boolean
+util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size,
+                  struct pipe_context *ctx, struct pipe_resource *pt,
+                  unsigned level, unsigned layer, unsigned flags,
+                  struct pipe_surface **res)
 {
    if(likely((pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT) && us->u.array))
    {
       struct pipe_surface *ps = us->u.array[level];
-      if(ps)
+      if(ps && ps->context == ctx)
       {
         p_atomic_inc(&ps->reference.count);
-        return ps;
+        *res = ps;
+        return FALSE;
       }
    }
 
-   return util_surfaces_do_get(us, surface_struct_size, pscreen, pt, face, level, zslice, flags);
+   return util_surfaces_do_get(us, surface_struct_size, ctx, pt, level, layer, flags, res);
 }
 
 static INLINE struct pipe_surface *
-util_surfaces_peek(struct util_surfaces *us, struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice)
+util_surfaces_peek(struct util_surfaces *us, struct pipe_resource *pt, unsigned level, unsigned layer)
 {
    if(!us->u.pv)
       return 0;
 
    if(unlikely(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE))
-      return cso_hash_iter_data(cso_hash_find(us->u.hash, ((zslice + face) << 8) | level));
+      return cso_hash_iter_data(cso_hash_find(us->u.hash, (layer << 8) | level));
    else
       return us->u.array[level];
 }
@@ -80,7 +89,7 @@ util_surfaces_detach(struct util_surfaces *us, struct pipe_surface *ps)
 {
    if(likely(ps->texture->target == PIPE_TEXTURE_2D || ps->texture->target == PIPE_TEXTURE_RECT))
    {
-      us->u.array[ps->level] = 0;
+      us->u.array[ps->u.tex.level] = 0;
       return;
    }
 
index 69f6fab9504e62870031a27095a37da55db87a67..e2828cfd99e8ef54330f777dadc199b9335b9884 100644 (file)
@@ -8,22 +8,24 @@
  * pointer.  XXX: strides??
  */
 void u_default_transfer_inline_write( struct pipe_context *pipe,
-                                     struct pipe_resource *resource,
-                                     struct pipe_subresource sr,
-                                     unsigned usage,
-                                     const struct pipe_box *box,
-                                     const void *data,
-                                     unsigned stride,
-                                     unsigned slice_stride)
+                                      struct pipe_resource *resource,
+                                      unsigned level,
+                                      unsigned usage,
+                                      const struct pipe_box *box,
+                                      const void *data,
+                                      unsigned stride,
+                                      unsigned layer_stride)
 {
    struct pipe_transfer *transfer = NULL;
    uint8_t *map = NULL;
-
-   transfer = pipe->get_transfer(pipe, 
-                                resource,
-                                sr,
-                                usage,
-                                box );
+   const uint8_t *src_data = data;
+   unsigned i;
+
+   transfer = pipe->get_transfer(pipe,
+                                 resource,
+                                 level,
+                                 usage,
+                                 box );
    if (transfer == NULL)
       goto out;
 
@@ -31,17 +33,19 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
    if (map == NULL)
       goto out;
 
-   assert(box->depth == 1);    /* XXX: fix me */
-   
-   util_copy_rect(map,
-                 resource->format,
-                 transfer->stride, /* bytes */
-                 0, 0,
-                 box->width,
-                 box->height,
-                 data,
-                 stride,       /* bytes */
-                 0, 0);
+   for (i = 0; i < box->depth; i++) {
+      util_copy_rect(map,
+                     resource->format,
+                     transfer->stride, /* bytes */
+                     0, 0,
+                     box->width,
+                     box->height,
+                     src_data,
+                     stride,       /* bytes */
+                     0, 0);
+      map += transfer->layer_stride;
+      src_data += layer_stride;
+   }
 
 out:
    if (map)
@@ -53,8 +57,8 @@ out:
 
 
 boolean u_default_resource_get_handle(struct pipe_screen *screen,
-                                     struct pipe_resource *resource,
-                                     struct winsys_handle *handle)
+                                      struct pipe_resource *resource,
+                                      struct winsys_handle *handle)
 {
    return FALSE;
 }
@@ -62,32 +66,32 @@ boolean u_default_resource_get_handle(struct pipe_screen *screen,
 
 
 void u_default_transfer_flush_region( struct pipe_context *pipe,
-                                     struct pipe_transfer *transfer,
-                                     const struct pipe_box *box)
+                                      struct pipe_transfer *transfer,
+                                      const struct pipe_box *box)
 {
    /* This is a no-op implementation, nothing to do.
     */
 }
 
 unsigned u_default_is_resource_referenced( struct pipe_context *pipe,
-                                          struct pipe_resource *resource,
-                                       unsigned face, unsigned level)
+                                           struct pipe_resource *resource,
+                                           unsigned level, int layer)
 {
    return 0;
 }
 
 struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
-                                             struct pipe_resource *resource,
-                                             struct pipe_subresource sr,
-                                             unsigned usage,
-                                             const struct pipe_box *box)
+                                              struct pipe_resource *resource,
+                                              unsigned level,
+                                              unsigned usage,
+                                              const struct pipe_box *box)
 {
    struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
    if (transfer == NULL)
       return NULL;
 
    transfer->resource = resource;
-   transfer->sr = sr;
+   transfer->level = level;
    transfer->usage = usage;
    transfer->box = *box;
 
@@ -98,12 +102,12 @@ struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
 }
 
 void u_default_transfer_unmap( struct pipe_context *pipe,
-                             struct pipe_transfer *transfer )
+                               struct pipe_transfer *transfer )
 {
 }
 
 void u_default_transfer_destroy(struct pipe_context *pipe,
-                               struct pipe_transfer *transfer)
+                                struct pipe_transfer *transfer)
 {
    FREE(transfer);
 }
index e3a38730f214aea837b80e5a4fbd180cc76973c7..3412e13c3ccc9641b6e9ab718f444e83d286915e 100644 (file)
@@ -11,37 +11,37 @@ struct pipe_context;
 struct winsys_handle;
 
 boolean u_default_resource_get_handle(struct pipe_screen *screen,
-                                     struct pipe_resource *resource,
-                                     struct winsys_handle *handle);
+                                      struct pipe_resource *resource,
+                                      struct winsys_handle *handle);
 
 void u_default_transfer_inline_write( struct pipe_context *pipe,
-                             struct pipe_resource *resource,
-                             struct pipe_subresource sr,
-                             unsigned usage,
-                             const struct pipe_box *box,
-                             const void *data,
-                             unsigned stride,
-                             unsigned slice_stride);
+                                      struct pipe_resource *resource,
+                                      unsigned level,
+                                      unsigned usage,
+                                      const struct pipe_box *box,
+                                      const void *data,
+                                      unsigned stride,
+                                      unsigned layer_stride);
 
 void u_default_transfer_flush_region( struct pipe_context *pipe,
-                                     struct pipe_transfer *transfer,
-                                     const struct pipe_box *box);
+                                      struct pipe_transfer *transfer,
+                                      const struct pipe_box *box);
 
 unsigned u_default_is_resource_referenced( struct pipe_context *pipe,
-                                          struct pipe_resource *resource,
-                                          unsigned face, unsigned level);
+                                           struct pipe_resource *resource,
+                                           unsigned level, int layer);
 
 struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
-                                             struct pipe_resource *resource,
-                                             struct pipe_subresource sr,
-                                             unsigned usage,
-                                             const struct pipe_box *box);
+                                              struct pipe_resource *resource,
+                                              unsigned level,
+                                              unsigned usage,
+                                              const struct pipe_box *box);
 
 void u_default_transfer_unmap( struct pipe_context *pipe,
-                              struct pipe_transfer *transfer );
+                               struct pipe_transfer *transfer );
 
 void u_default_transfer_destroy(struct pipe_context *pipe,
-                               struct pipe_transfer *transfer);
+                                struct pipe_transfer *transfer);
 
 
 
@@ -51,43 +51,43 @@ void u_default_transfer_destroy(struct pipe_context *pipe,
 struct u_resource_vtbl {
 
    boolean (*resource_get_handle)(struct pipe_screen *,
-                                 struct pipe_resource *tex,
-                                 struct winsys_handle *handle);
+                                  struct pipe_resource *tex,
+                                  struct winsys_handle *handle);
 
    void (*resource_destroy)(struct pipe_screen *,
-                           struct pipe_resource *pt);
+                            struct pipe_resource *pt);
 
    unsigned (*is_resource_referenced)(struct pipe_context *pipe,
-                                     struct pipe_resource *texture,
-                                     unsigned face, unsigned level);
+                                      struct pipe_resource *texture,
+                                      unsigned level, int layer);
 
    struct pipe_transfer *(*get_transfer)(struct pipe_context *,
-                                        struct pipe_resource *resource,
-                                        struct pipe_subresource,
-                                        unsigned usage,
-                                        const struct pipe_box *);
+                                         struct pipe_resource *resource,
+                                         unsigned level,
+                                         unsigned usage,
+                                         const struct pipe_box *);
 
    void (*transfer_destroy)(struct pipe_context *,
-                           struct pipe_transfer *);
+                            struct pipe_transfer *);
 
    void *(*transfer_map)( struct pipe_context *,
-                         struct pipe_transfer *transfer );
+                          struct pipe_transfer *transfer );
 
    void (*transfer_flush_region)( struct pipe_context *,
-                                 struct pipe_transfer *transfer,
-                                 const struct pipe_box *);
+                                  struct pipe_transfer *transfer,
+                                  const struct pipe_box *);
 
    void (*transfer_unmap)( struct pipe_context *,
-                          struct pipe_transfer *transfer );
+   struct pipe_transfer *transfer );
 
    void (*transfer_inline_write)( struct pipe_context *pipe,
-                                 struct pipe_resource *resource,
-                                 struct pipe_subresource sr,
-                                 unsigned usage,
-                                 const struct pipe_box *box,
-                                 const void *data,
-                                 unsigned stride,
-                                 unsigned slice_stride);
+                                  struct pipe_resource *resource,
+                                  unsigned level,
+                                  unsigned usage,
+                                  const struct pipe_box *box,
+                                  const void *data,
+                                  unsigned stride,
+                                  unsigned layer_stride);
 };
 
 
@@ -98,43 +98,43 @@ struct u_resource {
 
 
 boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
-                             struct pipe_resource *resource,
-                             struct winsys_handle *handle);
+                                   struct pipe_resource *resource,
+                                   struct winsys_handle *handle);
 
 void u_resource_destroy_vtbl(struct pipe_screen *screen,
-                       struct pipe_resource *resource);
+                             struct pipe_resource *resource);
 
 unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe,
-                                       struct pipe_resource *resource,
-                                       unsigned face, unsigned level);
+                                        struct pipe_resource *resource,
+                                        unsigned level, int layer);
 
 struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
-                                    struct pipe_resource *resource,
-                                    struct pipe_subresource sr,
-                                    unsigned usage,
-                                    const struct pipe_box *box);
+                                          struct pipe_resource *resource,
+                                          unsigned level,
+                                          unsigned usage,
+                                          const struct pipe_box *box);
 
 void u_transfer_destroy_vtbl(struct pipe_context *pipe,
-                       struct pipe_transfer *transfer);
+                             struct pipe_transfer *transfer);
 
 void *u_transfer_map_vtbl( struct pipe_context *pipe,
-                     struct pipe_transfer *transfer );
+                           struct pipe_transfer *transfer );
 
 void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
-                             struct pipe_transfer *transfer,
-                             const struct pipe_box *box);
+                                   struct pipe_transfer *transfer,
+                                   const struct pipe_box *box);
 
 void u_transfer_unmap_vtbl( struct pipe_context *rm_ctx,
-                      struct pipe_transfer *transfer );
+                            struct pipe_transfer *transfer );
 
 void u_transfer_inline_write_vtbl( struct pipe_context *rm_ctx,
-                                  struct pipe_resource *resource,
-                                  struct pipe_subresource sr,
-                                  unsigned usage,
-                                  const struct pipe_box *box,
-                                  const void *data,
-                                  unsigned stride,
-                                  unsigned slice_stride);
+                                   struct pipe_resource *resource,
+                                   unsigned level,
+                                   unsigned usage,
+                                   const struct pipe_box *box,
+                                   const void *data,
+                                   unsigned stride,
+                                   unsigned layer_stride);
 
 
 
index af229e61a00a8cb2cc000b402d37166ed1858332..3b3d5b418fe9227daf3ee4fc9d56443a6b94325d 100644 (file)
 struct u_upload_mgr {
    struct pipe_context *pipe;
 
-   unsigned default_size;
-   unsigned alignment;
-   unsigned usage;
-
-   /* The active buffer:
-    */
-   struct pipe_resource *buffer;
-   unsigned size;
-   unsigned offset;
+   unsigned default_size;  /* Minimum size of the upload buffer, in bytes. */
+   unsigned alignment;     /* Alignment of each sub-allocation. */
+   unsigned bind;          /* Bitmask of PIPE_BIND_* flags. */
+
+   struct pipe_resource *buffer;   /* Upload buffer. */
+   struct pipe_transfer *transfer; /* Transfer object for the upload buffer. */
+   uint8_t *map;    /* Pointer to the mapped upload buffer. */
+   unsigned size;   /* Actual size of the upload buffer. */
+   unsigned offset; /* Aligned offset to the upload buffer, pointing
+                     * at the first unused byte. */
 };
 
 
 struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
                                       unsigned default_size,
                                       unsigned alignment,
-                                      unsigned usage )
+                                      unsigned bind )
 {
    struct u_upload_mgr *upload = CALLOC_STRUCT( u_upload_mgr );
    if (!upload)
@@ -65,54 +66,12 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
    upload->pipe = pipe;
    upload->default_size = default_size;
    upload->alignment = alignment;
-   upload->usage = usage;
+   upload->bind = bind;
    upload->buffer = NULL;
 
    return upload;
 }
 
-/* Slightly specialized version of buffer_write designed to maximize
- * chances of the driver consolidating successive writes into a single
- * upload.
- *
- * dirty_size may be slightly greater than size to cope with
- * alignment.  We don't want to leave holes between succesively mapped
- * regions as that may prevent the driver from consolidating uploads.
- * 
- * Note that the 'data' pointer has probably come from the application
- * and we cannot read even a byte past its end without risking
- * segfaults, or at least complaints from valgrind..
- */
-static INLINE enum pipe_error
-my_buffer_write(struct pipe_context *pipe,
-                struct pipe_resource *buf,
-                unsigned offset, unsigned size, unsigned dirty_size,
-                const void *data)
-{
-   struct pipe_transfer *transfer = NULL;
-   uint8_t *map;
-   
-   assert(offset < buf->width0);
-   assert(offset + size <= buf->width0);
-   assert(dirty_size >= size);
-   assert(size);
-
-   map = pipe_buffer_map_range(pipe, buf, offset, dirty_size,
-                               PIPE_TRANSFER_WRITE |
-                               PIPE_TRANSFER_FLUSH_EXPLICIT |
-                               PIPE_TRANSFER_DISCARD |
-                               PIPE_TRANSFER_UNSYNCHRONIZED,
-                              &transfer);
-   if (map == NULL) 
-      return PIPE_ERROR_OUT_OF_MEMORY;
-
-   memcpy(map + offset, data, size);
-   pipe_buffer_flush_mapped_range(pipe, transfer, offset, dirty_size);
-   pipe_buffer_unmap(pipe, buf, transfer);
-
-   return PIPE_OK;
-}
-
 /* Release old buffer.
  * 
  * This must usually be called prior to firing the command stream
@@ -124,6 +83,11 @@ my_buffer_write(struct pipe_context *pipe,
  */
 void u_upload_flush( struct u_upload_mgr *upload )
 {
+   /* Unmap and unreference the upload buffer. */
+   if (upload->transfer) {
+      pipe_transfer_unmap(upload->pipe, upload->transfer);
+      upload->transfer = NULL;
+   }
    pipe_resource_reference( &upload->buffer, NULL );
    upload->size = 0;
 }
@@ -142,7 +106,7 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
 {
    unsigned size;
 
-   /* Release old buffer, if present:
+   /* Release the old buffer, if present:
     */
    u_upload_flush( upload );
 
@@ -151,10 +115,14 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
    size = align(MAX2(upload->default_size, min_size), 4096);
 
    upload->buffer = pipe_buffer_create( upload->pipe->screen,
-                                        upload->usage,
+                                        upload->bind,
                                         size );
    if (upload->buffer == NULL) 
       goto fail;
+
+   /* Map the new buffer. */
+   upload->map = pipe_buffer_map(upload->pipe, upload->buffer,
+                                 PIPE_TRANSFER_WRITE, &upload->transfer);
    
    upload->size = size;
 
@@ -168,38 +136,62 @@ fail:
    return PIPE_ERROR_OUT_OF_MEMORY;
 }
 
-
-enum pipe_error u_upload_data( struct u_upload_mgr *upload,
-                               unsigned size,
-                               const void *data,
-                               unsigned *out_offset,
-                               struct pipe_resource **outbuf )
+enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
+                                unsigned min_out_offset,
+                                unsigned size,
+                                unsigned *out_offset,
+                                struct pipe_resource **outbuf,
+                                boolean *flushed,
+                                void **ptr )
 {
    unsigned alloc_size = align( size, upload->alignment );
-   enum pipe_error ret = PIPE_OK;
+   unsigned alloc_offset = align(min_out_offset, upload->alignment);
+   unsigned offset;
 
-   if (upload->offset + alloc_size > upload->size) {
-      ret = u_upload_alloc_buffer( upload, alloc_size );
+   /* Make sure we have enough space in the upload buffer
+    * for the sub-allocation. */
+   if (MAX2(upload->offset, alloc_offset) + alloc_size > upload->size) {
+      enum pipe_error ret = u_upload_alloc_buffer(upload,
+                                                  alloc_offset + alloc_size);
       if (ret)
          return ret;
+
+      *flushed = TRUE;
+   } else {
+      *flushed = FALSE;
    }
 
-   /* Copy the data, using map_range if available:
-    */
-   ret = my_buffer_write( upload->pipe, 
-                          upload->buffer,
-                          upload->offset,
-                          size, 
-                          alloc_size,
-                          data );
+   offset = MAX2(upload->offset, alloc_offset);
+
+   assert(offset < upload->buffer->width0);
+   assert(offset + size <= upload->buffer->width0);
+   assert(size);
+
+   /* Emit the return values: */
+   *ptr = upload->map + offset;
+   pipe_resource_reference( outbuf, upload->buffer );
+   *out_offset = offset;
+
+   upload->offset = offset + alloc_size;
+   return PIPE_OK;
+}
+
+enum pipe_error u_upload_data( struct u_upload_mgr *upload,
+                               unsigned min_out_offset,
+                               unsigned size,
+                               const void *data,
+                               unsigned *out_offset,
+                               struct pipe_resource **outbuf,
+                               boolean *flushed )
+{
+   uint8_t *ptr;
+   enum pipe_error ret = u_upload_alloc(upload, min_out_offset, size,
+                                        out_offset, outbuf, flushed,
+                                        (void**)&ptr);
    if (ret)
       return ret;
 
-   /* Emit the return values:
-    */
-   pipe_resource_reference( outbuf, upload->buffer );
-   *out_offset = upload->offset;
-   upload->offset += alloc_size;
+   memcpy(ptr, data, size);
    return PIPE_OK;
 }
 
@@ -210,11 +202,13 @@ enum pipe_error u_upload_data( struct u_upload_mgr *upload,
  * renders or DrawElements calls.
  */
 enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
+                                 unsigned min_out_offset,
                                  unsigned offset,
                                  unsigned size,
                                  struct pipe_resource *inbuf,
                                  unsigned *out_offset,
-                                 struct pipe_resource **outbuf )
+                                 struct pipe_resource **outbuf,
+                                 boolean *flushed )
 {
    enum pipe_error ret = PIPE_OK;
    struct pipe_transfer *transfer = NULL;
@@ -233,17 +227,16 @@ enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
    if (0)
       debug_printf("upload ptr %p ofs %d sz %d\n", map, offset, size);
 
-   ret = u_upload_data( upload, 
+   ret = u_upload_data( upload,
+                        min_out_offset,
                         size,
                         map + offset,
                         out_offset,
-                        outbuf );
-   if (ret)
-      goto done;
+                        outbuf, flushed );
 
 done:
    if (map)
-      pipe_buffer_unmap( upload->pipe, inbuf, transfer );
+      pipe_buffer_unmap( upload->pipe, transfer );
 
    return ret;
 }
index de016df02e02f826c8456b5bdd4ebb7960d0b072..c9a2ffeb572074460298549851d8517fc9382f9f 100644 (file)
 #ifndef U_UPLOAD_MGR_H
 #define U_UPLOAD_MGR_H
 
+#include "pipe/p_compiler.h"
+
 struct pipe_context;
 struct pipe_resource;
 
 
+/**
+ * Create the upload manager.
+ *
+ * \param pipe          Pipe driver.
+ * \param default_size  Minimum size of the upload buffer, in bytes.
+ * \param alignment     Alignment of each suballocation in the upload buffer.
+ * \param bind          Bitmask of PIPE_BIND_* flags.
+ */
 struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
                                       unsigned default_size,
                                       unsigned alignment,
-                                      unsigned usage );
+                                      unsigned bind );
 
+/**
+ * Destroy the upload manager.
+ */
 void u_upload_destroy( struct u_upload_mgr *upload );
 
 /* Unmap and release old buffer.
@@ -53,20 +66,55 @@ void u_upload_destroy( struct u_upload_mgr *upload );
  */
 void u_upload_flush( struct u_upload_mgr *upload );
 
+/**
+ * Sub-allocate new memory from the upload buffer.
+ *
+ * \param upload           Upload manager
+ * \param min_out_offset   Minimum offset that should be returned in out_offset.
+ * \param size             Size of the allocation.
+ * \param out_offset       Pointer to where the new buffer offset will be returned.
+ * \param outbuf           Pointer to where the upload buffer will be returned.
+ * \param flushed          Whether the upload buffer was flushed.
+ * \param ptr              Pointer to the allocated memory that is returned.
+ */
+enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
+                                unsigned min_out_offset,
+                                unsigned size,
+                                unsigned *out_offset,
+                                struct pipe_resource **outbuf,
+                                boolean *flushed,
+                                void **ptr );
 
+
+/**
+ * Allocate and write data to the upload buffer.
+ *
+ * Same as u_upload_alloc, but in addition to that, it copies "data"
+ * to the pointer returned from u_upload_alloc.
+ */
 enum pipe_error u_upload_data( struct u_upload_mgr *upload,
+                               unsigned min_out_offset,
                                unsigned size,
                                const void *data,
                                unsigned *out_offset,
-                               struct pipe_resource **outbuf );
+                               struct pipe_resource **outbuf,
+                               boolean *flushed );
 
 
+/**
+ * Allocate and copy an input buffer to the upload buffer.
+ *
+ * Same as u_upload_data, except that the input data comes from a buffer
+ * instead of a user pointer.
+ */
 enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
+                                 unsigned min_out_offset,
                                  unsigned offset,
                                  unsigned size,
                                  struct pipe_resource *inbuf,
                                  unsigned *out_offset,
-                                 struct pipe_resource **outbuf );
+                                 struct pipe_resource **outbuf,
+                                 boolean *flushed );
 
 
 
index f8155c828b12b74e2c8dfbba026310490fe6ce04..11e77190895672e66fd429d03e17df8158057524 100644 (file)
@@ -162,8 +162,8 @@ CreateDepthStencilState -> create_depth_stencil_alpha_state
        + Gallium has per-face writemask/valuemasks, D3D11 uses the same value for back and front
        + Gallium supports the alpha test, which D3D11 lacks
 
-CreateDepthStencilView -> get_tex_surface
-CreateRenderTargetView -> get_tex_surface
+CreateDepthStencilView -> create_surface
+CreateRenderTargetView -> create_surface
        ! Gallium merges depthstencil and rendertarget views into pipe_surface, which also doubles as a 2D surface abstraction
        - lack of texture array support
        - lack of render-to-buffer support
@@ -221,7 +221,6 @@ CreateResource -> texture_create or buffer_create
        ! D3D11 specifies mapping flags (i.e. read/write/discard);:it's unclear what they are used for here
        - D3D11 supports odd things in the D3D10_DDI_RESOURCE_MISC_FLAG enum (D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT, D3D11_DDI_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS, D3D11_DDI_RESOURCE_MISC_BUFFER_STRUCTURED)
        - Gallium does not support indirect draw call parameter buffers
-       - Gallium lacks array textures
        ! D3D11 supports specifying hardware modes and other stuff here for scanout resources
        + Gallium allows specifying minimum buffer alignment
        ! D3D11 implements cube maps as 2D array textures
index e09a1304c4d3b383a6719ccc4e90013485d9e922..c33cf7c57380b04548d3fa04e2633a2a1d63beff 100644 (file)
@@ -84,7 +84,14 @@ in the result register. For example, ``swizzle_r`` specifies what is going to be
 placed in first component of result register.
 
 The ``first_level`` and ``last_level`` fields of sampler view template specify
-the LOD range the texture is going to be constrained to.
+the LOD range the texture is going to be constrained to. Note that these
+values are in addition to the respective min_lod, max_lod values in the
+pipe_sampler_state (that is if min_lod is 2.0, and first_level 3, the first mip
+level used for sampling from the resource is effectively the fifth).
+
+The ``first_layer`` and ``last_layer`` fields specify the layer range the
+texture is going to be constrained to. Similar to the LOD range, this is added
+to the array index which is used for sampling.
 
 * ``set_fragment_sampler_views`` binds an array of sampler views to
   fragment shader stage. Every binding point acquires a reference
@@ -103,6 +110,22 @@ the LOD range the texture is going to be constrained to.
 * ``sampler_view_destroy`` destroys a sampler view and releases its reference
   to associated texture.
 
+Surfaces
+^^^^^^^^
+
+These are the means to use resources as color render targets or depthstencil
+attachments. To create one, specify the mip level, the range of layers, and
+the bind flags (either PIPE_BIND_DEPTH_STENCIL or PIPE_BIND_RENDER_TARGET).
+Note that layer values are in addition to what is indicated by the geometry
+shader output variable XXX_FIXME (that is if first_layer is 3 and geometry
+shader indicates index 2, the 5th layer of the resource will be used). These
+first_layer and last_layer parameters will only be used for 1d array, 2d array,
+cube, and 3d textures otherwise they are 0.
+
+* ``create_surface`` creates a new surface.
+
+* ``surface_destroy`` destroys a surface and releases its reference to the
+  associated resource.
 
 Clearing
 ^^^^^^^^
@@ -118,8 +141,7 @@ used by GL), and always clears the whole surfaces (no scissoring as used by
 GL clear or explicit rectangles like d3d9 uses). It can, however, also clear
 only depth or stencil in a combined depth/stencil surface, if the driver
 supports PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE.
-If a surface includes several layers/slices (XXX: not yet...) then all layers
-will be cleared.
+If a surface includes several layers then all layers will be cleared.
 
 ``clear_render_target`` clears a single color rendertarget with the specified
 color value. While it is only possible to clear one surface at a time (which can
@@ -271,12 +293,12 @@ These methods operate directly on ``pipe_resource`` objects, and stand
 apart from any 3D state in the context.  Blitting functionality may be
 moved to a separate abstraction at some point in the future.
 
-``resource_copy_region`` blits a region of a subresource of a resource to a
-region of another subresource of a resource, provided that both resources have
-the same format, or compatible formats, i.e., formats for which copying the
-bytes from the source resource unmodified to the destination resource will
-achieve the same effect of a textured quad blitter. The source and destination
-may be the same resource, but overlapping blits are not permitted.
+``resource_copy_region`` blits a region of a resource to a region of another
+resource, provided that both resources have the same format, or compatible
+formats, i.e., formats for which copying the bytes from the source resource
+unmodified to the destination resource will achieve the same effect of a
+textured quad blitter.. The source and destination may be the same resource,
+but overlapping blits are not permitted.
 
 ``resource_resolve`` resolves a multisampled resource into a non-multisampled
 one. Formats and dimensions must match. This function must be present if a driver
index acde56eafc493d6ad3674894beebf4aeb2723a4a..c749d0c95561b8c61d7ebbdfc69467752eff0911 100644 (file)
@@ -22,6 +22,14 @@ Glossary
       Level of Detail. Also spelled "LoD." The value that determines when the
       switches between mipmaps occur during texture sampling.
 
+   layer
+      This term is used as the name of the "3rd coordinate" of a resource.
+      3D textures have zslices, cube maps have faces, 1D and 2D array textures
+      have array members (other resources do not have multiple layers).
+      Since the functions only take one parameter no matter what type of
+      resource is used, use the term "layer" instead of a resource type
+      specific one.
+
    GLSL
       GL Shading Language. The official, common high-level shader language used
       in GL 2.0 and above.
index a62520061eabebe34975ee7ee56d482996dd1e67..ab90097add63e8a708602d9d56636f8779e387a0 100644 (file)
@@ -259,25 +259,33 @@ resource_create
 Create a new resource from a template.
 The following fields of the pipe_resource must be specified in the template:
 
-target
+**target** one of the pipe_texture_target enums.
+Note that PIPE_BUFFER and PIPE_TEXTURE_X are not really fundamentally different.
+Modern APIs allow using buffers as shader resources.
 
-format
+**format** one of the pipe_format enums.
 
-width0
+**width0** the width of the base mip level of the texture or size of the buffer.
 
-height0
+**height0** the height of the base mip level of the texture
+(1 for 1D or 1D array textures).
 
-depth0
+**depth0** the depth of the base mip level of the texture
+(1 for everything else).
 
-last_level
+**array_size the array size for 1D and 2D array textures.
+For cube maps this must be 6, for other textures 1.
 
-nr_samples
+**last_level** the last mip map level present.
 
-usage
+**nr_samples** the nr of msaa samples. 0 (or 1) specifies a resource
+which isn't multisampled.
 
-bind
+**usage** one of the PIPE_USAGE flags.
 
-flags
+**bind** bitmask of the PIPE_BIND flags.
+
+**flags** bitmask of PIPE_RESOURCE_FLAG flags.
 
 
 
index d99ed7c6d6b24acb10b7b4b8b5c84e682c811450..d986e6601e63c7095aba4caeb4cb202767ee4eb6 100644 (file)
@@ -577,17 +577,45 @@ This instruction replicates its result.
 
 .. opcode:: TEX - Texture Lookup
 
-  TBD
+.. math::
+
+  coord = src0
+
+  bias = 0.0
+
+  dst = texture_sample(unit, coord, bias)
 
 
 .. opcode:: TXD - Texture Lookup with Derivatives
 
-  TBD
+.. math::
+
+  coord = src0
+
+  ddx = src1
+
+  ddy = src2
+
+  bias = 0.0
+
+  dst = texture_sample_deriv(unit, coord, bias, ddx, ddy)
 
 
 .. opcode:: TXP - Projective Texture Lookup
 
-  TBD
+.. math::
+
+  coord.x = src0.x / src.w
+
+  coord.y = src0.y / src.w
+
+  coord.z = src0.z / src.w
+
+  coord.w = src0.w
+
+  bias = 0.0
+
+  dst = texture_sample(unit, coord, bias)
 
 
 .. opcode:: UP2H - Unpack Two 16-Bit Floats
@@ -729,7 +757,19 @@ This instruction replicates its result.
 
 .. opcode:: TXB - Texture Lookup With Bias
 
-  TBD
+.. math::
+
+  coord.x = src.x
+
+  coord.y = src.y
+
+  coord.z = src.z
+
+  coord.w = 1.0
+
+  bias = src.z
+
+  dst = texture_sample(unit, coord, bias)
 
 
 .. opcode:: NRM - 3-component Vector Normalise
@@ -767,9 +807,21 @@ This instruction replicates its result.
   dst = src0.x \times src1.x + src0.y \times src1.y
 
 
-.. opcode:: TXL - Texture Lookup With LOD
+.. opcode:: TXL - Texture Lookup With explicit LOD
 
-  TBD
+.. math::
+
+  coord.x = src0.x
+
+  coord.y = src0.y
+
+  coord.z = src0.z
+
+  coord.w = 1.0
+
+  lod = src0.w
+
+  dst = texture_sample(unit, coord, lod)
 
 
 .. opcode:: BRK - Break
@@ -1464,6 +1516,11 @@ GL_ARB_fragment_coord_conventions extension.
 DirectX 9 uses INTEGER.
 DirectX 10 uses HALF_INTEGER.
 
+FS_COLOR0_WRITES_ALL_CBUFS
+""""""""""""""""""""""""""
+Specifies that writes to the fragment shader color 0 are replicated to all
+bound cbufs. This facilitates OpenGL's fragColor output vs fragData[0] where
+fragData is directed to a single color buffer, but fragColor is broadcast.
 
 
 Texture Sampling and Texture Formats
index 143eca848f1813d36ad02408e5cc5c34187d8ce2..f9b83c8666c1d6464f5abf92a77c8c8346007934 100644 (file)
@@ -37,6 +37,7 @@
 #include "pipe/p_format.h"
 #include "util/u_memory.h"
 #include "pipe/p_screen.h"
+#include "util/u_inlines.h"
 
 #include "draw/draw_context.h"
 #include "draw/draw_private.h"
@@ -61,6 +62,11 @@ static void
 cell_destroy_context( struct pipe_context *pipe )
 {
    struct cell_context *cell = cell_context(pipe);
+   unsigned i;
+
+   for (i = 0; i < cell->num_vertex_buffers; i++) {
+      pipe_resource_reference(&cell->vertex_buffer[i].buffer, NULL);
+   }
 
    util_delete_keymap(cell->fragment_ops_cache, NULL);
 
@@ -100,8 +106,8 @@ static const struct debug_named_value cell_debug_flags[] = {
 
 static unsigned int
 cell_is_resource_referenced( struct pipe_context *pipe,
-                           struct pipe_resource *texture,
-                           unsigned face, unsigned level)
+                             struct pipe_resource *texture,
+                             unsigned level, int layer)
 {
    /**
     * FIXME: Optimize.
index a065d68b5a63ba297d9c20cc3c5e18c23bef0aa8..eb22a09a913b85182b1c469efebc097e07e1f055 100644 (file)
@@ -82,8 +82,9 @@ cell_set_vertex_buffers(struct pipe_context *pipe,
 
    assert(count <= PIPE_MAX_ATTRIBS);
 
-   memcpy(cell->vertex_buffer, buffers, count * sizeof(buffers[0]));
-   cell->num_vertex_buffers = count;
+   util_copy_vertex_buffers(cell->vertex_buffer,
+                            &cell->num_vertex_buffers,
+                            buffers, count);
 
    cell->dirty |= CELL_NEW_VERTEX;
 
index b3042df77922c556948e7e85e5deb686f16756ca..946a7050e5fe7b1103715bd2ab5ecf1d89dc91e4 100644 (file)
@@ -304,47 +304,34 @@ untwiddle_image_uint(uint w, uint h, uint tile_size, uint *dst,
 
 
 static struct pipe_surface *
-cell_get_tex_surface(struct pipe_screen *screen,
-                     struct pipe_resource *pt,
-                     unsigned face, unsigned level, unsigned zslice,
-                     unsigned usage)
+cell_create_surface(struct pipe_context *ctx,
+                    struct pipe_resource *pt,
+                    const struct pipe_surface *surf_tmpl)
 {
    struct cell_resource *ct = cell_resource(pt);
    struct pipe_surface *ps;
 
+   assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
       pipe_reference_init(&ps->reference, 1);
       pipe_resource_reference(&ps->texture, pt);
-      ps->format = pt->format;
-      ps->width = u_minify(pt->width0, level);
-      ps->height = u_minify(pt->height0, level);
-      ps->offset = ct->level_offset[level];
+      ps->format = surf_tmpl->format;
+      ps->context = ctx;
+      ps->width = u_minify(pt->width0, surf_tmpl->u.tex.level);
+      ps->height = u_minify(pt->height0, surf_tmpl->u.tex.level);
       /* XXX may need to override usage flags (see sp_texture.c) */
-      ps->usage = usage;
-      ps->face = face;
-      ps->level = level;
-      ps->zslice = zslice;
-
-      if (pt->target == PIPE_TEXTURE_CUBE) {
-         unsigned h_tile = align(ps->height, TILE_SIZE);
-         ps->offset += face * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level];
-      }
-      else if (pt->target == PIPE_TEXTURE_3D) {
-         unsigned h_tile = align(ps->height, TILE_SIZE);
-         ps->offset += zslice * util_format_get_nblocksy(ps->format, h_tile) * ct->stride[level];
-      }
-      else {
-         assert(face == 0);
-         assert(zslice == 0);
-      }
+      ps->usage = surf_tmpl->usage;
+      ps->u.tex.level = surf_tmpl->u.tex.level;
+      ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+      ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
    }
    return ps;
 }
 
 
 static void 
-cell_tex_surface_destroy(struct pipe_surface *surf)
+cell_surface_destroy(struct pipe_context *ctx, struct pipe_surface *surf)
 {
    pipe_resource_reference(&surf->texture, NULL);
    FREE(surf);
@@ -358,44 +345,39 @@ cell_tex_surface_destroy(struct pipe_surface *surf)
  */
 static struct pipe_transfer *
 cell_get_transfer(struct pipe_context *ctx,
-                 struct pipe_resource *resource,
-                 struct pipe_subresource sr,
-                 unsigned usage,
-                 const struct pipe_box *box)
+                  struct pipe_resource *resource,
+                  unsigned level,
+                  unsigned usage,
+                  const struct pipe_box *box)
 {
    struct cell_resource *ct = cell_resource(resource);
    struct cell_transfer *ctrans;
    enum pipe_format format = resource->format;
 
    assert(resource);
-   assert(sr.level <= resource->last_level);
+   assert(level <= resource->last_level);
 
    /* make sure the requested region is in the image bounds */
-   assert(box->x + box->width <= u_minify(resource->width0, sr.level));
-   assert(box->y + box->height <= u_minify(resource->height0, sr.level));
-   assert(box->z + box->depth <= u_minify(resource->depth0, sr.level));
+   assert(box->x + box->width <= u_minify(resource->width0, level));
+   assert(box->y + box->height <= u_minify(resource->height0, level));
+   assert(box->z + box->depth <= (u_minify(resource->depth0, level) + resource->array_size - 1));
 
    ctrans = CALLOC_STRUCT(cell_transfer);
    if (ctrans) {
       struct pipe_transfer *pt = &ctrans->base;
       pipe_resource_reference(&pt->resource, resource);
-      pt->sr = sr;
+      pt->level = level;
       pt->usage = usage;
       pt->box = *box;
-      pt->stride = ct->stride[sr.level];
+      pt->stride = ct->stride[level];
 
-      ctrans->offset = ct->level_offset[sr.level];
+      ctrans->offset = ct->level_offset[level];
 
-      if (resource->target == PIPE_TEXTURE_CUBE) {
-         unsigned h_tile = align(u_minify(resource->height0, sr.level), TILE_SIZE);
-         ctrans->offset += sr.face * util_format_get_nblocksy(format, h_tile) * pt->stride;
-      }
-      else if (resource->target == PIPE_TEXTURE_3D) {
-         unsigned h_tile = align(u_minify(resource->height0, sr.level), TILE_SIZE);
+      if (resource->target == PIPE_TEXTURE_CUBE || resource->target == PIPE_TEXTURE_3D) {
+         unsigned h_tile = align(u_minify(resource->height0, level), TILE_SIZE);
          ctrans->offset += box->z * util_format_get_nblocksy(format, h_tile) * pt->stride;
       }
       else {
-         assert(sr.face == 0);
          assert(box->z == 0);
       }
 
@@ -439,7 +421,7 @@ cell_transfer_map(struct pipe_context *ctx, struct pipe_transfer *transfer)
    /* Better test would be resource->is_linear
     */
    if (transfer->resource->target != PIPE_BUFFER) {
-      const uint level = ctrans->base.sr.level;
+      const uint level = ctrans->base.level;
       const uint texWidth = u_minify(pt->width0, level);
       const uint texHeight = u_minify(pt->height0, level);
       unsigned size;
@@ -500,7 +482,7 @@ cell_transfer_unmap(struct pipe_context *ctx,
    struct cell_transfer *ctrans = cell_transfer(transfer);
    struct pipe_resource *pt = transfer->resource;
    struct cell_resource *ct = cell_resource(pt);
-   const uint level = ctrans->base.sr.level;
+   const uint level = ctrans->base.level;
    const uint texWidth = u_minify(pt->width0, level);
    const uint texHeight = u_minify(pt->height0, level);
    const uint stride = ct->stride[level];
@@ -548,12 +530,13 @@ cell_transfer_unmap(struct pipe_context *ctx,
  */
 static void
 cell_flush_frontbuffer(struct pipe_screen *_screen,
-                       struct pipe_surface *surface,
+                       struct pipe_resource *resource,
+                       unsigned level, unsigned layer,
                        void *context_private)
 {
    struct cell_screen *screen = cell_screen(_screen);
    struct sw_winsys *winsys = screen->winsys;
-   struct cell_resource *ct = cell_resource(surface->texture);
+   struct cell_resource *ct = cell_resource(resource);
 
    if (!ct->dt)
       return;
@@ -564,10 +547,10 @@ cell_flush_frontbuffer(struct pipe_screen *_screen,
       unsigned *map = winsys->displaytarget_map(winsys, ct->dt,
                                                 (PIPE_TRANSFER_READ |
                                                  PIPE_TRANSFER_WRITE));
-      unsigned *src = (unsigned *)(ct->data + ct->level_offset[surface->level]);
+      unsigned *src = (unsigned *)(ct->data + ct->level_offset[level]);
 
-      untwiddle_image_uint(surface->width,
-                           surface->height,
+      untwiddle_image_uint(u_minify(resource->width0, level),
+                           u_minify(resource->height0, level),
                            TILE_SIZE,
                            map,
                            ct->dt_stride,
@@ -605,6 +588,7 @@ cell_user_buffer_create(struct pipe_screen *screen,
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
    buffer->base.depth0 = 1;
+   buffer->base.array_size = 1;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
 
@@ -641,9 +625,6 @@ cell_init_screen_texture_funcs(struct pipe_screen *screen)
    screen->resource_get_handle = cell_resource_get_handle;
    screen->user_buffer_create = cell_user_buffer_create;
 
-   screen->get_tex_surface = cell_get_tex_surface;
-   screen->tex_surface_destroy = cell_tex_surface_destroy;
-
    screen->flush_frontbuffer = cell_flush_frontbuffer;
 }
 
@@ -657,4 +638,7 @@ cell_init_texture_transfer_funcs(struct cell_context *cell)
 
    cell->pipe.transfer_flush_region = u_default_transfer_flush_region;
    cell->pipe.transfer_inline_write = u_default_transfer_inline_write;
+
+   cell->pipe.create_surface = cell_create_surface;
+   cell->pipe.surface_destroy = cell_surface_destroy;
 }
index ec3609291e9a51e423a79905e1c1a9ba8e776481..d60718d971661f0121ffc6eda89ff1453551f17c 100644 (file)
@@ -29,6 +29,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 #include "pipe/p_context.h"
+#include "util/u_inlines.h"
 
 #include "fo_context.h"
 #include "fo_winsys.h"
 static void failover_destroy( struct pipe_context *pipe )
 {
    struct failover_context *failover = failover_context( pipe );
+   unsigned i;
+
+   for (i = 0; i < failover->num_vertex_buffers; i++) {
+      pipe_resource_reference(&failover->vertex_buffers[i].buffer, NULL);
+   }
 
    FREE( failover );
 }
@@ -89,14 +95,14 @@ static void failover_draw_vbo( struct pipe_context *pipe,
 
 static unsigned int
 failover_is_resource_referenced( struct pipe_context *_pipe,
-                                struct pipe_resource *resource,
-                                unsigned face, unsigned level)
+                                 struct pipe_resource *resource,
+                                 unsigned level, int layer)
 {
    struct failover_context *failover = failover_context( _pipe );
    struct pipe_context *pipe = (failover->mode == FO_HW) ?
       failover->hw : failover->sw;
 
-   return pipe->is_resource_referenced(pipe, resource, face, level);
+   return pipe->is_resource_referenced(pipe, resource, level, layer);
 }
 
 struct pipe_context *failover_create( struct pipe_context *hw,
@@ -137,10 +143,10 @@ struct pipe_context *failover_create( struct pipe_context *hw,
    failover->pipe.resource_copy_region = hw->resource_copy_region;
 
 #if 0
-   failover->pipe.texture_create = hw->texture_create;
-   failover->pipe.texture_destroy = hw->texture_destroy;
-   failover->pipe.get_tex_surface = hw->get_tex_surface;
-   failover->pipe.texture_update = hw->texture_update;
+   failover->pipe.resource_create = hw->resource_create;
+   failover->pipe.resource_destroy = hw->resource_destroy;
+   failover->pipe.create_surface = hw->create_surface;
+   failover->pipe.surface_destroy = hw->surface_destroy;
 #endif
 
    failover->pipe.flush = hw->flush;
index c265f381b6755559f668eb8e1ac6353d6e843744..af1fd953aaf0b89c44973e88492449526cdc6967 100644 (file)
@@ -574,10 +574,10 @@ failover_set_vertex_buffers(struct pipe_context *pipe,
 {
    struct failover_context *failover = failover_context(pipe);
 
-   memcpy(failover->vertex_buffers, vertex_buffers,
-          count * sizeof(vertex_buffers[0]));
+   util_copy_vertex_buffers(failover->vertex_buffers,
+                            &failover->num_vertex_buffers,
+                            vertex_buffers, count);
    failover->dirty |= FO_NEW_VERTEX_BUFFER;
-   failover->num_vertex_buffers = count;
    failover->sw->set_vertex_buffers( failover->sw, count, vertex_buffers );
    failover->hw->set_vertex_buffers( failover->hw, count, vertex_buffers );
 }
index 50f66079c2a5e7c50175109ce1e63be1e2ec14a4..8cbf0b1de4a6507517d99cabbe329c77ab9c4bb5 100644 (file)
@@ -381,6 +381,8 @@ galahad_create_vertex_elements_state(struct pipe_context *_pipe,
    struct galahad_context *glhd_pipe = galahad_context(_pipe);
    struct pipe_context *pipe = glhd_pipe->pipe;
 
+   /* XXX check if stride lines up with element size, at least for floats */
+
    return pipe->create_vertex_elements_state(pipe,
                                              num_elements,
                                              vertex_elements);
@@ -662,17 +664,13 @@ galahad_set_index_buffer(struct pipe_context *_pipe,
 static void
 galahad_resource_copy_region(struct pipe_context *_pipe,
                               struct pipe_resource *_dst,
-                              struct pipe_subresource subdst,
+                              unsigned dst_level,
                               unsigned dstx,
                               unsigned dsty,
                               unsigned dstz,
                               struct pipe_resource *_src,
-                              struct pipe_subresource subsrc,
-                              unsigned srcx,
-                              unsigned srcy,
-                              unsigned srcz,
-                              unsigned width,
-                              unsigned height)
+                              unsigned src_level,
+                              const struct pipe_box *src_box)
 {
    struct galahad_context *glhd_pipe = galahad_context(_pipe);
    struct galahad_resource *glhd_resource_dst = galahad_resource(_dst);
@@ -689,17 +687,13 @@ galahad_resource_copy_region(struct pipe_context *_pipe,
 
    pipe->resource_copy_region(pipe,
                               dst,
-                              subdst,
+                              dst_level,
                               dstx,
                               dsty,
                               dstz,
                               src,
-                              subsrc,
-                              srcx,
-                              srcy,
-                              srcz,
-                              width,
-                              height);
+                              src_level,
+                              src_box);
 }
 
 static void
@@ -781,8 +775,8 @@ galahad_flush(struct pipe_context *_pipe,
 static unsigned int
 galahad_is_resource_referenced(struct pipe_context *_pipe,
                                 struct pipe_resource *_resource,
-                                unsigned face,
-                                unsigned level)
+                                unsigned level,
+                                int layer)
 {
    struct galahad_context *glhd_pipe = galahad_context(_pipe);
    struct galahad_resource *glhd_resource = galahad_resource(_resource);
@@ -791,8 +785,8 @@ galahad_is_resource_referenced(struct pipe_context *_pipe,
 
    return pipe->is_resource_referenced(pipe,
                                        resource,
-                                       face,
-                                       level);
+                                       level,
+                                       layer);
 }
 
 static struct pipe_sampler_view *
@@ -823,10 +817,40 @@ galahad_context_sampler_view_destroy(struct pipe_context *_pipe,
                                  galahad_sampler_view(_view));
 }
 
+static struct pipe_surface *
+galahad_context_create_surface(struct pipe_context *_pipe,
+                                struct pipe_resource *_resource,
+                                const struct pipe_surface *templ)
+{
+   struct galahad_context *glhd_context = galahad_context(_pipe);
+   struct galahad_resource *glhd_resource = galahad_resource(_resource);
+   struct pipe_context *pipe = glhd_context->pipe;
+   struct pipe_resource *resource = glhd_resource->resource;
+   struct pipe_surface *result;
+
+   result = pipe->create_surface(pipe,
+                                 resource,
+                                 templ);
+
+   if (result)
+      return galahad_surface_create(glhd_context, glhd_resource, result);
+   return NULL;
+}
+
+static void
+galahad_context_surface_destroy(struct pipe_context *_pipe,
+                                struct pipe_surface *_surface)
+{
+   galahad_surface_destroy(galahad_context(_pipe),
+                           galahad_surface(_surface));
+}
+
+
+
 static struct pipe_transfer *
 galahad_context_get_transfer(struct pipe_context *_context,
                               struct pipe_resource *_resource,
-                              struct pipe_subresource sr,
+                              unsigned level,
                               unsigned usage,
                               const struct pipe_box *box)
 {
@@ -838,7 +862,7 @@ galahad_context_get_transfer(struct pipe_context *_context,
 
    result = context->get_transfer(context,
                                   resource,
-                                  sr,
+                                  level,
                                   usage,
                                   box);
 
@@ -915,7 +939,7 @@ galahad_context_transfer_unmap(struct pipe_context *_context,
 static void
 galahad_context_transfer_inline_write(struct pipe_context *_context,
                                        struct pipe_resource *_resource,
-                                       struct pipe_subresource sr,
+                                       unsigned level,
                                        unsigned usage,
                                        const struct pipe_box *box,
                                        const void *data,
@@ -929,7 +953,7 @@ galahad_context_transfer_inline_write(struct pipe_context *_context,
 
    context->transfer_inline_write(context,
                                   resource,
-                                  sr,
+                                  level,
                                   usage,
                                   box,
                                   data,
@@ -1004,6 +1028,8 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    glhd_pipe->base.is_resource_referenced = galahad_is_resource_referenced;
    glhd_pipe->base.create_sampler_view = galahad_context_create_sampler_view;
    glhd_pipe->base.sampler_view_destroy = galahad_context_sampler_view_destroy;
+   glhd_pipe->base.create_surface = galahad_context_create_surface;
+   glhd_pipe->base.surface_destroy = galahad_context_surface_destroy;
    glhd_pipe->base.get_transfer = galahad_context_get_transfer;
    glhd_pipe->base.transfer_destroy = galahad_context_transfer_destroy;
    glhd_pipe->base.transfer_map = galahad_context_transfer_map;
index 6c5a21ae704900ad85702d619a7704fc79572150..b50d85655e8e453ab80c35349d419e08d0e104fc 100644 (file)
@@ -71,7 +71,8 @@ galahad_resource_destroy(struct galahad_resource *glhd_resource)
 
 
 struct pipe_surface *
-galahad_surface_create(struct galahad_resource *glhd_resource,
+galahad_surface_create(struct galahad_context *glhd_context,
+                        struct galahad_resource *glhd_resource,
                         struct pipe_surface *surface)
 {
    struct galahad_surface *glhd_surface;
@@ -100,10 +101,11 @@ error:
 }
 
 void
-galahad_surface_destroy(struct galahad_surface *glhd_surface)
+galahad_surface_destroy(struct galahad_context *glhd_context,
+                         struct galahad_surface *glhd_surface)
 {
    pipe_resource_reference(&glhd_surface->base.texture, NULL);
-   pipe_surface_reference(&glhd_surface->surface, NULL);
+   glhd_context->pipe->surface_destroy(glhd_context->pipe, glhd_surface->surface);
    FREE(glhd_surface);
 }
 
index dc74c5bebc9635f170f781240ef5a6816bd3b275..13dc7485887877ed5b56c7e7d2682b09a3a27178 100644 (file)
@@ -149,11 +149,13 @@ void
 galahad_resource_destroy(struct galahad_resource *glhd_resource);
 
 struct pipe_surface *
-galahad_surface_create(struct galahad_resource *glhd_resource,
+galahad_surface_create(struct galahad_context *glhd_context,
+                       struct galahad_resource *glhd_resource,
                         struct pipe_surface *surface);
 
 void
-galahad_surface_destroy(struct galahad_surface *glhd_surface);
+galahad_surface_destroy(struct galahad_context *glhd_context,
+                         struct galahad_surface *glhd_surface);
 
 struct pipe_sampler_view *
 galahad_sampler_view_create(struct galahad_context *glhd_context,
index b6cc41d908be607ab332c67285d7c45ed81eb7cf..b4825bef66dafb04609b78b22527b360fc062d4f 100644 (file)
@@ -223,39 +223,6 @@ galahad_screen_resource_destroy(struct pipe_screen *screen,
    galahad_resource_destroy(galahad_resource(_resource));
 }
 
-static struct pipe_surface *
-galahad_screen_get_tex_surface(struct pipe_screen *_screen,
-                                struct pipe_resource *_resource,
-                                unsigned face,
-                                unsigned level,
-                                unsigned zslice,
-                                unsigned usage)
-{
-   struct galahad_screen *glhd_screen = galahad_screen(_screen);
-   struct galahad_resource *glhd_resource = galahad_resource(_resource);
-   struct pipe_screen *screen = glhd_screen->screen;
-   struct pipe_resource *resource = glhd_resource->resource;
-   struct pipe_surface *result;
-
-   result = screen->get_tex_surface(screen,
-                                    resource,
-                                    face,
-                                    level,
-                                    zslice,
-                                    usage);
-
-   if (result)
-      return galahad_surface_create(glhd_resource, result);
-   return NULL;
-}
-
-static void
-galahad_screen_tex_surface_destroy(struct pipe_surface *_surface)
-{
-   galahad_surface_destroy(galahad_surface(_surface));
-}
-
-
 
 static struct pipe_resource *
 galahad_screen_user_buffer_create(struct pipe_screen *_screen,
@@ -281,16 +248,18 @@ galahad_screen_user_buffer_create(struct pipe_screen *_screen,
 
 static void
 galahad_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                                  struct pipe_surface *_surface,
+                                  struct pipe_resource *_resource,
+                                  unsigned level, unsigned layer,
                                   void *context_private)
 {
    struct galahad_screen *glhd_screen = galahad_screen(_screen);
-   struct galahad_surface *glhd_surface = galahad_surface(_surface);
+   struct galahad_resource *glhd_resource = galahad_resource(_resource);
    struct pipe_screen *screen = glhd_screen->screen;
-   struct pipe_surface *surface = glhd_surface->surface;
+   struct pipe_resource *resource = glhd_resource->resource;
 
    screen->flush_frontbuffer(screen,
-                             surface,
+                             resource,
+                             level, layer,
                              context_private);
 }
 
@@ -360,8 +329,6 @@ galahad_screen_create(struct pipe_screen *screen)
    glhd_screen->base.resource_from_handle = galahad_screen_resource_from_handle;
    glhd_screen->base.resource_get_handle = galahad_screen_resource_get_handle;
    glhd_screen->base.resource_destroy = galahad_screen_resource_destroy;
-   glhd_screen->base.get_tex_surface = galahad_screen_get_tex_surface;
-   glhd_screen->base.tex_surface_destroy = galahad_screen_tex_surface_destroy;
    glhd_screen->base.user_buffer_create = galahad_screen_user_buffer_create;
    glhd_screen->base.flush_frontbuffer = galahad_screen_flush_frontbuffer;
    glhd_screen->base.fence_reference = galahad_screen_fence_reference;
diff --git a/src/gallium/drivers/i915/TODO b/src/gallium/drivers/i915/TODO
new file mode 100644 (file)
index 0000000..94c428b
--- /dev/null
@@ -0,0 +1,25 @@
+Random list of problems with i915g:
+
+- Dies with BadDrawable on GLXFBconfig changes/destruction. Makes piglit totally
+  unusable :( Upgrading xserver helped here, it doesn't crash anymore. Still
+  broken, it doesn't update the viewport/get new buffers.
+
+- Tends to hang the chip after a few minutes of openarena. Looks tiling related,
+  at the last frame rendered has tiling corruption over the complete frame.
+
+- Kills the chip in 3D_PRIMITIVE LINELIST with mesa-demos/fbotexture in
+  wireframe mode.
+
+- Tiling is funny: If unlucky, it renders/samples all black. No clue yet what's
+  going on. Seems to depend on tiny details like whethever the sampler
+  relocation is fenced/unfenced (broken _with_ fenced reloc using tiling bits!).
+
+- Y-tiling is even more fun. i915c doesn't use it, maybe there's a reason?
+  Texture sampling from Y-tiled buffers seems to work, though (save above
+  problems).
+
+- Need to validate buffers before usage. Currently do_exec on the batchbuffer
+  can fail with -ENOSPC.
+
+Other bugs can be found here:
+https://bugs.freedesktop.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Drivers/Gallium/i915g
index c411b84ccd4756f72b5c8a0f9248d42c20f34f61..6e93da76209937aab21c556be8cdcf1eb4520149 100644 (file)
    i915_winsys_batchbuffer_dword(i915->batch, dword)
 
 #define OUT_RELOC(buf, usage, offset) \
-   i915_winsys_batchbuffer_reloc(i915->batch, buf, usage, offset)
+   i915_winsys_batchbuffer_reloc(i915->batch, buf, usage, offset, false)
+
+#define OUT_RELOC_FENCED(buf, usage, offset) \
+   i915_winsys_batchbuffer_reloc(i915->batch, buf, usage, offset, true)
 
 #define FLUSH_BATCH(fence) \
    i915_flush(i915, fence)
index c1cd314e7b8aca94664ebd2c9b7f0166cd3ce3c8..d92b2ccb31effd846aebfd0a0b4915e7719a609a 100644 (file)
 #define I915_BATCHBUFFER_H
 
 #include "i915_winsys.h"
+#include "util/u_debug.h"
 
 struct i915_context;
 
+static INLINE size_t
+i915_winsys_batchbuffer_space(struct i915_winsys_batchbuffer *batch)
+{
+   return batch->size - (batch->ptr - batch->map);
+}
+
 static INLINE boolean
 i915_winsys_batchbuffer_check(struct i915_winsys_batchbuffer *batch,
                               size_t dwords,
                               size_t relocs)
 {
-   return dwords * 4 <= batch->size - (batch->ptr - batch->map) &&
+   return dwords * 4 <= i915_winsys_batchbuffer_space(batch) &&
           relocs <= (batch->max_relocs - batch->relocs);
 }
 
-static INLINE size_t
-i915_winsys_batchbuffer_space(struct i915_winsys_batchbuffer *batch)
+static INLINE void
+i915_winsys_batchbuffer_dword_unchecked(struct i915_winsys_batchbuffer *batch,
+                              unsigned dword)
 {
-   return batch->size - (batch->ptr - batch->map);
+   *(unsigned *)batch->ptr = dword;
+   batch->ptr += 4;
 }
 
 static INLINE void
 i915_winsys_batchbuffer_dword(struct i915_winsys_batchbuffer *batch,
                               unsigned dword)
 {
-   if (i915_winsys_batchbuffer_space(batch) < 4)
-      return;
-
-   *(unsigned *)batch->ptr = dword;
-   batch->ptr += 4;
+   assert (i915_winsys_batchbuffer_space(batch) >= 4);
+   i915_winsys_batchbuffer_dword_unchecked(batch, dword);
 }
 
 static INLINE void
 i915_winsys_batchbuffer_write(struct i915_winsys_batchbuffer *batch,
-                       void *data,
-                       size_t size)
+                             void *data,
+                             size_t size)
 {
-   if (i915_winsys_batchbuffer_space(batch) < size)
-      return;
+   assert (i915_winsys_batchbuffer_space(batch) >= size);
 
    memcpy(data, batch->ptr, size);
    batch->ptr += size;
@@ -74,9 +79,9 @@ static INLINE int
 i915_winsys_batchbuffer_reloc(struct i915_winsys_batchbuffer *batch,
                               struct i915_winsys_buffer *buffer,
                               enum i915_winsys_buffer_usage usage,
-                              size_t offset)
+                              size_t offset, bool fenced)
 {
-   return batch->iws->batchbuffer_reloc(batch, buffer, usage, offset);
+   return batch->iws->batchbuffer_reloc(batch, buffer, usage, offset, fenced);
 }
 
 #endif
index cdf20c0055a73e124e34c746d55ea369d59350ff..97c256651563486ba8c541ec65af8486ff240efb 100644 (file)
@@ -74,7 +74,7 @@ i915_fill_blit(struct i915_context *i915,
    OUT_BATCH(BR13);
    OUT_BATCH((y << 16) | x);
    OUT_BATCH(((y + h) << 16) | (x + w));
-   OUT_RELOC(dst_buffer, I915_USAGE_2D_TARGET, dst_offset);
+   OUT_RELOC_FENCED(dst_buffer, I915_USAGE_2D_TARGET, dst_offset);
    OUT_BATCH(color);
 }
 
@@ -138,8 +138,8 @@ i915_copy_blit(struct i915_context *i915,
    OUT_BATCH(BR13);
    OUT_BATCH((dst_y << 16) | dst_x);
    OUT_BATCH((dst_y2 << 16) | dst_x2);
-   OUT_RELOC(dst_buffer, I915_USAGE_2D_TARGET, dst_offset);
+   OUT_RELOC_FENCED(dst_buffer, I915_USAGE_2D_TARGET, dst_offset);
    OUT_BATCH((src_y << 16) | src_x);
    OUT_BATCH(((int) src_pitch & 0xffff));
-   OUT_RELOC(src_buffer, I915_USAGE_2D_SOURCE, src_offset);
+   OUT_RELOC_FENCED(src_buffer, I915_USAGE_2D_SOURCE, src_offset);
 }
index 847dd6dd47e697792f42a8514a23d5174daeecbb..9be316192547d929855ae214b1566ae4186e0b12 100644 (file)
@@ -107,6 +107,10 @@ static void i915_destroy(struct pipe_context *pipe)
    if(i915->batch)
       i915->iws->batchbuffer_destroy(i915->batch);
 
+   for (i = 0; i < i915->num_vertex_buffers; i++) {
+      pipe_resource_reference(&i915->vertex_buffer[i].buffer, NULL);
+   }
+
    /* unbind framebuffer */
    for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
       pipe_surface_reference(&i915->framebuffer.cbufs[i], NULL);
index 3ae61d0ea70c0a0cfd4a5347e80ef775ba844ac7..d15e1723d8379285f26a6462b3f72fe47962cb11 100644 (file)
@@ -193,8 +193,7 @@ struct i915_velems_state {
 };
 
 
-struct i915_context
-{
+struct i915_context {
    struct pipe_context base;
 
    struct i915_winsys *iws;
@@ -273,7 +272,7 @@ struct i915_context
 #define I915_HW_PROGRAM           (1<<I915_CACHE_PROGRAM)
 #define I915_HW_CONSTANTS         (1<<I915_CACHE_CONSTANTS)
 #define I915_HW_IMMEDIATE         (1<<(I915_MAX_CACHE+0))
-#define I915_HW_INVARIENT         (1<<(I915_MAX_CACHE+1))
+#define I915_HW_INVARIANT         (1<<(I915_MAX_CACHE+1))
 
 
 /***********************************************************************
index 57d3390dea37d3bea34ae2116487142c086ae10a..87c435a2f364c0d98ff2064e81276a1f18d3f7a6 100644 (file)
@@ -46,10 +46,12 @@ static const struct debug_named_value debug_options[] = {
 };
 
 unsigned i915_debug = 0;
+boolean i915_tiling = TRUE;
 
 void i915_debug_init(struct i915_screen *screen)
 {
    i915_debug = debug_get_flags_option("I915_DEBUG", debug_options, 0);
+   i915_tiling = !debug_get_bool_option("I915_NO_TILING", FALSE);
 }
 
 
@@ -974,7 +976,7 @@ i915_dump_hardware_dirty(struct i915_context *i915, const char *func)
       {I915_HW_PROGRAM,   "program"},
       {I915_HW_CONSTANTS, "constants"},
       {I915_HW_IMMEDIATE, "immediate"},
-      {I915_HW_INVARIENT, "invarient"},
+      {I915_HW_INVARIANT, "invariant"},
       {0, NULL},
    };
    int i;
index fa60799d0c55669253ae9ab3ae4327764a96a54a..11af7662f0a614e75f7f9d52ae27bc336460b011 100644 (file)
@@ -46,6 +46,7 @@ struct i915_winsys_batchbuffer;
 #define DBG_CONSTANTS 0x20
 
 extern unsigned i915_debug;
+extern boolean i915_tiling;
 
 #ifdef DEBUG
 static INLINE boolean
index 25c53210be8eb2552440c4e1c74575459b2e2c62..9e20010c4a1e8cb217ccbd0fe49e49eeac380e7a 100644 (file)
@@ -924,6 +924,14 @@ i915_translate_instructions(struct i915_fp_compile *p,
       tgsi_parse_token( &parse );
 
       switch( parse.FullToken.Token.Type ) {
+      case TGSI_TOKEN_TYPE_PROPERTY:
+         /*
+          * We only support one cbuf, but we still need to ignore the property
+          * correctly so we don't hit the assert at the end of the switch case.
+          */
+         assert(parse.FullToken.FullProperty.Property.PropertyName ==
+                TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS);
+         break;
       case TGSI_TOKEN_TYPE_DECLARATION:
          if (parse.FullToken.FullDeclaration.Declaration.File
                   == TGSI_FILE_CONSTANT) {
index bd046bd9058463ecb1d9a6356aeff344cebf0c82..baebbc7bae3a471594507761fdbf1d2af4ff975a 100644 (file)
@@ -172,6 +172,7 @@ i915_vbuf_render_reserve(struct i915_vbuf_render *i915_render, size_t size)
  *
  * Side effects:
  *    Updates hw_offset, sw_offset, index and allocates a new buffer.
+ *    Will set i915->vbo to null on buffer allocation.
  */
 static void
 i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
@@ -179,8 +180,16 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
    struct i915_context *i915 = i915_render->i915;
    struct i915_winsys *iws = i915->iws;
 
-   if (i915_render->vbo)
+   if (i915_render->vbo) {
       iws->buffer_destroy(iws, i915_render->vbo);
+      /*
+       * XXX If buffers where referenced then this should be done in
+       * update_vbo_state but since they arn't and malloc likes to reuse
+       * memory we need to set it to null
+       */
+      i915->vbo = NULL;
+      i915_render->vbo = NULL;
+   }
 
    i915->vbo_flushed = 0;
 
@@ -198,7 +207,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
 #endif
 
    i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size,
-                                         64, I915_NEW_VERTEX);
+                                         I915_NEW_VERTEX);
 }
 
 /**
@@ -726,7 +735,7 @@ i915_vbuf_render_create(struct i915_context *i915)
    i915_render->pool_fifo = u_fifo_create(6);
    for (i = 0; i < 6; i++)
       u_fifo_add(i915_render->pool_fifo,
-                 iws->buffer_create(iws, i915_render->pool_buffer_size, 64,
+                 iws->buffer_create(iws, i915_render->pool_buffer_size,
                                     I915_NEW_VERTEX));
 #else
    (void)i;
index cc28891e4ac0e6c11710b92ac94b24d227a17346..5e4e80ddf6b2504a308bb298d5dd793ac9194294 100644 (file)
 #define    MT_COMPRESS_DXT1_RGB                   (4<<3)
 #define MS3_USE_FENCE_REGS              (1<<2)
 #define MS3_TILED_SURFACE             (1<<1)
-#define MS3_TILE_WALK                 (1<<0)
+#define MS3_TILE_WALK_Y                (1<<0)
 
 #define MS4_PITCH_SHIFT                 21
 #define MS4_CUBE_FACE_ENA_NEGX          (1<<20)
 #define MI_FLUSH                   ((0<<29)|(4<<23))
 #define FLUSH_MAP_CACHE            (1<<0)
 #define INHIBIT_FLUSH_RENDER_CACHE (1<<2)
+#define MI_NOOP                    0
 
 
 #define CMD_3D (0x3<<29)
index 753bd266b1200be43b8bed721de0c68ce231823d..86620e6a123e5926b1fca4867bc36a154258d85b 100644 (file)
@@ -49,6 +49,10 @@ struct i915_buffer {
 #define I915_MAX_TEXTURE_3D_LEVELS  8  /* max 128x128x128 */
 
 
+struct offset_pair {
+       unsigned short nblocksx;
+       unsigned short nblocksy;
+};
 
 struct i915_texture {
    struct u_resource b;
@@ -63,14 +67,18 @@ struct i915_texture {
 
    /* Explicitly store the offset of each image for each cube face or
     * depth value.
+    *
+    * Array [depth] off offsets.
     */
-   unsigned *image_offset[I915_MAX_TEXTURE_2D_LEVELS];   /**< array [depth] of offsets */
+   struct offset_pair *image_offset[I915_MAX_TEXTURE_2D_LEVELS];
 
    /* The data is held here:
     */
    struct i915_winsys_buffer *buffer;
 };
 
+unsigned i915_texture_offset(struct i915_texture *tex,
+                             unsigned level, unsigned layer);
 void i915_init_screen_resource_functions(struct i915_screen *is);
 void i915_init_resource_functions(struct i915_context *i915);
 
index 0d379497dfc1329f551444a2d2c478d47743482f..450203d60a9700e3a854675ceeda2bbcc5c747ff 100644 (file)
@@ -62,7 +62,7 @@ i915_buffer_destroy(struct pipe_screen *screen,
 
 static void *
 i915_buffer_transfer_map( struct pipe_context *pipe,
-                         struct pipe_transfer *transfer )
+                          struct pipe_transfer *transfer )
 {
    struct i915_buffer *buffer = i915_buffer(transfer->resource);
    return buffer->data + transfer->box.x;
@@ -71,19 +71,19 @@ i915_buffer_transfer_map( struct pipe_context *pipe,
 
 static void
 i915_buffer_transfer_inline_write( struct pipe_context *rm_ctx,
-                                  struct pipe_resource *resource,
-                                  struct pipe_subresource sr,
-                                  unsigned usage,
-                                  const struct pipe_box *box,
-                                  const void *data,
-                                  unsigned stride,
-                                  unsigned slice_stride)
+                                   struct pipe_resource *resource,
+                                   unsigned level,
+                                   unsigned usage,
+                                   const struct pipe_box *box,
+                                   const void *data,
+                                   unsigned stride,
+                                   unsigned layer_stride)
 {
    struct i915_buffer *buffer = i915_buffer(resource);
 
    memcpy(buffer->data + box->x,
-         data,
-         box->width);
+          data,
+          box->width);
 }
 
 
@@ -115,7 +115,7 @@ i915_buffer_create(struct pipe_screen *screen,
    buf->b.vtbl = &i915_buffer_vtbl;
    pipe_reference_init(&buf->b.b.reference, 1);
    buf->b.b.screen = screen;
-   
+
    buf->data = MALLOC(template->width0);
    buf->free_on_destroy = TRUE;
 
@@ -135,7 +135,7 @@ struct pipe_resource *
 i915_user_buffer_create(struct pipe_screen *screen,
                         void *ptr,
                         unsigned bytes,
-                       unsigned bind)
+                        unsigned bind)
 {
    struct i915_buffer *buf = CALLOC_STRUCT(i915_buffer);
 
@@ -152,6 +152,7 @@ i915_user_buffer_create(struct pipe_screen *screen,
    buf->b.b.width0 = bytes;
    buf->b.b.height0 = 1;
    buf->b.b.depth0 = 1;
+   buf->b.b.array_size = 1;
 
    buf->data = ptr;
    buf->free_on_destroy = FALSE;
index d45346b32ada1433e1c1dd777988a4a78c6796d7..f19106f3414a65825ff7acf88ed22928ee9362e2 100644 (file)
@@ -106,6 +106,23 @@ get_pot_stride(enum pipe_format format, unsigned width)
    return util_next_power_of_two(util_format_get_stride(format, width));
 }
 
+static INLINE const char*
+get_tiling_string(enum i915_winsys_buffer_tile tile)
+{
+   switch(tile) {
+   case I915_TILE_NONE:
+      return "none";
+   case I915_TILE_X:
+      return "x";
+   case I915_TILE_Y:
+      return "y";
+   default:
+      assert(FALSE);
+      return "?";
+   }
+}
+
+
 /*
  * More advanced helper funcs
  */
@@ -120,28 +137,56 @@ i915_texture_set_level_info(struct i915_texture *tex,
    assert(!tex->image_offset[level]);
 
    tex->nr_images[level] = nr_images;
-   tex->image_offset[level] = (unsigned *) MALLOC(nr_images * sizeof(unsigned));
-   tex->image_offset[level][0] = 0;
+   tex->image_offset[level] = MALLOC(nr_images * sizeof(struct offset_pair));
+   tex->image_offset[level][0].nblocksx = 0;
+   tex->image_offset[level][0].nblocksy = 0;
+}
+
+INLINE unsigned i915_texture_offset(struct i915_texture *tex,
+                                    unsigned level, unsigned layer)
+{
+   unsigned x, y;
+   x = tex->image_offset[level][layer].nblocksx
+      * util_format_get_blocksize(tex->b.b.format);
+   y = tex->image_offset[level][layer].nblocksy;
+
+   return y * tex->stride + x;
 }
 
 static void
 i915_texture_set_image_offset(struct i915_texture *tex,
                               unsigned level, unsigned img,
-                              unsigned x, unsigned y)
+                              unsigned nblocksx, unsigned nblocksy)
 {
    /* for the first image and level make sure offset is zero */
-   assert(!(img == 0 && level == 0) || (x == 0 && y == 0));
+   assert(!(img == 0 && level == 0) || (nblocksx == 0 && nblocksy == 0));
    assert(img < tex->nr_images[level]);
 
-   tex->image_offset[level][img] = y * tex->stride + x * util_format_get_blocksize(tex->b.b.format);
+   tex->image_offset[level][img].nblocksx = nblocksx;
+   tex->image_offset[level][img].nblocksy = nblocksy;
 
 #if DEBUG_TEXTURES
-   debug_printf("%s: %p level %u, img %u (%u, %u) %p\n", __FUNCTION__,
-                tex, level, img, x, y,
-                (void*)(uintptr_t)tex->image_offset[level][img]);
+   debug_printf("%s: %p level %u, img %u (%u, %u)\n", __FUNCTION__,
+                tex, level, img, x, y);
 #endif
 }
 
+static enum i915_winsys_buffer_tile
+i915_texture_tiling(struct pipe_resource *pt)
+{
+   if (!i915_tiling)
+      return I915_TILE_NONE;
+
+   if (pt->target == PIPE_TEXTURE_1D)
+      return I915_TILE_NONE;
+
+   if (util_format_is_s3tc(pt->format))
+      /* XXX X-tiling might make sense */
+      return I915_TILE_NONE;
+
+   return I915_TILE_X;
+}
+
 
 /*
  * Shared layout functions
@@ -163,9 +208,10 @@ i9x5_scanout_layout(struct i915_texture *tex)
    i915_texture_set_image_offset(tex, 0, 0, 0, 0);
 
    if (pt->width0 >= 240) {
-      tex->stride = get_pot_stride(pt->format, pt->width0);
+      tex->stride = align(util_format_get_stride(pt->format, pt->width0), 64);
       tex->total_nblocksy = align_nblocksy(pt->format, pt->height0, 8);
       tex->tiling = I915_TILE_X;
+   /* special case for cursors */
    } else if (pt->width0 == 64 && pt->height0 == 64) {
       tex->stride = get_pot_stride(pt->format, pt->width0);
       tex->total_nblocksy = align_nblocksy(pt->format, pt->height0, 8);
@@ -200,7 +246,7 @@ i9x5_display_target_layout(struct i915_texture *tex)
    i915_texture_set_level_info(tex, 0, 1);
    i915_texture_set_image_offset(tex, 0, 0, 0, 0);
 
-   tex->stride = get_pot_stride(pt->format, pt->width0);
+   tex->stride = align(util_format_get_stride(pt->format, pt->width0), 64);
    tex->total_nblocksy = align_nblocksy(pt->format, pt->height0, 8);
    tex->tiling = I915_TILE_X;
 
@@ -357,6 +403,8 @@ i915_texture_layout(struct i915_texture * tex)
 {
    struct pipe_resource *pt = &tex->b.b;
 
+   tex->tiling = i915_texture_tiling(pt);
+
    switch (pt->target) {
    case PIPE_TEXTURE_1D:
    case PIPE_TEXTURE_2D:
@@ -603,6 +651,8 @@ i945_texture_layout(struct i915_texture * tex)
 {
    struct pipe_resource *pt = &tex->b.b;
 
+   tex->tiling = i915_texture_tiling(pt);
+
    switch (pt->target) {
    case PIPE_TEXTURE_1D:
    case PIPE_TEXTURE_2D:
@@ -650,7 +700,7 @@ i915_texture_get_handle(struct pipe_screen * screen,
 
 static void
 i915_texture_destroy(struct pipe_screen *screen,
-                    struct pipe_resource *pt)
+                     struct pipe_resource *pt)
 {
    struct i915_texture *tex = i915_texture(pt);
    struct i915_winsys *iws = i915_screen(screen)->iws;
@@ -667,10 +717,10 @@ i915_texture_destroy(struct pipe_screen *screen,
 
 static struct pipe_transfer * 
 i915_texture_get_transfer(struct pipe_context *context,
-                         struct pipe_resource *resource,
-                         struct pipe_subresource sr,
-                         unsigned usage,
-                         const struct pipe_box *box)
+                          struct pipe_resource *resource,
+                          unsigned level,
+                          unsigned usage,
+                          const struct pipe_box *box)
 {
    struct i915_texture *tex = i915_texture(resource);
    struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
@@ -678,37 +728,31 @@ i915_texture_get_transfer(struct pipe_context *context,
       return NULL;
 
    transfer->resource = resource;
-   transfer->sr = sr;
+   transfer->level = level;
    transfer->usage = usage;
    transfer->box = *box;
    transfer->stride = tex->stride;
+   /* FIXME: layer_stride */
 
    return transfer;
 }
 
-
 static void *
 i915_texture_transfer_map(struct pipe_context *pipe,
-                         struct pipe_transfer *transfer)
+                          struct pipe_transfer *transfer)
 {
    struct pipe_resource *resource = transfer->resource;
    struct i915_texture *tex = i915_texture(resource);
    struct i915_winsys *iws = i915_screen(pipe->screen)->iws;
-   struct pipe_subresource sr = transfer->sr;
    struct pipe_box *box = &transfer->box;
    enum pipe_format format = resource->format;
    unsigned offset;
    char *map;
 
-   if (resource->target == PIPE_TEXTURE_CUBE) {
-      offset = tex->image_offset[sr.level][sr.face];
-   } else if (resource->target == PIPE_TEXTURE_3D) {
-      offset = tex->image_offset[sr.level][box->z];
-   } else {
-      offset = tex->image_offset[sr.level][0];
-      assert(sr.face == 0);
+   if (resource->target != PIPE_TEXTURE_3D &&
+       resource->target != PIPE_TEXTURE_CUBE)
       assert(box->z == 0);
-   }
+   offset = i915_texture_offset(tex, transfer->level, box->z);
 
    map = iws->buffer_map(iws, tex->buffer,
                          (transfer->usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE);
@@ -754,7 +798,6 @@ i915_texture_create(struct pipe_screen *screen,
    struct i915_screen *is = i915_screen(screen);
    struct i915_winsys *iws = is->iws;
    struct i915_texture *tex = CALLOC_STRUCT(i915_texture);
-   size_t tex_size;
    unsigned buf_usage = 0;
 
    if (!tex)
@@ -773,8 +816,6 @@ i915_texture_create(struct pipe_screen *screen,
          goto fail;
    }
 
-   tex_size = tex->stride * tex->total_nblocksy;
-
    /* for scanouts and cursors, cursors arn't scanouts */
 
    /* XXX: use a custom flag for cursors, don't rely on magically
@@ -785,27 +826,15 @@ i915_texture_create(struct pipe_screen *screen,
    else
       buf_usage = I915_NEW_TEXTURE;
 
-   tex->buffer = iws->buffer_create(iws, tex_size, 64, buf_usage);
+   tex->buffer = iws->buffer_create_tiled(iws, &tex->stride, tex->total_nblocksy,
+                                         &tex->tiling, buf_usage);
    if (!tex->buffer)
       goto fail;
 
-   /* setup any hw fences */
-   if (tex->tiling) {
-      iws->buffer_set_fence_reg(iws, tex->buffer, tex->stride, tex->tiling);
-   }
-
-   
-#if 0
-   void *ptr = ws->buffer_map(ws, tex->buffer,
-      PIPE_BUFFER_USAGE_CPU_WRITE);
-   memset(ptr, 0x80, tex_size);
-   ws->buffer_unmap(ws, tex->buffer);
-#endif
-
-   I915_DBG(DBG_TEXTURE, "%s: %p size %u, stride %u, blocks (%u, %u)\n", __func__,
-            tex, (unsigned int)tex_size, tex->stride,
+   I915_DBG(DBG_TEXTURE, "%s: %p stride %u, blocks (%u, %u) tiling %s\n", __func__,
+            tex, tex->stride,
             tex->stride / util_format_get_blocksize(tex->b.b.format),
-            tex->total_nblocksy);
+            tex->total_nblocksy, get_tiling_string(tex->tiling));
 
    return &tex->b.b;
 
@@ -824,10 +853,11 @@ i915_texture_from_handle(struct pipe_screen * screen,
    struct i915_winsys *iws = is->iws;
    struct i915_winsys_buffer *buffer;
    unsigned stride;
+   enum i915_winsys_buffer_tile tiling;
 
    assert(screen);
 
-   buffer = iws->buffer_from_handle(iws, whandle, &stride);
+   buffer = iws->buffer_from_handle(iws, whandle, &tiling, &stride);
 
    /* Only supports one type */
    if ((template->target != PIPE_TEXTURE_2D &&
@@ -847,6 +877,7 @@ i915_texture_from_handle(struct pipe_screen * screen,
    tex->b.b.screen = screen;
 
    tex->stride = stride;
+   tex->tiling = tiling;
    tex->total_nblocksy = align_nblocksy(tex->b.b.format, tex->b.b.height0, 8);
 
    i915_texture_set_level_info(tex, 0, 1);
@@ -854,10 +885,10 @@ i915_texture_from_handle(struct pipe_screen * screen,
 
    tex->buffer = buffer;
 
-   I915_DBG(DBG_TEXTURE, "%s: %p stride %u, blocks (%ux%u)\n", __func__,
+   I915_DBG(DBG_TEXTURE, "%s: %p stride %u, blocks (%u, %u) tiling %s\n", __func__,
             tex, tex->stride,
             tex->stride / util_format_get_blocksize(tex->b.b.format),
-            tex->total_nblocksy);
+            tex->total_nblocksy, get_tiling_string(tex->tiling));
 
    return &tex->b.b;
 }
index a3c51138008cef66f9be6f53bd44ff960cb2bfbc..bdbc08e808653d0d82b94b75cfb283c79097e9f0 100644 (file)
@@ -35,7 +35,6 @@
 #include "i915_debug.h"
 #include "i915_context.h"
 #include "i915_screen.h"
-#include "i915_surface.h"
 #include "i915_resource.h"
 #include "i915_winsys.h"
 #include "i915_public.h"
@@ -387,7 +386,6 @@ i915_screen_create(struct i915_winsys *iws)
    is->base.fence_finish = i915_fence_finish;
 
    i915_init_screen_resource_functions(is);
-   i915_init_screen_surface_functions(is);
 
    i915_debug_init(is);
 
index bbfcff6bc4d04396872b40c7813cd44af520a13b..f5b60ed59427414d348ac823871622037675b953 100644 (file)
@@ -760,8 +760,9 @@ static void i915_set_vertex_buffers(struct pipe_context *pipe,
     */
    draw_flush(i915->draw);
 
-   memcpy(i915->vertex_buffer, buffers, count * sizeof(buffers[0]));
-   i915->num_vertex_buffers = count;
+   util_copy_vertex_buffers(i915->vertex_buffer,
+                            &i915->num_vertex_buffers,
+                            buffers, count);
 
    /* pass-through to draw module */
    draw_set_vertex_buffers(i915->draw, count, buffers);
index 49dff1f775c040ea0c9e6ddf18159be16d879d79..86c02976495234688222bd05d6de8140121551cd 100644 (file)
@@ -86,6 +86,22 @@ framebuffer_size(const struct pipe_framebuffer_state *fb,
    }
 }
 
+static inline uint32_t
+buf_3d_tiling_bits(enum i915_winsys_buffer_tile tiling)
+{
+         uint32_t tiling_bits = 0;
+
+         switch (tiling) {
+         case I915_TILE_Y:
+            tiling_bits |= BUF_3D_TILE_WALK_Y;
+         case I915_TILE_X:
+            tiling_bits |= BUF_3D_TILED_SURFACE;
+         case I915_TILE_NONE:
+            break;
+         }
+
+         return tiling_bits;
+}
 
 /* Push the state into the sarea and/or texture memory.
  */
@@ -126,7 +142,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
    save_relocs = i915->batch->relocs;
 
    /* 14 dwords, 0 relocs */
-   if (i915->hardware_dirty & I915_HW_INVARIENT)
+   if (i915->hardware_dirty & I915_HW_INVARIANT)
    {
       OUT_BATCH(_3DSTATE_AA_CMD |
                 AA_LINE_ECAAR_WIDTH_ENABLE |
@@ -220,7 +236,6 @@ i915_emit_hardware_state(struct i915_context *i915 )
       struct pipe_surface *depth_surface = i915->framebuffer.zsbuf;
 
       if (cbuf_surface) {
-         unsigned ctile = BUF_3D_USE_FENCE;
          struct i915_texture *tex = i915_texture(cbuf_surface->texture);
          assert(tex);
 
@@ -228,30 +243,32 @@ i915_emit_hardware_state(struct i915_context *i915 )
 
          OUT_BATCH(BUF_3D_ID_COLOR_BACK |
                    BUF_3D_PITCH(tex->stride) |  /* pitch in bytes */
-                   ctile);
+                   buf_3d_tiling_bits(tex->tiling));
 
          OUT_RELOC(tex->buffer,
                    I915_USAGE_RENDER,
-                   cbuf_surface->offset);
+                   0);
       }
 
       /* What happens if no zbuf??
        */
       if (depth_surface) {
-         unsigned ztile = BUF_3D_USE_FENCE;
          struct i915_texture *tex = i915_texture(depth_surface->texture);
+         unsigned offset = i915_texture_offset(tex, depth_surface->u.tex.level,
+                                               depth_surface->u.tex.first_layer);
          assert(tex);
+         assert(offset == 0);
 
          OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
 
          assert(tex);
          OUT_BATCH(BUF_3D_ID_DEPTH |
                    BUF_3D_PITCH(tex->stride) |  /* pitch in bytes */
-                   ztile);
+                   buf_3d_tiling_bits(tex->tiling));
 
          OUT_RELOC(tex->buffer,
                    I915_USAGE_RENDER,
-                   depth_surface->offset);
+                   0);
       }
 
       {
@@ -293,12 +310,11 @@ i915_emit_hardware_state(struct i915_context *i915 )
                if (enabled & (1 << unit)) {
                   struct i915_texture *texture = i915_texture(i915->fragment_sampler_views[unit]->texture);
                   struct i915_winsys_buffer *buf = texture->buffer;
-                  uint offset = 0;
                   assert(buf);
 
                   count++;
 
-                  OUT_RELOC(buf, I915_USAGE_SAMPLER, offset);
+                  OUT_RELOC(buf, I915_USAGE_SAMPLER, 0);
                   OUT_BATCH(i915->current.texbuffer[unit][0]); /* MS3 */
                   OUT_BATCH(i915->current.texbuffer[unit][1]); /* MS4 */
                }
@@ -391,18 +407,33 @@ i915_emit_hardware_state(struct i915_context *i915 )
 #if 01
    /* drawing surface size */
    /* 6 dwords, 0 relocs */
+   if (i915->hardware_dirty & I915_HW_STATIC)
    {
       uint w, h;
-      boolean k = framebuffer_size(&i915->framebuffer, &w, &h);
-      (void)k;
-      assert(k);
+      struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0];
+      struct i915_texture *tex = i915_texture(cbuf_surface->texture);
+      unsigned x, y;
+      int layer;
+      uint32_t draw_offset;
+      boolean ret;
+
+      ret = framebuffer_size(&i915->framebuffer, &w, &h);
+      assert(ret);
 
+      layer = cbuf_surface->u.tex.first_layer;
+
+      x = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksx;
+      y = tex->image_offset[cbuf_surface->u.tex.level][layer].nblocksy;
+
+      draw_offset = x | (y << 16);
+
+      /* XXX flush only required when the draw_offset changes! */
+      OUT_BATCH(MI_FLUSH | INHIBIT_FLUSH_RENDER_CACHE);
       OUT_BATCH(_3DSTATE_DRAW_RECT_CMD);
-      OUT_BATCH(0);
-      OUT_BATCH(0);
-      OUT_BATCH(((w - 1) & 0xffff) | ((h - 1) << 16));
-      OUT_BATCH(0);
-      OUT_BATCH(0);
+      OUT_BATCH(DRAW_RECT_DIS_DEPTH_OFS);
+      OUT_BATCH(draw_offset);
+      OUT_BATCH((w - 1 + x) | ((h - 1 + y) << 16));
+      OUT_BATCH(draw_offset);
    }
 #endif
 
index 9771274ca1126ef34893df1f8e07008ae3843a5a..916cb767536e1ab2a1d23c67b19d66c9b70b72b1 100644 (file)
@@ -243,6 +243,23 @@ static uint translate_texture_format(enum pipe_format pipeFormat)
    }
 }
 
+static inline uint32_t
+ms3_tiling_bits(enum i915_winsys_buffer_tile tiling)
+{
+         uint32_t tiling_bits = 0;
+
+         switch (tiling) {
+         case I915_TILE_Y:
+            tiling_bits |= MS3_TILE_WALK_Y;
+         case I915_TILE_X:
+            tiling_bits |= MS3_TILED_SURFACE;
+         case I915_TILE_NONE:
+            break;
+         }
+
+         return tiling_bits;
+}
+
 static void update_map(struct i915_context *i915,
                        uint unit,
                        const struct i915_texture *tex,
@@ -254,7 +271,6 @@ static void update_map(struct i915_context *i915,
    const uint width = pt->width0, height = pt->height0, depth = pt->depth0;
    const uint num_levels = pt->last_level;
    unsigned max_lod = num_levels * 4;
-   unsigned tiled = MS3_USE_FENCE_REGS;
 
    assert(tex);
    assert(width);
@@ -272,7 +288,7 @@ static void update_map(struct i915_context *i915,
       (((height - 1) << MS3_HEIGHT_SHIFT)
        | ((width - 1) << MS3_WIDTH_SHIFT)
        | format
-       | tiled);
+       | ms3_tiling_bits(tex->tiling));
 
    /*
     * XXX When min_filter != mag_filter and there's just one mipmap level,
index f40876e708e26d92503a70fb0e15415ac3812c23..becc6e93c2d258e047d6e621a397f6e3c54b646f 100644 (file)
  */
 static void
 i915_surface_copy(struct pipe_context *pipe,
-                  struct pipe_resource *dst, struct pipe_subresource subdst,
+                  struct pipe_resource *dst, unsigned dst_level,
                   unsigned dstx, unsigned dsty, unsigned dstz,
-                  struct pipe_resource *src, struct pipe_subresource subsrc,
-                  unsigned srcx, unsigned srcy, unsigned srcz,
-                  unsigned width, unsigned height)
+                  struct pipe_resource *src, unsigned src_level,
+                  const struct pipe_box *src_box)
 {
    struct i915_texture *dst_tex = i915_texture(dst);
    struct i915_texture *src_tex = i915_texture(src);
@@ -55,29 +54,17 @@ i915_surface_copy(struct pipe_context *pipe,
    struct pipe_resource *spt = &src_tex->b.b;
    unsigned dst_offset, src_offset;  /* in bytes */
 
-   if (dst->target == PIPE_TEXTURE_CUBE) {
-      dst_offset = dst_tex->image_offset[subdst.level][subdst.face];
-   }
-   else if (dst->target == PIPE_TEXTURE_3D) {
-      dst_offset = dst_tex->image_offset[subdst.level][dstz];
-   }
-   else {
-      dst_offset = dst_tex->image_offset[subdst.level][0];
-      assert(subdst.face == 0);
+   /* XXX cannot copy 3d regions at this time */
+   assert(src_box->depth == 1);
+   if (dst->target != PIPE_TEXTURE_CUBE &&
+       dst->target != PIPE_TEXTURE_3D)
       assert(dstz == 0);
-   }
-   if (src->target == PIPE_TEXTURE_CUBE) {
-      src_offset = src_tex->image_offset[subsrc.level][subsrc.face];
-   }
-   else if (src->target == PIPE_TEXTURE_3D) {
-      src_offset = src_tex->image_offset[subsrc.level][srcz];
-   }
-   else {
-      src_offset = src_tex->image_offset[subsrc.level][0];
-      assert(subsrc.face == 0);
-      assert(srcz == 0);
-   }
+   dst_offset = i915_texture_offset(dst_tex, dst_level, dstz);
 
+   if (src->target != PIPE_TEXTURE_CUBE &&
+       src->target != PIPE_TEXTURE_3D)
+      assert(src_box->z == 0);
+   src_offset = i915_texture_offset(src_tex, src_level, src_box->z);
 
    assert( dst != src );
    assert( util_format_get_blocksize(dpt->format) == util_format_get_blocksize(spt->format) );
@@ -90,7 +77,8 @@ i915_surface_copy(struct pipe_context *pipe,
                    util_format_get_blocksize(dpt->format),
                    (unsigned short) src_tex->stride, src_tex->buffer, src_offset,
                    (unsigned short) dst_tex->stride, dst_tex->buffer, dst_offset,
-                   (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
+                   (short) src_box->x, (short) src_box->y, (short) dstx, (short) dsty,
+                   (short) src_box->width, (short) src_box->height );
 }
 
 
@@ -104,6 +92,7 @@ i915_clear_render_target(struct pipe_context *pipe,
    struct i915_texture *tex = i915_texture(dst->texture);
    struct pipe_resource *pt = &tex->b.b;
    union util_color uc;
+   unsigned offset = i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
 
    assert(util_format_get_blockwidth(pt->format) == 1);
    assert(util_format_get_blockheight(pt->format) == 1);
@@ -113,7 +102,7 @@ i915_clear_render_target(struct pipe_context *pipe,
                    util_format_get_blocksize(pt->format),
                    XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB,
                    (unsigned short) tex->stride,
-                   tex->buffer, dst->offset,
+                   tex->buffer, offset,
                    (short) dstx, (short) dsty,
                    (short) width, (short) height,
                    uc.ui );
@@ -132,6 +121,7 @@ i915_clear_depth_stencil(struct pipe_context *pipe,
    struct pipe_resource *pt = &tex->b.b;
    unsigned packedds;
    unsigned mask = 0;
+   unsigned offset = i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
 
    assert(util_format_get_blockwidth(pt->format) == 1);
    assert(util_format_get_blockheight(pt->format) == 1);
@@ -151,7 +141,7 @@ i915_clear_depth_stencil(struct pipe_context *pipe,
                    util_format_get_blocksize(pt->format),
                    mask,
                    (unsigned short) tex->stride,
-                   tex->buffer, dst->offset,
+                   tex->buffer, offset,
                    (short) dstx, (short) dsty,
                    (short) width, (short) height,
                    packedds );
@@ -163,42 +153,37 @@ i915_clear_depth_stencil(struct pipe_context *pipe,
 
 
 static struct pipe_surface *
-i915_get_tex_surface(struct pipe_screen *screen,
-                     struct pipe_resource *pt,
-                     unsigned face, unsigned level, unsigned zslice,
-                     unsigned flags)
+i915_create_surface(struct pipe_context *ctx,
+                    struct pipe_resource *pt,
+                    const struct pipe_surface *surf_tmpl)
 {
-   struct i915_texture *tex = i915_texture(pt);
    struct pipe_surface *ps;
-   unsigned offset;  /* in bytes */
 
-   if (pt->target == PIPE_TEXTURE_CUBE) {
-      offset = tex->image_offset[level][face];
-   }
-   else if (pt->target == PIPE_TEXTURE_3D) {
-      offset = tex->image_offset[level][zslice];
-   }
-   else {
-      offset = tex->image_offset[level][0];
-      assert(face == 0);
-      assert(zslice == 0);
-   }
+   assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
+   if (pt->target != PIPE_TEXTURE_CUBE &&
+       pt->target != PIPE_TEXTURE_3D)
+      assert(surf_tmpl->u.tex.first_layer == 0);
 
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
+      /* could subclass pipe_surface and store offset as it used to do */
       pipe_reference_init(&ps->reference, 1);
       pipe_resource_reference(&ps->texture, pt);
-      ps->format = pt->format;
-      ps->width = u_minify(pt->width0, level);
-      ps->height = u_minify(pt->height0, level);
-      ps->offset = offset;
-      ps->usage = flags;
+      ps->format = surf_tmpl->format;
+      ps->width = u_minify(pt->width0, surf_tmpl->u.tex.level);
+      ps->height = u_minify(pt->height0, surf_tmpl->u.tex.level);
+      ps->u.tex.level = surf_tmpl->u.tex.level;
+      ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+      ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
+      ps->usage = surf_tmpl->usage;
+      ps->context = ctx;
    }
    return ps;
 }
 
 static void
-i915_tex_surface_destroy(struct pipe_surface *surf)
+i915_surface_destroy(struct pipe_context *ctx,
+                     struct pipe_surface *surf)
 {
    pipe_resource_reference(&surf->texture, NULL);
    FREE(surf);
@@ -211,13 +196,6 @@ i915_init_surface_functions(struct i915_context *i915)
    i915->base.resource_copy_region = i915_surface_copy;
    i915->base.clear_render_target = i915_clear_render_target;
    i915->base.clear_depth_stencil = i915_clear_depth_stencil;
-}
-
-/* No good reason for these to be in the screen.
- */
-void
-i915_init_screen_surface_functions(struct i915_screen *is)
-{
-   is->base.get_tex_surface = i915_get_tex_surface;
-   is->base.tex_surface_destroy = i915_tex_surface_destroy;
+   i915->base.create_surface = i915_create_surface;
+   i915->base.surface_destroy = i915_surface_destroy;
 }
index 448106d5662300ec6b05de3e6f2d6b49a7b37b95..70b61de80f2686d553dbdacb3ef3793bee090796 100644 (file)
@@ -32,7 +32,6 @@ struct i915_context;
 struct i915_screen;
 
 void i915_init_surface_functions( struct i915_context *i915 );
-void i915_init_screen_surface_functions( struct i915_screen *is );
 
 
 #endif /* I915_SCREEN_H */
index 5385e403d224e3715dd8116b2f0e92f049961c8f..24ea416f015469b84215dba63bd9f2ca1b19e624 100644 (file)
@@ -53,6 +53,7 @@ enum i915_winsys_buffer_type
    I915_NEW_VERTEX
 };
 
+/* These need to be in sync with the definitions of libdrm-intel! */
 enum i915_winsys_buffer_tile
 {
    I915_TILE_NONE,
@@ -106,7 +107,7 @@ struct i915_winsys {
    int (*batchbuffer_reloc)(struct i915_winsys_batchbuffer *batch,
                             struct i915_winsys_buffer *reloc,
                             enum i915_winsys_buffer_usage usage,
-                            unsigned offset);
+                            unsigned offset, bool fenced);
 
    /**
     * Flush a bufferbatch.
@@ -130,9 +131,23 @@ struct i915_winsys {
     */
    struct i915_winsys_buffer *
       (*buffer_create)(struct i915_winsys *iws,
-                       unsigned size, unsigned alignment,
+                       unsigned size,
                        enum i915_winsys_buffer_type type);
 
+   /**
+    * Create a tiled buffer.
+    *
+    * *stride, height are in bytes. The winsys tries to allocate the buffer with
+    * the tiling mode provide in *tiling. If tiling is no possible, *tiling will
+    * be set to I915_TILE_NONE. The calculated stride (incorporateing hw/kernel
+    * requirements) is always returned in *stride.
+    */
+   struct i915_winsys_buffer *
+      (*buffer_create_tiled)(struct i915_winsys *iws,
+                             unsigned *stride, unsigned height,
+                             enum i915_winsys_buffer_tile *tiling,
+                             enum i915_winsys_buffer_type type);
+
    /**
     * Creates a buffer from a handle.
     * Used to implement pipe_screen::resource_from_handle.
@@ -142,6 +157,7 @@ struct i915_winsys {
    struct i915_winsys_buffer *
       (*buffer_from_handle)(struct i915_winsys *iws,
                             struct winsys_handle *whandle,
+                            enum i915_winsys_buffer_tile *tiling,
                             unsigned *stride);
 
    /**
@@ -153,15 +169,6 @@ struct i915_winsys {
                                 struct winsys_handle *whandle,
                                 unsigned stride);
 
-   /**
-    * Fence a buffer with a fence reg.
-    * Not to be confused with pipe_fence_handle.
-    */
-   int (*buffer_set_fence_reg)(struct i915_winsys *iws,
-                               struct i915_winsys_buffer *buffer,
-                               unsigned stride,
-                               enum i915_winsys_buffer_tile tile);
-
    /**
     * Map a buffer.
     */
index b0b09703384d78b2062a5cb1b6edab671e5f581d..a0331f805813ccc4a06cb111724d40f997b2ebfb 100644 (file)
@@ -33,6 +33,7 @@ C_SOURCES = \
        brw_pipe_flush.c \
        brw_pipe_misc.c \
        brw_pipe_sampler.c \
+        brw_pipe_surface.c \
        brw_pipe_vertex.c \
        brw_pipe_clear.c \
        brw_pipe_rast.c \
@@ -66,7 +67,6 @@ C_SOURCES = \
        brw_resource_buffer.c \
        brw_resource_texture.c \
        brw_resource_texture_layout.c \
-       brw_screen_surface.c \
        brw_batchbuffer.c \
        brw_winsys_debug.c \
        intel_decode.c
index 019af682f68f044c90990ead8ba24f8e0450fa24..3ef6c88030588237392c31c93dbae8e288a00391 100644 (file)
@@ -36,6 +36,8 @@ i965 = env.ConvenienceLibrary(
                'brw_pipe_query.c',
                'brw_pipe_rast.c',
                'brw_pipe_sampler.c',
+                'brw_pipe_surface.c',
+                'brw_pipe_surface.c',
                'brw_pipe_shader.c',
                'brw_pipe_vertex.c',
                'brw_resource.c',
@@ -43,7 +45,6 @@ i965 = env.ConvenienceLibrary(
                'brw_resource_texture.c',
                'brw_resource_texture_layout.c',
                'brw_screen.c',
-               'brw_screen_surface.c',
                'brw_structs_dump.c',
                'brw_sf.c',
                'brw_sf_emit.c',
index e80067f3b191830d72bc67335688a5f33c61cb82..3c935792465edf10715b3bfd31e3b54333add01e 100644 (file)
@@ -64,13 +64,11 @@ brw_batchbuffer_reset(struct brw_batchbuffer *batch)
 }
 
 struct brw_batchbuffer *
-brw_batchbuffer_alloc(struct brw_winsys_screen *sws,
-                      struct brw_chipset chipset)
+brw_batchbuffer_alloc(struct brw_winsys_screen *sws)
 {
    struct brw_batchbuffer *batch = CALLOC_STRUCT(brw_batchbuffer);
 
    batch->sws = sws;
-   batch->chipset = chipset;
    brw_batchbuffer_reset(batch);
 
    return batch;
index 6ca9f617f5ea33056be62cf6382564c536a837d7..6ecb91857dda5b732ccab054afb517286c27e221 100644 (file)
@@ -26,7 +26,6 @@ struct brw_batchbuffer {
 
    struct brw_winsys_screen *sws;
    struct brw_winsys_buffer *buf;
-   struct brw_chipset chipset;
 
    /**
     * Values exported to speed up the writing the batchbuffer,
@@ -47,8 +46,8 @@ struct brw_batchbuffer {
    /*@}*/
 };
 
-struct brw_batchbuffer *brw_batchbuffer_alloc( struct brw_winsys_screen *sws,
-                                               struct brw_chipset chipset );
+struct brw_batchbuffer *brw_batchbuffer_alloc( struct brw_winsys_screen *sws );
+
 
 void brw_batchbuffer_free(struct brw_batchbuffer *batch);
 
index ccba205e8c769528a03806938bd34925d625d748..66b13ea58e26084d73cb0ac8bc3ac23beb6420ca 100644 (file)
@@ -66,16 +66,14 @@ compile_clip_prog( struct brw_context *brw,
 
    c.func.single_program_flow = 1;
 
-   c.chipset = brw->chipset;
    c.key = *key;
-   c.need_ff_sync = c.chipset.is_igdng;
 
    /* Need to locate the two positions present in vertex + header.
     * These are currently hardcoded:
     */
    c.header_position_offset = ATTR_SIZE;
 
-   if (c.chipset.is_igdng)
+   if (brw->gen == 5)
        delta = 3 * REG_SIZE;
    else
        delta = REG_SIZE;
@@ -97,7 +95,7 @@ compile_clip_prog( struct brw_context *brw,
    if (c.key.output_edgeflag != BRW_OUTPUT_NOT_PRESENT)
       c.offset_edgeflag = delta + c.key.output_edgeflag * ATTR_SIZE;
    
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
        c.nr_regs = (c.key.nr_attrs + 1) / 2 + 3;  /* are vertices packed, or reg-aligned? */
    else
        c.nr_regs = (c.key.nr_attrs + 1) / 2 + 1;  /* are vertices packed, or reg-aligned? */
index 80e3a11a370c21d9a242e9d8f9403afa715b2a10..f123b73c063b60c69eaad0bcd3f0b879ca7604f4 100644 (file)
@@ -125,12 +125,10 @@ struct brw_clip_compile {
    GLuint last_tmp;
 
    GLboolean need_direction;
-   struct brw_chipset chipset;
 
    GLuint last_mrf;
 
    GLuint header_position_offset;
-   GLboolean need_ff_sync;
 
    GLuint nr_color_attrs;
    GLuint offset_color0;
index 66caadc4d533fe99b0297b926e19c1e80e49eb18..4ed7362171bc61068d340586b269ab28aa486929 100644 (file)
@@ -32,6 +32,7 @@
 #include "util/u_debug.h"
 
 #include "brw_defines.h"
+#include "brw_context.h"
 #include "brw_eu.h"
 #include "brw_clip.h"
 
@@ -41,7 +42,7 @@
 static void brw_clip_line_alloc_regs( struct brw_clip_compile *c )
 {
    GLuint i = 0,j;
-
+   struct brw_context *brw = c->func.brw;
    /* Register usage is static, precompute here:
     */
    c->reg.R0 = retype(brw_vec8_grf(i, 0), BRW_REGISTER_TYPE_UD); i++;
@@ -79,7 +80,7 @@ static void brw_clip_line_alloc_regs( struct brw_clip_compile *c )
       i++;
    }
 
-   if (c->need_ff_sync) {
+   if (brw->needs_ff_sync) {
       c->reg.ff_sync = retype(brw_vec1_grf(i, 0), BRW_REGISTER_TYPE_UD);
       i++;
    }
@@ -120,6 +121,7 @@ static void brw_clip_line_alloc_regs( struct brw_clip_compile *c )
 static void clip_and_emit_line( struct brw_clip_compile *c )
 {
    struct brw_compile *p = &c->func;
+   struct brw_context *brw = p->brw;
    struct brw_indirect vtx0     = brw_indirect(0, 0);
    struct brw_indirect vtx1      = brw_indirect(1, 0);
    struct brw_indirect newvtx0   = brw_indirect(2, 0);
@@ -146,7 +148,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
    brw_clip_init_clipmask(c);
 
    /* -ve rhw workaround */
-   if (c->chipset.is_965) {
+   if (brw->has_negative_rhw_bug) {
       brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
       brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
               brw_imm_ud(1<<20));
@@ -183,7 +185,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
               * Both can be negative on GM965/G965 due to RHW workaround
               * if so, this object should be rejected.
               */
-             if (c->chipset.is_965) {
+            if (brw->has_negative_rhw_bug) {
                  brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_LE, c->reg.dp0, brw_imm_f(0.0));
                  is_neg2 = brw_IF(p, BRW_EXECUTE_1);
                  {
@@ -208,7 +210,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
 
              /* If both are positive, do nothing */
              /* Only on GM965/G965 */
-             if (c->chipset.is_965) {
+            if (brw->has_negative_rhw_bug) {
                  brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0));
                  is_neg2 = brw_IF(p, BRW_EXECUTE_1);
              }
@@ -223,7 +225,7 @@ static void clip_and_emit_line( struct brw_clip_compile *c )
                  brw_set_predicate_control(p, BRW_PREDICATE_NONE);
              }
 
-             if (c->chipset.is_965) {
+            if (brw->has_negative_rhw_bug) {
                  brw_ENDIF(p, is_neg2);
              }
          }
index 5c3ccfd8d0da43a6bd0ab2b569705908595dc756..f56edf3177c2678119ced8f59e590620ac16e91d 100644 (file)
@@ -109,7 +109,7 @@ clip_unit_create_from_key(struct brw_context *brw,
       /* Although up to 16 concurrent Clip threads are allowed on IGDNG, 
        * only 2 threads can output VUEs at a time.
        */
-      if (BRW_IS_IGDNG(brw))
+      if (brw->gen == 5)
          clip.thread4.max_threads = 16 - 1;        
       else
          clip.thread4.max_threads = 2 - 1;
@@ -134,7 +134,7 @@ clip_unit_create_from_key(struct brw_context *brw,
    clip.clip5.api_mode = BRW_CLIP_API_OGL;
    clip.clip5.clip_mode = key->clip_mode;
 
-   if (BRW_IS_G4X(brw))
+   if (brw->is_g4x)
       clip.clip5.negative_w_clip_test = 1;
 
    clip.clip6.clipper_viewport_state_ptr = 0;
index 069524bc14f623a062ec89ad1bd838bc89f18f4d..7d400e6028b1ca675d182d35d09090959f94b89e 100644 (file)
@@ -30,6 +30,7 @@
   */
 
 #include "brw_defines.h"
+#include "brw_context.h"
 #include "brw_eu.h"
 #include "brw_clip.h"
 
@@ -43,6 +44,7 @@ void brw_clip_tri_alloc_regs( struct brw_clip_compile *c,
                              GLuint nr_verts )
 {
    GLuint i = 0,j;
+   struct brw_context *brw = c->func.brw;
 
    /* Register usage is static, precompute here:
     */
@@ -69,7 +71,7 @@ void brw_clip_tri_alloc_regs( struct brw_clip_compile *c,
       for (j = 0; j < 3; j++) {
         GLuint delta = c->key.nr_attrs*16 + 32;
 
-         if (c->chipset.is_igdng)
+         if (brw->gen == 5)
              delta = c->key.nr_attrs * 16 + 32 * 3;
 
         brw_MOV(&c->func, byte_offset(c->reg.vertex[j], delta), brw_imm_f(0));
@@ -110,7 +112,7 @@ void brw_clip_tri_alloc_regs( struct brw_clip_compile *c,
       i++;
    }
 
-   if (c->need_ff_sync) {
+   if (brw->needs_ff_sync) {
       c->reg.ff_sync = retype(brw_vec1_grf(i, 0), BRW_REGISTER_TYPE_UD);
       i++;
    }
@@ -563,7 +565,7 @@ void brw_emit_tri_clip( struct brw_clip_compile *c )
 
    /* if -ve rhw workaround bit is set, 
       do cliptest */
-   if (c->chipset.is_965) {
+   if (p->brw->has_negative_rhw_bug) {
       brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
       brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2), 
               brw_imm_ud(1<<20));
index 23e51ee9bcde8395b266ab46bfdb080670c859ff..5713f25da7ce6bcad69d83e12e789fad5331d1ef 100644 (file)
@@ -31,6 +31,7 @@
 
 
 #include "brw_defines.h"
+#include "brw_context.h"
 #include "brw_eu.h"
 #include "brw_clip.h"
 
@@ -126,6 +127,7 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
                             GLboolean force_edgeflag)
 {
    struct brw_compile *p = &c->func;
+   struct brw_context *brw = p->brw;
    struct brw_reg tmp = get_tmp(c);
    GLuint i;
 
@@ -142,7 +144,7 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
    for (i = 0; i < c->key.nr_attrs; i++) {
       GLuint delta = i*16 + 32;
 
-      if (c->chipset.is_igdng)
+      if (brw->gen == 5)
           delta = i * 16 + 32 * 3;
 
       if (delta == c->offset_edgeflag) {
@@ -176,7 +178,7 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
    if (i & 1) {
       GLuint delta = i*16 + 32;
 
-      if (c->chipset.is_igdng)
+      if (brw->gen == 5)
           delta = i * 16 + 32 * 3;
 
       brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(0));
@@ -350,7 +352,8 @@ void brw_clip_init_clipmask( struct brw_clip_compile *c )
 
 void brw_clip_ff_sync(struct brw_clip_compile *c)
 {
-    if (c->need_ff_sync) {
+    struct brw_context *brw = c->func.brw;
+    if (brw->needs_ff_sync) {
         struct brw_compile *p = &c->func;
         struct brw_instruction *need_ff_sync;
 
@@ -379,7 +382,8 @@ void brw_clip_ff_sync(struct brw_clip_compile *c)
 
 void brw_clip_init_ff_sync(struct brw_clip_compile *c)
 {
-    if (c->need_ff_sync) {
+    struct brw_context *brw = c->func.brw;
+    if (brw->needs_ff_sync) {
        struct brw_compile *p = &c->func;
         
         brw_MOV(p, c->reg.ff_sync, brw_imm_ud(0));
index 227bc790debbc6166c35ac175161e7d5611464a8..41a468a32f0945ae98737eb62cf30646706a2d67 100644 (file)
@@ -107,7 +107,7 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen,
                                        void *priv)
 {
    struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context);
-
+   struct brw_screen *brs = brw_screen(screen);
    if (!brw) {
       debug_printf("%s: failed to alloc context\n", __FUNCTION__);
       return NULL;
@@ -117,7 +117,10 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen,
    brw->base.priv = priv;
    brw->base.destroy = brw_destroy_context;
    brw->sws = brw_screen(screen)->sws;
-   brw->chipset = brw_screen(screen)->chipset;
+   brw->is_g4x = brs->is_g4x;
+   brw->needs_ff_sync = brs->needs_ff_sync;
+   brw->has_negative_rhw_bug = brs->has_negative_rhw_bug;
+   brw->gen = brs->gen;
 
    brw_init_resource_functions( brw );
    brw_pipe_blend_init( brw );
@@ -131,6 +134,7 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen,
    brw_pipe_shader_init( brw );
    brw_pipe_vertex_init( brw );
    brw_pipe_clear_init( brw );
+   brw_pipe_surface_init( brw );
 
    brw_hw_cc_init( brw );
 
@@ -144,7 +148,7 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen,
 
    make_empty_list(&brw->query.active_head);
 
-   brw->batch = brw_batchbuffer_alloc( brw->sws, brw->chipset );
+   brw->batch = brw_batchbuffer_alloc( brw->sws );
    if (brw->batch == NULL)
       goto fail;
 
index 56d351f97d1f867b54b3435c631a1fe5348fcaf4..45fc26dd7d885a733a7ef31dfe88930417baae57 100644 (file)
@@ -529,7 +529,14 @@ struct brw_query_object {
 struct brw_context 
 {
    struct pipe_context base;
-   struct brw_chipset chipset;
+   int gen;
+   boolean has_negative_rhw_bug;
+   boolean needs_ff_sync;
+   boolean is_g4x;
+
+   int urb_size;
+   int vs_max_threads;
+   int wm_max_threads;
 
    struct brw_winsys_screen *sws;
 
@@ -821,6 +828,7 @@ void brw_pipe_sampler_cleanup( struct brw_context *brw );
 void brw_pipe_shader_cleanup( struct brw_context *brw );
 void brw_pipe_vertex_cleanup( struct brw_context *brw );
 void brw_pipe_clear_cleanup( struct brw_context *brw );
+void brw_pipe_surface_init( struct brw_context *brw );
 
 void brw_hw_cc_init( struct brw_context *brw );
 void brw_hw_cc_cleanup( struct brw_context *brw );
@@ -853,11 +861,5 @@ brw_context( struct pipe_context *ctx )
    return (struct brw_context *)ctx;
 }
 
-
-#define BRW_IS_965(brw)    ((brw)->chipset.is_965)
-#define BRW_IS_IGDNG(brw)  ((brw)->chipset.is_igdng)
-#define BRW_IS_G4X(brw)    ((brw)->chipset.is_g4x)
-
-
 #endif
 
index e201ce4d7ceffe1914aa56db672197fd3b164713..7547eae97c763f5e04576b1f669c2a15b1e73e02 100644 (file)
 #define BRW_COMPRESSION_2NDHALF       1
 #define BRW_COMPRESSION_COMPRESSED    2
 
+#define GEN6_COMPRESSION_1Q            0
+#define GEN6_COMPRESSION_2Q            1
+#define GEN6_COMPRESSION_3Q            2
+#define GEN6_COMPRESSION_4Q            3
+#define GEN6_COMPRESSION_1H            0
+#define GEN6_COMPRESSION_2H            2
+
 #define BRW_CONDITIONAL_NONE  0
 #define BRW_CONDITIONAL_Z     1
 #define BRW_CONDITIONAL_NZ    2
 #define BRW_MASK_ENABLE   0
 #define BRW_MASK_DISABLE  1
 
+/** @{
+ *
+ * Gen6 has replaced "mask enable/disable" with WECtrl, which is
+ * effectively the same but much simpler to think about.  Now, there
+ * are two contributors ANDed together to whether channels are
+ * executed: The predication on the instruction, and the channel write
+ * enable.
+ */
+/**
+ * This is the default value.  It means that a channel's write enable is set
+ * if the per-channel IP is pointing at this instruction.
+ */
+#define BRW_WE_NORMAL          0
+/**
+ * This is used like BRW_MASK_DISABLE, and causes all channels to have
+ * their write enable set.  Note that predication still contributes to
+ * whether the channel actually gets written.
+ */
+#define BRW_WE_ALL             1
+/** @} */
+
 #define BRW_OPCODE_MOV        1
 #define BRW_OPCODE_SEL        2
 #define BRW_OPCODE_NOT        4
 #define BRW_OPCODE_POP        47
 #define BRW_OPCODE_WAIT       48
 #define BRW_OPCODE_SEND       49
+#define BRW_OPCODE_SENDC      50
+#define BRW_OPCODE_MATH       56
 #define BRW_OPCODE_ADD        64
 #define BRW_OPCODE_MUL        65
 #define BRW_OPCODE_AVG        66
 #define BRW_OPCODE_DP2        87
 #define BRW_OPCODE_DPA2       88
 #define BRW_OPCODE_LINE       89
+#define BRW_OPCODE_PLN        90
 #define BRW_OPCODE_NOP        126
 
 #define BRW_PREDICATE_NONE             0
 #define BRW_ARF_NOTIFICATION_COUNT    0x90
 #define BRW_ARF_IP                    0xA0
 
+#define BRW_MRF_COMPR4                 (1 << 7)
+
 #define BRW_AMASK   0
 #define BRW_IMASK   1
 #define BRW_LMASK   2
 #define BRW_POLYGON_FACING_BACK       1
 
 #define BRW_MESSAGE_TARGET_NULL               0
-#define BRW_MESSAGE_TARGET_MATH               1
+#define BRW_MESSAGE_TARGET_MATH               1 /* reserved on GEN6 */
 #define BRW_MESSAGE_TARGET_SAMPLER            2
 #define BRW_MESSAGE_TARGET_GATEWAY            3
-#define BRW_MESSAGE_TARGET_DATAPORT_READ      4
-#define BRW_MESSAGE_TARGET_DATAPORT_WRITE     5
+#define BRW_MESSAGE_TARGET_DATAPORT_READ      4 /* sampler cache on GEN6 */
+#define BRW_MESSAGE_TARGET_DATAPORT_WRITE     5 /* render cache on Gen6 */
 #define BRW_MESSAGE_TARGET_URB                6
 #define BRW_MESSAGE_TARGET_THREAD_SPAWNER     7
+#define BRW_MESSAGE_TARGET_CONST_CACHE       9 /* GEN6 */
 
 #define BRW_SAMPLER_RETURN_FORMAT_FLOAT32     0
 #define BRW_SAMPLER_RETURN_FORMAT_UINT32      2
 #define BRW_SAMPLER_MESSAGE_SIMD8_LD                  3
 #define BRW_SAMPLER_MESSAGE_SIMD16_LD                 3
 
-#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_IGDNG            0
-#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_IGDNG          0
-#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_IGDNG           0
-#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_IGDNG       1
-#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_BIAS_IGDNG     1
-#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS_IGDNG      1
-#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_LOD_IGDNG        2
-#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD_IGDNG      2
-#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD_IGDNG       2
-#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_COMPARE_IGDNG    3
-#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE_IGDNG  3
-#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE_IGDNG   3
-
-/* for IGDNG only */
+#define BRW_SAMPLER_MESSAGE_SAMPLE_GEN5            0
+#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5       1
+#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_GEN5        2
+#define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5    3
+#define BRW_SAMPLER_MESSAGE_SAMPLE_DERIVS_GEN5     4
+#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE_GEN5 5
+#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE_GEN5 6
+
+/* for GEN5 only */
 #define BRW_SAMPLER_SIMD_MODE_SIMD4X2                   0
 #define BRW_SAMPLER_SIMD_MODE_SIMD8                     1
 #define BRW_SAMPLER_SIMD_MODE_SIMD16                    2
 #define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS   2
 #define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_16DWORDS  3
 
+/* This one stays the same across generations. */
 #define BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ          0
+/* GEN4 */
 #define BRW_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ     1
-#define BRW_DATAPORT_READ_MESSAGE_DWORD_BLOCK_READ          2
+#define BRW_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ          2
 #define BRW_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ      3
+/* G45, GEN5 */
+#define G45_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ        1
+#define G45_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ     2
+#define G45_DATAPORT_READ_MESSAGE_AVC_LOOP_FILTER_READ     3
+#define G45_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ          4
+#define G45_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ      6
+/* GEN6 */
+#define GEN6_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ       1
+#define GEN6_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ     2
+#define GEN6_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ          4
+#define GEN6_DATAPORT_READ_MESSAGE_OWORD_UNALIGN_BLOCK_READ  5
+#define GEN6_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ      6
 
 #define BRW_DATAPORT_READ_TARGET_DATA_CACHE      0
 #define BRW_DATAPORT_READ_TARGET_RENDER_CACHE    1
 #define BRW_DATAPORT_WRITE_MESSAGE_STREAMED_VERTEX_BUFFER_WRITE     5
 #define BRW_DATAPORT_WRITE_MESSAGE_FLUSH_RENDER_CACHE               7
 
+/* GEN6 */
+#define BRW_DATAPORT_WRITE_MESSAGE_DWORD_ATOMIC_WRITE_GEN6             7
+#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE_GEN6              8
+#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE_GEN6         9
+#define BRW_DATAPORT_WRITE_MESSAGE_MEDIA_BLOCK_WRITE_GEN6              10
+#define BRW_DATAPORT_WRITE_MESSAGE_DWORLD_SCATTERED_WRITE_GEN6         11
+#define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE_GEN6            12
+#define BRW_DATAPORT_WRITE_MESSAGE_STREAMED_VB_WRITE_GEN6              13
+#define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_UNORM_WRITE_GEN6      14
+
 #define BRW_MATH_FUNCTION_INV                              1
 #define BRW_MATH_FUNCTION_LOG                              2
 #define BRW_MATH_FUNCTION_EXP                              3
 #define BRW_MATH_FUNCTION_SIN                              6 /* was 7 */
 #define BRW_MATH_FUNCTION_COS                              7 /* was 8 */
 #define BRW_MATH_FUNCTION_SINCOS                           8 /* was 6 */
-#define BRW_MATH_FUNCTION_TAN                              9
+#define BRW_MATH_FUNCTION_TAN                              9 /* gen4 */
+#define BRW_MATH_FUNCTION_FDIV                             9 /* gen6+ */
 #define BRW_MATH_FUNCTION_POW                              10
 #define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER   11
 #define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT                 12
 
 #define CMD_PIPELINED_STATE_POINTERS  0x7800
 #define CMD_BINDING_TABLE_PTRS        0x7801
+# define GEN6_BINDING_TABLE_MODIFY_VS  (1 << 8)
+# define GEN6_BINDING_TABLE_MODIFY_GS  (1 << 9)
+# define GEN6_BINDING_TABLE_MODIFY_PS  (1 << 12)
+
+#define CMD_3D_SAMPLER_STATE_POINTERS                  0x7802 /* SNB+ */
+# define PS_SAMPLER_STATE_CHANGE                               (1 << 12)
+# define GS_SAMPLER_STATE_CHANGE                               (1 << 9)
+# define VS_SAMPLER_STATE_CHANGE                               (1 << 8)
+/* DW1: VS */
+/* DW2: GS */
+/* DW3: PS */
 
 #define CMD_VERTEX_BUFFER             0x7808
 # define BRW_VB0_INDEX_SHIFT           27
+# define GEN6_VB0_INDEX_SHIFT          26
 # define BRW_VB0_ACCESS_VERTEXDATA     (0 << 26)
 # define BRW_VB0_ACCESS_INSTANCEDATA   (1 << 26)
+# define GEN6_VB0_ACCESS_VERTEXDATA    (0 << 20)
+# define GEN6_VB0_ACCESS_INSTANCEDATA  (1 << 20)
 # define BRW_VB0_PITCH_SHIFT           0
 
 #define CMD_VERTEX_ELEMENT            0x7809
 # define BRW_VE0_INDEX_SHIFT           27
+# define GEN6_VE0_INDEX_SHIFT          26
 # define BRW_VE0_FORMAT_SHIFT          16
 # define BRW_VE0_VALID                 (1 << 26)
+# define GEN6_VE0_VALID                        (1 << 25)
 # define BRW_VE0_SRC_OFFSET_SHIFT      0
 # define BRW_VE1_COMPONENT_NOSTORE     0
 # define BRW_VE1_COMPONENT_STORE_SRC   1
 #define CMD_INDEX_BUFFER              0x780a
 #define CMD_VF_STATISTICS_965         0x780b
 #define CMD_VF_STATISTICS_GM45        0x680b
+#define CMD_3D_CC_STATE_POINTERS      0x780e /* GEN6+ */
+
+#define CMD_URB                                        0x7805 /* GEN6+ */
+# define GEN6_URB_VS_SIZE_SHIFT                                16
+# define GEN6_URB_VS_ENTRIES_SHIFT                     0
+# define GEN6_URB_GS_ENTRIES_SHIFT                     8
+# define GEN6_URB_GS_SIZE_SHIFT                                0
+
+#define CMD_VIEWPORT_STATE_POINTERS                    0x780d /* GEN6+ */
+# define GEN6_CC_VIEWPORT_MODIFY                       (1 << 12)
+# define GEN6_SF_VIEWPORT_MODIFY                       (1 << 11)
+# define GEN6_CLIP_VIEWPORT_MODIFY                     (1 << 10)
+
+#define CMD_3D_SCISSOR_STATE_POINTERS          0x780f /* GEN6+ */
+
+#define CMD_3D_VS_STATE                      0x7810 /* GEN6+ */
+/* DW2 */
+# define GEN6_VS_SPF_MODE                              (1 << 31)
+# define GEN6_VS_VECTOR_MASK_ENABLE                    (1 << 30)
+# define GEN6_VS_SAMPLER_COUNT_SHIFT                   27
+# define GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT       18
+# define GEN6_VS_FLOATING_POINT_MODE_IEEE_754          (0 << 16)
+# define GEN6_VS_FLOATING_POINT_MODE_ALT               (1 << 16)
+/* DW4 */
+# define GEN6_VS_DISPATCH_START_GRF_SHIFT              20
+# define GEN6_VS_URB_READ_LENGTH_SHIFT                 11
+# define GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT           4
+/* DW5 */
+# define GEN6_VS_MAX_THREADS_SHIFT                     25
+# define GEN6_VS_STATISTICS_ENABLE                     (1 << 10)
+# define GEN6_VS_CACHE_DISABLE                         (1 << 1)
+# define GEN6_VS_ENABLE                                        (1 << 0)
+
+#define CMD_3D_GS_STATE                      0x7811 /* GEN6+ */
+/* DW2 */
+# define GEN6_GS_SPF_MODE                              (1 << 31)
+# define GEN6_GS_VECTOR_MASK_ENABLE                    (1 << 30)
+# define GEN6_GS_SAMPLER_COUNT_SHIFT                   27
+# define GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT       18
+/* DW4 */
+# define GEN6_GS_URB_READ_LENGTH_SHIFT                 11
+# define GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT           4
+# define GEN6_GS_DISPATCH_START_GRF_SHIFT              0
+/* DW5 */
+# define GEN6_GS_MAX_THREADS_SHIFT                     25
+# define GEN6_GS_STATISTICS_ENABLE                     (1 << 10)
+# define GEN6_GS_SO_STATISTICS_ENABLE                  (1 << 9)
+# define GEN6_GS_RENDERING_ENABLE                      (1 << 8)
+/* DW6 */
+# define GEN6_GS_ENABLE                                        (1 << 15)
+
+#define CMD_3D_CLIP_STATE                    0x7812 /* GEN6+ */
+/* DW1 */
+# define GEN6_CLIP_STATISTICS_ENABLE                   (1 << 10)
+/**
+ * Just does cheap culling based on the clip distance.  Bits must be
+ * disjoint with USER_CLIP_CLIP_DISTANCE bits.
+ */
+# define GEN6_USER_CLIP_CULL_DISTANCES_SHIFT           0
+/* DW2 */
+# define GEN6_CLIP_ENABLE                              (1 << 31)
+# define GEN6_CLIP_API_OGL                             (0 << 30)
+# define GEN6_CLIP_API_D3D                             (1 << 30)
+# define GEN6_CLIP_XY_TEST                             (1 << 28)
+# define GEN6_CLIP_Z_TEST                              (1 << 27)
+# define GEN6_CLIP_GB_TEST                             (1 << 26)
+/** 8-bit field of which user clip distances to clip aganist. */
+# define GEN6_USER_CLIP_CLIP_DISTANCES_SHIFT           16
+# define GEN6_CLIP_MODE_NORMAL                         (0 << 13)
+# define GEN6_CLIP_MODE_REJECT_ALL                     (3 << 13)
+# define GEN6_CLIP_MODE_ACCEPT_ALL                     (4 << 13)
+# define GEN6_CLIP_PERSPECTIVE_DIVIDE_DISABLE          (1 << 9)
+# define GEN6_CLIP_BARYCENTRIC_ENABLE                  (1 << 8)
+# define GEN6_CLIP_TRI_PROVOKE_SHIFT                   4
+# define GEN6_CLIP_LINE_PROVOKE_SHIFT                  2
+# define GEN6_CLIP_TRIFAN_PROVOKE_SHIFT                        0
+/* DW3 */
+# define GEN6_CLIP_MIN_POINT_WIDTH_SHIFT               17
+# define GEN6_CLIP_MAX_POINT_WIDTH_SHIFT               6
+# define GEN6_CLIP_FORCE_ZERO_RTAINDEX                 (1 << 5)
+
+#define CMD_3D_SF_STATE                                0x7813 /* GEN6+ */
+/* DW1 */
+# define GEN6_SF_NUM_OUTPUTS_SHIFT                     22
+# define GEN6_SF_SWIZZLE_ENABLE                                (1 << 21)
+# define GEN6_SF_POINT_SPRITE_LOWERLEFT                        (1 << 20)
+# define GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT           11
+# define GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT           4
+/* DW2 */
+# define GEN6_SF_LEGACY_GLOBAL_DEPTH_BIAS              (1 << 11)
+# define GEN6_SF_STATISTICS_ENABLE                     (1 << 10)
+# define GEN6_SF_GLOBAL_DEPTH_OFFSET_SOLID             (1 << 9)
+# define GEN6_SF_GLOBAL_DEPTH_OFFSET_WIREFRAME         (1 << 8)
+# define GEN6_SF_GLOBAL_DEPTH_OFFSET_POINT             (1 << 7)
+# define GEN6_SF_FRONT_SOLID                           (0 << 5)
+# define GEN6_SF_FRONT_WIREFRAME                       (1 << 5)
+# define GEN6_SF_FRONT_POINT                           (2 << 5)
+# define GEN6_SF_BACK_SOLID                            (0 << 3)
+# define GEN6_SF_BACK_WIREFRAME                                (1 << 3)
+# define GEN6_SF_BACK_POINT                            (2 << 3)
+# define GEN6_SF_VIEWPORT_TRANSFORM_ENABLE             (1 << 1)
+# define GEN6_SF_WINDING_CCW                           (1 << 0)
+/* DW3 */
+# define GEN6_SF_LINE_AA_ENABLE                                (1 << 31)
+# define GEN6_SF_CULL_BOTH                             (0 << 29)
+# define GEN6_SF_CULL_NONE                             (1 << 29)
+# define GEN6_SF_CULL_FRONT                            (2 << 29)
+# define GEN6_SF_CULL_BACK                             (3 << 29)
+# define GEN6_SF_LINE_WIDTH_SHIFT                      18 /* U3.7 */
+# define GEN6_SF_LINE_END_CAP_WIDTH_0_5                        (0 << 16)
+# define GEN6_SF_LINE_END_CAP_WIDTH_1_0                        (1 << 16)
+# define GEN6_SF_LINE_END_CAP_WIDTH_2_0                        (2 << 16)
+# define GEN6_SF_LINE_END_CAP_WIDTH_4_0                        (3 << 16)
+# define GEN6_SF_SCISSOR_ENABLE                                (1 << 11)
+# define GEN6_SF_MSRAST_OFF_PIXEL                      (0 << 8)
+# define GEN6_SF_MSRAST_OFF_PATTERN                    (1 << 8)
+# define GEN6_SF_MSRAST_ON_PIXEL                       (2 << 8)
+# define GEN6_SF_MSRAST_ON_PATTERN                     (3 << 8)
+/* DW4 */
+# define GEN6_SF_TRI_PROVOKE_SHIFT                     29
+# define GEN6_SF_LINE_PROVOKE_SHIFT                    27
+# define GEN6_SF_TRIFAN_PROVOKE_SHIFT                  25
+# define GEN6_SF_LINE_AA_MODE_MANHATTAN                        (0 << 14)
+# define GEN6_SF_LINE_AA_MODE_TRUE                     (1 << 14)
+# define GEN6_SF_VERTEX_SUBPIXEL_8BITS                 (0 << 12)
+# define GEN6_SF_VERTEX_SUBPIXEL_4BITS                 (1 << 12)
+# define GEN6_SF_USE_STATE_POINT_WIDTH                 (1 << 11)
+# define GEN6_SF_POINT_WIDTH_SHIFT                     0 /* U8.3 */
+/* DW5: depth offset constant */
+/* DW6: depth offset scale */
+/* DW7: depth offset clamp */
+/* DW8 */
+# define ATTRIBUTE_1_OVERRIDE_W                                (1 << 31)
+# define ATTRIBUTE_1_OVERRIDE_Z                                (1 << 30)
+# define ATTRIBUTE_1_OVERRIDE_Y                                (1 << 29)
+# define ATTRIBUTE_1_OVERRIDE_X                                (1 << 28)
+# define ATTRIBUTE_1_CONST_SOURCE_SHIFT                        25
+# define ATTRIBUTE_1_SWIZZLE_SHIFT                     22
+# define ATTRIBUTE_1_SOURCE_SHIFT                      16
+# define ATTRIBUTE_0_OVERRIDE_W                                (1 << 15)
+# define ATTRIBUTE_0_OVERRIDE_Z                                (1 << 14)
+# define ATTRIBUTE_0_OVERRIDE_Y                                (1 << 13)
+# define ATTRIBUTE_0_OVERRIDE_X                                (1 << 12)
+# define ATTRIBUTE_0_CONST_SOURCE_SHIFT                        9
+# define ATTRIBUTE_0_SWIZZLE_SHIFT                     6
+# define ATTRIBUTE_0_SOURCE_SHIFT                      0
+
+# define ATTRIBUTE_SWIZZLE_INPUTATTR                    0
+# define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING             1
+# define ATTRIBUTE_SWIZZLE_INPUTATTR_W                  2
+# define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING_W           3
+# define ATTRIBUTE_SWIZZLE_SHIFT                        6
+
+/* DW16: Point sprite texture coordinate enables */
+/* DW17: Constant interpolation enables */
+/* DW18: attr 0-7 wrap shortest enables */
+/* DW19: attr 8-16 wrap shortest enables */
+
+#define CMD_3D_WM_STATE                      0x7814 /* GEN6+ */
+/* DW1: kernel pointer */
+/* DW2 */
+# define GEN6_WM_SPF_MODE                              (1 << 31)
+# define GEN6_WM_VECTOR_MASK_ENABLE                    (1 << 30)
+# define GEN6_WM_SAMPLER_COUNT_SHIFT                   27
+# define GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT       18
+# define GEN6_WM_FLOATING_POINT_MODE_IEEE_754          (0 << 16)
+# define GEN6_WM_FLOATING_POINT_MODE_ALT               (1 << 16)
+/* DW3: scratch space */
+/* DW4 */
+# define GEN6_WM_STATISTICS_ENABLE                     (1 << 31)
+# define GEN6_WM_DEPTH_CLEAR                           (1 << 30)
+# define GEN6_WM_DEPTH_RESOLVE                         (1 << 28)
+# define GEN6_WM_HIERARCHICAL_DEPTH_RESOLVE            (1 << 27)
+# define GEN6_WM_DISPATCH_START_GRF_SHIFT_0            16
+# define GEN6_WM_DISPATCH_START_GRF_SHIFT_1            8
+# define GEN6_WM_DISPATCH_START_GRF_SHIFT_2            0
+/* DW5 */
+# define GEN6_WM_MAX_THREADS_SHIFT                     25
+# define GEN6_WM_KILL_ENABLE                           (1 << 22)
+# define GEN6_WM_COMPUTED_DEPTH                                (1 << 21)
+# define GEN6_WM_USES_SOURCE_DEPTH                     (1 << 20)
+# define GEN6_WM_DISPATCH_ENABLE                       (1 << 19)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5             (0 << 16)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0             (1 << 16)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_2_0             (2 << 16)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_4_0             (3 << 16)
+# define GEN6_WM_LINE_AA_WIDTH_0_5                     (0 << 14)
+# define GEN6_WM_LINE_AA_WIDTH_1_0                     (1 << 14)
+# define GEN6_WM_LINE_AA_WIDTH_2_0                     (2 << 14)
+# define GEN6_WM_LINE_AA_WIDTH_4_0                     (3 << 14)
+# define GEN6_WM_POLYGON_STIPPLE_ENABLE                        (1 << 13)
+# define GEN6_WM_LINE_STIPPLE_ENABLE                   (1 << 11)
+# define GEN6_WM_OMASK_TO_RENDER_TARGET                        (1 << 9)
+# define GEN6_WM_USES_SOURCE_W                         (1 << 8)
+# define GEN6_WM_DUAL_SOURCE_BLEND_ENABLE              (1 << 7)
+# define GEN6_WM_32_DISPATCH_ENABLE                    (1 << 2)
+# define GEN6_WM_16_DISPATCH_ENABLE                    (1 << 1)
+# define GEN6_WM_8_DISPATCH_ENABLE                     (1 << 0)
+/* DW6 */
+# define GEN6_WM_NUM_SF_OUTPUTS_SHIFT                  20
+# define GEN6_WM_POSOFFSET_NONE                                (0 << 18)
+# define GEN6_WM_POSOFFSET_CENTROID                    (2 << 18)
+# define GEN6_WM_POSOFFSET_SAMPLE                      (3 << 18)
+# define GEN6_WM_POSITION_ZW_PIXEL                     (0 << 16)
+# define GEN6_WM_POSITION_ZW_CENTROID                  (2 << 16)
+# define GEN6_WM_POSITION_ZW_SAMPLE                    (3 << 16)
+# define GEN6_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC     (1 << 15)
+# define GEN6_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC   (1 << 14)
+# define GEN6_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC      (1 << 13)
+# define GEN6_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC                (1 << 12)
+# define GEN6_WM_PERSPECTIVE_CENTROID_BARYCENTRIC      (1 << 11)
+# define GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC         (1 << 10)
+# define GEN6_WM_POINT_RASTRULE_UPPER_RIGHT            (1 << 9)
+# define GEN6_WM_MSRAST_OFF_PIXEL                      (0 << 1)
+# define GEN6_WM_MSRAST_OFF_PATTERN                    (1 << 1)
+# define GEN6_WM_MSRAST_ON_PIXEL                       (2 << 1)
+# define GEN6_WM_MSRAST_ON_PATTERN                     (3 << 1)
+# define GEN6_WM_MSDISPMODE_PERPIXEL                   (1 << 0)
+/* DW7: kernel 1 pointer */
+/* DW8: kernel 2 pointer */
+
+#define CMD_3D_CONSTANT_VS_STATE             0x7815 /* GEN6+ */
+#define CMD_3D_CONSTANT_GS_STATE             0x7816 /* GEN6+ */
+#define CMD_3D_CONSTANT_PS_STATE             0x7817 /* GEN6+ */
+# define GEN6_CONSTANT_BUFFER_3_ENABLE                 (1 << 15)
+# define GEN6_CONSTANT_BUFFER_2_ENABLE                 (1 << 14)
+# define GEN6_CONSTANT_BUFFER_1_ENABLE                 (1 << 13)
+# define GEN6_CONSTANT_BUFFER_0_ENABLE                 (1 << 12)
+
+#define CMD_3D_SAMPLE_MASK                     0x7818 /* GEN6+ */
 
 #define CMD_DRAW_RECT                 0x7900
 #define CMD_BLEND_CONSTANT_COLOR      0x7901
 #define CMD_GLOBAL_DEPTH_OFFSET_CLAMP 0x7909
 #define CMD_AA_LINE_PARAMETERS        0x790a
 
+#define CMD_GS_SVB_INDEX                       0x790b /* CTG+ */
+/* DW1 */
+# define SVB_INDEX_SHIFT                               29
+# define SVB_LOAD_INTERNAL_VERTEX_COUNT                        (1 << 0) /* SNB+ */
+/* DW2: SVB index */
+/* DW3: SVB maximum index */
+
+#define CMD_3D_MULTISAMPLE                     0x790d /* SNB+ */
+/* DW1 */
+# define MS_PIXEL_LOCATION_CENTER                      (0 << 4)
+# define MS_PIXEL_LOCATION_UPPER_LEFT                  (1 << 4)
+# define MS_NUMSAMPLES_1                               (0 << 1)
+# define MS_NUMSAMPLES_4                               (2 << 1)
+# define MS_NUMSAMPLES_8                               (3 << 1)
+
+#define CMD_3D_CLEAR_PARAMS                    0x7910 /* ILK+ */
+# define DEPTH_CLEAR_VALID                             (1 << 15)
+/* DW1: depth clear value */
+
 #define CMD_PIPE_CONTROL              0x7a00
 
 #define CMD_3D_PRIM                   0x7b00
 #define R02_PRIM_END    0x1
 #define R02_PRIM_START  0x2
 
-#define URB_SIZES(brw)                  (BRW_IS_IGDNG(brw) ? 1024 : \
-                                         (BRW_IS_G4X(brw) ? 384 : 256))  /* 512 bit units */
+#define URB_SIZES(brw)                  (brw->gen == 5 ? 1024 : \
+                                         (brw->is_g4x ? 384 : 256))  /* 512 bit units */
 
 
 
index 28c83515ba9c926cb3ae3c2361fa076dbb6a4df9..b093569f0cf4aa6c568b5be23edb0e3d5b0eb1d6 100644 (file)
@@ -49,12 +49,14 @@ struct {
     [BRW_OPCODE_MAC] = { .name = "mac", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_MACH] = { .name = "mach", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_LINE] = { .name = "line", .nsrc = 2, .ndst = 1 },
+    [BRW_OPCODE_PLN] = { .name = "pln", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_SAD2] = { .name = "sad2", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_SADA2] = { .name = "sada2", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_DP4] = { .name = "dp4", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_DPH] = { .name = "dph", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_DP3] = { .name = "dp3", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_DP2] = { .name = "dp2", .nsrc = 2, .ndst = 1 },
+    [BRW_OPCODE_MATH] = { .name = "math", .nsrc = 2, .ndst = 1 },
 
     [BRW_OPCODE_AVG] = { .name = "avg", .nsrc = 2, .ndst = 1 },
     [BRW_OPCODE_ADD] = { .name = "add", .nsrc = 2, .ndst = 1 },
@@ -69,13 +71,14 @@ struct {
     [BRW_OPCODE_CMPN] = { .name = "cmpn", .nsrc = 2, .ndst = 1 },
 
     [BRW_OPCODE_SEND] = { .name = "send", .nsrc = 1, .ndst = 1 },
+    [BRW_OPCODE_SENDC] = { .name = "sendc", .nsrc = 1, .ndst = 1 },
     [BRW_OPCODE_NOP] = { .name = "nop", .nsrc = 0, .ndst = 0 },
     [BRW_OPCODE_JMPI] = { .name = "jmpi", .nsrc = 1, .ndst = 0 },
     [BRW_OPCODE_IF] = { .name = "if", .nsrc = 2, .ndst = 0 },
-    [BRW_OPCODE_IFF] = { .name = "iff", .nsrc = 1, .ndst = 01 },
-    [BRW_OPCODE_WHILE] = { .name = "while", .nsrc = 1, .ndst = 0 },
+    [BRW_OPCODE_IFF] = { .name = "iff", .nsrc = 2, .ndst = 1 },
+    [BRW_OPCODE_WHILE] = { .name = "while", .nsrc = 2, .ndst = 0 },
     [BRW_OPCODE_ELSE] = { .name = "else", .nsrc = 2, .ndst = 0 },
-    [BRW_OPCODE_BREAK] = { .name = "break", .nsrc = 1, .ndst = 0 },
+    [BRW_OPCODE_BREAK] = { .name = "break", .nsrc = 2, .ndst = 0 },
     [BRW_OPCODE_CONTINUE] = { .name = "cont", .nsrc = 1, .ndst = 0 },
     [BRW_OPCODE_HALT] = { .name = "halt", .nsrc = 1, .ndst = 0 },
     [BRW_OPCODE_MSAVE] = { .name = "msave", .nsrc = 1, .ndst = 1 },
@@ -144,7 +147,6 @@ char *chan_sel[4] = {
 };
 
 char *dest_condmod[16] = {
-   [0] = NULL
 };
 
 char *debug_ctrl[2] = {
@@ -157,6 +159,16 @@ char *saturate[2] = {
     [1] = ".sat"
 };
 
+char *accwr[2] = {
+    [0] = "",
+    [1] = "AccWrEnable"
+};
+
+char *wectrl[2] = {
+    [0] = "WE_normal",
+    [1] = "WE_all"
+};
+
 char *exec_size[8] = {
     [0] = "1",
     [1] = "2",
@@ -204,6 +216,7 @@ char *compr_ctrl[4] = {
     [0] = "",
     [1] = "sechalf",
     [2] = "compr",
+    [3] = "compr4",
 };
 
 char *dep_ctrl[4] = {
@@ -233,6 +246,16 @@ char *reg_encoding[8] = {
     [7] = "F"
 };
 
+int reg_type_size[8] = {
+    [0] = 4,
+    [1] = 4,
+    [2] = 2,
+    [3] = 2,
+    [4] = 1,
+    [5] = 1,
+    [7] = 4
+};
+
 char *imm_encoding[8] = {
     [0] = "UD",
     [1] = "D",
@@ -321,6 +344,11 @@ char *math_precision[2] = {
     [1] = "partial_precision"
 };
 
+char *urb_opcode[2] = {
+    [0] = "urb_write",
+    [1] = "ff_sync",
+};
+
 char *urb_swizzle[4] = {
     [BRW_URB_SWIZZLE_NONE] = "",
     [BRW_URB_SWIZZLE_INTERLEAVE] = "interleave",
@@ -416,6 +444,11 @@ static int print_opcode (FILE *file, int id)
 static int reg (FILE *file, GLuint _reg_file, GLuint _reg_nr)
 {
     int        err = 0;
+
+    /* Clear the Compr4 instruction compression bit. */
+    if (_reg_file == BRW_MESSAGE_REGISTER_FILE)
+       _reg_nr &= ~(1 << 7);
+
     if (_reg_file == BRW_ARCHITECTURE_REGISTER_FILE) {
        switch (_reg_nr & 0xf0) {
        case BRW_ARF_NULL:
@@ -427,6 +460,9 @@ static int reg (FILE *file, GLuint _reg_file, GLuint _reg_nr)
        case BRW_ARF_ACCUMULATOR:
            format (file, "acc%d", _reg_nr & 0x0f);
            break;
+       case BRW_ARF_FLAG:
+           format (file, "f%d", _reg_nr & 0x0f);
+           break;
        case BRW_ARF_MASK:
            format (file, "mask%d", _reg_nr & 0x0f);
            break;
@@ -457,7 +493,7 @@ static int reg (FILE *file, GLuint _reg_file, GLuint _reg_nr)
     return err;
 }
 
-static int dest (FILE *file, const struct brw_instruction *inst)
+static int dest (FILE *file, struct brw_instruction *inst)
 {
     int        err = 0;
 
@@ -469,7 +505,8 @@ static int dest (FILE *file, const struct brw_instruction *inst)
            if (err == -1)
                return 0;
            if (inst->bits1.da1.dest_subreg_nr)
-               format (file, ".%d", inst->bits1.da1.dest_subreg_nr);
+               format (file, ".%d", inst->bits1.da1.dest_subreg_nr /
+                                    reg_type_size[inst->bits1.da1.dest_reg_type]);
            format (file, "<%d>", inst->bits1.da1.dest_horiz_stride);
            err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.da1.dest_reg_type, NULL);
        }
@@ -477,7 +514,8 @@ static int dest (FILE *file, const struct brw_instruction *inst)
        {
            string (file, "g[a0");
            if (inst->bits1.ia1.dest_subreg_nr)
-               format (file, ".%d", inst->bits1.ia1.dest_subreg_nr);
+               format (file, ".%d", inst->bits1.ia1.dest_subreg_nr /
+                                       reg_type_size[inst->bits1.ia1.dest_reg_type]);
            if (inst->bits1.ia1.dest_indirect_offset)
                format (file, " %d", inst->bits1.ia1.dest_indirect_offset);
            string (file, "]");
@@ -493,7 +531,8 @@ static int dest (FILE *file, const struct brw_instruction *inst)
            if (err == -1)
                return 0;
            if (inst->bits1.da16.dest_subreg_nr)
-               format (file, ".%d", inst->bits1.da16.dest_subreg_nr);
+               format (file, ".%d", inst->bits1.da16.dest_subreg_nr /
+                                    reg_type_size[inst->bits1.da16.dest_reg_type]);
            string (file, "<1>");
            err |= control (file, "writemask", writemask, inst->bits1.da16.dest_writemask, NULL);
            err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.da16.dest_reg_type, NULL);
@@ -534,7 +573,7 @@ static int src_da1 (FILE *file, GLuint type, GLuint _reg_file,
     if (err == -1)
        return 0;
     if (sub_reg_num)
-       format (file, ".%d", sub_reg_num);
+       format (file, ".%d", sub_reg_num / reg_type_size[type]); /* use formal style like spec */
     src_align1_region (file, _vert_stride, _width, _horiz_stride);
     err |= control (file, "src reg encoding", reg_encoding, type, NULL);
     return err;
@@ -588,11 +627,12 @@ static int src_da16 (FILE *file,
     if (err == -1)
        return 0;
     if (_subreg_nr)
-       format (file, ".%d", _subreg_nr);
+       /* bit4 for subreg number byte addressing. Make this same meaning as
+          in da1 case, so output looks consistent. */
+       format (file, ".%d", 16 / reg_type_size[_reg_type]);
     string (file, "<");
     err |= control (file, "vert stride", vert_stride, _vert_stride, NULL);
-    string (file, ",1,1>");
-    err |= control (file, "src da16 reg type", reg_encoding, _reg_type, NULL);
+    string (file, ",4,1>");
     /*
      * Three kinds of swizzle display:
      *  identity - nothing printed
@@ -619,11 +659,12 @@ static int src_da16 (FILE *file,
        err |= control (file, "channel select", chan_sel, swz_z, NULL);
        err |= control (file, "channel select", chan_sel, swz_w, NULL);
     }
+    err |= control (file, "src da16 reg type", reg_encoding, _reg_type, NULL);
     return err;
 }
 
 
-static int imm (FILE *file, GLuint type, const struct brw_instruction *inst) {
+static int imm (FILE *file, GLuint type, struct brw_instruction *inst) {
     switch (type) {
     case BRW_REGISTER_TYPE_UD:
        format (file, "0x%08xUD", inst->bits3.ud);
@@ -652,7 +693,7 @@ static int imm (FILE *file, GLuint type, const struct brw_instruction *inst) {
     return 0;
 }
 
-static int src0 (FILE *file, const struct brw_instruction *inst)
+static int src0 (FILE *file, struct brw_instruction *inst)
 {
     if (inst->bits1.da1.src0_reg_file == BRW_IMMEDIATE_VALUE)
        return imm (file, inst->bits1.da1.src0_reg_type,
@@ -712,7 +753,7 @@ static int src0 (FILE *file, const struct brw_instruction *inst)
     }
 }
 
-static int src1 (FILE *file, const struct brw_instruction *inst)
+static int src1 (FILE *file, struct brw_instruction *inst)
 {
     if (inst->bits1.da1.src1_reg_file == BRW_IMMEDIATE_VALUE)
        return imm (file, inst->bits1.da1.src1_reg_type,
@@ -772,7 +813,7 @@ static int src1 (FILE *file, const struct brw_instruction *inst)
     }
 }
 
-int brw_disasm_insn (FILE *file, const struct brw_instruction *inst)
+int brw_disasm_insn (FILE *file, struct brw_instruction *inst, int gen)
 {
     int        err = 0;
     int space = 0;
@@ -822,7 +863,8 @@ int brw_disasm_insn (FILE *file, const struct brw_instruction *inst)
        err |= src1 (file, inst);
     }
 
-    if (inst->header.opcode == BRW_OPCODE_SEND) {
+    if (inst->header.opcode == BRW_OPCODE_SEND ||
+        inst->header.opcode == BRW_OPCODE_SENDC) {
        newline (file);
        pad (file, 16);
        space = 0;
@@ -842,24 +884,70 @@ int brw_disasm_insn (FILE *file, const struct brw_instruction *inst)
                            inst->bits3.math.precision, &space);
            break;
        case BRW_MESSAGE_TARGET_SAMPLER:
-           format (file, " (%d, %d, ",
-                   inst->bits3.sampler.binding_table_index,
-                   inst->bits3.sampler.sampler);
-           err |= control (file, "sampler target format", sampler_target_format,
-                           inst->bits3.sampler.return_format, NULL);
-           string (file, ")");
+           if (gen >= 5) {
+               format (file, " (%d, %d, %d, %d)",
+                       inst->bits3.sampler_gen5.binding_table_index,
+                       inst->bits3.sampler_gen5.sampler,
+                       inst->bits3.sampler_gen5.msg_type,
+                       inst->bits3.sampler_gen5.simd_mode);
+           } else if (0 /* FINISHME: is_g4x */) {
+             format (file, " (%d, %d)",
+                       inst->bits3.sampler_g4x.binding_table_index,
+                       inst->bits3.sampler_g4x.sampler);
+           } else {
+               format (file, " (%d, %d, ",
+                       inst->bits3.sampler.binding_table_index,
+                       inst->bits3.sampler.sampler);
+               err |= control (file, "sampler target format", sampler_target_format,
+                               inst->bits3.sampler.return_format, NULL);
+               string (file, ")");
+           }
+           break;
+       case BRW_MESSAGE_TARGET_DATAPORT_READ:
+           if (gen >= 6) {
+               format (file, " (%d, %d, %d, %d, %d, %d)",
+                       inst->bits3.dp_render_cache.binding_table_index,
+                       inst->bits3.dp_render_cache.msg_control,
+                       inst->bits3.dp_render_cache.msg_type,
+                       inst->bits3.dp_render_cache.send_commit_msg,
+                       inst->bits3.dp_render_cache.msg_length,
+                       inst->bits3.dp_render_cache.response_length);
+           } else if (gen >= 5 /* FINISHME: || is_g4x */) {
+               format (file, " (%d, %d, %d)",
+                       inst->bits3.dp_read_gen5.binding_table_index,
+                       inst->bits3.dp_read_gen5.msg_control,
+                       inst->bits3.dp_read_gen5.msg_type);
+           } else {
+               format (file, " (%d, %d, %d)",
+                       inst->bits3.dp_read.binding_table_index,
+                       inst->bits3.dp_read.msg_control,
+                       inst->bits3.dp_read.msg_type);
+           }
            break;
        case BRW_MESSAGE_TARGET_DATAPORT_WRITE:
-           format (file, " (%d, %d, %d, %d)",
-                   inst->bits3.dp_write.binding_table_index,
-                   (inst->bits3.dp_write.pixel_scoreboard_clear << 3) |
-                   inst->bits3.dp_write.msg_control,
-                   inst->bits3.dp_write.msg_type,
-                   inst->bits3.dp_write.send_commit_msg);
+           if (gen >= 6) {
+               format (file, " (%d, %d, %d, %d, %d, %d)",
+                       inst->bits3.dp_render_cache.binding_table_index,
+                       inst->bits3.dp_render_cache.msg_control,
+                       inst->bits3.dp_render_cache.msg_type,
+                       inst->bits3.dp_render_cache.send_commit_msg,
+                       inst->bits3.dp_render_cache.msg_length,
+                       inst->bits3.dp_render_cache.response_length);
+           } else {
+               format (file, " (%d, %d, %d, %d)",
+                       inst->bits3.dp_write.binding_table_index,
+                       (inst->bits3.dp_write.pixel_scoreboard_clear << 3) |
+                       inst->bits3.dp_write.msg_control,
+                       inst->bits3.dp_write.msg_type,
+                       inst->bits3.dp_write.send_commit_msg);
+           }
            break;
        case BRW_MESSAGE_TARGET_URB:
-           format (file, " %d", inst->bits3.urb.offset);
-           space = 1;
+           if (gen >= 5) {
+               format (file, " %d", inst->bits3.urb_gen5.offset);
+           } else {
+               format (file, " %d", inst->bits3.urb.offset);
+           }
            err |= control (file, "urb swizzle", urb_swizzle,
                            inst->bits3.urb.swizzle_control, &space);
            err |= control (file, "urb allocate", urb_allocate,
@@ -868,6 +956,11 @@ int brw_disasm_insn (FILE *file, const struct brw_instruction *inst)
                            inst->bits3.urb.used, &space);
            err |= control (file, "urb complete", urb_complete,
                            inst->bits3.urb.complete, &space);
+           if (gen >= 5) {
+               format (file, " mlen %d, rlen %d\n",
+                       inst->bits3.urb_gen5.msg_length,
+                       inst->bits3.urb_gen5.response_length);
+           }
            break;
        case BRW_MESSAGE_TARGET_THREAD_SPAWNER:
            break;
@@ -877,10 +970,17 @@ int brw_disasm_insn (FILE *file, const struct brw_instruction *inst)
        }
        if (space)
            string (file, " ");
-       format (file, "mlen %d",
-               inst->bits3.generic.msg_length);
-       format (file, " rlen %d",
-               inst->bits3.generic.response_length);
+       if (gen >= 5) {
+          format (file, "mlen %d",
+                  inst->bits3.generic_gen5.msg_length);
+          format (file, " rlen %d",
+                  inst->bits3.generic_gen5.response_length);
+       } else {
+           format (file, "mlen %d",
+                   inst->bits3.generic.msg_length);
+           format (file, " rlen %d",
+                   inst->bits3.generic.response_length);
+       }
     }
     pad (file, 64);
     if (inst->header.opcode != BRW_OPCODE_NOP) {
@@ -891,7 +991,8 @@ int brw_disasm_insn (FILE *file, const struct brw_instruction *inst)
        err |= control (file, "dependency control", dep_ctrl, inst->header.dependency_control, &space);
        err |= control (file, "compression control", compr_ctrl, inst->header.compression_control, &space);
        err |= control (file, "thread control", thread_ctrl, inst->header.thread_control, &space);
-       if (inst->header.opcode == BRW_OPCODE_SEND)
+       if (inst->header.opcode == BRW_OPCODE_SEND ||
+            inst->header.opcode == BRW_OPCODE_SENDC)
            err |= control (file, "end of thread", end_of_thread,
                            inst->bits3.generic.end_of_thread, &space);
        if (space)
@@ -905,13 +1006,13 @@ int brw_disasm_insn (FILE *file, const struct brw_instruction *inst)
 
 
 int brw_disasm (FILE *file, 
-                const struct brw_instruction *inst,
-                unsigned count)
+                struct brw_instruction *inst,
+                unsigned count, int gen)
 {
    int i, err;
 
    for (i = 0; i < count; i++) {
-      err = brw_disasm_insn(stderr, &inst[i]);
+      err = brw_disasm_insn(stderr, &inst[i], gen);
       if (err)
          return err;
    }
index ba5b109c483668cae403091fbaa7782c1137799e..ce451ed5a06611d3c7b2053b014fd9649b181a65 100644 (file)
 
 struct brw_instruction;
 
-int brw_disasm_insn (FILE *file, const struct brw_instruction *inst);
+int brw_disasm_insn (FILE *file, struct brw_instruction *inst, int gen);
 int brw_disasm (FILE *file, 
-                const struct brw_instruction *inst,
-                unsigned count);
+                struct brw_instruction *inst,
+                unsigned count, int gen);
 
 #endif
 
index ebeb1e146aa9bee5d95f955131efa88b68daf3d1..04ec5c81a6b7f4838e73f41085dfdfb26bde4955 100644 (file)
@@ -89,13 +89,16 @@ static int brw_prepare_vertices(struct brw_context *brw)
                          vb->buffer->width0 - vb->buffer_offset :
                          MAX2(vb->buffer->width0 - vb->buffer_offset,
                               vb->stride * (max_index + 1 - min_index)));
+        boolean flushed;
 
-        ret = u_upload_buffer( brw->vb.upload_vertex, 
+        ret = u_upload_buffer( brw->vb.upload_vertex,
+                               0,
                                vb->buffer_offset + min_index * vb->stride,
                                size,
                                vb->buffer,
                                &offset,
-                               &upload_buf );
+                               &upload_buf,
+                               &flushed );
         if (ret)
            return ret;
 
@@ -167,7 +170,7 @@ static int brw_emit_vertex_buffers( struct brw_context *brw )
       OUT_RELOC(brw->vb.vb[i].bo,
                BRW_USAGE_VERTEX,
                brw->vb.vb[i].offset);
-      if (BRW_IS_IGDNG(brw)) {
+      if (brw->gen == 5) {
         OUT_RELOC(brw->vb.vb[i].bo,
                   BRW_USAGE_VERTEX,
                   brw->vb.vb[i].bo->size - 1);
@@ -251,13 +254,16 @@ static int brw_prepare_indices(struct brw_context *brw)
    /* Turn userbuffer into a proper hardware buffer?
     */
    if (brw_buffer_is_user_buffer(index_buffer)) {
+      boolean flushed;
 
       ret = u_upload_buffer( brw->vb.upload_index,
+                             0,
                             index_offset,
                             ib_size,
                             index_buffer,
                             &offset,
-                            &upload_buf );
+                            &upload_buf,
+                            &flushed );
       if (ret)
         return ret;
 
index 00d8eaccbc42b97ba40ae9085a9a3c874d1c41d0..ba1159e4c32d1101664b0f59f3ac016a87704d7e 100644 (file)
@@ -255,19 +255,19 @@ static void brw_set_math_message( struct brw_context *brw,
 {
    brw_set_src1(insn, brw_imm_d(0));
 
-   if (BRW_IS_IGDNG(brw)) {
-       insn->bits3.math_igdng.function = function;
-       insn->bits3.math_igdng.int_type = integer_type;
-       insn->bits3.math_igdng.precision = low_precision;
-       insn->bits3.math_igdng.saturate = saturate;
-       insn->bits3.math_igdng.data_type = dataType;
-       insn->bits3.math_igdng.snapshot = 0;
-       insn->bits3.math_igdng.header_present = 0;
-       insn->bits3.math_igdng.response_length = response_length;
-       insn->bits3.math_igdng.msg_length = msg_length;
-       insn->bits3.math_igdng.end_of_thread = 0;
-       insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_MATH;
-       insn->bits2.send_igdng.end_of_thread = 0;
+   if (brw->gen == 5) {
+       insn->bits3.math_gen5.function = function;
+       insn->bits3.math_gen5.int_type = integer_type;
+       insn->bits3.math_gen5.precision = low_precision;
+       insn->bits3.math_gen5.saturate = saturate;
+       insn->bits3.math_gen5.data_type = dataType;
+       insn->bits3.math_gen5.snapshot = 0;
+       insn->bits3.math_gen5.header_present = 0;
+       insn->bits3.math_gen5.response_length = response_length;
+       insn->bits3.math_gen5.msg_length = msg_length;
+       insn->bits3.math_gen5.end_of_thread = 0;
+       insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_MATH;
+       insn->bits2.send_gen5.end_of_thread = 0;
    } else {
        insn->bits3.math.function = function;
        insn->bits3.math.int_type = integer_type;
@@ -295,18 +295,18 @@ static void brw_set_ff_sync_message( struct brw_context *brw,
 {
        brw_set_src1(insn, brw_imm_d(0));
 
-       insn->bits3.urb_igdng.opcode = 1;
-       insn->bits3.urb_igdng.offset = offset;
-       insn->bits3.urb_igdng.swizzle_control = swizzle_control;
-       insn->bits3.urb_igdng.allocate = allocate;
-       insn->bits3.urb_igdng.used = used;
-       insn->bits3.urb_igdng.complete = complete;
-       insn->bits3.urb_igdng.header_present = 1;
-       insn->bits3.urb_igdng.response_length = response_length;
-       insn->bits3.urb_igdng.msg_length = msg_length;
-       insn->bits3.urb_igdng.end_of_thread = end_of_thread;
-       insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB;
-       insn->bits2.send_igdng.end_of_thread = end_of_thread;
+       insn->bits3.urb_gen5.opcode = 1;
+       insn->bits3.urb_gen5.offset = offset;
+       insn->bits3.urb_gen5.swizzle_control = swizzle_control;
+       insn->bits3.urb_gen5.allocate = allocate;
+       insn->bits3.urb_gen5.used = used;
+       insn->bits3.urb_gen5.complete = complete;
+       insn->bits3.urb_gen5.header_present = 1;
+       insn->bits3.urb_gen5.response_length = response_length;
+       insn->bits3.urb_gen5.msg_length = msg_length;
+       insn->bits3.urb_gen5.end_of_thread = end_of_thread;
+       insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_URB;
+       insn->bits2.send_gen5.end_of_thread = end_of_thread;
 }
 
 static void brw_set_urb_message( struct brw_context *brw,
@@ -322,19 +322,19 @@ static void brw_set_urb_message( struct brw_context *brw,
 {
     brw_set_src1(insn, brw_imm_d(0));
 
-    if (BRW_IS_IGDNG(brw)) {
-        insn->bits3.urb_igdng.opcode = 0;      /* ? */
-        insn->bits3.urb_igdng.offset = offset;
-        insn->bits3.urb_igdng.swizzle_control = swizzle_control;
-        insn->bits3.urb_igdng.allocate = allocate;
-        insn->bits3.urb_igdng.used = used;     /* ? */
-        insn->bits3.urb_igdng.complete = complete;
-        insn->bits3.urb_igdng.header_present = 1;
-        insn->bits3.urb_igdng.response_length = response_length;
-        insn->bits3.urb_igdng.msg_length = msg_length;
-        insn->bits3.urb_igdng.end_of_thread = end_of_thread;
-        insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB;
-        insn->bits2.send_igdng.end_of_thread = end_of_thread;
+    if (brw->gen == 5) {
+        insn->bits3.urb_gen5.opcode = 0;       /* ? */
+        insn->bits3.urb_gen5.offset = offset;
+        insn->bits3.urb_gen5.swizzle_control = swizzle_control;
+        insn->bits3.urb_gen5.allocate = allocate;
+        insn->bits3.urb_gen5.used = used;      /* ? */
+        insn->bits3.urb_gen5.complete = complete;
+        insn->bits3.urb_gen5.header_present = 1;
+        insn->bits3.urb_gen5.response_length = response_length;
+        insn->bits3.urb_gen5.msg_length = msg_length;
+        insn->bits3.urb_gen5.end_of_thread = end_of_thread;
+        insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_URB;
+        insn->bits2.send_gen5.end_of_thread = end_of_thread;
     } else {
         insn->bits3.urb.opcode = 0;    /* ? */
         insn->bits3.urb.offset = offset;
@@ -361,18 +361,18 @@ static void brw_set_dp_write_message( struct brw_context *brw,
 {
    brw_set_src1(insn, brw_imm_d(0));
 
-   if (BRW_IS_IGDNG(brw)) {
-       insn->bits3.dp_write_igdng.binding_table_index = binding_table_index;
-       insn->bits3.dp_write_igdng.msg_control = msg_control;
-       insn->bits3.dp_write_igdng.pixel_scoreboard_clear = pixel_scoreboard_clear;
-       insn->bits3.dp_write_igdng.msg_type = msg_type;
-       insn->bits3.dp_write_igdng.send_commit_msg = 0;
-       insn->bits3.dp_write_igdng.header_present = 1;
-       insn->bits3.dp_write_igdng.response_length = response_length;
-       insn->bits3.dp_write_igdng.msg_length = msg_length;
-       insn->bits3.dp_write_igdng.end_of_thread = end_of_thread;
-       insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE;
-       insn->bits2.send_igdng.end_of_thread = end_of_thread;
+   if (brw->gen == 5) {
+       insn->bits3.dp_write_gen5.binding_table_index = binding_table_index;
+       insn->bits3.dp_write_gen5.msg_control = msg_control;
+       insn->bits3.dp_write_gen5.pixel_scoreboard_clear = pixel_scoreboard_clear;
+       insn->bits3.dp_write_gen5.msg_type = msg_type;
+       insn->bits3.dp_write_gen5.send_commit_msg = 0;
+       insn->bits3.dp_write_gen5.header_present = 1;
+       insn->bits3.dp_write_gen5.response_length = response_length;
+       insn->bits3.dp_write_gen5.msg_length = msg_length;
+       insn->bits3.dp_write_gen5.end_of_thread = end_of_thread;
+       insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE;
+       insn->bits2.send_gen5.end_of_thread = end_of_thread;
    } else {
        insn->bits3.dp_write.binding_table_index = binding_table_index;
        insn->bits3.dp_write.msg_control = msg_control;
@@ -398,18 +398,18 @@ static void brw_set_dp_read_message( struct brw_context *brw,
 {
    brw_set_src1(insn, brw_imm_d(0));
 
-   if (BRW_IS_IGDNG(brw)) {
-       insn->bits3.dp_read_igdng.binding_table_index = binding_table_index;
-       insn->bits3.dp_read_igdng.msg_control = msg_control;
-       insn->bits3.dp_read_igdng.msg_type = msg_type;
-       insn->bits3.dp_read_igdng.target_cache = target_cache;
-       insn->bits3.dp_read_igdng.header_present = 1;
-       insn->bits3.dp_read_igdng.response_length = response_length;
-       insn->bits3.dp_read_igdng.msg_length = msg_length;
-       insn->bits3.dp_read_igdng.pad1 = 0;
-       insn->bits3.dp_read_igdng.end_of_thread = end_of_thread;
-       insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_DATAPORT_READ;
-       insn->bits2.send_igdng.end_of_thread = end_of_thread;
+   if (brw->gen == 5) {
+       insn->bits3.dp_read_gen5.binding_table_index = binding_table_index;
+       insn->bits3.dp_read_gen5.msg_control = msg_control;
+       insn->bits3.dp_read_gen5.msg_type = msg_type;
+       insn->bits3.dp_read_gen5.target_cache = target_cache;
+       insn->bits3.dp_read_gen5.header_present = 1;
+       insn->bits3.dp_read_gen5.response_length = response_length;
+       insn->bits3.dp_read_gen5.msg_length = msg_length;
+       insn->bits3.dp_read_gen5.pad1 = 0;
+       insn->bits3.dp_read_gen5.end_of_thread = end_of_thread;
+       insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_READ;
+       insn->bits2.send_gen5.end_of_thread = end_of_thread;
    } else {
        insn->bits3.dp_read.binding_table_index = binding_table_index; /*0:7*/
        insn->bits3.dp_read.msg_control = msg_control;  /*8:11*/
@@ -437,18 +437,18 @@ static void brw_set_sampler_message(struct brw_context *brw,
    assert(eot == 0);
    brw_set_src1(insn, brw_imm_d(0));
 
-   if (BRW_IS_IGDNG(brw)) {
-      insn->bits3.sampler_igdng.binding_table_index = binding_table_index;
-      insn->bits3.sampler_igdng.sampler = sampler;
-      insn->bits3.sampler_igdng.msg_type = msg_type;
-      insn->bits3.sampler_igdng.simd_mode = simd_mode;
-      insn->bits3.sampler_igdng.header_present = header_present;
-      insn->bits3.sampler_igdng.response_length = response_length;
-      insn->bits3.sampler_igdng.msg_length = msg_length;
-      insn->bits3.sampler_igdng.end_of_thread = eot;
-      insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_SAMPLER;
-      insn->bits2.send_igdng.end_of_thread = eot;
-   } else if (BRW_IS_G4X(brw)) {
+   if (brw->gen == 5) {
+      insn->bits3.sampler_gen5.binding_table_index = binding_table_index;
+      insn->bits3.sampler_gen5.sampler = sampler;
+      insn->bits3.sampler_gen5.msg_type = msg_type;
+      insn->bits3.sampler_gen5.simd_mode = simd_mode;
+      insn->bits3.sampler_gen5.header_present = header_present;
+      insn->bits3.sampler_gen5.response_length = response_length;
+      insn->bits3.sampler_gen5.msg_length = msg_length;
+      insn->bits3.sampler_gen5.end_of_thread = eot;
+      insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER;
+      insn->bits2.send_gen5.end_of_thread = eot;
+   } else if (brw->is_g4x) {
       insn->bits3.sampler_g4x.binding_table_index = binding_table_index;
       insn->bits3.sampler_g4x.sampler = sampler;
       insn->bits3.sampler_g4x.msg_type = msg_type;
@@ -478,7 +478,7 @@ static struct brw_instruction *next_insn( struct brw_compile *p,
    if (0 && (BRW_DEBUG & DEBUG_DISASSEM))
    {
       if (p->nr_insn) 
-         brw_disasm_insn(stderr, &p->store[p->nr_insn-1]);
+         brw_disasm_insn(stderr, &p->store[p->nr_insn-1], p->brw->gen);
    }
 
    assert(p->nr_insn + 1 < BRW_EU_MAX_INSN);
@@ -658,7 +658,7 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p,
    struct brw_instruction *insn;
    GLuint br = 1;
 
-   if (BRW_IS_IGDNG(p->brw))
+   if (p->brw->gen == 5)
       br = 2;
 
    if (p->single_program_flow) {
@@ -699,7 +699,7 @@ void brw_ENDIF(struct brw_compile *p,
 {
    GLuint br = 1;
 
-   if (BRW_IS_IGDNG(p->brw))
+   if (p->brw->gen == 5)
       br = 2; 
  
    if (p->single_program_flow) {
@@ -813,7 +813,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p,
    struct brw_instruction *insn;
    GLuint br = 1;
 
-   if (BRW_IS_IGDNG(p->brw))
+   if (p->brw->gen == 5)
       br = 2;
 
    if (p->single_program_flow)
@@ -856,7 +856,7 @@ void brw_land_fwd_jump(struct brw_compile *p,
    struct brw_instruction *landing = &p->store[p->nr_insn];
    GLuint jmpi = 1;
 
-   if (BRW_IS_IGDNG(p->brw))
+   if (p->brw->gen == 5)
        jmpi = 2;
 
    assert(jmp_insn->header.opcode == BRW_OPCODE_JMPI);
index 06826635a8a24eb6a019902ca281ede1f2ae1834..2a8165b83ee6e0f827da576269fd5477b46a8c54 100644 (file)
@@ -51,13 +51,13 @@ static enum pipe_error compile_gs_prog( struct brw_context *brw,
    memset(&c, 0, sizeof(c));
    
    c.key = *key;
-   c.need_ff_sync = BRW_IS_IGDNG(brw);
+   c.need_ff_sync = brw->gen == 5;
    /* Need to locate the two positions present in vertex + header.
     * These are currently hardcoded:
     */
    c.nr_attrs = c.key.nr_attrs;
 
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
       c.nr_regs = (c.nr_attrs + 1) / 2 + 3;  /* are vertices packed, or reg-aligned? */
    else
       c.nr_regs = (c.nr_attrs + 1) / 2 + 1;  /* are vertices packed, or reg-aligned? */
index b64ec286cea4923de3e1a5e31750845169374215..6e070f6d7565294fa454dfbf0de49271d95261c7 100644 (file)
@@ -103,7 +103,7 @@ gs_unit_create_from_key(struct brw_context *brw,
    else
       gs.thread4.max_threads = 0;
 
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
       gs.thread4.rendering_enable = 1;
 
    if (BRW_DEBUG & DEBUG_STATS)
index b5029ceb69fcb87e6d64acccd1406a8144b294e9..d53ce6ccfd4a0041e3f9f1f9d65c6f5295cdd855 100644 (file)
@@ -239,7 +239,7 @@ static int prepare_depthbuffer(struct brw_context *brw)
 static int emit_depthbuffer(struct brw_context *brw)
 {
    struct pipe_surface *surface = brw->curr.fb.zsbuf;
-   unsigned int len = (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) ? 6 : 5;
+   unsigned int len = (brw->is_g4x || brw->gen == 5) ? 6 : 5;
 
    if (surface == NULL) {
       BEGIN_BATCH(len, IGNORE_CLIPRECTS);
@@ -250,7 +250,7 @@ static int emit_depthbuffer(struct brw_context *brw)
       OUT_BATCH(0);
       OUT_BATCH(0);
 
-      if (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw))
+      if (brw->is_g4x || brw->gen == 5)
          OUT_BATCH(0);
 
       ADVANCE_BATCH();
@@ -287,17 +287,18 @@ static int emit_depthbuffer(struct brw_context *brw)
       OUT_BATCH(((pitch * cpp) - 1) |
                (format << 18) |
                (BRW_TILEWALK_YMAJOR << 26) |
-               ((surface->layout != PIPE_SURFACE_LAYOUT_LINEAR) << 27) |
+                /* always linear ?
+               ((surface->layout != PIPE_SURFACE_LAYOUT_LINEAR) << 27) |*/
                (BRW_SURFACE_2D << 29));
       OUT_RELOC(bo,
                BRW_USAGE_DEPTH_BUFFER,
-               surface->offset);
+               brw_surface(surface)->offset);
       OUT_BATCH((BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1) |
                ((pitch - 1) << 6) |
                ((surface->height - 1) << 19));
       OUT_BATCH(0);
 
-      if (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw))
+      if (brw->is_g4x || brw->gen == 5)
          OUT_BATCH(0);
 
       ADVANCE_BATCH();
@@ -362,10 +363,10 @@ const struct brw_tracked_state brw_line_stipple = {
 
 
 /***********************************************************************
- * Misc invarient state packets
+ * Misc invariant state packets
  */
 
-static int upload_invarient_state( struct brw_context *brw )
+static int upload_invariant_state( struct brw_context *brw )
 {
    {
       /* 0x61040000  Pipeline Select */
@@ -373,7 +374,7 @@ static int upload_invarient_state( struct brw_context *brw )
       struct brw_pipeline_select ps;
 
       memset(&ps, 0, sizeof(ps));
-      if (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw))
+      if (brw->is_g4x || brw->gen == 5)
         ps.header.opcode = CMD_PIPELINE_SELECT_GM45;
       else
         ps.header.opcode = CMD_PIPELINE_SELECT_965;
@@ -412,7 +413,7 @@ static int upload_invarient_state( struct brw_context *brw )
       struct brw_vf_statistics vfs;
       memset(&vfs, 0, sizeof(vfs));
 
-      if (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw)) 
+      if (brw->is_g4x || brw->gen == 5)
         vfs.opcode = CMD_VF_STATISTICS_GM45;
       else 
         vfs.opcode = CMD_VF_STATISTICS_965;
@@ -423,7 +424,7 @@ static int upload_invarient_state( struct brw_context *brw )
       BRW_BATCH_STRUCT(brw, &vfs);
    }
    
-   if (!BRW_IS_965(brw))
+   if (!(brw->gen == 4))
    {
       struct brw_aa_line_parameters balp;
 
@@ -438,7 +439,7 @@ static int upload_invarient_state( struct brw_context *brw )
    {
       struct brw_polygon_stipple_offset bpso;
       
-      /* This is invarient state in gallium:
+      /* This is invariant state in gallium:
        */
       memset(&bpso, 0, sizeof(bpso));
       bpso.header.opcode = CMD_POLY_STIPPLE_OFFSET;
@@ -452,13 +453,13 @@ static int upload_invarient_state( struct brw_context *brw )
    return 0;
 }
 
-const struct brw_tracked_state brw_invarient_state = {
+const struct brw_tracked_state brw_invariant_state = {
    .dirty = {
       .mesa = 0,
       .brw = BRW_NEW_CONTEXT,
       .cache = 0
    },
-   .emit = upload_invarient_state
+   .emit = upload_invariant_state
 };
 
 
@@ -479,7 +480,7 @@ static int upload_state_base_address( struct brw_context *brw )
    /* Output the structure (brw_state_base_address) directly to the
     * batchbuffer, so we can emit relocations inline.
     */
-   if (BRW_IS_IGDNG(brw)) {
+   if (brw->gen == 5) {
        BEGIN_BATCH(8, IGNORE_CLIPRECTS);
        OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (8 - 2));
        OUT_BATCH(1); /* General state base address */
index d5cff338a66fb200c64b43552d559447d876832c..7bf3ea6994a8d694e7a96a592147e98ccb29c631 100644 (file)
@@ -64,7 +64,7 @@ try_clear( struct brw_context *brw,
    debug_printf("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
                 __FUNCTION__,
                 (void *)surface->bo, pitch * cpp,
-                surface->base.offset,
+                surface->offset,
                 x1, y1, x2 - x1, y2 - y1);
 
    BR13 = 0xf0 << 16;
@@ -99,7 +99,7 @@ try_clear( struct brw_context *brw,
    OUT_BATCH((y2 << 16) | x2);
    OUT_RELOC(surface->bo,
              BRW_USAGE_BLIT_DEST,
-             surface->base.offset);
+             surface->offset);
    OUT_BATCH(value);
    ADVANCE_BATCH();
 
index 4c1a6d7dcdfde014ae3248c9457395e9279c4dfa..c86681d149576d01fb5d7a2c0ec1c51783d6cd95 100644 (file)
@@ -35,7 +35,7 @@ calculate_clip_key_rast( const struct brw_context *brw,
 {
    memset(key, 0, sizeof *key);
 
-   if (brw->chipset.is_igdng)
+   if (brw->gen == 5)
        key->clip_mode = BRW_CLIPMODE_KERNEL_CLIP;
    else
        key->clip_mode = BRW_CLIPMODE_NORMAL;
diff --git a/src/gallium/drivers/i965/brw_pipe_surface.c b/src/gallium/drivers/i965/brw_pipe_surface.c
new file mode 100644 (file)
index 0000000..58a6100
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ Copyright (C) Intel Corp.  2006.  All Rights Reserved.
+ Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
+ develop this 3D driver.
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+ The above copyright notice and this permission notice (including the
+ next paragraph) shall be included in all copies or substantial
+ portions of the Software.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ **********************************************************************/
+ /*
+  * Authors:
+  *   Keith Whitwell <keith@tungstengraphics.com>
+  */
+
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+#include "util/u_math.h"
+
+#include "pipe/p_screen.h"
+#include "brw_screen.h"
+#include "brw_context.h"
+#include "brw_defines.h"
+#include "brw_resource.h"
+#include "brw_winsys.h"
+
+enum {
+   BRW_VIEW_LINEAR,
+   BRW_VIEW_IN_PLACE
+};
+
+
+static boolean need_linear_view( struct brw_screen *brw_screen,
+                                struct brw_texture *brw_texture,
+                                union brw_surface_id id,
+                                unsigned usage )
+{
+#if 0
+   /* XXX: what about IDGNG?
+    */
+   if (!BRW_IS_G4X(brw->brw_screen->pci_id))
+   {
+      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
+      struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+
+      /* The original gen4 hardware couldn't set up WM surfaces pointing
+       * at an offset within a tile, which can happen when rendering to
+       * anything but the base level of a texture or the +X face/0 depth.
+       * This was fixed with the 4 Series hardware.
+       *
+       * For these original chips, you would have to make the depth and
+       * color destination surfaces include information on the texture
+       * type, LOD, face, and various limits to use them as a destination.
+       *
+       * This is easy in Gallium as surfaces are all backed by
+       * textures, but there's also a nasty requirement that the depth
+       * and the color surfaces all be of the same LOD, which is
+       * harder to get around as we can't look at a surface in
+       * isolation and decide if it's legal.
+       *
+       * Instead, end up being pessimistic and say that for i965,
+       * ... ??
+       */
+      if (brw_tex->tiling != I915_TILING_NONE &&
+         (brw_tex_image_offset(brw_tex, face, level, zslize) & 4095)) {
+        if (BRW_DEBUG & DEBUG_VIEW)
+           debug_printf("%s: need surface view for non-aligned tex image\n",
+                        __FUNCTION__);
+        return GL_TRUE;
+      }
+   }
+#endif
+
+   /* Tiled 3d textures don't have subsets that look like 2d surfaces:
+    */
+   
+   /* Everything else should be fine to render to in-place:
+    */
+   return GL_FALSE;
+}
+
+/* Look at all texture views and figure out if any of them need to be
+ * back-copied into the texture for sampling
+ */
+void brw_update_texture( struct brw_screen *brw_screen,
+                        struct brw_texture *tex )
+{
+   /* currently nothing to do */
+}
+
+
+/* Create a new surface with linear layout to serve as a render-target
+ * where it would be illegal (perhaps due to tiling constraints) to do
+ * this in-place.
+ * 
+ * Currently not implemented, not sure if it's needed.
+ */
+static struct brw_surface *create_linear_view( struct brw_screen *brw_screen,
+                                               struct pipe_context *pipe,
+                                              struct brw_texture *tex,
+                                              union brw_surface_id id,
+                                              unsigned usage )
+{
+   return NULL;
+}
+
+
+/* Create a pipe_surface that just points directly into the existing
+ * texture's storage.
+ */
+static struct brw_surface *create_in_place_view( struct brw_screen *brw_screen,
+                                                 struct pipe_context *pipe,
+                                                 struct brw_texture *tex,
+                                                 union brw_surface_id id,
+                                                 unsigned usage )
+{
+   struct brw_surface *surface;
+
+   surface = CALLOC_STRUCT(brw_surface);
+   if (surface == NULL)
+      return NULL;
+
+   pipe_reference_init(&surface->base.reference, 1);
+
+   /* XXX: ignoring render-to-slice-of-3d-texture
+    */
+   assert(tex->b.b.target != PIPE_TEXTURE_3D || id.bits.layer == 0);
+
+   surface->base.context = pipe;
+   surface->base.format = tex->b.b.format;
+   surface->base.width = u_minify(tex->b.b.width0, id.bits.level);
+   surface->base.height = u_minify(tex->b.b.height0, id.bits.level);
+   surface->base.usage = usage;
+   surface->base.u.tex.first_layer = id.bits.layer;
+   surface->base.u.tex.last_layer = surface->base.u.tex.first_layer;
+   surface->base.u.tex.level = id.bits.level;
+   surface->id = id;
+   surface->offset = tex->image_offset[id.bits.level][id.bits.layer];
+   surface->cpp = tex->cpp;
+   surface->pitch = tex->pitch;
+   surface->tiling = tex->tiling;
+
+   bo_reference( &surface->bo, tex->bo );
+   pipe_resource_reference( &surface->base.texture, &tex->b.b );
+
+   surface->ss.ss0.surface_format = tex->ss.ss0.surface_format;
+   surface->ss.ss0.surface_type = BRW_SURFACE_2D;
+
+   if (tex->tiling == BRW_TILING_NONE) {
+      surface->ss.ss1.base_addr = surface->offset;
+   } else {
+      uint32_t tile_offset = surface->offset % 4096;
+
+      surface->ss.ss1.base_addr = surface->offset - tile_offset;
+
+      if (tex->tiling == BRW_TILING_X) {
+       /* Note that the low bits of these fields are missing, so
+        * there's the possibility of getting in trouble.
+        */
+       surface->ss.ss5.x_offset = (tile_offset % 512) / tex->cpp / 4;
+       surface->ss.ss5.y_offset = tile_offset / 512 / 2;
+      } else {
+       surface->ss.ss5.x_offset = (tile_offset % 128) / tex->cpp / 4;
+           surface->ss.ss5.y_offset = tile_offset / 128 / 2;
+      }
+   }
+
+#if 0
+   if (region_bo != NULL)
+      surface->ss.ss1.base_addr += region_bo->offset; /* reloc */
+#endif
+
+   surface->ss.ss2.width = surface->base.width - 1;
+   surface->ss.ss2.height = surface->base.height - 1;
+   surface->ss.ss3.tiled_surface = tex->ss.ss3.tiled_surface;
+   surface->ss.ss3.tile_walk = tex->ss.ss3.tile_walk;
+   surface->ss.ss3.pitch = tex->ss.ss3.pitch;
+
+   return surface;
+}
+
+/* Get a surface which is view into a texture 
+ */
+static struct pipe_surface *brw_create_surface(struct pipe_context *pipe,
+                                               struct pipe_resource *pt,
+                                               const struct pipe_surface *surf_tmpl)
+{
+   struct brw_texture *tex = brw_texture(pt);
+   struct brw_screen *bscreen = brw_screen(pipe->screen);
+   struct brw_surface *surface;
+   union brw_surface_id id;
+   int type;
+
+   assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
+   id.bits.level = surf_tmpl->u.tex.level;
+   id.bits.layer = surf_tmpl->u.tex.first_layer;
+
+   if (need_linear_view(bscreen, tex, id, surf_tmpl->usage))
+      type = BRW_VIEW_LINEAR;
+   else
+      type = BRW_VIEW_IN_PLACE;
+
+   
+   foreach (surface, &tex->views[type]) {
+      if (id.value == surface->id.value)
+        return &surface->base;
+   }
+
+   switch (type) {
+   case BRW_VIEW_LINEAR:
+      surface = create_linear_view( bscreen, pipe, tex, id, surf_tmpl->usage );
+      break;
+   case BRW_VIEW_IN_PLACE:
+      surface = create_in_place_view( bscreen, pipe, tex, id, surf_tmpl->usage );
+      break;
+   }
+
+   insert_at_head( &tex->views[type], surface );
+   return &surface->base;
+}
+
+
+static void brw_surface_destroy( struct pipe_context *pipe,
+                                 struct pipe_surface *surf )
+{
+   struct brw_surface *surface = brw_surface(surf);
+
+   /* Unreference texture, shared buffer:
+    */
+   remove_from_list(surface);
+   bo_reference(&surface->bo, NULL);
+   pipe_resource_reference( &surface->base.texture, NULL );
+
+   FREE(surface);
+}
+
+
+void brw_pipe_surface_init( struct brw_context *brw )
+{
+   brw->base.create_surface = brw_create_surface;
+   brw->base.surface_destroy = brw_surface_destroy;
+}
index 007239efc40424756f2df4dbc4452a80bbf7e9b0..b23454b5808c7f191003a30d08aa1c9f16f2109a 100644 (file)
@@ -203,7 +203,7 @@ static void brw_translate_vertex_elements(struct brw_context *brw,
       brw_velems->ve[i].ve1.vfcomponent2 = comp2;
       brw_velems->ve[i].ve1.vfcomponent3 = comp3;
 
-      if (BRW_IS_IGDNG(brw))
+      if (brw->gen == 5)
          brw_velems->ve[i].ve1.dst_offset = 0;
       else
          brw_velems->ve[i].ve1.dst_offset = i * 4;
@@ -248,7 +248,6 @@ static void brw_set_vertex_buffers(struct pipe_context *pipe,
                                    const struct pipe_vertex_buffer *buffers)
 {
    struct brw_context *brw = brw_context(pipe);
-   unsigned i;
 
    /* Check for no change */
    if (count == brw->curr.num_vertex_buffers &&
@@ -257,18 +256,9 @@ static void brw_set_vertex_buffers(struct pipe_context *pipe,
               count * sizeof buffers[0]) == 0)
       return;
 
-   /* Adjust refcounts */
-   for (i = 0; i < count; i++) 
-      pipe_resource_reference(&brw->curr.vertex_buffer[i].buffer, 
-                            buffers[i].buffer);
-
-   for ( ; i < brw->curr.num_vertex_buffers; i++)
-      pipe_resource_reference(&brw->curr.vertex_buffer[i].buffer,
-                            NULL);
-
-   /* Copy remaining data */
-   memcpy(brw->curr.vertex_buffer, buffers, count * sizeof buffers[0]);
-   brw->curr.num_vertex_buffers = count;
+   util_copy_vertex_buffers(brw->curr.vertex_buffer,
+                            &brw->curr.num_vertex_buffers,
+                            buffers, count);
 
    brw->state.dirty.mesa |= PIPE_NEW_VERTEX_BUFFER;
 }
@@ -318,9 +308,13 @@ brw_pipe_vertex_init( struct brw_context *brw )
 void 
 brw_pipe_vertex_cleanup( struct brw_context *brw )
 {
+   unsigned i;
 
    /* Release bound pipe vertex_buffers
     */
+   for (i = 0; i < brw->curr.num_vertex_buffers; i++) {
+      pipe_resource_reference(&brw->curr.vertex_buffer[i].buffer, NULL);
+   }
 
    /* Release some other stuff
     */
index ba10f9d5df1e0197d5ef225b15c943a3f0808fef..53c7c435713e0010f212a6e6bf96b41ef88d4f80 100644 (file)
 #define PCI_CHIP_G45_G                  0x2E22
 #define PCI_CHIP_G41_G                  0x2E32
 #define PCI_CHIP_B43_G                  0x2E42
+#define PCI_CHIP_B43_G1                 0x2E92
 
 #define PCI_CHIP_ILD_G                  0x0042
 #define PCI_CHIP_ILM_G                  0x0046
 
-struct brw_chipset {
-   unsigned pci_id:16;
-   unsigned is_965:1;
-   unsigned is_igdng:1;
-   unsigned is_g4x:1;
-   unsigned pad:13;
-};
-
+#define PCI_CHIP_SANDYBRIDGE_GT1       0x0102  /* Desktop */
+#define PCI_CHIP_SANDYBRIDGE_GT2       0x0112
+#define PCI_CHIP_SANDYBRIDGE_GT2_PLUS  0x0122
+#define PCI_CHIP_SANDYBRIDGE_M_GT1     0x0106  /* Mobile */
+#define PCI_CHIP_SANDYBRIDGE_M_GT2     0x0116
+#define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS        0x0126
+#define PCI_CHIP_SANDYBRIDGE_S         0x010A  /* Server */
+
+#define IS_G45(devid)           (devid == PCI_CHIP_IGD_E_G || \
+                                 devid == PCI_CHIP_Q45_G || \
+                                 devid == PCI_CHIP_G45_G || \
+                                 devid == PCI_CHIP_G41_G || \
+                                 devid == PCI_CHIP_B43_G || \
+                                 devid == PCI_CHIP_B43_G1)
+#define IS_GM45(devid)          (devid == PCI_CHIP_GM45_GM)
+#define IS_G4X(devid)          (IS_G45(devid) || IS_GM45(devid))
+
+#define IS_GEN4(devid)         (devid == PCI_CHIP_I965_G || \
+                                devid == PCI_CHIP_I965_Q || \
+                                devid == PCI_CHIP_I965_G_1 || \
+                                devid == PCI_CHIP_I965_GM || \
+                                devid == PCI_CHIP_I965_GME || \
+                                devid == PCI_CHIP_I946_GZ || \
+                                IS_G4X(devid))
+
+#define IS_ILD(devid)           (devid == PCI_CHIP_ILD_G)
+#define IS_ILM(devid)           (devid == PCI_CHIP_ILM_G)
+#define IS_GEN5(devid)          (IS_ILD(devid) || IS_ILM(devid))
+
+#define IS_IRONLAKE(devid)     IS_GEN5(devid)
+
+#define IS_GEN6(devid)         (devid == PCI_CHIP_SANDYBRIDGE_GT1 || \
+                                devid == PCI_CHIP_SANDYBRIDGE_GT2 || \
+                                devid == PCI_CHIP_SANDYBRIDGE_GT2_PLUS || \
+                                devid == PCI_CHIP_SANDYBRIDGE_M_GT1 || \
+                                devid == PCI_CHIP_SANDYBRIDGE_M_GT2 || \
+                                devid == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS || \
+                                devid == PCI_CHIP_SANDYBRIDGE_S)
+
+#define IS_965(devid)          (IS_GEN4(devid) || \
+                                IS_G4X(devid) || \
+                                IS_GEN5(devid) || \
+                                IS_GEN6(devid))
 
 /* XXX: hacks
  */
index 5f9e8a87c9976e9d98a2388d4fc26e80534e27f8..afb96ee3e7fd6b0ab718cde45514f71f82974d13 100644 (file)
@@ -92,9 +92,9 @@ brw_buffer_transfer_unmap( struct pipe_context *pipe,
 
 
 static unsigned brw_buffer_is_referenced( struct pipe_context *pipe,
-                                        struct pipe_resource *resource,
-                                        unsigned face,
-                                        unsigned level)
+                                          struct pipe_resource *resource,
+                                          unsigned level,
+                                          int layer)
 {
    struct brw_context *brw = brw_context(pipe);
    struct brw_winsys_buffer *batch_bo = brw->batch->buf;
@@ -194,6 +194,7 @@ brw_user_buffer_create(struct pipe_screen *screen,
    buf->b.b.width0 = bytes;
    buf->b.b.height0 = 1;
    buf->b.b.depth0 = 1;
+   buf->b.b.array_size = 1;
 
    buf->user_buffer = ptr;
    
index 3860d18a7a2f10190d25f26efda9a20b9133bcc8..0cb895f35dee26488f3fddde0c41f84181d55a68 100644 (file)
@@ -229,8 +229,8 @@ static void brw_texture_destroy(struct pipe_screen *screen,
 
 static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
                                           struct pipe_resource *texture,
-                                          unsigned face, 
-                                          unsigned level )
+                                          unsigned level,
+                                          int layer )
 {
    struct brw_context *brw = brw_context(pipe);
    struct brw_screen *bscreen = brw_screen(pipe->screen);
@@ -246,7 +246,7 @@ static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
    if (bscreen->sws->bo_references( batch_bo, tex->bo ))
       return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
 
-   /* Find any view on this texture for this face/level and see if it
+   /* Find any view on this texture for this level/layer and see if it
     * is referenced:
     */
    for (i = 0; i < 2; i++) {
@@ -254,7 +254,7 @@ static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
          if (surf->bo == tex->bo)
             continue;
 
-         if (surf->id.bits.face != face ||
+         if (!(layer == -1 || surf->id.bits.layer == layer) ||
              surf->id.bits.level != level)
             continue;
          
@@ -274,10 +274,10 @@ static unsigned brw_texture_is_referenced( struct pipe_context *pipe,
 
 static struct pipe_transfer * 
 brw_texture_get_transfer(struct pipe_context *context,
-                         struct pipe_resource *resource,
-                         struct pipe_subresource sr,
-                         unsigned usage,
-                         const struct pipe_box *box)
+                         struct pipe_resource *resource,
+                         unsigned level,
+                         unsigned usage,
+                         const struct pipe_box *box)
 {
    struct brw_texture *tex = brw_texture(resource);
    struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
@@ -285,10 +285,11 @@ brw_texture_get_transfer(struct pipe_context *context,
       return NULL;
 
    transfer->resource = resource;
-   transfer->sr = sr;
+   transfer->level = level;
    transfer->usage = usage;
    transfer->box = *box;
    transfer->stride = tex->pitch * tex->cpp;
+   /* FIXME: layer_stride */
 
    return transfer;
 }
@@ -301,24 +302,16 @@ brw_texture_transfer_map(struct pipe_context *pipe,
    struct pipe_resource *resource = transfer->resource;
    struct brw_texture *tex = brw_texture(transfer->resource);
    struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws;
-   struct pipe_subresource sr = transfer->sr;
    struct pipe_box *box = &transfer->box;
    enum pipe_format format = resource->format;
    unsigned usage = transfer->usage;
    unsigned offset;
    char *map;
 
-   if (resource->target == PIPE_TEXTURE_CUBE) {
-      offset = tex->image_offset[sr.level][sr.face];
-   }
-   else if (resource->target == PIPE_TEXTURE_3D) {
-      offset = tex->image_offset[sr.level][box->z];
-   }
-   else {
-      offset = tex->image_offset[sr.level][0];
-      assert(sr.face == 0);
+   if (resource->target != PIPE_TEXTURE_3D &&
+       resource->target != PIPE_TEXTURE_CUBE)
       assert(box->z == 0);
-   }
+   offset = tex->image_offset[transfer->level][box->z];
 
    map = sws->bo_map(tex->bo, 
                      BRW_DATA_OTHER,
@@ -399,7 +392,7 @@ brw_texture_create( struct pipe_screen *screen,
    if (tex->compressed == 0 &&
        !bscreen->no_tiling) 
    {
-      if (bscreen->chipset.is_965 &&
+      if (bscreen->gen < 5 &&
          util_format_is_depth_or_stencil(template->format))
         tex->tiling = BRW_TILING_Y;
       else
index 2187bdd82cec679ff7d6aae1200c4204344f3f56..afecc77e3127d2cc6643f625b12c27fbf8673e7a 100644 (file)
@@ -388,7 +388,7 @@ GLboolean brw_texture_layout(struct brw_screen *brw_screen,
 {
    switch (tex->b.b.target) {
    case PIPE_TEXTURE_CUBE:
-      if (brw_screen->chipset.is_igdng)
+      if (brw_screen->gen == 5)
         brw_layout_cubemap_idgng( tex );
       else
         brw_layout_3d_cube( tex );
index 29486f5b815b27001b14d3f9bc5864580026618f..bf805fd080c9e2ed33900e68f4821ab1eebae10a 100644 (file)
@@ -97,7 +97,7 @@ brw_get_name(struct pipe_screen *screen)
    static char buffer[128];
    const char *chipset;
 
-   switch (brw_screen(screen)->chipset.pci_id) {
+   switch (brw_screen(screen)->pci_id) {
    case PCI_CHIP_I965_G:
       chipset = "I965_G";
       break;
@@ -405,8 +405,6 @@ struct pipe_screen *
 brw_screen_create(struct brw_winsys_screen *sws)
 {
    struct brw_screen *bscreen;
-   struct brw_chipset chipset;
-
 #ifdef DEBUG
    BRW_DEBUG = debug_get_flags_option("BRW_DEBUG", debug_names, 0);
    BRW_DEBUG |= debug_get_flags_option("INTEL_DEBUG", debug_names, 0);
@@ -415,46 +413,30 @@ brw_screen_create(struct brw_winsys_screen *sws)
    BRW_DUMP = debug_get_flags_option("BRW_DUMP", dump_names, 0);
 #endif
 
-   memset(&chipset, 0, sizeof chipset);
-
-   chipset.pci_id = sws->pci_id;
-
-   switch (chipset.pci_id) {
-   case PCI_CHIP_I965_G:
-   case PCI_CHIP_I965_Q:
-   case PCI_CHIP_I965_G_1:
-   case PCI_CHIP_I946_GZ:
-   case PCI_CHIP_I965_GM:
-   case PCI_CHIP_I965_GME:
-      chipset.is_965 = TRUE;
-      break;
-
-   case PCI_CHIP_GM45_GM:
-   case PCI_CHIP_IGD_E_G:
-   case PCI_CHIP_Q45_G:
-   case PCI_CHIP_G45_G:
-   case PCI_CHIP_G41_G:
-   case PCI_CHIP_B43_G:
-      chipset.is_g4x = TRUE;
-      break;
-
-   case PCI_CHIP_ILD_G:
-   case PCI_CHIP_ILM_G:
-      chipset.is_igdng = TRUE;
-      break;
+   bscreen = CALLOC_STRUCT(brw_screen);
+   if (!bscreen)
+      return NULL;
 
-   default:
+   bscreen->pci_id = sws->pci_id;
+   if (IS_GEN6(sws->pci_id)) {
+       bscreen->gen = 6;
+       bscreen->needs_ff_sync = TRUE;
+   } else if (IS_GEN5(sws->pci_id)) {
+       bscreen->gen = 5;
+       bscreen->needs_ff_sync = TRUE;
+   } else if (IS_965(sws->pci_id)) {
+       bscreen->gen = 4;
+       if (IS_G4X(sws->pci_id)) {
+          bscreen->is_g4x = true;
+       }
+   } else {
       debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", 
-                   __FUNCTION__, chipset.pci_id);
+                   __FUNCTION__, sws->pci_id);
+      free(bscreen);
       return NULL;
    }
 
-
-   bscreen = CALLOC_STRUCT(brw_screen);
-   if (!bscreen)
-      return NULL;
-
-   bscreen->chipset = chipset;
+   sws->gen = bscreen->gen;
    bscreen->sws = sws;
    bscreen->base.winsys = NULL;
    bscreen->base.destroy = brw_destroy_screen;
@@ -470,7 +452,6 @@ brw_screen_create(struct brw_winsys_screen *sws)
    bscreen->base.fence_finish = brw_fence_finish;
 
    brw_init_screen_resource_functions(bscreen);
-   brw_screen_tex_surface_init(bscreen);
 
    bscreen->no_tiling = debug_get_option("BRW_NO_TILING", FALSE) != NULL;
    
index 522a3bf899528ea3046e96e7ca2506ae08ee91ac..a62e1afc405e5b0a99262944bce7a7dc0c3085f3 100644 (file)
@@ -43,7 +43,11 @@ struct brw_winsys_screen;
 struct brw_screen
 {
    struct pipe_screen base;
-   struct brw_chipset chipset;
+   int gen;
+   boolean has_negative_rhw_bug;
+   boolean needs_ff_sync;
+   boolean is_g4x;
+   int pci_id;
    struct brw_winsys_screen *sws;
    boolean no_tiling;
 };
@@ -52,9 +56,8 @@ struct brw_screen
 
 union brw_surface_id {
    struct {
-      unsigned face:3;
-      unsigned zslice:13;
       unsigned level:16;
+      unsigned layer:16;
    } bits;
    unsigned value;
 };
@@ -63,8 +66,9 @@ union brw_surface_id {
 struct brw_surface
 {
    struct pipe_surface base;
-   
+
    union brw_surface_id id;
+   unsigned offset;
    unsigned cpp;
    unsigned pitch;
    unsigned draw_offset;
@@ -96,7 +100,5 @@ brw_surface(struct pipe_surface *surface)
 unsigned
 brw_surface_pitch( const struct pipe_surface *surface );
 
-void brw_screen_tex_surface_init( struct brw_screen *brw_screen );
-
 
 #endif /* BRW_SCREEN_H */
diff --git a/src/gallium/drivers/i965/brw_screen_surface.c b/src/gallium/drivers/i965/brw_screen_surface.c
deleted file mode 100644 (file)
index f288fdb..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- Copyright (C) Intel Corp.  2006.  All Rights Reserved.
- Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
- develop this 3D driver.
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- The above copyright notice and this permission notice (including the
- next paragraph) shall be included in all copies or substantial
- portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- **********************************************************************/
- /*
-  * Authors:
-  *   Keith Whitwell <keith@tungstengraphics.com>
-  */
-
-#include "util/u_memory.h"
-#include "util/u_simple_list.h"
-#include "util/u_math.h"
-
-#include "pipe/p_screen.h"
-#include "brw_screen.h"
-#include "brw_defines.h"
-#include "brw_resource.h"
-#include "brw_winsys.h"
-
-enum {
-   BRW_VIEW_LINEAR,
-   BRW_VIEW_IN_PLACE
-};
-
-
-static boolean need_linear_view( struct brw_screen *brw_screen,
-                                struct brw_texture *brw_texture,
-                                union brw_surface_id id,
-                                unsigned usage )
-{
-#if 0
-   /* XXX: what about IDGNG?
-    */
-   if (!BRW_IS_G4X(brw->brw_screen->pci_id))
-   {
-      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
-      struct intel_renderbuffer *irb = intel_renderbuffer(rb);
-
-      /* The original gen4 hardware couldn't set up WM surfaces pointing
-       * at an offset within a tile, which can happen when rendering to
-       * anything but the base level of a texture or the +X face/0 depth.
-       * This was fixed with the 4 Series hardware.
-       *
-       * For these original chips, you would have to make the depth and
-       * color destination surfaces include information on the texture
-       * type, LOD, face, and various limits to use them as a destination.
-       *
-       * This is easy in Gallium as surfaces are all backed by
-       * textures, but there's also a nasty requirement that the depth
-       * and the color surfaces all be of the same LOD, which is
-       * harder to get around as we can't look at a surface in
-       * isolation and decide if it's legal.
-       *
-       * Instead, end up being pessimistic and say that for i965,
-       * ... ??
-       */
-      if (brw_tex->tiling != I915_TILING_NONE &&
-         (brw_tex_image_offset(brw_tex, face, level, zslize) & 4095)) {
-        if (BRW_DEBUG & DEBUG_VIEW)
-           debug_printf("%s: need surface view for non-aligned tex image\n",
-                        __FUNCTION__);
-        return GL_TRUE;
-      }
-   }
-#endif
-
-   /* Tiled 3d textures don't have subsets that look like 2d surfaces:
-    */
-   
-   /* Everything else should be fine to render to in-place:
-    */
-   return GL_FALSE;
-}
-
-/* Look at all texture views and figure out if any of them need to be
- * back-copied into the texture for sampling
- */
-void brw_update_texture( struct brw_screen *brw_screen,
-                        struct brw_texture *tex )
-{
-   /* currently nothing to do */
-}
-
-
-/* Create a new surface with linear layout to serve as a render-target
- * where it would be illegal (perhaps due to tiling constraints) to do
- * this in-place.
- * 
- * Currently not implmented, not sure if it's needed.
- */
-static struct brw_surface *create_linear_view( struct brw_screen *brw_screen,
-                                              struct brw_texture *tex,
-                                              union brw_surface_id id,
-                                              unsigned usage )
-{
-   return NULL;
-}
-
-
-/* Create a pipe_surface that just points directly into the existing
- * texture's storage.
- */
-static struct brw_surface *create_in_place_view( struct brw_screen *brw_screen,
-                                                 struct brw_texture *tex,
-                                                 union brw_surface_id id,
-                                                 unsigned usage )
-{
-   struct brw_surface *surface;
-
-   surface = CALLOC_STRUCT(brw_surface);
-   if (surface == NULL)
-      return NULL;
-
-   pipe_reference_init(&surface->base.reference, 1);
-
-   /* XXX: ignoring render-to-slice-of-3d-texture
-    */
-   assert(id.bits.zslice == 0);
-
-   surface->base.format = tex->b.b.format;
-   surface->base.width = u_minify(tex->b.b.width0, id.bits.level);
-   surface->base.height = u_minify(tex->b.b.height0, id.bits.level);
-   surface->base.offset = tex->image_offset[id.bits.level][id.bits.face];
-   surface->base.usage = usage;
-   surface->base.zslice = id.bits.zslice;
-   surface->base.face = id.bits.face;
-   surface->base.level = id.bits.level;
-   surface->id = id;
-   surface->cpp = tex->cpp;
-   surface->pitch = tex->pitch;
-   surface->tiling = tex->tiling;
-
-   bo_reference( &surface->bo, tex->bo );
-   pipe_resource_reference( &surface->base.texture, &tex->b.b );
-
-   surface->ss.ss0.surface_format = tex->ss.ss0.surface_format;
-   surface->ss.ss0.surface_type = BRW_SURFACE_2D;
-
-   if (tex->tiling == BRW_TILING_NONE) {
-      surface->ss.ss1.base_addr = surface->base.offset;
-   } else {
-      uint32_t tile_offset = surface->base.offset % 4096;
-
-      surface->ss.ss1.base_addr = surface->base.offset - tile_offset;
-
-      if (brw_screen->chipset.is_g4x) {
-        if (tex->tiling == BRW_TILING_X) {
-           /* Note that the low bits of these fields are missing, so
-            * there's the possibility of getting in trouble.
-            */
-           surface->ss.ss5.x_offset = (tile_offset % 512) / tex->cpp / 4;
-           surface->ss.ss5.y_offset = tile_offset / 512 / 2;
-        } else {
-           surface->ss.ss5.x_offset = (tile_offset % 128) / tex->cpp / 4;
-           surface->ss.ss5.y_offset = tile_offset / 128 / 2;
-        }
-      }
-      else {
-        assert(tile_offset == 0);
-      }
-   }
-
-#if 0
-   if (region_bo != NULL)
-      surface->ss.ss1.base_addr += region_bo->offset; /* reloc */
-#endif
-
-   surface->ss.ss2.width = surface->base.width - 1;
-   surface->ss.ss2.height = surface->base.height - 1;
-   surface->ss.ss3.tiled_surface = tex->ss.ss3.tiled_surface;
-   surface->ss.ss3.tile_walk = tex->ss.ss3.tile_walk;
-   surface->ss.ss3.pitch = tex->ss.ss3.pitch;
-
-   return surface;
-}
-
-/* Get a surface which is view into a texture 
- */
-static struct pipe_surface *brw_get_tex_surface(struct pipe_screen *screen,
-                                               struct pipe_resource *pt,
-                                               unsigned face, unsigned level,
-                                               unsigned zslice,
-                                               unsigned usage )
-{
-   struct brw_texture *tex = brw_texture(pt);
-   struct brw_screen *bscreen = brw_screen(screen);
-   struct brw_surface *surface;
-   union brw_surface_id id;
-   int type;
-
-   id.bits.face = face;
-   id.bits.level = level;
-   id.bits.zslice = zslice;
-
-   if (need_linear_view(bscreen, tex, id, usage)) 
-      type = BRW_VIEW_LINEAR;
-   else
-      type = BRW_VIEW_IN_PLACE;
-
-   
-   foreach (surface, &tex->views[type]) {
-      if (id.value == surface->id.value)
-        return &surface->base;
-   }
-
-   switch (type) {
-   case BRW_VIEW_LINEAR:
-      surface = create_linear_view( bscreen, tex, id, usage );
-      break;
-   case BRW_VIEW_IN_PLACE:
-      surface = create_in_place_view( bscreen, tex, id, usage );
-      break;
-   }
-
-   insert_at_head( &tex->views[type], surface );
-   return &surface->base;
-}
-
-
-static void brw_tex_surface_destroy( struct pipe_surface *surf )
-{
-   struct brw_surface *surface = brw_surface(surf);
-
-   /* Unreference texture, shared buffer:
-    */
-   remove_from_list(surface);
-   bo_reference(&surface->bo, NULL);
-   pipe_resource_reference( &surface->base.texture, NULL );
-
-
-   FREE(surface);
-}
-
-
-void brw_screen_tex_surface_init( struct brw_screen *brw_screen )
-{
-   brw_screen->base.get_tex_surface = brw_get_tex_surface;
-   brw_screen->base.tex_surface_destroy = brw_tex_surface_destroy;
-}
index 497634ec9ed8111951502c57b4ba937f2f97ba34..901c3341642f105c18a214b4a9a9a30cf95761f6 100644 (file)
@@ -161,7 +161,7 @@ static void do_flatshade_triangle( struct brw_sf_compile *c )
    if (c->key.primitive == SF_UNFILLED_TRIS)
       return;
 
-   if (BRW_IS_IGDNG(p->brw))
+   if (p->brw->gen == 5)
        jmpi = 2;
 
    brw_push_insn_state(p);
@@ -205,7 +205,7 @@ static void do_flatshade_line( struct brw_sf_compile *c )
    if (c->key.primitive == SF_UNFILLED_TRIS)
       return;
 
-   if (BRW_IS_IGDNG(p->brw))
+   if (p->brw->gen == 5)
        jmpi = 2;
 
    brw_push_insn_state(p);
index 6c299a86b4986a0f2d5a793ff4348df0a229f377..eec024650ce1362dc7b6c610faccedb4381aca10 100644 (file)
@@ -148,7 +148,7 @@ sf_unit_create_from_key(struct brw_context *brw,
 
    sf.thread3.dispatch_grf_start_reg = 3;
 
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
        sf.thread3.urb_entry_read_offset = 3;
    else
        sf.thread3.urb_entry_read_offset = 1;
@@ -161,7 +161,7 @@ sf_unit_create_from_key(struct brw_context *brw,
    /* Each SF thread produces 1 PUE, and there can be up to 24(Pre-IGDNG) or 
     * 48(IGDNG) threads 
     */
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
       chipset_max_threads = 48;
    else
       chipset_max_threads = 24;
index d2bbd0123d1192ffe7013ba92513ba0ba40be893..380d511f9bbc87545b5289bbf921af31a16051a7 100644 (file)
@@ -56,7 +56,7 @@ const struct brw_tracked_state brw_clip_prog;
 const struct brw_tracked_state brw_clip_unit;
 const struct brw_tracked_state brw_curbe_buffer;
 const struct brw_tracked_state brw_curbe_offsets;
-const struct brw_tracked_state brw_invarient_state;
+const struct brw_tracked_state brw_invariant_state;
 const struct brw_tracked_state brw_gs_prog;
 const struct brw_tracked_state brw_gs_unit;
 const struct brw_tracked_state brw_line_stipple;
index f8b91eff816709cb65420b9e719e55bb9c3aa32c..cdbf270e06a7e7e056e29811fd78f642269559aa 100644 (file)
@@ -69,7 +69,7 @@ const struct brw_tracked_state *atoms[] =
 
    /* Command packets:
     */
-   &brw_invarient_state,
+   &brw_invariant_state,
    &brw_state_base_address,
 
    &brw_binding_table_pointers,
index e97ddeb5e1cf729759b39afccc7e71c2e817b55a..b0d75b4f828290b8478dbf24eee8b1423a2925e9 100644 (file)
@@ -279,7 +279,7 @@ struct brw_aa_line_parameters
    struct header header;
 
    struct {
-      GLuint aa_coverage_scope:8;
+      GLuint aa_coverage_slope:8;
       GLuint pad0:8;
       GLuint aa_coverage_bias:8;
       GLuint pad1:8;
@@ -659,7 +659,105 @@ struct brw_clip_unit_state
    GLfloat viewport_ymax;  
 };
 
+struct gen6_blend_state
+{
+   struct {
+      GLuint dest_blend_factor:5;
+      GLuint source_blend_factor:5;
+      GLuint pad3:1;
+      GLuint blend_func:3;
+      GLuint pad2:1;
+      GLuint ia_dest_blend_factor:5;
+      GLuint ia_source_blend_factor:5;
+      GLuint pad1:1;
+      GLuint ia_blend_func:3;
+      GLuint pad0:1;
+      GLuint ia_blend_enable:1;
+      GLuint blend_enable:1;
+   } blend0;
+
+   struct {
+      GLuint post_blend_clamp_enable:1;
+      GLuint pre_blend_clamp_enable:1;
+      GLuint clamp_range:2;
+      GLuint pad0:4;
+      GLuint x_dither_offset:2;
+      GLuint y_dither_offset:2;
+      GLuint dither_enable:1;
+      GLuint alpha_test_func:3;
+      GLuint alpha_test_enable:1;
+      GLuint pad1:1;
+      GLuint logic_op_func:4;
+      GLuint logic_op_enable:1;
+      GLuint pad2:1;
+      GLuint write_disable_b:1;
+      GLuint write_disable_g:1;
+      GLuint write_disable_r:1;
+      GLuint write_disable_a:1;
+      GLuint pad3:1;
+      GLuint alpha_to_coverage_dither:1;
+      GLuint alpha_to_one:1;
+      GLuint alpha_to_coverage:1;
+   } blend1;
+};
 
+struct gen6_color_calc_state
+{
+   struct {
+      GLuint alpha_test_format:1;
+      GLuint pad0:14;
+      GLuint round_disable:1;
+      GLuint bf_stencil_ref:8;
+      GLuint stencil_ref:8;
+   } cc0;
+
+   union {
+      GLfloat alpha_ref_f;
+      struct {
+        GLuint ui:8;
+        GLuint pad0:24;
+      } alpha_ref_fi;
+   } cc1;
+
+   GLfloat constant_r;
+   GLfloat constant_g;
+   GLfloat constant_b;
+   GLfloat constant_a;
+};
+
+struct gen6_depth_stencil_state
+{
+   struct {
+      GLuint pad0:3;
+      GLuint bf_stencil_pass_depth_pass_op:3;
+      GLuint bf_stencil_pass_depth_fail_op:3;
+      GLuint bf_stencil_fail_op:3;
+      GLuint bf_stencil_func:3;
+      GLuint bf_stencil_enable:1;
+      GLuint pad1:2;
+      GLuint stencil_write_enable:1;
+      GLuint stencil_pass_depth_pass_op:3;
+      GLuint stencil_pass_depth_fail_op:3;
+      GLuint stencil_fail_op:3;
+      GLuint stencil_func:3;
+      GLuint stencil_enable:1;
+   } ds0;
+
+   struct {
+      GLuint bf_stencil_write_mask:8;
+      GLuint bf_stencil_test_mask:8;
+      GLuint stencil_write_mask:8;
+      GLuint stencil_test_mask:8;
+   } ds1;
+
+   struct {
+      GLuint pad0:26;
+      GLuint depth_write_enable:1;
+      GLuint depth_test_func:3;
+      GLuint pad1:1;
+      GLuint depth_test_enable:1;
+   } ds2;
+};
 
 struct brw_cc_unit_state
 {
@@ -814,6 +912,13 @@ struct brw_sf_unit_state
 
 };
 
+struct gen6_scissor_rect
+{
+   GLuint xmin:16;
+   GLuint ymin:16;
+   GLuint xmax:16;
+   GLuint ymax:16;
+};
 
 struct brw_gs_unit_state
 {
@@ -825,7 +930,7 @@ struct brw_gs_unit_state
    struct
    {
       GLuint pad0:8;
-      GLuint rendering_enable:1; /* for IGDNG */
+      GLuint rendering_enable:1; /* for Ironlake */
       GLuint pad4:1;
       GLuint stats_enable:1; 
       GLuint nr_urb_entries:7; 
@@ -935,7 +1040,7 @@ struct brw_wm_unit_state
    GLfloat global_depth_offset_constant;  
    GLfloat global_depth_offset_scale;   
    
-   /* for IGDNG only */
+   /* for Ironlake only */
    struct {
       GLuint pad0:1;
       GLuint grf_reg_count_1:3; 
@@ -962,6 +1067,15 @@ struct brw_sampler_default_color {
    GLfloat color[4];
 };
 
+struct gen5_sampler_default_color {
+   uint8_t ub[4];
+   float f[4];
+   uint16_t hf[4];
+   uint16_t us[4];
+   int16_t s[4];
+   uint8_t b[4];
+};
+
 struct brw_sampler_state
 {
    
@@ -973,7 +1087,7 @@ struct brw_sampler_state
       GLuint mag_filter:3; 
       GLuint mip_filter:2; 
       GLuint base_level:5; 
-      GLuint pad:1;
+      GLuint min_mag_neq:1;
       GLuint lod_preclamp:1; 
       GLuint default_color_mode:1; 
       GLuint pad0:1;
@@ -985,7 +1099,8 @@ struct brw_sampler_state
       GLuint r_wrap_mode:3; 
       GLuint t_wrap_mode:3; 
       GLuint s_wrap_mode:3; 
-      GLuint pad:3;
+      GLuint cube_control_mode:1;
+      GLuint pad:2;
       GLuint max_lod:10; 
       GLuint min_lod:10; 
    } ss1;
@@ -999,7 +1114,9 @@ struct brw_sampler_state
    
    struct brw_ss3
    {
-      GLuint pad:19;
+      GLuint non_normalized_coord:1;
+      GLuint pad:12;
+      GLuint address_round:6;
       GLuint max_aniso:3; 
       GLuint chroma_key_mode:1; 
       GLuint chroma_key_index:2; 
@@ -1044,6 +1161,15 @@ struct brw_sf_viewport
    } scissor;
 };
 
+struct gen6_sf_viewport {
+   GLfloat m00;
+   GLfloat m11;
+   GLfloat m22;
+   GLfloat m30;
+   GLfloat m31;
+   GLfloat m32;
+};
+
 /* Documented in the subsystem/shared-functions/sampler chapter...
  */
 struct brw_surface_state
@@ -1055,7 +1181,12 @@ struct brw_surface_state
       GLuint cube_neg_y:1; 
       GLuint cube_pos_x:1; 
       GLuint cube_neg_x:1; 
-      GLuint pad:4;
+      GLuint pad:2;
+      /* Required on gen6 for surfaces accessed through render cache messages.
+       */
+      GLuint render_cache_read_write:1;
+      /* Ironlake and newer: instead of replicating one of the texels */
+      GLuint cube_corner_average:1;
       GLuint mipmap_layout_mode:1; 
       GLuint vert_line_stride_ofs:1; 
       GLuint vert_line_stride:1; 
@@ -1202,7 +1333,8 @@ struct brw_instruction
       GLuint predicate_inverse:1;
       GLuint execution_size:3;
       GLuint destreg__conditionalmod:4; /* destreg - send, conditionalmod - others */
-      GLuint pad0:2;
+      GLuint acc_wr_control:1;
+      GLuint cmpt_control:1;
       GLuint debug_control:1;
       GLuint saturate:1;
    } header;
@@ -1250,7 +1382,7 @@ struct brw_instruction
         GLuint dest_writemask:4;
         GLuint dest_subreg_nr:1;
         GLuint dest_reg_nr:8;
-        GLuint pad1:2;
+        GLuint dest_horiz_stride:2;
         GLuint dest_address_mode:1;
       } da16;
 
@@ -1264,9 +1396,21 @@ struct brw_instruction
         GLuint dest_writemask:4;
         GLint dest_indirect_offset:6;
         GLuint dest_subreg_nr:3;
-        GLuint pad1:2;
+        GLuint dest_horiz_stride:2;
         GLuint dest_address_mode:1;
       } ia16;
+
+      struct {
+        GLuint dest_reg_file:2;
+        GLuint dest_reg_type:3;
+        GLuint src0_reg_file:2;
+        GLuint src0_reg_type:3;
+        GLuint src1_reg_file:2;
+        GLuint src1_reg_type:3;
+        GLuint pad:1;
+
+        GLint jump_count:16;
+      } branch_gen6;
    } bits1;
 
 
@@ -1339,7 +1483,7 @@ struct brw_instruction
            GLuint end_of_thread:1;
            GLuint pad1:1;
            GLuint sfid:4;
-       } send_igdng;  /* for IGDNG only */
+       } send_gen5;  /* for Ironlake only */
 
    } bits2;
 
@@ -1413,6 +1557,21 @@ struct brw_instruction
         GLuint  pad0:12;
       } if_else;
 
+      struct
+      {
+        /* Signed jump distance to the ip to jump to if all channels
+         * are disabled after the break or continue.  It should point
+         * to the end of the innermost control flow block, as that's
+         * where some channel could get re-enabled.
+         */
+        int jip:16;
+
+        /* Signed jump distance to the location to resume execution
+         * of this channel if it's enabled for the break or continue.
+         */
+        int uip:16;
+      } break_cont;
+
       struct {
         GLuint function:4;
         GLuint int_type:1;
@@ -1440,7 +1599,7 @@ struct brw_instruction
         GLuint msg_length:4;
         GLuint pad1:2;
         GLuint end_of_thread:1;
-      } math_igdng;
+      } math_gen5;
 
       struct {
         GLuint binding_table_index:8;
@@ -1476,7 +1635,7 @@ struct brw_instruction
         GLuint msg_length:4;
         GLuint pad1:2;
         GLuint end_of_thread:1;
-      } sampler_igdng;
+      } sampler_gen5;
 
       struct brw_urb_immediate urb;
 
@@ -1494,7 +1653,7 @@ struct brw_instruction
         GLuint msg_length:4;
         GLuint pad1:2;
         GLuint end_of_thread:1;
-      } urb_igdng;
+      } urb_gen5;
 
       struct {
         GLuint binding_table_index:8;
@@ -1508,6 +1667,18 @@ struct brw_instruction
         GLuint end_of_thread:1;
       } dp_read;
 
+      struct {
+        GLuint binding_table_index:8;
+        GLuint msg_control:3;
+        GLuint msg_type:3;
+        GLuint target_cache:2;
+        GLuint response_length:4;
+        GLuint msg_length:4;
+        GLuint msg_target:4;
+        GLuint pad1:3;
+        GLuint end_of_thread:1;
+      } dp_read_g4x;
+
       struct {
         GLuint binding_table_index:8;
         GLuint msg_control:3;  
@@ -1519,7 +1690,7 @@ struct brw_instruction
         GLuint msg_length:4;
         GLuint pad1:2;
         GLuint end_of_thread:1;
-      } dp_read_igdng;
+      } dp_read_gen5;
 
       struct {
         GLuint binding_table_index:8;
@@ -1546,10 +1717,38 @@ struct brw_instruction
         GLuint msg_length:4;
         GLuint pad1:2;
         GLuint end_of_thread:1;
-      } dp_write_igdng;
+      } dp_write_gen5;
+
+      /* Sandybridge DP for sample cache, constant cache, render cache */
+      struct {
+        GLuint binding_table_index:8;
+        GLuint msg_control:5;
+        GLuint msg_type:3;
+        GLuint pad0:3;
+        GLuint header_present:1;
+        GLuint response_length:5;
+        GLuint msg_length:4;
+        GLuint pad1:2;
+        GLuint end_of_thread:1;
+      } dp_sampler_const_cache;
+
+      struct {
+        GLuint binding_table_index:8;
+        GLuint msg_control:3;
+        GLuint slot_group_select:1;
+        GLuint pixel_scoreboard_clear:1;
+        GLuint msg_type:4;
+        GLuint send_commit_msg:1;
+        GLuint pad0:1;
+        GLuint header_present:1;
+        GLuint response_length:5;
+        GLuint msg_length:4;
+        GLuint pad1:2;
+        GLuint end_of_thread:1;
+      } dp_render_cache;
 
       struct {
-        GLuint pad:16;
+        GLuint function_control:16;
         GLuint response_length:4;
         GLuint msg_length:4;
         GLuint msg_target:4;
@@ -1557,14 +1756,15 @@ struct brw_instruction
         GLuint end_of_thread:1;
       } generic;
 
+      /* Of this struct, only end_of_thread is not present for gen6. */
       struct {
-        GLuint pad:19;
+        GLuint function_control:19;
         GLuint header_present:1;
         GLuint response_length:5;
         GLuint msg_length:4;
         GLuint pad1:2;
         GLuint end_of_thread:1;
-      } generic_igdng;
+      } generic_gen5;
 
       GLint d;
       GLuint ud;
index cd40fc6d618df479aeabdc03572bbe9e1f688855..f3de2f995b31405fa918ff827ef2f3c93d779ab6 100644 (file)
@@ -72,7 +72,7 @@ brw_dump_aa_line_parameters(const struct brw_aa_line_parameters *ptr)
 {
    debug_printf("\t\t.header.length = 0x%x\n", (*ptr).header.length);
    debug_printf("\t\t.header.opcode = 0x%x\n", (*ptr).header.opcode);
-   debug_printf("\t\t.bits0.aa_coverage_scope = 0x%x\n", (*ptr).bits0.aa_coverage_scope);
+   debug_printf("\t\t.bits0.aa_coverage_scope = 0x%x\n", (*ptr).bits0.aa_coverage_slope);
    debug_printf("\t\t.bits0.aa_coverage_bias = 0x%x\n", (*ptr).bits0.aa_coverage_bias);
    debug_printf("\t\t.bits1.aa_coverage_endcap_slope = 0x%x\n", (*ptr).bits1.aa_coverage_endcap_slope);
    debug_printf("\t\t.bits1.aa_coverage_endcap_bias = 0x%x\n", (*ptr).bits1.aa_coverage_endcap_bias);
index 907ec56c6ca4cec9af658ff6130deb0d261c9083..b630752809ec01dbb358723ce7c8c65fe9ffa743 100644 (file)
@@ -147,7 +147,7 @@ static int recalculate_urb_fence( struct brw_context *brw )
 
       brw->urb.constrained = 0;
 
-      if (BRW_IS_IGDNG(brw)) {
+      if (brw->gen == 5) {
          brw->urb.nr_vs_entries = 128;
          brw->urb.nr_sf_entries = 48;
          if (check_urb_layout(brw)) {
@@ -157,7 +157,7 @@ static int recalculate_urb_fence( struct brw_context *brw )
             brw->urb.nr_vs_entries = limits[VS].preferred_nr_entries;
             brw->urb.nr_sf_entries = limits[SF].preferred_nr_entries;
          }
-      } else if (BRW_IS_G4X(brw)) {
+      } else if (brw->is_g4x) {
         brw->urb.nr_vs_entries = 64;
         if (check_urb_layout(brw)) {
            goto done;
index 944d88c84cc8028157922539fc8d157a5c0c0857..b6d1091618ed5c31d039328efcf523026211ff53 100644 (file)
@@ -56,7 +56,6 @@ struct brw_vs_compile {
    struct brw_compile func;
    struct brw_vs_prog_key key;
    struct brw_vs_prog_data prog_data;
-   struct brw_chipset chipset;
 
    struct brw_vertex_shader *vp;
 
index 5dcbd597ddcaf1860c3efada8a98d5e10ad02592..559f0c61d8dd0a9e3a95d90872ea7f40550c697b 100644 (file)
@@ -116,6 +116,7 @@ static boolean find_output_slot( struct brw_vs_compile *c,
  */
 static void brw_vs_alloc_regs( struct brw_vs_compile *c )
 {
+   struct brw_context *brw = c->func.brw;
    GLuint i, reg = 0, subreg = 0, mrf;
    int attributes_in_vue;
 
@@ -218,7 +219,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
     */
    c->nr_outputs = c->prog_data.nr_outputs;
 
-   if (c->chipset.is_igdng)
+   if (brw->gen == 5)
       mrf = 8;
    else
       mrf = 4;
@@ -333,7 +334,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
     */
    attributes_in_vue = MAX2(c->nr_outputs, c->nr_inputs);
 
-   if (c->chipset.is_igdng)
+   if (brw->gen == 5)
       c->prog_data.urb_entry_size = (attributes_in_vue + 6 + 3) / 4;
    else
       c->prog_data.urb_entry_size = (attributes_in_vue + 2 + 3) / 4;
@@ -1124,6 +1125,7 @@ static struct brw_reg get_dst( struct brw_vs_compile *c,
 static void emit_vertex_write( struct brw_vs_compile *c)
 {
    struct brw_compile *p = &c->func;
+   struct brw_context *brw = p->brw;
    struct brw_reg m0 = brw_message_reg(0);
    struct brw_reg pos = c->regs[TGSI_FILE_OUTPUT][VERT_RESULT_HPOS];
    struct brw_reg ndc;
@@ -1143,7 +1145,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
     */
    if (c->prog_data.writes_psiz ||
        c->key.nr_userclip || 
-       c->chipset.is_965)
+       brw->has_negative_rhw_bug)
    {
       struct brw_reg header1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
       GLuint i;
@@ -1174,7 +1176,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
        * Later, clipping will detect ucp[6] and ensure the primitive is
        * clipped against all fixed planes.
        */
-      if (c->chipset.is_965) {
+      if (brw->has_negative_rhw_bug) {
         brw_CMP(p,
                 vec8(brw_null_reg()),
                 BRW_CONDITIONAL_L,
@@ -1202,7 +1204,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
    brw_set_access_mode(p, BRW_ALIGN_1);
    brw_MOV(p, offset(m0, 2), ndc);
 
-   if (c->chipset.is_igdng) {
+   if (brw->gen == 5) {
        /* There are 20 DWs (D0-D19) in VUE vertex header on IGDNG */
        brw_MOV(p, offset(m0, 3), pos); /* a portion of vertex header */
        /* m4, m5 contain the distances from vertex to the user clip planeXXX. 
@@ -1339,6 +1341,7 @@ static void emit_insn(struct brw_vs_compile *c,
    unsigned opcode = inst->Instruction.Opcode;
    unsigned label = inst->Label.Label;
    struct brw_compile *p = &c->func;
+   struct brw_context *brw = p->brw;
    struct brw_reg args[3], dst;
    GLuint i;
 
@@ -1514,7 +1517,7 @@ static void emit_insn(struct brw_vs_compile *c,
 
       c->loop_depth--;
 
-      if (c->chipset.is_igdng)
+      if (brw->gen == 5)
         br = 2;
 
       inst0 = inst1 = brw_WHILE(p, c->loop_inst[c->loop_depth]);
@@ -1652,6 +1655,6 @@ void brw_vs_emit(struct brw_vs_compile *c)
 
    if (BRW_DEBUG & DEBUG_VS) {
       debug_printf("vs-native:\n");
-      brw_disasm(stderr, p->store, p->nr_insn);
+      brw_disasm(stderr, p->store, p->nr_insn, p->brw->gen);
    }
 }
index dadbb622e4d80a97190c48d086366021cae9d988..6d2ccfd6d980ac5f9b7f44680c522f5acd872d88 100644 (file)
@@ -100,7 +100,7 @@ vs_unit_create_from_key(struct brw_context *brw,
     */
    vs.thread1.single_program_flow = 0;
 
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
       vs.thread1.binding_table_entry_count = 0; /* hardware requirement */
    else
       vs.thread1.binding_table_entry_count = key->nr_surfaces;
@@ -111,16 +111,16 @@ vs_unit_create_from_key(struct brw_context *brw,
    vs.thread3.urb_entry_read_offset = 0;
    vs.thread3.const_urb_entry_read_offset = key->curbe_offset * 2;
 
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
        vs.thread4.nr_urb_entries = key->nr_urb_entries >> 2;
    else
        vs.thread4.nr_urb_entries = key->nr_urb_entries;
 
    vs.thread4.urb_entry_allocation_size = key->urb_size - 1;
 
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
       chipset_max_threads = 72;
-   else if (BRW_IS_G4X(brw))
+   else if (brw->is_g4x)
       chipset_max_threads = 32;
    else
       chipset_max_threads = 16;
index a06f8bb7d6140d9e1d61111d4ea927d752355143..038f6f788a039698515b84f1be55cee54bbcd5f3 100644 (file)
@@ -148,7 +148,7 @@ static INLINE void make_reloc(struct brw_winsys_reloc *reloc,
 struct brw_winsys_screen {
 
    unsigned pci_id;
-
+   int gen;
    /**
     * Buffer functions.
     */
@@ -282,7 +282,7 @@ void brw_dump_data( unsigned pci_id,
                    enum brw_buffer_data_type data_type,
                    unsigned offset,
                    const void *data,
-                   size_t size );
+                   size_t size, int gen );
 
 
 #endif
index f8f6a539bc9d4e8efdcd6530ffc9ebd582f5ea81..b66b1cfccb69e1eb6f8d5356497743c632e6e905 100644 (file)
@@ -9,7 +9,7 @@ void brw_dump_data( unsigned pci_id,
                    enum brw_buffer_data_type data_type,
                    unsigned offset,
                    const void *data,
-                   size_t size )
+                   size_t size, int gen )
 {
    if (BRW_DUMP & DUMP_ASM) {
       switch (data_type) {
@@ -18,7 +18,7 @@ void brw_dump_data( unsigned pci_id,
       case BRW_DATA_GS_VS_PROG:
       case BRW_DATA_GS_GS_PROG:
       case BRW_DATA_GS_CLIP_PROG:
-         brw_disasm( stderr, data, size / sizeof(struct brw_instruction) );
+         brw_disasm( stderr, (struct brw_instruction *)data, size / sizeof(struct brw_instruction), gen );
          break;
       default:
          break;
@@ -77,7 +77,7 @@ void brw_dump_data( unsigned pci_id,
    if (BRW_DUMP & DUMP_BATCH) {
       switch (data_type) {
       case BRW_DATA_BATCH_BUFFER:
-         intel_decode(data, size / 4, offset, pci_id);
+         intel_decode(data, size / 4, offset, pci_id, 0);
          break;
       default:
          break;
index 8f983a60ae86fbcd3b3bc3ad261e48b232aa788e..6301062fd79015e4197fa7d0c49d02572cc5802b 100644 (file)
@@ -848,11 +848,11 @@ static void emit_tex( struct brw_wm_compile *c,
 
    responseLength = 8;         /* always */
 
-   if (BRW_IS_IGDNG(p->brw)) {
+   if (p->brw->gen == 5) {
        if (shadow)
-           msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE_IGDNG;
+           msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5;
        else
-           msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_IGDNG;
+          msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_GEN5;
    } else {
        if (shadow)
            msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE;
@@ -917,8 +917,8 @@ static void emit_txb( struct brw_wm_compile *c,
    brw_MOV(p, brw_message_reg(8), coord[3]);
    msgLength = 9;
 
-   if (BRW_IS_IGDNG(p->brw))
-       msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS_IGDNG;
+   if (p->brw->gen == 5)
+       msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5;
    else
        msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS;
 
@@ -1516,6 +1516,6 @@ void brw_wm_emit( struct brw_wm_compile *c )
 
    if (BRW_DEBUG & DEBUG_WM) {
       debug_printf("wm-native:\n");
-      brw_disasm(stderr, p->store, p->nr_insn);
+      brw_disasm(stderr, p->store, p->nr_insn, p->brw->gen);
    }
 }
index f7ee55cc1c85b03b3a37276b0155a726fe978d2a..a65e16edec09d93fea9071c5ea11a9b9beae71ff 100644 (file)
@@ -812,7 +812,7 @@ static void precalc_tex( struct brw_wm_compile *c,
    }
 
    /* XXX: add GL_EXT_texture_swizzle support to gallium -- by
-    * generating shader varients in mesa state tracker.
+    * generating shader variants in mesa state tracker.
     */
 
    /* Release this temp if we ended up allocating it:
index 3b3afc39d3c3ddbd4b835a588b9646cde597a113..fb8e40d928eb161305c5ed2a63e0e9bb91e494b8 100644 (file)
@@ -1607,7 +1607,7 @@ static void emit_txb(struct brw_wm_compile *c,
     brw_MOV(p, brw_message_reg(5), src[3]);          /* bias */
     brw_MOV(p, brw_message_reg(6), brw_imm_f(0));    /* ref (unused?) */
 
-    if (BRW_IS_IGDNG(p->brw)) {
+    if (p->brw->gen == 5) {
         msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_IGDNG;
     } else {
         /* Does it work well on SIMD8? */
@@ -1688,7 +1688,7 @@ static void emit_tex(struct brw_wm_compile *c,
        brw_MOV(p, brw_message_reg(6), src[2]);        /* ref value / R coord */
     }
 
-    if (BRW_IS_IGDNG(p->brw)) {
+    if (p->brw->gen == 5) {
         if (shadow)
             msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_COMPARE_IGDNG;
         else
@@ -1970,7 +1970,7 @@ static void brw_wm_emit_branching_shader(struct brw_context *brw, struct brw_wm_
                   struct brw_instruction *inst0, *inst1;
                   GLuint br = 1;
 
-                  if (BRW_IS_IGDNG(brw))
+                  if (brw->gen == 5)
                      br = 2;
  
                   loop_depth--;
index efc2d96be135a60427fc37ac5ec4310bee04de68..a690003ecbd466cb7edcf54958ed8e182b233064 100644 (file)
@@ -70,9 +70,9 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
       key->max_threads = 1;
    else {
       /* WM maximum threads is number of EUs times number of threads per EU. */
-      if (BRW_IS_IGDNG(brw))
+      if (brw->gen == 5)
          key->max_threads = 12 * 6;
-      else if (BRW_IS_G4X(brw))
+      else if (brw->is_g4x)
         key->max_threads = 10 * 5;
       else
         key->max_threads = 8 * 4;
@@ -155,7 +155,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
    wm.thread1.depth_coef_urb_read_offset = 1;
    wm.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754;
 
-   if (BRW_IS_IGDNG(brw))
+   if (brw->gen == 5)
       wm.thread1.binding_table_entry_count = 0; /* hardware requirement */
    else
       wm.thread1.binding_table_entry_count = key->nr_surfaces;
@@ -174,7 +174,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
    wm.thread3.const_urb_entry_read_length = key->curb_entry_read_length;
    wm.thread3.const_urb_entry_read_offset = key->curbe_offset * 2;
 
-   if (BRW_IS_IGDNG(brw)
+   if (brw->gen == 5
       wm.wm4.sampler_count = 0; /* hardware requirement */
    else
       wm.wm4.sampler_count = (key->sampler_count + 1) / 4;
@@ -277,7 +277,7 @@ static enum pipe_error upload_wm_unit( struct brw_context *brw )
    grf_reg_count = (align(key.total_grf, 16) / 16 - 1);
    per_thread_scratch_space = key.total_scratch / 1024 - 1;
    stats_enable = (BRW_DEBUG & DEBUG_STATS) || key.stats_wm;
-   sampler_count = BRW_IS_IGDNG(brw) ? 0 :(key.sampler_count + 1) / 4;
+   sampler_count = brw->gen == 5 ? 0 :(key.sampler_count + 1) / 4;
 
    /* Emit WM program relocation */
    make_reloc(&reloc[nr_reloc++],
index 36c04a31655fab79c157492f3668b550f0850324..1abe869f1aebb8511f0e8e74bf742e63707d362b 100644 (file)
 
 #include "util/u_memory.h"
 #include "util/u_string.h"
+
 #include "intel_decode.h"
+#include "brw_reg.h"
 
 /*#include "intel_chipset.h"*/
-#define IS_965(x) 1             /* XXX */
 #define IS_9XX(x) 1             /* XXX */
 
 #define BUFFER_FAIL(_count, _len, _name) do {                  \
@@ -99,10 +100,11 @@ decode_mi(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
     } opcodes_mi[] = {
        { 0x08, 0, 1, 1, "MI_ARB_ON_OFF" },
        { 0x0a, 0, 1, 1, "MI_BATCH_BUFFER_END" },
+       { 0x30, 0x3f, 3, 3, "MI_BATCH_BUFFER" },
        { 0x31, 0x3f, 2, 2, "MI_BATCH_BUFFER_START" },
        { 0x14, 0x3f, 3, 3, "MI_DISPLAY_BUFFER_INFO" },
        { 0x04, 0, 1, 1, "MI_FLUSH" },
-       { 0x22, 0, 3, 3, "MI_LOAD_REGISTER_IMM" },
+       { 0x22, 0x1f, 3, 3, "MI_LOAD_REGISTER_IMM" },
        { 0x13, 0x3f, 2, 2, "MI_LOAD_SCAN_LINES_EXCL" },
        { 0x12, 0x3f, 2, 2, "MI_LOAD_SCAN_LINES_INCL" },
        { 0x00, 0, 1, 1, "MI_NOOP" },
@@ -116,6 +118,11 @@ decode_mi(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
        { 0x03, 0, 1, 1, "MI_WAIT_FOR_EVENT" },
     };
 
+    switch ((data[0] & 0x1f800000) >> 23) {
+    case 0x0a:
+       instr_out(data, hw_offset, 0, "MI_BATCH_BUFFER_END\n");
+       return -1;
+    }
 
     for (opcode = 0; opcode < Elements(opcodes_mi); opcode++) {
        if ((data[0] & 0x1f800000) >> 23 == opcodes_mi[opcode].opcode) {
@@ -308,9 +315,13 @@ decode_2d(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
 static int
 decode_3d_1c(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
 {
-    switch ((data[0] & 0x00f80000) >> 19) {
+    uint32_t opcode;
+
+    opcode = (data[0] & 0x00f80000) >> 19;
+
+    switch (opcode) {
     case 0x11:
-       instr_out(data, hw_offset, 0, "3DSTATE_DEPTH_SUBRECTANGLE_DISALBE\n");
+       instr_out(data, hw_offset, 0, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE\n");
        return 1;
     case 0x10:
        instr_out(data, hw_offset, 0, "3DSTATE_SCISSOR_ENABLE\n");
@@ -326,7 +337,8 @@ decode_3d_1c(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
        return 1;
     }
 
-    instr_out(data, hw_offset, 0, "3D UNKNOWN\n");
+    instr_out(data, hw_offset, 0, "3D UNKNOWN: 3d_1c opcode = 0x%x\n",
+             opcode);
     (*failures)++;
     return 1;
 }
@@ -384,7 +396,7 @@ i915_get_instruction_dst(const uint32_t *data, int i, char *dstname, int do_mask
        sprintf(dstname, "oD%s%s",  dstmask, sat);
        break;
     case 6:
-       if (dst_nr > 2)
+       if (dst_nr > 3)
            fprintf(out, "bad destination reg U%d\n", dst_nr);
        sprintf(dstname, "U%d%s%s", dst_nr, dstmask, sat);
        break;
@@ -455,7 +467,7 @@ i915_get_instruction_src_name(uint32_t src_type, uint32_t src_nr, char *name)
        break;
     case 6:
        sprintf(name, "U%d", src_nr);
-       if (src_nr > 2)
+       if (src_nr > 3)
            fprintf(out, "bad src reg %s\n", name);
        break;
     default:
@@ -800,10 +812,14 @@ i915_decode_instruction(const uint32_t *data, uint32_t hw_offset,
 }
 
 static int
-decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures, int i830)
+decode_3d_1d(const uint32_t *data, int count,
+            uint32_t hw_offset,
+            uint32_t devid,
+            int *failures)
 {
-    unsigned int len, i, c, opcode, word, map, sampler, instr;
+    unsigned int len, i, c, idx, word, map, sampler, instr;
     char *format;
+    uint32_t opcode;
 
     struct {
        uint32_t opcode;
@@ -814,7 +830,7 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
     } opcodes_3d_1d[] = {
        { 0x8e, 0, 3, 3, "3DSTATE_BUFFER_INFO" },
        { 0x86, 0, 4, 4, "3DSTATE_CHROMA_KEY" },
-       { 0x9c, 0, 1, 1, "3DSTATE_CLEAR_PARAMETERS" },
+       { 0x9c, 0, 7, 7, "3DSTATE_CLEAR_PARAMETERS" },
        { 0x88, 0, 2, 2, "3DSTATE_CONSTANT_BLEND_COLOR" },
        { 0x99, 0, 2, 2, "3DSTATE_DEFAULT_DIFFUSE" },
        { 0x9a, 0, 2, 2, "3DSTATE_DEFAULT_SPECULAR" },
@@ -822,7 +838,6 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
        { 0x97, 0, 2, 2, "3DSTATE_DEPTH_OFFSET_SCALE" },
        { 0x85, 0, 2, 2, "3DSTATE_DEST_BUFFER_VARIABLES" },
        { 0x80, 0, 5, 5, "3DSTATE_DRAWING_RECTANGLE" },
-       { 0x8e, 0, 3, 3, "3DSTATE_BUFFER_INFO" },
        { 0x9d, 0, 65, 65, "3DSTATE_FILTER_COEFFICIENTS_4X4" },
        { 0x9e, 0, 4, 4, "3DSTATE_MONO_FILTER" },
        { 0x89, 0, 4, 4, "3DSTATE_FOG_MODE" },
@@ -834,9 +849,11 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
        { 0x8d, 1, 3, 3, "3DSTATE_W_STATE_I830" },
        { 0x01, 1, 2, 2, "3DSTATE_COLOR_FACTOR_I830" },
        { 0x02, 1, 2, 2, "3DSTATE_MAP_COORD_SETBIND_I830" },
-    };
+    }, *opcode_3d_1d;
 
-    switch ((data[0] & 0x00ff0000) >> 16) {
+    opcode = (data[0] & 0x00ff0000) >> 16;
+
+    switch (opcode) {
     case 0x07:
        /* This instruction is unusual.  A 0 length means just 1 DWORD instead of
         * 2.  The 0 length is specified in one place to be unsupported, but
@@ -891,26 +908,56 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
        instr_out(data, hw_offset, 0, "3DSTATE_LOAD_STATE_IMMEDIATE_1\n");
        len = (data[0] & 0x0000000f) + 2;
        i = 1;
-       for (word = 0; word <= 7; word++) {
+       for (word = 0; word <= 8; word++) {
            if (data[0] & (1 << (4 + word))) {
                if (i >= count)
                    BUFFER_FAIL(count, len, "3DSTATE_LOAD_STATE_IMMEDIATE_1");
 
                /* save vertex state for decode */
-               if (word == 2) {
-                   saved_s2_set = 1;
-                   saved_s2 = data[i];
-               }
-               if (word == 4) {
-                   saved_s4_set = 1;
-                   saved_s4 = data[i];
+               if (IS_9XX(devid)) {
+                   if (word == 2) {
+                       saved_s2_set = 1;
+                       saved_s2 = data[i];
+                   }
+                   if (word == 4) {
+                       saved_s4_set = 1;
+                       saved_s4 = data[i];
+                   }
                }
 
                instr_out(data, hw_offset, i++, "S%d\n", word);
            }
        }
        if (len != i) {
-           fprintf(out, "Bad count in 3DSTATE_LOAD_INDIRECT\n");
+           fprintf(out, "Bad count in 3DSTATE_LOAD_STATE_IMMEDIATE_1\n");
+           (*failures)++;
+       }
+       return len;
+    case 0x03:
+       instr_out(data, hw_offset, 0, "3DSTATE_LOAD_STATE_IMMEDIATE_2\n");
+       len = (data[0] & 0x0000000f) + 2;
+       i = 1;
+       for (word = 6; word <= 14; word++) {
+           if (data[0] & (1 << word)) {
+               if (i >= count)
+                   BUFFER_FAIL(count, len, "3DSTATE_LOAD_STATE_IMMEDIATE_2");
+
+               if (word == 6)
+                   instr_out(data, hw_offset, i++, "TBCF\n");
+               else if (word >= 7 && word <= 10) {
+                   instr_out(data, hw_offset, i++, "TB%dC\n", word - 7);
+                   instr_out(data, hw_offset, i++, "TB%dA\n", word - 7);
+               } else if (word >= 11 && word <= 14) {
+                   instr_out(data, hw_offset, i++, "TM%dS0\n", word - 11);
+                   instr_out(data, hw_offset, i++, "TM%dS1\n", word - 11);
+                   instr_out(data, hw_offset, i++, "TM%dS2\n", word - 11);
+                   instr_out(data, hw_offset, i++, "TM%dS3\n", word - 11);
+                   instr_out(data, hw_offset, i++, "TM%dS4\n", word - 11);
+               }
+           }
+       }
+       if (len != i) {
+           fprintf(out, "Bad count in 3DSTATE_LOAD_STATE_IMMEDIATE_2\n");
            (*failures)++;
        }
        return len;
@@ -922,11 +969,27 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
        i = 2;
        for (map = 0; map <= 15; map++) {
            if (data[1] & (1 << map)) {
+               int width, height, pitch, dword;
+               const char *tiling;
+
                if (i + 3 >= count)
                    BUFFER_FAIL(count, len, "3DSTATE_MAP_STATE");
                instr_out(data, hw_offset, i++, "map %d MS2\n", map);
-               instr_out(data, hw_offset, i++, "map %d MS3\n", map);
-               instr_out(data, hw_offset, i++, "map %d MS4\n", map);
+
+               dword = data[i];
+               width = ((dword >> 10) & ((1 << 11) - 1))+1;
+               height = ((dword >> 21) & ((1 << 11) - 1))+1;
+
+               tiling = "none";
+               if (dword & (1 << 2))
+                       tiling = "fenced";
+               else if (dword & (1 << 1))
+                       tiling = dword & (1 << 0) ? "Y" : "X";
+               instr_out(data, hw_offset, i++, "map %d MS3 [width=%d, height=%d, tiling=%s]\n", map, width, height, tiling);
+
+               dword = data[i];
+               pitch = 4*(((dword >> 21) & ((1 << 11) - 1))+1);
+               instr_out(data, hw_offset, i++, "map %d MS4 [pitch=%d]\n", map, pitch);
            }
        }
        if (len != i) {
@@ -982,8 +1045,8 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
        }
        return len;
     case 0x01:
-       if (i830)
-           break;
+       if (!IS_9XX(devid))
+               break;
        instr_out(data, hw_offset, 0, "3DSTATE_SAMPLER_STATE\n");
        instr_out(data, hw_offset, 1, "mask\n");
        len = (data[0] & 0x0000003f) + 2;
@@ -1034,30 +1097,61 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
                  format,
                  (data[1] & (1 << 31)) ? "en" : "dis");
        return len;
+
+    case 0x8e:
+       {
+           const char *name, *tiling;
+
+           len = (data[0] & 0x0000000f) + 2;
+           if (len != 3)
+               fprintf(out, "Bad count in 3DSTATE_BUFFER_INFO\n");
+           if (count < 3)
+               BUFFER_FAIL(count, len, "3DSTATE_BUFFER_INFO");
+
+           switch((data[1] >> 24) & 0x7) {
+           case 0x3: name = "color"; break;
+           case 0x7: name = "depth"; break;
+           default: name = "unknown"; break;
+           }
+
+           tiling = "none";
+           if (data[1] & (1 << 23))
+               tiling = "fenced";
+           else if (data[1] & (1 << 22))
+               tiling = data[1] & (1 << 21) ? "Y" : "X";
+
+           instr_out(data, hw_offset, 0, "3DSTATE_BUFFER_INFO\n");
+           instr_out(data, hw_offset, 1, "%s, tiling = %s, pitch=%d\n", name, tiling, data[1]&0xffff);
+
+           instr_out(data, hw_offset, 2, "address\n");
+           return len;
+       }
     }
 
-    for (opcode = 0; opcode < Elements(opcodes_3d_1d); opcode++) {
-       if (opcodes_3d_1d[opcode].i830_only && !i830)
+    for (idx = 0; idx < Elements(opcodes_3d_1d); idx++)
+    {
+       opcode_3d_1d = &opcodes_3d_1d[idx];
+       if (opcode_3d_1d->i830_only && IS_9XX(devid))
            continue;
 
-       if (((data[0] & 0x00ff0000) >> 16) == opcodes_3d_1d[opcode].opcode) {
+       if (((data[0] & 0x00ff0000) >> 16) == opcode_3d_1d->opcode) {
            len = 1;
 
-           instr_out(data, hw_offset, 0, "%s\n", opcodes_3d_1d[opcode].name);
-           if (opcodes_3d_1d[opcode].max_len > 1) {
+           instr_out(data, hw_offset, 0, "%s\n", opcode_3d_1d->name);
+           if (opcode_3d_1d->max_len > 1) {
                len = (data[0] & 0x0000ffff) + 2;
-               if (len < opcodes_3d_1d[opcode].min_len ||
-                   len > opcodes_3d_1d[opcode].max_len)
+               if (len < opcode_3d_1d->min_len ||
+                   len > opcode_3d_1d->max_len)
                {
                    fprintf(out, "Bad count in %s\n",
-                           opcodes_3d_1d[opcode].name);
+                           opcode_3d_1d->name);
                    (*failures)++;
                }
            }
 
            for (i = 1; i < len; i++) {
                if (i >= count)
-                   BUFFER_FAIL(count, len,  opcodes_3d_1d[opcode].name);
+                   BUFFER_FAIL(count, len,  opcode_3d_1d->name);
                instr_out(data, hw_offset, i, "dword %d\n", i);
            }
 
@@ -1065,7 +1159,7 @@ decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures,
        }
     }
 
-    instr_out(data, hw_offset, 0, "3D UNKNOWN\n");
+    instr_out(data, hw_offset, 0, "3D UNKNOWN: 3d_1d opcode = 0x%x\n", opcode);
     (*failures)++;
     return 1;
 }
@@ -1075,8 +1169,10 @@ decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
                    int *failures)
 {
     char immediate = (data[0] & (1 << 23)) == 0;
-    unsigned int len, i;
+    unsigned int len, i, ret;
     char *primtype;
+    int original_s2 = saved_s2;
+    int original_s4 = saved_s4;
 
     switch ((data[0] >> 18) & 0xf) {
     case 0x0: primtype = "TRILIST"; break;
@@ -1089,7 +1185,7 @@ decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
     case 0x7: primtype = "RECTLIST"; break;
     case 0x8: primtype = "POINTLIST"; break;
     case 0x9: primtype = "DIB"; break;
-    case 0xa: primtype = "CLEAR_RECT"; break;
+    case 0xa: primtype = "CLEAR_RECT"; saved_s4 = 3 << 6; saved_s2 = ~0; break;
     default: primtype = "unknown"; break;
     }
 
@@ -1193,6 +1289,8 @@ decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
                vertex++;
            }
        }
+
+       ret = len;
     } else {
        /* indirect vertices */
        len = data[0] & 0x0000ffff; /* index count */
@@ -1210,13 +1308,15 @@ decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
                    if ((data[i] & 0xffff) == 0xffff) {
                        instr_out(data, hw_offset, i,
                                  "            indices: (terminator)\n");
-                       return i;
+                       ret = i;
+                       goto out;
                    } else if ((data[i] >> 16) == 0xffff) {
                        instr_out(data, hw_offset, i,
                                  "            indices: 0x%04x, "
                                  "(terminator)\n",
                                  data[i] & 0xffff);
-                       return i;
+                       ret = i;
+                       goto out;
                    } else {
                        instr_out(data, hw_offset, i,
                                  "            indices: 0x%04x, 0x%04x\n",
@@ -1226,7 +1326,8 @@ decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
                fprintf(out,
                        "3DPRIMITIVE: no terminator found in index buffer\n");
                (*failures)++;
-               return count;
+               ret = count;
+               goto out;
            } else {
                /* fixed size vertex index buffer */
                for (i = 0; i < len; i += 2) {
@@ -1241,7 +1342,8 @@ decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
                    }
                }
            }
-           return (len + 1) / 2 + 1;
+           ret = (len + 1) / 2 + 1;
+           goto out;
        } else {
            /* sequential vertex access */
            if (count < 2)
@@ -1250,17 +1352,22 @@ decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
                      "3DPRIMITIVE sequential indirect %s, %d starting from "
                      "%d\n", primtype, len, data[1] & 0xffff);
            instr_out(data, hw_offset, 1, "           start\n");
-           return 2;
+           ret = 2;
+           goto out;
        }
     }
 
-    return len;
+out:
+    saved_s2 = original_s2;
+    saved_s4 = original_s4;
+    return ret;
 }
 
 static int
-decode_3d(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_3d(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int *failures)
 {
-    unsigned int opcode;
+    uint32_t opcode;
+    unsigned int idx;
 
     struct {
        uint32_t opcode;
@@ -1277,41 +1384,44 @@ decode_3d(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
        { 0x0d, 1, 1, "3DSTATE_MODES_4" },
        { 0x0c, 1, 1, "3DSTATE_MODES_5" },
        { 0x07, 1, 1, "3DSTATE_RASTERIZATION_RULES" },
-    };
+    }, *opcode_3d;
+
+    opcode = (data[0] & 0x1f000000) >> 24;
 
-    switch ((data[0] & 0x1f000000) >> 24) {
+    switch (opcode) {
     case 0x1f:
        return decode_3d_primitive(data, count, hw_offset, failures);
     case 0x1d:
-       return decode_3d_1d(data, count, hw_offset, failures, 0);
+       return decode_3d_1d(data, count, hw_offset, devid, failures);
     case 0x1c:
        return decode_3d_1c(data, count, hw_offset, failures);
     }
 
-    for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) {
-       if ((data[0] & 0x1f000000) >> 24 == opcodes_3d[opcode].opcode) {
+    for (idx = 0; idx < Elements(opcodes_3d); idx++) {
+       opcode_3d = &opcodes_3d[idx];
+       if (opcode == opcode_3d->opcode) {
            unsigned int len = 1, i;
 
-           instr_out(data, hw_offset, 0, "%s\n", opcodes_3d[opcode].name);
-           if (opcodes_3d[opcode].max_len > 1) {
+           instr_out(data, hw_offset, 0, "%s\n", opcode_3d->name);
+           if (opcode_3d->max_len > 1) {
                len = (data[0] & 0xff) + 2;
-               if (len < opcodes_3d[opcode].min_len ||
-                   len > opcodes_3d[opcode].max_len)
+               if (len < opcode_3d->min_len ||
+                   len > opcode_3d->max_len)
                {
-                   fprintf(out, "Bad count in %s\n", opcodes_3d[opcode].name);
+                   fprintf(out, "Bad count in %s\n", opcode_3d->name);
                }
            }
 
            for (i = 1; i < len; i++) {
                if (i >= count)
-                   BUFFER_FAIL(count, len, opcodes_3d[opcode].name);
+                   BUFFER_FAIL(count, len, opcode_3d->name);
                instr_out(data, hw_offset, i, "dword %d\n", i);
            }
            return len;
        }
     }
 
-    instr_out(data, hw_offset, 0, "3D UNKNOWN\n");
+    instr_out(data, hw_offset, 0, "3D UNKNOWN: 3d opcode = 0x%x\n", opcode);
     (*failures)++;
     return 1;
 }
@@ -1401,12 +1511,87 @@ get_965_prim_type(uint32_t data)
     default: return "fail";
     }
 }
+static int
+i965_decode_urb_fence(const uint32_t *data, uint32_t hw_offset, int len, int count,
+                     int *failures)
+{
+       uint32_t vs_fence, clip_fence, gs_fence, sf_fence, vfe_fence, cs_fence;
+
+       if (len != 3)
+           fprintf(out, "Bad count in URB_FENCE\n");
+       if (count < 3)
+           BUFFER_FAIL(count, len, "URB_FENCE");
+
+       vs_fence = data[1] & 0x3ff;
+       gs_fence = (data[1] >> 10) & 0x3ff;
+       clip_fence = (data[1] >> 20) & 0x3ff;
+       sf_fence = data[2] & 0x3ff;
+       vfe_fence = (data[2] >> 10) & 0x3ff;
+       cs_fence = (data[2] >> 20) & 0x7ff;
+
+       instr_out(data, hw_offset, 0, "URB_FENCE: %s%s%s%s%s%s\n",
+                       (data[0] >> 13) & 1 ? "cs " : "",
+                       (data[0] >> 12) & 1 ? "vfe " : "",
+                       (data[0] >> 11) & 1 ? "sf " : "",
+                       (data[0] >> 10) & 1 ? "clip " : "",
+                       (data[0] >> 9)  & 1 ? "gs " : "",
+                       (data[0] >> 8)  & 1 ? "vs " : "");
+       instr_out(data, hw_offset, 1,
+                 "vs fence: %d, clip_fence: %d, gs_fence: %d\n",
+                 vs_fence, clip_fence, gs_fence);
+       instr_out(data, hw_offset, 2,
+                 "sf fence: %d, vfe_fence: %d, cs_fence: %d\n",
+                 sf_fence, vfe_fence, cs_fence);
+       if (gs_fence < vs_fence)
+           fprintf(out, "gs fence < vs fence!\n");
+       if (clip_fence < gs_fence)
+           fprintf(out, "clip fence < gs fence!\n");
+       if (sf_fence < clip_fence)
+           fprintf(out, "sf fence < clip fence!\n");
+       if (cs_fence < sf_fence)
+           fprintf(out, "cs fence < sf fence!\n");
+
+       return len;
+}
+
+static void
+state_base_out(const uint32_t *data, uint32_t hw_offset, unsigned int index,
+              char *name)
+{
+    if (data[index] & 1) {
+       instr_out(data, hw_offset, index, "%s state base address 0x%08x\n",
+                 name, data[index] & ~1);
+    } else {
+       instr_out(data, hw_offset, index, "%s state base not updated\n",
+                 name);
+    }
+}
+
+static void
+state_max_out(const uint32_t *data, uint32_t hw_offset, unsigned int index,
+             char *name)
+{
+    if (data[index] & 1) {
+       if (data[index] == 1) {
+           instr_out(data, hw_offset, index,
+                     "%s state upper bound disabled\n", name);
+       } else {
+           instr_out(data, hw_offset, index, "%s state upper bound 0x%08x\n",
+                     name, data[index] & ~1);
+       }
+    } else {
+       instr_out(data, hw_offset, index, "%s state upper bound not updated\n",
+                 name);
+    }
+}
 
 static int
-decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int *failures)
 {
-    unsigned int opcode, len;
-    int i;
+    uint32_t opcode;
+    unsigned int idx, len;
+    int i, sba_len;
+    char *desc1 = NULL;
 
     struct {
        uint32_t opcode;
@@ -1435,51 +1620,78 @@ decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures
        { 0x7907, 33, 33, "3DSTATE_POLY_STIPPLE_PATTERN" },
        { 0x7908, 3, 3, "3DSTATE_LINE_STIPPLE" },
        { 0x7909, 2, 2, "3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP" },
+       { 0x7909, 2, 2, "3DSTATE_CLEAR_PARAMS" },
        { 0x790a, 3, 3, "3DSTATE_AA_LINE_PARAMETERS" },
+       { 0x790b, 4, 4, "3DSTATE_GS_SVB_INDEX" },
+       { 0x790d, 3, 3, "3DSTATE_MULTISAMPLE" },
        { 0x7b00, 6, 6, "3DPRIMITIVE" },
-    };
+       { 0x7802, 4, 4, "3DSTATE_SAMPLER_STATE_POINTERS" },
+       { 0x7805, 3, 3, "3DSTATE_URB" },
+       { 0x780e, 4, 4, "3DSTATE_CC_STATE_POINTERS" },
+       { 0x7810, 6, 6, "3DSTATE_VS_STATE" },
+       { 0x7811, 7, 7, "3DSTATE_GS_STATE" },
+       { 0x7812, 4, 4, "3DSTATE_CLIP_STATE" },
+       { 0x7813, 20, 20, "3DSTATE_SF_STATE" },
+       { 0x7814, 9, 9, "3DSTATE_WM_STATE" },
+       { 0x7812, 4, 4, "3DSTATE_CLIP_STATE" },
+       { 0x7815, 5, 5, "3DSTATE_CONSTANT_VS_STATE" },
+       { 0x7816, 5, 5, "3DSTATE_CONSTANT_GS_STATE" },
+       { 0x7817, 5, 5, "3DSTATE_CONSTANT_PS_STATE" },
+       { 0x7818, 2, 2, "3DSTATE_SAMPLE_MASK" },
+   }, *opcode_3d;
 
     len = (data[0] & 0x0000ffff) + 2;
 
-    switch ((data[0] & 0xffff0000) >> 16) {
+    opcode = (data[0] & 0xffff0000) >> 16;
+    switch (opcode) {
+    case 0x6000:
+       len = (data[0] & 0x000000ff) + 2;
+       return i965_decode_urb_fence(data, hw_offset, len, count, failures);
+    case 0x6001:
+       instr_out(data, hw_offset, 0, "CS_URB_STATE\n");
+       instr_out(data, hw_offset, 1, "entry_size: %d [%d bytes], n_entries: %d\n",
+                       (data[1] >> 4) & 0x1f,
+                       (((data[1] >> 4) & 0x1f) + 1) * 64,
+                       data[1] & 0x7);
+       return len;
+    case 0x6002:
+       len = (data[0] & 0x000000ff) + 2;
+       instr_out(data, hw_offset, 0, "CONSTANT_BUFFER: %s\n",
+                       (data[0] >> 8) & 1 ? "valid" : "invalid");
+       instr_out(data, hw_offset, 1, "offset: 0x%08x, length: %d bytes\n",
+                       data[1] & ~0x3f, ((data[1] & 0x3f) + 1) * 64);
+       return len;
     case 0x6101:
-       if (len != 6)
+       if (IS_GEN6(devid))
+           sba_len = 10;
+       else if (IS_IRONLAKE(devid))
+           sba_len = 8;
+       else
+           sba_len = 6;
+       if (len != sba_len)
            fprintf(out, "Bad count in STATE_BASE_ADDRESS\n");
-       if (count < 6)
+       if (len != sba_len)
            BUFFER_FAIL(count, len, "STATE_BASE_ADDRESS");
 
+       i = 0;
        instr_out(data, hw_offset, 0,
                  "STATE_BASE_ADDRESS\n");
-
-       if (data[1] & 1) {
-           instr_out(data, hw_offset, 1, "General state at 0x%08x\n",
-                     data[1] & ~1);
-       } else
-           instr_out(data, hw_offset, 1, "General state not updated\n");
-
-       if (data[2] & 1) {
-           instr_out(data, hw_offset, 2, "Surface state at 0x%08x\n",
-                     data[2] & ~1);
-       } else
-           instr_out(data, hw_offset, 2, "Surface state not updated\n");
-
-       if (data[3] & 1) {
-           instr_out(data, hw_offset, 3, "Indirect state at 0x%08x\n",
-                     data[3] & ~1);
-       } else
-           instr_out(data, hw_offset, 3, "Indirect state not updated\n");
-
-       if (data[4] & 1) {
-           instr_out(data, hw_offset, 4, "General state upper bound 0x%08x\n",
-                     data[4] & ~1);
-       } else
-           instr_out(data, hw_offset, 4, "General state not updated\n");
-
-       if (data[5] & 1) {
-           instr_out(data, hw_offset, 5, "Indirect state upper bound 0x%08x\n",
-                     data[5] & ~1);
-       } else
-           instr_out(data, hw_offset, 5, "Indirect state not updated\n");
+       i++;
+
+       state_base_out(data, hw_offset, i++, "general");
+       state_base_out(data, hw_offset, i++, "surface");
+       if (IS_GEN6(devid))
+           state_base_out(data, hw_offset, i++, "dynamic");
+       state_base_out(data, hw_offset, i++, "indirect");
+       if (IS_IRONLAKE(devid) || IS_GEN6(devid))
+           state_base_out(data, hw_offset, i++, "instruction");
+
+       state_max_out(data, hw_offset, i++, "general");
+       if (IS_GEN6(devid))
+           state_max_out(data, hw_offset, i++, "dynamic");
+       state_max_out(data, hw_offset, i++, "indirect");
+       if (IS_IRONLAKE(devid) || IS_GEN6(devid))
+           state_max_out(data, hw_offset, i++, "instruction");
 
        return len;
     case 0x7800:
@@ -1498,18 +1710,33 @@ decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures
        instr_out(data, hw_offset, 6, "CC state\n");
        return len;
     case 0x7801:
-       if (len != 6)
+       len = (data[0] & 0x000000ff) + 2;
+       if (len != 6 && len != 4)
            fprintf(out, "Bad count in 3DSTATE_BINDING_TABLE_POINTERS\n");
-       if (count < 6)
-           BUFFER_FAIL(count, len, "3DSTATE_BINDING_TABLE_POINTERS");
+       if (len == 6) {
+           if (count < 6)
+               BUFFER_FAIL(count, len, "3DSTATE_BINDING_TABLE_POINTERS");
+           instr_out(data, hw_offset, 0,
+                     "3DSTATE_BINDING_TABLE_POINTERS\n");
+           instr_out(data, hw_offset, 1, "VS binding table\n");
+           instr_out(data, hw_offset, 2, "GS binding table\n");
+           instr_out(data, hw_offset, 3, "Clip binding table\n");
+           instr_out(data, hw_offset, 4, "SF binding table\n");
+           instr_out(data, hw_offset, 5, "WM binding table\n");
+       } else {
+           if (count < 4)
+               BUFFER_FAIL(count, len, "3DSTATE_BINDING_TABLE_POINTERS");
 
-       instr_out(data, hw_offset, 0,
-                 "3DSTATE_BINDING_TABLE_POINTERS\n");
-       instr_out(data, hw_offset, 1, "VS binding table\n");
-       instr_out(data, hw_offset, 2, "GS binding table\n");
-       instr_out(data, hw_offset, 3, "Clip binding table\n");
-       instr_out(data, hw_offset, 4, "SF binding table\n");
-       instr_out(data, hw_offset, 5, "WM binding table\n");
+           instr_out(data, hw_offset, 0,
+                     "3DSTATE_BINDING_TABLE_POINTERS: VS mod %d, "
+                     "GS mod %d, PS mod %d\n",
+                     (data[0] & (1 << 8)) != 0,
+                     (data[0] & (1 << 9)) != 0,
+                     (data[0] & (1 << 10)) != 0);
+           instr_out(data, hw_offset, 1, "VS binding table\n");
+           instr_out(data, hw_offset, 2, "GS binding table\n");
+           instr_out(data, hw_offset, 3, "WM binding table\n");
+       }
 
        return len;
 
@@ -1560,6 +1787,18 @@ decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures
        }
        return len;
 
+    case 0x780d:
+       len = (data[0] & 0xff) + 2;
+       if (len != 4)
+           fprintf(out, "Bad count in 3DSTATE_VIEWPORT_STATE_POINTERS\n");
+       if (count < len)
+           BUFFER_FAIL(count, len, "3DSTATE_VIEWPORT_STATE_POINTERS");
+       instr_out(data, hw_offset, 0, "3DSTATE_VIEWPORT_STATE_POINTERS\n");
+       instr_out(data, hw_offset, 1, "clip\n");
+       instr_out(data, hw_offset, 2, "sf\n");
+       instr_out(data, hw_offset, 3, "cc\n");
+       return len;
+
     case 0x780a:
        len = (data[0] & 0xff) + 2;
        if (len != 3)
@@ -1592,7 +1831,7 @@ decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures
        return len;
 
     case 0x7905:
-       if (len != 5 && len != 6)
+       if (len < 5 || len > 7)
            fprintf(out, "Bad count in 3DSTATE_DEPTH_BUFFER\n");
        if (count < len)
            BUFFER_FAIL(count, len, "3DSTATE_DEPTH_BUFFER");
@@ -1609,9 +1848,36 @@ decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures
                  ((data[3] & 0x0007ffc0) >> 6) + 1,
                  ((data[3] & 0xfff80000) >> 19) + 1);
        instr_out(data, hw_offset, 4, "volume depth\n");
-       if (len == 6)
+       if (len >= 6)
            instr_out(data, hw_offset, 5, "\n");
+       if (len >= 7)
+           instr_out(data, hw_offset, 6, "render target view extent\n");
+
+       return len;
 
+    case 0x7a00:
+       len = (data[0] & 0xff) + 2;
+       if (len != 4)
+           fprintf(out, "Bad count in PIPE_CONTROL\n");
+       if (count < len)
+           BUFFER_FAIL(count, len, "PIPE_CONTROL");
+
+       switch ((data[0] >> 14) & 0x3) {
+       case 0: desc1 = "no write"; break;
+       case 1: desc1 = "qword write"; break;
+       case 2: desc1 = "PS_DEPTH_COUNT write"; break;
+       case 3: desc1 = "TIMESTAMP write"; break;
+       }
+       instr_out(data, hw_offset, 0,
+                 "PIPE_CONTROL: %s, %sdepth stall, %sRC write flush, "
+                 "%sinst flush\n",
+                 desc1,
+                 data[0] & (1 << 13) ? "" : "no ",
+                 data[0] & (1 << 12) ? "" : "no ",
+                 data[0] & (1 << 11) ? "" : "no ");
+       instr_out(data, hw_offset, 1, "destination address\n");
+       instr_out(data, hw_offset, 2, "immediate dword low\n");
+       instr_out(data, hw_offset, 3, "immediate dword high\n");
        return len;
 
     case 0x7b00:
@@ -1633,39 +1899,41 @@ decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures
        return len;
     }
 
-    for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) {
-       if ((data[0] & 0xffff0000) >> 16 == opcodes_3d[opcode].opcode) {
+    for (idx = 0; idx < Elements(opcodes_3d); idx++) {
+       opcode_3d = &opcodes_3d[idx];
+       if ((data[0] & 0xffff0000) >> 16 == opcode_3d->opcode) {
            unsigned int i;
            len = 1;
 
-           instr_out(data, hw_offset, 0, "%s\n", opcodes_3d[opcode].name);
-           if (opcodes_3d[opcode].max_len > 1) {
+           instr_out(data, hw_offset, 0, "%s\n", opcode_3d->name);
+           if (opcode_3d->max_len > 1) {
                len = (data[0] & 0xff) + 2;
-               if (len < opcodes_3d[opcode].min_len ||
-                   len > opcodes_3d[opcode].max_len)
+               if (len < opcode_3d->min_len ||
+                   len > opcode_3d->max_len)
                {
-                   fprintf(out, "Bad count in %s\n", opcodes_3d[opcode].name);
+                   fprintf(out, "Bad count in %s\n", opcode_3d->name);
                }
            }
 
            for (i = 1; i < len; i++) {
                if (i >= count)
-                   BUFFER_FAIL(count, len, opcodes_3d[opcode].name);
+                   BUFFER_FAIL(count, len, opcode_3d->name);
                instr_out(data, hw_offset, i, "dword %d\n", i);
            }
            return len;
        }
     }
 
-    instr_out(data, hw_offset, 0, "3D UNKNOWN\n");
+    instr_out(data, hw_offset, 0, "3D UNKNOWN: 3d_965 opcode = 0x%x\n", opcode);
     (*failures)++;
     return 1;
 }
 
 static int
-decode_3d_i830(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_3d_i830(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, int *failures)
 {
-    unsigned int opcode;
+    unsigned int idx;
+    uint32_t opcode;
 
     struct {
        uint32_t opcode;
@@ -1689,41 +1957,44 @@ decode_3d_i830(const uint32_t *data, int count, uint32_t hw_offset, int *failure
        { 0x0f, 1, 1, "3DSTATE_MODES_2" },
        { 0x15, 1, 1, "3DSTATE_FOG_COLOR" },
        { 0x16, 1, 1, "3DSTATE_MODES_4" },
-    };
+    }, *opcode_3d;
+
+    opcode = (data[0] & 0x1f000000) >> 24;
 
-    switch ((data[0] & 0x1f000000) >> 24) {
+    switch (opcode) {
     case 0x1f:
        return decode_3d_primitive(data, count, hw_offset, failures);
     case 0x1d:
-       return decode_3d_1d(data, count, hw_offset, failures, 1);
+       return decode_3d_1d(data, count, hw_offset, devid, failures);
     case 0x1c:
        return decode_3d_1c(data, count, hw_offset, failures);
     }
 
-    for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) {
-       if ((data[0] & 0x1f000000) >> 24 == opcodes_3d[opcode].opcode) {
+    for (idx = 0; idx < Elements(opcodes_3d); idx++) {
+       opcode_3d = &opcodes_3d[idx];
+       if ((data[0] & 0x1f000000) >> 24 == opcode_3d->opcode) {
            unsigned int len = 1, i;
 
-           instr_out(data, hw_offset, 0, "%s\n", opcodes_3d[opcode].name);
-           if (opcodes_3d[opcode].max_len > 1) {
+           instr_out(data, hw_offset, 0, "%s\n", opcode_3d->name);
+           if (opcode_3d->max_len > 1) {
                len = (data[0] & 0xff) + 2;
-               if (len < opcodes_3d[opcode].min_len ||
-                   len > opcodes_3d[opcode].max_len)
+               if (len < opcode_3d->min_len ||
+                   len > opcode_3d->max_len)
                {
-                   fprintf(out, "Bad count in %s\n", opcodes_3d[opcode].name);
+                   fprintf(out, "Bad count in %s\n", opcode_3d->name);
                }
            }
 
            for (i = 1; i < len; i++) {
                if (i >= count)
-                   BUFFER_FAIL(count, len, opcodes_3d[opcode].name);
+                   BUFFER_FAIL(count, len, opcode_3d->name);
                instr_out(data, hw_offset, i, "dword %d\n", i);
            }
            return len;
        }
     }
 
-    instr_out(data, hw_offset, 0, "3D UNKNOWN\n");
+    instr_out(data, hw_offset, 0, "3D UNKNOWN: 3d_i830 opcode = 0x%x\n", opcode);
     (*failures)++;
     return 1;
 }
@@ -1736,8 +2007,12 @@ decode_3d_i830(const uint32_t *data, int count, uint32_t hw_offset, int *failure
  * \param hw_offset hardware address for the buffer
  */
 int
-intel_decode(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid)
+intel_decode(const uint32_t *data, int count,
+            uint32_t hw_offset,
+            uint32_t devid,
+            uint32_t ignore_end_of_batchbuffer)
 {
+    int ret;
     int index = 0;
     int failures = 0;
 
@@ -1746,8 +2021,23 @@ intel_decode(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid
     while (index < count) {
        switch ((data[index] & 0xe0000000) >> 29) {
        case 0x0:
-           index += decode_mi(data + index, count - index,
+           ret = decode_mi(data + index, count - index,
                               hw_offset + index * 4, &failures);
+
+           /* If MI_BATCHBUFFER_END happened, then dump the rest of the
+            * output in case we some day want it in debugging, but don't
+            * decode it since it'll just confuse in the common case.
+            */
+           if (ret == -1) {
+               if (ignore_end_of_batchbuffer) {
+                   index++;
+               } else {
+                   for (index = index + 1; index < count; index++) {
+                       instr_out(data, hw_offset, index, "\n");
+                   }
+               }
+           } else
+               index += ret;
            break;
        case 0x2:
            index += decode_2d(data + index, count - index,
@@ -1756,13 +2046,16 @@ intel_decode(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid
        case 0x3:
            if (IS_965(devid)) {
                index += decode_3d_965(data + index, count - index,
-                                      hw_offset + index * 4, &failures);
+                                      hw_offset + index * 4,
+                                      devid, &failures);
            } else if (IS_9XX(devid)) {
                index += decode_3d(data + index, count - index,
-                                  hw_offset + index * 4, &failures);
+                                  hw_offset + index * 4,
+                                  devid, &failures);
            } else {
                index += decode_3d_i830(data + index, count - index,
-                                       hw_offset + index * 4, &failures);
+                                       hw_offset + index * 4,
+                                       devid, &failures);
            }
            break;
        default:
index 7683097b869bded77954712dd03b1c550fad4400..7e7c108c0c61e20864ecc70f72f19e2c222edac8 100644 (file)
@@ -25,5 +25,7 @@
  *
  */
 
-int intel_decode(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid);
+#include "pipe/p_compiler.h"
+
+int intel_decode(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid, uint32_t ignore_end_of_batchbuffer);
 void intel_decode_context_reset(void);
index 522e3bd92c2c13767ff12d8dfcb10e72473bb486..ec6eec8910f18b363e4e88611d0a59bf3c665c84 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef INTEL_STRUCTS_H
 #define INTEL_STRUCTS_H
 
+#include "brw_types.h"
+
 struct br0 {
    GLuint length:8;
    GLuint pad0:3;
index b364e0acc84a4f97d95d94b3308b53021a52f271..d24d1ec7c61f869502366dea36a54284f4bef658 100644 (file)
@@ -10,4 +10,6 @@ identity = env.ConvenienceLibrary(
                'id_screen.c',
        ])
 
+env.Alias('identity', identity)
+
 Export('identity')
index de83c249057a3bcff2cd87e2dd31e645d406e764..3efbd6a246d577d1c9d302a223ce8dade86e4c88 100644 (file)
@@ -577,17 +577,13 @@ identity_set_index_buffer(struct pipe_context *_pipe,
 static void
 identity_resource_copy_region(struct pipe_context *_pipe,
                               struct pipe_resource *_dst,
-                              struct pipe_subresource subdst,
+                              unsigned dst_level,
                               unsigned dstx,
                               unsigned dsty,
                               unsigned dstz,
                               struct pipe_resource *_src,
-                              struct pipe_subresource subsrc,
-                              unsigned srcx,
-                              unsigned srcy,
-                              unsigned srcz,
-                              unsigned width,
-                              unsigned height)
+                              unsigned src_level,
+                              const struct pipe_box *src_box)
 {
    struct identity_context *id_pipe = identity_context(_pipe);
    struct identity_resource *id_resource_dst = identity_resource(_dst);
@@ -598,17 +594,13 @@ identity_resource_copy_region(struct pipe_context *_pipe,
 
    pipe->resource_copy_region(pipe,
                               dst,
-                              subdst,
+                              dst_level,
                               dstx,
                               dsty,
                               dstz,
                               src,
-                              subsrc,
-                              srcx,
-                              srcy,
-                              srcz,
-                              width,
-                              height);
+                              src_level,
+                              src_box);
 }
 
 static void
@@ -690,8 +682,8 @@ identity_flush(struct pipe_context *_pipe,
 static unsigned int
 identity_is_resource_referenced(struct pipe_context *_pipe,
                                 struct pipe_resource *_resource,
-                                unsigned face,
-                                unsigned level)
+                                unsigned level,
+                                int layer)
 {
    struct identity_context *id_pipe = identity_context(_pipe);
    struct identity_resource *id_resource = identity_resource(_resource);
@@ -700,8 +692,8 @@ identity_is_resource_referenced(struct pipe_context *_pipe,
 
    return pipe->is_resource_referenced(pipe,
                                        resource,
-                                       face,
-                                       level);
+                                       level,
+                                       layer);
 }
 
 static struct pipe_sampler_view *
@@ -732,10 +724,38 @@ identity_context_sampler_view_destroy(struct pipe_context *_pipe,
                                  identity_sampler_view(_view));
 }
 
+static struct pipe_surface *
+identity_context_create_surface(struct pipe_context *_pipe,
+                                struct pipe_resource *_resource,
+                                const struct pipe_surface *templ)
+{
+   struct identity_context *id_context = identity_context(_pipe);
+   struct identity_resource *id_resource = identity_resource(_resource);
+   struct pipe_context *pipe = id_context->pipe;
+   struct pipe_resource *resource = id_resource->resource;
+   struct pipe_surface *result;
+
+   result = pipe->create_surface(pipe,
+                                 resource,
+                                 templ);
+
+   if (result)
+      return identity_surface_create(id_context, id_resource, result);
+   return NULL;
+}
+
+static void
+identity_context_surface_destroy(struct pipe_context *_pipe,
+                                 struct pipe_surface *_surf)
+{
+   identity_surface_destroy(identity_context(_pipe),
+                            identity_surface(_surf));
+}
+
 static struct pipe_transfer *
 identity_context_get_transfer(struct pipe_context *_context,
                               struct pipe_resource *_resource,
-                              struct pipe_subresource sr,
+                              unsigned level,
                               unsigned usage,
                               const struct pipe_box *box)
 {
@@ -747,7 +767,7 @@ identity_context_get_transfer(struct pipe_context *_context,
 
    result = context->get_transfer(context,
                                   resource,
-                                  sr,
+                                  level,
                                   usage,
                                   box);
 
@@ -812,12 +832,12 @@ identity_context_transfer_unmap(struct pipe_context *_context,
 static void 
 identity_context_transfer_inline_write(struct pipe_context *_context,
                                        struct pipe_resource *_resource,
-                                       struct pipe_subresource sr,
+                                       unsigned level,
                                        unsigned usage,
                                        const struct pipe_box *box,
                                        const void *data,
                                        unsigned stride,
-                                       unsigned slice_stride)
+                                       unsigned layer_stride)
 {
    struct identity_context *id_context = identity_context(_context);
    struct identity_resource *id_resource = identity_resource(_resource);
@@ -826,12 +846,12 @@ identity_context_transfer_inline_write(struct pipe_context *_context,
 
    context->transfer_inline_write(context,
                                   resource,
-                                  sr,
+                                  level,
                                   usage,
                                   box,
                                   data,
                                   stride,
-                                  slice_stride);
+                                  layer_stride);
 }
 
 
@@ -899,6 +919,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    id_pipe->base.clear_depth_stencil = identity_clear_depth_stencil;
    id_pipe->base.flush = identity_flush;
    id_pipe->base.is_resource_referenced = identity_is_resource_referenced;
+   id_pipe->base.create_surface = identity_context_create_surface;
+   id_pipe->base.surface_destroy = identity_context_surface_destroy;
    id_pipe->base.create_sampler_view = identity_context_create_sampler_view;
    id_pipe->base.sampler_view_destroy = identity_context_sampler_view_destroy;
    id_pipe->base.get_transfer = identity_context_get_transfer;
index 593928f399c7edaa7ee904169541f0426e617184..63454410525ee4e8639d794e8bb637962ffb6f83 100644 (file)
@@ -71,7 +71,8 @@ identity_resource_destroy(struct identity_resource *id_resource)
 
 
 struct pipe_surface *
-identity_surface_create(struct identity_resource *id_resource,
+identity_surface_create(struct identity_context *id_context,
+                        struct identity_resource *id_resource,
                         struct pipe_surface *surface)
 {
    struct identity_surface *id_surface;
@@ -100,10 +101,12 @@ error:
 }
 
 void
-identity_surface_destroy(struct identity_surface *id_surface)
+identity_surface_destroy(struct identity_context *id_context,
+                         struct identity_surface *id_surface)
 {
    pipe_resource_reference(&id_surface->base.texture, NULL);
-   pipe_surface_reference(&id_surface->surface, NULL);
+   id_context->pipe->surface_destroy(id_context->pipe,
+                                     id_surface->surface);
    FREE(id_surface);
 }
 
index e8deabf4fc7f3df6d59c141298b39252b656e484..181f2d6623e9dc635522a4f6a10bf84e879a4ffb 100644 (file)
@@ -147,11 +147,13 @@ void
 identity_resource_destroy(struct identity_resource *id_resource);
 
 struct pipe_surface *
-identity_surface_create(struct identity_resource *id_resource,
+identity_surface_create(struct identity_context *id_context,
+                        struct identity_resource *id_resource,
                         struct pipe_surface *surface);
 
 void
-identity_surface_destroy(struct identity_surface *id_surface);
+identity_surface_destroy(struct identity_context *id_context,
+                         struct identity_surface *id_surface);
 
 struct pipe_sampler_view *
 identity_sampler_view_create(struct identity_context *id_context,
index 5fb464b4148837370954788c1aba7f31a0b41168..644481bb7480e3559ff85a86677522d880941091 100644 (file)
@@ -189,39 +189,6 @@ identity_screen_resource_destroy(struct pipe_screen *screen,
    identity_resource_destroy(identity_resource(_resource));
 }
 
-static struct pipe_surface *
-identity_screen_get_tex_surface(struct pipe_screen *_screen,
-                                struct pipe_resource *_resource,
-                                unsigned face,
-                                unsigned level,
-                                unsigned zslice,
-                                unsigned usage)
-{
-   struct identity_screen *id_screen = identity_screen(_screen);
-   struct identity_resource *id_resource = identity_resource(_resource);
-   struct pipe_screen *screen = id_screen->screen;
-   struct pipe_resource *resource = id_resource->resource;
-   struct pipe_surface *result;
-
-   result = screen->get_tex_surface(screen,
-                                    resource,
-                                    face,
-                                    level,
-                                    zslice,
-                                    usage);
-
-   if (result)
-      return identity_surface_create(id_resource, result);
-   return NULL;
-}
-
-static void
-identity_screen_tex_surface_destroy(struct pipe_surface *_surface)
-{
-   identity_surface_destroy(identity_surface(_surface));
-}
-
-
 
 static struct pipe_resource *
 identity_screen_user_buffer_create(struct pipe_screen *_screen,
@@ -247,16 +214,18 @@ identity_screen_user_buffer_create(struct pipe_screen *_screen,
 
 static void
 identity_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                                  struct pipe_surface *_surface,
+                                  struct pipe_resource *_resource,
+                                  unsigned level, unsigned layer,
                                   void *context_private)
 {
    struct identity_screen *id_screen = identity_screen(_screen);
-   struct identity_surface *id_surface = identity_surface(_surface);
+   struct identity_resource *id_resource = identity_resource(_resource);
    struct pipe_screen *screen = id_screen->screen;
-   struct pipe_surface *surface = id_surface->surface;
+   struct pipe_resource *resource = id_resource->resource;
 
    screen->flush_frontbuffer(screen,
-                             surface,
+                             resource,
+                             level, layer,
                              context_private);
 }
 
@@ -323,8 +292,6 @@ identity_screen_create(struct pipe_screen *screen)
    id_screen->base.resource_from_handle = identity_screen_resource_from_handle;
    id_screen->base.resource_get_handle = identity_screen_resource_get_handle;
    id_screen->base.resource_destroy = identity_screen_resource_destroy;
-   id_screen->base.get_tex_surface = identity_screen_get_tex_surface;
-   id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy;
    id_screen->base.user_buffer_create = identity_screen_user_buffer_create;
    id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer;
    id_screen->base.fence_reference = identity_screen_fence_reference;
index 669e42e3003cfabb6bf07d29f24330a619acac56..4068bed393c92fc0a54cc0a5aea86641c5a82f82 100644 (file)
@@ -3,8 +3,6 @@ include $(TOP)/configs/current
 
 LIBNAME = llvmpipe
 
-DEFINES += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
-
 C_SOURCES = \
        lp_bld_alpha.c \
        lp_bld_blend_aos.c \
index e50643790c8aa4c3f6eef0a48e31ada6c118deab..518969c3202bb8d23b08085a2fec5beff3f8976f 100644 (file)
@@ -43,7 +43,7 @@
 
 
 void
-lp_build_alpha_test(LLVMBuilderRef builder,
+lp_build_alpha_test(struct gallivm_state *gallivm,
                     unsigned func,
                     struct lp_type type,
                     struct lp_build_mask_context *mask,
@@ -54,7 +54,7 @@ lp_build_alpha_test(LLVMBuilderRef builder,
    struct lp_build_context bld;
    LLVMValueRef test;
 
-   lp_build_context_init(&bld, builder, type);
+   lp_build_context_init(&bld, gallivm, type);
 
    test = lp_build_cmp(&bld, func, alpha, ref);
 
index 27ca8aad4d4406283fbf44c4ed70d31b932a516d..06206a24d835d5a934965fd259f8f863c5f7bfee 100644 (file)
 #ifndef LP_BLD_ALPHA_H
 #define LP_BLD_ALPHA_H
 
+#include "pipe/p_compiler.h"
 
 #include "gallivm/lp_bld.h"
 
 struct pipe_alpha_state;
+struct gallivm_state;
 struct lp_type;
 struct lp_build_mask_context;
 
 
 void
-lp_build_alpha_test(LLVMBuilderRef builder,
+lp_build_alpha_test(struct gallivm_state *gallivm,
                     unsigned func,
                     struct lp_type type,
                     struct lp_build_mask_context *mask,
index 5cecec3d7f9f5a7b3757c3c168ec70ea9962b3f7..f82ae30bb7dc8a277f5a48b792075b03c9471b0a 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_init.h"
  
 #include "pipe/p_format.h"
 
@@ -61,7 +62,7 @@ lp_build_blend_func(struct lp_build_context *bld,
 
 
 LLVMValueRef
-lp_build_blend_aos(LLVMBuilderRef builder,
+lp_build_blend_aos(struct gallivm_state *gallivm,
                    const struct pipe_blend_state *blend,
                    struct lp_type type,
                    unsigned rt,
@@ -72,7 +73,7 @@ lp_build_blend_aos(LLVMBuilderRef builder,
 
 
 void
-lp_build_blend_soa(LLVMBuilderRef builder,
+lp_build_blend_soa(struct gallivm_state *gallivm,
                    const struct pipe_blend_state *blend,
                    struct lp_type type,
                    unsigned rt,
index d1c9b88f9bbf362c0a7ad2a5c9167bb3119c97b9..c342346a36ec33238877f4582b7243f5ed33fa25 100644 (file)
@@ -301,7 +301,7 @@ lp_build_blend_func(struct lp_build_context *bld,
 
 
 LLVMValueRef
-lp_build_blend_aos(LLVMBuilderRef builder,
+lp_build_blend_aos(struct gallivm_state *gallivm,
                    const struct pipe_blend_state *blend,
                    struct lp_type type,
                    unsigned rt,
@@ -322,7 +322,7 @@ lp_build_blend_aos(LLVMBuilderRef builder,
 
    /* Setup build context */
    memset(&bld, 0, sizeof bld);
-   lp_build_context_init(&bld.base, builder, type);
+   lp_build_context_init(&bld.base, gallivm, type);
    bld.src = src;
    bld.dst = dst;
    bld.const_ = const_;
index 30d261e979f0228359f2df07ebab77fd875e5c5f..4d5bc9642d928cc328e35d883bbc8dd1208e3f48 100644 (file)
@@ -73,6 +73,7 @@
 
 #include "gallivm/lp_bld_type.h"
 #include "gallivm/lp_bld_arit.h"
+#include "gallivm/lp_bld_init.h"
 #include "lp_bld_blend.h"
 
 
@@ -211,7 +212,7 @@ lp_build_blend_factor_complementary(unsigned src_factor, unsigned dst_factor)
  * \param res  the result/output
  */
 void
-lp_build_blend_soa(LLVMBuilderRef builder,
+lp_build_blend_soa(struct gallivm_state *gallivm,
                    const struct pipe_blend_state *blend,
                    struct lp_type type,
                    unsigned rt,
@@ -220,6 +221,7 @@ lp_build_blend_soa(LLVMBuilderRef builder,
                    LLVMValueRef con[4],
                    LLVMValueRef res[4])
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_build_blend_soa_context bld;
    unsigned i, j, k;
 
@@ -227,7 +229,7 @@ lp_build_blend_soa(LLVMBuilderRef builder,
 
    /* Setup build context */
    memset(&bld, 0, sizeof bld);
-   lp_build_context_init(&bld.base, builder, type);
+   lp_build_context_init(&bld.base, gallivm, type);
    for (i = 0; i < 4; ++i) {
       bld.src[i] = src[i];
       bld.dst[i] = dst[i];
index 7eb76d4fb31d2e3c146b46bebadc1ff9eadefd2c..1bf741194c5ec6d4e4737f380d52874f3085ec13 100644 (file)
@@ -97,6 +97,7 @@ lp_build_stencil_test_single(struct lp_build_context *bld,
                              LLVMValueRef stencilRef,
                              LLVMValueRef stencilVals)
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    const unsigned stencilMax = 255; /* XXX fix */
    struct lp_type type = bld->type;
    LLVMValueRef res;
@@ -107,10 +108,10 @@ lp_build_stencil_test_single(struct lp_build_context *bld,
 
    if (stencil->valuemask != stencilMax) {
       /* compute stencilRef = stencilRef & valuemask */
-      LLVMValueRef valuemask = lp_build_const_int_vec(type, stencil->valuemask);
-      stencilRef = LLVMBuildAnd(bld->builder, stencilRef, valuemask, "");
+      LLVMValueRef valuemask = lp_build_const_int_vec(bld->gallivm, type, stencil->valuemask);
+      stencilRef = LLVMBuildAnd(builder, stencilRef, valuemask, "");
       /* compute stencilVals = stencilVals & valuemask */
-      stencilVals = LLVMBuildAnd(bld->builder, stencilVals, valuemask, "");
+      stencilVals = LLVMBuildAnd(builder, stencilVals, valuemask, "");
    }
 
    res = lp_build_cmp(bld, stencil->func, stencilRef, stencilVals);
@@ -167,9 +168,10 @@ lp_build_stencil_op_single(struct lp_build_context *bld,
                            LLVMValueRef stencilVals)
 
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    struct lp_type type = bld->type;
    LLVMValueRef res;
-   LLVMValueRef max = lp_build_const_int_vec(type, 0xff);
+   LLVMValueRef max = lp_build_const_int_vec(bld->gallivm, type, 0xff);
    unsigned stencil_op;
 
    assert(type.sign);
@@ -210,15 +212,15 @@ lp_build_stencil_op_single(struct lp_build_context *bld,
       break;
    case PIPE_STENCIL_OP_INCR_WRAP:
       res = lp_build_add(bld, stencilVals, bld->one);
-      res = LLVMBuildAnd(bld->builder, res, max, "");
+      res = LLVMBuildAnd(builder, res, max, "");
       break;
    case PIPE_STENCIL_OP_DECR_WRAP:
       res = lp_build_sub(bld, stencilVals, bld->one);
-      res = LLVMBuildAnd(bld->builder, res, max, "");
+      res = LLVMBuildAnd(builder, res, max, "");
       break;
    case PIPE_STENCIL_OP_INVERT:
-      res = LLVMBuildNot(bld->builder, stencilVals, "");
-      res = LLVMBuildAnd(bld->builder, res, max, "");
+      res = LLVMBuildNot(builder, stencilVals, "");
+      res = LLVMBuildAnd(builder, res, max, "");
       break;
    default:
       assert(0 && "bad stencil op mode");
@@ -242,6 +244,7 @@ lp_build_stencil_op(struct lp_build_context *bld,
                     LLVMValueRef front_facing)
 
 {
+   LLVMBuilderRef builder = bld->gallivm->builder;
    LLVMValueRef res;
 
    assert(stencil[0].enabled);
@@ -262,10 +265,11 @@ lp_build_stencil_op(struct lp_build_context *bld,
 
    if (stencil->writemask != 0xff) {
       /* mask &= stencil->writemask */
-      LLVMValueRef writemask = lp_build_const_int_vec(bld->type, stencil->writemask);
-      mask = LLVMBuildAnd(bld->builder, mask, writemask, "");
+      LLVMValueRef writemask = lp_build_const_int_vec(bld->gallivm, bld->type,
+                                                      stencil->writemask);
+      mask = LLVMBuildAnd(builder, mask, writemask, "");
       /* res = (res & mask) | (stencilVals & ~mask) */
-      res = lp_build_select_bitwise(bld, writemask, res, stencilVals);
+      res = lp_build_select_bitwise(bld, mask, res, stencilVals);
    }
    else {
       /* res = mask ? res : stencilVals */
@@ -411,25 +415,27 @@ get_s_shift_and_mask(const struct util_format_description *format_desc,
  * \param counter is a pointer of the uint32 counter.
  */
 void
-lp_build_occlusion_count(LLVMBuilderRef builder,
+lp_build_occlusion_count(struct gallivm_state *gallivm,
                          struct lp_type type,
                          LLVMValueRef maskvalue,
                          LLVMValueRef counter)
 {
-   LLVMValueRef countmask = lp_build_const_int_vec(type, 1);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMContextRef context = gallivm->context;
+   LLVMValueRef countmask = lp_build_const_int_vec(gallivm, type, 1);
    LLVMValueRef countv = LLVMBuildAnd(builder, maskvalue, countmask, "countv");
-   LLVMTypeRef i8v16 = LLVMVectorType(LLVMInt8Type(), 16);
+   LLVMTypeRef i8v16 = LLVMVectorType(LLVMInt8TypeInContext(context), 16);
    LLVMValueRef counti = LLVMBuildBitCast(builder, countv, i8v16, "counti");
    LLVMValueRef maskarray[4] = {
-      LLVMConstInt(LLVMInt32Type(), 0, 0),
-      LLVMConstInt(LLVMInt32Type(), 4, 0),
-      LLVMConstInt(LLVMInt32Type(), 8, 0),
-      LLVMConstInt(LLVMInt32Type(), 12, 0),
+      lp_build_const_int32(gallivm, 0),
+      lp_build_const_int32(gallivm, 4),
+      lp_build_const_int32(gallivm, 8),
+      lp_build_const_int32(gallivm, 12)
    };
    LLVMValueRef shufflemask = LLVMConstVector(maskarray, 4);
    LLVMValueRef shufflev =  LLVMBuildShuffleVector(builder, counti, LLVMGetUndef(i8v16), shufflemask, "shufflev");
-   LLVMValueRef shuffle = LLVMBuildBitCast(builder, shufflev, LLVMInt32Type(), "shuffle");
-   LLVMValueRef count = lp_build_intrinsic_unary(builder, "llvm.ctpop.i32", LLVMInt32Type(), shuffle);
+   LLVMValueRef shuffle = LLVMBuildBitCast(builder, shufflev, LLVMInt32TypeInContext(context), "shuffle");
+   LLVMValueRef count = lp_build_intrinsic_unary(builder, "llvm.ctpop.i32", LLVMInt32TypeInContext(context), shuffle);
    LLVMValueRef orig = LLVMBuildLoad(builder, counter, "orig");
    LLVMValueRef incr = LLVMBuildAdd(builder, orig, count, "incr");
    LLVMBuildStore(builder, incr, counter);
@@ -452,7 +458,7 @@ lp_build_occlusion_count(LLVMBuilderRef builder,
  * \param facing  contains boolean value indicating front/back facing polygon
  */
 void
-lp_build_depth_stencil_test(LLVMBuilderRef builder,
+lp_build_depth_stencil_test(struct gallivm_state *gallivm,
                             const struct pipe_depth_state *depth,
                             const struct pipe_stencil_state stencil[2],
                             struct lp_type z_src_type,
@@ -465,6 +471,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
                             LLVMValueRef *zs_value,
                             boolean do_branch)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_type z_type;
    struct lp_build_context z_bld;
    struct lp_build_context s_bld;
@@ -537,11 +544,11 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 
 
    /* Setup build context for Z vals */
-   lp_build_context_init(&z_bld, builder, z_type);
+   lp_build_context_init(&z_bld, gallivm, z_type);
 
    /* Setup build context for stencil vals */
    s_type = lp_type_int_vec(z_type.width);
-   lp_build_context_init(&s_bld, builder, s_type);
+   lp_build_context_init(&s_bld, gallivm, s_type);
 
    /* Load current z/stencil value from z/stencil buffer */
    zs_dst_ptr = LLVMBuildBitCast(builder,
@@ -559,14 +566,14 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 
       if (get_z_shift_and_mask(format_desc, &z_shift, &z_width, &z_mask)) {
          if (z_mask != 0xffffffff) {
-            z_bitmask = lp_build_const_int_vec(z_type, z_mask);
+            z_bitmask = lp_build_const_int_vec(gallivm, z_type, z_mask);
          }
 
          /*
           * Align the framebuffer Z 's LSB to the right.
           */
          if (z_shift) {
-            LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift);
+            LLVMValueRef shift = lp_build_const_int_vec(gallivm, z_type, z_shift);
             z_dst = LLVMBuildLShr(builder, zs_dst, shift, "z_dst");
          } else if (z_bitmask) {
            /* TODO: Instead of loading a mask from memory and ANDing, it's
@@ -580,7 +587,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 
       if (get_s_shift_and_mask(format_desc, &s_shift, &s_mask)) {
          if (s_shift) {
-            LLVMValueRef shift = lp_build_const_int_vec(s_type, s_shift);
+            LLVMValueRef shift = lp_build_const_int_vec(gallivm, s_type, s_shift);
             stencil_vals = LLVMBuildLShr(builder, zs_dst, shift, "");
             stencil_shift = shift;  /* used below */
          }
@@ -589,7 +596,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
          }
 
          if (s_mask != 0xffffffff) {
-            LLVMValueRef mask = lp_build_const_int_vec(s_type, s_mask);
+            LLVMValueRef mask = lp_build_const_int_vec(gallivm, s_type, s_mask);
             stencil_vals = LLVMBuildAnd(builder, stencil_vals, mask, "");
          }
 
@@ -600,12 +607,13 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
    if (stencil[0].enabled) {
 
       if (face) {
-         LLVMValueRef zero = LLVMConstInt(LLVMInt32Type(), 0, 0);
+         LLVMValueRef zero = lp_build_const_int32(gallivm, 0);
 
          /* front_facing = face != 0 ? ~0 : 0 */
          front_facing = LLVMBuildICmp(builder, LLVMIntNE, face, zero, "");
          front_facing = LLVMBuildSExt(builder, front_facing,
-                                      LLVMIntType(s_bld.type.length*s_bld.type.width),
+                                      LLVMIntTypeInContext(gallivm->context,
+                                             s_bld.type.length*s_bld.type.width),
                                       "");
          front_facing = LLVMBuildBitCast(builder, front_facing,
                                          s_bld.int_vec_type, "");
@@ -642,7 +650,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
           */
 
          if (!z_type.floating) {
-            z_src = lp_build_clamped_float_to_unsigned_norm(builder,
+            z_src = lp_build_clamped_float_to_unsigned_norm(gallivm,
                                                             z_src_type,
                                                             z_width,
                                                             z_src);
@@ -657,7 +665,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
          assert(z_src_type.norm);
          assert(!z_type.floating);
          if (z_src_type.width > z_width) {
-            LLVMValueRef shift = lp_build_const_int_vec(z_src_type,
+            LLVMValueRef shift = lp_build_const_int_vec(gallivm, z_src_type,
                                                         z_src_type.width - z_width);
             z_src = LLVMBuildLShr(builder, z_src, shift, "");
          }
@@ -710,7 +718,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
                                             z_fail_mask, front_facing);
 
          /* apply Z-pass operator */
-         z_pass_mask = LLVMBuildAnd(z_bld.builder, orig_mask, z_pass, "");
+         z_pass_mask = LLVMBuildAnd(builder, orig_mask, z_pass, "");
          stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
                                             stencil_refs, stencil_vals,
                                             z_pass_mask, front_facing);
@@ -720,7 +728,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
       /* No depth test: apply Z-pass operator to stencil buffer values which
        * passed the stencil test.
        */
-      s_pass_mask = LLVMBuildAnd(s_bld.builder, orig_mask, s_pass_mask, "");
+      s_pass_mask = LLVMBuildAnd(builder, orig_mask, s_pass_mask, "");
       stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
                                          stencil_refs, stencil_vals,
                                          s_pass_mask, front_facing);
@@ -728,11 +736,11 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 
    /* Put Z and ztencil bits in the right place */
    if (z_dst && z_shift) {
-      LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift);
+      LLVMValueRef shift = lp_build_const_int_vec(gallivm, z_type, z_shift);
       z_dst = LLVMBuildShl(builder, z_dst, shift, "");
    }
    if (stencil_vals && stencil_shift)
-      stencil_vals = LLVMBuildShl(s_bld.builder, stencil_vals,
+      stencil_vals = LLVMBuildShl(builder, stencil_vals,
                                   stencil_shift, "");
 
    /* Finally, merge/store the z/stencil values */
@@ -740,7 +748,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
        (stencil[0].enabled && stencil[0].writemask)) {
 
       if (z_dst && stencil_vals)
-         zs_dst = LLVMBuildOr(z_bld.builder, z_dst, stencil_vals, "");
+         zs_dst = LLVMBuildOr(builder, z_dst, stencil_vals, "");
       else if (z_dst)
          zs_dst = z_dst;
       else
@@ -775,7 +783,7 @@ lp_build_depth_write(LLVMBuilderRef builder,
 
 
 void
-lp_build_deferred_depth_write(LLVMBuilderRef builder,
+lp_build_deferred_depth_write(struct gallivm_state *gallivm,
                               struct lp_type z_src_type,
                               const struct util_format_description *format_desc,
                               struct lp_build_mask_context *mask,
@@ -785,11 +793,12 @@ lp_build_deferred_depth_write(LLVMBuilderRef builder,
    struct lp_type z_type;
    struct lp_build_context z_bld;
    LLVMValueRef z_dst;
+   LLVMBuilderRef builder = gallivm->builder;
 
    /* XXX: pointlessly redo type logic:
     */
    z_type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length);
-   lp_build_context_init(&z_bld, builder, z_type);
+   lp_build_context_init(&z_bld, gallivm, z_type);
 
    zs_dst_ptr = LLVMBuildBitCast(builder, zs_dst_ptr,
                                  LLVMPointerType(z_bld.vec_type, 0), "");
index a54ef3a711e9d40ca7a2b8a27546ba517220eb37..e01fc46ec1693b4d591ba0a2c89574e73045342d 100644 (file)
 #define LP_BLD_DEPTH_H
 
 
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
 #include "gallivm/lp_bld.h"
 
  
 struct pipe_depth_state;
+struct gallivm_state;
 struct util_format_description;
 struct lp_type;
 struct lp_build_mask_context;
@@ -51,7 +55,7 @@ lp_depth_type(const struct util_format_description *format_desc,
 
 
 void
-lp_build_depth_stencil_test(LLVMBuilderRef builder,
+lp_build_depth_stencil_test(struct gallivm_state *gallivm,
                             const struct pipe_depth_state *depth,
                             const struct pipe_stencil_state stencil[2],
                             struct lp_type type,
@@ -71,7 +75,7 @@ lp_build_depth_write(LLVMBuilderRef builder,
                      LLVMValueRef zs_value);
 
 void
-lp_build_deferred_depth_write(LLVMBuilderRef builder,
+lp_build_deferred_depth_write(struct gallivm_state *gallivm,
                               struct lp_type z_src_type,
                               const struct util_format_description *format_desc,
                               struct lp_build_mask_context *mask,
@@ -79,7 +83,7 @@ lp_build_deferred_depth_write(LLVMBuilderRef builder,
                               LLVMValueRef zs_value);
 
 void
-lp_build_occlusion_count(LLVMBuilderRef builder,
+lp_build_occlusion_count(struct gallivm_state *gallivm,
                          struct lp_type type,
                          LLVMValueRef maskvalue,
                          LLVMValueRef counter);
index c9da8900d0c1042510f7d6adab83a4507e68eec6..45ddf547bf0f5f7327b3aafa30181f6c43f7b6a2 100644 (file)
@@ -127,13 +127,14 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
             LLVMValueRef dady_ptr)
 {
    struct lp_build_context *coeff_bld = &bld->coeff_bld;
-   LLVMBuilderRef builder = coeff_bld->builder;
+   struct gallivm_state *gallivm = coeff_bld->gallivm;
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef zero = LLVMConstNull(coeff_bld->elem_type);
    LLVMValueRef one = LLVMConstReal(coeff_bld->elem_type, 1.0);
-   LLVMValueRef i0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   LLVMValueRef i1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
-   LLVMValueRef i2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
-   LLVMValueRef i3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
+   LLVMValueRef i0 = lp_build_const_int32(gallivm, 0);
+   LLVMValueRef i1 = lp_build_const_int32(gallivm, 1);
+   LLVMValueRef i2 = lp_build_const_int32(gallivm, 2);
+   LLVMValueRef i3 = lp_build_const_int32(gallivm, 3);
    unsigned attrib;
    unsigned chan;
 
@@ -144,7 +145,8 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
       const unsigned interp = bld->interp[attrib];
       for (chan = 0; chan < NUM_CHANNELS; ++chan) {
          if (mask & (1 << chan)) {
-            LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), attrib*NUM_CHANNELS + chan, 0);
+            LLVMValueRef index = lp_build_const_int32(gallivm,
+                                      attrib * NUM_CHANNELS + chan);
             LLVMValueRef a0 = zero;
             LLVMValueRef dadx = zero;
             LLVMValueRef dady = zero;
@@ -231,7 +233,7 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
              * a = {a, a, a, a}
              */
 
-            a = lp_build_broadcast(builder, coeff_bld->vec_type, a);
+            a = lp_build_broadcast(gallivm, coeff_bld->vec_type, a);
 
             /*
              * Compute the attrib values on the upper-left corner of each quad.
@@ -273,12 +275,14 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
  */
 static void
 attribs_update(struct lp_build_interp_soa_context *bld,
+               struct gallivm_state *gallivm,
                int quad_index,
                int start,
                int end)
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_build_context *coeff_bld = &bld->coeff_bld;
-   LLVMValueRef shuffle = lp_build_const_int_vec(coeff_bld->type, quad_index);
+   LLVMValueRef shuffle = lp_build_const_int_vec(gallivm, coeff_bld->type, quad_index);
    LLVMValueRef oow = NULL;
    unsigned attrib;
    unsigned chan;
@@ -308,7 +312,7 @@ attribs_update(struct lp_build_interp_soa_context *bld,
                 * Broadcast the attribute value for this quad into all elements
                 */
 
-               a = LLVMBuildShuffleVector(coeff_bld->builder,
+               a = LLVMBuildShuffleVector(builder,
                                           a, coeff_bld->undef, shuffle, "");
 
                /*
@@ -380,10 +384,11 @@ pos_init(struct lp_build_interp_soa_context *bld,
          LLVMValueRef x0,
          LLVMValueRef y0)
 {
+   LLVMBuilderRef builder = bld->coeff_bld.gallivm->builder;
    struct lp_build_context *coeff_bld = &bld->coeff_bld;
 
-   bld->x = LLVMBuildSIToFP(coeff_bld->builder, x0, coeff_bld->elem_type, "");
-   bld->y = LLVMBuildSIToFP(coeff_bld->builder, y0, coeff_bld->elem_type, "");
+   bld->x = LLVMBuildSIToFP(builder, x0, coeff_bld->elem_type, "");
+   bld->y = LLVMBuildSIToFP(builder, y0, coeff_bld->elem_type, "");
 }
 
 
@@ -392,6 +397,7 @@ pos_init(struct lp_build_interp_soa_context *bld,
  */
 void
 lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
+                         struct gallivm_state *gallivm,
                          unsigned num_inputs,
                          const struct lp_shader_input *inputs,
                          LLVMBuilderRef builder,
@@ -417,7 +423,7 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
    /* XXX: we don't support interpolating into any other types */
    assert(memcmp(&coeff_type, &type, sizeof coeff_type) == 0);
 
-   lp_build_context_init(&bld->coeff_bld, builder, coeff_type);
+   lp_build_context_init(&bld->coeff_bld, gallivm, coeff_type);
 
    /* For convenience */
    bld->pos = bld->attribs[0];
@@ -453,19 +459,21 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
  */
 void
 lp_build_interp_soa_update_inputs(struct lp_build_interp_soa_context *bld,
+                                  struct gallivm_state *gallivm,
                                   int quad_index)
 {
    assert(quad_index < 4);
 
-   attribs_update(bld, quad_index, 1, bld->num_attribs);
+   attribs_update(bld, gallivm, quad_index, 1, bld->num_attribs);
 }
 
 void
 lp_build_interp_soa_update_pos(struct lp_build_interp_soa_context *bld,
+                                  struct gallivm_state *gallivm,
                                   int quad_index)
 {
    assert(quad_index < 4);
 
-   attribs_update(bld, quad_index, 0, 1);
+   attribs_update(bld, gallivm, quad_index, 0, 1);
 }
 
index a7ebdd1bfa2771e51dc33c49397510aab84ff9de..b58b2dc11558fd706b80d40561d190a08b3ee904 100644 (file)
@@ -102,6 +102,7 @@ struct lp_build_interp_soa_context
 
 void
 lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
+                         struct gallivm_state *gallivm,
                          unsigned num_inputs,
                          const struct lp_shader_input *inputs,
                          LLVMBuilderRef builder,
@@ -114,11 +115,13 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
 
 void
 lp_build_interp_soa_update_inputs(struct lp_build_interp_soa_context *bld,
-                           int quad_index);
+                                  struct gallivm_state *gallivm,
+                                  int quad_index);
 
 void
 lp_build_interp_soa_update_pos(struct lp_build_interp_soa_context *bld,
-                           int quad_index);
+                               struct gallivm_state *gallivm,
+                               int quad_index);
 
 
 #endif /* LP_BLD_INTERP_H */
index 763432ed712a197244c515151257d252a8291084..644201ddf7c1580e9aac6d3f22ec466474de95d1 100644 (file)
 DEBUG_GET_ONCE_BOOL_OPTION(lp_no_rast, "LP_NO_RAST", FALSE)
 
 
+/** shared by all contexts */
+unsigned llvmpipe_variant_count;
+
+
+/**
+ * This function is called by the gallivm "garbage collector" when
+ * the LLVM global data structures are freed.  We must free all LLVM-related
+ * data.  Specifically, all JIT'd shader variants.
+ */
+static void
+garbage_collect_callback(void *cb_data)
+{
+   struct llvmpipe_context *lp = (struct llvmpipe_context *) cb_data;
+   struct lp_fs_variant_list_item *li;
+
+   /* Free all the context's shader variants */
+   li = first_elem(&lp->fs_variants_list);
+   while (!at_end(&lp->fs_variants_list, li)) {
+      struct lp_fs_variant_list_item *next = next_elem(li);
+      llvmpipe_remove_shader_variant(lp, li->base);
+      li = next;
+   }
+
+   /* Free all the context's primitive setup variants */
+   lp_delete_setup_variants(lp);
+
+   /* release references to setup variants, shaders */
+   lp_setup_set_setup_variant(lp->setup, NULL);
+   lp_setup_set_fs_variant(lp->setup, NULL);
+   lp_setup_reset(lp->setup);
+
+   /* This type will be recreated upon demand */
+   lp->jit_context_ptr_type = NULL;
+
+   /* mark all state as dirty to ensure new shaders are jit'd, etc. */
+   lp->dirty = ~0;
+}
+
+
+
 static void llvmpipe_destroy( struct pipe_context *pipe )
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
@@ -57,6 +97,9 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
 
    lp_print_counters();
 
+   gallivm_remove_garbage_collector_callback(garbage_collect_callback,
+                                             llvmpipe);
+
    /* This will also destroy llvmpipe->setup:
     */
    if (llvmpipe->draw)
@@ -82,7 +125,11 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
       }
    }
 
-   lp_delete_setup_variants(llvmpipe);
+   for (i = 0; i < llvmpipe->num_vertex_buffers; i++) {
+      pipe_resource_reference(&llvmpipe->vertex_buffer[i].buffer, NULL);
+   }
+
+   gallivm_destroy(llvmpipe->gallivm);
 
    align_free( llvmpipe );
 }
@@ -110,8 +157,10 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
    memset(llvmpipe, 0, sizeof *llvmpipe);
 
    make_empty_list(&llvmpipe->fs_variants_list);
+
    make_empty_list(&llvmpipe->setup_variants_list);
 
+
    llvmpipe->pipe.winsys = screen->winsys;
    llvmpipe->pipe.screen = screen;
    llvmpipe->pipe.priv = priv;
@@ -136,10 +185,12 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
    llvmpipe_init_context_resource_funcs( &llvmpipe->pipe );
    llvmpipe_init_surface_functions(llvmpipe);
 
+   llvmpipe->gallivm = gallivm_create();
+
    /*
     * Create drawing context and plug our rendering stage into it.
     */
-   llvmpipe->draw = draw_create(&llvmpipe->pipe);
+   llvmpipe->draw = draw_create_gallivm(&llvmpipe->pipe, llvmpipe->gallivm);
    if (!llvmpipe->draw)
       goto fail;
 
@@ -173,6 +224,9 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
 
    lp_reset_counters();
 
+   gallivm_register_garbage_collector_callback(garbage_collect_callback,
+                                               llvmpipe);
+
    return &llvmpipe->pipe;
 
  fail:
index a35e09e8b47130f0e0771582cddea13dc029bf15..503f09d810c770ec058ffafdee0ed6229a9ca1dc 100644 (file)
@@ -126,14 +126,27 @@ struct llvmpipe_context {
    unsigned tex_timestamp;
    boolean no_rast;
 
+   /** List of all fragment shader variants */
    struct lp_fs_variant_list_item fs_variants_list;
    unsigned nr_fs_variants;
 
+   /** JIT code generation */
+   struct gallivm_state *gallivm;
+   LLVMTypeRef jit_context_ptr_type;
+
    struct lp_setup_variant_list_item setup_variants_list;
    unsigned nr_setup_variants;
 };
 
 
+/**
+ * Fragment and setup variant count, used to trigger garbage collection.
+ * This is global since all variants in all contexts will be free when
+ * we do garbage collection.
+ */
+extern unsigned llvmpipe_variant_count;
+
+
 struct pipe_context *
 llvmpipe_create_context( struct pipe_screen *screen, void *priv );
 
index e2c723b7a873ad64936b66c95ad42ef271777d61..85e3cdec82c0b244240eb4691fa49a5ad6025599 100644 (file)
@@ -56,6 +56,13 @@ llvmpipe_flush( struct pipe_context *pipe,
    /* ask the setup module to flush */
    lp_setup_flush(llvmpipe->setup, flags, fence, reason);
 
+
+   if (llvmpipe_variant_count > 1000) {
+      /* time to do a garbage collection */
+      gallivm_garbage_collect(llvmpipe->gallivm);
+      llvmpipe_variant_count = 0;
+   }
+
    /* Enable to dump BMPs of the color/depth buffers each frame */
    if (0) {
       if (flags & PIPE_FLUSH_FRAME) {
@@ -101,8 +108,8 @@ llvmpipe_finish( struct pipe_context *pipe,
 boolean
 llvmpipe_flush_resource(struct pipe_context *pipe,
                         struct pipe_resource *resource,
-                        unsigned face,
                         unsigned level,
+                        int layer,
                         unsigned flush_flags,
                         boolean read_only,
                         boolean cpu_access,
@@ -111,7 +118,7 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
 {
    unsigned referenced;
 
-   referenced = pipe->is_resource_referenced(pipe, resource, face, level);
+   referenced = pipe->is_resource_referenced(pipe, resource, level, layer);
 
    if ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
        ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) {
index 3626ce4a86c6249e5e3293f6b70ffea297837839..579d24c68ad185b2398070c4d0689c213f088bd6 100644 (file)
@@ -47,8 +47,8 @@ llvmpipe_finish( struct pipe_context *pipe,
 boolean
 llvmpipe_flush_resource(struct pipe_context *pipe,
                         struct pipe_resource *resource,
-                        unsigned face,
                         unsigned level,
+                        int layer,
                         unsigned flush_flags,
                         boolean read_only,
                         boolean cpu_access,
index c540f9b362880ca15e2cdf38a91fee1ae8994641..482a902dd23116e7c13c34b36fbbb66b952c6621 100644 (file)
  */
 
 
-#include <llvm-c/Transforms/Scalar.h>
-
 #include "util/u_memory.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_debug.h"
-#include "lp_screen.h"
-#include "gallivm/lp_bld_intr.h"
+#include "lp_context.h"
 #include "lp_jit.h"
 
 
 static void
-lp_jit_init_globals(struct llvmpipe_screen *screen)
+lp_jit_create_types(struct llvmpipe_context *lp)
 {
+   struct gallivm_state *gallivm = lp->gallivm;
+   LLVMContextRef lc = gallivm->context;
    LLVMTypeRef texture_type;
 
    /* struct lp_jit_texture */
    {
       LLVMTypeRef elem_types[LP_JIT_TEXTURE_NUM_FIELDS];
 
-      elem_types[LP_JIT_TEXTURE_WIDTH]  = LLVMInt32Type();
-      elem_types[LP_JIT_TEXTURE_HEIGHT] = LLVMInt32Type();
-      elem_types[LP_JIT_TEXTURE_DEPTH] = LLVMInt32Type();
-      elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type();
+      elem_types[LP_JIT_TEXTURE_WIDTH]  =
+      elem_types[LP_JIT_TEXTURE_HEIGHT] =
+      elem_types[LP_JIT_TEXTURE_DEPTH] =
+      elem_types[LP_JIT_TEXTURE_LAST_LEVEL] =  LLVMInt32TypeInContext(lc);
       elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
-         LLVMArrayType(LLVMInt32Type(), LP_MAX_TEXTURE_LEVELS);
       elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
-         LLVMArrayType(LLVMInt32Type(), LP_MAX_TEXTURE_LEVELS);
+         LLVMArrayType(LLVMInt32TypeInContext(lc), LP_MAX_TEXTURE_LEVELS);
       elem_types[LP_JIT_TEXTURE_DATA] =
-         LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0),
+         LLVMArrayType(LLVMPointerType(LLVMInt8TypeInContext(lc), 0),
                        LP_MAX_TEXTURE_LEVELS);
-      elem_types[LP_JIT_TEXTURE_MIN_LOD] = LLVMFloatType();
-      elem_types[LP_JIT_TEXTURE_MAX_LOD] = LLVMFloatType();
-      elem_types[LP_JIT_TEXTURE_LOD_BIAS] = LLVMFloatType();
+      elem_types[LP_JIT_TEXTURE_MIN_LOD] =
+      elem_types[LP_JIT_TEXTURE_MAX_LOD] =
+      elem_types[LP_JIT_TEXTURE_LOD_BIAS] = LLVMFloatTypeInContext(lc);
       elem_types[LP_JIT_TEXTURE_BORDER_COLOR] = 
-         LLVMArrayType(LLVMFloatType(), 4);
+         LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
+
+      texture_type = LLVMStructTypeInContext(lc, elem_types,
+                                             Elements(elem_types), 0);
 
-      texture_type = LLVMStructType(elem_types, Elements(elem_types), 0);
+      LLVMInvalidateStructLayout(gallivm->target, texture_type);
 
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, width,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_WIDTH);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, height,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_HEIGHT);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_DEPTH);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_LAST_LEVEL);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, row_stride,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_ROW_STRIDE);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, img_stride,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_IMG_STRIDE);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, data,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_DATA);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, min_lod,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_MIN_LOD);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, max_lod,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_MAX_LOD);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, lod_bias,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_LOD_BIAS);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, border_color,
-                             screen->target, texture_type,
+                             gallivm->target, texture_type,
                              LP_JIT_TEXTURE_BORDER_COLOR);
 
       LP_CHECK_STRUCT_SIZE(struct lp_jit_texture,
-                           screen->target, texture_type);
+                           gallivm->target, texture_type);
 
-      LLVMAddTypeName(screen->module, "texture", texture_type);
+      LLVMAddTypeName(gallivm->module, "texture", texture_type);
    }
 
    /* struct lp_jit_context */
@@ -116,44 +117,47 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
       LLVMTypeRef elem_types[LP_JIT_CTX_COUNT];
       LLVMTypeRef context_type;
 
-      elem_types[LP_JIT_CTX_CONSTANTS] = LLVMPointerType(LLVMFloatType(), 0);
-      elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatType();
-      elem_types[LP_JIT_CTX_STENCIL_REF_FRONT] = LLVMInt32Type();
-      elem_types[LP_JIT_CTX_STENCIL_REF_BACK] = LLVMInt32Type();
-      elem_types[LP_JIT_CTX_BLEND_COLOR] = LLVMPointerType(LLVMInt8Type(), 0);
+      elem_types[LP_JIT_CTX_CONSTANTS] = LLVMPointerType(LLVMFloatTypeInContext(lc), 0);
+      elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatTypeInContext(lc);
+      elem_types[LP_JIT_CTX_STENCIL_REF_FRONT] =
+      elem_types[LP_JIT_CTX_STENCIL_REF_BACK] = LLVMInt32TypeInContext(lc);
+      elem_types[LP_JIT_CTX_BLEND_COLOR] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
       elem_types[LP_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type,
                                                       PIPE_MAX_SAMPLERS);
 
-      context_type = LLVMStructType(elem_types, Elements(elem_types), 0);
+      context_type = LLVMStructTypeInContext(lc, elem_types,
+                                             Elements(elem_types), 0);
+
+      LLVMInvalidateStructLayout(gallivm->target, context_type);
 
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants,
-                             screen->target, context_type,
+                             gallivm->target, context_type,
                              LP_JIT_CTX_CONSTANTS);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value,
-                             screen->target, context_type,
+                             gallivm->target, context_type,
                              LP_JIT_CTX_ALPHA_REF);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref_front,
-                             screen->target, context_type,
+                             gallivm->target, context_type,
                              LP_JIT_CTX_STENCIL_REF_FRONT);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref_back,
-                             screen->target, context_type,
+                             gallivm->target, context_type,
                              LP_JIT_CTX_STENCIL_REF_BACK);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, blend_color,
-                             screen->target, context_type,
+                             gallivm->target, context_type,
                              LP_JIT_CTX_BLEND_COLOR);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, textures,
-                             screen->target, context_type,
+                             gallivm->target, context_type,
                              LP_JIT_CTX_TEXTURES);
       LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
-                           screen->target, context_type);
+                           gallivm->target, context_type);
 
-      LLVMAddTypeName(screen->module, "context", context_type);
+      LLVMAddTypeName(gallivm->module, "context", context_type);
 
-      screen->context_ptr_type = LLVMPointerType(context_type, 0);
+      lp->jit_context_ptr_type = LLVMPointerType(context_type, 0);
    }
 
    if (gallivm_debug & GALLIVM_DEBUG_IR) {
-      LLVMDumpModule(screen->module);
+      LLVMDumpModule(gallivm->module);
    }
 }
 
@@ -161,8 +165,7 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
 void
 lp_jit_screen_cleanup(struct llvmpipe_screen *screen)
 {
-   if(screen->pass)
-      LLVMDisposePassManager(screen->pass);
+   /* nothing */
 }
 
 
@@ -170,30 +173,14 @@ void
 lp_jit_screen_init(struct llvmpipe_screen *screen)
 {
    lp_build_init();
+}
 
-   screen->module = lp_build_module;
-   screen->provider = lp_build_provider;
-   screen->engine = lp_build_engine;
-   screen->target = lp_build_target;
-
-   screen->pass = LLVMCreateFunctionPassManager(screen->provider);
-   LLVMAddTargetData(screen->target, screen->pass);
-
-   if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
-      /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-       * but there are more on SVN. */
-      /* TODO: Add more passes */
-      LLVMAddCFGSimplificationPass(screen->pass);
-      LLVMAddPromoteMemoryToRegisterPass(screen->pass);
-      LLVMAddConstantPropagationPass(screen->pass);
-      LLVMAddInstructionCombiningPass(screen->pass);
-      LLVMAddGVNPass(screen->pass);
-   } else {
-      /* We need at least this pass to prevent the backends to fail in
-       * unexpected ways.
-       */
-      LLVMAddPromoteMemoryToRegisterPass(screen->pass);
-   }
 
-   lp_jit_init_globals(screen);
+LLVMTypeRef
+lp_jit_get_context_type(struct llvmpipe_context *lp)
+{
+   if (!lp->jit_context_ptr_type)
+      lp_jit_create_types(lp);
+
+   return lp->jit_context_ptr_type;
 }
index 114f21f2d16fa4184a25364a49a807678b224ac3..a6763dce17abf5bcf155096360d1529f5d5267b8 100644 (file)
@@ -120,23 +120,23 @@ enum {
 };
 
 
-#define lp_jit_context_constants(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
+#define lp_jit_context_constants(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
 
-#define lp_jit_context_alpha_ref_value(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
+#define lp_jit_context_alpha_ref_value(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
 
-#define lp_jit_context_stencil_ref_front_value(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_STENCIL_REF_FRONT, "stencil_ref_front")
+#define lp_jit_context_stencil_ref_front_value(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_STENCIL_REF_FRONT, "stencil_ref_front")
 
-#define lp_jit_context_stencil_ref_back_value(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_STENCIL_REF_BACK, "stencil_ref_back")
+#define lp_jit_context_stencil_ref_back_value(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_STENCIL_REF_BACK, "stencil_ref_back")
 
-#define lp_jit_context_blend_color(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_BLEND_COLOR, "blend_color")
+#define lp_jit_context_blend_color(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_BLEND_COLOR, "blend_color")
 
-#define lp_jit_context_textures(_builder, _ptr) \
-   lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CTX_TEXTURES, "textures")
+#define lp_jit_context_textures(_gallivm, _ptr) \
+   lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_TEXTURES, "textures")
 
 
 
@@ -162,4 +162,8 @@ void
 lp_jit_screen_init(struct llvmpipe_screen *screen);
 
 
+LLVMTypeRef
+lp_jit_get_context_type(struct llvmpipe_context *lp);
+
+
 #endif /* LP_JIT_H */
index b23a100b8737538160bfe3f9c21c506ab1b949f1..455adf7d6f85a1e479b8440750ea435ac6303fe2 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef LP_PERF_H
 #define LP_PERF_H
 
+#include "pipe/p_compiler.h"
 
 /**
  * Various counters
index decf3bd44991bc46dd3ed45d7c3a4af40e5ec1c2..dafadc1ea9bce176c3a48fa880a0cbb168d9e632 100644 (file)
@@ -47,6 +47,7 @@
 #ifdef DEBUG
 int jit_line = 0;
 const struct lp_rast_state *jit_state = NULL;
+const struct lp_rasterizer_task *jit_task = NULL;
 #endif
 
 
@@ -119,8 +120,8 @@ lp_rast_tile_begin(struct lp_rasterizer_task *task,
           * and update the tile's layout info.
           */
          (void) llvmpipe_get_texture_tile(lpt,
-                                          zsbuf->face + zsbuf->zslice,
-                                          zsbuf->level,
+                                          zsbuf->u.tex.first_layer,
+                                          zsbuf->u.tex.level,
                                           usage,
                                           task->x,
                                           task->y);
@@ -288,7 +289,6 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task,
 
 
 
-
 /**
  * Convert the color tile from tiled to linear layout.
  * This is generally only done when we're flushing the scene just prior to
@@ -306,15 +306,15 @@ lp_rast_store_linear_color( struct lp_rasterizer_task *task )
 
    for (buf = 0; buf < scene->fb.nr_cbufs; buf++) {
       struct pipe_surface *cbuf = scene->fb.cbufs[buf];
-      const unsigned face_slice = cbuf->face + cbuf->zslice;
-      const unsigned level = cbuf->level;
+      const unsigned layer = cbuf->u.tex.first_layer;
+      const unsigned level = cbuf->u.tex.level;
       struct llvmpipe_resource *lpt = llvmpipe_resource(cbuf->texture);
 
       if (!task->color_tiles[buf])
          continue;
 
       llvmpipe_unswizzle_cbuf_tile(lpt,
-                                   face_slice,
+                                   layer,
                                    level,
                                    task->x, task->y,
                                    task->color_tiles[buf]);
@@ -362,7 +362,7 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
          depth = lp_rast_get_depth_block_pointer(task, tile_x + x, tile_y + y);
 
          /* run shader on 4x4 block */
-         BEGIN_JIT_CALL(state);
+         BEGIN_JIT_CALL(state, task);
          variant->jit_function[RAST_WHOLE]( &state->jit_context,
                                             tile_x + x, tile_y + y,
                                             inputs->frontfacing,
@@ -443,7 +443,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task,
    assert(lp_check_alignment(state->jit_context.blend_color, 16));
 
    /* run shader on 4x4 block */
-   BEGIN_JIT_CALL(state);
+   BEGIN_JIT_CALL(state, task);
    variant->jit_function[RAST_EDGE_TEST](&state->jit_context,
                                          x, y,
                                          inputs->frontfacing,
index b30408f097bf95e5f323ad74f1b0db07d27a84e3..cd686bc82c13fc3a769359db0e62799c05133d3a 100644 (file)
  */
 #ifdef DEBUG
 
+struct lp_rasterizer_task;
 extern int jit_line;
 extern const struct lp_rast_state *jit_state;
+extern const struct lp_rasterizer_task *jit_task;
 
-#define BEGIN_JIT_CALL(state) \
+#define BEGIN_JIT_CALL(state, task)                  \
    do { \
       jit_line = __LINE__; \
       jit_state = state; \
+      jit_task = task; \
    } while (0)
 
 #define END_JIT_CALL() \
@@ -62,7 +65,7 @@ extern const struct lp_rast_state *jit_state;
 
 #else
 
-#define BEGIN_JIT_CALL(X)
+#define BEGIN_JIT_CALL(X, Y)
 #define END_JIT_CALL()
 
 #endif
@@ -191,8 +194,8 @@ lp_rast_get_color_tile_pointer(struct lp_rasterizer_task *task,
 
       if (usage != LP_TEX_USAGE_WRITE_ALL) {
          llvmpipe_swizzle_cbuf_tile(lpt,
-                                    cbuf->face + cbuf->zslice,
-                                    cbuf->level,
+                                    cbuf->u.tex.first_layer,
+                                    cbuf->u.tex.level,
                                     task->x, task->y,
                                     task->color_tiles[buf]);
       }
@@ -258,7 +261,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
    depth = lp_rast_get_depth_block_pointer(task, x, y);
 
    /* run shader on 4x4 block */
-   BEGIN_JIT_CALL(state);
+   BEGIN_JIT_CALL(state, task);
    variant->jit_function[RAST_WHOLE]( &state->jit_context,
                                       x, y,
                                       inputs->frontfacing,
index a4fdf7cff3626f8d3bf9587f988cef2b9523b285..5d0f5f8b7b58f5dcb451c658f1135b46c0f8b544 100644 (file)
@@ -74,6 +74,7 @@ lp_scene_create( struct pipe_context *pipe )
 void
 lp_scene_destroy(struct lp_scene *scene)
 {
+   lp_fence_reference(&scene->fence, NULL);
    pipe_mutex_destroy(scene->mutex);
    assert(scene->data.head->next == NULL);
    FREE(scene->data.head);
@@ -136,30 +137,30 @@ lp_scene_begin_rasterization(struct lp_scene *scene)
    int i;
 
    //LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
-   
+
    for (i = 0; i < scene->fb.nr_cbufs; i++) {
       struct pipe_surface *cbuf = scene->fb.cbufs[i];
+      assert(cbuf->u.tex.first_layer == cbuf->u.tex.last_layer);
       scene->cbufs[i].stride = llvmpipe_resource_stride(cbuf->texture,
-                                                        cbuf->level);
+                                                        cbuf->u.tex.level);
 
       scene->cbufs[i].map = llvmpipe_resource_map(cbuf->texture,
-                                                  cbuf->face,
-                                                  cbuf->level,
-                                                  cbuf->zslice,
+                                                  cbuf->u.tex.level,
+                                                  cbuf->u.tex.first_layer,
                                                   LP_TEX_USAGE_READ_WRITE,
                                                   LP_TEX_LAYOUT_LINEAR);
    }
 
    if (fb->zsbuf) {
       struct pipe_surface *zsbuf = scene->fb.zsbuf;
-      scene->zsbuf.stride = llvmpipe_resource_stride(zsbuf->texture, zsbuf->level);
+      assert(zsbuf->u.tex.first_layer == zsbuf->u.tex.last_layer);
+      scene->zsbuf.stride = llvmpipe_resource_stride(zsbuf->texture, zsbuf->u.tex.level);
       scene->zsbuf.blocksize = 
          util_format_get_blocksize(zsbuf->texture->format);
 
       scene->zsbuf.map = llvmpipe_resource_map(zsbuf->texture,
-                                               zsbuf->face,
-                                               zsbuf->level,
-                                               zsbuf->zslice,
+                                               zsbuf->u.tex.level,
+                                               zsbuf->u.tex.first_layer,
                                                LP_TEX_USAGE_READ_WRITE,
                                                LP_TEX_LAYOUT_NONE);
    }
@@ -181,9 +182,8 @@ lp_scene_end_rasterization(struct lp_scene *scene )
       if (scene->cbufs[i].map) {
          struct pipe_surface *cbuf = scene->fb.cbufs[i];
          llvmpipe_resource_unmap(cbuf->texture,
-                                 cbuf->face,
-                                 cbuf->level,
-                                 cbuf->zslice);
+                                 cbuf->u.tex.level,
+                                 cbuf->u.tex.first_layer);
          scene->cbufs[i].map = NULL;
       }
    }
@@ -192,9 +192,8 @@ lp_scene_end_rasterization(struct lp_scene *scene )
    if (scene->zsbuf.map) {
       struct pipe_surface *zsbuf = scene->fb.zsbuf;
       llvmpipe_resource_unmap(zsbuf->texture,
-                             zsbuf->face,
-                             zsbuf->level,
-                             zsbuf->zslice);
+                              zsbuf->u.tex.level,
+                              zsbuf->u.tex.first_layer);
       scene->zsbuf.map = NULL;
    }
 
index fd7c65a2c8b299ad9435283efefeabf4fc4b1bfb..dd9ab593b4acaa8fd4a141802433e9a932dd0216 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef LP_SCENE_QUEUE
 #define LP_SCENE_QUEUE
 
+#include "pipe/p_compiler.h"
+
 struct lp_scene_queue;
 struct lp_scene;
 
index 43904343c3a26bf20e5a1b0684c0c7cd6e35016d..b6919a5c6d3d19470e3203a90e3a786b2ff69819 100644 (file)
@@ -289,12 +289,13 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
 
 static void
 llvmpipe_flush_frontbuffer(struct pipe_screen *_screen,
-                           struct pipe_surface *surface,
+                           struct pipe_resource *resource,
+                           unsigned level, unsigned layer,
                            void *context_private)
 {
    struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
    struct sw_winsys *winsys = screen->winsys;
-   struct llvmpipe_resource *texture = llvmpipe_resource(surface->texture);
+   struct llvmpipe_resource *texture = llvmpipe_resource(resource);
 
    assert(texture->dt);
    if (texture->dt)
index 731526dfabebc72e28d8ddb5a0a0a30a08d29e4f..7f69a11a6e3a1ccb8c46eb35d6a48a5ddabf6097 100644 (file)
 #ifndef LP_SCREEN_H
 #define LP_SCREEN_H
 
-#include "gallivm/lp_bld.h"
-#include <llvm-c/ExecutionEngine.h>
-
-#include "os/os_thread.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_defines.h"
+#include "os/os_thread.h"
+#include "gallivm/lp_bld.h"
 
 
 struct sw_winsys;
@@ -51,14 +49,6 @@ struct llvmpipe_screen
 
    struct sw_winsys *winsys;
 
-   LLVMModuleRef module;
-   LLVMExecutionEngineRef engine;
-   LLVMModuleProviderRef provider;
-   LLVMTargetDataRef target;
-   LLVMPassManagerRef pass;
-
-   LLVMTypeRef context_ptr_type;
-
    unsigned num_threads;
 
    /* Increments whenever textures are modified.  Contexts can track this.
index 6118434d3d36ac828e26de63cedebaf5aefb856d..5d83a1e3579b5d51390b951b51096c6406ddf16a 100644 (file)
@@ -114,7 +114,7 @@ first_point( struct lp_setup_context *setup,
    setup->point( setup, v0 );
 }
 
-static void lp_setup_reset( struct lp_setup_context *setup )
+void lp_setup_reset( struct lp_setup_context *setup )
 {
    LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
 
@@ -263,7 +263,6 @@ execute_clears( struct lp_setup_context *setup )
 
 const char *states[] = {
    "FLUSHED",
-   "EMPTY  ",
    "CLEARED",
    "ACTIVE "
 };
@@ -913,6 +912,12 @@ lp_setup_update_state( struct lp_setup_context *setup,
          llvmpipe_update_derived(lp);
       }
 
+      if (lp->setup->dirty) {
+         llvmpipe_update_setup(lp);
+      }
+
+      assert(setup->setup.variant);
+
       /* Will probably need to move this somewhere else, just need  
        * to know about vertex shader point size attribute.
        */
@@ -928,7 +933,7 @@ lp_setup_update_state( struct lp_setup_context *setup,
                    setup->setup.variant->key.size) == 0);
    }
 
-   if (update_scene) {
+   if (update_scene && setup->state != SETUP_ACTIVE) {
       if (!set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ ))
          return FALSE;
    }
@@ -991,6 +996,8 @@ lp_setup_destroy( struct lp_setup_context *setup )
       lp_scene_destroy(scene);
    }
 
+   lp_fence_reference(&setup->last_fence, NULL);
+
    FREE( setup );
 }
 
index ebb18f813444b3a1c8dc84cce454705ff1c9d09f..0d6e161a2188df54d8a4169ec39bbbf16b269315 100644 (file)
@@ -45,6 +45,9 @@ struct lp_jit_context;
 struct llvmpipe_query;
 struct pipe_fence_handle;
 struct lp_setup_variant;
+struct lp_setup_context;
+
+void lp_setup_reset( struct lp_setup_context *setup );
 
 struct lp_setup_context *
 lp_setup_create( struct pipe_context *pipe,
index 9c1f0fe793903426dd70f4f7baf041d41482087b..384242f81d708ca8c8be93c02679b44d06bed7e2 100644 (file)
@@ -141,6 +141,8 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr)
    const boolean flatshade_first = setup->flatshade_first;
    unsigned i;
 
+   assert(setup->setup.variant);
+
    if (!lp_setup_update_state(setup, TRUE))
       return;
 
index cd67d4886163ca74211d9b8568745954206cfbe6..1b9119eda0020f00579f1cf6939040c1fdcd6fca 100644 (file)
@@ -90,7 +90,6 @@
 #include "lp_context.h"
 #include "lp_debug.h"
 #include "lp_perf.h"
-#include "lp_screen.h"
 #include "lp_setup.h"
 #include "lp_state.h"
 #include "lp_tex_sample.h"
 #include <llvm-c/BitWriter.h>
 
 
+/** Fragment shader number (for debugging) */
 static unsigned fs_no = 0;
 
 
-
 /**
  * Expand the relevent bits of mask_input to a 4-dword mask for the 
  * four pixels in a 2x2 quad.  This will set the four elements of the
@@ -115,13 +114,14 @@ static unsigned fs_no = 0;
  * \param mask_input  bitwise mask for the whole 4x4 stamp
  */
 static LLVMValueRef
-generate_quad_mask(LLVMBuilderRef builder,
+generate_quad_mask(struct gallivm_state *gallivm,
                    struct lp_type fs_type,
                    unsigned quad,
                    LLVMValueRef mask_input) /* int32 */
 {
+   LLVMBuilderRef builder = gallivm->builder;
    struct lp_type mask_type;
-   LLVMTypeRef i32t = LLVMInt32Type();
+   LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
    LLVMValueRef bits[4];
    LLVMValueRef mask;
    int shift;
@@ -136,7 +136,6 @@ generate_quad_mask(LLVMBuilderRef builder,
    /*
     * mask_input >>= (quad * 4)
     */
-   
    switch (quad) {
    case 0:
       shift = 0;
@@ -163,8 +162,9 @@ generate_quad_mask(LLVMBuilderRef builder,
    /*
     * mask = { mask_input & (1 << i), for i in [0,3] }
     */
-
-   mask = lp_build_broadcast(builder, lp_build_vec_type(mask_type), mask_input);
+   mask = lp_build_broadcast(gallivm,
+                             lp_build_vec_type(gallivm, mask_type),
+                             mask_input);
 
    bits[0] = LLVMConstInt(i32t, 1 << 0, 0);
    bits[1] = LLVMConstInt(i32t, 1 << 1, 0);
@@ -176,11 +176,10 @@ generate_quad_mask(LLVMBuilderRef builder,
    /*
     * mask = mask != 0 ? ~0 : 0
     */
-
-   mask = lp_build_compare(builder,
+   mask = lp_build_compare(gallivm,
                            mask_type, PIPE_FUNC_NOTEQUAL,
                            mask,
-                           lp_build_const_int_vec(mask_type, 0));
+                           lp_build_const_int_vec(gallivm, mask_type, 0));
 
    return mask;
 }
@@ -213,7 +212,8 @@ find_output_by_semantic( const struct tgsi_shader_info *info,
  * \param partial_mask  if 1, do mask_input testing
  */
 static void
-generate_fs(struct lp_fragment_shader *shader,
+generate_fs(struct gallivm_state *gallivm,
+            struct lp_fragment_shader *shader,
             const struct lp_fragment_shader_variant_key *key,
             LLVMBuilderRef builder,
             struct lp_type type,
@@ -278,42 +278,42 @@ generate_fs(struct lp_fragment_shader *shader,
 
    assert(i < 4);
 
-   stencil_refs[0] = lp_jit_context_stencil_ref_front_value(builder, context_ptr);
-   stencil_refs[1] = lp_jit_context_stencil_ref_back_value(builder, context_ptr);
+   stencil_refs[0] = lp_jit_context_stencil_ref_front_value(gallivm, context_ptr);
+   stencil_refs[1] = lp_jit_context_stencil_ref_back_value(gallivm, context_ptr);
 
-   vec_type = lp_build_vec_type(type);
+   vec_type = lp_build_vec_type(gallivm, type);
 
-   consts_ptr = lp_jit_context_constants(builder, context_ptr);
+   consts_ptr = lp_jit_context_constants(gallivm, context_ptr);
 
    memset(outputs, 0, sizeof outputs);
 
    /* Declare the color and z variables */
    for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) {
       for(chan = 0; chan < NUM_CHANNELS; ++chan) {
-        color[cbuf][chan] = lp_build_alloca(builder, vec_type, "color");
+        color[cbuf][chan] = lp_build_alloca(gallivm, vec_type, "color");
       }
    }
 
    /* do triangle edge testing */
    if (partial_mask) {
-      *pmask = generate_quad_mask(builder, type,
+      *pmask = generate_quad_mask(gallivm, type,
                                   i, mask_input);
    }
    else {
-      *pmask = lp_build_const_int_vec(type, ~0);
+      *pmask = lp_build_const_int_vec(gallivm, type, ~0);
    }
 
    /* 'mask' will control execution based on quad's pixel alive/killed state */
-   lp_build_mask_begin(&mask, builder, type, *pmask);
+   lp_build_mask_begin(&mask, gallivm, type, *pmask);
 
    if (!(depth_mode & EARLY_DEPTH_TEST) && !simple_shader)
       lp_build_mask_check(&mask);
 
-   lp_build_interp_soa_update_pos(interp, i);
+   lp_build_interp_soa_update_pos(interp, gallivm, i);
    z = interp->pos[2];
 
    if (depth_mode & EARLY_DEPTH_TEST) {
-      lp_build_depth_stencil_test(builder,
+      lp_build_depth_stencil_test(gallivm,
                                   &key->depth,
                                   key->stencil,
                                   type,
@@ -330,15 +330,14 @@ generate_fs(struct lp_fragment_shader *shader,
       }
    }
 
-   lp_build_interp_soa_update_inputs(interp, i);
+   lp_build_interp_soa_update_inputs(interp, gallivm, i);
    
    /* Build the actual shader */
-   lp_build_tgsi_soa(builder, tokens, type, &mask,
+   lp_build_tgsi_soa(gallivm, tokens, type, &mask,
                      consts_ptr, NULL, /* sys values array */
                      interp->pos, interp->inputs,
                      outputs, sampler, &shader->info.base);
 
-
    /* Alpha test */
    if (key->alpha.enabled) {
       int color0 = find_output_by_semantic(&shader->info.base,
@@ -349,10 +348,10 @@ generate_fs(struct lp_fragment_shader *shader,
          LLVMValueRef alpha = LLVMBuildLoad(builder, outputs[color0][3], "alpha");
          LLVMValueRef alpha_ref_value;
 
-         alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr);
-         alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value);
+         alpha_ref_value = lp_jit_context_alpha_ref_value(gallivm, context_ptr);
+         alpha_ref_value = lp_build_broadcast(gallivm, vec_type, alpha_ref_value);
 
-         lp_build_alpha_test(builder, key->alpha.func, type,
+         lp_build_alpha_test(gallivm, key->alpha.func, type,
                              &mask, alpha, alpha_ref_value,
                              (depth_mode & LATE_DEPTH_TEST) != 0);
       }
@@ -368,7 +367,7 @@ generate_fs(struct lp_fragment_shader *shader,
          z = LLVMBuildLoad(builder, outputs[pos0][2], "output.z");
       }
 
-      lp_build_depth_stencil_test(builder,
+      lp_build_depth_stencil_test(gallivm,
                                   &key->depth,
                                   key->stencil,
                                   type,
@@ -391,7 +390,7 @@ generate_fs(struct lp_fragment_shader *shader,
        * depth value, update from zs_value with the new mask value and
        * write that out.
        */
-      lp_build_deferred_depth_write(builder,
+      lp_build_deferred_depth_write(gallivm,
                                     type,
                                     zs_format_desc,
                                     &mask,
@@ -421,7 +420,7 @@ generate_fs(struct lp_fragment_shader *shader,
    }
 
    if (counter)
-      lp_build_occlusion_count(builder, type,
+      lp_build_occlusion_count(gallivm, type,
                                lp_build_mask_value(&mask), counter);
 
    *pmask = lp_build_mask_end(&mask);
@@ -438,7 +437,8 @@ generate_fs(struct lp_fragment_shader *shader,
  * \param dst_ptr  the destination color buffer pointer
  */
 static void
-generate_blend(const struct pipe_blend_state *blend,
+generate_blend(struct gallivm_state *gallivm,
+               const struct pipe_blend_state *blend,
                unsigned rt,
                LLVMBuilderRef builder,
                struct lp_type type,
@@ -457,21 +457,21 @@ generate_blend(const struct pipe_blend_state *blend,
    LLVMValueRef res[4];
    unsigned chan;
 
-   lp_build_context_init(&bld, builder, type);
+   lp_build_context_init(&bld, gallivm, type);
 
-   lp_build_mask_begin(&mask_ctx, builder, type, mask);
+   lp_build_mask_begin(&mask_ctx, gallivm, type, mask);
    if (do_branch)
       lp_build_mask_check(&mask_ctx);
 
-   vec_type = lp_build_vec_type(type);
+   vec_type = lp_build_vec_type(gallivm, type);
 
-   const_ptr = lp_jit_context_blend_color(builder, context_ptr);
+   const_ptr = lp_jit_context_blend_color(gallivm, context_ptr);
    const_ptr = LLVMBuildBitCast(builder, const_ptr,
                                 LLVMPointerType(vec_type, 0), "");
 
    /* load constant blend color and colors from the dest color buffer */
    for(chan = 0; chan < 4; ++chan) {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), chan, 0);
+      LLVMValueRef index = lp_build_const_int32(gallivm, chan);
       con[chan] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, const_ptr, &index, 1, ""), "");
 
       dst[chan] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, dst_ptr, &index, 1, ""), "");
@@ -481,12 +481,12 @@ generate_blend(const struct pipe_blend_state *blend,
    }
 
    /* do blend */
-   lp_build_blend_soa(builder, blend, type, rt, src, dst, con, res);
+   lp_build_blend_soa(gallivm, blend, type, rt, src, dst, con, res);
 
    /* store results to color buffer */
    for(chan = 0; chan < 4; ++chan) {
       if(blend->rt[rt].colormask & (1 << chan)) {
-         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), chan, 0);
+         LLVMValueRef index = lp_build_const_int32(gallivm, chan);
          lp_build_name(res[chan], "res.%c", "rgba"[chan]);
          res[chan] = lp_build_select(&bld, mask, res[chan], dst[chan]);
          LLVMBuildStore(builder, res[chan], LLVMBuildGEP(builder, dst_ptr, &index, 1, ""));
@@ -504,11 +504,12 @@ generate_blend(const struct pipe_blend_state *blend,
  * 2x2 pixels.
  */
 static void
-generate_fragment(struct llvmpipe_screen *screen,
+generate_fragment(struct llvmpipe_context *lp,
                   struct lp_fragment_shader *shader,
                   struct lp_fragment_shader_variant *variant,
                   unsigned partial_mask)
 {
+   struct gallivm_state *gallivm = lp->gallivm;
    const struct lp_fragment_shader_variant_key *key = &variant->key;
    struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
    char func_name[256];
@@ -519,6 +520,8 @@ generate_fragment(struct llvmpipe_screen *screen,
    LLVMTypeRef blend_vec_type;
    LLVMTypeRef arg_types[11];
    LLVMTypeRef func_type;
+   LLVMTypeRef int32_type = LLVMInt32TypeInContext(gallivm->context);
+   LLVMTypeRef int8_type = LLVMInt8TypeInContext(gallivm->context);
    LLVMValueRef context_ptr;
    LLVMValueRef x;
    LLVMValueRef y;
@@ -580,29 +583,30 @@ generate_fragment(struct llvmpipe_screen *screen,
     * lp_jit.h's lp_jit_frag_func function pointer type, and vice-versa.
     */
 
-   fs_elem_type = lp_build_elem_type(fs_type);
-   fs_int_vec_type = lp_build_int_vec_type(fs_type);
+   fs_elem_type = lp_build_elem_type(gallivm, fs_type);
+   fs_int_vec_type = lp_build_int_vec_type(gallivm, fs_type);
 
-   blend_vec_type = lp_build_vec_type(blend_type);
+   blend_vec_type = lp_build_vec_type(gallivm, blend_type);
 
    util_snprintf(func_name, sizeof(func_name), "fs%u_variant%u_%s", 
                 shader->no, variant->no, partial_mask ? "partial" : "whole");
 
-   arg_types[0] = screen->context_ptr_type;            /* context */
-   arg_types[1] = LLVMInt32Type();                     /* x */
-   arg_types[2] = LLVMInt32Type();                     /* y */
-   arg_types[3] = LLVMInt32Type();                     /* facing */
+   arg_types[0] = lp_jit_get_context_type(lp);         /* context */
+   arg_types[1] = int32_type;                          /* x */
+   arg_types[2] = int32_type;                          /* y */
+   arg_types[3] = int32_type;                          /* facing */
    arg_types[4] = LLVMPointerType(fs_elem_type, 0);    /* a0 */
    arg_types[5] = LLVMPointerType(fs_elem_type, 0);    /* dadx */
    arg_types[6] = LLVMPointerType(fs_elem_type, 0);    /* dady */
    arg_types[7] = LLVMPointerType(LLVMPointerType(blend_vec_type, 0), 0);  /* color */
-   arg_types[8] = LLVMPointerType(LLVMInt8Type(), 0);  /* depth */
-   arg_types[9] = LLVMInt32Type();                     /* mask_input */
-   arg_types[10] = LLVMPointerType(LLVMInt32Type(), 0);/* counter */
+   arg_types[8] = LLVMPointerType(int8_type, 0);       /* depth */
+   arg_types[9] = int32_type;                          /* mask_input */
+   arg_types[10] = LLVMPointerType(int32_type, 0);     /* counter */
 
-   func_type = LLVMFunctionType(LLVMVoidType(), arg_types, Elements(arg_types), 0);
+   func_type = LLVMFunctionType(LLVMVoidTypeInContext(gallivm->context),
+                                arg_types, Elements(arg_types), 0);
 
-   function = LLVMAddFunction(screen->module, func_name, func_type);
+   function = LLVMAddFunction(gallivm->module, func_name, func_type);
    LLVMSetFunctionCallConv(function, LLVMCCallConv);
 
    variant->function[partial_mask] = function;
@@ -644,8 +648,9 @@ generate_fragment(struct llvmpipe_screen *screen,
     * Function body
     */
 
-   block = LLVMAppendBasicBlock(function, "entry");
-   builder = LLVMCreateBuilder();
+   block = LLVMAppendBasicBlockInContext(gallivm->context, function, "entry");
+   builder = gallivm->builder;
+   assert(builder);
    LLVMPositionBuilderAtEnd(builder, block);
 
    /*
@@ -654,6 +659,7 @@ generate_fragment(struct llvmpipe_screen *screen,
     * already included in the shader key.
     */
    lp_build_interp_soa_init(&interp, 
+                            gallivm,
                             shader->info.base.num_inputs,
                             inputs,
                             builder, fs_type,
@@ -667,7 +673,7 @@ generate_fragment(struct llvmpipe_screen *screen,
    zs_format_desc = util_format_description(key->zsbuf_format);
 
    for(i = 0; i < num_fs; ++i) {
-      LLVMValueRef depth_offset = LLVMConstInt(LLVMInt32Type(),
+      LLVMValueRef depth_offset = LLVMConstInt(int32_type,
                                                i*fs_type.length*zs_format_desc->block.bits/8,
                                                0);
       LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS];
@@ -675,7 +681,8 @@ generate_fragment(struct llvmpipe_screen *screen,
 
       depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &depth_offset, 1, "");
 
-      generate_fs(shader, key,
+      generate_fs(gallivm,
+                  shader, key,
                   builder,
                   fs_type,
                   context_ptr,
@@ -701,7 +708,7 @@ generate_fragment(struct llvmpipe_screen *screen,
     */
    for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) {
       LLVMValueRef color_ptr;
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), cbuf, 0);
+      LLVMValueRef index = lp_build_const_int32(gallivm, cbuf);
       LLVMValueRef blend_in_color[NUM_CHANNELS];
       unsigned rt;
 
@@ -716,7 +723,7 @@ generate_fragment(struct llvmpipe_screen *screen,
                LLVMBuildLoad(builder, fs_out_color[cbuf][chan][i], "fs_color_vals");
          }
 
-        lp_build_conv(builder, fs_type, blend_type,
+        lp_build_conv(gallivm, fs_type, blend_type,
                        fs_color_vals,
                        num_fs,
                       &blend_in_color[chan], 1);
@@ -725,11 +732,11 @@ generate_fragment(struct llvmpipe_screen *screen,
       }
 
       if (partial_mask || !variant->opaque) {
-         lp_build_conv_mask(builder, fs_type, blend_type,
+         lp_build_conv_mask(lp->gallivm, fs_type, blend_type,
                             fs_mask, num_fs,
                             &blend_mask, 1);
       } else {
-         blend_mask = lp_build_const_int_vec(blend_type, ~0);
+         blend_mask = lp_build_const_int_vec(lp->gallivm, blend_type, ~0);
       }
 
       color_ptr = LLVMBuildLoad(builder, 
@@ -750,7 +757,8 @@ generate_fragment(struct llvmpipe_screen *screen,
                               !key->alpha.enabled &&
                               !shader->info.base.uses_kill);
 
-         generate_blend(&key->blend,
+         generate_blend(lp->gallivm,
+                        &key->blend,
                         rt,
                         builder,
                         blend_type,
@@ -764,9 +772,6 @@ generate_fragment(struct llvmpipe_screen *screen,
 
    LLVMBuildRetVoid(builder);
 
-   LLVMDisposeBuilder(builder);
-
-
    /* Verify the LLVM IR.  If invalid, dump and abort */
 #ifdef DEBUG
    if(LLVMVerifyFunction(function, LLVMPrintMessageAction)) {
@@ -777,7 +782,7 @@ generate_fragment(struct llvmpipe_screen *screen,
 #endif
 
    /* Apply optimizations to LLVM IR */
-   LLVMRunFunctionPassManager(screen->pass, function);
+   LLVMRunFunctionPassManager(gallivm->passmgr, function);
 
    if ((gallivm_debug & GALLIVM_DEBUG_IR) || (LP_DEBUG & DEBUG_FS)) {
       /* Print the LLVM IR to stderr */
@@ -787,14 +792,14 @@ generate_fragment(struct llvmpipe_screen *screen,
 
    /* Dump byte code to a file */
    if (0) {
-      LLVMWriteBitcodeToFile(lp_build_module, "llvmpipe.bc");
+      LLVMWriteBitcodeToFile(gallivm->module, "llvmpipe.bc");
    }
 
    /*
     * Translate the LLVM IR into machine code.
     */
    {
-      void *f = LLVMGetPointerToGlobal(screen->engine, function);
+      void *f = LLVMGetPointerToGlobal(gallivm->engine, function);
 
       variant->jit_function[partial_mask] = (lp_jit_frag_func)pointer_to_func(f);
 
@@ -898,8 +903,13 @@ lp_debug_fs_variant(const struct lp_fragment_shader_variant *variant)
    debug_printf("\n");
 }
 
+
+/**
+ * Generate a new fragment shader variant from the shader code and
+ * other state indicated by the key.
+ */
 static struct lp_fragment_shader_variant *
-generate_variant(struct llvmpipe_screen *screen,
+generate_variant(struct llvmpipe_context *lp,
                  struct lp_fragment_shader *shader,
                  const struct lp_fragment_shader_variant_key *key)
 {
@@ -945,11 +955,11 @@ generate_variant(struct llvmpipe_screen *screen,
       lp_debug_fs_variant(variant);
    }
 
-   generate_fragment(screen, shader, variant, RAST_EDGE_TEST);
+   generate_fragment(lp, shader, variant, RAST_EDGE_TEST);
 
    if (variant->opaque) {
       /* Specialized shader, which doesn't need to read the color buffer. */
-      generate_fragment(screen, shader, variant, RAST_WHOLE);
+      generate_fragment(lp, shader, variant, RAST_WHOLE);
    } else {
       variant->jit_function[RAST_WHOLE] = variant->jit_function[RAST_EDGE_TEST];
    }
@@ -1034,7 +1044,8 @@ llvmpipe_create_fs_state(struct pipe_context *pipe,
 
    if (LP_DEBUG & DEBUG_TGSI) {
       unsigned attrib;
-      debug_printf("llvmpipe: Create fragment shader #%u %p:\n", shader->no, (void *) shader);
+      debug_printf("llvmpipe: Create fragment shader #%u %p:\n",
+                   shader->no, (void *) shader);
       tgsi_dump(templ->tokens, 0);
       debug_printf("usage masks:\n");
       for (attrib = 0; attrib < shader->info.base.num_inputs; ++attrib) {
@@ -1071,33 +1082,49 @@ llvmpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
    llvmpipe->dirty |= LP_NEW_FS;
 }
 
-static void
-remove_shader_variant(struct llvmpipe_context *lp,
-                      struct lp_fragment_shader_variant *variant)
+
+/**
+ * Remove shader variant from two lists: the shader's variant list
+ * and the context's variant list.
+ */
+void
+llvmpipe_remove_shader_variant(struct llvmpipe_context *lp,
+                               struct lp_fragment_shader_variant *variant)
 {
-   struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
    unsigned i;
 
    if (gallivm_debug & GALLIVM_DEBUG_IR) {
-      debug_printf("llvmpipe: del fs #%u var #%u v created #%u v cached #%u v total cached #%u\n",
-                    variant->shader->no, variant->no, variant->shader->variants_created,
-                    variant->shader->variants_cached, lp->nr_fs_variants);
+      debug_printf("llvmpipe: del fs #%u var #%u v created #%u v cached"
+                   " #%u v total cached #%u\n",
+                   variant->shader->no,
+                   variant->no,
+                   variant->shader->variants_created,
+                   variant->shader->variants_cached,
+                   lp->nr_fs_variants);
    }
+
+   /* free all the variant's JIT'd functions */
    for (i = 0; i < Elements(variant->function); i++) {
       if (variant->function[i]) {
          if (variant->jit_function[i])
-            LLVMFreeMachineCodeForFunction(screen->engine,
+            LLVMFreeMachineCodeForFunction(lp->gallivm->engine,
                                            variant->function[i]);
          LLVMDeleteFunction(variant->function[i]);
       }
    }
+
+   /* remove from shader's list */
    remove_from_list(&variant->list_item_local);
    variant->shader->variants_cached--;
+
+   /* remove from context's list */
    remove_from_list(&variant->list_item_global);
    lp->nr_fs_variants--;
+
    FREE(variant);
 }
 
+
 static void
 llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
 {
@@ -1106,23 +1133,23 @@ llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
    struct lp_fs_variant_list_item *li;
 
    assert(fs != llvmpipe->fs);
-   (void) llvmpipe;
 
    /*
     * XXX: we need to flush the context until we have some sort of reference
     * counting in fragment shaders as they may still be binned
     * Flushing alone might not sufficient we need to wait on it too.
     */
-
    llvmpipe_finish(pipe, __FUNCTION__);
 
+   /* Delete all the variants */
    li = first_elem(&shader->variants);
    while(!at_end(&shader->variants, li)) {
       struct lp_fs_variant_list_item *next = next_elem(li);
-      remove_shader_variant(llvmpipe, li->base);
+      llvmpipe_remove_shader_variant(llvmpipe, li->base);
       li = next;
    }
 
+   /* Delete draw module's data */
    draw_delete_fragment_shader(llvmpipe->draw, shader->draw_data);
 
    assert(shader->variants_cached == 0);
@@ -1278,14 +1305,15 @@ make_variant_key(struct llvmpipe_context *lp,
    }
 }
 
+
+
 /**
- * Update fragment state.  This is called just prior to drawing
+ * Update fragment shader state.  This is called just prior to drawing
  * something when some fragment-related state has changed.
  */
 void 
 llvmpipe_update_fs(struct llvmpipe_context *lp)
 {
-   struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
    struct lp_fragment_shader *shader = lp->fs;
    struct lp_fragment_shader_variant_key key;
    struct lp_fragment_shader_variant *variant = NULL;
@@ -1293,6 +1321,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
 
    make_variant_key(lp, shader, &key);
 
+   /* Search the variants for one which matches the key */
    li = first_elem(&shader->variants);
    while(!at_end(&shader->variants, li)) {
       if(memcmp(&li->base->key, &key, shader->variant_key_size) == 0) {
@@ -1303,36 +1332,49 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
    }
 
    if (variant) {
+      /* Move this variant to the head of the list to implement LRU
+       * deletion of shader's when we have too many.
+       */
       move_to_head(&lp->fs_variants_list, &variant->list_item_global);
    }
    else {
-      int64_t t0, t1;
-      int64_t dt;
+      /* variant not found, create it now */
+      int64_t t0, t1, dt;
       unsigned i;
+
+      /* First, check if we've exceeded the max number of shader variants.
+       * If so, free 25% of them (the least recently used ones).
+       */
       if (lp->nr_fs_variants >= LP_MAX_SHADER_VARIANTS) {
          struct pipe_context *pipe = &lp->pipe;
 
          /*
-          * XXX: we need to flush the context until we have some sort of reference
-          * counting in fragment shaders as they may still be binned
+          * XXX: we need to flush the context until we have some sort of
+          * reference counting in fragment shaders as they may still be binned
           * Flushing alone might not be sufficient we need to wait on it too.
           */
          llvmpipe_finish(pipe, __FUNCTION__);
 
          for (i = 0; i < LP_MAX_SHADER_VARIANTS / 4; i++) {
-            struct lp_fs_variant_list_item *item = last_elem(&lp->fs_variants_list);
-            remove_shader_variant(lp, item->base);
+            struct lp_fs_variant_list_item *item;
+            item = last_elem(&lp->fs_variants_list);
+            llvmpipe_remove_shader_variant(lp, item->base);
          }
       }
-      t0 = os_time_get();
-
-      variant = generate_variant(screen, shader, &key);
 
+      /*
+       * Generate the new variant.
+       */
+      t0 = os_time_get();
+      variant = generate_variant(lp, shader, &key);
       t1 = os_time_get();
       dt = t1 - t0;
       LP_COUNT_ADD(llvm_compile_time, dt);
       LP_COUNT_ADD(nr_llvm_compiles, 2);  /* emit vs. omit in/out test */
 
+      llvmpipe_variant_count++;
+
+      /* Put the new variant into the list */
       if (variant) {
          insert_at_head(&shader->variants, &variant->list_item_local);
          insert_at_head(&lp->fs_variants_list, &variant->list_item_global);
@@ -1341,6 +1383,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
       }
    }
 
+   /* Bind this variant */
    lp_setup_set_fs_variant(lp->setup, variant);
 }
 
index 7d58c4936c7944580f7639c8eb74b7b34926e07e..98410c69359c1ce02825392be3a516f7ef298ba8 100644 (file)
@@ -69,12 +69,15 @@ struct lp_fragment_shader_variant_key
    struct lp_sampler_static_state sampler[PIPE_MAX_SAMPLERS];
 };
 
+
+/** doubly-linked list item */
 struct lp_fs_variant_list_item
 {
    struct lp_fragment_shader_variant *base;
    struct lp_fs_variant_list_item *next, *prev;
 };
 
+
 struct lp_fragment_shader_variant
 {
    struct lp_fragment_shader_variant_key key;
@@ -118,5 +121,9 @@ struct lp_fragment_shader
 void
 lp_debug_fs_variant(const struct lp_fragment_shader_variant *variant);
 
+void
+llvmpipe_remove_shader_variant(struct llvmpipe_context *lp,
+                               struct lp_fragment_shader_variant *variant);
+
 
 #endif /* LP_STATE_FS_H_ */
index 47f3d95320ffb71355a7a3b2c625db5bf7a66597..ad751b9ef42f1e78f13dc54593dee3f05cffaff3 100644 (file)
@@ -31,6 +31,7 @@
 #include "util/u_simple_list.h"
 #include "os/os_time.h"
 #include "gallivm/lp_bld_arit.h"
+#include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_debug.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_intr.h"
@@ -83,24 +84,29 @@ struct lp_setup_args
    LLVMValueRef v2a;
 };
 
-static LLVMTypeRef type4f(void)
+
+
+static LLVMTypeRef
+type4f(struct gallivm_state *gallivm)
 {
-   return LLVMVectorType(LLVMFloatType(), 4);
+   return LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4);
 }
 
 
 /* Equivalent of _mm_setr_ps(a,b,c,d)
  */
-static LLVMValueRef vec4f(LLVMBuilderRef bld,
-                         LLVMValueRef a, LLVMValueRef b, LLVMValueRef c, LLVMValueRef d,
-                         const char *name)
+static LLVMValueRef
+vec4f(struct gallivm_state *gallivm,
+      LLVMValueRef a, LLVMValueRef b, LLVMValueRef c, LLVMValueRef d,
+      const char *name)
 {
-   LLVMValueRef i0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   LLVMValueRef i1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
-   LLVMValueRef i2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
-   LLVMValueRef i3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
+   LLVMBuilderRef bld = gallivm->builder;
+   LLVMValueRef i0 = lp_build_const_int32(gallivm, 0);
+   LLVMValueRef i1 = lp_build_const_int32(gallivm, 1);
+   LLVMValueRef i2 = lp_build_const_int32(gallivm, 2);
+   LLVMValueRef i3 = lp_build_const_int32(gallivm, 3);
 
-   LLVMValueRef res = LLVMGetUndef(type4f());
+   LLVMValueRef res = LLVMGetUndef(type4f(gallivm));
 
    res = LLVMBuildInsertElement(bld, res, a, i0, "");
    res = LLVMBuildInsertElement(bld, res, b, i1, "");
@@ -112,15 +118,17 @@ static LLVMValueRef vec4f(LLVMBuilderRef bld,
 
 /* Equivalent of _mm_set1_ps(a)
  */
-static LLVMValueRef vec4f_from_scalar(LLVMBuilderRef bld,
-                                     LLVMValueRef a,
-                                     const char *name)
+static LLVMValueRef
+vec4f_from_scalar(struct gallivm_state *gallivm,
+                  LLVMValueRef a,
+                  const char *name)
 {
-   LLVMValueRef res = LLVMGetUndef(type4f());
+   LLVMBuilderRef bld = gallivm->builder;
+   LLVMValueRef res = LLVMGetUndef(type4f(gallivm));
    int i;
 
    for(i = 0; i < 4; ++i) {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      LLVMValueRef index = lp_build_const_int32(gallivm, i);
       res = LLVMBuildInsertElement(bld, res, a, index, i == 3 ? name : "");
    }
 
@@ -128,14 +136,15 @@ static LLVMValueRef vec4f_from_scalar(LLVMBuilderRef bld,
 }
 
 static void
-store_coef(LLVMBuilderRef builder,
+store_coef(struct gallivm_state *gallivm,
           struct lp_setup_args *args,
           unsigned slot,
           LLVMValueRef a0,
           LLVMValueRef dadx,
           LLVMValueRef dady)
 {
-   LLVMValueRef idx = LLVMConstInt(LLVMInt32Type(), slot, 0);
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMValueRef idx = lp_build_const_int32(gallivm, slot);
    
    LLVMBuildStore(builder,
                  a0, 
@@ -153,14 +162,14 @@ store_coef(LLVMBuilderRef builder,
 
 
 static void 
-emit_constant_coef4( LLVMBuilderRef builder,
+emit_constant_coef4(struct gallivm_state *gallivm,
                     struct lp_setup_args *args,
                     unsigned slot,
                     LLVMValueRef vert)
 {
-   LLVMValueRef zero      = LLVMConstReal(LLVMFloatType(), 0.0);
-   LLVMValueRef zerovec   = vec4f_from_scalar(builder, zero, "zero");
-   store_coef(builder, args, slot, vert, zerovec, zerovec);
+   LLVMValueRef zero      = lp_build_const_float(gallivm, 0.0);
+   LLVMValueRef zerovec   = vec4f_from_scalar(gallivm, zero, "zero");
+   store_coef(gallivm, args, slot, vert, zerovec, zerovec);
 }
 
 
@@ -170,30 +179,33 @@ emit_constant_coef4( LLVMBuilderRef builder,
  * \param frontface  is the triangle front facing?
  */
 static void 
-emit_facing_coef( LLVMBuilderRef builder,
+emit_facing_coef(struct gallivm_state *gallivm,
                  struct lp_setup_args *args,
                  unsigned slot )
 {
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
    LLVMValueRef a0_0 = args->facing;
-   LLVMValueRef a0_0f = LLVMBuildSIToFP(builder, a0_0, LLVMFloatType(), "");
-   LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
-   LLVMValueRef a0      = vec4f(builder, a0_0f, zero, zero, zero, "facing");
-   LLVMValueRef zerovec = vec4f_from_scalar(builder, zero, "zero");
+   LLVMValueRef a0_0f = LLVMBuildSIToFP(builder, a0_0, float_type, "");
+   LLVMValueRef zero = lp_build_const_float(gallivm, 0.0);
+   LLVMValueRef a0 = vec4f(gallivm, a0_0f, zero, zero, zero, "facing");
+   LLVMValueRef zerovec = vec4f_from_scalar(gallivm, zero, "zero");
 
-   store_coef(builder, args, slot, a0, zerovec, zerovec);
+   store_coef(gallivm, args, slot, a0, zerovec, zerovec);
 }
 
 
 static LLVMValueRef
-vert_attrib(LLVMBuilderRef b,
+vert_attrib(struct gallivm_state *gallivm,
            LLVMValueRef vert,
            int attr,
            int elem,
            const char *name)
 {
+   LLVMBuilderRef b = gallivm->builder;
    LLVMValueRef idx[2];
-   idx[0] = LLVMConstInt(LLVMInt32Type(), attr, 0);
-   idx[1] = LLVMConstInt(LLVMInt32Type(), elem, 0);
+   idx[0] = lp_build_const_int32(gallivm, attr);
+   idx[1] = lp_build_const_int32(gallivm, elem);
    return LLVMBuildLoad(b, LLVMBuildGEP(b, vert, idx, 2, ""), name);
 }
 
@@ -214,16 +226,17 @@ vert_clamp(LLVMBuilderRef b,
 }
 
 static void
-lp_twoside(LLVMBuilderRef b, 
+lp_twoside(struct gallivm_state *gallivm,
            struct lp_setup_args *args,
            const struct lp_setup_variant_key *key,
            int bcolor_slot)
 {
+   LLVMBuilderRef b = gallivm->builder;
    LLVMValueRef a0_back, a1_back, a2_back;
-   LLVMValueRef idx2 = LLVMConstInt(LLVMInt32Type(), bcolor_slot, 0);
+   LLVMValueRef idx2 = lp_build_const_int32(gallivm, bcolor_slot);
 
    LLVMValueRef facing = args->facing;
-   LLVMValueRef front_facing = LLVMBuildICmp(b, LLVMIntEQ, facing, LLVMConstInt(LLVMInt32Type(), 0, 0), ""); /** need i1 for if condition */
+   LLVMValueRef front_facing = LLVMBuildICmp(b, LLVMIntEQ, facing, lp_build_const_int32(gallivm, 0), ""); /** need i1 for if condition */
    
    a0_back = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v0, &idx2, 1, ""), "v0a_back");
    a1_back = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v1, &idx2, 1, ""), "v1a_back");
@@ -241,29 +254,31 @@ lp_twoside(LLVMBuilderRef b,
 }
 
 static void
-lp_do_offset_tri(LLVMBuilderRef b, 
+lp_do_offset_tri(struct gallivm_state *gallivm,
                  struct lp_setup_args *args,
                  const struct lp_setup_variant_key *key)
 {
+   LLVMBuilderRef b = gallivm->builder;
    struct lp_build_context bld;
    LLVMValueRef zoffset, mult;
    LLVMValueRef z0_new, z1_new, z2_new;
    LLVMValueRef dzdx0, dzdx, dzdy0, dzdy;
    LLVMValueRef max, max_value;
    
-   LLVMValueRef one  = LLVMConstReal(LLVMFloatType(), 1.0);
-   LLVMValueRef zero  = LLVMConstReal(LLVMFloatType(), 0.0);
+   LLVMValueRef one  = lp_build_const_float(gallivm, 1.0);
+   LLVMValueRef zero = lp_build_const_float(gallivm, 0.0);
+   LLVMValueRef two  = lp_build_const_int32(gallivm, 2);
 
    /* edge vectors: e = v0 - v2, f = v1 - v2 */
-   LLVMValueRef v0_x = vert_attrib(b, args->v0, 0, 0, "v0_x");
-   LLVMValueRef v1_x = vert_attrib(b, args->v1, 0, 0, "v1_x");
-   LLVMValueRef v2_x = vert_attrib(b, args->v2, 0, 0, "v2_x");
-   LLVMValueRef v0_y = vert_attrib(b, args->v0, 0, 1, "v0_y");
-   LLVMValueRef v1_y = vert_attrib(b, args->v1, 0, 1, "v1_y");
-   LLVMValueRef v2_y = vert_attrib(b, args->v2, 0, 1, "v2_y");
-   LLVMValueRef v0_z = vert_attrib(b, args->v0, 0, 2, "v0_z");
-   LLVMValueRef v1_z = vert_attrib(b, args->v1, 0, 2, "v1_z");
-   LLVMValueRef v2_z = vert_attrib(b, args->v2, 0, 2, "v2_z");
+   LLVMValueRef v0_x = vert_attrib(gallivm, args->v0, 0, 0, "v0_x");
+   LLVMValueRef v1_x = vert_attrib(gallivm, args->v1, 0, 0, "v1_x");
+   LLVMValueRef v2_x = vert_attrib(gallivm, args->v2, 0, 0, "v2_x");
+   LLVMValueRef v0_y = vert_attrib(gallivm, args->v0, 0, 1, "v0_y");
+   LLVMValueRef v1_y = vert_attrib(gallivm, args->v1, 0, 1, "v1_y");
+   LLVMValueRef v2_y = vert_attrib(gallivm, args->v2, 0, 1, "v2_y");
+   LLVMValueRef v0_z = vert_attrib(gallivm, args->v0, 0, 2, "v0_z");
+   LLVMValueRef v1_z = vert_attrib(gallivm, args->v1, 0, 2, "v1_z");
+   LLVMValueRef v2_z = vert_attrib(gallivm, args->v2, 0, 2, "v2_z");
  
    /* edge vectors: e = v0 - v2, f = v1 - v2 */
    LLVMValueRef dx02 = LLVMBuildFSub(b, v0_x, v2_x, "dx02");
@@ -288,7 +303,7 @@ lp_do_offset_tri(LLVMBuilderRef b,
    LLVMValueRef res2  = LLVMBuildFSub(b, dz02_dx12, dx02_dz12, "res2");
 
    /* dzdx = fabsf(res1 * inv_det), dydx = fabsf(res2 * inv_det)*/
-   lp_build_context_init(&bld, b, lp_type_float(32));
+   lp_build_context_init(&bld, gallivm, lp_type_float(32));
    dzdx0 = LLVMBuildFMul(b, res1, inv_det, "dzdx");
    dzdx  = lp_build_abs(&bld, dzdx0);
    dzdy0 = LLVMBuildFMul(b, res2, inv_det, "dzdy");
@@ -298,8 +313,8 @@ lp_do_offset_tri(LLVMBuilderRef b,
    max = LLVMBuildFCmp(b, LLVMRealUGT, dzdx, dzdy, "");
    max_value = LLVMBuildSelect(b, max, dzdx, dzdy, "max"); 
 
-   mult = LLVMBuildFMul(b, max_value, LLVMConstReal(LLVMFloatType(), key->scale), "");
-   zoffset = LLVMBuildFAdd(b, LLVMConstReal(LLVMFloatType(), key->units), mult, "zoffset");
+   mult = LLVMBuildFMul(b, max_value, lp_build_const_float(gallivm, key->scale), "");
+   zoffset = LLVMBuildFAdd(b, lp_build_const_float(gallivm, key->units), mult, "zoffset");
 
    /* clamp and do offset */
    z0_new = vert_clamp(b, LLVMBuildFAdd(b, v0_z, zoffset, ""), zero, one);
@@ -308,18 +323,19 @@ lp_do_offset_tri(LLVMBuilderRef b,
 
    /* insert into args->a0.z, a1.z, a2.z:
     */   
-   args->v0a = LLVMBuildInsertElement(b, args->v0a, z0_new, LLVMConstInt(LLVMInt32Type(), 2, 0), "");
-   args->v1a = LLVMBuildInsertElement(b, args->v1a, z1_new, LLVMConstInt(LLVMInt32Type(), 2, 0), "");
-   args->v2a = LLVMBuildInsertElement(b, args->v2a, z2_new, LLVMConstInt(LLVMInt32Type(), 2, 0), "");
+   args->v0a = LLVMBuildInsertElement(b, args->v0a, z0_new, two, "");
+   args->v1a = LLVMBuildInsertElement(b, args->v1a, z1_new, two, "");
+   args->v2a = LLVMBuildInsertElement(b, args->v2a, z2_new, two, "");
 }
 
 static void
-load_attribute(LLVMBuilderRef b, 
+load_attribute(struct gallivm_state *gallivm,
                struct lp_setup_args *args,
                const struct lp_setup_variant_key *key,
                unsigned vert_attr)
 {
-   LLVMValueRef idx = LLVMConstInt(LLVMInt32Type(), vert_attr, 0);
+   LLVMBuilderRef b = gallivm->builder;
+   LLVMValueRef idx = lp_build_const_int32(gallivm, vert_attr);
 
    /* Load the vertex data
     */
@@ -331,25 +347,26 @@ load_attribute(LLVMBuilderRef b,
    /* Potentially modify it according to twoside, offset, etc:
     */
    if (vert_attr == 0 && (key->scale != 0.0f || key->units != 0.0f)) {
-      lp_do_offset_tri(b, args, key);
+      lp_do_offset_tri(gallivm, args, key);
    }
 
    if (key->twoside) {
       if (vert_attr == key->color_slot && key->bcolor_slot != ~0)
-         lp_twoside(b, args, key, key->bcolor_slot);
+         lp_twoside(gallivm, args, key, key->bcolor_slot);
       else if (vert_attr == key->spec_slot && key->bspec_slot != ~0)
-         lp_twoside(b, args, key, key->bspec_slot);
+         lp_twoside(gallivm, args, key, key->bspec_slot);
    }
 }
 
 static void 
-emit_coef4( LLVMBuilderRef b,
+emit_coef4( struct gallivm_state *gallivm,
            struct lp_setup_args *args,
            unsigned slot,
            LLVMValueRef a0,
            LLVMValueRef a1,
            LLVMValueRef a2)
 {
+   LLVMBuilderRef b = gallivm->builder;
    LLVMValueRef dy20_ooa = args->dy20_ooa;
    LLVMValueRef dy01_ooa = args->dy01_ooa;
    LLVMValueRef dx20_ooa = args->dx20_ooa;
@@ -381,17 +398,17 @@ emit_coef4( LLVMBuilderRef b,
    LLVMValueRef attr_v0       = LLVMBuildFAdd(b, dadx_x0, dady_y0, "attr_v0"); 
    LLVMValueRef attr_0        = LLVMBuildFSub(b, a0, attr_v0, "attr_0"); 
 
-   store_coef(b, args, slot, attr_0, dadx, dady);
+   store_coef(gallivm, args, slot, attr_0, dadx, dady);
 }
 
 
 static void 
-emit_linear_coef( LLVMBuilderRef b,
+emit_linear_coef( struct gallivm_state *gallivm,
                  struct lp_setup_args *args,
                  unsigned slot)
 {
    /* nothing to do anymore */
-   emit_coef4(b,
+   emit_coef4(gallivm,
               args, slot, 
               args->v0a,
               args->v1a,
@@ -408,30 +425,32 @@ emit_linear_coef( LLVMBuilderRef b,
  * divide the interpolated value by the interpolated W at that fragment.
  */
 static void 
-emit_perspective_coef( LLVMBuilderRef b,
+emit_perspective_coef( struct gallivm_state *gallivm,
                       struct lp_setup_args *args,
                       unsigned slot)
 {
+   LLVMBuilderRef b = gallivm->builder;
+
    /* premultiply by 1/w  (v[0][3] is always 1/w):
     */
-   LLVMValueRef v0_oow = vec4f_from_scalar(b, vert_attrib(b, args->v0, 0, 3, ""), "v0_oow");
-   LLVMValueRef v1_oow = vec4f_from_scalar(b, vert_attrib(b, args->v1, 0, 3, ""), "v1_oow");
-   LLVMValueRef v2_oow = vec4f_from_scalar(b, vert_attrib(b, args->v2, 0, 3, ""), "v2_oow");
+   LLVMValueRef v0_oow = vec4f_from_scalar(gallivm, vert_attrib(gallivm, args->v0, 0, 3, ""), "v0_oow");
+   LLVMValueRef v1_oow = vec4f_from_scalar(gallivm, vert_attrib(gallivm, args->v1, 0, 3, ""), "v1_oow");
+   LLVMValueRef v2_oow = vec4f_from_scalar(gallivm, vert_attrib(gallivm, args->v2, 0, 3, ""), "v2_oow");
 
    LLVMValueRef v0_oow_v0a = LLVMBuildFMul(b, args->v0a, v0_oow, "v0_oow_v0a");
    LLVMValueRef v1_oow_v1a = LLVMBuildFMul(b, args->v1a, v1_oow, "v1_oow_v1a");
    LLVMValueRef v2_oow_v2a = LLVMBuildFMul(b, args->v2a, v2_oow, "v2_oow_v2a");
 
-   emit_coef4(b, args, slot, v0_oow_v0a, v1_oow_v1a, v2_oow_v2a);
+   emit_coef4(gallivm, args, slot, v0_oow_v0a, v1_oow_v1a, v2_oow_v2a);
 }
 
 
 static void
-emit_position_coef( LLVMBuilderRef builder,
+emit_position_coef( struct gallivm_state *gallivm,
                    struct lp_setup_args *args,
                    int slot )
 {
-   emit_linear_coef(builder, args, slot);
+   emit_linear_coef(gallivm, args, slot);
 }
 
 
@@ -441,7 +460,7 @@ emit_position_coef( LLVMBuilderRef builder,
  * Compute the inputs-> dadx, dady, a0 values.
  */
 static void 
-emit_tri_coef( LLVMBuilderRef builder,
+emit_tri_coef( struct gallivm_state *gallivm,
               const struct lp_setup_variant_key *key,
               struct lp_setup_args *args )
 {
@@ -449,8 +468,8 @@ emit_tri_coef( LLVMBuilderRef builder,
 
    /* The internal position input is in slot zero:
     */
-   load_attribute(builder, args, key, 0);
-   emit_position_coef(builder, args, 0);
+   load_attribute(gallivm, args, key, 0);
+   emit_position_coef(gallivm, args, 0);
 
    /* setup interpolation for all the remaining attributes:
     */
@@ -459,24 +478,24 @@ emit_tri_coef( LLVMBuilderRef builder,
       if (key->inputs[slot].interp == LP_INTERP_CONSTANT ||
           key->inputs[slot].interp == LP_INTERP_LINEAR ||
           key->inputs[slot].interp == LP_INTERP_PERSPECTIVE)
-         load_attribute(builder, args, key, key->inputs[slot].src_index);
+         load_attribute(gallivm, args, key, key->inputs[slot].src_index);
 
       switch (key->inputs[slot].interp) {
       case LP_INTERP_CONSTANT:
         if (key->flatshade_first) {
-           emit_constant_coef4(builder, args, slot+1, args->v0a);
+           emit_constant_coef4(gallivm, args, slot+1, args->v0a);
         }
         else {
-           emit_constant_coef4(builder, args, slot+1, args->v2a);
+           emit_constant_coef4(gallivm, args, slot+1, args->v2a);
         }
         break;
 
       case LP_INTERP_LINEAR:
-        emit_linear_coef(builder, args, slot+1);
+        emit_linear_coef(gallivm, args, slot+1);
          break;
 
       case LP_INTERP_PERSPECTIVE:
-        emit_perspective_coef(builder, args, slot+1);
+        emit_perspective_coef(gallivm, args, slot+1);
          break;
 
       case LP_INTERP_POSITION:
@@ -487,7 +506,7 @@ emit_tri_coef( LLVMBuilderRef builder,
          break;
 
       case LP_INTERP_FACING:
-         emit_facing_coef(builder, args, slot+1);
+         emit_facing_coef(gallivm, args, slot+1);
          break;
 
       default:
@@ -500,7 +519,7 @@ emit_tri_coef( LLVMBuilderRef builder,
 /* XXX: This is generic code, share with fs/vs codegen:
  */
 static lp_jit_setup_triangle
-finalize_function(struct llvmpipe_screen *screen,
+finalize_function(struct gallivm_state *gallivm,
                  LLVMBuilderRef builder,
                  LLVMValueRef function)
 {
@@ -516,7 +535,7 @@ finalize_function(struct llvmpipe_screen *screen,
 #endif
 
    /* Apply optimizations to LLVM IR */
-   LLVMRunFunctionPassManager(screen->pass, function);
+   LLVMRunFunctionPassManager(gallivm->passmgr, function);
 
    if (gallivm_debug & GALLIVM_DEBUG_IR)
    {
@@ -528,7 +547,7 @@ finalize_function(struct llvmpipe_screen *screen,
    /*
     * Translate the LLVM IR into machine code.
     */
-   f = LLVMGetPointerToGlobal(screen->engine, function);
+   f = LLVMGetPointerToGlobal(gallivm->engine, function);
 
    if (gallivm_debug & GALLIVM_DEBUG_ASM)
    {
@@ -543,11 +562,12 @@ finalize_function(struct llvmpipe_screen *screen,
 /* XXX: Generic code:
  */
 static void
-lp_emit_emms(LLVMBuilderRef builder)
+lp_emit_emms(struct gallivm_state *gallivm)
 {
 #ifdef PIPE_ARCH_X86
    /* Avoid corrupting the FPU stack on 32bit OSes. */
-   lp_build_intrinsic(builder, "llvm.x86.mmx.emms", LLVMVoidType(), NULL, 0);
+   lp_build_intrinsic(gallivm->builder, "llvm.x86.mmx.emms",
+         LLVMVoidTypeInContext(gallivm->context), NULL, 0);
 #endif
 }
 
@@ -568,21 +588,23 @@ set_noalias(LLVMBuilderRef builder,
 }
 
 static void
-init_args(LLVMBuilderRef b, 
+init_args(struct gallivm_state *gallivm,
          struct lp_setup_args *args,
          const struct lp_setup_variant *variant)
 {
-   LLVMValueRef v0_x = vert_attrib(b, args->v0, 0, 0, "v0_x");
-   LLVMValueRef v0_y = vert_attrib(b, args->v0, 0, 1, "v0_y");
+   LLVMBuilderRef b = gallivm->builder;
 
-   LLVMValueRef v1_x = vert_attrib(b, args->v1, 0, 0, "v1_x");
-   LLVMValueRef v1_y = vert_attrib(b, args->v1, 0, 1, "v1_y");
+   LLVMValueRef v0_x = vert_attrib(gallivm, args->v0, 0, 0, "v0_x");
+   LLVMValueRef v0_y = vert_attrib(gallivm, args->v0, 0, 1, "v0_y");
 
-   LLVMValueRef v2_x = vert_attrib(b, args->v2, 0, 0, "v2_x");
-   LLVMValueRef v2_y = vert_attrib(b, args->v2, 0, 1, "v2_y");
+   LLVMValueRef v1_x = vert_attrib(gallivm, args->v1, 0, 0, "v1_x");
+   LLVMValueRef v1_y = vert_attrib(gallivm, args->v1, 0, 1, "v1_y");
 
-   LLVMValueRef pixel_center = LLVMConstReal(LLVMFloatType(),
-                                            variant->key.pixel_center_half ? 0.5 : 0);
+   LLVMValueRef v2_x = vert_attrib(gallivm, args->v2, 0, 0, "v2_x");
+   LLVMValueRef v2_y = vert_attrib(gallivm, args->v2, 0, 1, "v2_y");
+
+   LLVMValueRef pixel_center = lp_build_const_float(gallivm,
+                                   variant->key.pixel_center_half ? 0.5 : 0);
 
    LLVMValueRef x0_center = LLVMBuildFSub(b, v0_x, pixel_center, "x0_center" );
    LLVMValueRef y0_center = LLVMBuildFSub(b, v0_y, pixel_center, "y0_center" );
@@ -592,7 +614,7 @@ init_args(LLVMBuilderRef b,
    LLVMValueRef dx20 = LLVMBuildFSub(b, v2_x, v0_x, "dx20");
    LLVMValueRef dy20 = LLVMBuildFSub(b, v2_y, v0_y, "dy20");
 
-   LLVMValueRef one  = LLVMConstReal(LLVMFloatType(), 1.0);
+   LLVMValueRef one  = lp_build_const_float(gallivm, 1.0);
    LLVMValueRef e    = LLVMBuildFMul(b, dx01, dy20, "e");
    LLVMValueRef f    = LLVMBuildFMul(b, dx20, dy01, "f");
    LLVMValueRef ooa  = LLVMBuildFDiv(b, one, LLVMBuildFSub(b, e, f, ""), "ooa");
@@ -602,14 +624,14 @@ init_args(LLVMBuilderRef b,
    LLVMValueRef dx20_ooa = LLVMBuildFMul(b, dx20, ooa, "dx20_ooa");
    LLVMValueRef dx01_ooa = LLVMBuildFMul(b, dx01, ooa, "dx01_ooa");
 
-   args->dy20_ooa  = vec4f_from_scalar(b, dy20_ooa, "dy20_ooa_4f");
-   args->dy01_ooa  = vec4f_from_scalar(b, dy01_ooa, "dy01_ooa_4f");
+   args->dy20_ooa  = vec4f_from_scalar(gallivm, dy20_ooa, "dy20_ooa_4f");
+   args->dy01_ooa  = vec4f_from_scalar(gallivm, dy01_ooa, "dy01_ooa_4f");
 
-   args->dx20_ooa  = vec4f_from_scalar(b, dx20_ooa, "dx20_ooa_4f");
-   args->dx01_ooa  = vec4f_from_scalar(b, dx01_ooa, "dx01_ooa_4f");
+   args->dx20_ooa  = vec4f_from_scalar(gallivm, dx20_ooa, "dx20_ooa_4f");
+   args->dx01_ooa  = vec4f_from_scalar(gallivm, dx01_ooa, "dx01_ooa_4f");
 
-   args->x0_center = vec4f_from_scalar(b, x0_center, "x0_center_4f");
-   args->y0_center = vec4f_from_scalar(b, y0_center, "y0_center_4f");
+   args->x0_center = vec4f_from_scalar(gallivm, x0_center, "x0_center_4f");
+   args->y0_center = vec4f_from_scalar(gallivm, y0_center, "y0_center_4f");
 }
 
 /**
@@ -617,7 +639,7 @@ init_args(LLVMBuilderRef b,
  *
  */
 static struct lp_setup_variant *
-generate_setup_variant(struct llvmpipe_screen *screen,
+generate_setup_variant(struct gallivm_state *gallivm,
                       struct lp_setup_variant_key *key,
                        struct llvmpipe_context *lp)
 {
@@ -628,7 +650,7 @@ generate_setup_variant(struct llvmpipe_screen *screen,
    LLVMTypeRef func_type;
    LLVMTypeRef arg_types[7];
    LLVMBasicBlockRef block;
-   LLVMBuilderRef builder;
+   LLVMBuilderRef builder = gallivm->builder;
    int64_t t0, t1;
 
    if (0)
@@ -653,19 +675,20 @@ generate_setup_variant(struct llvmpipe_screen *screen,
     * the vertices.
     */
 
-   vec4f_type = LLVMVectorType(LLVMFloatType(), 4);
+   vec4f_type = LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4);
 
    arg_types[0] = LLVMPointerType(vec4f_type, 0);        /* v0 */
    arg_types[1] = LLVMPointerType(vec4f_type, 0);        /* v1 */
    arg_types[2] = LLVMPointerType(vec4f_type, 0);        /* v2 */
-   arg_types[3] = LLVMInt32Type();                     /* facing */
+   arg_types[3] = LLVMInt32TypeInContext(gallivm->context); /* facing */
    arg_types[4] = LLVMPointerType(vec4f_type, 0);      /* a0, aligned */
    arg_types[5] = LLVMPointerType(vec4f_type, 0);      /* dadx, aligned */
    arg_types[6] = LLVMPointerType(vec4f_type, 0);      /* dady, aligned */
 
-   func_type = LLVMFunctionType(LLVMVoidType(), arg_types, Elements(arg_types), 0);
+   func_type = LLVMFunctionType(LLVMVoidTypeInContext(gallivm->context),
+                                arg_types, Elements(arg_types), 0);
 
-   variant->function = LLVMAddFunction(screen->module, func_name, func_type);
+   variant->function = LLVMAddFunction(gallivm->module, func_name, func_type);
    if (!variant->function)
       goto fail;
 
@@ -690,19 +713,18 @@ generate_setup_variant(struct llvmpipe_screen *screen,
    /*
     * Function body
     */
-   block = LLVMAppendBasicBlock(variant->function, "entry");
-   builder = LLVMCreateBuilder();
+   block = LLVMAppendBasicBlockInContext(gallivm->context,
+                                         variant->function, "entry");
    LLVMPositionBuilderAtEnd(builder, block);
 
    set_noalias(builder, variant->function, arg_types, Elements(arg_types));
-   init_args(builder, &args, variant);
-   emit_tri_coef(builder, &variant->key, &args);
+   init_args(gallivm, &args, variant);
+   emit_tri_coef(gallivm, &variant->key, &args);
 
-   lp_emit_emms(builder);
+   lp_emit_emms(gallivm);
    LLVMBuildRetVoid(builder);
-   LLVMDisposeBuilder(builder);
 
-   variant->jit_function = finalize_function(screen, builder,
+   variant->jit_function = finalize_function(gallivm, builder,
                                             variant->function);
    if (!variant->jit_function)
       goto fail;
@@ -722,7 +744,7 @@ fail:
    if (variant) {
       if (variant->function) {
         if (variant->jit_function)
-           LLVMFreeMachineCodeForFunction(screen->engine,
+           LLVMFreeMachineCodeForFunction(gallivm->engine,
                                           variant->function);
         LLVMDeleteFunction(variant->function);
       }
@@ -773,8 +795,6 @@ static void
 remove_setup_variant(struct llvmpipe_context *lp,
                     struct lp_setup_variant *variant)
 {
-   struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
-
    if (gallivm_debug & GALLIVM_DEBUG_IR) {
       debug_printf("llvmpipe: del setup_variant #%u total %u\n",
                   variant->no, lp->nr_setup_variants);
@@ -782,7 +802,7 @@ remove_setup_variant(struct llvmpipe_context *lp,
 
    if (variant->function) {
       if (variant->jit_function)
-        LLVMFreeMachineCodeForFunction(screen->engine,
+        LLVMFreeMachineCodeForFunction(lp->gallivm->engine,
                                        variant->function);
       LLVMDeleteFunction(variant->function);
    }
@@ -825,8 +845,6 @@ cull_setup_variants(struct llvmpipe_context *lp)
 void 
 llvmpipe_update_setup(struct llvmpipe_context *lp)
 {
-   struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
-
    struct lp_setup_variant_key *key = &lp->setup_variant.key;
    struct lp_setup_variant *variant = NULL;
    struct lp_setup_variant_list_item *li;
@@ -849,9 +867,11 @@ llvmpipe_update_setup(struct llvmpipe_context *lp)
         cull_setup_variants(lp);
       }
 
-      variant = generate_setup_variant(screen, key, lp);
+      variant = generate_setup_variant(lp->gallivm, key, lp);
       insert_at_head(&lp->setup_variants_list, &variant->list_item_global);
       lp->nr_setup_variants++;
+
+      llvmpipe_variant_count++;
    }
 
    lp_setup_set_setup_variant(lp->setup,
index fb29423dd3562e2559503a8d3c74764df5133cd2..fffdeb6ccde615cb7c16390d7d44c5b0a9fec2e1 100644 (file)
@@ -33,6 +33,7 @@
 #include "lp_state.h"
 
 #include "draw/draw_context.h"
+#include "util/u_inlines.h"
 
 
 static void *
@@ -80,8 +81,9 @@ llvmpipe_set_vertex_buffers(struct pipe_context *pipe,
 
    assert(count <= PIPE_MAX_ATTRIBS);
 
-   memcpy(llvmpipe->vertex_buffer, buffers, count * sizeof(buffers[0]));
-   llvmpipe->num_vertex_buffers = count;
+   util_copy_vertex_buffers(llvmpipe->vertex_buffer,
+                            &llvmpipe->num_vertex_buffers,
+                            buffers, count);
 
    llvmpipe->dirty |= LP_NEW_VERTEX;
 
index 164242eda67070eefe3d4e63aa1c6680e5f50067..e7e46a628a15f0eac8b8b856ac783c707702a3e4 100644 (file)
@@ -52,19 +52,23 @@ adjust_to_tile_bounds(unsigned x, unsigned y, unsigned width, unsigned height,
 
 static void
 lp_resource_copy(struct pipe_context *pipe,
-                 struct pipe_resource *dst, struct pipe_subresource subdst,
+                 struct pipe_resource *dst, unsigned dst_level,
                  unsigned dstx, unsigned dsty, unsigned dstz,
-                 struct pipe_resource *src, struct pipe_subresource subsrc,
-                 unsigned srcx, unsigned srcy, unsigned srcz,
-                 unsigned width, unsigned height)
+                 struct pipe_resource *src, unsigned src_level,
+                 const struct pipe_box *src_box)
 {
-   /* XXX what about the dstz/srcz parameters - zslice wasn't used... */
+   /* XXX this used to ignore srcz/dstz
+    * assume it works the same for cube and 3d
+    */
    struct llvmpipe_resource *src_tex = llvmpipe_resource(src);
    struct llvmpipe_resource *dst_tex = llvmpipe_resource(dst);
    const enum pipe_format format = src_tex->base.format;
+   unsigned width = src_box->width;
+   unsigned height = src_box->height;
+   assert(src_box->depth == 1);
 
    llvmpipe_flush_resource(pipe,
-                           dst, subdst.face, subdst.level,
+                           dst, dst_level, dstz,
                            0, /* flush_flags */
                            FALSE, /* read_only */
                            TRUE, /* cpu_access */
@@ -72,7 +76,7 @@ lp_resource_copy(struct pipe_context *pipe,
                            "blit dest");
 
    llvmpipe_flush_resource(pipe,
-                           src, subsrc.face, subsrc.level,
+                           src, src_level, src_box->z,
                            0, /* flush_flags */
                            TRUE, /* read_only */
                            TRUE, /* cpu_access */
@@ -80,9 +84,10 @@ lp_resource_copy(struct pipe_context *pipe,
                            "blit src");
 
    /*
-   printf("surface copy from %u to %u: %u,%u to %u,%u %u x %u\n",
-          src_tex->id, dst_tex->id,
-          srcx, srcy, dstx, dsty, width, height);
+   printf("surface copy from %u lvl %u to %u lvl %u: %u,%u,%u to %u,%u,%u %u x %u x %u\n",
+          src_tex->id, src_level, dst_tex->id, dst_level, 
+          src_box->x, src_box->y, src_box->z, dstx, dsty, dstz,
+          src_box->width, src_box->height, src_box->depth);
    */
 
    /* set src tiles to linear layout */
@@ -90,12 +95,13 @@ lp_resource_copy(struct pipe_context *pipe,
       unsigned tx, ty, tw, th;
       unsigned x, y;
 
-      adjust_to_tile_bounds(srcx, srcy, width, height, &tx, &ty, &tw, &th);
+      adjust_to_tile_bounds(src_box->x, src_box->y, width, height,
+                            &tx, &ty, &tw, &th);
 
       for (y = 0; y < th; y += TILE_SIZE) {
          for (x = 0; x < tw; x += TILE_SIZE) {
             (void) llvmpipe_get_texture_tile_linear(src_tex,
-                                                    subsrc.face, subsrc.level,
+                                                    src_box->z, src_level,
                                                     LP_TEX_USAGE_READ,
                                                     tx + x, ty + y);
          }
@@ -130,7 +136,7 @@ lp_resource_copy(struct pipe_context *pipe,
                usage = LP_TEX_USAGE_READ_WRITE;
 
             (void) llvmpipe_get_texture_tile_linear(dst_tex,
-                                                    subdst.face, subdst.level,
+                                                    dstz, dst_level,
                                                     usage,
                                                     tx + x, ty + y);
          }
@@ -140,22 +146,22 @@ lp_resource_copy(struct pipe_context *pipe,
    /* copy */
    {
       const ubyte *src_linear_ptr
-         = llvmpipe_get_texture_image_address(src_tex, subsrc.face,
-                                              subsrc.level,
+         = llvmpipe_get_texture_image_address(src_tex, src_box->z,
+                                              src_level,
                                               LP_TEX_LAYOUT_LINEAR);
       ubyte *dst_linear_ptr
-         = llvmpipe_get_texture_image_address(dst_tex, subdst.face,
-                                              subdst.level,
+         = llvmpipe_get_texture_image_address(dst_tex, dstz,
+                                              dst_level,
                                               LP_TEX_LAYOUT_LINEAR);
 
       if (dst_linear_ptr && src_linear_ptr) {
          util_copy_rect(dst_linear_ptr, format,
-                        llvmpipe_resource_stride(&dst_tex->base, subdst.level),
+                        llvmpipe_resource_stride(&dst_tex->base, dst_level),
                         dstx, dsty,
                         width, height,
                         src_linear_ptr,
-                        llvmpipe_resource_stride(&src_tex->base, subsrc.level),
-                        srcx, srcy);
+                        llvmpipe_resource_stride(&src_tex->base, src_level),
+                        src_box->x, src_box->y);
       }
    }
 }
index 90422e42588bf7e8fa4ca8b51a9d141e39b2e069..c64f3e149fdabf050d3156de1d9853f33143b5a2 100644 (file)
@@ -64,13 +64,14 @@ write_tsv_header(FILE *fp);
 
 
 boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n);
+test_some(struct gallivm_state *gallivm,unsigned verbose, FILE *fp,
+          unsigned long n);
 
 boolean
-test_single(unsigned verbose, FILE *fp);
+test_single(struct gallivm_state *gallivm, unsigned verbose, FILE *fp);
 
 boolean
-test_all(unsigned verbose, FILE *fp);
+test_all(struct gallivm_state *gallivm, unsigned verbose, FILE *fp);
 
 
 #if defined(PIPE_CC_MSVC)
index 8b6b5e1298f215f2a31bbaef0b44a6c7303c5037..b3ca134131d36529d2842fe414e61cbd9977c05d 100644 (file)
@@ -163,11 +163,13 @@ dump_blend_type(FILE *fp,
 
 
 static LLVMValueRef
-add_blend_test(LLVMModuleRef module,
+add_blend_test(struct gallivm_state *gallivm,
                const struct pipe_blend_state *blend,
                enum vector_mode mode,
                struct lp_type type)
 {
+   LLVMModuleRef module = gallivm->module;
+   LLVMContextRef context = gallivm->context;
    LLVMTypeRef vec_type;
    LLVMTypeRef args[4];
    LLVMValueRef func;
@@ -179,18 +181,18 @@ add_blend_test(LLVMModuleRef module,
    LLVMBuilderRef builder;
    const unsigned rt = 0;
 
-   vec_type = lp_build_vec_type(type);
+   vec_type = lp_build_vec_type(gallivm, type);
 
    args[3] = args[2] = args[1] = args[0] = LLVMPointerType(vec_type, 0);
-   func = LLVMAddFunction(module, "test", LLVMFunctionType(LLVMVoidType(), args, 4, 0));
+   func = LLVMAddFunction(module, "test", LLVMFunctionType(LLVMVoidTypeInContext(context), args, 4, 0));
    LLVMSetFunctionCallConv(func, LLVMCCallConv);
    src_ptr = LLVMGetParam(func, 0);
    dst_ptr = LLVMGetParam(func, 1);
    const_ptr = LLVMGetParam(func, 2);
    res_ptr = LLVMGetParam(func, 3);
 
-   block = LLVMAppendBasicBlock(func, "entry");
-   builder = LLVMCreateBuilder();
+   block = LLVMAppendBasicBlockInContext(context, func, "entry");
+   builder = gallivm->builder;
    LLVMPositionBuilderAtEnd(builder, block);
 
    if (mode == AoS) {
@@ -203,7 +205,7 @@ add_blend_test(LLVMModuleRef module,
       dst = LLVMBuildLoad(builder, dst_ptr, "dst");
       con = LLVMBuildLoad(builder, const_ptr, "const");
 
-      res = lp_build_blend_aos(builder, blend, type, rt, src, dst, con, 3);
+      res = lp_build_blend_aos(gallivm, blend, type, rt, src, dst, con, 3);
 
       lp_build_name(res, "res");
 
@@ -218,7 +220,7 @@ add_blend_test(LLVMModuleRef module,
       unsigned i;
 
       for(i = 0; i < 4; ++i) {
-         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+         LLVMValueRef index = LLVMConstInt(LLVMInt32TypeInContext(context), i, 0);
          src[i] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, src_ptr, &index, 1, ""), "");
          dst[i] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, dst_ptr, &index, 1, ""), "");
          con[i] = LLVMBuildLoad(builder, LLVMBuildGEP(builder, const_ptr, &index, 1, ""), "");
@@ -227,10 +229,10 @@ add_blend_test(LLVMModuleRef module,
          lp_build_name(dst[i], "dst.%c", "rgba"[i]);
       }
 
-      lp_build_blend_soa(builder, blend, type, rt, src, dst, con, res);
+      lp_build_blend_soa(gallivm, blend, type, rt, src, dst, con, res);
 
       for(i = 0; i < 4; ++i) {
-         LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+         LLVMValueRef index = LLVMConstInt(LLVMInt32TypeInContext(context), i, 0);
          lp_build_name(res[i], "res.%c", "rgba"[i]);
          LLVMBuildStore(builder, res[i], LLVMBuildGEP(builder, res_ptr, &index, 1, ""));
       }
@@ -238,7 +240,6 @@ add_blend_test(LLVMModuleRef module,
 
    LLVMBuildRetVoid(builder);;
 
-   LLVMDisposeBuilder(builder);
    return func;
 }
 
@@ -465,16 +466,16 @@ compute_blend_ref(const struct pipe_blend_state *blend,
 
 PIPE_ALIGN_STACK
 static boolean
-test_one(unsigned verbose,
+test_one(struct gallivm_state *gallivm,
+         unsigned verbose,
          FILE *fp,
          const struct pipe_blend_state *blend,
          enum vector_mode mode,
          struct lp_type type)
 {
-   LLVMModuleRef module = NULL;
+   LLVMModuleRef module = gallivm->module;
    LLVMValueRef func = NULL;
-   LLVMExecutionEngineRef engine = lp_build_engine;
-   LLVMPassManagerRef pass = NULL;
+   LLVMExecutionEngineRef engine = gallivm->engine;
    char *error = NULL;
    blend_test_ptr_t blend_test_ptr;
    boolean success;
@@ -487,9 +488,7 @@ test_one(unsigned verbose,
    if(verbose >= 1)
       dump_blend_type(stdout, blend, mode, type);
 
-   module = LLVMModuleCreateWithName("test");
-
-   func = add_blend_test(module, blend, mode, type);
+   func = add_blend_test(gallivm, blend, mode, type);
 
    if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) {
       LLVMDumpModule(module);
@@ -497,24 +496,6 @@ test_one(unsigned verbose,
    }
    LLVMDisposeMessage(error);
 
-#if 0
-   pass = LLVMCreatePassManager();
-   LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass);
-   /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-    * but there are more on SVN. */
-   LLVMAddConstantPropagationPass(pass);
-   LLVMAddInstructionCombiningPass(pass);
-   LLVMAddPromoteMemoryToRegisterPass(pass);
-   LLVMAddGVNPass(pass);
-   LLVMAddCFGSimplificationPass(pass);
-   LLVMRunPassManager(pass, module);
-#else
-   (void)pass;
-#endif
-
-   if(verbose >= 2)
-      LLVMDumpModule(module);
-
    code = LLVMGetPointerToGlobal(engine, func);
    blend_test_ptr = voidptr_to_blend_test_ptr_t(code);
 
@@ -715,9 +696,6 @@ test_one(unsigned verbose,
 
    LLVMFreeMachineCodeForFunction(engine, func);
 
-   if(pass)
-      LLVMDisposePassManager(pass);
-
    return success;
 }
 
@@ -773,7 +751,7 @@ const unsigned num_types = sizeof(blend_types)/sizeof(blend_types[0]);
 
 
 boolean
-test_all(unsigned verbose, FILE *fp)
+test_all(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    const unsigned *rgb_func;
    const unsigned *rgb_src_factor;
@@ -809,7 +787,7 @@ test_all(unsigned verbose, FILE *fp)
                            blend.rt[0].alpha_dst_factor  = *alpha_dst_factor;
                            blend.rt[0].colormask         = PIPE_MASK_RGBA;
 
-                           if(!test_one(verbose, fp, &blend, mode, *type))
+                           if(!test_one(gallivm, verbose, fp, &blend, mode, *type))
                              success = FALSE;
 
                         }
@@ -826,7 +804,8 @@ test_all(unsigned verbose, FILE *fp)
 
 
 boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n)
+test_some(struct gallivm_state *gallivm, unsigned verbose, FILE *fp,
+          unsigned long n)
 {
    const unsigned *rgb_func;
    const unsigned *rgb_src_factor;
@@ -868,7 +847,7 @@ test_some(unsigned verbose, FILE *fp, unsigned long n)
       blend.rt[0].alpha_dst_factor  = *alpha_dst_factor;
       blend.rt[0].colormask         = PIPE_MASK_RGBA;
 
-      if(!test_one(verbose, fp, &blend, mode, *type))
+      if(!test_one(gallivm, verbose, fp, &blend, mode, *type))
         success = FALSE;
    }
 
@@ -877,7 +856,7 @@ test_some(unsigned verbose, FILE *fp, unsigned long n)
 
 
 boolean
-test_single(unsigned verbose, FILE *fp)
+test_single(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    printf("no test_single()");
    return TRUE;
index 3ba42bf11a6169d6018fe7f8e55f840023d0feef..f4a2f360c75522f11a066aec0e34b3acb00ce5de 100644 (file)
@@ -97,64 +97,65 @@ dump_conv_types(FILE *fp,
 
 
 static LLVMValueRef
-add_conv_test(LLVMModuleRef module,
+add_conv_test(struct gallivm_state *gallivm,
               struct lp_type src_type, unsigned num_srcs,
               struct lp_type dst_type, unsigned num_dsts)
 {
+   LLVMModuleRef module = gallivm->module;
+   LLVMContextRef context = gallivm->context;
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMTypeRef args[2];
    LLVMValueRef func;
    LLVMValueRef src_ptr;
    LLVMValueRef dst_ptr;
    LLVMBasicBlockRef block;
-   LLVMBuilderRef builder;
    LLVMValueRef src[LP_MAX_VECTOR_LENGTH];
    LLVMValueRef dst[LP_MAX_VECTOR_LENGTH];
    unsigned i;
 
-   args[0] = LLVMPointerType(lp_build_vec_type(src_type), 0);
-   args[1] = LLVMPointerType(lp_build_vec_type(dst_type), 0);
+   args[0] = LLVMPointerType(lp_build_vec_type(gallivm, src_type), 0);
+   args[1] = LLVMPointerType(lp_build_vec_type(gallivm, dst_type), 0);
 
-   func = LLVMAddFunction(module, "test", LLVMFunctionType(LLVMVoidType(), args, 2, 0));
+   func = LLVMAddFunction(module, "test",
+                          LLVMFunctionType(LLVMVoidTypeInContext(context),
+                                           args, 2, 0));
    LLVMSetFunctionCallConv(func, LLVMCCallConv);
    src_ptr = LLVMGetParam(func, 0);
    dst_ptr = LLVMGetParam(func, 1);
 
-   block = LLVMAppendBasicBlock(func, "entry");
-   builder = LLVMCreateBuilder();
+   block = LLVMAppendBasicBlockInContext(context, func, "entry");
    LLVMPositionBuilderAtEnd(builder, block);
 
    for(i = 0; i < num_srcs; ++i) {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      LLVMValueRef index = LLVMConstInt(LLVMInt32TypeInContext(context), i, 0);
       LLVMValueRef ptr = LLVMBuildGEP(builder, src_ptr, &index, 1, "");
       src[i] = LLVMBuildLoad(builder, ptr, "");
    }
 
-   lp_build_conv(builder, src_type, dst_type, src, num_srcs, dst, num_dsts);
+   lp_build_conv(gallivm, src_type, dst_type, src, num_srcs, dst, num_dsts);
 
    for(i = 0; i < num_dsts; ++i) {
-      LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+      LLVMValueRef index = LLVMConstInt(LLVMInt32TypeInContext(context), i, 0);
       LLVMValueRef ptr = LLVMBuildGEP(builder, dst_ptr, &index, 1, "");
       LLVMBuildStore(builder, dst[i], ptr);
    }
 
    LLVMBuildRetVoid(builder);;
 
-   LLVMDisposeBuilder(builder);
    return func;
 }
 
 
 PIPE_ALIGN_STACK
 static boolean
-test_one(unsigned verbose,
+test_one(struct gallivm_state *gallivm, unsigned verbose,
          FILE *fp,
          struct lp_type src_type,
          struct lp_type dst_type)
 {
-   LLVMModuleRef module = NULL;
+   LLVMModuleRef module = gallivm->module;
+   LLVMExecutionEngineRef engine = gallivm->engine;
    LLVMValueRef func = NULL;
-   LLVMExecutionEngineRef engine = lp_build_engine;
-   LLVMPassManagerRef pass = NULL;
    char *error = NULL;
    conv_test_ptr_t conv_test_ptr;
    boolean success;
@@ -193,9 +194,7 @@ test_one(unsigned verbose,
 
    eps = MAX2(lp_const_eps(src_type), lp_const_eps(dst_type));
 
-   module = LLVMModuleCreateWithName("test");
-
-   func = add_conv_test(module, src_type, num_srcs, dst_type, num_dsts);
+   func = add_conv_test(gallivm, src_type, num_srcs, dst_type, num_dsts);
 
    if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) {
       LLVMDumpModule(module);
@@ -203,21 +202,6 @@ test_one(unsigned verbose,
    }
    LLVMDisposeMessage(error);
 
-#if 0
-   pass = LLVMCreatePassManager();
-   LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass);
-   /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-    * but there are more on SVN. */
-   LLVMAddConstantPropagationPass(pass);
-   LLVMAddInstructionCombiningPass(pass);
-   LLVMAddPromoteMemoryToRegisterPass(pass);
-   LLVMAddGVNPass(pass);
-   LLVMAddCFGSimplificationPass(pass);
-   LLVMRunPassManager(pass, module);
-#else
-   (void)pass;
-#endif
-
    if(verbose >= 2)
       LLVMDumpModule(module);
 
@@ -342,9 +326,6 @@ test_one(unsigned verbose,
 
    LLVMFreeMachineCodeForFunction(engine, func);
 
-   if(pass)
-      LLVMDisposePassManager(pass);
-
    return success;
 }
 
@@ -390,7 +371,7 @@ const unsigned num_types = sizeof(conv_types)/sizeof(conv_types[0]);
 
 
 boolean
-test_all(unsigned verbose, FILE *fp)
+test_all(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    const struct lp_type *src_type;
    const struct lp_type *dst_type;
@@ -405,7 +386,7 @@ test_all(unsigned verbose, FILE *fp)
          if(src_type->norm != dst_type->norm)
             continue;
 
-         if(!test_one(verbose, fp, *src_type, *dst_type))
+         if(!test_one(gallivm, verbose, fp, *src_type, *dst_type))
            success = FALSE;
 
       }
@@ -416,7 +397,8 @@ test_all(unsigned verbose, FILE *fp)
 
 
 boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n)
+test_some(struct gallivm_state *gallivm, unsigned verbose, FILE *fp,
+          unsigned long n)
 {
    const struct lp_type *src_type;
    const struct lp_type *dst_type;
@@ -430,7 +412,7 @@ test_some(unsigned verbose, FILE *fp, unsigned long n)
          dst_type = &conv_types[rand() % num_types];
       } while (src_type == dst_type || src_type->norm != dst_type->norm);
 
-      if(!test_one(verbose, fp, *src_type, *dst_type))
+      if(!test_one(gallivm, verbose, fp, *src_type, *dst_type))
         success = FALSE;
    }
 
@@ -439,7 +421,7 @@ test_some(unsigned verbose, FILE *fp, unsigned long n)
 
 
 boolean
-test_single(unsigned verbose, FILE *fp)
+test_single(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    /*    float, fixed,  sign,  norm, width, len */
    struct lp_type f32x4_type =
@@ -449,7 +431,7 @@ test_single(unsigned verbose, FILE *fp)
 
    boolean success;
 
-   success = test_one(verbose, fp, f32x4_type, ub8x4_type);
+   success = test_one(gallivm, verbose, fp, f32x4_type, ub8x4_type);
 
    return success;
 }
index 2855d7cea4fb5980b30185a58f7409f2edde1348..4152ca6cf6370e41e8b551cd0162c20c6008cb3b 100644 (file)
 #include <stdio.h>
 #include <float.h>
 
-#include "gallivm/lp_bld.h"
-#include "gallivm/lp_bld_debug.h"
-#include "gallivm/lp_bld_init.h"
-#include <llvm-c/Analysis.h>
-#include <llvm-c/Target.h>
-#include <llvm-c/Transforms/Scalar.h>
-
 #include "util/u_memory.h"
 #include "util/u_pointer.h"
 #include "util/u_string.h"
 #include "util/u_format_tests.h"
 #include "util/u_format_s3tc.h"
 
+#include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_debug.h"
 #include "gallivm/lp_bld_format.h"
+#include "gallivm/lp_bld_init.h"
+
 #include "lp_test.h"
 
 
@@ -78,56 +75,57 @@ typedef void
 
 
 static LLVMValueRef
-add_fetch_rgba_test(unsigned verbose,
+add_fetch_rgba_test(struct gallivm_state *gallivm, unsigned verbose,
                     const struct util_format_description *desc,
                     struct lp_type type)
 {
    char name[256];
+   LLVMContextRef context = gallivm->context;
+   LLVMModuleRef module = gallivm->module;
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMPassManagerRef passmgr = gallivm->passmgr;
    LLVMTypeRef args[4];
    LLVMValueRef func;
    LLVMValueRef packed_ptr;
-   LLVMValueRef offset = LLVMConstNull(LLVMInt32Type());
+   LLVMValueRef offset = LLVMConstNull(LLVMInt32TypeInContext(context));
    LLVMValueRef rgba_ptr;
    LLVMValueRef i;
    LLVMValueRef j;
    LLVMBasicBlockRef block;
-   LLVMBuilderRef builder;
    LLVMValueRef rgba;
 
    util_snprintf(name, sizeof name, "fetch_%s_%s", desc->short_name,
                  type.floating ? "float" : "unorm8");
 
-   args[0] = LLVMPointerType(lp_build_vec_type(type), 0);
-   args[1] = LLVMPointerType(LLVMInt8Type(), 0);
-   args[3] = args[2] = LLVMInt32Type();
+   args[0] = LLVMPointerType(lp_build_vec_type(gallivm, type), 0);
+   args[1] = LLVMPointerType(LLVMInt8TypeInContext(context), 0);
+   args[3] = args[2] = LLVMInt32TypeInContext(context);
 
-   func = LLVMAddFunction(lp_build_module, name,
-                          LLVMFunctionType(LLVMVoidType(), args, Elements(args), 0));
+   func = LLVMAddFunction(module, name,
+                          LLVMFunctionType(LLVMVoidTypeInContext(context),
+                                           args, Elements(args), 0));
    LLVMSetFunctionCallConv(func, LLVMCCallConv);
    rgba_ptr = LLVMGetParam(func, 0);
    packed_ptr = LLVMGetParam(func, 1);
    i = LLVMGetParam(func, 2);
    j = LLVMGetParam(func, 3);
 
-   block = LLVMAppendBasicBlock(func, "entry");
-   builder = LLVMCreateBuilder();
+   block = LLVMAppendBasicBlockInContext(context, func, "entry");
    LLVMPositionBuilderAtEnd(builder, block);
 
-   rgba = lp_build_fetch_rgba_aos(builder, desc, type,
+   rgba = lp_build_fetch_rgba_aos(gallivm, desc, type,
                                   packed_ptr, offset, i, j);
 
    LLVMBuildStore(builder, rgba, rgba_ptr);
 
    LLVMBuildRetVoid(builder);
 
-   LLVMDisposeBuilder(builder);
-
    if (LLVMVerifyFunction(func, LLVMPrintMessageAction)) {
       LLVMDumpValue(func);
       abort();
    }
 
-   LLVMRunFunctionPassManager(lp_build_pass, func);
+   LLVMRunFunctionPassManager(passmgr, func);
 
    if (verbose >= 1) {
       LLVMDumpValue(func);
@@ -139,10 +137,11 @@ add_fetch_rgba_test(unsigned verbose,
 
 PIPE_ALIGN_STACK
 static boolean
-test_format_float(unsigned verbose, FILE *fp,
+test_format_float(struct gallivm_state *gallivm, unsigned verbose, FILE *fp,
                   const struct util_format_description *desc)
 {
    LLVMValueRef fetch = NULL;
+   LLVMExecutionEngineRef engine = gallivm->engine;
    fetch_ptr_t fetch_ptr;
    PIPE_ALIGN_VAR(16) float unpacked[4];
    boolean first = TRUE;
@@ -150,9 +149,9 @@ test_format_float(unsigned verbose, FILE *fp,
    unsigned i, j, k, l;
    void *f;
 
-   fetch = add_fetch_rgba_test(verbose, desc, lp_float32_vec4_type());
+   fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_float32_vec4_type());
 
-   f = LLVMGetPointerToGlobal(lp_build_engine, fetch);
+   f = LLVMGetPointerToGlobal(engine, fetch);
    fetch_ptr = (fetch_ptr_t) pointer_to_func(f);
 
    if (verbose >= 2) {
@@ -208,7 +207,7 @@ test_format_float(unsigned verbose, FILE *fp,
       }
    }
 
-   LLVMFreeMachineCodeForFunction(lp_build_engine, fetch);
+   LLVMFreeMachineCodeForFunction(engine, fetch);
    LLVMDeleteFunction(fetch);
 
    if(fp)
@@ -220,7 +219,8 @@ test_format_float(unsigned verbose, FILE *fp,
 
 PIPE_ALIGN_STACK
 static boolean
-test_format_unorm8(unsigned verbose, FILE *fp,
+test_format_unorm8(struct gallivm_state *gallivm,
+                   unsigned verbose, FILE *fp,
                    const struct util_format_description *desc)
 {
    LLVMValueRef fetch = NULL;
@@ -231,9 +231,9 @@ test_format_unorm8(unsigned verbose, FILE *fp,
    unsigned i, j, k, l;
    void *f;
 
-   fetch = add_fetch_rgba_test(verbose, desc, lp_unorm8_vec4_type());
+   fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_unorm8_vec4_type());
 
-   f = LLVMGetPointerToGlobal(lp_build_engine, fetch);
+   f = LLVMGetPointerToGlobal(gallivm->engine, fetch);
    fetch_ptr = (fetch_ptr_t) pointer_to_func(f);
 
    if (verbose >= 2) {
@@ -290,7 +290,7 @@ test_format_unorm8(unsigned verbose, FILE *fp,
    if (!success)
       LLVMDumpValue(fetch);
 
-   LLVMFreeMachineCodeForFunction(lp_build_engine, fetch);
+   LLVMFreeMachineCodeForFunction(gallivm->engine, fetch);
    LLVMDeleteFunction(fetch);
 
    if(fp)
@@ -303,16 +303,17 @@ test_format_unorm8(unsigned verbose, FILE *fp,
 
 
 static boolean
-test_one(unsigned verbose, FILE *fp,
+test_one(struct gallivm_state *gallivm,
+         unsigned verbose, FILE *fp,
          const struct util_format_description *format_desc)
 {
    boolean success = TRUE;
 
-   if (!test_format_float(verbose, fp, format_desc)) {
+   if (!test_format_float(gallivm, verbose, fp, format_desc)) {
      success = FALSE;
    }
 
-   if (!test_format_unorm8(verbose, fp, format_desc)) {
+   if (!test_format_unorm8(gallivm, verbose, fp, format_desc)) {
      success = FALSE;
    }
 
@@ -321,7 +322,7 @@ test_one(unsigned verbose, FILE *fp,
 
 
 boolean
-test_all(unsigned verbose, FILE *fp)
+test_all(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    enum pipe_format format;
    boolean success = TRUE;
@@ -349,7 +350,7 @@ test_all(unsigned verbose, FILE *fp)
          continue;
       }
 
-      if (!test_one(verbose, fp, format_desc)) {
+      if (!test_one(gallivm, verbose, fp, format_desc)) {
            success = FALSE;
       }
    }
@@ -359,14 +360,15 @@ test_all(unsigned verbose, FILE *fp)
 
 
 boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n)
+test_some(struct gallivm_state *gallivm, unsigned verbose, FILE *fp,
+          unsigned long n)
 {
-   return test_all(verbose, fp);
+   return test_all(gallivm, verbose, fp);
 }
 
 
 boolean
-test_single(unsigned verbose, FILE *fp)
+test_single(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    printf("no test_single()");
    return TRUE;
index 7a0d06ae2c8cd1a45fbf748e17b9e915d34d7b9b..149ee6f1256a4e9dca3c4144d8361fabeab0c8d7 100644 (file)
@@ -380,6 +380,7 @@ int main(int argc, char **argv)
    unsigned i;
    boolean success;
    boolean single = FALSE;
+   struct gallivm_state *gallivm;
 
    for(i = 1; i < argc; ++i) {
       if(strcmp(argv[i], "-v") == 0)
@@ -394,21 +395,23 @@ int main(int argc, char **argv)
 
    lp_build_init();
 
+   gallivm = gallivm_create();
+
    util_cpu_detect();
 
    if(fp) {
       /* Warm up the caches */
-      test_some(0, NULL, 100);
+      test_some(gallivm, 0, NULL, 100);
 
       write_tsv_header(fp);
    }
       
    if (single)
-      success = test_single(verbose, fp);
+      success = test_single(gallivm, verbose, fp);
    else if (n)
-      success = test_some(verbose, fp, n);
+      success = test_some(gallivm, verbose, fp, n);
    else
-      success = test_all(verbose, fp);
+      success = test_all(gallivm, verbose, fp);
 
    if(fp)
       fclose(fp);
index 4653f30e39dd3d2b1c672f92eddbabaed417dea5..620cdb57c13c8ccfaa6bc39c1775d6e833cd40ff 100644 (file)
 #include "gallivm/lp_bld_assert.h"
 #include "gallivm/lp_bld_printf.h"
 
-#include <llvm-c/Analysis.h>
-#include <llvm-c/ExecutionEngine.h>
-#include <llvm-c/Target.h>
-#include <llvm-c/Transforms/Scalar.h>
-
 #include "lp_test.h"
 
 
@@ -63,48 +58,45 @@ typedef void (*test_printf_t)(int i);
 
 
 static LLVMValueRef
-add_printf_test(LLVMModuleRef module)
+add_printf_test(struct gallivm_state *gallivm)
 {
-   LLVMTypeRef args[1] = { LLVMIntType(32) };
-   LLVMValueRef func = LLVMAddFunction(module, "test_printf", LLVMFunctionType(LLVMVoidType(), args, 1, 0));
-   LLVMBuilderRef builder = LLVMCreateBuilder();
-   LLVMBasicBlockRef block = LLVMAppendBasicBlock(func, "entry");
+   LLVMModuleRef module = gallivm->module;
+   LLVMTypeRef args[1] = { LLVMIntTypeInContext(gallivm->context, 32) };
+   LLVMValueRef func = LLVMAddFunction(module, "test_printf", LLVMFunctionType(LLVMVoidTypeInContext(gallivm->context), args, 1, 0));
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMBasicBlockRef block = LLVMAppendBasicBlockInContext(gallivm->context, func, "entry");
 
    LLVMSetFunctionCallConv(func, LLVMCCallConv);
 
    LLVMPositionBuilderAtEnd(builder, block);
-   lp_build_printf(builder, "hello, world\n");
-   lp_build_printf(builder, "print 5 6: %d %d\n", LLVMConstInt(LLVMInt32Type(), 5, 0),
-                               LLVMConstInt(LLVMInt32Type(), 6, 0));
+   lp_build_printf(gallivm, "hello, world\n");
+   lp_build_printf(gallivm, "print 5 6: %d %d\n", LLVMConstInt(LLVMInt32TypeInContext(gallivm->context), 5, 0),
+                               LLVMConstInt(LLVMInt32TypeInContext(gallivm->context), 6, 0));
 
    /* Also test lp_build_assert().  This should not fail. */
-   lp_build_assert(builder, LLVMConstInt(LLVMInt32Type(), 1, 0), "assert(1)");
+   lp_build_assert(gallivm, LLVMConstInt(LLVMInt32TypeInContext(gallivm->context), 1, 0), "assert(1)");
 
    LLVMBuildRetVoid(builder);
-   LLVMDisposeBuilder(builder);
+
    return func;
 }
 
 
 PIPE_ALIGN_STACK
 static boolean
-test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase)
+test_printf(struct gallivm_state *gallivm,
+            unsigned verbose, FILE *fp,
+            const struct printf_test_case *testcase)
 {
-   LLVMModuleRef module = NULL;
-   LLVMValueRef test = NULL;
-   LLVMExecutionEngineRef engine = NULL;
-   LLVMModuleProviderRef provider = NULL;
-   LLVMPassManagerRef pass = NULL;
+   LLVMExecutionEngineRef engine = gallivm->engine;
+   LLVMModuleRef module = gallivm->module;
+   LLVMValueRef test;
    char *error = NULL;
-   test_printf_t test_printf;
-   float unpacked[4];
-   unsigned packed;
+   test_printf_t test_printf_func;
    boolean success = TRUE;
    void *code;
 
-   module = LLVMModuleCreateWithName("test");
-
-   test = add_printf_test(module);
+   test = add_printf_test(gallivm);
 
    if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) {
       LLVMDumpModule(module);
@@ -112,74 +104,40 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase)
    }
    LLVMDisposeMessage(error);
 
-   provider = LLVMCreateModuleProviderForExistingModule(module);
-#if 0
-   if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) {
-      fprintf(stderr, "%s\n", error);
-      LLVMDisposeMessage(error);
-      abort();
-   }
-#else
-   (void) provider;
-   engine = lp_build_engine;
-#endif
-
-#if 0
-   pass = LLVMCreatePassManager();
-   LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass);
-   /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-    * but there are more on SVN. */
-   LLVMAddConstantPropagationPass(pass);
-   LLVMAddInstructionCombiningPass(pass);
-   LLVMAddPromoteMemoryToRegisterPass(pass);
-   LLVMAddGVNPass(pass);
-   LLVMAddCFGSimplificationPass(pass);
-   LLVMRunPassManager(pass, module);
-#else
-   (void)pass;
-#endif
-
    code = LLVMGetPointerToGlobal(engine, test);
-   test_printf = (test_printf_t)pointer_to_func(code);
-
-   memset(unpacked, 0, sizeof unpacked);
-   packed = 0;
-
+   test_printf_func = (test_printf_t) pointer_to_func(code);
 
    // LLVMDumpModule(module);
 
-   test_printf(0);
+   test_printf_func(0);
 
    LLVMFreeMachineCodeForFunction(engine, test);
 
-   LLVMDisposeExecutionEngine(engine);
-   if(pass)
-      LLVMDisposePassManager(pass);
-
    return success;
 }
 
 
 boolean
-test_all(unsigned verbose, FILE *fp)
+test_all(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    boolean success = TRUE;
 
-   test_printf(verbose, fp, NULL);
+   test_printf(gallivm, verbose, fp, NULL);
 
    return success;
 }
 
 
 boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n)
+test_some(struct gallivm_state *gallivm, unsigned verbose, FILE *fp,
+          unsigned long n)
 {
-   return test_all(verbose, fp);
+   return test_all(gallivm, verbose, fp);
 }
 
 
 boolean
-test_single(unsigned verbose, FILE *fp)
+test_single(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    printf("no test_single()");
    return TRUE;
index 816518e5081f6a2e1eab92fbdd35e22692788a66..4edee4af12339161b7be145da9f884ec0ee44048 100644 (file)
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_arit.h"
 
-#include <llvm-c/Analysis.h>
-#include <llvm-c/ExecutionEngine.h>
-#include <llvm-c/Target.h>
-#include <llvm-c/Transforms/Scalar.h>
-
 #include "lp_test.h"
 
 
@@ -64,18 +59,21 @@ typedef LLVMValueRef (*lp_func_t)(struct lp_build_context *, LLVMValueRef);
 
 
 static LLVMValueRef
-add_test(LLVMModuleRef module, const char *name, lp_func_t lp_func)
+add_test(struct gallivm_state *gallivm, const char *name, lp_func_t lp_func)
 {
-   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatType(), 4);
+   LLVMModuleRef module = gallivm->module;
+   LLVMContextRef context = gallivm->context;
+   LLVMBuilderRef builder = gallivm->builder;
+
+   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatTypeInContext(context), 4);
    LLVMTypeRef args[1] = { v4sf };
    LLVMValueRef func = LLVMAddFunction(module, name, LLVMFunctionType(v4sf, args, 1, 0));
    LLVMValueRef arg1 = LLVMGetParam(func, 0);
-   LLVMBuilderRef builder = LLVMCreateBuilder();
-   LLVMBasicBlockRef block = LLVMAppendBasicBlock(func, "entry");
+   LLVMBasicBlockRef block = LLVMAppendBasicBlockInContext(context, func, "entry");
    LLVMValueRef ret;
    struct lp_build_context bld;
 
-   lp_build_context_init(&bld, builder, lp_float32_vec4_type());
+   lp_build_context_init(&bld, gallivm, lp_float32_vec4_type());
 
    LLVMSetFunctionCallConv(func, LLVMCCallConv);
 
@@ -84,7 +82,7 @@ add_test(LLVMModuleRef module, const char *name, lp_func_t lp_func)
    ret = lp_func(&bld, arg1);
 
    LLVMBuildRet(builder, ret);
-   LLVMDisposeBuilder(builder);
+
    return func;
 }
 
@@ -117,12 +115,11 @@ compare(v4sf x, v4sf y)
 
 PIPE_ALIGN_STACK
 static boolean
-test_round(unsigned verbose, FILE *fp)
+test_round(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
-   LLVMModuleRef module = NULL;
+   LLVMModuleRef module = gallivm->module;
    LLVMValueRef test_round = NULL, test_trunc, test_floor, test_ceil;
-   LLVMExecutionEngineRef engine = lp_build_engine;
-   LLVMPassManagerRef pass = NULL;
+   LLVMExecutionEngineRef engine = gallivm->engine;
    char *error = NULL;
    test_round_t round_func, trunc_func, floor_func, ceil_func;
    float unpacked[4];
@@ -130,12 +127,10 @@ test_round(unsigned verbose, FILE *fp)
    boolean success = TRUE;
    int i;
 
-   module = LLVMModuleCreateWithName("test");
-
-   test_round = add_test(module, "round", lp_build_round);
-   test_trunc = add_test(module, "trunc", lp_build_trunc);
-   test_floor = add_test(module, "floor", lp_build_floor);
-   test_ceil = add_test(module, "ceil", lp_build_ceil);
+   test_round = add_test(gallivm, "round", lp_build_round);
+   test_trunc = add_test(gallivm, "trunc", lp_build_trunc);
+   test_floor = add_test(gallivm, "floor", lp_build_floor);
+   test_ceil = add_test(gallivm, "ceil", lp_build_ceil);
 
    if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) {
       printf("LLVMVerifyModule: %s\n", error);
@@ -144,21 +139,6 @@ test_round(unsigned verbose, FILE *fp)
    }
    LLVMDisposeMessage(error);
 
-#if 0
-   pass = LLVMCreatePassManager();
-   LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass);
-   /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-    * but there are more on SVN. */
-   LLVMAddConstantPropagationPass(pass);
-   LLVMAddInstructionCombiningPass(pass);
-   LLVMAddPromoteMemoryToRegisterPass(pass);
-   LLVMAddGVNPass(pass);
-   LLVMAddCFGSimplificationPass(pass);
-   LLVMRunPassManager(pass, module);
-#else
-   (void)pass;
-#endif
-
    round_func = (test_round_t) pointer_to_func(LLVMGetPointerToGlobal(engine, test_round));
    trunc_func = (test_round_t) pointer_to_func(LLVMGetPointerToGlobal(engine, test_trunc));
    floor_func = (test_round_t) pointer_to_func(LLVMGetPointerToGlobal(engine, test_floor));
@@ -229,17 +209,13 @@ test_round(unsigned verbose, FILE *fp)
    LLVMFreeMachineCodeForFunction(engine, test_floor);
    LLVMFreeMachineCodeForFunction(engine, test_ceil);
 
-   LLVMDisposeExecutionEngine(engine);
-   if(pass)
-      LLVMDisposePassManager(pass);
-
    return success;
 }
 
 #else /* !PIPE_ARCH_SSE */
 
 static boolean
-test_round(unsigned verbose, FILE *fp)
+test_round(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    return TRUE;
 }
@@ -248,20 +224,21 @@ test_round(unsigned verbose, FILE *fp)
 
 
 boolean
-test_all(unsigned verbose, FILE *fp)
+test_all(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
-   return test_round(verbose, fp);
+   return test_round(gallivm, verbose, fp);
 }
 
 
 boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n)
+test_some(struct gallivm_state *gallivm, unsigned verbose, FILE *fp,
+          unsigned long n)
 {
-   return test_all(verbose, fp);
+   return test_all(gallivm, verbose, fp);
 }
 
 boolean
-test_single(unsigned verbose, FILE *fp)
+test_single(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    printf("no test_single()");
    return TRUE;
index 79939b1a3939b0f16b95df3c58c91ad751a6334f..066d633d443b317f0747811af2eabd16dd4a8441 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "util/u_pointer.h"
+
 #include "gallivm/lp_bld.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_arit.h"
-#include "util/u_pointer.h"
-
-#include <llvm-c/Analysis.h>
-#include <llvm-c/ExecutionEngine.h>
-#include <llvm-c/Target.h>
-#include <llvm-c/Transforms/Scalar.h>
 
 #include "lp_test.h"
 
@@ -61,25 +57,25 @@ write_tsv_header(FILE *fp)
 typedef __m128 (*test_sincos_t)(__m128);
 
 static LLVMValueRef
-add_sincos_test(LLVMModuleRef module, boolean sin)
+add_sincos_test(struct gallivm_state *gallivm, LLVMModuleRef module,
+                LLVMContextRef context, boolean sin)
 {
-   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatType(), 4);
+   LLVMTypeRef v4sf = LLVMVectorType(LLVMFloatTypeInContext(context), 4);
    LLVMTypeRef args[1] = { v4sf };
    LLVMValueRef func = LLVMAddFunction(module, "sincos", LLVMFunctionType(v4sf, args, 1, 0));
    LLVMValueRef arg1 = LLVMGetParam(func, 0);
-   LLVMBuilderRef builder = LLVMCreateBuilder();
-   LLVMBasicBlockRef block = LLVMAppendBasicBlock(func, "entry");
+   LLVMBuilderRef builder = gallivm->builder;
+   LLVMBasicBlockRef block = LLVMAppendBasicBlockInContext(context, func, "entry");
    LLVMValueRef ret;
    struct lp_build_context bld;
 
-   lp_build_context_init(&bld, builder, lp_float32_vec4_type());
+   lp_build_context_init(&bld, gallivm, lp_float32_vec4_type());
 
    LLVMSetFunctionCallConv(func, LLVMCCallConv);
 
    LLVMPositionBuilderAtEnd(builder, block);
    ret = sin ? lp_build_sin(&bld, arg1) : lp_build_cos(&bld, arg1);
    LLVMBuildRet(builder, ret);
-   LLVMDisposeBuilder(builder);
    return func;
 }
 
@@ -95,22 +91,20 @@ printv(char* string, v4sf value)
 
 PIPE_ALIGN_STACK
 static boolean
-test_sincos(unsigned verbose, FILE *fp)
+test_sincos(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
-   LLVMModuleRef module = NULL;
+   LLVMModuleRef module = gallivm->module;
    LLVMValueRef test_sin = NULL, test_cos = NULL;
-   LLVMExecutionEngineRef engine = lp_build_engine;
-   LLVMPassManagerRef pass = NULL;
+   LLVMExecutionEngineRef engine = gallivm->engine;
+   LLVMContextRef context = gallivm->context;
    char *error = NULL;
    test_sincos_t sin_func;
    test_sincos_t cos_func;
    float unpacked[4];
    boolean success = TRUE;
 
-   module = LLVMModuleCreateWithName("test");
-
-   test_sin = add_sincos_test(module, TRUE);
-   test_cos = add_sincos_test(module, FALSE);
+   test_sin = add_sincos_test(gallivm, module, context, TRUE);
+   test_cos = add_sincos_test(gallivm, module, context,FALSE);
 
    if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) {
       printf("LLVMVerifyModule: %s\n", error);
@@ -119,21 +113,6 @@ test_sincos(unsigned verbose, FILE *fp)
    }
    LLVMDisposeMessage(error);
 
-#if 0
-   pass = LLVMCreatePassManager();
-   LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass);
-   /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-    * but there are more on SVN. */
-   LLVMAddConstantPropagationPass(pass);
-   LLVMAddInstructionCombiningPass(pass);
-   LLVMAddPromoteMemoryToRegisterPass(pass);
-   LLVMAddGVNPass(pass);
-   LLVMAddCFGSimplificationPass(pass);
-   LLVMRunPassManager(pass, module);
-#else
-   (void)pass;
-#endif
-
    sin_func = (test_sincos_t) pointer_to_func(LLVMGetPointerToGlobal(engine, test_sin));
    cos_func = (test_sincos_t) pointer_to_func(LLVMGetPointerToGlobal(engine, test_cos));
 
@@ -152,16 +131,13 @@ test_sincos(unsigned verbose, FILE *fp)
    LLVMFreeMachineCodeForFunction(engine, test_sin);
    LLVMFreeMachineCodeForFunction(engine, test_cos);
 
-   if(pass)
-      LLVMDisposePassManager(pass);
-
    return success;
 }
 
 #else /* !PIPE_ARCH_SSE */
 
 static boolean
-test_sincos(unsigned verbose, FILE *fp)
+test_sincos(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    return TRUE;
 }
@@ -170,24 +146,25 @@ test_sincos(unsigned verbose, FILE *fp)
 
 
 boolean
-test_all(unsigned verbose, FILE *fp)
+test_all(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    boolean success = TRUE;
 
-   test_sincos(verbose, fp);
+   test_sincos(gallivm, verbose, fp);
 
    return success;
 }
 
 
 boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n)
+test_some(struct gallivm_state *gallivm, unsigned verbose, FILE *fp,
+          unsigned long n)
 {
-   return test_all(verbose, fp);
+   return test_all(gallivm, verbose, fp);
 }
 
 boolean
-test_single(unsigned verbose, FILE *fp)
+test_single(struct gallivm_state *gallivm, unsigned verbose, FILE *fp)
 {
    printf("no test_single()");
    return TRUE;
index f417fc8a9ea5564134a2a54c487ee81d01eccc80..ed4282937f88859aea7ffe416395e1c6a67a86ee 100644 (file)
@@ -43,6 +43,7 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
 #include "gallivm/lp_bld_debug.h"
+#include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_type.h"
 #include "gallivm/lp_bld_sample.h"
 #include "gallivm/lp_bld_tgsi.h"
@@ -89,7 +90,7 @@ struct lp_llvm_sampler_soa
  */
 static LLVMValueRef
 lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
-                       LLVMBuilderRef builder,
+                       struct gallivm_state *gallivm,
                        unsigned unit,
                        unsigned member_index,
                        const char *member_name,
@@ -97,6 +98,7 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
 {
    struct llvmpipe_sampler_dynamic_state *state =
       (struct llvmpipe_sampler_dynamic_state *)base;
+   LLVMBuilderRef builder = gallivm->builder;
    LLVMValueRef indices[4];
    LLVMValueRef ptr;
    LLVMValueRef res;
@@ -104,13 +106,13 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
    assert(unit < PIPE_MAX_SAMPLERS);
 
    /* context[0] */
-   indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   indices[0] = lp_build_const_int32(gallivm, 0);
    /* context[0].textures */
-   indices[1] = LLVMConstInt(LLVMInt32Type(), LP_JIT_CTX_TEXTURES, 0);
+   indices[1] = lp_build_const_int32(gallivm, LP_JIT_CTX_TEXTURES);
    /* context[0].textures[unit] */
-   indices[2] = LLVMConstInt(LLVMInt32Type(), unit, 0);
+   indices[2] = lp_build_const_int32(gallivm, unit);
    /* context[0].textures[unit].member */
-   indices[3] = LLVMConstInt(LLVMInt32Type(), member_index, 0);
+   indices[3] = lp_build_const_int32(gallivm, member_index);
 
    ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
 
@@ -137,10 +139,10 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
 #define LP_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load)  \
    static LLVMValueRef \
    lp_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \
-                            LLVMBuilderRef builder, \
+                            struct gallivm_state *gallivm, \
                             unsigned unit) \
    { \
-      return lp_llvm_texture_member(base, builder, unit, _index, #_name, _emit_load ); \
+      return lp_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \
    }
 
 
@@ -170,7 +172,7 @@ lp_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
  */
 static void
 lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
-                                     LLVMBuilderRef builder,
+                                     struct gallivm_state *gallivm,
                                      struct lp_type type,
                                      unsigned unit,
                                      unsigned num_coords,
@@ -186,11 +188,11 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
    assert(unit < PIPE_MAX_SAMPLERS);
    
    if (LP_PERF & PERF_NO_TEX) {
-      lp_build_sample_nop(type, texel);
+      lp_build_sample_nop(gallivm, type, texel);
       return;
    }
 
-   lp_build_sample_soa(builder,
+   lp_build_sample_soa(gallivm,
                        &sampler->dynamic_state.static_state[unit],
                        &sampler->dynamic_state.base,
                        type,
index a4b9f2590af2815ea4c821f554bb396471eaa161..9753da5e57e8e62663f5851cb5875c8436e4cc21 100644 (file)
@@ -49,6 +49,7 @@
 #include "lp_tile_image.h"
 #include "lp_texture.h"
 #include "lp_setup.h"
+#include "lp_state.h"
 
 #include "state_tracker/sw_winsys.h"
 
@@ -242,6 +243,7 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
       /* other data (vertex buffer, const buffer, etc) */
       const enum pipe_format format = templat->format;
       const uint w = templat->width0 / util_format_get_blockheight(format);
+      /* XXX buffers should only have one dimension, those values should be 1 */
       const uint h = templat->height0 / util_format_get_blockwidth(format);
       const uint d = templat->depth0;
       const uint bpp = util_format_get_blocksize(format);
@@ -329,17 +331,16 @@ llvmpipe_resource_destroy(struct pipe_screen *pscreen,
  */
 void *
 llvmpipe_resource_map(struct pipe_resource *resource,
-                     unsigned face,
-                     unsigned level,
-                     unsigned zslice,
+                      unsigned level,
+                      unsigned layer,
                       enum lp_texture_usage tex_usage,
                       enum lp_texture_layout layout)
 {
    struct llvmpipe_resource *lpr = llvmpipe_resource(resource);
    uint8_t *map;
 
-   assert(face < 6);
    assert(level < LP_MAX_TEXTURE_LEVELS);
+   assert(layer < (u_minify(resource->depth0, level) + resource->array_size - 1));
 
    assert(tex_usage == LP_TEX_USAGE_READ ||
           tex_usage == LP_TEX_USAGE_READ_WRITE ||
@@ -363,9 +364,8 @@ llvmpipe_resource_map(struct pipe_resource *resource,
          dt_usage = PIPE_TRANSFER_READ_WRITE;
       }
 
-      assert(face == 0);
       assert(level == 0);
-      assert(zslice == 0);
+      assert(layer == 0);
 
       /* FIXME: keep map count? */
       map = winsys->displaytarget_map(winsys, lpr->dt, dt_usage);
@@ -381,15 +381,8 @@ llvmpipe_resource_map(struct pipe_resource *resource,
       return map2;
    }
    else if (resource_is_texture(resource)) {
-      /* regular texture */
-      if (resource->target != PIPE_TEXTURE_CUBE) {
-         assert(face == 0);
-      }
-      if (resource->target != PIPE_TEXTURE_3D) {
-         assert(zslice == 0);
-      }
 
-      map = llvmpipe_get_texture_image(lpr, face + zslice, level,
+      map = llvmpipe_get_texture_image(lpr, layer, level,
                                        tex_usage, layout);
       return map;
    }
@@ -404,9 +397,8 @@ llvmpipe_resource_map(struct pipe_resource *resource,
  */
 void
 llvmpipe_resource_unmap(struct pipe_resource *resource,
-                       unsigned face,
                        unsigned level,
-                       unsigned zslice)
+                       unsigned layer)
 {
    struct llvmpipe_resource *lpr = llvmpipe_resource(resource);
 
@@ -415,12 +407,11 @@ llvmpipe_resource_unmap(struct pipe_resource *resource,
       struct llvmpipe_screen *lp_screen = llvmpipe_screen(resource->screen);
       struct sw_winsys *winsys = lp_screen->winsys;
 
-      assert(face == 0);
       assert(level == 0);
-      assert(zslice == 0);
+      assert(layer == 0);
 
       /* make sure linear image is up to date */
-      (void) llvmpipe_get_texture_image(lpr, face + zslice, level,
+      (void) llvmpipe_get_texture_image(lpr, layer, level,
                                         LP_TEX_USAGE_READ,
                                         LP_TEX_LAYOUT_LINEAR);
 
@@ -520,34 +511,35 @@ llvmpipe_resource_get_handle(struct pipe_screen *screen,
 
 
 static struct pipe_surface *
-llvmpipe_get_tex_surface(struct pipe_screen *screen,
-                         struct pipe_resource *pt,
-                         unsigned face, unsigned level, unsigned zslice,
-                         unsigned usage)
+llvmpipe_create_surface(struct pipe_context *pipe,
+                        struct pipe_resource *pt,
+                        const struct pipe_surface *surf_tmpl)
 {
    struct pipe_surface *ps;
 
-   assert(level <= pt->last_level);
+   assert(surf_tmpl->u.tex.level <= pt->last_level);
 
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
       pipe_reference_init(&ps->reference, 1);
       pipe_resource_reference(&ps->texture, pt);
-      ps->format = pt->format;
-      ps->width = u_minify(pt->width0, level);
-      ps->height = u_minify(pt->height0, level);
-      ps->usage = usage;
-
-      ps->face = face;
-      ps->level = level;
-      ps->zslice = zslice;
+      ps->context = pipe;
+      ps->format = surf_tmpl->format;
+      ps->width = u_minify(pt->width0, surf_tmpl->u.tex.level);
+      ps->height = u_minify(pt->height0, surf_tmpl->u.tex.level);
+      ps->usage = surf_tmpl->usage;
+
+      ps->u.tex.level = surf_tmpl->u.tex.level;
+      ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+      ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
    }
    return ps;
 }
 
 
 static void 
-llvmpipe_tex_surface_destroy(struct pipe_surface *surf)
+llvmpipe_surface_destroy(struct pipe_context *pipe,
+                         struct pipe_surface *surf)
 {
    /* Effectively do the texture_update work here - if texture images
     * needed post-processing to put them into hardware layout, this is
@@ -561,16 +553,17 @@ llvmpipe_tex_surface_destroy(struct pipe_surface *surf)
 
 static struct pipe_transfer *
 llvmpipe_get_transfer(struct pipe_context *pipe,
-                     struct pipe_resource *resource,
-                     struct pipe_subresource sr,
-                     unsigned usage,
-                     const struct pipe_box *box)
+                      struct pipe_resource *resource,
+                      unsigned level,
+                      unsigned usage,
+                      const struct pipe_box *box)
 {
+   struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
    struct llvmpipe_resource *lprex = llvmpipe_resource(resource);
    struct llvmpipe_transfer *lpr;
 
    assert(resource);
-   assert(sr.level <= resource->last_level);
+   assert(level <= resource->last_level);
 
    /*
     * Transfers, like other pipe operations, must happen in order, so flush the
@@ -580,7 +573,8 @@ llvmpipe_get_transfer(struct pipe_context *pipe,
       boolean read_only = !(usage & PIPE_TRANSFER_WRITE);
       boolean do_not_block = !!(usage & PIPE_TRANSFER_DONTBLOCK);
       if (!llvmpipe_flush_resource(pipe, resource,
-                                   sr.face, sr.level,
+                                   level,
+                                   box->depth > 1 ? -1 : box->z,
                                    0, /* flush_flags */
                                    read_only,
                                    TRUE, /* cpu_access */
@@ -594,14 +588,17 @@ llvmpipe_get_transfer(struct pipe_context *pipe,
       }
    }
 
+   if (resource == llvmpipe->constants[PIPE_SHADER_FRAGMENT][0])
+      llvmpipe->dirty |= LP_NEW_CONSTANTS;
+
    lpr = CALLOC_STRUCT(llvmpipe_transfer);
    if (lpr) {
       struct pipe_transfer *pt = &lpr->base;
       pipe_resource_reference(&pt->resource, resource);
       pt->box = *box;
-      pt->sr = sr;
-      pt->stride = lprex->row_stride[sr.level];
-      pt->slice_stride = lprex->img_stride[sr.level];
+      pt->level = level;
+      pt->stride = lprex->row_stride[level];
+      pt->layer_stride = lprex->img_stride[level];
       pt->usage = usage;
 
       return pt;
@@ -635,8 +632,7 @@ llvmpipe_transfer_map( struct pipe_context *pipe,
    enum lp_texture_usage tex_usage;
    const char *mode;
 
-   assert(transfer->sr.face < 6);
-   assert(transfer->sr.level < LP_MAX_TEXTURE_LEVELS);
+   assert(transfer->level < LP_MAX_TEXTURE_LEVELS);
 
    /*
    printf("tex_transfer_map(%d, %d  %d x %d of %d x %d,  usage %d )\n",
@@ -666,9 +662,8 @@ llvmpipe_transfer_map( struct pipe_context *pipe,
    format = lpr->base.format;
 
    map = llvmpipe_resource_map(transfer->resource,
-                              transfer->sr.face,
-                              transfer->sr.level,
-                              transfer->box.z,
+                               transfer->level,
+                               transfer->box.z,
                                tex_usage, LP_TEX_LAYOUT_LINEAR);
 
 
@@ -680,7 +675,7 @@ llvmpipe_transfer_map( struct pipe_context *pipe,
        */
       screen->timestamp++;
    }
-   
+
    map +=
       transfer->box.y / util_format_get_blockheight(format) * transfer->stride +
       transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
@@ -696,21 +691,20 @@ llvmpipe_transfer_unmap(struct pipe_context *pipe,
    assert(transfer->resource);
 
    llvmpipe_resource_unmap(transfer->resource,
-                          transfer->sr.face,
-                          transfer->sr.level,
-                          transfer->box.z);
+                           transfer->level,
+                           transfer->box.z);
 }
 
 static unsigned int
 llvmpipe_is_resource_referenced( struct pipe_context *pipe,
-                               struct pipe_resource *presource,
-                               unsigned face, unsigned level)
+                                 struct pipe_resource *presource,
+                                 unsigned level, int layer)
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
 
    if (presource->target == PIPE_BUFFER)
       return PIPE_UNREFERENCED;
-   
+
    return lp_setup_is_resource_referenced(llvmpipe->setup, presource);
 }
 
@@ -740,6 +734,7 @@ llvmpipe_user_buffer_create(struct pipe_screen *screen,
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
    buffer->base.depth0 = 1;
+   buffer->base.array_size = 1;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
 
@@ -1396,8 +1391,6 @@ llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen)
    screen->resource_get_handle = llvmpipe_resource_get_handle;
    screen->user_buffer_create = llvmpipe_user_buffer_create;
 
-   screen->get_tex_surface = llvmpipe_get_tex_surface;
-   screen->tex_surface_destroy = llvmpipe_tex_surface_destroy;
 }
 
 
@@ -1412,4 +1405,7 @@ llvmpipe_init_context_resource_funcs(struct pipe_context *pipe)
  
    pipe->transfer_flush_region = u_default_transfer_flush_region;
    pipe->transfer_inline_write = u_default_transfer_inline_write;
+
+   pipe->create_surface = llvmpipe_create_surface;
+   pipe->surface_destroy = llvmpipe_surface_destroy;
 }
index 4e4a65dcb401d1e260b79655ab301a45e6e8c2f1..b789c0f4090a1bd1602627db9b84cc2f210e9746 100644 (file)
@@ -172,17 +172,15 @@ llvmpipe_resource_stride(struct pipe_resource *resource,
 
 void *
 llvmpipe_resource_map(struct pipe_resource *resource,
-                     unsigned face_slice,
-                     unsigned level,
-                     unsigned zslice,
+                      unsigned level,
+                      unsigned layer,
                       enum lp_texture_usage tex_usage,
                       enum lp_texture_layout layout);
 
 void
 llvmpipe_resource_unmap(struct pipe_resource *resource,
-                       unsigned face_slice,
                        unsigned level,
-                       unsigned zslice);
+                       unsigned layer);
 
 
 void *
index fb5cdb460935c37b4b684292faa0c6b3c838c660..3680f4622da82339a792a786ab386568f8495832 100644 (file)
 #include <util/u_inlines.h>
 #include <util/u_format.h>
 #include "noop_public.h"
-#include "state_tracker/sw_winsys.h"
+
+DEBUG_GET_ONCE_BOOL_OPTION(noop, "GALLIUM_NOOP", FALSE)
 
 void noop_init_state_functions(struct pipe_context *ctx);
 
+struct noop_pipe_screen {
+       struct pipe_screen      pscreen;
+       struct pipe_screen      *oscreen;
+};
+
 /*
  * query
  */
@@ -83,7 +89,7 @@ struct noop_resource {
 
 static unsigned noop_is_resource_referenced(struct pipe_context *pipe,
                                                struct pipe_resource *resource,
-                                               unsigned face, unsigned level)
+                                               unsigned level, int layer)
 {
        return PIPE_UNREFERENCED;
 }
@@ -108,52 +114,29 @@ static struct pipe_resource *noop_resource_create(struct pipe_screen *screen,
                FREE(nresource);
                return NULL;
        }
-#if 0
-       if (nresource->base.bind & (PIPE_BIND_DISPLAY_TARGET |
-                                       PIPE_BIND_SCANOUT |
-                                       PIPE_BIND_SHARED)) {
-               struct sw_winsys *winsys = (struct sw_winsys *)screen->winsys;
-               unsigned stride;
-
-               nresource->dt = winsys->displaytarget_create(winsys, nresource->base.bind,
-                                                               nresource->base.format,
-                                                               nresource->base.width0, 
-                                                               nresource->base.height0,
-                                                               16, &stride);
-       }
-#endif
        return &nresource->base;
 }
 
-static struct pipe_resource *noop_resource_from_handle(struct pipe_screen * screen,
+static struct pipe_resource *noop_resource_from_handle(struct pipe_screen *screen,
                                                        const struct pipe_resource *templ,
-                                                       struct winsys_handle *whandle)
+                                                       struct winsys_handle *handle)
 {
-       struct sw_winsys *winsys = (struct sw_winsys *)screen->winsys;
-       struct noop_resource *nresource;
-       struct sw_displaytarget *dt;
-       unsigned stride;
+       struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen;
+       struct pipe_screen *oscreen = noop_screen->oscreen;
+       struct pipe_resource *result;
+       struct pipe_resource *noop_resource;
 
-       dt = winsys->displaytarget_from_handle(winsys, templ, whandle, &stride);
-       if (dt == NULL) {
-               return NULL;
-       }
-       nresource = (struct noop_resource *)noop_resource_create(screen, templ);
-       nresource->dt = dt;
-       return &nresource->base;
+       result = oscreen->resource_from_handle(oscreen, templ, handle);
+       noop_resource = noop_resource_create(screen, result);
+       pipe_resource_reference(&result, NULL);
+       return noop_resource;
 }
 
 static boolean noop_resource_get_handle(struct pipe_screen *screen,
                                        struct pipe_resource *resource,
                                        struct winsys_handle *handle)
 {
-       struct sw_winsys *winsys = (struct sw_winsys *)screen->winsys;
-       struct noop_resource *nresource = (struct noop_resource *)resource;
-
-       if (nresource->dt == NULL)
-               return FALSE;
-
-       return winsys->displaytarget_get_handle(winsys, nresource->dt, handle);
+       return FALSE;
 }
 
 static void noop_resource_destroy(struct pipe_screen *screen,
@@ -161,11 +144,6 @@ static void noop_resource_destroy(struct pipe_screen *screen,
 {
        struct noop_resource *nresource = (struct noop_resource *)resource;
 
-       if (nresource->dt) {
-               /* display target */
-               struct sw_winsys *winsys = (struct sw_winsys *)screen->winsys;
-               winsys->displaytarget_destroy(winsys, nresource->dt);
-       }
        free(nresource->data);
        FREE(resource);
 }
@@ -193,7 +171,7 @@ static struct pipe_resource *noop_user_buffer_create(struct pipe_screen *screen,
  */
 static struct pipe_transfer *noop_get_transfer(struct pipe_context *context,
                                                struct pipe_resource *resource,
-                                               struct pipe_subresource sr,
+                                               unsigned level,
                                                enum pipe_transfer_usage usage,
                                                const struct pipe_box *box)
 {
@@ -203,11 +181,11 @@ static struct pipe_transfer *noop_get_transfer(struct pipe_context *context,
        if (transfer == NULL)
                return NULL;
        pipe_resource_reference(&transfer->resource, resource);
-       transfer->sr = sr;
+       transfer->level = level;
        transfer->usage = usage;
        transfer->box = *box;
        transfer->stride = 1;
-       transfer->slice_stride = 1;
+       transfer->layer_stride = 1;
        return transfer;
 }
 
@@ -239,12 +217,12 @@ static void noop_transfer_destroy(struct pipe_context *pipe,
 
 static void noop_transfer_inline_write(struct pipe_context *pipe,
                                        struct pipe_resource *resource,
-                                       struct pipe_subresource sr,
+                                       unsigned level,
                                        unsigned usage,
                                        const struct pipe_box *box,
                                        const void *data,
                                        unsigned stride,
-                                       unsigned slice_stride)
+                                       unsigned layer_stride)
 {
 }
 
@@ -277,12 +255,11 @@ static void noop_clear_depth_stencil(struct pipe_context *ctx,
 
 static void noop_resource_copy_region(struct pipe_context *ctx,
                                      struct pipe_resource *dst,
-                                     struct pipe_subresource subdst,
+                                     unsigned dst_level,
                                      unsigned dstx, unsigned dsty, unsigned dstz,
                                      struct pipe_resource *src,
-                                     struct pipe_subresource subsrc,
-                                     unsigned srcx, unsigned srcy, unsigned srcz,
-                                     unsigned width, unsigned height)
+                                     unsigned src_level,
+                                     const struct pipe_box *src_box)
 {
 }
 
@@ -332,46 +309,14 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen, void
        return ctx;
 }
 
-/*
- * texture
- */
-static struct pipe_surface *noop_get_tex_surface(struct pipe_screen *screen,
-                                               struct pipe_resource *texture,
-                                               unsigned face, unsigned level,
-                                               unsigned zslice, unsigned flags)
-{
-       struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
-
-       if (surface == NULL)
-               return NULL;
-       pipe_reference_init(&surface->reference, 1);
-       pipe_resource_reference(&surface->texture, texture);
-       surface->format = texture->format;
-       surface->width = texture->width0;
-       surface->height = texture->height0;
-       surface->offset = 0;
-       surface->usage = flags;
-       surface->zslice = zslice;
-       surface->texture = texture;
-       surface->face = face;
-       surface->level = level;
-
-       return surface;
-}
-
-static void noop_tex_surface_destroy(struct pipe_surface *surface)
-{
-       pipe_resource_reference(&surface->texture, NULL);
-       FREE(surface);
-}
-
 
 /*
  * pipe_screen
  */
 static void noop_flush_frontbuffer(struct pipe_screen *_screen,
-                                       struct pipe_surface *surface,
-                                       void *context_private)
+                                  struct pipe_resource *resource,
+                                  unsigned level, unsigned layer,
+                                  void *context_private)
 {
 }
 
@@ -516,19 +461,30 @@ static boolean noop_is_format_supported(struct pipe_screen* screen,
 
 static void noop_destroy_screen(struct pipe_screen *screen)
 {
+       struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen;
+       struct pipe_screen *oscreen = noop_screen->oscreen;
+
+       oscreen->destroy(oscreen);
        FREE(screen);
 }
 
-struct pipe_screen *noop_screen_create(struct sw_winsys *winsys)
+struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen)
 {
+       struct noop_pipe_screen *noop_screen;
        struct pipe_screen *screen;
 
-       screen = CALLOC_STRUCT(pipe_screen);
-       if (screen == NULL) {
+       if (!debug_get_option_noop()) {
+               return oscreen;
+       }
+
+       noop_screen = CALLOC_STRUCT(noop_pipe_screen);
+       if (noop_screen == NULL) {
                return NULL;
        }
+       noop_screen->oscreen = oscreen;
+       screen = &noop_screen->pscreen;
 
-       screen->winsys = (struct pipe_winsys*)winsys;
+       screen->winsys = oscreen->winsys;
        screen->destroy = noop_destroy_screen;
        screen->get_name = noop_get_name;
        screen->get_vendor = noop_get_vendor;
@@ -537,8 +493,6 @@ struct pipe_screen *noop_screen_create(struct sw_winsys *winsys)
        screen->get_paramf = noop_get_paramf;
        screen->is_format_supported = noop_is_format_supported;
        screen->context_create = noop_create_context;
-       screen->get_tex_surface = noop_get_tex_surface;
-       screen->tex_surface_destroy = noop_tex_surface_destroy;
        screen->resource_create = noop_resource_create;
        screen->resource_from_handle = noop_resource_from_handle;
        screen->resource_get_handle = noop_resource_get_handle;
index 8ce82bec698a13a75dbd6fdc6bc08521ff15573d..180ea597fab10bc6c4002f00584dd9bb617161ca 100644 (file)
@@ -23,8 +23,7 @@
 #ifndef NOOP_PUBLIC_H
 #define NOOP_PUBLIC_H
 
-struct sw_winsys;
-
-struct pipe_screen *noop_screen_create(struct sw_winsys *winsys);
+struct pipe_screen;
+struct pipe_screen *noop_screen_create(struct pipe_screen *screen);
 
 #endif
index 048ed42a9b666c0da4ef7160ea51c872f56955b5..ad324774c0347de38f50260accf28e2f0786dd13 100644 (file)
@@ -101,6 +101,28 @@ static struct pipe_sampler_view *noop_create_sampler_view(struct pipe_context *c
        return sampler_view;
 }
 
+static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
+                                               struct pipe_resource *texture,
+                                               const struct pipe_surface *surf_tmpl)
+{
+       struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
+
+       if (surface == NULL)
+               return NULL;
+       pipe_reference_init(&surface->reference, 1);
+       pipe_resource_reference(&surface->texture, texture);
+       surface->context = ctx;
+       surface->format = surf_tmpl->format;
+       surface->width = texture->width0;
+       surface->height = texture->height0;
+       surface->usage = surf_tmpl->usage;
+       surface->texture = texture;
+       surface->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+       surface->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
+       surface->u.tex.level = surf_tmpl->u.tex.level;
+
+       return surface;
+}
 static void noop_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
                                        struct pipe_sampler_view **views)
 {
@@ -163,6 +185,14 @@ static void noop_sampler_view_destroy(struct pipe_context *ctx,
        FREE(state);
 }
 
+
+static void noop_surface_destroy(struct pipe_context *ctx,
+                                struct pipe_surface *surface)
+{
+       pipe_resource_reference(&surface->texture, NULL);
+       FREE(surface);
+}
+
 static void noop_bind_state(struct pipe_context *ctx, void *state)
 {
 }
@@ -213,6 +243,8 @@ static void *noop_create_shader_state(struct pipe_context *ctx,
        return nstate;
 }
 
+void noop_init_state_functions(struct pipe_context *ctx);
+
 void noop_init_state_functions(struct pipe_context *ctx)
 {
        ctx->create_blend_state = noop_create_blend_state;
@@ -221,6 +253,7 @@ void noop_init_state_functions(struct pipe_context *ctx)
        ctx->create_rasterizer_state = noop_create_rs_state;
        ctx->create_sampler_state = noop_create_sampler_state;
        ctx->create_sampler_view = noop_create_sampler_view;
+       ctx->create_surface = noop_create_surface;
        ctx->create_vertex_elements_state = noop_create_vertex_elements;
        ctx->create_vs_state = noop_create_shader_state;
        ctx->bind_blend_state = noop_bind_state;
@@ -252,5 +285,6 @@ void noop_init_state_functions(struct pipe_context *ctx)
        ctx->set_vertex_sampler_views = noop_set_vs_sampler_view;
        ctx->set_viewport_state = noop_set_viewport_state;
        ctx->sampler_view_destroy = noop_sampler_view_destroy;
+       ctx->surface_destroy = noop_surface_destroy;
        ctx->draw_vbo = noop_draw_vbo;
 }
index 8c290273fb4597537cefb0940378af01083b4b47..1f4e5171c01f351f53be46a5d5347beff15dcf26 100644 (file)
@@ -66,7 +66,7 @@ void nouveau_screen_fini(struct nouveau_screen *);
 
 
 
-
+#ifndef NOUVEAU_NVC0
 static INLINE unsigned
 RING_3D(unsigned mthd, unsigned size)
 {
@@ -78,5 +78,6 @@ RING_3D_NI(unsigned mthd, unsigned size)
 {
        return 0x40000000 | (7 << 13) | (size << 18) | mthd;
 }
+#endif
 
 #endif
index ab480cabd09d9259bc58567a371fd648f833da52..8dfb84a596f55751a21d56a73c7134f43a16f468 100644 (file)
@@ -10,7 +10,9 @@
 #include "nouveau/nouveau_grobj.h"
 #include "nouveau/nouveau_notifier.h"
 #include "nouveau/nouveau_resource.h"
-#include "nouveau/nouveau_pushbuf.h"
+#ifndef NOUVEAU_NVC0
+#include "nouveau/nv04_pushbuf.h"
+#endif
 
 #ifndef NV04_PFIFO_MAX_PACKET_LEN
 #define NV04_PFIFO_MAX_PACKET_LEN 2047
@@ -41,4 +43,7 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
 extern struct pipe_screen *
 nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
 
+extern struct pipe_screen *
+nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
+
 #endif
index cb7653c3fe2f0dfb0aaf6a8724c436e4713c3074..a5b0d0478c8c4ac51a70d0ee87e56753b94bccc5 100644 (file)
@@ -8,12 +8,10 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- nv30-40_3d.xml (  31709 bytes, from 2010-09-05 07:53:14)
-- copyright.xml  (   6503 bytes, from 2010-04-10 23:15:50)
-- nv_3ddefs.xml  (  15193 bytes, from 2010-09-05 07:50:15)
-- nv_defs.xml    (   4437 bytes, from 2010-08-05 19:38:53)
-- nv_object.xml  (  10424 bytes, from 2010-08-05 19:38:53)
-- nvchipsets.xml (   2824 bytes, from 2010-08-05 19:38:53)
+- nv_object.xml  (  11547 bytes, from 2010-10-24 15:29:34)
+- copyright.xml  (   6498 bytes, from 2010-10-03 13:18:37)
+- nvchipsets.xml (   2907 bytes, from 2010-10-15 16:28:21)
+- nv_defs.xml    (   4437 bytes, from 2010-07-06 07:43:58)
 
 Copyright (C) 2006-2010 by the following authors:
 - Artur Huillet <arthur.huillet@free.fr> (ahuillet)
@@ -37,7 +35,7 @@ Copyright (C) 2006-2010 by the following authors:
 - Mark Carey <mark.carey@gmail.com> (careym)
 - Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
 - nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
-- Patrice Mandin <mandin.patrice@orange.fr> (pmandin, pmdata)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
 - Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
 - Peter Popov <ironpeter@users.sf.net> (ironpeter)
 - Richard Hughes <hughsient@users.sf.net> (hughsient)
@@ -180,6 +178,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NV50_COMPUTE                                           0x000050c0
 #define NVA3_COMPUTE                                           0x000085c0
 #define NVC0_COMPUTE                                           0x000090c0
+#define NV84_CRYPT                                             0x000074c1
 #define NV01_SUBCHAN__SIZE                                     0x00002000
 #define NV01_SUBCHAN                                           0x00000000
 
@@ -194,9 +193,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define NV84_SUBCHAN_QUERY_GET                                 0x0000001c
 
-#define NV84_SUBCHAN_UNK20                                     0x00000020
+#define NV84_SUBCHAN_QUERY_INTR                                        0x00000020
 
-#define NV84_SUBCHAN_UNK24                                     0x00000024
+#define NV84_SUBCHAN_WRCACHE_FLUSH                             0x00000024
 
 #define NV10_SUBCHAN_REF_CNT                                   0x00000050
 
@@ -209,7 +208,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define NV11_SUBCHAN_SEMAPHORE_RELEASE                         0x0000006c
 
-#define NV50_SUBCHAN_UNK80                                     0x00000080
+#define NV40_SUBCHAN_YIELD                                     0x00000080
 
 #define NV01_GRAPH                                             0x00000000
 
@@ -227,5 +226,43 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define NV40_GRAPH_PM_TRIGGER                                  0x00000140
 
+#define NVC0_SUBCHAN__SIZE                                     0x00008000
+#define NVC0_SUBCHAN                                           0x00000000
+
+#define NVC0_SUBCHAN_OBJECT                                    0x00000000
+
+
+#define NVC0_SUBCHAN_QUERY_ADDRESS_HIGH                                0x00000010
+
+#define NVC0_SUBCHAN_QUERY_ADDRESS_LOW                         0x00000014
+
+#define NVC0_SUBCHAN_QUERY_SEQUENCE                            0x00000018
+
+#define NVC0_SUBCHAN_QUERY_GET                                 0x0000001c
+
+#define NVC0_SUBCHAN_REF_CNT                                   0x00000050
+
+#define NVC0_GRAPH                                             0x00000000
+
+#define NVC0_GRAPH_NOP                                         0x00000100
+
+#define NVC0_GRAPH_NOTIFY_ADDRESS_HIGH                         0x00000104
+
+#define NVC0_GRAPH_NOTIFY_ADDRESS_LOW                          0x00000108
+
+#define NVC0_GRAPH_NOTIFY                                      0x0000010c
+#define NVC0_GRAPH_NOTIFY_WRITE                                        0x00000000
+#define NVC0_GRAPH_NOTIFY_WRITE_AND_AWAKEN                     0x00000001
+
+#define NVC0_GRAPH_SERIALIZE                                   0x00000110
+
+#define NVC0_GRAPH_MACRO_UPLOAD_POS                            0x00000114
+
+#define NVC0_GRAPH_MACRO_UPLOAD_DATA                           0x00000118
+
+#define NVC0_GRAPH_MACRO_ID                                    0x0000011c
+
+#define NVC0_GRAPH_MACRO_POS                                   0x00000120
+
 
 #endif /* NV_OBJECT_XML */
index dacfee9799c89f8993ab7a0ecd61560fb96aba84..45356f9f637c290f06f6707f472b7df99de2e916 100644 (file)
@@ -136,6 +136,7 @@ nv50_user_buffer_create(struct pipe_screen *pscreen,
        buffer->base.width0 = bytes;
        buffer->base.height0 = 1;
        buffer->base.depth0 = 1;
+       buffer->base.array_size = 1;
 
        buffer->bo = nouveau_screen_bo_user(pscreen, ptr, bytes);
        if (!buffer->bo)
index 0874cb5e4ea45f35365c79c1b62afc393931d780..4f9761617603bd1e9480fcd8378b0cf325b86454 100644 (file)
@@ -49,6 +49,10 @@ nv50_destroy(struct pipe_context *pipe)
        struct nv50_context *nv50 = nv50_context(pipe);
        int i;
 
+        for (i = 0; i < nv50->vtxbuf_nr; i++) {
+           pipe_resource_reference(&nv50->vtxbuf[i].buffer, NULL);
+        }
+
        for (i = 0; i < 64; i++) {
                if (!nv50->state.hw[i])
                        continue;
index bf6a577188be55bafa193188c07c520ab596b015..b2b0b72fe265e1e33b6e23999b7697cb9648d328 100644 (file)
@@ -108,6 +108,7 @@ get_tile_depth(uint32_t tile_mode)
 
 struct nv50_surface {
        struct pipe_surface base;
+       unsigned offset;
 };
 
 static INLINE struct nv50_surface *
index dd0e8fd41b1b4a238853bc1ab804770397106602..309b6503ca52e8a7010ba0626d984257a568336a 100644 (file)
@@ -276,46 +276,53 @@ nv50_miptree_from_handle(struct pipe_screen *pscreen,
  */
 
 struct pipe_surface *
-nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt,
-                        unsigned face, unsigned level, unsigned zslice,
-                        unsigned flags)
+nv50_miptree_surface_new(struct pipe_context *pipe, struct pipe_resource *pt,
+                        const struct pipe_surface *surf_tmpl)
 {
+       unsigned level = surf_tmpl->u.tex.level;
        struct nv50_miptree *mt = nv50_miptree(pt);
        struct nv50_miptree_level *lvl = &mt->level[level];
-       struct pipe_surface *ps;
-       unsigned img = 0;
+       struct nv50_surface *ns;
+       unsigned img = 0, zslice = 0;
 
+       assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
+
+       /* XXX can't unify these here? */
        if (pt->target == PIPE_TEXTURE_CUBE)
-               img = face;
+               img = surf_tmpl->u.tex.first_layer;
+       else if (pt->target == PIPE_TEXTURE_3D)
+               zslice = surf_tmpl->u.tex.first_layer;
 
-       ps = CALLOC_STRUCT(pipe_surface);
-       if (!ps)
+       ns = CALLOC_STRUCT(nv50_surface);
+       if (!ns)
                return NULL;
-       pipe_resource_reference(&ps->texture, pt);
-       ps->format = pt->format;
-       ps->width = u_minify(pt->width0, level);
-       ps->height = u_minify(pt->height0, level);
-       ps->usage = flags;
-       pipe_reference_init(&ps->reference, 1);
-       ps->face = face;
-       ps->level = level;
-       ps->zslice = zslice;
-       ps->offset = lvl->image_offset[img];
+       pipe_resource_reference(&ns->base.texture, pt);
+       ns->base.context = pipe;
+       ns->base.format = pt->format;
+       ns->base.width = u_minify(pt->width0, level);
+       ns->base.height = u_minify(pt->height0, level);
+       ns->base.usage = surf_tmpl->usage;
+       pipe_reference_init(&ns->base.reference, 1);
+       ns->base.u.tex.level = level;
+       ns->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+       ns->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
+       ns->offset = lvl->image_offset[img];
 
        if (pt->target == PIPE_TEXTURE_3D) {
-               unsigned nb_h = util_format_get_nblocksy(pt->format, ps->height);
-               ps->offset += get_zslice_offset(lvl->tile_mode, zslice,
+               unsigned nb_h = util_format_get_nblocksy(pt->format, ns->base.height);
+               ns->offset += get_zslice_offset(lvl->tile_mode, zslice,
                                                lvl->pitch, nb_h);
        }
 
-       return ps;
+       return &ns->base;
 }
 
 void
-nv50_miptree_surface_del(struct pipe_surface *ps)
+nv50_miptree_surface_del(struct pipe_context *pipe,
+                        struct pipe_surface *ps)
 {
        struct nv50_surface *s = nv50_surface(ps);
 
-       pipe_resource_reference(&ps->texture, NULL);
+       pipe_resource_reference(&s->base.texture, NULL);
        FREE(s);
 }
index cfdb60418b5efcf1601521d2d29a26cd0eb3f60e..6c0a9696355de2d5bbdf25408344ebcedd88f5af 100644 (file)
@@ -15,7 +15,7 @@
 static unsigned int
 nv50_resource_is_referenced(struct pipe_context *pipe,
                            struct pipe_resource *resource,
-                           unsigned face, unsigned level)
+                           unsigned level, int layer)
 {
        return nouveau_reference_flags(nv50_resource(resource)->bo);
 }
@@ -51,6 +51,9 @@ nv50_init_resource_functions(struct pipe_context *pcontext)
        pcontext->transfer_destroy = u_transfer_destroy_vtbl;
        pcontext->transfer_inline_write = u_transfer_inline_write_vtbl;
        pcontext->is_resource_referenced = nv50_resource_is_referenced;
+
+       pcontext->create_surface = nv50_miptree_surface_new;
+       pcontext->surface_destroy = nv50_miptree_surface_del;
 }
 
 void
@@ -61,7 +64,4 @@ nv50_screen_init_resource_functions(struct pipe_screen *pscreen)
        pscreen->resource_get_handle = u_resource_get_handle_vtbl;
        pscreen->resource_destroy = u_resource_destroy_vtbl;
        pscreen->user_buffer_create = nv50_user_buffer_create;
-   
-       pscreen->get_tex_surface = nv50_miptree_surface_new;
-       pscreen->tex_surface_destroy = nv50_miptree_surface_del;
 }
index f435a5892e51b96ea648f51fa80740caa5276612..4b2a75e11ad9341e94891a0671f4c287178b1db7 100644 (file)
@@ -87,12 +87,11 @@ nv50_user_buffer_create(struct pipe_screen *screen,
 
 
 struct pipe_surface *
-nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt,
-                        unsigned face, unsigned level, unsigned zslice,
-                        unsigned flags);
+nv50_miptree_surface_new(struct pipe_context *pipe, struct pipe_resource *pt,
+                        const struct pipe_surface *surf_tmpl);
 
 void
-nv50_miptree_surface_del(struct pipe_surface *ps);
+nv50_miptree_surface_del(struct pipe_context *pipe, struct pipe_surface *ps);
 
 
 #endif
index 49522b74d5b9f7c016b646f94a6ccd2751ab6df0..edc3d54d01287c57621beb92cadeec4d32d01a4a 100644 (file)
@@ -127,6 +127,10 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
                return 0;
        case PIPE_CAP_DEPTH_CLAMP:
                return 1;
+       case PIPE_CAP_SHADER_STENCIL_EXPORT:
+               return 0;
+       case PIPE_CAP_PRIMITIVE_RESTART:
+               return 0;
        default:
                NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
                return 0;
index 306aa81d9859cd71a07a2279c0eb384a6453ed4b..1c1b66deb3cd86d7549ebf12c7ece7804ff42601 100644 (file)
@@ -71,7 +71,7 @@ nv50_transfer_constbuf(struct nv50_context *nv50,
       map += nr;
    }
 
-   pipe_buffer_unmap(pipe, buf, transfer);
+   pipe_buffer_unmap(pipe, transfer);
 }
 
 static void
index f42fa2d4d2bd225694f8bd346c6163f82373c27d..b4eda0f617d55b276beaeb8e92a44bb2f73d6004 100644 (file)
@@ -721,17 +721,16 @@ nv50_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
        struct nv50_context *nv50 = nv50_context(pipe);
 
        if (shader == PIPE_SHADER_VERTEX) {
-               nv50->constbuf[PIPE_SHADER_VERTEX] = buf;
                nv50->dirty |= NV50_NEW_VERTPROG_CB;
        } else
        if (shader == PIPE_SHADER_FRAGMENT) {
-               nv50->constbuf[PIPE_SHADER_FRAGMENT] = buf;
                nv50->dirty |= NV50_NEW_FRAGPROG_CB;
-       } else
-       if (shader == PIPE_SHADER_GEOMETRY) {
-               nv50->constbuf[PIPE_SHADER_GEOMETRY] = buf;
+       } else {
+               assert(shader == PIPE_SHADER_GEOMETRY);
                nv50->dirty |= NV50_NEW_GEOMPROG_CB;
        }
+
+       pipe_resource_reference(&nv50->constbuf[shader], buf);
 }
 
 static void
@@ -780,8 +779,9 @@ nv50_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
 {
        struct nv50_context *nv50 = nv50_context(pipe);
 
-       memcpy(nv50->vtxbuf, vb, sizeof(*vb) * count);
-       nv50->vtxbuf_nr = count;
+        util_copy_vertex_buffers(nv50->vtxbuf,
+                                 &nv50->vtxbuf_nr,
+                                 vb, count);
 
        nv50->dirty |= NV50_NEW_ARRAYS;
 }
index 16c2dab9af658d8f1f40c16f12582f6045a7c8fa..ae02143e352f92e38e6885e8199aa95e3e64c8e2 100644 (file)
@@ -63,13 +63,13 @@ validate_fb(struct nv50_context *nv50)
                so_data  (so, fb->cbufs[i]->height);
 
                so_method(so, tesla, NV50TCL_RT_ADDRESS_HIGH(i), 5);
-               so_reloc (so, bo, fb->cbufs[i]->offset, NOUVEAU_BO_VRAM |
+               so_reloc (so, bo, ((struct nv50_surface *)fb->cbufs[i])->offset, NOUVEAU_BO_VRAM |
                              NOUVEAU_BO_HIGH | NOUVEAU_BO_RDWR, 0, 0);
-               so_reloc (so, bo, fb->cbufs[i]->offset, NOUVEAU_BO_VRAM |
+               so_reloc (so, bo, ((struct nv50_surface *)fb->cbufs[i])->offset, NOUVEAU_BO_VRAM |
                              NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0);
                so_data  (so, nv50_format_table[fb->cbufs[i]->format].rt);
                so_data  (so, nv50_miptree(pt)->
-                             level[fb->cbufs[i]->level].tile_mode << 4);
+                             level[fb->cbufs[i]->u.tex.level].tile_mode << 4);
                so_data(so, 0x00000000);
 
                so_method(so, tesla, NV50TCL_RT_ARRAY_MODE, 1);
@@ -92,13 +92,13 @@ validate_fb(struct nv50_context *nv50)
                assert(nv50_format_table[fb->zsbuf->format].rt);
 
                so_method(so, tesla, NV50TCL_ZETA_ADDRESS_HIGH, 5);
-               so_reloc (so, bo, fb->zsbuf->offset, NOUVEAU_BO_VRAM |
+               so_reloc (so, bo, ((struct nv50_surface *)(fb->zsbuf))->offset, NOUVEAU_BO_VRAM |
                              NOUVEAU_BO_HIGH | NOUVEAU_BO_RDWR, 0, 0);
-               so_reloc (so, bo, fb->zsbuf->offset, NOUVEAU_BO_VRAM |
+               so_reloc (so, bo, ((struct nv50_surface *)(fb->zsbuf))->offset, NOUVEAU_BO_VRAM |
                              NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0);
                so_data  (so, nv50_format_table[fb->zsbuf->format].rt);
                so_data  (so, nv50_miptree(pt)->
-                             level[fb->zsbuf->level].tile_mode << 4);
+                             level[fb->zsbuf->u.tex.level].tile_mode << 4);
                so_data  (so, 0x00000000);
 
                so_method(so, tesla, NV50TCL_ZETA_ENABLE, 1);
index f70c138fe1a3e75183c31af38c941aeb94623b62..a99df76cee339607a5431291be8a94834e26e58d 100644 (file)
@@ -22,7 +22,7 @@
 
 #define __NOUVEAU_PUSH_H__
 #include <stdint.h>
-#include "nouveau/nouveau_pushbuf.h"
+#include "nouveau/nv04_pushbuf.h"
 #include "nv50_context.h"
 #include "nv50_resource.h"
 #include "pipe/p_defines.h"
@@ -97,23 +97,23 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst)
                OUT_RING  (chan, format);
                OUT_RING  (chan, 1);
                BEGIN_RING(chan, eng2d, mthd + 0x14, 5);
-               OUT_RING  (chan, mt->level[ps->level].pitch);
+               OUT_RING  (chan, mt->level[ps->u.tex.level].pitch);
                OUT_RING  (chan, ps->width);
                OUT_RING  (chan, ps->height);
-               OUT_RELOCh(chan, bo, ps->offset, flags);
-               OUT_RELOCl(chan, bo, ps->offset, flags);
+               OUT_RELOCh(chan, bo, ((struct nv50_surface *)ps)->offset, flags);
+               OUT_RELOCl(chan, bo, ((struct nv50_surface *)ps)->offset, flags);
        } else {
                BEGIN_RING(chan, eng2d, mthd, 5);
                OUT_RING  (chan, format);
                OUT_RING  (chan, 0);
-               OUT_RING  (chan, mt->level[ps->level].tile_mode << 4);
+               OUT_RING  (chan, mt->level[ps->u.tex.level].tile_mode << 4);
                OUT_RING  (chan, 1);
                OUT_RING  (chan, 0);
                BEGIN_RING(chan, eng2d, mthd + 0x18, 4);
                OUT_RING  (chan, ps->width);
                OUT_RING  (chan, ps->height);
-               OUT_RELOCh(chan, bo, ps->offset, flags);
-               OUT_RELOCl(chan, bo, ps->offset, flags);
+               OUT_RELOCh(chan, bo, ((struct nv50_surface *)ps)->offset, flags);
+               OUT_RELOCl(chan, bo, ((struct nv50_surface *)ps)->offset, flags);
        }
  
 #if 0
@@ -173,30 +173,41 @@ nv50_surface_do_copy(struct nv50_screen *screen, struct pipe_surface *dst,
 
 static void
 nv50_surface_copy(struct pipe_context *pipe,
-                 struct pipe_resource *dest, struct pipe_subresource subdst,
+                 struct pipe_resource *dest, unsigned dst_level,
                  unsigned destx, unsigned desty, unsigned destz,
-                 struct pipe_resource *src, struct pipe_subresource subsrc,
-                 unsigned srcx, unsigned srcy, unsigned srcz,
-                 unsigned width, unsigned height)
+                 struct pipe_resource *src, unsigned src_level,
+                 const struct pipe_box *src_box)
 {
        struct nv50_context *nv50 = nv50_context(pipe);
        struct nv50_screen *screen = nv50->screen;
-       struct pipe_surface *ps_dst, *ps_src;
+       struct pipe_surface *ps_dst, *ps_src, surf_tmpl;
+
 
        assert((src->format == dest->format) ||
               (nv50_2d_format_faithful(src->format) &&
                nv50_2d_format_faithful(dest->format)));
-
-       ps_src = nv50_miptree_surface_new(pipe->screen, src, subsrc.face,
-                                         subsrc.level, srcz, 0 /* bind flags */);
-       ps_dst = nv50_miptree_surface_new(pipe->screen, dest, subdst.face,
-                                         subdst.level, destz, 0 /* bindflags */);
-
-       nv50_surface_do_copy(screen, ps_dst, destx, desty, ps_src, srcx,
-                            srcy, width, height);
-
-       nv50_miptree_surface_del(ps_src);
-       nv50_miptree_surface_del(ps_dst);
+       assert(src_box->depth == 1);
+
+       memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+       surf_tmpl.format = src->format;
+       surf_tmpl.usage = 0; /* no bind flag - not a surface */
+       surf_tmpl.u.tex.level = src_level;
+       surf_tmpl.u.tex.first_layer = src_box->z;
+       surf_tmpl.u.tex.last_layer = src_box->z;
+       /* XXX really need surfaces here? */
+       ps_src = nv50_miptree_surface_new(pipe, src, &surf_tmpl);
+       surf_tmpl.format = dest->format;
+       surf_tmpl.usage = 0; /* no bind flag - not a surface */
+       surf_tmpl.u.tex.level = dst_level;
+       surf_tmpl.u.tex.first_layer = destz;
+       surf_tmpl.u.tex.last_layer = destz;
+       ps_dst = nv50_miptree_surface_new(pipe, dest, &surf_tmpl);
+
+       nv50_surface_do_copy(screen, ps_dst, destx, desty, ps_src, src_box->x,
+                            src_box->y, src_box->width, src_box->height);
+
+       nv50_miptree_surface_del(pipe, ps_src);
+       nv50_miptree_surface_del(pipe, ps_dst);
 }
 
 static void
@@ -225,10 +236,10 @@ nv50_clear_render_target(struct pipe_context *pipe,
        BEGIN_RING(chan, tesla, NV50TCL_RT_CONTROL, 1);
        OUT_RING  (chan, 1);
        BEGIN_RING(chan, tesla, NV50TCL_RT_ADDRESS_HIGH(0), 5);
-       OUT_RELOCh(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
-       OUT_RELOCl(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCh(chan, bo, ((struct nv50_surface *)dst)->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCl(chan, bo, ((struct nv50_surface *)dst)->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        OUT_RING  (chan, nv50_format_table[dst->format].rt);
-       OUT_RING  (chan, mt->level[dst->level].tile_mode << 4);
+       OUT_RING  (chan, mt->level[dst->u.tex.level].tile_mode << 4);
        OUT_RING  (chan, 0);
        BEGIN_RING(chan, tesla, NV50TCL_RT_HORIZ(0), 2);
        OUT_RING  (chan, dst->width);
@@ -281,10 +292,10 @@ nv50_clear_depth_stencil(struct pipe_context *pipe,
                return;
 
        BEGIN_RING(chan, tesla, NV50TCL_ZETA_ADDRESS_HIGH, 5);
-       OUT_RELOCh(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
-       OUT_RELOCl(chan, bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCh(chan, bo, ((struct nv50_surface *)dst)->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCl(chan, bo, ((struct nv50_surface *)dst)->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
        OUT_RING  (chan, nv50_format_table[dst->format].rt);
-       OUT_RING  (chan, mt->level[dst->level].tile_mode << 4);
+       OUT_RING  (chan, mt->level[dst->u.tex.level].tile_mode << 4);
        OUT_RING  (chan, 0);
        BEGIN_RING(chan, tesla, NV50TCL_ZETA_ENABLE, 1);
        OUT_RING  (chan, 1);
index 658324ec5bebc1aba6c266c860b3b1971946e24b..9243f9edceda320bb2c3c448f625fe2aa073ac98 100644 (file)
@@ -106,7 +106,7 @@ nv50_tex_construct(struct nv50_sampler_view *view)
 
        tic[6] = 0x03000000;
 
-       tic[7] = (view->pipe.last_level << 4) | view->pipe.first_level;
+       tic[7] = (view->pipe.u.tex.last_level << 4) | view->pipe.u.tex.first_level;
 
        return TRUE;
 }
index 0cc2f4a837f0dcefa3cc36643b76519865636256..bf5af4ddc653cf580f4aa2546ab20d28688dc45b 100644 (file)
@@ -126,20 +126,23 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
 struct pipe_transfer *
 nv50_miptree_transfer_new(struct pipe_context *pcontext,
                          struct pipe_resource *pt,
-                         struct pipe_subresource sr,
+                         unsigned level,
                          unsigned usage,
                          const struct pipe_box *box)
 {
         struct pipe_screen *pscreen = pcontext->screen;
        struct nouveau_device *dev = nouveau_screen(pscreen)->device;
        struct nv50_miptree *mt = nv50_miptree(pt);
-       struct nv50_miptree_level *lvl = &mt->level[sr.level];
+       struct nv50_miptree_level *lvl = &mt->level[level];
        struct nv50_transfer *tx;
-       unsigned nx, ny, image = 0;
+       unsigned nx, ny, image = 0, boxz = 0;
        int ret;
 
+       /* XXX can't unify these here? */
        if (pt->target == PIPE_TEXTURE_CUBE)
-               image = sr.face;
+               image = box->z;
+       else if (pt->target == PIPE_TEXTURE_3D)
+               boxz = box->z;
 
        tx = CALLOC_STRUCT(nv50_transfer);
        if (!tx)
@@ -151,21 +154,21 @@ nv50_miptree_transfer_new(struct pipe_context *pcontext,
 
 
        pipe_resource_reference(&tx->base.resource, pt);
-       tx->base.sr = sr;
+       tx->base.level = level;
        tx->base.usage = usage;
        tx->base.box = *box;
-       tx->nblocksx = util_format_get_nblocksx(pt->format, u_minify(pt->width0, sr.level));
-       tx->nblocksy = util_format_get_nblocksy(pt->format, u_minify(pt->height0, sr.level));
+       tx->nblocksx = util_format_get_nblocksx(pt->format, u_minify(pt->width0, level));
+       tx->nblocksy = util_format_get_nblocksy(pt->format, u_minify(pt->height0, level));
        tx->base.stride = tx->nblocksx * util_format_get_blocksize(pt->format);
        tx->base.usage = usage;
 
        tx->level_pitch = lvl->pitch;
-       tx->level_width = u_minify(mt->base.base.width0, sr.level);
-       tx->level_height = u_minify(mt->base.base.height0, sr.level);
-       tx->level_depth = u_minify(mt->base.base.depth0, sr.level);
+       tx->level_width = u_minify(mt->base.base.width0, level);
+       tx->level_height = u_minify(mt->base.base.height0, level);
+       tx->level_depth = u_minify(mt->base.base.depth0, level);
        tx->level_offset = lvl->image_offset[image];
        tx->level_tiling = lvl->tile_mode;
-       tx->level_z = box->z;
+       tx->level_z = boxz;
        tx->level_x = util_format_get_nblocksx(pt->format, box->x);
        tx->level_y = util_format_get_nblocksy(pt->format, box->y);
        ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0,
@@ -181,7 +184,7 @@ nv50_miptree_transfer_new(struct pipe_context *pcontext,
 
                nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset,
                                        tx->level_pitch, tx->level_tiling,
-                                       box->x, box->y, box->z,
+                                       box->x, box->y, boxz,
                                        tx->nblocksx, tx->nblocksy,
                                        tx->level_depth,
                                        tx->bo, 0,
index 663503547cb6b12bfe9023a6eb1708827c43155b..6699bf546eabff47a1be5c5c7ead934eb8fcab1b 100644 (file)
@@ -8,7 +8,7 @@
 struct pipe_transfer *
 nv50_miptree_transfer_new(struct pipe_context *pcontext,
                          struct pipe_resource *pt,
-                         struct pipe_subresource sr,
+                         unsigned level,
                          unsigned usage,
                          const struct pipe_box *box);
 void
index d41a59d05dbd10e1aa9e689c3ec35664ada40385..53f319acf468b8e6cda64f75f2a53a782ee3f404 100644 (file)
@@ -284,7 +284,7 @@ nv50_draw_elements_inline(struct pipe_context *pipe,
                nzi = TRUE;
        }
 
-       pipe_buffer_unmap(pipe, indexBuffer, transfer);
+       pipe_buffer_unmap(pipe, transfer);
 }
 
 static void
diff --git a/src/gallium/drivers/nvc0/Makefile b/src/gallium/drivers/nvc0/Makefile
new file mode 100644 (file)
index 0000000..da8f9a2
--- /dev/null
@@ -0,0 +1,34 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = nvc0
+
+C_SOURCES = \
+       nvc0_buffer.c \
+       nvc0_context.c \
+       nvc0_draw.c \
+       nvc0_formats.c \
+       nvc0_miptree.c \
+       nvc0_resource.c \
+       nvc0_screen.c \
+       nvc0_state.c \
+       nvc0_state_validate.c \
+       nvc0_surface.c \
+       nvc0_tex.c \
+       nvc0_transfer.c \
+       nvc0_vbo.c \
+       nvc0_program.c \
+       nvc0_shader_state.c \
+       nvc0_pc.c \
+       nvc0_pc_print.c \
+       nvc0_pc_emit.c \
+       nvc0_tgsi_to_nc.c \
+       nvc0_pc_optimize.c \
+       nvc0_pc_regalloc.c \
+       nvc0_push.c \
+       nvc0_push2.c \
+       nvc0_fence.c \
+       nvc0_mm.c \
+       nvc0_query.c
+
+include ../../Makefile.template
diff --git a/src/gallium/drivers/nvc0/SConscript b/src/gallium/drivers/nvc0/SConscript
new file mode 100644 (file)
index 0000000..c49e0dd
--- /dev/null
@@ -0,0 +1,36 @@
+Import('*')
+
+env = env.Clone()
+
+nvc0 = env.ConvenienceLibrary(
+    target = 'nvc0',
+    source = [
+        'nvc0_buffer.c',
+        'nvc0_context.c',
+        'nvc0_draw.c',
+        'nvc0_formats.c',
+        'nvc0_miptree.c',
+        'nvc0_resource.c',
+        'nvc0_screen.c',
+        'nvc0_state.c',
+        'nvc0_state_validate.c',
+        'nvc0_surface.c',
+        'nvc0_tex.c',
+        'nvc0_transfer.c',
+        'nvc0_vbo.c',
+        'nvc0_program.c',
+        'nvc0_shader_state.c',
+        'nvc0_pc.c',
+        'nvc0_pc_print.c',
+        'nvc0_pc_emit.c',
+        'nvc0_tgsi_to_nc.c',
+        'nvc0_pc_optimize.c',
+        'nvc0_pc_regalloc.c',
+        'nvc0_push.c',
+        'nvc0_push2.c',
+        'nvc0_fence.c',
+        'nvc0_mm.c',
+        'nvc0_query.c'
+    ])
+
+Export('nvc0')
diff --git a/src/gallium/drivers/nvc0/nv50_defs.xml.h b/src/gallium/drivers/nvc0/nv50_defs.xml.h
new file mode 100644 (file)
index 0000000..1bf2f80
--- /dev/null
@@ -0,0 +1,142 @@
+#ifndef NV50_DEFS_XML
+#define NV50_DEFS_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv50_defs.xml (   4482 bytes, from 2010-10-03 13:18:37)
+- copyright.xml (   6498 bytes, from 2010-10-03 13:18:37)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin KoÅ›cielnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+#define NV50_SURFACE_FORMAT_R32G32B32A32_FLOAT                 0x000000c0
+#define NV50_SURFACE_FORMAT_R32G32B32A32_SINT                  0x000000c1
+#define NV50_SURFACE_FORMAT_R32G32B32A32_UINT                  0x000000c2
+#define NV50_SURFACE_FORMAT_R32G32B32X32_FLOAT                 0x000000c3
+#define NV50_SURFACE_FORMAT_R16G16B16A16_UNORM                 0x000000c6
+#define NV50_SURFACE_FORMAT_R16G16B16A16_SNORM                 0x000000c7
+#define NV50_SURFACE_FORMAT_R16G16B16A16_SINT                  0x000000c8
+#define NV50_SURFACE_FORMAT_R16G16B16A16_UINT                  0x000000c9
+#define NV50_SURFACE_FORMAT_R16G16B16A16_FLOAT                 0x000000ca
+#define NV50_SURFACE_FORMAT_R32G32_FLOAT                       0x000000cb
+#define NV50_SURFACE_FORMAT_R32G32_SINT                                0x000000cc
+#define NV50_SURFACE_FORMAT_R32G32_UINT                                0x000000cd
+#define NV50_SURFACE_FORMAT_R16G16B16X16_FLOAT                 0x000000ce
+#define NV50_SURFACE_FORMAT_A8R8G8B8_UNORM                     0x000000cf
+#define NV50_SURFACE_FORMAT_A8R8G8B8_SRGB                      0x000000d0
+#define NV50_SURFACE_FORMAT_A2B10G10R10_UNORM                  0x000000d1
+#define NV50_SURFACE_FORMAT_A2B10G10R10_UINT                   0x000000d2
+#define NV50_SURFACE_FORMAT_A8B8G8R8_UNORM                     0x000000d5
+#define NV50_SURFACE_FORMAT_A8B8G8R8_SRGB                      0x000000d6
+#define NV50_SURFACE_FORMAT_A8B8G8R8_SNORM                     0x000000d7
+#define NV50_SURFACE_FORMAT_A8B8G8R8_SINT                      0x000000d8
+#define NV50_SURFACE_FORMAT_A8B8G8R8_UINT                      0x000000d9
+#define NV50_SURFACE_FORMAT_R16G16_UNORM                       0x000000da
+#define NV50_SURFACE_FORMAT_R16G16_SNORM                       0x000000db
+#define NV50_SURFACE_FORMAT_R16G16_SINT                                0x000000dc
+#define NV50_SURFACE_FORMAT_R16G16_UINT                                0x000000dd
+#define NV50_SURFACE_FORMAT_R16G16_FLOAT                       0x000000de
+#define NV50_SURFACE_FORMAT_A2R10G10B10_UNORM                  0x000000df
+#define NV50_SURFACE_FORMAT_B10G11R11_FLOAT                    0x000000e0
+#define NV50_SURFACE_FORMAT_R32_FLOAT                          0x000000e5
+#define NV50_SURFACE_FORMAT_X8R8G8B8_UNORM                     0x000000e6
+#define NV50_SURFACE_FORMAT_X8R8G8B8_SRGB                      0x000000e7
+#define NV50_SURFACE_FORMAT_R5G6B5_UNORM                       0x000000e8
+#define NV50_SURFACE_FORMAT_A1R5G5B5_UNORM                     0x000000e9
+#define NV50_SURFACE_FORMAT_R8G8_UNORM                         0x000000ea
+#define NV50_SURFACE_FORMAT_R8G8_SNORM                         0x000000eb
+#define NV50_SURFACE_FORMAT_R8G8_SINT                          0x000000ec
+#define NV50_SURFACE_FORMAT_R8G8_UINT                          0x000000ed
+#define NV50_SURFACE_FORMAT_R16_UNORM                          0x000000ee
+#define NV50_SURFACE_FORMAT_R16_SNORM                          0x000000ef
+#define NV50_SURFACE_FORMAT_R16_SINT                           0x000000f0
+#define NV50_SURFACE_FORMAT_R16_UINT                           0x000000f1
+#define NV50_SURFACE_FORMAT_R16_FLOAT                          0x000000f2
+#define NV50_SURFACE_FORMAT_R8_UNORM                           0x000000f3
+#define NV50_SURFACE_FORMAT_R8_SNORM                           0x000000f4
+#define NV50_SURFACE_FORMAT_R8_SINT                            0x000000f5
+#define NV50_SURFACE_FORMAT_R8_UINT                            0x000000f6
+#define NV50_SURFACE_FORMAT_A8_UNORM                           0x000000f7
+#define NV50_SURFACE_FORMAT_X1R5G5B5_UNORM                     0x000000f8
+#define NV50_SURFACE_FORMAT_X8B8G8R8_UNORM                     0x000000f9
+#define NV50_SURFACE_FORMAT_X8B8G8R8_SRGB                      0x000000fa
+#define NV50_ZETA_FORMAT_Z32_FLOAT                             0x0000000a
+#define NV50_ZETA_FORMAT_Z16_UNORM                             0x00000013
+#define NV50_ZETA_FORMAT_Z24S8_UNORM                           0x00000014
+#define NV50_ZETA_FORMAT_X8Z24_UNORM                           0x00000015
+#define NV50_ZETA_FORMAT_S8Z24_UNORM                           0x00000016
+#define NV50_ZETA_FORMAT_UNK18                                 0x00000018
+#define NV50_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM                 0x00000019
+#define NV50_ZETA_FORMAT_UNK1D                                 0x0000001d
+#define NV50_ZETA_FORMAT_UNK1E                                 0x0000001e
+#define NV50_ZETA_FORMAT_UNK1F                                 0x0000001f
+#define NV50_QUERY__SIZE                                       0x00000010
+#define NV50_QUERY_COUNTER                                     0x00000000
+
+#define NV50_QUERY_RES                                         0x00000004
+
+#define NV50_QUERY_TIME                                                0x00000008
+
+
+#endif /* NV50_DEFS_XML */
diff --git a/src/gallium/drivers/nvc0/nv50_texture.xml.h b/src/gallium/drivers/nvc0/nv50_texture.xml.h
new file mode 100644 (file)
index 0000000..9f83206
--- /dev/null
@@ -0,0 +1,259 @@
+#ifndef NV50_TEXTURE_XML
+#define NV50_TEXTURE_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv50_texture.xml (   6871 bytes, from 2010-10-03 13:18:37)
+- copyright.xml    (   6498 bytes, from 2010-10-03 13:18:37)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin KoÅ›cielnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+#define NV50_TIC_MAP_ZERO                                      0x00000000
+#define NV50_TIC_MAP_C0                                                0x00000002
+#define NV50_TIC_MAP_C1                                                0x00000003
+#define NV50_TIC_MAP_C2                                                0x00000004
+#define NV50_TIC_MAP_C3                                                0x00000005
+#define NV50_TIC_MAP_ONE                                       0x00000007
+#define NV50_TIC_TYPE_SNORM                                    0x00000001
+#define NV50_TIC_TYPE_UNORM                                    0x00000002
+#define NV50_TIC_TYPE_SINT                                     0x00000003
+#define NV50_TIC_TYPE_UINT                                     0x00000004
+#define NV50_TIC_TYPE_SSCALED                                  0x00000005
+#define NV50_TIC_TYPE_USCALED                                  0x00000006
+#define NV50_TIC_TYPE_FLOAT                                    0x00000007
+#define NV50_TSC_WRAP_REPEAT                                   0x00000000
+#define NV50_TSC_WRAP_MIRROR_REPEAT                            0x00000001
+#define NV50_TSC_WRAP_CLAMP_TO_EDGE                            0x00000002
+#define NV50_TSC_WRAP_CLAMP_TO_BORDER                          0x00000003
+#define NV50_TSC_WRAP_CLAMP                                    0x00000004
+#define NV50_TSC_WRAP_MIRROR_CLAMP_TO_EDGE                     0x00000005
+#define NV50_TSC_WRAP_MIRROR_CLAMP_TO_BORDER                   0x00000006
+#define NV50_TSC_WRAP_MIRROR_CLAMP                             0x00000007
+#define NV50_TIC__SIZE                                         0x00000020
+#define NV50_TIC_0                                             0x00000000
+#define NV50_TIC_0_MAPA__MASK                                  0x38000000
+#define NV50_TIC_0_MAPA__SHIFT                                 27
+#define NV50_TIC_0_MAPB__MASK                                  0x07000000
+#define NV50_TIC_0_MAPB__SHIFT                                 24
+#define NV50_TIC_0_MAPG__MASK                                  0x00e00000
+#define NV50_TIC_0_MAPG__SHIFT                                 21
+#define NV50_TIC_0_MAPR__MASK                                  0x001c0000
+#define NV50_TIC_0_MAPR__SHIFT                                 18
+#define NV50_TIC_0_TYPE3__MASK                                 0x00038000
+#define NV50_TIC_0_TYPE3__SHIFT                                        15
+#define NV50_TIC_0_TYPE2__MASK                                 0x00007000
+#define NV50_TIC_0_TYPE2__SHIFT                                        12
+#define NV50_TIC_0_TYPE1__MASK                                 0x00000e00
+#define NV50_TIC_0_TYPE1__SHIFT                                        9
+#define NV50_TIC_0_TYPE0__MASK                                 0x000001c0
+#define NV50_TIC_0_TYPE0__SHIFT                                        6
+#define NV50_TIC_0_SWIZZLE__MASK                               0x3ffc0000
+#define NV50_TIC_0_FMT__MASK                                   0x0000003f
+#define NV50_TIC_0_FMT__SHIFT                                  0
+#define NV50_TIC_0_FMT_32_32_32_32                             0x00000001
+#define NV50_TIC_0_FMT_16_16_16_16                             0x00000003
+#define NV50_TIC_0_FMT_32_32                                   0x00000004
+#define NV50_TIC_0_FMT_32_8                                    0x00000005
+#define NV50_TIC_0_FMT_8_8_8_8                                 0x00000008
+#define NV50_TIC_0_FMT_2_10_10_10                              0x00000009
+#define NV50_TIC_0_FMT_16_16                                   0x0000000c
+#define NV50_TIC_0_FMT_8_24                                    0x0000000d
+#define NV50_TIC_0_FMT_24_8                                    0x0000000e
+#define NV50_TIC_0_FMT_32                                      0x0000000f
+#define NV50_TIC_0_FMT_4_4_4_4                                 0x00000012
+#define NV50_TIC_0_FMT_5_5_5_1                                 0x00000013
+#define NV50_TIC_0_FMT_1_5_5_5                                 0x00000014
+#define NV50_TIC_0_FMT_5_6_5                                   0x00000015
+#define NV50_TIC_0_FMT_6_5_5                                   0x00000016
+#define NV50_TIC_0_FMT_8_8                                     0x00000018
+#define NV50_TIC_0_FMT_16                                      0x0000001b
+#define NV50_TIC_0_FMT_8                                       0x0000001d
+#define NV50_TIC_0_FMT_4_4                                     0x0000001e
+#define NV50_TIC_0_FMT_UNK1F                                   0x0000001f
+#define NV50_TIC_0_FMT_E5_9_9_9                                        0x00000020
+#define NV50_TIC_0_FMT_10_11_11                                        0x00000021
+#define NV50_TIC_0_FMT_C1_C2_C1_C0                             0x00000022
+#define NV50_TIC_0_FMT_C2_C1_C0_C1                             0x00000023
+#define NV50_TIC_0_FMT_DXT1                                    0x00000024
+#define NV50_TIC_0_FMT_DXT3                                    0x00000025
+#define NV50_TIC_0_FMT_DXT5                                    0x00000026
+#define NV50_TIC_0_FMT_RGTC1                                   0x00000027
+#define NV50_TIC_0_FMT_RGTC2                                   0x00000028
+#define NV50_TIC_0_FMT_24_8_ZETA                               0x00000029
+#define NV50_TIC_0_FMT_8_24_ZETA                               0x0000002a
+#define NV50_TIC_0_FMT_UNK2C_ZETA                              0x0000002c
+#define NV50_TIC_0_FMT_UNK2D_ZETA                              0x0000002d
+#define NV50_TIC_0_FMT_UNK2E_ZETA                              0x0000002e
+#define NV50_TIC_0_FMT_32_ZETA                                 0x0000002f
+#define NV50_TIC_0_FMT_32_8_ZETA                               0x00000030
+#define NV50_TIC_0_FMT_16_ZETA                         0x0000003a
+
+#define NV50_TIC_1                                             0x00000004
+#define NV50_TIC_1_OFFSET_LOW__MASK                            0xffffffff
+#define NV50_TIC_1_OFFSET_LOW__SHIFT                           0
+
+#define NV50_TIC_2                                             0x00000008
+#define NV50_TIC_2_OFFSET_HIGH__MASK                           0x000000ff
+#define NV50_TIC_2_OFFSET_HIGH__SHIFT                          0
+#define NV50_TIC_2_COLORSPACE_SRGB                             0x00000400
+#define NV50_TIC_2_TARGET__MASK                                        0x0003c000
+#define NV50_TIC_2_TARGET__SHIFT                               14
+#define NV50_TIC_2_TARGET_1D                                   0x00000000
+#define NV50_TIC_2_TARGET_2D                                   0x00004000
+#define NV50_TIC_2_TARGET_3D                                   0x00008000
+#define NV50_TIC_2_TARGET_CUBE                                 0x0000c000
+#define NV50_TIC_2_TARGET_1D_ARRAY                             0x00010000
+#define NV50_TIC_2_TARGET_2D_ARRAY                             0x00014000
+#define NV50_TIC_2_TARGET_BUFFER                               0x00018000
+#define NV50_TIC_2_TARGET_RECT                                 0x0001c000
+#define NV50_TIC_2_TARGET_CUBE_ARRAY                           0x00020000
+#define NV50_TIC_2_TILE_MODE_LINEAR                            0x00040000
+#define NV50_TIC_2_TILE_MODE_Y__MASK                           0x01c00000
+#define NV50_TIC_2_TILE_MODE_Y__SHIFT                          22
+#define NV50_TIC_2_TILE_MODE_Z__MASK                           0x0e000000
+#define NV50_TIC_2_TILE_MODE_Z__SHIFT                          25
+#define NV50_TIC_2_2D_UNK0258__MASK                            0x30000000
+#define NV50_TIC_2_2D_UNK0258__SHIFT                           28
+#define NV50_TIC_2_NORMALIZED_COORDS                           0x80000000
+
+#define NV50_TIC_3                                             0x0000000c
+#define NV50_TIC_3_PITCH__MASK                                 0xffffffff
+#define NV50_TIC_3_PITCH__SHIFT                                        0
+
+#define NV50_TIC_4                                             0x00000010
+#define NV50_TIC_4_WIDTH__MASK                                 0xffffffff
+#define NV50_TIC_4_WIDTH__SHIFT                                        0
+
+#define NV50_TIC_5                                             0x00000014
+#define NV50_TIC_5_LAST_LEVEL__MASK                            0xf0000000
+#define NV50_TIC_5_LAST_LEVEL__SHIFT                           28
+#define NV50_TIC_5_DEPTH__MASK                                 0x0fff0000
+#define NV50_TIC_5_DEPTH__SHIFT                                        16
+#define NV50_TIC_5_HEIGHT__MASK                                        0x0000ffff
+#define NV50_TIC_5_HEIGHT__SHIFT                               0
+
+#define NV50_TIC_7                                             0x0000001c
+#define NV50_TIC_7_BASE_LEVEL__MASK                            0x0000000f
+#define NV50_TIC_7_BASE_LEVEL__SHIFT                           0
+#define NV50_TIC_7_MAX_LEVEL__MASK                             0x000000f0
+#define NV50_TIC_7_MAX_LEVEL__SHIFT                            4
+
+#define NV50_TSC__SIZE                                         0x00000020
+#define NV50_TSC_0                                             0x00000000
+#define NV50_TSC_0_WRAPS__MASK                                 0x00000007
+#define NV50_TSC_0_WRAPS__SHIFT                                        0
+#define NV50_TSC_0_WRAPT__MASK                                 0x00000038
+#define NV50_TSC_0_WRAPT__SHIFT                                        3
+#define NV50_TSC_0_WRAPR__MASK                                 0x000001c0
+#define NV50_TSC_0_WRAPR__SHIFT                                        6
+#define NV50_TSC_0_SHADOW_COMPARE_ENABLE                       0x00000200
+#define NV50_TSC_0_SHADOW_COMPARE_FUNC__MASK                   0x00001c00
+#define NV50_TSC_0_SHADOW_COMPARE_FUNC__SHIFT                  10
+#define NV50_TSC_0_ANISOTROPY_MASK__MASK                       0x00700000
+#define NV50_TSC_0_ANISOTROPY_MASK__SHIFT                      20
+
+#define NV50_TSC_1                                             0x00000004
+#define NV50_TSC_1_UNKN_ANISO_15                               0x10000000
+#define NV50_TSC_1_UNKN_ANISO_35                               0x18000000
+#define NV50_TSC_1_MAGF__MASK                                  0x00000003
+#define NV50_TSC_1_MAGF__SHIFT                                 0
+#define NV50_TSC_1_MAGF_NEAREST                                        0x00000001
+#define NV50_TSC_1_MAGF_LINEAR                                 0x00000002
+#define NV50_TSC_1_MINF__MASK                                  0x00000030
+#define NV50_TSC_1_MINF__SHIFT                                 4
+#define NV50_TSC_1_MINF_NEAREST                                        0x00000010
+#define NV50_TSC_1_MINF_LINEAR                                 0x00000020
+#define NV50_TSC_1_MIPF__MASK                                  0x000000c0
+#define NV50_TSC_1_MIPF__SHIFT                                 6
+#define NV50_TSC_1_MIPF_NONE                                   0x00000040
+#define NV50_TSC_1_MIPF_NEAREST                                        0x00000080
+#define NV50_TSC_1_MIPF_LINEAR                                 0x000000c0
+#define NV50_TSC_1_LOD_BIAS__MASK                              0x01fff000
+#define NV50_TSC_1_LOD_BIAS__SHIFT                             12
+
+#define NV50_TSC_2                                             0x00000008
+#define NV50_TSC_2_MIN_LOD__MASK                               0x00000f00
+#define NV50_TSC_2_MIN_LOD__SHIFT                              8
+#define NV50_TSC_2_MAX_LOD__MASK                               0x00f00000
+#define NV50_TSC_2_MAX_LOD__SHIFT                              20
+
+#define NV50_TSC_4                                             0x00000010
+#define NV50_TSC_4_BORDER_COLOR_RED__MASK                      0xffffffff
+#define NV50_TSC_4_BORDER_COLOR_RED__SHIFT                     0
+
+#define NV50_TSC_5                                             0x00000014
+#define NV50_TSC_5_BORDER_COLOR_GREEN__MASK                    0xffffffff
+#define NV50_TSC_5_BORDER_COLOR_GREEN__SHIFT                   0
+
+#define NV50_TSC_6                                             0x00000018
+#define NV50_TSC_6_BORDER_COLOR_BLUE__MASK                     0xffffffff
+#define NV50_TSC_6_BORDER_COLOR_BLUE__SHIFT                    0
+
+#define NV50_TSC_7                                             0x0000001c
+#define NV50_TSC_7_BORDER_COLOR_ALPHA__MASK                    0xffffffff
+#define NV50_TSC_7_BORDER_COLOR_ALPHA__SHIFT                   0
+
+
+#endif /* NV50_TEXTURE_XML */
diff --git a/src/gallium/drivers/nvc0/nvc0_2d.xml.h b/src/gallium/drivers/nvc0/nvc0_2d.xml.h
new file mode 100644 (file)
index 0000000..aebcd51
--- /dev/null
@@ -0,0 +1,380 @@
+#ifndef NVC0_2D_XML
+#define NVC0_2D_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nvc0_2d.xml    (   9454 bytes, from 2010-10-16 16:03:11)
+- copyright.xml  (   6498 bytes, from 2010-10-03 13:18:37)
+- nv_object.xml  (  11379 bytes, from 2010-10-16 11:43:24)
+- nvchipsets.xml (   2907 bytes, from 2010-10-15 16:28:21)
+- nv_defs.xml    (   4437 bytes, from 2010-07-06 07:43:58)
+- nv50_defs.xml  (   4482 bytes, from 2010-10-03 13:18:37)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin KoÅ›cielnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NVC0_2D_DST_FORMAT                                     0x00000200
+
+#define NVC0_2D_DST_LINEAR                                     0x00000204
+
+#define NVC0_2D_DST_TILE_MODE                                  0x00000208
+
+#define NVC0_2D_DST_DEPTH                                      0x0000020c
+
+#define NVC0_2D_DST_LAYER                                      0x00000210
+
+#define NVC0_2D_DST_PITCH                                      0x00000214
+
+#define NVC0_2D_DST_WIDTH                                      0x00000218
+
+#define NVC0_2D_DST_HEIGHT                                     0x0000021c
+
+#define NVC0_2D_DST_ADDRESS_HIGH                               0x00000220
+
+#define NVC0_2D_DST_ADDRESS_LOW                                        0x00000224
+
+#define NVC0_2D_UNK228                                         0x00000228
+
+#define NVC0_2D_SRC_FORMAT                                     0x00000230
+
+#define NVC0_2D_SRC_LINEAR                                     0x00000234
+
+#define NVC0_2D_SRC_TILE_MODE                                  0x00000238
+
+#define NVC0_2D_SRC_DEPTH                                      0x0000023c
+
+#define NVC0_2D_SRC_LAYER                                      0x00000240
+
+#define NVC0_2D_SRC_PITCH                                      0x00000244
+#define NVC0_2D_SRC_PITCH__MAX                                 0x00040000
+
+#define NVC0_2D_SRC_WIDTH                                      0x00000248
+#define NVC0_2D_SRC_WIDTH__MAX                                 0x00010000
+
+#define NVC0_2D_SRC_HEIGHT                                     0x0000024c
+#define NVC0_2D_SRC_HEIGHT__MAX                                        0x00010000
+
+#define NVC0_2D_SRC_ADDRESS_HIGH                               0x00000250
+
+#define NVC0_2D_SRC_ADDRESS_LOW                                        0x00000254
+
+#define NVC0_2D_UNK258                                         0x00000258
+
+#define NVC0_2D_UNK260                                         0x00000260
+
+#define NVC0_2D_COND_ADDRESS_HIGH                              0x00000264
+
+#define NVC0_2D_COND_ADDRESS_LOW                               0x00000268
+
+#define NVC0_2D_COND_MODE                                      0x0000026c
+#define NVC0_2D_COND_MODE_NEVER                                        0x00000000
+#define NVC0_2D_COND_MODE_ALWAYS                               0x00000001
+#define NVC0_2D_COND_MODE_RES_NON_ZERO                         0x00000002
+#define NVC0_2D_COND_MODE_EQUAL                                        0x00000003
+#define NVC0_2D_COND_MODE_NOT_EQUAL                            0x00000004
+
+#define NVC0_2D_CLIP_X                                         0x00000280
+
+#define NVC0_2D_CLIP_Y                                         0x00000284
+
+#define NVC0_2D_CLIP_W                                         0x00000288
+
+#define NVC0_2D_CLIP_H                                         0x0000028c
+
+#define NVC0_2D_CLIP_ENABLE                                    0x00000290
+
+#define NVC0_2D_COLOR_KEY_FORMAT                               0x00000294
+#define NVC0_2D_COLOR_KEY_FORMAT_16BPP                         0x00000000
+#define NVC0_2D_COLOR_KEY_FORMAT_15BPP                         0x00000001
+#define NVC0_2D_COLOR_KEY_FORMAT_24BPP                         0x00000002
+#define NVC0_2D_COLOR_KEY_FORMAT_30BPP                         0x00000003
+#define NVC0_2D_COLOR_KEY_FORMAT_8BPP                          0x00000004
+#define NVC0_2D_COLOR_KEY_FORMAT_16BPP2                                0x00000005
+#define NVC0_2D_COLOR_KEY_FORMAT_32BPP                         0x00000006
+
+#define NVC0_2D_COLOR_KEY                                      0x00000298
+
+#define NVC0_2D_COLOR_KEY_ENABLE                               0x0000029c
+
+#define NVC0_2D_ROP                                            0x000002a0
+
+#define NVC0_2D_BETA1                                          0x000002a4
+
+#define NVC0_2D_BETA4                                          0x000002a8
+
+#define NVC0_2D_OPERATION                                      0x000002ac
+#define NVC0_2D_OPERATION_SRCCOPY_AND                          0x00000000
+#define NVC0_2D_OPERATION_ROP_AND                              0x00000001
+#define NVC0_2D_OPERATION_BLEND_AND                            0x00000002
+#define NVC0_2D_OPERATION_SRCCOPY                              0x00000003
+#define NVC0_2D_OPERATION_UNK4                                 0x00000004
+#define NVC0_2D_OPERATION_SRCCOPY_PREMULT                      0x00000005
+#define NVC0_2D_OPERATION_BLEND_PREMULT                                0x00000006
+
+#define NVC0_2D_UNK2B0                                         0x000002b0
+#define NVC0_2D_UNK2B0_UNK0__MASK                              0x0000003f
+#define NVC0_2D_UNK2B0_UNK0__SHIFT                             0
+#define NVC0_2D_UNK2B0_UNK1__MASK                              0x00003f00
+#define NVC0_2D_UNK2B0_UNK1__SHIFT                             8
+
+#define NVC0_2D_PATTERN_SELECT                                 0x000002b4
+#define NVC0_2D_PATTERN_SELECT_MONO_8X8                                0x00000000
+#define NVC0_2D_PATTERN_SELECT_MONO_64X1                       0x00000001
+#define NVC0_2D_PATTERN_SELECT_MONO_1X64                       0x00000002
+#define NVC0_2D_PATTERN_SELECT_COLOR                           0x00000003
+
+#define NVC0_2D_PATTERN_COLOR_FORMAT                           0x000002e8
+#define NVC0_2D_PATTERN_COLOR_FORMAT_16BPP                     0x00000000
+#define NVC0_2D_PATTERN_COLOR_FORMAT_15BPP                     0x00000001
+#define NVC0_2D_PATTERN_COLOR_FORMAT_32BPP                     0x00000002
+#define NVC0_2D_PATTERN_COLOR_FORMAT_8BPP                      0x00000003
+#define NVC0_2D_PATTERN_COLOR_FORMAT_UNK4                      0x00000004
+#define NVC0_2D_PATTERN_COLOR_FORMAT_UNK5                      0x00000005
+
+#define NVC0_2D_PATTERN_MONO_FORMAT                            0x000002ec
+#define NVC0_2D_PATTERN_MONO_FORMAT_CGA6                       0x00000000
+#define NVC0_2D_PATTERN_MONO_FORMAT_LE                         0x00000001
+
+#define NVC0_2D_PATTERN_COLOR(i0)                             (0x000002f0 + 0x4*(i0))
+#define NVC0_2D_PATTERN_COLOR__ESIZE                           0x00000004
+#define NVC0_2D_PATTERN_COLOR__LEN                             0x00000002
+
+#define NVC0_2D_PATTERN_BITMAP(i0)                            (0x000002f8 + 0x4*(i0))
+#define NVC0_2D_PATTERN_BITMAP__ESIZE                          0x00000004
+#define NVC0_2D_PATTERN_BITMAP__LEN                            0x00000002
+
+#define NVC0_2D_PATTERN_X8R8G8B8(i0)                          (0x00000300 + 0x4*(i0))
+#define NVC0_2D_PATTERN_X8R8G8B8__ESIZE                                0x00000004
+#define NVC0_2D_PATTERN_X8R8G8B8__LEN                          0x00000040
+#define NVC0_2D_PATTERN_X8R8G8B8_B__MASK                       0x000000ff
+#define NVC0_2D_PATTERN_X8R8G8B8_B__SHIFT                      0
+#define NVC0_2D_PATTERN_X8R8G8B8_G__MASK                       0x0000ff00
+#define NVC0_2D_PATTERN_X8R8G8B8_G__SHIFT                      8
+#define NVC0_2D_PATTERN_X8R8G8B8_R__MASK                       0x00ff0000
+#define NVC0_2D_PATTERN_X8R8G8B8_R__SHIFT                      16
+
+#define NVC0_2D_PATTERN_R5G6B5(i0)                            (0x00000400 + 0x4*(i0))
+#define NVC0_2D_PATTERN_R5G6B5__ESIZE                          0x00000004
+#define NVC0_2D_PATTERN_R5G6B5__LEN                            0x00000020
+#define NVC0_2D_PATTERN_R5G6B5_B0__MASK                                0x0000001f
+#define NVC0_2D_PATTERN_R5G6B5_B0__SHIFT                       0
+#define NVC0_2D_PATTERN_R5G6B5_G0__MASK                                0x000007e0
+#define NVC0_2D_PATTERN_R5G6B5_G0__SHIFT                       5
+#define NVC0_2D_PATTERN_R5G6B5_R0__MASK                                0x0000f800
+#define NVC0_2D_PATTERN_R5G6B5_R0__SHIFT                       11
+#define NVC0_2D_PATTERN_R5G6B5_B1__MASK                                0x001f0000
+#define NVC0_2D_PATTERN_R5G6B5_B1__SHIFT                       16
+#define NVC0_2D_PATTERN_R5G6B5_G1__MASK                                0x07e00000
+#define NVC0_2D_PATTERN_R5G6B5_G1__SHIFT                       21
+#define NVC0_2D_PATTERN_R5G6B5_R1__MASK                                0xf8000000
+#define NVC0_2D_PATTERN_R5G6B5_R1__SHIFT                       27
+
+#define NVC0_2D_PATTERN_X1R5G5B5(i0)                          (0x00000480 + 0x4*(i0))
+#define NVC0_2D_PATTERN_X1R5G5B5__ESIZE                                0x00000004
+#define NVC0_2D_PATTERN_X1R5G5B5__LEN                          0x00000020
+#define NVC0_2D_PATTERN_X1R5G5B5_B0__MASK                      0x0000001f
+#define NVC0_2D_PATTERN_X1R5G5B5_B0__SHIFT                     0
+#define NVC0_2D_PATTERN_X1R5G5B5_G0__MASK                      0x000003e0
+#define NVC0_2D_PATTERN_X1R5G5B5_G0__SHIFT                     5
+#define NVC0_2D_PATTERN_X1R5G5B5_R0__MASK                      0x00007c00
+#define NVC0_2D_PATTERN_X1R5G5B5_R0__SHIFT                     10
+#define NVC0_2D_PATTERN_X1R5G5B5_B1__MASK                      0x001f0000
+#define NVC0_2D_PATTERN_X1R5G5B5_B1__SHIFT                     16
+#define NVC0_2D_PATTERN_X1R5G5B5_G1__MASK                      0x03e00000
+#define NVC0_2D_PATTERN_X1R5G5B5_G1__SHIFT                     21
+#define NVC0_2D_PATTERN_X1R5G5B5_R1__MASK                      0x7c000000
+#define NVC0_2D_PATTERN_X1R5G5B5_R1__SHIFT                     26
+
+#define NVC0_2D_PATTERN_Y8(i0)                                (0x00000500 + 0x4*(i0))
+#define NVC0_2D_PATTERN_Y8__ESIZE                              0x00000004
+#define NVC0_2D_PATTERN_Y8__LEN                                        0x00000010
+#define NVC0_2D_PATTERN_Y8_Y0__MASK                            0x000000ff
+#define NVC0_2D_PATTERN_Y8_Y0__SHIFT                           0
+#define NVC0_2D_PATTERN_Y8_Y1__MASK                            0x0000ff00
+#define NVC0_2D_PATTERN_Y8_Y1__SHIFT                           8
+#define NVC0_2D_PATTERN_Y8_Y2__MASK                            0x00ff0000
+#define NVC0_2D_PATTERN_Y8_Y2__SHIFT                           16
+#define NVC0_2D_PATTERN_Y8_Y3__MASK                            0xff000000
+#define NVC0_2D_PATTERN_Y8_Y3__SHIFT                           24
+
+#define NVC0_2D_DRAW_SHAPE                                     0x00000580
+#define NVC0_2D_DRAW_SHAPE_POINTS                              0x00000000
+#define NVC0_2D_DRAW_SHAPE_LINES                               0x00000001
+#define NVC0_2D_DRAW_SHAPE_LINE_STRIP                          0x00000002
+#define NVC0_2D_DRAW_SHAPE_TRIANGLES                           0x00000003
+#define NVC0_2D_DRAW_SHAPE_RECTANGLES                          0x00000004
+
+#define NVC0_2D_DRAW_COLOR_FORMAT                              0x00000584
+
+#define NVC0_2D_DRAW_COLOR                                     0x00000588
+
+#define NVC0_2D_UNK58C                                         0x0000058c
+#define NVC0_2D_UNK58C_0                                       0x00000001
+#define NVC0_2D_UNK58C_1                                       0x00000010
+#define NVC0_2D_UNK58C_2                                       0x00000100
+#define NVC0_2D_UNK58C_3                                       0x00001000
+
+#define NVC0_2D_DRAW_POINT16                                   0x000005e0
+#define NVC0_2D_DRAW_POINT16_X__MASK                           0x0000ffff
+#define NVC0_2D_DRAW_POINT16_X__SHIFT                          0
+#define NVC0_2D_DRAW_POINT16_Y__MASK                           0xffff0000
+#define NVC0_2D_DRAW_POINT16_Y__SHIFT                          16
+
+#define NVC0_2D_DRAW_POINT32_X(i0)                            (0x00000600 + 0x8*(i0))
+#define NVC0_2D_DRAW_POINT32_X__ESIZE                          0x00000008
+#define NVC0_2D_DRAW_POINT32_X__LEN                            0x00000040
+
+#define NVC0_2D_DRAW_POINT32_Y(i0)                            (0x00000604 + 0x8*(i0))
+#define NVC0_2D_DRAW_POINT32_Y__ESIZE                          0x00000008
+#define NVC0_2D_DRAW_POINT32_Y__LEN                            0x00000040
+
+#define NVC0_2D_SIFC_BITMAP_ENABLE                             0x00000800
+
+#define NVC0_2D_SIFC_FORMAT                                    0x00000804
+
+#define NVC0_2D_SIFC_BITMAP_FORMAT                             0x00000808
+#define NVC0_2D_SIFC_BITMAP_FORMAT_I1                          0x00000000
+#define NVC0_2D_SIFC_BITMAP_FORMAT_I4                          0x00000001
+#define NVC0_2D_SIFC_BITMAP_FORMAT_I8                          0x00000002
+
+#define NVC0_2D_SIFC_BITMAP_LSB_FIRST                          0x0000080c
+
+#define NVC0_2D_SIFC_BITMAP_LINE_PACK_MODE                     0x00000810
+#define NVC0_2D_SIFC_BITMAP_LINE_PACK_MODE_PACKED              0x00000000
+#define NVC0_2D_SIFC_BITMAP_LINE_PACK_MODE_ALIGN_BYTE          0x00000001
+#define NVC0_2D_SIFC_BITMAP_LINE_PACK_MODE_ALIGN_WORD          0x00000002
+
+#define NVC0_2D_SIFC_BITMAP_COLOR_BIT0                         0x00000814
+
+#define NVC0_2D_SIFC_BITMAP_COLOR_BIT1                         0x00000818
+
+#define NVC0_2D_SIFC_BITMAP_WRITE_BIT0_ENABLE                  0x0000081c
+
+#define NVC0_2D_SIFC_WIDTH                                     0x00000838
+
+#define NVC0_2D_SIFC_HEIGHT                                    0x0000083c
+
+#define NVC0_2D_SIFC_DX_DU_FRACT                               0x00000840
+
+#define NVC0_2D_SIFC_DX_DU_INT                                 0x00000844
+
+#define NVC0_2D_SIFC_DY_DV_FRACT                               0x00000848
+
+#define NVC0_2D_SIFC_DY_DV_INT                                 0x0000084c
+
+#define NVC0_2D_SIFC_DST_X_FRACT                               0x00000850
+
+#define NVC0_2D_SIFC_DST_X_INT                                 0x00000854
+
+#define NVC0_2D_SIFC_DST_Y_FRACT                               0x00000858
+
+#define NVC0_2D_SIFC_DST_Y_INT                                 0x0000085c
+
+#define NVC0_2D_SIFC_DATA                                      0x00000860
+
+#define NVC0_2D_UNK0870                                                0x00000870
+
+#define NVC0_2D_UNK0880                                                0x00000880
+
+#define NVC0_2D_UNK0884                                                0x00000884
+
+#define NVC0_2D_UNK0888                                                0x00000888
+
+#define NVC0_2D_BLIT_CONTROL                                   0x0000088c
+#define NVC0_2D_BLIT_CONTROL_ORIGIN__MASK                      0x00000001
+#define NVC0_2D_BLIT_CONTROL_ORIGIN__SHIFT                     0
+#define NVC0_2D_BLIT_CONTROL_ORIGIN_CENTER                     0x00000000
+#define NVC0_2D_BLIT_CONTROL_ORIGIN_CORNER                     0x00000001
+#define NVC0_2D_BLIT_CONTROL_FILTER__MASK                      0x00000010
+#define NVC0_2D_BLIT_CONTROL_FILTER__SHIFT                     4
+#define NVC0_2D_BLIT_CONTROL_FILTER_POINT_SAMPLE               0x00000000
+#define NVC0_2D_BLIT_CONTROL_FILTER_BILINEAR                   0x00000010
+
+#define NVC0_2D_BLIT_DST_X                                     0x000008b0
+
+#define NVC0_2D_BLIT_DST_Y                                     0x000008b4
+
+#define NVC0_2D_BLIT_DST_W                                     0x000008b8
+
+#define NVC0_2D_BLIT_DST_H                                     0x000008bc
+
+#define NVC0_2D_BLIT_DU_DX_FRACT                               0x000008c0
+
+#define NVC0_2D_BLIT_DU_DX_INT                                 0x000008c4
+
+#define NVC0_2D_BLIT_DV_DY_FRACT                               0x000008c8
+
+#define NVC0_2D_BLIT_DV_DY_INT                                 0x000008cc
+
+#define NVC0_2D_BLIT_SRC_X_FRACT                               0x000008d0
+
+#define NVC0_2D_BLIT_SRC_X_INT                                 0x000008d4
+
+#define NVC0_2D_BLIT_SRC_Y_FRACT                               0x000008d8
+
+#define NVC0_2D_BLIT_SRC_Y_INT                                 0x000008dc
+
+
+#endif /* NVC0_2D_XML */
diff --git a/src/gallium/drivers/nvc0/nvc0_3d.xml.h b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
new file mode 100644 (file)
index 0000000..3130294
--- /dev/null
@@ -0,0 +1,1182 @@
+#ifndef NVC0_3D_XML
+#define NVC0_3D_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nvc0_3d.xml    (  30827 bytes, from 2011-01-13 18:23:07)
+- copyright.xml  (   6452 bytes, from 2010-11-25 23:28:20)
+- nv_defs.xml    (   4437 bytes, from 2010-07-06 07:43:58)
+- nv_3ddefs.xml  (  16394 bytes, from 2010-12-17 15:10:40)
+- nv_object.xml  (  11898 bytes, from 2010-12-23 14:14:20)
+- nvchipsets.xml (   3074 bytes, from 2010-11-07 00:36:28)
+- nv50_defs.xml  (   4487 bytes, from 2010-12-10 00:37:17)
+
+Copyright (C) 2006-2011 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin KoÅ›cielnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NVC0_3D_NOTIFY_ADDRESS_HIGH                            0x00000104
+#define NVC0_3D_NOTIFY_ADDRESS_LOW                             0x00000108
+#define NVC0_3D_NOTIFY                                         0x0000010c
+
+#define NVC0_3D_SERIALIZE                                      0x00000110
+
+#define NVC0_3D_EARLY_FRAGMENT_TESTS                           0x00000210
+
+#define NVC0_3D_TESS_MODE                                      0x00000320
+#define NVC0_3D_TESS_MODE_PRIM__MASK                           0x0000000f
+#define NVC0_3D_TESS_MODE_PRIM__SHIFT                          0
+#define NVC0_3D_TESS_MODE_PRIM_ISOLINES                                0x00000000
+#define NVC0_3D_TESS_MODE_PRIM_TRIANGLES                       0x00000001
+#define NVC0_3D_TESS_MODE_PRIM_QUADS                           0x00000002
+#define NVC0_3D_TESS_MODE_SPACING__MASK                                0x000000f0
+#define NVC0_3D_TESS_MODE_SPACING__SHIFT                       4
+#define NVC0_3D_TESS_MODE_SPACING_EQUAL                                0x00000000
+#define NVC0_3D_TESS_MODE_SPACING_FRACTIONAL_ODD               0x00000010
+#define NVC0_3D_TESS_MODE_SPACING_FRACTIONAL_EVEN              0x00000020
+#define NVC0_3D_TESS_MODE_CW                                   0x00000100
+#define NVC0_3D_TESS_MODE_CONNECTED                            0x00000200
+
+#define NVC0_3D_TESS_LEVEL_OUTER(i0)                          (0x00000324 + 0x4*(i0))
+#define NVC0_3D_TESS_LEVEL_OUTER__ESIZE                                0x00000004
+#define NVC0_3D_TESS_LEVEL_OUTER__LEN                          0x00000004
+
+#define NVC0_3D_TESS_LEVEL_INNER(i0)                          (0x00000334 + 0x4*(i0))
+#define NVC0_3D_TESS_LEVEL_INNER__ESIZE                                0x00000004
+#define NVC0_3D_TESS_LEVEL_INNER__LEN                          0x00000002
+
+#define NVC0_3D_RASTERIZE_ENABLE                               0x0000037c
+
+#define NVC0_3D_TFB(i0)                                               (0x00000380 + 0x20*(i0))
+#define NVC0_3D_TFB__ESIZE                                     0x00000020
+#define NVC0_3D_TFB__LEN                                       0x00000004
+
+#define NVC0_3D_TFB_BUFFER_ENABLE(i0)                         (0x00000380 + 0x20*(i0))
+
+#define NVC0_3D_TFB_ADDRESS_HIGH(i0)                          (0x00000384 + 0x20*(i0))
+
+#define NVC0_3D_TFB_ADDRESS_LOW(i0)                           (0x00000388 + 0x20*(i0))
+
+#define NVC0_3D_TFB_BUFFER_SIZE(i0)                           (0x0000038c + 0x20*(i0))
+
+#define NVC0_3D_TFB_PRIMITIVE_ID(i0)                          (0x00000390 + 0x20*(i0))
+
+#define NVC0_3D_TFB_UNK0700(i0)                                       (0x00000700 + 0x10*(i0))
+
+#define NVC0_3D_TFB_VARYING_COUNT(i0)                         (0x00000704 + 0x10*(i0))
+
+#define NVC0_3D_TFB_BUFFER_STRIDE(i0)                         (0x00000708 + 0x10*(i0))
+
+#define NVC0_3D_TFB_ENABLE                                     0x00000744
+
+#define NVC0_3D_LOCAL_BASE                                     0x0000077c
+
+#define NVC0_3D_LOCAL_ADDRESS_HIGH                             0x00000790
+
+#define NVC0_3D_LOCAL_ADDRESS_LOW                              0x00000794
+
+#define NVC0_3D_LOCAL_SIZE_HIGH                                        0x00000798
+
+#define NVC0_3D_LOCAL_SIZE_LOW                                 0x0000079c
+
+#define NVC0_3D_RT(i0)                                        (0x00000800 + 0x20*(i0))
+#define NVC0_3D_RT__ESIZE                                      0x00000020
+#define NVC0_3D_RT__LEN                                                0x00000008
+
+#define NVC0_3D_RT_ADDRESS_HIGH(i0)                           (0x00000800 + 0x20*(i0))
+
+#define NVC0_3D_RT_ADDRESS_LOW(i0)                            (0x00000804 + 0x20*(i0))
+
+#define NVC0_3D_RT_HORIZ(i0)                                  (0x00000808 + 0x20*(i0))
+
+#define NVC0_3D_RT_VERT(i0)                                   (0x0000080c + 0x20*(i0))
+
+#define NVC0_3D_RT_FORMAT(i0)                                 (0x00000810 + 0x20*(i0))
+
+#define NVC0_3D_RT_TILE_MODE(i0)                              (0x00000814 + 0x20*(i0))
+#define NVC0_3D_RT_TILE_MODE_UNK0                              0x00000001
+#define NVC0_3D_RT_TILE_MODE_Y__MASK                           0x00000070
+#define NVC0_3D_RT_TILE_MODE_Y__SHIFT                          4
+#define NVC0_3D_RT_TILE_MODE_Z__MASK                           0x00000700
+#define NVC0_3D_RT_TILE_MODE_Z__SHIFT                          8
+
+#define NVC0_3D_RT_ARRAY_MODE(i0)                             (0x00000818 + 0x20*(i0))
+#define NVC0_3D_RT_ARRAY_MODE_LAYERS__MASK                     0x0000ffff
+#define NVC0_3D_RT_ARRAY_MODE_LAYERS__SHIFT                    0
+#define NVC0_3D_RT_ARRAY_MODE_VOLUME                           0x00010000
+
+#define NVC0_3D_RT_LAYER_STRIDE(i0)                           (0x0000081c + 0x20*(i0))
+
+#define NVC0_3D_VIEWPORT_SCALE_X(i0)                          (0x00000a00 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_SCALE_X__ESIZE                                0x00000020
+#define NVC0_3D_VIEWPORT_SCALE_X__LEN                          0x00000010
+
+#define NVC0_3D_VIEWPORT_SCALE_Y(i0)                          (0x00000a04 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_SCALE_Y__ESIZE                                0x00000020
+#define NVC0_3D_VIEWPORT_SCALE_Y__LEN                          0x00000010
+
+#define NVC0_3D_VIEWPORT_SCALE_Z(i0)                          (0x00000a08 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_SCALE_Z__ESIZE                                0x00000020
+#define NVC0_3D_VIEWPORT_SCALE_Z__LEN                          0x00000010
+
+#define NVC0_3D_VIEWPORT_TRANSLATE_X(i0)                      (0x00000a0c + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_TRANSLATE_X__ESIZE                    0x00000020
+#define NVC0_3D_VIEWPORT_TRANSLATE_X__LEN                      0x00000010
+
+#define NVC0_3D_VIEWPORT_TRANSLATE_Y(i0)                      (0x00000a10 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_TRANSLATE_Y__ESIZE                    0x00000020
+#define NVC0_3D_VIEWPORT_TRANSLATE_Y__LEN                      0x00000010
+
+#define NVC0_3D_VIEWPORT_TRANSLATE_Z(i0)                      (0x00000a14 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_TRANSLATE_Z__ESIZE                    0x00000020
+#define NVC0_3D_VIEWPORT_TRANSLATE_Z__LEN                      0x00000010
+
+#define NVC0_3D_VIEWPORT_HORIZ(i0)                            (0x00000c00 + 0x10*(i0))
+#define NVC0_3D_VIEWPORT_HORIZ__ESIZE                          0x00000010
+#define NVC0_3D_VIEWPORT_HORIZ__LEN                            0x00000010
+#define NVC0_3D_VIEWPORT_HORIZ_X__MASK                         0x0000ffff
+#define NVC0_3D_VIEWPORT_HORIZ_X__SHIFT                                0
+#define NVC0_3D_VIEWPORT_HORIZ_W__MASK                         0xffff0000
+#define NVC0_3D_VIEWPORT_HORIZ_W__SHIFT                                16
+
+#define NVC0_3D_VIEWPORT_VERT(i0)                             (0x00000c04 + 0x10*(i0))
+#define NVC0_3D_VIEWPORT_VERT__ESIZE                           0x00000010
+#define NVC0_3D_VIEWPORT_VERT__LEN                             0x00000010
+#define NVC0_3D_VIEWPORT_VERT_Y__MASK                          0x0000ffff
+#define NVC0_3D_VIEWPORT_VERT_Y__SHIFT                         0
+#define NVC0_3D_VIEWPORT_VERT_H__MASK                          0xffff0000
+#define NVC0_3D_VIEWPORT_VERT_H__SHIFT                         16
+
+#define NVC0_3D_DEPTH_RANGE_NEAR(i0)                          (0x00000c08 + 0x10*(i0))
+#define NVC0_3D_DEPTH_RANGE_NEAR__ESIZE                                0x00000010
+#define NVC0_3D_DEPTH_RANGE_NEAR__LEN                          0x00000010
+
+#define NVC0_3D_DEPTH_RANGE_FAR(i0)                           (0x00000c0c + 0x10*(i0))
+#define NVC0_3D_DEPTH_RANGE_FAR__ESIZE                         0x00000010
+#define NVC0_3D_DEPTH_RANGE_FAR__LEN                           0x00000010
+
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ(i0)                               (0x00000d00 + 0x8*(i0))
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ__ESIZE                     0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ__LEN                       0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MIN__MASK                  0x0000ffff
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MIN__SHIFT                 0
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MAX__MASK                  0xffff0000
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MAX__SHIFT                 16
+
+#define NVC0_3D_VIEWPORT_CLIP_VERT(i0)                        (0x00000d04 + 0x8*(i0))
+#define NVC0_3D_VIEWPORT_CLIP_VERT__ESIZE                      0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_VERT__LEN                                0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MIN__MASK                   0x0000ffff
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MIN__SHIFT                  0
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MAX__MASK                   0xffff0000
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MAX__SHIFT                  16
+
+#define NVC0_3D_CLIPID_REGION_HORIZ(i0)                               (0x00000d40 + 0x8*(i0))
+#define NVC0_3D_CLIPID_REGION_HORIZ__ESIZE                     0x00000008
+#define NVC0_3D_CLIPID_REGION_HORIZ__LEN                       0x00000004
+#define NVC0_3D_CLIPID_REGION_HORIZ_X__MASK                    0x0000ffff
+#define NVC0_3D_CLIPID_REGION_HORIZ_X__SHIFT                   0
+#define NVC0_3D_CLIPID_REGION_HORIZ_W__MASK                    0xffff0000
+#define NVC0_3D_CLIPID_REGION_HORIZ_W__SHIFT                   16
+
+#define NVC0_3D_CLIPID_REGION_VERT(i0)                        (0x00000d44 + 0x8*(i0))
+#define NVC0_3D_CLIPID_REGION_VERT__ESIZE                      0x00000008
+#define NVC0_3D_CLIPID_REGION_VERT__LEN                                0x00000004
+#define NVC0_3D_CLIPID_REGION_VERT_Y__MASK                     0x0000ffff
+#define NVC0_3D_CLIPID_REGION_VERT_Y__SHIFT                    0
+#define NVC0_3D_CLIPID_REGION_VERT_H__MASK                     0xffff0000
+#define NVC0_3D_CLIPID_REGION_VERT_H__SHIFT                    16
+
+#define NVC0_3D_COUNTER_ENABLE                                 0x00000d68
+#define NVC0_3D_COUNTER_ENABLE_UNK00                           0x00000001
+#define NVC0_3D_COUNTER_ENABLE_UNK01                           0x00000002
+#define NVC0_3D_COUNTER_ENABLE_UNK02                           0x00000004
+#define NVC0_3D_COUNTER_ENABLE_UNK03                           0x00000008
+#define NVC0_3D_COUNTER_ENABLE_UNK04                           0x00000010
+#define NVC0_3D_COUNTER_ENABLE_EMITTED_PRIMITIVES              0x00000020
+#define NVC0_3D_COUNTER_ENABLE_UNK06                           0x00000040
+#define NVC0_3D_COUNTER_ENABLE_UNK07                           0x00000080
+#define NVC0_3D_COUNTER_ENABLE_UNK08                           0x00000100
+#define NVC0_3D_COUNTER_ENABLE_UNK09                           0x00000200
+#define NVC0_3D_COUNTER_ENABLE_GENERATED_PRIMITIVES            0x00000400
+#define NVC0_3D_COUNTER_ENABLE_UNK0B                           0x00000800
+#define NVC0_3D_COUNTER_ENABLE_UNK0C                           0x00001000
+#define NVC0_3D_COUNTER_ENABLE_UNK0D                           0x00002000
+#define NVC0_3D_COUNTER_ENABLE_UNK0E                           0x00004000
+#define NVC0_3D_COUNTER_ENABLE_UNK0F                           0x00008000
+
+#define NVC0_3D_VERTEX_BUFFER_FIRST                            0x00000d74
+
+#define NVC0_3D_VERTEX_BUFFER_COUNT                            0x00000d78
+
+#define NVC0_3D_CLEAR_COLOR(i0)                                       (0x00000d80 + 0x4*(i0))
+#define NVC0_3D_CLEAR_COLOR__ESIZE                             0x00000004
+#define NVC0_3D_CLEAR_COLOR__LEN                               0x00000004
+
+#define NVC0_3D_CLEAR_DEPTH                                    0x00000d90
+
+#define NVC0_3D_CLEAR_STENCIL                                  0x00000da0
+
+#define NVC0_3D_POLYGON_SMOOTH_ENABLE                          0x00000db4
+
+#define NVC0_3D_POLYGON_OFFSET_POINT_ENABLE                    0x00000dc0
+
+#define NVC0_3D_POLYGON_OFFSET_LINE_ENABLE                     0x00000dc4
+
+#define NVC0_3D_POLYGON_OFFSET_FILL_ENABLE                     0x00000dc8
+
+#define NVC0_3D_PATCH_VERTICES                                 0x00000dcc
+
+#define NVC0_3D_WINDOW_OFFSET_X                                        0x00000df8
+
+#define NVC0_3D_WINDOW_OFFSET_Y                                        0x00000dfc
+
+#define NVC0_3D_SCISSOR_ENABLE(i0)                            (0x00000e00 + 0x10*(i0))
+#define NVC0_3D_SCISSOR_ENABLE__ESIZE                          0x00000010
+#define NVC0_3D_SCISSOR_ENABLE__LEN                            0x00000010
+
+#define NVC0_3D_SCISSOR_HORIZ(i0)                             (0x00000e04 + 0x10*(i0))
+#define NVC0_3D_SCISSOR_HORIZ__ESIZE                           0x00000010
+#define NVC0_3D_SCISSOR_HORIZ__LEN                             0x00000010
+#define NVC0_3D_SCISSOR_HORIZ_MIN__MASK                                0x0000ffff
+#define NVC0_3D_SCISSOR_HORIZ_MIN__SHIFT                       0
+#define NVC0_3D_SCISSOR_HORIZ_MAX__MASK                                0xffff0000
+#define NVC0_3D_SCISSOR_HORIZ_MAX__SHIFT                       16
+
+#define NVC0_3D_SCISSOR_VERT(i0)                              (0x00000e08 + 0x10*(i0))
+#define NVC0_3D_SCISSOR_VERT__ESIZE                            0x00000010
+#define NVC0_3D_SCISSOR_VERT__LEN                              0x00000010
+#define NVC0_3D_SCISSOR_VERT_MIN__MASK                         0x0000ffff
+#define NVC0_3D_SCISSOR_VERT_MIN__SHIFT                                0
+#define NVC0_3D_SCISSOR_VERT_MAX__MASK                         0xffff0000
+#define NVC0_3D_SCISSOR_VERT_MAX__SHIFT                                16
+
+#define NVC0_3D_STENCIL_BACK_FUNC_REF                          0x00000f54
+
+#define NVC0_3D_STENCIL_BACK_MASK                              0x00000f58
+
+#define NVC0_3D_STENCIL_BACK_FUNC_MASK                         0x00000f5c
+
+#define NVC0_3D_VERTEX_RUNOUT_ADDRESS_HIGH                     0x00000f84
+
+#define NVC0_3D_VERTEX_RUNOUT_ADDRESS_LOW                      0x00000f88
+
+#define NVC0_3D_DEPTH_BOUNDS(i0)                              (0x00000f9c + 0x4*(i0))
+#define NVC0_3D_DEPTH_BOUNDS__ESIZE                            0x00000004
+#define NVC0_3D_DEPTH_BOUNDS__LEN                              0x00000002
+
+#define NVC0_3D_MSAA_MASK(i0)                                 (0x00000fbc + 0x4*(i0))
+#define NVC0_3D_MSAA_MASK__ESIZE                               0x00000004
+#define NVC0_3D_MSAA_MASK__LEN                                 0x00000004
+
+#define NVC0_3D_CLIPID_ADDRESS_HIGH                            0x00000fcc
+
+#define NVC0_3D_CLIPID_ADDRESS_LOW                             0x00000fd0
+
+#define NVC0_3D_ZETA_ADDRESS_HIGH                              0x00000fe0
+
+#define NVC0_3D_ZETA_ADDRESS_LOW                               0x00000fe4
+
+#define NVC0_3D_ZETA_FORMAT                                    0x00000fe8
+
+#define NVC0_3D_ZETA_TILE_MODE                                 0x00000fec
+
+#define NVC0_3D_ZETA_LAYER_STRIDE                              0x00000ff0
+
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ                           0x00000ff4
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_W__MASK                   0xffff0000
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_W__SHIFT                  16
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_X__MASK                   0x0000ffff
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_X__SHIFT                  0
+
+#define NVC0_3D_SCREEN_SCISSOR_VERT                            0x00000ff8
+#define NVC0_3D_SCREEN_SCISSOR_VERT_H__MASK                    0xffff0000
+#define NVC0_3D_SCREEN_SCISSOR_VERT_H__SHIFT                   16
+#define NVC0_3D_SCREEN_SCISSOR_VERT_Y__MASK                    0x0000ffff
+#define NVC0_3D_SCREEN_SCISSOR_VERT_Y__SHIFT                   0
+
+#define NVC0_3D_VERTEX_ID                                      0x00001118
+
+#define NVC0_3D_VTX_ATTR_DEFINE                                        0x0000114c
+#define NVC0_3D_VTX_ATTR_DEFINE_ATTR__MASK                     0x000000ff
+#define NVC0_3D_VTX_ATTR_DEFINE_ATTR__SHIFT                    0
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__MASK                     0x00000700
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__SHIFT                    8
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__MIN                      0x00000001
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__MAX                      0x00000004
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE__MASK                     0x00007000
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE__SHIFT                    12
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE_8                         0x00001000
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE_16                                0x00002000
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE_32                                0x00004000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE__MASK                     0x00070000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE__SHIFT                    16
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_SNORM                     0x00010000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_UNORM                     0x00020000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_SINT                      0x00030000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_UINT                      0x00040000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_USCALED                   0x00050000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_SSCALED                   0x00060000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_FLOAT                     0x00070000
+
+#define NVC0_3D_VTX_ATTR_DATA(i0)                             (0x00001150 + 0x4*(i0))
+#define NVC0_3D_VTX_ATTR_DATA__ESIZE                           0x00000004
+#define NVC0_3D_VTX_ATTR_DATA__LEN                             0x00000004
+
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT(i0)                      (0x00001160 + 0x4*(i0))
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT__ESIZE                    0x00000004
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT__LEN                      0x00000020
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_BUFFER__MASK              0x0000003f
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_BUFFER__SHIFT             0
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_CONST                     0x00000040
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_OFFSET__MASK              0x001fff80
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_OFFSET__SHIFT             7
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE__MASK                        0x07e00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE__SHIFT               21
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32_32_32_32          0x00200000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32_32_32             0x00400000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16_16_16_16          0x00600000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32_32                        0x00800000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16_16_16             0x00a00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8_8_8_8              0x01400000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16_16                        0x01e00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32                   0x02400000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8_8_8                        0x02600000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8_8                  0x03000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16                   0x03600000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8                    0x03a00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_2_10_10_10           0x06000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE__MASK                        0x78000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE__SHIFT               27
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_SNORM                        0x08000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_UNORM                        0x10000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_SINT                 0x18000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_UINT                 0x20000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_USCALED              0x28000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_SSCALED              0x30000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_FLOAT                        0x38000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_BGRA                      0x80000000
+
+#define NVC0_3D_RT_CONTROL                                     0x0000121c
+#define NVC0_3D_RT_CONTROL_COUNT__MASK                         0x0000000f
+#define NVC0_3D_RT_CONTROL_COUNT__SHIFT                                0
+#define NVC0_3D_RT_CONTROL_MAP0__MASK                          0x00000070
+#define NVC0_3D_RT_CONTROL_MAP0__SHIFT                         4
+#define NVC0_3D_RT_CONTROL_MAP1__MASK                          0x00000380
+#define NVC0_3D_RT_CONTROL_MAP1__SHIFT                         7
+#define NVC0_3D_RT_CONTROL_MAP2__MASK                          0x00001c00
+#define NVC0_3D_RT_CONTROL_MAP2__SHIFT                         10
+#define NVC0_3D_RT_CONTROL_MAP3__MASK                          0x0000e000
+#define NVC0_3D_RT_CONTROL_MAP3__SHIFT                         13
+#define NVC0_3D_RT_CONTROL_MAP4__MASK                          0x00070000
+#define NVC0_3D_RT_CONTROL_MAP4__SHIFT                         16
+#define NVC0_3D_RT_CONTROL_MAP5__MASK                          0x00380000
+#define NVC0_3D_RT_CONTROL_MAP5__SHIFT                         19
+#define NVC0_3D_RT_CONTROL_MAP6__MASK                          0x01c00000
+#define NVC0_3D_RT_CONTROL_MAP6__SHIFT                         22
+#define NVC0_3D_RT_CONTROL_MAP7__MASK                          0x0e000000
+#define NVC0_3D_RT_CONTROL_MAP7__SHIFT                         25
+
+#define NVC0_3D_ZETA_HORIZ                                     0x00001228
+
+#define NVC0_3D_ZETA_VERT                                      0x0000122c
+
+#define NVC0_3D_ZETA_ARRAY_MODE                                        0x00001230
+#define NVC0_3D_ZETA_ARRAY_MODE_LAYERS__MASK                   0x0000ffff
+#define NVC0_3D_ZETA_ARRAY_MODE_LAYERS__SHIFT                  0
+#define NVC0_3D_ZETA_ARRAY_MODE_UNK                            0x00010000
+
+#define NVC0_3D_LINKED_TSC                                     0x00001234
+
+#define NVC0_3D_DRAW_TFB_BYTES                                 0x0000123c
+
+#define NVC0_3D_FP_RESULT_COUNT                                        0x00001298
+
+#define NVC0_3D_DEPTH_TEST_ENABLE                              0x000012cc
+
+#define NVC0_3D_D3D_FILL_MODE                                  0x000012d0
+#define NVC0_3D_D3D_FILL_MODE_POINT                            0x00000001
+#define NVC0_3D_D3D_FILL_MODE_WIREFRAME                                0x00000002
+#define NVC0_3D_D3D_FILL_MODE_SOLID                            0x00000003
+
+#define NVC0_3D_SHADE_MODEL                                    0x000012d4
+#define NVC0_3D_SHADE_MODEL_FLAT                               0x00001d00
+#define NVC0_3D_SHADE_MODEL_SMOOTH                             0x00001d01
+
+#define NVC0_3D_BLEND_INDEPENDENT                              0x000012e4
+
+#define NVC0_3D_DEPTH_WRITE_ENABLE                             0x000012e8
+
+#define NVC0_3D_ALPHA_TEST_ENABLE                              0x000012ec
+
+#define NVC0_3D_VB_ELEMENT_U8_SETUP                            0x00001300
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_OFFSET__MASK               0xc0000000
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_OFFSET__SHIFT              30
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_COUNT__MASK                        0x3fffffff
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_COUNT__SHIFT               0
+
+#define NVC0_3D_VB_ELEMENT_U8                                  0x00001304
+#define NVC0_3D_VB_ELEMENT_U8_I0__MASK                         0x000000ff
+#define NVC0_3D_VB_ELEMENT_U8_I0__SHIFT                                0
+#define NVC0_3D_VB_ELEMENT_U8_I1__MASK                         0x0000ff00
+#define NVC0_3D_VB_ELEMENT_U8_I1__SHIFT                                8
+#define NVC0_3D_VB_ELEMENT_U8_I2__MASK                         0x00ff0000
+#define NVC0_3D_VB_ELEMENT_U8_I2__SHIFT                                16
+#define NVC0_3D_VB_ELEMENT_U8_I3__MASK                         0xff000000
+#define NVC0_3D_VB_ELEMENT_U8_I3__SHIFT                                24
+
+#define NVC0_3D_D3D_CULL_MODE                                  0x00001308
+#define NVC0_3D_D3D_CULL_MODE_NONE                             0x00000001
+#define NVC0_3D_D3D_CULL_MODE_FRONT                            0x00000002
+#define NVC0_3D_D3D_CULL_MODE_BACK                             0x00000003
+
+#define NVC0_3D_DEPTH_TEST_FUNC                                        0x0000130c
+#define NVC0_3D_DEPTH_TEST_FUNC_NEVER                          0x00000200
+#define NVC0_3D_DEPTH_TEST_FUNC_LESS                           0x00000201
+#define NVC0_3D_DEPTH_TEST_FUNC_EQUAL                          0x00000202
+#define NVC0_3D_DEPTH_TEST_FUNC_LEQUAL                         0x00000203
+#define NVC0_3D_DEPTH_TEST_FUNC_GREATER                                0x00000204
+#define NVC0_3D_DEPTH_TEST_FUNC_NOTEQUAL                       0x00000205
+#define NVC0_3D_DEPTH_TEST_FUNC_GEQUAL                         0x00000206
+#define NVC0_3D_DEPTH_TEST_FUNC_ALWAYS                         0x00000207
+
+#define NVC0_3D_ALPHA_TEST_REF                                 0x00001310
+
+#define NVC0_3D_ALPHA_TEST_FUNC                                        0x00001314
+#define NVC0_3D_ALPHA_TEST_FUNC_NEVER                          0x00000200
+#define NVC0_3D_ALPHA_TEST_FUNC_LESS                           0x00000201
+#define NVC0_3D_ALPHA_TEST_FUNC_EQUAL                          0x00000202
+#define NVC0_3D_ALPHA_TEST_FUNC_LEQUAL                         0x00000203
+#define NVC0_3D_ALPHA_TEST_FUNC_GREATER                                0x00000204
+#define NVC0_3D_ALPHA_TEST_FUNC_NOTEQUAL                       0x00000205
+#define NVC0_3D_ALPHA_TEST_FUNC_GEQUAL                         0x00000206
+#define NVC0_3D_ALPHA_TEST_FUNC_ALWAYS                         0x00000207
+
+#define NVC0_3D_DRAW_TFB_STRIDE                                        0x00001318
+#define NVC0_3D_DRAW_TFB_STRIDE__MIN                           0x00000001
+#define NVC0_3D_DRAW_TFB_STRIDE__MAX                           0x00000fff
+
+#define NVC0_3D_BLEND_COLOR(i0)                                       (0x0000131c + 0x4*(i0))
+#define NVC0_3D_BLEND_COLOR__ESIZE                             0x00000004
+#define NVC0_3D_BLEND_COLOR__LEN                               0x00000004
+
+#define NVC0_3D_TSC_FLUSH                                      0x00001330
+#define NVC0_3D_TSC_FLUSH_SPECIFIC                             0x00000001
+#define NVC0_3D_TSC_FLUSH_ENTRY__MASK                          0x03fffff0
+#define NVC0_3D_TSC_FLUSH_ENTRY__SHIFT                         4
+
+#define NVC0_3D_TIC_FLUSH                                      0x00001334
+#define NVC0_3D_TIC_FLUSH_SPECIFIC                             0x00000001
+#define NVC0_3D_TIC_FLUSH_ENTRY__MASK                          0x03fffff0
+#define NVC0_3D_TIC_FLUSH_ENTRY__SHIFT                         4
+
+#define NVC0_3D_TEX_CACHE_CTL                                  0x00001338
+#define NVC0_3D_TEX_CACHE_CTL_UNK1__MASK                       0x00000030
+#define NVC0_3D_TEX_CACHE_CTL_UNK1__SHIFT                      4
+
+#define NVC0_3D_BLEND_EQUATION_RGB                             0x00001340
+#define NVC0_3D_BLEND_EQUATION_RGB_FUNC_ADD                    0x00008006
+#define NVC0_3D_BLEND_EQUATION_RGB_MIN                         0x00008007
+#define NVC0_3D_BLEND_EQUATION_RGB_MAX                         0x00008008
+#define NVC0_3D_BLEND_EQUATION_RGB_FUNC_SUBTRACT               0x0000800a
+#define NVC0_3D_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT       0x0000800b
+
+#define NVC0_3D_BLEND_FUNC_SRC_RGB                             0x00001344
+
+#define NVC0_3D_BLEND_FUNC_DST_RGB                             0x00001348
+
+#define NVC0_3D_BLEND_EQUATION_ALPHA                           0x0000134c
+#define NVC0_3D_BLEND_EQUATION_ALPHA_FUNC_ADD                  0x00008006
+#define NVC0_3D_BLEND_EQUATION_ALPHA_MIN                       0x00008007
+#define NVC0_3D_BLEND_EQUATION_ALPHA_MAX                       0x00008008
+#define NVC0_3D_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT             0x0000800a
+#define NVC0_3D_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT     0x0000800b
+
+#define NVC0_3D_BLEND_FUNC_SRC_ALPHA                           0x00001350
+
+#define NVC0_3D_BLEND_FUNC_DST_ALPHA                           0x00001358
+
+#define NVC0_3D_BLEND_ENABLE(i0)                              (0x00001360 + 0x4*(i0))
+#define NVC0_3D_BLEND_ENABLE__ESIZE                            0x00000004
+#define NVC0_3D_BLEND_ENABLE__LEN                              0x00000008
+
+#define NVC0_3D_STENCIL_FRONT_ENABLE                           0x00001380
+
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL                          0x00001384
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_ZERO                     0x00000000
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_INVERT                   0x0000150a
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_KEEP                     0x00001e00
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_REPLACE                  0x00001e01
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_INCR                     0x00001e02
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_DECR                     0x00001e03
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_INCR_WRAP                        0x00008507
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_DECR_WRAP                        0x00008508
+
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL                         0x00001388
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_ZERO                    0x00000000
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_INVERT                  0x0000150a
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_KEEP                    0x00001e00
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_REPLACE                 0x00001e01
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_INCR                    0x00001e02
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_DECR                    0x00001e03
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP               0x00008507
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP               0x00008508
+
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS                         0x0000138c
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_ZERO                    0x00000000
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_INVERT                  0x0000150a
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_KEEP                    0x00001e00
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_REPLACE                 0x00001e01
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_INCR                    0x00001e02
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_DECR                    0x00001e03
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_INCR_WRAP               0x00008507
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_DECR_WRAP               0x00008508
+
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC                                0x00001390
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_NEVER                  0x00000200
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_LESS                   0x00000201
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_EQUAL                  0x00000202
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_LEQUAL                 0x00000203
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_GREATER                        0x00000204
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL               0x00000205
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_GEQUAL                 0x00000206
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_ALWAYS                 0x00000207
+
+#define NVC0_3D_STENCIL_FRONT_FUNC_REF                         0x00001394
+
+#define NVC0_3D_STENCIL_FRONT_MASK                             0x00001398
+
+#define NVC0_3D_STENCIL_FRONT_FUNC_MASK                                0x0000139c
+
+#define NVC0_3D_DRAW_TFB_BASE                                  0x000013a4
+
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN                            0x000013a8
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_0                          0x00000001
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_1                          0x00000010
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_2                          0x00000100
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_3                          0x00001000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_4                          0x00010000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_5                          0x00100000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_6                          0x01000000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_7                          0x10000000
+
+#define NVC0_3D_SCREEN_Y_CONTROL                               0x000013ac
+#define NVC0_3D_SCREEN_Y_CONTROL_Y_NEGATE                      0x00000001
+#define NVC0_3D_SCREEN_Y_CONTROL_TRIANGLE_RAST_FLIP            0x00000010
+
+#define NVC0_3D_LINE_WIDTH                                     0x000013b0
+
+#define NVC0_3D_GP_VERTEX_OUTPUT_COUNT                         0x00001420
+#define NVC0_3D_GP_VERTEX_OUTPUT_COUNT__MIN                    0x00000001
+#define NVC0_3D_GP_VERTEX_OUTPUT_COUNT__MAX                    0x00000400
+
+#define NVC0_3D_VERTEX_ARRAY_FLUSH                             0x0000142c
+
+#define NVC0_3D_VB_ELEMENT_BASE                                        0x00001434
+
+#define NVC0_3D_VB_INSTANCE_BASE                               0x00001438
+
+#define NVC0_3D_CODE_CB_FLUSH                                  0x00001440
+
+#define NVC0_3D_CLIPID_HEIGHT                                  0x00001504
+#define NVC0_3D_CLIPID_HEIGHT__MAX                             0x00002000
+
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE                                0x00001510
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_0                      0x00000001
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_1                      0x00000002
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_2                      0x00000004
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_3                      0x00000008
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_4                      0x00000010
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_5                      0x00000020
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_6                      0x00000040
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_7                      0x00000080
+
+#define NVC0_3D_SAMPLECNT_ENABLE                               0x00001514
+
+#define NVC0_3D_POINT_SIZE                                     0x00001518
+
+#define NVC0_3D_POINT_SPRITE_ENABLE                            0x00001520
+
+#define NVC0_3D_COUNTER_RESET                                  0x00001530
+#define NVC0_3D_COUNTER_RESET_SAMPLECNT                                0x00000001
+#define NVC0_3D_COUNTER_RESET_UNK02                            0x00000002
+#define NVC0_3D_COUNTER_RESET_UNK03                            0x00000003
+#define NVC0_3D_COUNTER_RESET_UNK04                            0x00000004
+#define NVC0_3D_COUNTER_RESET_EMITTED_PRIMITIVES               0x00000010
+#define NVC0_3D_COUNTER_RESET_UNK11                            0x00000011
+#define NVC0_3D_COUNTER_RESET_UNK12                            0x00000012
+#define NVC0_3D_COUNTER_RESET_UNK13                            0x00000013
+#define NVC0_3D_COUNTER_RESET_UNK15                            0x00000015
+#define NVC0_3D_COUNTER_RESET_UNK16                            0x00000016
+#define NVC0_3D_COUNTER_RESET_UNK17                            0x00000017
+#define NVC0_3D_COUNTER_RESET_UNK18                            0x00000018
+#define NVC0_3D_COUNTER_RESET_UNK1A                            0x0000001a
+#define NVC0_3D_COUNTER_RESET_UNK1B                            0x0000001b
+#define NVC0_3D_COUNTER_RESET_UNK1C                            0x0000001c
+#define NVC0_3D_COUNTER_RESET_UNK1D                            0x0000001d
+#define NVC0_3D_COUNTER_RESET_UNK1E                            0x0000001e
+#define NVC0_3D_COUNTER_RESET_GENERATED_PRIMITIVES             0x0000001f
+
+#define NVC0_3D_MULTISAMPLE_ENABLE                             0x00001534
+
+#define NVC0_3D_ZETA_ENABLE                                    0x00001538
+
+#define NVC0_3D_MULTISAMPLE_CTRL                               0x0000153c
+#define NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE             0x00000001
+#define NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_ONE                  0x00000010
+
+#define NVC0_3D_COND_ADDRESS_HIGH                              0x00001550
+
+#define NVC0_3D_COND_ADDRESS_LOW                               0x00001554
+
+#define NVC0_3D_COND_MODE                                      0x00001558
+#define NVC0_3D_COND_MODE_NEVER                                        0x00000000
+#define NVC0_3D_COND_MODE_ALWAYS                               0x00000001
+#define NVC0_3D_COND_MODE_RES_NON_ZERO                         0x00000002
+#define NVC0_3D_COND_MODE_EQUAL                                        0x00000003
+#define NVC0_3D_COND_MODE_NOT_EQUAL                            0x00000004
+
+#define NVC0_3D_TSC_ADDRESS_HIGH                               0x0000155c
+
+#define NVC0_3D_TSC_ADDRESS_LOW                                        0x00001560
+#define NVC0_3D_TSC_ADDRESS_LOW__ALIGN                         0x00000020
+
+#define NVC0_3D_TSC_LIMIT                                      0x00001564
+#define NVC0_3D_TSC_LIMIT__MAX                                 0x00001fff
+
+#define NVC0_3D_POLYGON_OFFSET_FACTOR                          0x0000156c
+
+#define NVC0_3D_LINE_SMOOTH_ENABLE                             0x00001570
+
+#define NVC0_3D_TIC_ADDRESS_HIGH                               0x00001574
+
+#define NVC0_3D_TIC_ADDRESS_LOW                                        0x00001578
+
+#define NVC0_3D_TIC_LIMIT                                      0x0000157c
+
+#define NVC0_3D_STENCIL_TWO_SIDE_ENABLE                                0x00001594
+
+#define NVC0_3D_STENCIL_BACK_OP_FAIL                           0x00001598
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_ZERO                      0x00000000
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_INVERT                    0x0000150a
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_KEEP                      0x00001e00
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_REPLACE                   0x00001e01
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_INCR                      0x00001e02
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_DECR                      0x00001e03
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_INCR_WRAP                 0x00008507
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_DECR_WRAP                 0x00008508
+
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL                          0x0000159c
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_ZERO                     0x00000000
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_INVERT                   0x0000150a
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_KEEP                     0x00001e00
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_REPLACE                  0x00001e01
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_INCR                     0x00001e02
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_DECR                     0x00001e03
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_INCR_WRAP                        0x00008507
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_DECR_WRAP                        0x00008508
+
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS                          0x000015a0
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_ZERO                     0x00000000
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_INVERT                   0x0000150a
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_KEEP                     0x00001e00
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_REPLACE                  0x00001e01
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_INCR                     0x00001e02
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_DECR                     0x00001e03
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_INCR_WRAP                        0x00008507
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_DECR_WRAP                        0x00008508
+
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC                         0x000015a4
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_NEVER                   0x00000200
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_LESS                    0x00000201
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_EQUAL                   0x00000202
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_LEQUAL                  0x00000203
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_GREATER                 0x00000204
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_NOTEQUAL                        0x00000205
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_GEQUAL                  0x00000206
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_ALWAYS                  0x00000207
+
+#define NVC0_3D_CSAA_ENABLE                                    0x000015b4
+
+#define NVC0_3D_FRAMEBUFFER_SRGB                               0x000015b8
+
+#define NVC0_3D_POLYGON_OFFSET_UNITS                           0x000015bc
+
+#define NVC0_3D_GP_BUILTIN_RESULT_EN                           0x000015cc
+#define NVC0_3D_GP_BUILTIN_RESULT_EN_LAYER                     0x00010000
+
+#define NVC0_3D_MULTISAMPLE_MODE                               0x000015d0
+#define NVC0_3D_MULTISAMPLE_MODE_1X                            0x00000000
+#define NVC0_3D_MULTISAMPLE_MODE_2XMS                          0x00000001
+#define NVC0_3D_MULTISAMPLE_MODE_4XMS                          0x00000002
+#define NVC0_3D_MULTISAMPLE_MODE_8XMS                          0x00000003
+#define NVC0_3D_MULTISAMPLE_MODE_4XMS_4XCS                     0x00000008
+#define NVC0_3D_MULTISAMPLE_MODE_4XMS_12XCS                    0x00000009
+#define NVC0_3D_MULTISAMPLE_MODE_8XMS_8XCS                     0x0000000a
+
+#define NVC0_3D_VERTEX_BEGIN_D3D                               0x000015d4
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE__MASK               0x0fffffff
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE__SHIFT              0
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_POINTS              0x00000001
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINES               0x00000002
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINE_STRIP          0x00000003
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLES           0x00000004
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLE_STRIP      0x00000005
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINES_ADJACENCY     0x0000000a
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINE_STRIP_ADJACENCY        0x0000000b
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLES_ADJACENCY 0x0000000c
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLE_STRIP_ADJACENCY    0x0000000d
+#define NVC0_3D_VERTEX_BEGIN_D3D_INSTANCE_NEXT                 0x10000000
+
+#define NVC0_3D_VERTEX_END_D3D                                 0x000015d8
+#define NVC0_3D_VERTEX_END_D3D_UNK0                            0x00000001
+#define NVC0_3D_VERTEX_END_D3D_UNK1                            0x00000002
+
+#define NVC0_3D_EDGEFLAG_ENABLE                                        0x000015e4
+
+#define NVC0_3D_VB_ELEMENT_U32                                 0x000015e8
+
+#define NVC0_3D_VB_ELEMENT_U16_SETUP                           0x000015ec
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_OFFSET__MASK              0xc0000000
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_OFFSET__SHIFT             30
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_COUNT__MASK               0x3fffffff
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_COUNT__SHIFT              0
+
+#define NVC0_3D_VB_ELEMENT_U16                                 0x000015f0
+#define NVC0_3D_VB_ELEMENT_U16_I0__MASK                                0x0000ffff
+#define NVC0_3D_VB_ELEMENT_U16_I0__SHIFT                       0
+#define NVC0_3D_VB_ELEMENT_U16_I1__MASK                                0xffff0000
+#define NVC0_3D_VB_ELEMENT_U16_I1__SHIFT                       16
+
+#define NVC0_3D_VERTEX_BASE_HIGH                               0x000015f4
+
+#define NVC0_3D_VERTEX_BASE_LOW                                        0x000015f8
+
+#define NVC0_3D_POINT_COORD_REPLACE                            0x00001604
+#define NVC0_3D_POINT_COORD_REPLACE_BITS__MASK                 0x00001fff
+#define NVC0_3D_POINT_COORD_REPLACE_BITS__SHIFT                        0
+
+#define NVC0_3D_CODE_ADDRESS_HIGH                              0x00001608
+
+#define NVC0_3D_CODE_ADDRESS_LOW                               0x0000160c
+
+#define NVC0_3D_VERTEX_END_GL                                  0x00001614
+#define NVC0_3D_VERTEX_END_GL_UNK0                             0x00000001
+#define NVC0_3D_VERTEX_END_GL_UNK1                             0x00000002
+
+#define NVC0_3D_VERTEX_BEGIN_GL                                        0x00001618
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE__MASK                        0x0fffffff
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE__SHIFT               0
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_POINTS               0x00000000
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINES                        0x00000001
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINE_LOOP            0x00000002
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINE_STRIP           0x00000003
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLES            0x00000004
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLE_STRIP       0x00000005
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLE_FAN         0x00000006
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_QUADS                        0x00000007
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_QUAD_STRIP           0x00000008
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_POLYGON              0x00000009
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINES_ADJACENCY      0x0000000a
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINE_STRIP_ADJACENCY 0x0000000b
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLES_ADJACENCY  0x0000000c
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLE_STRIP_ADJACENCY     0x0000000d
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_PATCHES              0x0000000e
+#define NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT                  0x10000000
+
+#define NVC0_3D_VERTEX_DATA                                    0x00001640
+
+#define NVC0_3D_PRIM_RESTART_ENABLE                            0x00001644
+
+#define NVC0_3D_PRIM_RESTART_INDEX                             0x00001648
+
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN                          0x0000164c
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID                        0x00000001
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_INSTANCE_ID              0x00000010
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_PRIMITIVE_ID             0x00000100
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_UNK12                    0x00001000
+
+#define NVC0_3D_POINT_SMOOTH_ENABLE                            0x00001658
+
+#define NVC0_3D_POINT_RASTER_RULES                             0x0000165c
+#define NVC0_3D_POINT_RASTER_RULES_OGL                         0x00000000
+#define NVC0_3D_POINT_RASTER_RULES_D3D                         0x00000001
+
+#define NVC0_3D_POINT_SPRITE_CTRL                              0x00001660
+
+#define NVC0_3D_TEX_MISC                                       0x00001664
+#define NVC0_3D_TEX_MISC_SEAMLESS_CUBE_MAP                     0x00000004
+
+#define NVC0_3D_LINE_STIPPLE_ENABLE                            0x0000166c
+
+#define NVC0_3D_LINE_STIPPLE_PATTERN                           0x00001680
+
+#define NVC0_3D_PROVOKING_VERTEX_LAST                          0x00001684
+
+#define NVC0_3D_VERTEX_TWO_SIDE_ENABLE                         0x00001688
+
+#define NVC0_3D_POLYGON_STIPPLE_ENABLE                         0x0000168c
+
+#define NVC0_3D_POLYGON_STIPPLE_PATTERN(i0)                   (0x00001700 + 0x4*(i0))
+#define NVC0_3D_POLYGON_STIPPLE_PATTERN__ESIZE                 0x00000004
+#define NVC0_3D_POLYGON_STIPPLE_PATTERN__LEN                   0x00000020
+
+#define NVC0_3D_STRMOUT_UNK1780(i0)                           (0x00001780 + 0x4*(i0))
+#define NVC0_3D_STRMOUT_UNK1780__ESIZE                         0x00000004
+#define NVC0_3D_STRMOUT_UNK1780__LEN                           0x00000004
+
+#define NVC0_3D_UNK17BC_ADDRESS_HIGH                           0x000017bc
+
+#define NVC0_3D_UNK17BC_ADDRESS_LOW                            0x000017c0
+
+#define NVC0_3D_UNK17BC_LIMIT                                  0x000017c4
+
+#define NVC0_3D_INDEX_ARRAY_START_HIGH                         0x000017c8
+
+#define NVC0_3D_INDEX_ARRAY_START_LOW                          0x000017cc
+
+#define NVC0_3D_INDEX_ARRAY_LIMIT_HIGH                         0x000017d0
+
+#define NVC0_3D_INDEX_ARRAY_LIMIT_LOW                          0x000017d4
+
+#define NVC0_3D_INDEX_LOG2_SIZE                                        0x000017d8
+
+#define NVC0_3D_INDEX_BATCH_FIRST                              0x000017dc
+
+#define NVC0_3D_INDEX_BATCH_COUNT                              0x000017e0
+
+#define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE(i0)                 (0x00001880 + 0x4*(i0))
+#define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE__ESIZE               0x00000004
+#define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE__LEN                 0x00000020
+
+#define NVC0_3D_VP_POINT_SIZE_EN                               0x00001910
+
+#define NVC0_3D_CULL_FACE_ENABLE                               0x00001918
+
+#define NVC0_3D_FRONT_FACE                                     0x0000191c
+#define NVC0_3D_FRONT_FACE_CW                                  0x00000900
+#define NVC0_3D_FRONT_FACE_CCW                                 0x00000901
+
+#define NVC0_3D_CULL_FACE                                      0x00001920
+#define NVC0_3D_CULL_FACE_FRONT                                        0x00000404
+#define NVC0_3D_CULL_FACE_BACK                                 0x00000405
+#define NVC0_3D_CULL_FACE_FRONT_AND_BACK                       0x00000408
+
+#define NVC0_3D_VIEWPORT_TRANSFORM_EN                          0x0000192c
+
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL                          0x0000193c
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK0                     0x00000001
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1                     0x00000002
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK2                     0x00000004
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK3                     0x00000008
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK4                     0x00000010
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK7                     0x00000080
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK10                    0x00000400
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK11                    0x00000800
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK12                    0x00001000
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK13                    0x00002000
+
+#define NVC0_3D_VIEWPORT_CLIP_RECTS_EN                         0x0000194c
+
+#define NVC0_3D_VIEWPORT_CLIP_MODE                             0x00001950
+#define NVC0_3D_VIEWPORT_CLIP_MODE_INSIDE_ANY                  0x00000000
+#define NVC0_3D_VIEWPORT_CLIP_MODE_OUTSIDE_ALL                 0x00000001
+#define NVC0_3D_VIEWPORT_CLIP_MODE_NEVER                       0x00000002
+
+#define NVC0_3D_FP_ZORDER_CTRL                                 0x0000196c
+#define NVC0_3D_FP_ZORDER_CTRL_0                               0x00000001
+#define NVC0_3D_FP_ZORDER_CTRL_1                               0x00000010
+
+#define NVC0_3D_CLIPID_ENABLE                                  0x0000197c
+
+#define NVC0_3D_CLIPID_WIDTH                                   0x00001980
+#define NVC0_3D_CLIPID_WIDTH__MAX                              0x00002000
+#define NVC0_3D_CLIPID_WIDTH__ALIGN                            0x00000040
+
+#define NVC0_3D_CLIPID_ID                                      0x00001984
+
+#define NVC0_3D_FP_CONTROL                                     0x000019a8
+#define NVC0_3D_FP_CONTROL_MULTIPLE_RESULTS                    0x00000001
+#define NVC0_3D_FP_CONTROL_EXPORTS_Z                           0x00000100
+#define NVC0_3D_FP_CONTROL_USES_KIL                            0x00100000
+
+#define NVC0_3D_DEPTH_BOUNDS_EN                                        0x000019bc
+
+#define NVC0_3D_LOGIC_OP_ENABLE                                        0x000019c4
+
+#define NVC0_3D_LOGIC_OP                                       0x000019c8
+#define NVC0_3D_LOGIC_OP_CLEAR                                 0x00001500
+#define NVC0_3D_LOGIC_OP_AND                                   0x00001501
+#define NVC0_3D_LOGIC_OP_AND_REVERSE                           0x00001502
+#define NVC0_3D_LOGIC_OP_COPY                                  0x00001503
+#define NVC0_3D_LOGIC_OP_AND_INVERTED                          0x00001504
+#define NVC0_3D_LOGIC_OP_NOOP                                  0x00001505
+#define NVC0_3D_LOGIC_OP_XOR                                   0x00001506
+#define NVC0_3D_LOGIC_OP_OR                                    0x00001507
+#define NVC0_3D_LOGIC_OP_NOR                                   0x00001508
+#define NVC0_3D_LOGIC_OP_EQUIV                                 0x00001509
+#define NVC0_3D_LOGIC_OP_INVERT                                        0x0000150a
+#define NVC0_3D_LOGIC_OP_OR_REVERSE                            0x0000150b
+#define NVC0_3D_LOGIC_OP_COPY_INVERTED                         0x0000150c
+#define NVC0_3D_LOGIC_OP_OR_INVERTED                           0x0000150d
+#define NVC0_3D_LOGIC_OP_NAND                                  0x0000150e
+#define NVC0_3D_LOGIC_OP_SET                                   0x0000150f
+
+#define NVC0_3D_CLEAR_BUFFERS                                  0x000019d0
+#define NVC0_3D_CLEAR_BUFFERS_Z                                        0x00000001
+#define NVC0_3D_CLEAR_BUFFERS_S                                        0x00000002
+#define NVC0_3D_CLEAR_BUFFERS_R                                        0x00000004
+#define NVC0_3D_CLEAR_BUFFERS_G                                        0x00000008
+#define NVC0_3D_CLEAR_BUFFERS_B                                        0x00000010
+#define NVC0_3D_CLEAR_BUFFERS_A                                        0x00000020
+#define NVC0_3D_CLEAR_BUFFERS_RT__MASK                         0x000003c0
+#define NVC0_3D_CLEAR_BUFFERS_RT__SHIFT                                6
+#define NVC0_3D_CLEAR_BUFFERS_LAYER__MASK                      0x001ffc00
+#define NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT                     10
+
+#define NVC0_3D_COLOR_MASK(i0)                                (0x00001a00 + 0x4*(i0))
+#define NVC0_3D_COLOR_MASK__ESIZE                              0x00000004
+#define NVC0_3D_COLOR_MASK__LEN                                        0x00000008
+#define NVC0_3D_COLOR_MASK_R                                   0x0000000f
+#define NVC0_3D_COLOR_MASK_G                                   0x000000f0
+#define NVC0_3D_COLOR_MASK_B                                   0x00000f00
+#define NVC0_3D_COLOR_MASK_A                                   0x0000f000
+
+#define NVC0_3D_QUERY_ADDRESS_HIGH                             0x00001b00
+
+#define NVC0_3D_QUERY_ADDRESS_LOW                              0x00001b04
+
+#define NVC0_3D_QUERY_SEQUENCE                                 0x00001b08
+
+#define NVC0_3D_QUERY_GET                                      0x00001b0c
+#define NVC0_3D_QUERY_GET_MODE__MASK                           0x00000003
+#define NVC0_3D_QUERY_GET_MODE__SHIFT                          0
+#define NVC0_3D_QUERY_GET_MODE_WRITE_UNK0                      0x00000000
+#define NVC0_3D_QUERY_GET_MODE_SYNC                            0x00000001
+#define NVC0_3D_QUERY_GET_MODE_WRITE_UNK2                      0x00000002
+#define NVC0_3D_QUERY_GET_FENCE                                        0x00000010
+#define NVC0_3D_QUERY_GET_STREAM__MASK                         0x000000e0
+#define NVC0_3D_QUERY_GET_STREAM__SHIFT                                5
+#define NVC0_3D_QUERY_GET_UNK8                                 0x00000100
+#define NVC0_3D_QUERY_GET_UNIT__MASK                           0x0000f000
+#define NVC0_3D_QUERY_GET_UNIT__SHIFT                          12
+#define NVC0_3D_QUERY_GET_SYNC_COND__MASK                      0x00010000
+#define NVC0_3D_QUERY_GET_SYNC_COND__SHIFT                     16
+#define NVC0_3D_QUERY_GET_SYNC_COND_NEQUAL                     0x00000000
+#define NVC0_3D_QUERY_GET_SYNC_COND_GREATER                    0x00010000
+#define NVC0_3D_QUERY_GET_INTR                                 0x00100000
+#define NVC0_3D_QUERY_GET_UNK21                                        0x00200000
+#define NVC0_3D_QUERY_GET_SELECT__MASK                         0x0f800000
+#define NVC0_3D_QUERY_GET_SELECT__SHIFT                                23
+#define NVC0_3D_QUERY_GET_SELECT_ZERO                          0x00000000
+#define NVC0_3D_QUERY_GET_SELECT_SAMPLECNT                     0x01000000
+#define NVC0_3D_QUERY_GET_SELECT_EMITTED_PRIMS                 0x05800000
+#define NVC0_3D_QUERY_GET_SELECT_GENERATED_PRIMS               0x09000000
+#define NVC0_3D_QUERY_GET_SHORT                                        0x10000000
+
+#define NVC0_3D_VERTEX_ARRAY_FETCH(i0)                        (0x00001c00 + 0x10*(i0))
+#define NVC0_3D_VERTEX_ARRAY_FETCH__ESIZE                      0x00000010
+#define NVC0_3D_VERTEX_ARRAY_FETCH__LEN                                0x00000020
+#define NVC0_3D_VERTEX_ARRAY_FETCH_STRIDE__MASK                        0x00000fff
+#define NVC0_3D_VERTEX_ARRAY_FETCH_STRIDE__SHIFT               0
+#define NVC0_3D_VERTEX_ARRAY_FETCH_ENABLE                      0x00001000
+
+#define NVC0_3D_VERTEX_ARRAY_START_HIGH(i0)                   (0x00001c04 + 0x10*(i0))
+#define NVC0_3D_VERTEX_ARRAY_START_HIGH__ESIZE                 0x00000010
+#define NVC0_3D_VERTEX_ARRAY_START_HIGH__LEN                   0x00000020
+
+#define NVC0_3D_VERTEX_ARRAY_START_LOW(i0)                    (0x00001c08 + 0x10*(i0))
+#define NVC0_3D_VERTEX_ARRAY_START_LOW__ESIZE                  0x00000010
+#define NVC0_3D_VERTEX_ARRAY_START_LOW__LEN                    0x00000020
+
+#define NVC0_3D_VERTEX_ARRAY_DIVISOR(i0)                      (0x00001c0c + 0x10*(i0))
+#define NVC0_3D_VERTEX_ARRAY_DIVISOR__ESIZE                    0x00000010
+#define NVC0_3D_VERTEX_ARRAY_DIVISOR__LEN                      0x00000020
+
+#define NVC0_3D_IBLEND(i0)                                    (0x00001e00 + 0x20*(i0))
+#define NVC0_3D_IBLEND__ESIZE                                  0x00000020
+#define NVC0_3D_IBLEND__LEN                                    0x00000008
+
+#define NVC0_3D_IBLEND_EQUATION_RGB(i0)                               (0x00001e04 + 0x20*(i0))
+#define NVC0_3D_IBLEND_EQUATION_RGB_FUNC_ADD                   0x00008006
+#define NVC0_3D_IBLEND_EQUATION_RGB_MIN                                0x00008007
+#define NVC0_3D_IBLEND_EQUATION_RGB_MAX                                0x00008008
+#define NVC0_3D_IBLEND_EQUATION_RGB_FUNC_SUBTRACT              0x0000800a
+#define NVC0_3D_IBLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT      0x0000800b
+
+#define NVC0_3D_IBLEND_FUNC_SRC_RGB(i0)                               (0x00001e08 + 0x20*(i0))
+
+#define NVC0_3D_IBLEND_FUNC_DST_RGB(i0)                               (0x00001e0c + 0x20*(i0))
+
+#define NVC0_3D_IBLEND_EQUATION_ALPHA(i0)                     (0x00001e10 + 0x20*(i0))
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_FUNC_ADD                 0x00008006
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_MIN                      0x00008007
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_MAX                      0x00008008
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_FUNC_SUBTRACT            0x0000800a
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT    0x0000800b
+
+#define NVC0_3D_IBLEND_FUNC_SRC_ALPHA(i0)                     (0x00001e14 + 0x20*(i0))
+
+#define NVC0_3D_IBLEND_FUNC_DST_ALPHA(i0)                     (0x00001e18 + 0x20*(i0))
+
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_HIGH(i0)                   (0x00001f00 + 0x8*(i0))
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_HIGH__ESIZE                 0x00000008
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_HIGH__LEN                   0x00000020
+
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_LOW(i0)                    (0x00001f04 + 0x8*(i0))
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_LOW__ESIZE                  0x00000008
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_LOW__LEN                    0x00000020
+
+#define NVC0_3D_SP(i0)                                        (0x00002000 + 0x40*(i0))
+#define NVC0_3D_SP__ESIZE                                      0x00000040
+#define NVC0_3D_SP__LEN                                                0x00000006
+
+#define NVC0_3D_SP_SELECT(i0)                                 (0x00002000 + 0x40*(i0))
+#define NVC0_3D_SP_SELECT_ENABLE                               0x00000001
+#define NVC0_3D_SP_SELECT_PROGRAM__MASK                                0x00000070
+#define NVC0_3D_SP_SELECT_PROGRAM__SHIFT                       4
+#define NVC0_3D_SP_SELECT_PROGRAM_VP_A                         0x00000000
+#define NVC0_3D_SP_SELECT_PROGRAM_VP_B                         0x00000010
+#define NVC0_3D_SP_SELECT_PROGRAM_TCP                          0x00000020
+#define NVC0_3D_SP_SELECT_PROGRAM_TEP                          0x00000030
+#define NVC0_3D_SP_SELECT_PROGRAM_GP                           0x00000040
+#define NVC0_3D_SP_SELECT_PROGRAM_FP                           0x00000050
+
+#define NVC0_3D_SP_START_ID(i0)                                       (0x00002004 + 0x40*(i0))
+
+#define NVC0_3D_SP_GPR_ALLOC(i0)                              (0x0000200c + 0x40*(i0))
+
+#define NVC0_3D_TEX_LIMITS(i0)                                (0x00002200 + 0x10*(i0))
+#define NVC0_3D_TEX_LIMITS__ESIZE                              0x00000010
+#define NVC0_3D_TEX_LIMITS__LEN                                        0x00000005
+
+#define NVC0_3D_FIRMWARE(i0)                                  (0x00002300 + 0x4*(i0))
+#define NVC0_3D_FIRMWARE__ESIZE                                        0x00000004
+#define NVC0_3D_FIRMWARE__LEN                                  0x00000020
+
+#define NVC0_3D_CB_SIZE                                                0x00002380
+
+#define NVC0_3D_CB_ADDRESS_HIGH                                        0x00002384
+
+#define NVC0_3D_CB_ADDRESS_LOW                                 0x00002388
+
+#define NVC0_3D_CB_POS                                         0x0000238c
+
+#define NVC0_3D_CB_DATA(i0)                                   (0x00002390 + 0x4*(i0))
+#define NVC0_3D_CB_DATA__ESIZE                                 0x00000004
+#define NVC0_3D_CB_DATA__LEN                                   0x00000010
+
+#define NVC0_3D_BIND_TSC(i0)                                  (0x00002400 + 0x20*(i0))
+#define NVC0_3D_BIND_TSC__ESIZE                                        0x00000020
+#define NVC0_3D_BIND_TSC__LEN                                  0x00000005
+#define NVC0_3D_BIND_TSC_ACTIVE                                        0x00000001
+#define NVC0_3D_BIND_TSC_SAMPLER__MASK                         0x00000ff0
+#define NVC0_3D_BIND_TSC_SAMPLER__SHIFT                                4
+#define NVC0_3D_BIND_TSC_TSC__MASK                             0x01fff000
+#define NVC0_3D_BIND_TSC_TSC__SHIFT                            12
+
+#define NVC0_3D_BIND_TIC(i0)                                  (0x00002404 + 0x20*(i0))
+#define NVC0_3D_BIND_TIC__ESIZE                                        0x00000020
+#define NVC0_3D_BIND_TIC__LEN                                  0x00000005
+#define NVC0_3D_BIND_TIC_ACTIVE                                        0x00000001
+#define NVC0_3D_BIND_TIC_TEXTURE__MASK                         0x000001fe
+#define NVC0_3D_BIND_TIC_TEXTURE__SHIFT                                1
+#define NVC0_3D_BIND_TIC_TIC__MASK                             0x7ffffe00
+#define NVC0_3D_BIND_TIC_TIC__SHIFT                            9
+
+#define NVC0_3D_CB_BIND(i0)                                   (0x00002410 + 0x20*(i0))
+#define NVC0_3D_CB_BIND__ESIZE                                 0x00000020
+#define NVC0_3D_CB_BIND__LEN                                   0x00000005
+#define NVC0_3D_CB_BIND_VALID                                  0x00000001
+#define NVC0_3D_CB_BIND_INDEX__MASK                            0x000000f0
+#define NVC0_3D_CB_BIND_INDEX__SHIFT                           4
+
+#define NVC0_3D_VERT_COLOR_CLAMP_EN                            0x00002600
+
+#define NVC0_3D_TFB_VARYING_LOCS(i0)                          (0x00002800 + 0x4*(i0))
+#define NVC0_3D_TFB_VARYING_LOCS__ESIZE                                0x00000004
+#define NVC0_3D_TFB_VARYING_LOCS__LEN                          0x00000080
+
+#define NVC0_3D_COLOR_MASK_BROADCAST                           0x00003808
+
+#define NVC0_3D_VERTEX_ARRAY_SELECT                            0x00003820
+
+#define NVC0_3D_BLEND_ENABLES                                  0x00003858
+
+#define NVC0_3D_POLYGON_MODE_FRONT                             0x00003868
+#define NVC0_3D_POLYGON_MODE_FRONT_POINT                       0x00001b00
+#define NVC0_3D_POLYGON_MODE_FRONT_LINE                                0x00001b01
+#define NVC0_3D_POLYGON_MODE_FRONT_FILL                                0x00001b02
+
+#define NVC0_3D_POLYGON_MODE_BACK                              0x00003870
+#define NVC0_3D_POLYGON_MODE_BACK_POINT                                0x00001b00
+#define NVC0_3D_POLYGON_MODE_BACK_LINE                         0x00001b01
+#define NVC0_3D_POLYGON_MODE_BACK_FILL                         0x00001b02
+
+#define NVC0_3D_GP_SELECT                                      0x00003878
+
+#define NVC0_3D_TEP_SELECT                                     0x00003880
+
+
+#endif /* NVC0_3D_XML */
diff --git a/src/gallium/drivers/nvc0/nvc0_3ddefs.xml.h b/src/gallium/drivers/nvc0/nvc0_3ddefs.xml.h
new file mode 100644 (file)
index 0000000..84b1522
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef NV_3DDEFS_XML
+#define NV_3DDEFS_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nvc0_3d.xml    (  26312 bytes, from 2010-10-08 10:10:01)
+- copyright.xml  (   6498 bytes, from 2010-10-03 13:18:37)
+- nv_defs.xml    (   4437 bytes, from 2010-07-06 07:43:58)
+- nv_3ddefs.xml  (  16397 bytes, from 2010-10-08 13:30:38)
+- nv_object.xml  (  11249 bytes, from 2010-10-07 15:31:28)
+- nvchipsets.xml (   2824 bytes, from 2010-07-07 13:41:20)
+- nv50_defs.xml  (   4482 bytes, from 2010-10-03 13:18:37)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin KoÅ›cielnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+#define NV50_3D_BLEND_FACTOR_ZERO                              0x00004000
+#define NV50_3D_BLEND_FACTOR_ONE                               0x00004001
+#define NV50_3D_BLEND_FACTOR_SRC_COLOR                         0x00004300
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC_COLOR               0x00004301
+#define NV50_3D_BLEND_FACTOR_SRC_ALPHA                         0x00004302
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA               0x00004303
+#define NV50_3D_BLEND_FACTOR_DST_ALPHA                         0x00004304
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_DST_ALPHA               0x00004305
+#define NV50_3D_BLEND_FACTOR_DST_COLOR                         0x00004306
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_DST_COLOR               0x00004307
+#define NV50_3D_BLEND_FACTOR_SRC_ALPHA_SATURATE                        0x00004308
+#define NV50_3D_BLEND_FACTOR_CONSTANT_COLOR                    0x0000c001
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR          0x0000c002
+#define NV50_3D_BLEND_FACTOR_CONSTANT_ALPHA                    0x0000c003
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA          0x0000c004
+#define NV50_3D_BLEND_FACTOR_SRC1_COLOR                                0x0000c900
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR              0x0000c901
+#define NV50_3D_BLEND_FACTOR_SRC1_ALPHA                                0x0000c902
+#define NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA              0x0000c903
+
+#endif /* NV_3DDEFS_XML */
diff --git a/src/gallium/drivers/nvc0/nvc0_buffer.c b/src/gallium/drivers/nvc0/nvc0_buffer.c
new file mode 100644 (file)
index 0000000..ea3e642
--- /dev/null
@@ -0,0 +1,489 @@
+
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_math.h"
+
+#define NOUVEAU_NVC0
+#include "nouveau/nouveau_screen.h"
+#include "nouveau/nouveau_winsys.h"
+#undef NOUVEAU_NVC0
+
+#include "nvc0_context.h"
+#include "nvc0_resource.h"
+
+struct nvc0_transfer {
+   struct pipe_transfer base;
+};
+
+static INLINE struct nvc0_transfer *
+nvc0_transfer(struct pipe_transfer *transfer)
+{
+   return (struct nvc0_transfer *)transfer;
+}
+
+static INLINE boolean
+nvc0_buffer_allocate(struct nvc0_screen *screen, struct nvc0_resource *buf,
+                     unsigned domain)
+{
+   if (domain == NOUVEAU_BO_VRAM) {
+      buf->mm = nvc0_mm_allocate(screen->mm_VRAM, buf->base.width0, &buf->bo,
+                                 &buf->offset);
+      if (!buf->bo)
+         return nvc0_buffer_allocate(screen, buf, NOUVEAU_BO_GART);
+   } else
+   if (domain == NOUVEAU_BO_GART) {
+      buf->mm = nvc0_mm_allocate(screen->mm_GART, buf->base.width0, &buf->bo,
+                                 &buf->offset);
+      if (!buf->bo)
+         return FALSE;
+   }
+   if (domain != NOUVEAU_BO_GART) {
+      if (!buf->data) {
+         buf->data = MALLOC(buf->base.width0);
+         if (!buf->data)
+            return FALSE;
+      }
+   }
+   buf->domain = domain;
+   return TRUE;
+}
+
+static INLINE void
+release_allocation(struct nvc0_mm_allocation **mm, struct nvc0_fence *fence)
+{
+   if (fence && fence->state != NVC0_FENCE_STATE_SIGNALLED) {
+      nvc0_fence_sched_release(fence, *mm);
+   } else {
+      nvc0_mm_free(*mm);
+   }
+   (*mm) = NULL;
+}
+
+static INLINE boolean
+nvc0_buffer_reallocate(struct nvc0_screen *screen, struct nvc0_resource *buf,
+                       unsigned domain)
+{
+   nouveau_bo_ref(NULL, &buf->bo);
+
+   if (buf->mm)
+      release_allocation(&buf->mm, buf->fence);
+
+   return nvc0_buffer_allocate(screen, buf, domain);
+}
+
+static void
+nvc0_buffer_destroy(struct pipe_screen *pscreen,
+                    struct pipe_resource *presource)
+{
+   struct nvc0_resource *res = nvc0_resource(presource);
+
+   nouveau_bo_ref(NULL, &res->bo);
+
+   if (res->mm)
+      release_allocation(&res->mm, res->fence);
+
+   if (res->data && !(res->status & NVC0_BUFFER_STATUS_USER_MEMORY))
+      FREE(res->data);
+
+   FREE(res);
+}
+
+/* Maybe just migrate to GART right away if we actually need to do this. */
+boolean
+nvc0_buffer_download(struct nvc0_context *nvc0, struct nvc0_resource *buf,
+                     unsigned start, unsigned size)
+{
+   struct nvc0_mm_allocation *mm;
+   struct nouveau_bo *bounce = NULL;
+   uint32_t offset;
+
+   assert(buf->domain == NOUVEAU_BO_VRAM);
+
+   mm = nvc0_mm_allocate(nvc0->screen->mm_GART, size, &bounce, &offset);
+   if (!bounce)
+      return FALSE;
+
+   nvc0_m2mf_copy_linear(nvc0, bounce, offset, NOUVEAU_BO_GART,
+                         buf->bo, buf->offset + start, NOUVEAU_BO_VRAM,
+                         size);
+
+   if (nouveau_bo_map_range(bounce, offset, size, NOUVEAU_BO_RD))
+      return FALSE;
+   memcpy(buf->data + start, bounce->map, size);
+   nouveau_bo_unmap(bounce);
+
+   buf->status &= ~NVC0_BUFFER_STATUS_DIRTY;
+
+   nouveau_bo_ref(NULL, &bounce);
+   if (mm)
+      nvc0_mm_free(mm);
+   return TRUE;
+}
+
+static boolean
+nvc0_buffer_upload(struct nvc0_context *nvc0, struct nvc0_resource *buf,
+                   unsigned start, unsigned size)
+{
+   struct nvc0_mm_allocation *mm;
+   struct nouveau_bo *bounce = NULL;
+   uint32_t offset;
+
+   if (size <= 192) {
+      nvc0_m2mf_push_linear(nvc0, buf->bo, buf->domain, buf->offset + start,
+                            size, buf->data + start);
+      return TRUE;
+   }
+
+   mm = nvc0_mm_allocate(nvc0->screen->mm_GART, size, &bounce, &offset);
+   if (!bounce)
+      return FALSE;
+
+   nouveau_bo_map_range(bounce, offset, size,
+                        NOUVEAU_BO_WR | NOUVEAU_BO_NOSYNC);
+   memcpy(bounce->map, buf->data + start, size);
+   nouveau_bo_unmap(bounce);
+
+   nvc0_m2mf_copy_linear(nvc0, buf->bo, buf->offset + start, NOUVEAU_BO_VRAM,
+                         bounce, offset, NOUVEAU_BO_GART, size);
+
+   nouveau_bo_ref(NULL, &bounce);
+   if (mm)
+      release_allocation(&mm, nvc0->screen->fence.current);
+
+   if (start == 0 && size == buf->base.width0)
+      buf->status &= ~NVC0_BUFFER_STATUS_DIRTY;
+   return TRUE;
+}
+
+static struct pipe_transfer *
+nvc0_buffer_transfer_get(struct pipe_context *pipe,
+                         struct pipe_resource *resource,
+                         unsigned level,
+                         unsigned usage,
+                         const struct pipe_box *box)
+{
+   struct nvc0_resource *buf = nvc0_resource(resource);
+   struct nvc0_transfer *xfr = CALLOC_STRUCT(nvc0_transfer);
+   if (!xfr)
+      return NULL;
+
+   xfr->base.resource = resource;
+   xfr->base.box.x = box->x;
+   xfr->base.box.width = box->width;
+   xfr->base.usage = usage;
+
+   if (buf->domain == NOUVEAU_BO_VRAM) {
+      if (usage & PIPE_TRANSFER_READ) {
+         if (buf->status & NVC0_BUFFER_STATUS_DIRTY)
+            nvc0_buffer_download(nvc0_context(pipe), buf, 0, buf->base.width0);
+      }
+   }
+
+   return &xfr->base;
+}
+
+static void
+nvc0_buffer_transfer_destroy(struct pipe_context *pipe,
+                             struct pipe_transfer *transfer)
+{
+   struct nvc0_resource *buf = nvc0_resource(transfer->resource);
+   struct nvc0_transfer *xfr = nvc0_transfer(transfer);
+
+   if (xfr->base.usage & PIPE_TRANSFER_WRITE) {
+      /* writing is worse */
+      nvc0_buffer_adjust_score(nvc0_context(pipe), buf, -5000);
+
+      if (buf->domain == NOUVEAU_BO_VRAM) {
+         nvc0_buffer_upload(nvc0_context(pipe), buf,
+                            transfer->box.x, transfer->box.width);
+      }
+
+      if (buf->domain != 0 && (buf->base.bind & (PIPE_BIND_VERTEX_BUFFER |
+                                                 PIPE_BIND_INDEX_BUFFER)))
+         nvc0_context(pipe)->vbo_dirty = TRUE;
+   }
+
+   FREE(xfr);
+}
+
+static INLINE boolean
+nvc0_buffer_sync(struct nvc0_resource *buf, unsigned rw)
+{
+   if (rw == PIPE_TRANSFER_READ) {
+      if (!buf->fence_wr)
+         return TRUE;
+      if (!nvc0_fence_wait(buf->fence_wr))
+         return FALSE;
+   } else {
+      if (!buf->fence)
+         return TRUE;
+      if (!nvc0_fence_wait(buf->fence))
+         return FALSE;
+
+      nvc0_fence_reference(&buf->fence, NULL);
+   }
+   nvc0_fence_reference(&buf->fence_wr, NULL);
+
+   return TRUE;
+}
+
+static INLINE boolean
+nvc0_buffer_busy(struct nvc0_resource *buf, unsigned rw)
+{
+   if (rw == PIPE_TRANSFER_READ)
+      return (buf->fence_wr && !nvc0_fence_signalled(buf->fence_wr));
+   else
+      return (buf->fence && !nvc0_fence_signalled(buf->fence));
+}
+
+static void *
+nvc0_buffer_transfer_map(struct pipe_context *pipe,
+                         struct pipe_transfer *transfer)
+{
+   struct nvc0_transfer *xfr = nvc0_transfer(transfer);
+   struct nvc0_resource *buf = nvc0_resource(transfer->resource);
+   struct nouveau_bo *bo = buf->bo;
+   uint8_t *map;
+   int ret;
+   uint32_t offset = xfr->base.box.x;
+   uint32_t flags;
+
+   nvc0_buffer_adjust_score(nvc0_context(pipe), buf, -250);
+
+   if (buf->domain != NOUVEAU_BO_GART)
+      return buf->data + offset;
+
+   if (buf->mm)
+      flags = NOUVEAU_BO_NOSYNC | NOUVEAU_BO_RDWR;
+   else
+      flags = nouveau_screen_transfer_flags(xfr->base.usage);
+
+   offset += buf->offset;
+
+   ret = nouveau_bo_map_range(buf->bo, offset, xfr->base.box.width, flags);
+   if (ret)
+      return NULL;
+   map = bo->map;
+
+   /* Unmap right now. Since multiple buffers can share a single nouveau_bo,
+    * not doing so might make future maps fail or trigger "reloc while mapped"
+    * errors. For now, mappings to userspace are guaranteed to be persistent.
+    */
+   nouveau_bo_unmap(bo);
+
+   if (buf->mm) {
+      if (xfr->base.usage & PIPE_TRANSFER_DONTBLOCK) {
+         if (nvc0_buffer_busy(buf, xfr->base.usage & PIPE_TRANSFER_READ_WRITE))
+            return NULL;
+      } else
+      if (!(xfr->base.usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
+         nvc0_buffer_sync(buf, xfr->base.usage & PIPE_TRANSFER_READ_WRITE);
+      }
+   }
+   return map;
+}
+
+
+
+static void
+nvc0_buffer_transfer_flush_region(struct pipe_context *pipe,
+                                  struct pipe_transfer *transfer,
+                                  const struct pipe_box *box)
+{
+   struct nvc0_resource *res = nvc0_resource(transfer->resource);
+   struct nouveau_bo *bo = res->bo;
+   unsigned offset = res->offset + transfer->box.x + box->x;
+
+   /* not using non-snoop system memory yet, no need for cflush */
+   if (1)
+      return;
+
+   /* XXX: maybe need to upload for VRAM buffers here */
+
+   nouveau_screen_bo_map_flush_range(pipe->screen, bo, offset, box->width);
+}
+
+static void
+nvc0_buffer_transfer_unmap(struct pipe_context *pipe,
+                           struct pipe_transfer *transfer)
+{
+   /* we've called nouveau_bo_unmap right after map */
+}
+
+const struct u_resource_vtbl nvc0_buffer_vtbl =
+{
+   u_default_resource_get_handle,     /* get_handle */
+   nvc0_buffer_destroy,               /* resource_destroy */
+   NULL,                              /* is_resource_referenced */
+   nvc0_buffer_transfer_get,          /* get_transfer */
+   nvc0_buffer_transfer_destroy,      /* transfer_destroy */
+   nvc0_buffer_transfer_map,          /* transfer_map */
+   nvc0_buffer_transfer_flush_region, /* transfer_flush_region */
+   nvc0_buffer_transfer_unmap,        /* transfer_unmap */
+   u_default_transfer_inline_write    /* transfer_inline_write */
+};
+
+struct pipe_resource *
+nvc0_buffer_create(struct pipe_screen *pscreen,
+                   const struct pipe_resource *templ)
+{
+   struct nvc0_screen *screen = nvc0_screen(pscreen);
+   struct nvc0_resource *buffer;
+   boolean ret;
+
+   buffer = CALLOC_STRUCT(nvc0_resource);
+   if (!buffer)
+      return NULL;
+
+   buffer->base = *templ;
+   buffer->vtbl = &nvc0_buffer_vtbl;
+   pipe_reference_init(&buffer->base.reference, 1);
+   buffer->base.screen = pscreen;
+
+   if (buffer->base.bind & PIPE_BIND_CONSTANT_BUFFER)
+      ret = nvc0_buffer_allocate(screen, buffer, 0);
+   else
+      ret = nvc0_buffer_allocate(screen, buffer, NOUVEAU_BO_GART);
+
+   if (ret == FALSE)
+      goto fail;
+
+   return &buffer->base;
+
+fail:
+   FREE(buffer);
+   return NULL;
+}
+
+
+struct pipe_resource *
+nvc0_user_buffer_create(struct pipe_screen *pscreen,
+                        void *ptr,
+                        unsigned bytes,
+                        unsigned bind)
+{
+   struct nvc0_resource *buffer;
+
+   buffer = CALLOC_STRUCT(nvc0_resource);
+   if (!buffer)
+      return NULL;
+
+   pipe_reference_init(&buffer->base.reference, 1);
+   buffer->vtbl = &nvc0_buffer_vtbl;
+   buffer->base.screen = pscreen;
+   buffer->base.format = PIPE_FORMAT_R8_UNORM;
+   buffer->base.usage = PIPE_USAGE_IMMUTABLE;
+   buffer->base.bind = bind;
+   buffer->base.width0 = bytes;
+   buffer->base.height0 = 1;
+   buffer->base.depth0 = 1;
+
+   buffer->data = ptr;
+   buffer->status = NVC0_BUFFER_STATUS_USER_MEMORY;
+
+   return &buffer->base;
+}
+
+/* Like download, but for GART buffers. Merge ? */
+static INLINE boolean
+nvc0_buffer_data_fetch(struct nvc0_resource *buf,
+                       struct nouveau_bo *bo, unsigned offset, unsigned size)
+{
+   if (!buf->data) {
+      buf->data = MALLOC(size);
+      if (!buf->data)
+         return FALSE;
+   }
+   if (nouveau_bo_map_range(bo, offset, size, NOUVEAU_BO_RD))
+      return FALSE;
+   memcpy(buf->data, bo->map, size);
+   nouveau_bo_unmap(bo);
+
+   return TRUE;
+}
+
+/* Migrate a linear buffer (vertex, index, constants) USER -> GART -> VRAM. */
+boolean
+nvc0_buffer_migrate(struct nvc0_context *nvc0,
+                    struct nvc0_resource *buf, const unsigned new_domain)
+{
+   struct nvc0_screen *screen = nvc0_screen(buf->base.screen);
+   struct nouveau_bo *bo;
+   const unsigned old_domain = buf->domain;
+   unsigned size = buf->base.width0;
+   unsigned offset;
+   int ret;
+
+   assert(new_domain != old_domain);
+
+   if (new_domain == NOUVEAU_BO_GART && old_domain == 0) {
+      if (!nvc0_buffer_allocate(screen, buf, new_domain))
+         return FALSE;
+      ret = nouveau_bo_map_range(buf->bo, buf->offset, size, NOUVEAU_BO_WR |
+                                 NOUVEAU_BO_NOSYNC);
+      if (ret)
+         return ret;
+      memcpy(buf->bo->map, buf->data, size);
+      nouveau_bo_unmap(buf->bo);
+      FREE(buf->data);
+   } else
+   if (old_domain != 0 && new_domain != 0) {
+      struct nvc0_mm_allocation *mm = buf->mm;
+
+      if (new_domain == NOUVEAU_BO_VRAM) {
+         /* keep a system memory copy of our data in case we hit a fallback */
+         if (!nvc0_buffer_data_fetch(buf, buf->bo, buf->offset, size))
+            return FALSE;
+         debug_printf("migrating %u KiB to VRAM\n", size / 1024);
+      }
+
+      offset = buf->offset;
+      bo = buf->bo;
+      buf->bo = NULL;
+      buf->mm = NULL;
+      nvc0_buffer_allocate(screen, buf, new_domain);
+
+      nvc0_m2mf_copy_linear(nvc0, buf->bo, buf->offset, new_domain,
+                            bo, offset, old_domain, buf->base.width0);
+
+      nouveau_bo_ref(NULL, &bo);
+      if (mm)
+         release_allocation(&mm, screen->fence.current);
+   } else
+   if (new_domain == NOUVEAU_BO_VRAM && old_domain == 0) {
+      if (!nvc0_buffer_allocate(screen, buf, NOUVEAU_BO_VRAM))
+         return FALSE;
+      if (!nvc0_buffer_upload(nvc0, buf, 0, buf->base.width0))
+         return FALSE;
+   } else
+      return FALSE;
+
+   assert(buf->domain == new_domain);
+   return TRUE;
+}
+
+/* Migrate data from glVertexAttribPointer(non-VBO) user buffers to GART.
+ * We'd like to only allocate @size bytes here, but then we'd have to rebase
+ * the vertex indices ...
+ */
+boolean
+nvc0_user_buffer_upload(struct nvc0_resource *buf, unsigned base, unsigned size)
+{
+   struct nvc0_screen *screen = nvc0_screen(buf->base.screen);
+   int ret;
+
+   assert(buf->status & NVC0_BUFFER_STATUS_USER_MEMORY);
+
+   buf->base.width0 = base + size;
+   if (!nvc0_buffer_reallocate(screen, buf, NOUVEAU_BO_GART))
+      return FALSE;
+
+   ret = nouveau_bo_map_range(buf->bo, buf->offset + base, size,
+                              NOUVEAU_BO_WR | NOUVEAU_BO_NOSYNC);
+   if (ret)
+      return FALSE;
+   memcpy(buf->bo->map, buf->data + base, size);
+   nouveau_bo_unmap(buf->bo);
+
+   return TRUE;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c
new file mode 100644 (file)
index 0000000..2118abb
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "draw/draw_context.h"
+#include "pipe/p_defines.h"
+
+#include "nvc0_context.h"
+#include "nvc0_screen.h"
+#include "nvc0_resource.h"
+
+#include "nouveau/nouveau_reloc.h"
+
+static void
+nvc0_flush(struct pipe_context *pipe, unsigned flags,
+           struct pipe_fence_handle **fence)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+   if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
+      BEGIN_RING(chan, RING_3D(SERIALIZE), 1);
+      OUT_RING  (chan, 0);
+      BEGIN_RING(chan, RING_3D(TEX_CACHE_CTL), 1);
+      OUT_RING  (chan, 0x00);
+   }
+
+   if (fence) {
+      nvc0_screen_fence_new(nvc0->screen, (struct nvc0_fence **)fence, TRUE);
+   }
+
+   if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME)) {
+      FIRE_RING(chan);
+
+      nvc0_screen_fence_next(nvc0->screen);
+   }
+}
+
+static void
+nvc0_destroy(struct pipe_context *pipe)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+   draw_destroy(nvc0->draw);
+
+   if (nvc0->screen->cur_ctx == nvc0)
+      nvc0->screen->cur_ctx = NULL;
+
+   FREE(nvc0);
+}
+
+struct pipe_context *
+nvc0_create(struct pipe_screen *pscreen, void *priv)
+{
+   struct pipe_winsys *pipe_winsys = pscreen->winsys;
+   struct nvc0_screen *screen = nvc0_screen(pscreen);
+   struct nvc0_context *nvc0;
+
+   nvc0 = CALLOC_STRUCT(nvc0_context);
+   if (!nvc0)
+      return NULL;
+   nvc0->screen = screen;
+
+   nvc0->pipe.winsys = pipe_winsys;
+   nvc0->pipe.screen = pscreen;
+   nvc0->pipe.priv = priv;
+
+   nvc0->pipe.destroy = nvc0_destroy;
+
+   nvc0->pipe.draw_vbo = nvc0_draw_vbo;
+   nvc0->pipe.clear = nvc0_clear;
+
+   nvc0->pipe.flush = nvc0_flush;
+
+   screen->base.channel->user_private = nvc0;
+
+   nvc0_init_query_functions(nvc0);
+   nvc0_init_surface_functions(nvc0);
+   nvc0_init_state_functions(nvc0);
+   nvc0_init_resource_functions(&nvc0->pipe);
+
+   nvc0->draw = draw_create(&nvc0->pipe);
+   assert(nvc0->draw);
+   draw_set_rasterize_stage(nvc0->draw, nvc0_draw_render_stage(nvc0));
+
+   return &nvc0->pipe;
+}
+
+struct resident {
+   struct nvc0_resource *res;
+   uint32_t flags;
+};
+
+void
+nvc0_bufctx_add_resident(struct nvc0_context *nvc0, int ctx,
+                         struct nvc0_resource *resource, uint32_t flags)
+{
+   struct resident rsd = { resource, flags };
+
+   if (!resource->bo)
+      return;
+
+   /* We don't need to reference the resource here, it will be referenced
+    * in the context/state, and bufctx will be reset when state changes.
+    */
+   util_dynarray_append(&nvc0->residents[ctx], struct resident, rsd);
+}
+
+void
+nvc0_bufctx_del_resident(struct nvc0_context *nvc0, int ctx,
+                         struct nvc0_resource *resource)
+{
+   struct resident *rsd, *top;
+   unsigned i;
+
+   for (i = 0; i < nvc0->residents[ctx].size / sizeof(struct resident); ++i) {
+      rsd = util_dynarray_element(&nvc0->residents[ctx], struct resident, i);
+
+      if (rsd->res == resource) {
+         top = util_dynarray_pop_ptr(&nvc0->residents[ctx], struct resident);
+         if (rsd != top)
+            *rsd = *top;
+         break;
+      }
+   }
+}
+
+void
+nvc0_bufctx_emit_relocs(struct nvc0_context *nvc0)
+{
+   struct resident *rsd;
+   struct util_dynarray *array;
+   unsigned ctx, i;
+
+   for (ctx = 0; ctx < NVC0_BUFCTX_COUNT; ++ctx) {
+      array = &nvc0->residents[ctx];
+
+      for (i = 0; i < array->size / sizeof(struct resident); ++i) {
+         rsd = util_dynarray_element(array, struct resident, i);
+
+         nvc0_resource_validate(rsd->res, rsd->flags);
+      }
+   }
+
+   nvc0_screen_make_buffers_resident(nvc0->screen);
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_context.h b/src/gallium/drivers/nvc0/nvc0_context.h
new file mode 100644 (file)
index 0000000..eeb5bef
--- /dev/null
@@ -0,0 +1,227 @@
+#ifndef __NVC0_CONTEXT_H__
+#define __NVC0_CONTEXT_H__
+
+#include <stdio.h>
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_state.h"
+
+#include "util/u_memory.h"
+#include "util/u_math.h"
+#include "util/u_inlines.h"
+#include "util/u_dynarray.h"
+
+#include "draw/draw_vertex.h"
+
+#include "nvc0_winsys.h"
+#include "nvc0_stateobj.h"
+#include "nvc0_screen.h"
+#include "nvc0_program.h"
+#include "nvc0_resource.h"
+
+#include "nvc0_3ddefs.xml.h"
+#include "nvc0_3d.xml.h"
+#include "nvc0_2d.xml.h"
+#include "nvc0_m2mf.xml.h"
+
+#define NOUVEAU_ERR(fmt, args...) \
+   fprintf(stderr, "%s:%d -  "fmt, __FUNCTION__, __LINE__, ##args);
+
+#ifdef NOUVEAU_DEBUG
+# define NOUVEAU_DBG(args...) printf(args);
+#else
+# define NOUVEAU_DBG(args...)
+#endif
+
+#define NVC0_NEW_BLEND        (1 << 0)
+#define NVC0_NEW_RASTERIZER   (1 << 1)
+#define NVC0_NEW_ZSA          (1 << 2)
+#define NVC0_NEW_VERTPROG     (1 << 3)
+#define NVC0_NEW_TCTLPROG     (1 << 4)
+#define NVC0_NEW_TEVLPROG     (1 << 5)
+#define NVC0_NEW_GMTYPROG     (1 << 6)
+#define NVC0_NEW_FRAGPROG     (1 << 7)
+#define NVC0_NEW_BLEND_COLOUR (1 << 8)
+#define NVC0_NEW_STENCIL_REF  (1 << 9)
+#define NVC0_NEW_CLIP         (1 << 10)
+#define NVC0_NEW_SAMPLE_MASK  (1 << 11)
+#define NVC0_NEW_FRAMEBUFFER  (1 << 12)
+#define NVC0_NEW_STIPPLE      (1 << 13)
+#define NVC0_NEW_SCISSOR      (1 << 14)
+#define NVC0_NEW_VIEWPORT     (1 << 15)
+#define NVC0_NEW_ARRAYS       (1 << 16)
+#define NVC0_NEW_VERTEX       (1 << 17)
+#define NVC0_NEW_CONSTBUF     (1 << 18)
+#define NVC0_NEW_TEXTURES     (1 << 19)
+#define NVC0_NEW_SAMPLERS     (1 << 20)
+
+#define NVC0_BUFCTX_CONSTANT 0
+#define NVC0_BUFCTX_FRAME    1
+#define NVC0_BUFCTX_VERTEX   2
+#define NVC0_BUFCTX_TEXTURES 3
+#define NVC0_BUFCTX_COUNT    4
+
+struct nvc0_context {
+   struct pipe_context pipe;
+
+   struct nvc0_screen *screen;
+
+   struct util_dynarray residents[NVC0_BUFCTX_COUNT];
+
+   uint32_t dirty;
+
+   struct {
+      uint32_t instance_bits;
+      uint32_t instance_base;
+      int32_t index_bias;
+      boolean prim_restart;
+      uint8_t num_vtxbufs;
+      uint8_t num_vtxelts;
+      uint8_t num_textures[5];
+      uint8_t num_samplers[5];
+      uint16_t scissor;
+      uint32_t uniform_buffer_bound[5];
+   } state;
+
+   struct nvc0_blend_stateobj *blend;
+   struct nvc0_rasterizer_stateobj *rast;
+   struct nvc0_zsa_stateobj *zsa;
+   struct nvc0_vertex_stateobj *vertex;
+
+   struct nvc0_program *vertprog;
+   struct nvc0_program *tctlprog;
+   struct nvc0_program *tevlprog;
+   struct nvc0_program *gmtyprog;
+   struct nvc0_program *fragprog;
+
+   struct pipe_resource *constbuf[5][16];
+   uint16_t constbuf_dirty[5];
+
+   struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
+   unsigned num_vtxbufs;
+   struct pipe_index_buffer idxbuf;
+   uint32_t vbo_fifo; /* bitmask of vertex elements to be pushed to FIFO */
+   uint32_t vbo_user; /* bitmask of vertex buffers pointing to user memory */
+   unsigned vbo_min_index; /* from pipe_draw_info, for vertex upload */
+   unsigned vbo_max_index;
+
+   struct pipe_sampler_view *textures[5][PIPE_MAX_SAMPLERS];
+   unsigned num_textures[5];
+   struct nvc0_tsc_entry *samplers[5][PIPE_MAX_SAMPLERS];
+   unsigned num_samplers[5];
+
+   struct pipe_framebuffer_state framebuffer;
+   struct pipe_blend_color blend_colour;
+   struct pipe_stencil_ref stencil_ref;
+   struct pipe_poly_stipple stipple;
+   struct pipe_scissor_state scissor;
+   struct pipe_viewport_state viewport;
+   struct pipe_clip_state clip;
+
+   unsigned sample_mask;
+
+   boolean vbo_dirty;
+   boolean vbo_push_hint;
+
+   struct draw_context *draw;
+};
+
+static INLINE struct nvc0_context *
+nvc0_context(struct pipe_context *pipe)
+{
+   return (struct nvc0_context *)pipe;
+}
+
+struct nvc0_surface {
+   struct pipe_surface base;
+   uint32_t offset;
+   uint32_t width;
+   uint16_t height;
+   uint16_t depth;
+};
+
+static INLINE struct nvc0_surface *
+nvc0_surface(struct pipe_surface *ps)
+{
+   return (struct nvc0_surface *)ps;
+}
+
+/* nvc0_context.c */
+struct pipe_context *nvc0_create(struct pipe_screen *, void *);
+
+void nvc0_bufctx_emit_relocs(struct nvc0_context *);
+void nvc0_bufctx_add_resident(struct nvc0_context *, int ctx,
+                              struct nvc0_resource *, uint32_t flags);
+void nvc0_bufctx_del_resident(struct nvc0_context *, int ctx,
+                              struct nvc0_resource *);
+static INLINE void
+nvc0_bufctx_reset(struct nvc0_context *nvc0, int ctx)
+{
+   util_dynarray_resize(&nvc0->residents[ctx], 0);
+}
+
+/* nvc0_draw.c */
+extern struct draw_stage *nvc0_draw_render_stage(struct nvc0_context *);
+
+/* nvc0_program.c */
+boolean nvc0_program_translate(struct nvc0_program *);
+void nvc0_program_destroy(struct nvc0_context *, struct nvc0_program *);
+
+/* nvc0_query.c */
+void nvc0_init_query_functions(struct nvc0_context *);
+
+/* nvc0_shader_state.c */
+void nvc0_vertprog_validate(struct nvc0_context *);
+void nvc0_tctlprog_validate(struct nvc0_context *);
+void nvc0_tevlprog_validate(struct nvc0_context *);
+void nvc0_gmtyprog_validate(struct nvc0_context *);
+void nvc0_fragprog_validate(struct nvc0_context *);
+
+/* nvc0_state.c */
+extern void nvc0_init_state_functions(struct nvc0_context *);
+
+/* nvc0_state_validate.c */
+extern boolean nvc0_state_validate(struct nvc0_context *);
+
+/* nvc0_surface.c */
+extern void nvc0_clear(struct pipe_context *, unsigned buffers,
+                       const float *rgba, double depth, unsigned stencil);
+extern void nvc0_init_surface_functions(struct nvc0_context *);
+
+/* nvc0_tex.c */
+void nvc0_validate_textures(struct nvc0_context *);
+void nvc0_validate_samplers(struct nvc0_context *);
+
+struct pipe_sampler_view *
+nvc0_create_sampler_view(struct pipe_context *,
+                         struct pipe_resource *,
+                         const struct pipe_sampler_view *);
+
+/* nvc0_transfer.c */
+void
+nvc0_m2mf_push_linear(struct nvc0_context *nvc0,
+                     struct nouveau_bo *dst, unsigned domain, int offset,
+                     unsigned size, void *data);
+void
+nvc0_m2mf_copy_linear(struct nvc0_context *nvc0,
+                     struct nouveau_bo *dst, unsigned dstoff, unsigned dstdom,
+                     struct nouveau_bo *src, unsigned srcoff, unsigned srcdom,
+                     unsigned size);
+
+/* nvc0_vbo.c */
+void nvc0_draw_vbo(struct pipe_context *, const struct pipe_draw_info *);
+
+void *
+nvc0_vertex_state_create(struct pipe_context *pipe,
+                         unsigned num_elements,
+                         const struct pipe_vertex_element *elements);
+void
+nvc0_vertex_state_delete(struct pipe_context *pipe, void *hwcso);
+
+void nvc0_vertex_arrays_validate(struct nvc0_context *nvc0);
+
+/* nvc0_push.c */
+void nvc0_push_vbo(struct nvc0_context *, const struct pipe_draw_info *);
+void nvc0_push_vbo2(struct nvc0_context *, const struct pipe_draw_info *);
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_draw.c b/src/gallium/drivers/nvc0/nvc0_draw.c
new file mode 100644 (file)
index 0000000..ac7e9f6
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 Ben Skeggs
+ *
+ * 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.
+ */
+
+#include "draw/draw_pipe.h"
+
+#include "nvc0_context.h"
+
+struct nvc0_render_stage {
+   struct draw_stage stage;
+   struct nvc0_context *nvc0;
+};
+
+static INLINE struct nvc0_render_stage *
+nvc0_render_stage(struct draw_stage *stage)
+{
+   return (struct nvc0_render_stage *)stage;
+}
+
+static void
+nvc0_render_point(struct draw_stage *stage, struct prim_header *prim)
+{
+   NOUVEAU_ERR("\n");
+}
+
+static void
+nvc0_render_line(struct draw_stage *stage, struct prim_header *prim)
+{
+   NOUVEAU_ERR("\n");
+}
+
+static void
+nvc0_render_tri(struct draw_stage *stage, struct prim_header *prim)
+{
+   NOUVEAU_ERR("\n");
+}
+
+static void
+nvc0_render_flush(struct draw_stage *stage, unsigned flags)
+{
+}
+
+static void
+nvc0_render_reset_stipple_counter(struct draw_stage *stage)
+{
+   NOUVEAU_ERR("\n");
+}
+
+static void
+nvc0_render_destroy(struct draw_stage *stage)
+{
+   FREE(stage);
+}
+
+struct draw_stage *
+nvc0_draw_render_stage(struct nvc0_context *nvc0)
+{
+   struct nvc0_render_stage *rs = CALLOC_STRUCT(nvc0_render_stage);
+
+   rs->nvc0 = nvc0;
+   rs->stage.draw = nvc0->draw;
+   rs->stage.destroy = nvc0_render_destroy;
+   rs->stage.point = nvc0_render_point;
+   rs->stage.line = nvc0_render_line;
+   rs->stage.tri = nvc0_render_tri;
+   rs->stage.flush = nvc0_render_flush;
+   rs->stage.reset_stipple_counter = nvc0_render_reset_stipple_counter;
+
+   return &rs->stage;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_fence.c b/src/gallium/drivers/nvc0/nvc0_fence.c
new file mode 100644 (file)
index 0000000..9d2c48c
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "nvc0_fence.h"
+#include "nvc0_context.h"
+#include "nvc0_screen.h"
+
+#ifdef PIPE_OS_UNIX
+#include <sched.h>
+#endif
+
+boolean
+nvc0_screen_fence_new(struct nvc0_screen *screen, struct nvc0_fence **fence,
+                      boolean emit)
+{
+   *fence = CALLOC_STRUCT(nvc0_fence);
+   if (!*fence)
+      return FALSE;
+
+   (*fence)->screen = screen;
+   (*fence)->ref = 1;
+
+   if (emit)
+      nvc0_fence_emit(*fence);
+
+   return TRUE;
+}
+
+void
+nvc0_fence_emit(struct nvc0_fence *fence)
+{
+   struct nvc0_screen *screen = fence->screen;
+   struct nouveau_channel *chan = screen->base.channel;
+
+   fence->sequence = ++screen->fence.sequence;
+
+   assert(fence->state == NVC0_FENCE_STATE_AVAILABLE);
+
+   BEGIN_RING(chan, RING_3D(QUERY_ADDRESS_HIGH), 4);
+   OUT_RELOCh(chan, screen->fence.bo, 0, NOUVEAU_BO_WR);
+   OUT_RELOCl(chan, screen->fence.bo, 0, NOUVEAU_BO_WR);
+   OUT_RING  (chan, fence->sequence);
+   OUT_RING  (chan, NVC0_3D_QUERY_GET_FENCE | NVC0_3D_QUERY_GET_SHORT |
+              (0xf << NVC0_3D_QUERY_GET_UNIT__SHIFT));
+
+   ++fence->ref;
+
+   if (screen->fence.tail)
+      screen->fence.tail->next = fence;
+   else
+      screen->fence.head = fence;
+
+   screen->fence.tail = fence;
+
+   fence->state = NVC0_FENCE_STATE_EMITTED;
+}
+
+static void
+nvc0_fence_trigger_release_buffers(struct nvc0_fence *fence);
+
+void
+nvc0_fence_del(struct nvc0_fence *fence)
+{
+   struct nvc0_fence *it;
+   struct nvc0_screen *screen = fence->screen;
+
+   if (fence->state == NVC0_FENCE_STATE_EMITTED) {
+      if (fence == screen->fence.head) {
+         screen->fence.head = fence->next;
+         if (!screen->fence.head)
+            screen->fence.tail = NULL;
+      } else {
+         for (it = screen->fence.head; it && it->next != fence; it = it->next);
+         it->next = fence->next;
+         if (screen->fence.tail == fence)
+            screen->fence.tail = it;
+      }
+   }
+
+   if (fence->buffers) {
+      debug_printf("WARNING: deleting fence with buffers "
+                   "still hooked to it !\n");
+      nvc0_fence_trigger_release_buffers(fence);
+   }
+
+   FREE(fence);
+}
+
+static void
+nvc0_fence_trigger_release_buffers(struct nvc0_fence *fence)
+{
+   struct nvc0_mm_allocation *alloc = fence->buffers;
+
+   while (alloc) {
+      struct nvc0_mm_allocation *next = alloc->next;
+      nvc0_mm_free(alloc);
+      alloc = next;
+   };
+   fence->buffers = NULL;
+}
+
+static void
+nvc0_screen_fence_update(struct nvc0_screen *screen)
+{
+   struct nvc0_fence *fence;
+   struct nvc0_fence *next = NULL;
+   uint32_t sequence = screen->fence.map[0];
+
+   if (screen->fence.sequence_ack == sequence)
+      return;
+   screen->fence.sequence_ack = sequence;
+
+   for (fence = screen->fence.head; fence; fence = next) {
+      next = fence->next;
+      sequence = fence->sequence;
+
+      fence->state = NVC0_FENCE_STATE_SIGNALLED;
+
+      if (fence->buffers)
+         nvc0_fence_trigger_release_buffers(fence);
+
+      nvc0_fence_reference(&fence, NULL);
+
+      if (sequence == screen->fence.sequence_ack)
+         break;
+   }
+   screen->fence.head = next;
+   if (!next)
+      screen->fence.tail = NULL;
+}
+
+#define NVC0_FENCE_MAX_SPINS (1 << 17)
+
+boolean
+nvc0_fence_signalled(struct nvc0_fence *fence)
+{
+   struct nvc0_screen *screen = fence->screen;
+
+   if (fence->state == NVC0_FENCE_STATE_EMITTED)
+      nvc0_screen_fence_update(screen);
+
+   return fence->state == NVC0_FENCE_STATE_SIGNALLED;
+}
+
+boolean
+nvc0_fence_wait(struct nvc0_fence *fence)
+{
+   struct nvc0_screen *screen = fence->screen;
+   int spins = 0;
+
+   if (fence->state == NVC0_FENCE_STATE_AVAILABLE) {
+      nvc0_fence_emit(fence);
+
+      FIRE_RING(screen->base.channel);
+
+      if (fence == screen->fence.current)
+         nvc0_screen_fence_new(screen, &screen->fence.current, FALSE);
+   }
+
+   do {
+      nvc0_screen_fence_update(screen);
+
+      if (fence->state == NVC0_FENCE_STATE_SIGNALLED)
+         return TRUE;
+      spins++;
+#ifdef PIPE_OS_UNIX
+      if (!(spins % 8)) /* donate a few cycles */
+         sched_yield();
+#endif
+   } while (spins < NVC0_FENCE_MAX_SPINS);
+
+   if (spins > 9000)
+      NOUVEAU_ERR("fence %x: been spinning too long\n", fence->sequence);
+
+   return FALSE;
+}
+
+void
+nvc0_screen_fence_next(struct nvc0_screen *screen)
+{
+   nvc0_fence_emit(screen->fence.current);
+   nvc0_screen_fence_new(screen, &screen->fence.current, FALSE);
+   nvc0_screen_fence_update(screen);
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_fence.h b/src/gallium/drivers/nvc0/nvc0_fence.h
new file mode 100644 (file)
index 0000000..e63c164
--- /dev/null
@@ -0,0 +1,48 @@
+
+#ifndef __NVC0_FENCE_H__
+#define __NVC0_FENCE_H__
+
+#include "util/u_inlines.h"
+#include "util/u_double_list.h"
+
+#define NVC0_FENCE_STATE_AVAILABLE 0
+#define NVC0_FENCE_STATE_EMITTED   1
+#define NVC0_FENCE_STATE_SIGNALLED 2
+
+struct nvc0_mm_allocation;
+
+struct nvc0_fence {
+   struct nvc0_fence *next;
+   struct nvc0_screen *screen;
+   int state;
+   int ref;
+   uint32_t sequence;
+   struct nvc0_mm_allocation *buffers;
+};
+
+void nvc0_fence_emit(struct nvc0_fence *);
+void nvc0_fence_del(struct nvc0_fence *);
+
+boolean nvc0_fence_wait(struct nvc0_fence *);
+boolean nvc0_fence_signalled(struct nvc0_fence *);
+
+static INLINE void
+nvc0_fence_reference(struct nvc0_fence **ref, struct nvc0_fence *fence)
+{
+   if (*ref) {
+      if (--(*ref)->ref == 0)
+         nvc0_fence_del(*ref);
+   }
+   if (fence)
+      ++fence->ref;
+
+   *ref = fence;
+}
+
+static INLINE struct nvc0_fence *
+nvc0_fence(struct pipe_fence_handle *fence)
+{
+   return (struct nvc0_fence *)fence;
+}
+
+#endif // __NVC0_FENCE_H__
diff --git a/src/gallium/drivers/nvc0/nvc0_formats.c b/src/gallium/drivers/nvc0/nvc0_formats.c
new file mode 100644 (file)
index 0000000..5d02357
--- /dev/null
@@ -0,0 +1,462 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "nvc0_screen.h"
+#include "nv50_texture.xml.h"
+#include "nvc0_3d.xml.h"
+#include "nv50_defs.xml.h"
+#include "nv50_texture.xml.h"
+#include "pipe/p_defines.h"
+
+#define A_(cr, cg, cb, ca, t0, t1, t2, t3, sz, r)     \
+   (NV50_TIC_MAP_##cr << NV50_TIC_0_MAPR__SHIFT) |    \
+   (NV50_TIC_TYPE_##t0 << NV50_TIC_0_TYPE0__SHIFT) |  \
+   (NV50_TIC_MAP_##cg << NV50_TIC_0_MAPG__SHIFT) |    \
+   (NV50_TIC_TYPE_##t1 << NV50_TIC_0_TYPE1__SHIFT) |  \
+   (NV50_TIC_MAP_##cb << NV50_TIC_0_MAPB__SHIFT) |    \
+   (NV50_TIC_TYPE_##t2 << NV50_TIC_0_TYPE2__SHIFT) |  \
+   (NV50_TIC_MAP_##ca << NV50_TIC_0_MAPA__SHIFT) |    \
+   (NV50_TIC_TYPE_##t3 << NV50_TIC_0_TYPE3__SHIFT) |  \
+   NV50_TIC_0_FMT_##sz,                               \
+   NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_##sz |           \
+   NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_##t0 |           \
+   (r << 31)
+
+#define B_(cr, cg, cb, ca, t0, t1, t2, t3, sz, r)     \
+   (NV50_TIC_MAP_##cr << NV50_TIC_0_MAPR__SHIFT) |    \
+   (NV50_TIC_TYPE_##t0 << NV50_TIC_0_TYPE0__SHIFT) |  \
+   (NV50_TIC_MAP_##cg << NV50_TIC_0_MAPG__SHIFT) |    \
+   (NV50_TIC_TYPE_##t1 << NV50_TIC_0_TYPE1__SHIFT) |  \
+   (NV50_TIC_MAP_##cb << NV50_TIC_0_MAPB__SHIFT) |    \
+   (NV50_TIC_TYPE_##t2 << NV50_TIC_0_TYPE2__SHIFT) |  \
+   (NV50_TIC_MAP_##ca << NV50_TIC_0_MAPA__SHIFT) |    \
+   (NV50_TIC_TYPE_##t3 << NV50_TIC_0_TYPE3__SHIFT) |  \
+   NV50_TIC_0_FMT_##sz, 0
+
+#define VERTEX_BUFFER PIPE_BIND_VERTEX_BUFFER
+#define SAMPLER_VIEW  PIPE_BIND_SAMPLER_VIEW
+#define RENDER_TARGET PIPE_BIND_RENDER_TARGET
+#define DEPTH_STENCIL PIPE_BIND_DEPTH_STENCIL
+#define SCANOUT       PIPE_BIND_SCANOUT
+
+/* for vertex buffers: */
+#define NV50_TIC_0_FMT_8_8_8    NV50_TIC_0_FMT_8_8_8_8
+#define NV50_TIC_0_FMT_16_16_16 NV50_TIC_0_FMT_16_16_16_16
+#define NV50_TIC_0_FMT_32_32_32 NV50_TIC_0_FMT_32_32_32_32
+
+const struct nvc0_format nvc0_format_table[PIPE_FORMAT_COUNT] =
+{
+   /* COMMON FORMATS */
+
+   [PIPE_FORMAT_B8G8R8A8_UNORM] = { NV50_SURFACE_FORMAT_A8R8G8B8_UNORM,
+    A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
+
+   [PIPE_FORMAT_B8G8R8X8_UNORM] = { NV50_SURFACE_FORMAT_X8R8G8B8_UNORM,
+    A_(C2, C1, C0, ONE, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
+
+   [PIPE_FORMAT_B8G8R8A8_SRGB] = { NV50_SURFACE_FORMAT_A8R8G8B8_SRGB,
+    A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_B8G8R8X8_SRGB] = { NV50_SURFACE_FORMAT_X8R8G8B8_SRGB,
+    A_(C2, C1, C0, ONE, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_B5G6R5_UNORM] = { NV50_SURFACE_FORMAT_R5G6B5_UNORM,
+    B_(C2, C1, C0, ONE, UNORM, UNORM, UNORM, UNORM, 5_6_5, 1),
+    SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
+
+   [PIPE_FORMAT_B5G5R5A1_UNORM] = { NV50_SURFACE_FORMAT_A1R5G5B5_UNORM,
+    B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 1_5_5_5, 1),
+    SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
+
+   [PIPE_FORMAT_B4G4R4A4_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
+    B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R10G10B10A2_UNORM] = { NV50_SURFACE_FORMAT_A2B10G10R10_UNORM,
+    A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 2_10_10_10, 0),
+    SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER | SCANOUT },
+
+   [PIPE_FORMAT_B10G10R10A2_UNORM] = { NV50_SURFACE_FORMAT_A2R10G10B10_UNORM,
+    A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 2_10_10_10, 1),
+    SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER },
+
+   /* DEPTH/STENCIL FORMATS */
+
+   [PIPE_FORMAT_Z16_UNORM] = { NV50_ZETA_FORMAT_Z16_UNORM,
+    B_(C0, C0, C0, ONE, UNORM, UINT, UINT, UINT, 16_ZETA, 0),
+    SAMPLER_VIEW | DEPTH_STENCIL },
+
+   [PIPE_FORMAT_Z24_UNORM_S8_USCALED] = { NV50_ZETA_FORMAT_S8Z24_UNORM,
+    B_(C0, C0, C0, ONE, UNORM, UINT, UINT, UINT, 8_24, 0),
+    SAMPLER_VIEW | DEPTH_STENCIL },
+
+   [PIPE_FORMAT_Z24X8_UNORM] = { NV50_ZETA_FORMAT_X8Z24_UNORM,
+    B_(C0, C0, C0, ONE, UNORM, UINT, UINT, UINT, 8_24, 0),
+    SAMPLER_VIEW | DEPTH_STENCIL },
+
+   [PIPE_FORMAT_S8_USCALED_Z24_UNORM] = { NV50_ZETA_FORMAT_S8Z24_UNORM,
+    B_(C1, C1, C1, ONE, UINT, UNORM, UINT, UINT, 24_8, 0),
+    SAMPLER_VIEW | DEPTH_STENCIL },
+
+   [PIPE_FORMAT_Z32_FLOAT] = { NV50_ZETA_FORMAT_Z32_FLOAT,
+    B_(C0, C0, C0, ONE, FLOAT, UINT, UINT, UINT, 32_ZETA, 0),
+    SAMPLER_VIEW | DEPTH_STENCIL },
+
+   [PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED] = {
+    NV50_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM,
+    B_(C0, C0, C0, ONE, FLOAT, UINT, UINT, UINT, 32_8, 0),
+    SAMPLER_VIEW | DEPTH_STENCIL },
+
+   /* LUMINANCE, ALPHA, INTENSITY */
+
+   [PIPE_FORMAT_L8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
+    A_(C0, C0, C0, ONE, UNORM, UNORM, UNORM, UNORM, 8, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_L8_SRGB] = { NV50_SURFACE_FORMAT_R8_UNORM,
+    A_(C0, C0, C0, ONE, UNORM, UNORM, UNORM, UNORM, 8, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_I8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
+    A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_A8_UNORM] = { NV50_SURFACE_FORMAT_A8_UNORM,
+    A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
+    SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_L8A8_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
+    A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_L8A8_SRGB] = { 0,
+    A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
+    SAMPLER_VIEW },
+
+   /* DXT, RGTC */
+
+   [PIPE_FORMAT_DXT1_RGB] = { 0,
+    B_(C0, C1, C2, ONE, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_DXT1_RGBA] = { 0,
+    B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_DXT3_RGBA] = { 0,
+    B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT3, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_DXT5_RGBA] = { 0,
+    B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT5, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_RGTC1_UNORM] = { 0,
+    B_(C0, ZERO, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, RGTC1, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_RGTC1_SNORM] = { 0,
+    B_(C0, ZERO, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, RGTC1, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_RGTC2_UNORM] = { 0,
+    B_(C0, C1, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, RGTC2, 0),
+    SAMPLER_VIEW },
+
+   [PIPE_FORMAT_RGTC2_SNORM] = { 0,
+    B_(C0, C1, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, RGTC2, 0),
+    SAMPLER_VIEW },
+
+   /* FLOAT 16 */
+
+   [PIPE_FORMAT_R16G16B16A16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16B16A16_FLOAT,
+    A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 16_16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R16G16B16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16B16X16_FLOAT,
+    A_(C0, C1, C2, ONE, FLOAT, FLOAT, FLOAT, FLOAT, 16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R16G16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16_FLOAT,
+    A_(C0, C1, ZERO, ONE, FLOAT, FLOAT, FLOAT, FLOAT, 16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
+    A_(C0, ZERO, ZERO, ONE, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   /* FLOAT 32 */
+
+   [PIPE_FORMAT_R32G32B32A32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32B32A32_FLOAT,
+    A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R32G32B32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32B32X32_FLOAT,
+    A_(C0, C1, C2, ONE, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R32G32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32_FLOAT,
+    A_(C0, C1, ZERO, ONE, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
+    A_(C0, ZERO, ZERO, ONE, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   /* ODD FORMATS */
+
+   [PIPE_FORMAT_R11G11B10_FLOAT] = { NV50_SURFACE_FORMAT_B10G11R11_FLOAT,
+    B_(C0, C1, C2, ONE, FLOAT, FLOAT, FLOAT, FLOAT, 10_11_11, 0),
+    SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R9G9B9E5_FLOAT] = { 0,
+    B_(C0, C1, C2, ONE, FLOAT, FLOAT, FLOAT, FLOAT, E5_9_9_9, 0),
+    SAMPLER_VIEW },
+
+   /* SNORM 32 */
+
+   [PIPE_FORMAT_R32G32B32A32_SNORM] = { 0,
+    A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32B32_SNORM] = { 0,
+    A_(C0, C1, C2, ONE, SNORM, SNORM, SNORM, SNORM, 32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32_SNORM] = { 0,
+    A_(C0, C1, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, 32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32_SNORM] = { 0,
+    A_(C0, ZERO, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, 32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   /* UNORM 32 */
+
+   [PIPE_FORMAT_R32G32B32A32_UNORM] = { 0,
+    A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32B32_UNORM] = { 0,
+    A_(C0, C1, C2, ONE, UNORM, UNORM, UNORM, UNORM, 32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32_UNORM] = { 0,
+    A_(C0, C1, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, 32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32_UNORM] = { 0,
+    A_(C0, ZERO, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, 32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   /* SNORM 16 */
+
+   [PIPE_FORMAT_R16G16B16A16_SNORM] = { NV50_SURFACE_FORMAT_R16G16B16A16_SNORM,
+    A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 16_16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R16G16B16_SNORM] = { 0,
+    A_(C0, C1, C2, ONE, SNORM, SNORM, SNORM, SNORM, 16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16G16_SNORM] = { NV50_SURFACE_FORMAT_R16G16_SNORM,
+    A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
+    A_(C0, ZERO, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, 16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   /* UNORM 16 */
+
+   [PIPE_FORMAT_R16G16B16A16_UNORM] = { NV50_SURFACE_FORMAT_R16G16B16A16_UNORM,
+    A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 16_16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R16G16B16_UNORM] = { 0,
+    A_(C0, C1, C2, ONE, UNORM, UNORM, UNORM, UNORM, 16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16G16_UNORM] = { NV50_SURFACE_FORMAT_R16G16_UNORM,
+    A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R16_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
+    A_(C0, ZERO, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, 16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   /* SNORM 8 */
+
+   [PIPE_FORMAT_R8G8B8A8_SNORM] = { NV50_SURFACE_FORMAT_A8B8G8R8_SNORM,
+    A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 8_8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R8G8B8_SNORM] = { 0,
+    A_(C0, C1, C2, ONE, SNORM, SNORM, SNORM, SNORM, 8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R8G8_SNORM] = { NV50_SURFACE_FORMAT_R8G8_SNORM,
+    A_(C0, C1, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, 8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R8_SNORM] = { NV50_SURFACE_FORMAT_R8_SNORM,
+    A_(C0, ZERO, ZERO, ONE, SNORM, SNORM, SNORM, SNORM, 8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   /* UNORM 8 */
+
+   [PIPE_FORMAT_R8G8B8A8_UNORM] = { NV50_SURFACE_FORMAT_A8B8G8R8_UNORM,
+    A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R8G8B8A8_SRGB] = { NV50_SURFACE_FORMAT_A8B8G8R8_SRGB,
+    A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
+    SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R8G8B8_UNORM] = { NV50_SURFACE_FORMAT_X8B8G8R8_UNORM,
+    A_(C0, C1, C2, ONE, UNORM, UNORM, UNORM, UNORM, 8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R8G8B8_SRGB] = { NV50_SURFACE_FORMAT_X8B8G8R8_SRGB,
+    A_(C0, C1, C2, ONE, UNORM, UNORM, UNORM, UNORM, 8_8_8, 0),
+    SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R8G8_UNORM] = { NV50_SURFACE_FORMAT_R8G8_UNORM,
+    A_(C0, C1, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   [PIPE_FORMAT_R8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
+    A_(C0, ZERO, ZERO, ONE, UNORM, UNORM, UNORM, UNORM, 8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
+
+   /* SSCALED 32 */
+
+   [PIPE_FORMAT_R32G32B32A32_SSCALED] = { NV50_SURFACE_FORMAT_R32G32B32A32_SINT,
+    A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 32_32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32B32_SSCALED] = { 0,
+    A_(C0, C1, C2, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32_SSCALED] = { NV50_SURFACE_FORMAT_R32G32_SINT,
+    A_(C0, C1, ZERO, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32_SSCALED] = { 0,
+    A_(C0, ZERO, ZERO, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   /* USCALED 32 */
+
+   [PIPE_FORMAT_R32G32B32A32_USCALED] = { NV50_SURFACE_FORMAT_R32G32B32A32_UINT,
+    A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 32_32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32B32_USCALED] = { 0,
+    A_(C0, C1, C2, ONE, USCALED, USCALED, USCALED, USCALED, 32_32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32G32_USCALED] = { NV50_SURFACE_FORMAT_R32G32_UINT,
+    A_(C0, C1, ZERO, ONE, USCALED, USCALED, USCALED, USCALED, 32_32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R32_USCALED] = { 0,
+    A_(C0, ZERO, ZERO, ONE, USCALED, USCALED, USCALED, USCALED, 32, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   /* SSCALED 16 */
+
+   [PIPE_FORMAT_R16G16B16A16_SSCALED] = { NV50_SURFACE_FORMAT_R16G16B16A16_SINT,
+    A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 16_16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16G16B16_SSCALED] = { 0,
+    A_(C0, C1, C2, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16G16_SSCALED] = { NV50_SURFACE_FORMAT_R16G16_SINT,
+    A_(C0, C1, ZERO, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16_SSCALED] = { NV50_SURFACE_FORMAT_R16_SINT,
+    A_(C0, ZERO, ZERO, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   /* USCALED 16 */
+
+   [PIPE_FORMAT_R16G16B16A16_USCALED] = { NV50_SURFACE_FORMAT_R16G16B16A16_UINT,
+    A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 16_16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16G16B16_USCALED] = { 0,
+    A_(C0, C1, C2, ONE, USCALED, USCALED, USCALED, USCALED, 16_16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16G16_USCALED] = { NV50_SURFACE_FORMAT_R16G16_UINT,
+    A_(C0, C1, ZERO, ONE, USCALED, USCALED, USCALED, USCALED, 16_16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R16_USCALED] = { NV50_SURFACE_FORMAT_R16_UINT,
+    A_(C0, ZERO, ZERO, ONE, USCALED, USCALED, USCALED, USCALED, 16, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   /* SSCALED 8 */
+
+   [PIPE_FORMAT_R8G8B8A8_SSCALED] = { NV50_SURFACE_FORMAT_A8B8G8R8_SINT,
+    A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 8_8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R8G8B8_SSCALED] = { 0,
+    A_(C0, C1, C2, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R8G8_SSCALED] = { NV50_SURFACE_FORMAT_R8G8_SINT,
+    A_(C0, C1, ZERO, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R8_SSCALED] = { NV50_SURFACE_FORMAT_R8_SINT,
+    A_(C0, ZERO, ZERO, ONE, SSCALED, SSCALED, SSCALED, SSCALED, 8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   /* USCALED 8 */
+
+   [PIPE_FORMAT_R8G8B8A8_USCALED] = { NV50_SURFACE_FORMAT_A8B8G8R8_UINT,
+    A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 8_8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R8G8B8_USCALED] = { 0,
+    A_(C0, C1, C2, ONE, USCALED, USCALED, USCALED, USCALED, 8_8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R8G8_USCALED] = { NV50_SURFACE_FORMAT_R8G8_UINT,
+    A_(C0, C1, ZERO, ONE, USCALED, USCALED, USCALED, USCALED, 8_8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+
+   [PIPE_FORMAT_R8_USCALED] = { NV50_SURFACE_FORMAT_R8_UINT,
+    A_(C0, ZERO, ZERO, ONE, USCALED, USCALED, USCALED, USCALED, 8, 0),
+    VERTEX_BUFFER | SAMPLER_VIEW },
+};
diff --git a/src/gallium/drivers/nvc0/nvc0_graph_macros.h b/src/gallium/drivers/nvc0/nvc0_graph_macros.h
new file mode 100644 (file)
index 0000000..8da963a
--- /dev/null
@@ -0,0 +1,235 @@
+
+#ifndef __NVC0_PGRAPH_MACROS_H__
+#define __NVC0_PGRAPH_MACROS_H__
+
+/* extrinsrt r1, r2, src, size, dst: replace bits [dst:dst+size) in r1
+ *  with bits [src:src+size) in r2
+ *
+ * bra(n)z annul: no delay slot
+ */
+
+/* The comments above the macros describe what they *should* be doing,
+ * but we use less functionality for now.
+ */
+
+/*
+ * for (i = 0; i < 8; ++i)
+ *    [NVC0_3D_BLEND_ENABLE(i)] = BIT(i of arg);
+ *
+ * [3428] = arg;
+ *
+ * if (arg == 0 || [NVC0_3D_MULTISAMPLE_ENABLE] == 0)
+ *    [0d9c] = 0;
+ * else
+ *    [0d9c] = [342c];
+ */
+static const uint32_t nvc0_9097_blend_enables[] =
+{
+   0x05360021, /* 0x00: maddr [NVC0_3D_BLEND_ENABLE(0), increment = 4] */
+   0x00404042, /* 0x01: send extrinsrt 0 $r1 0 0x1 0 */
+   0x00424042, /* 0x02: send extrinsrt 0 $r1 0x1 0x1 0 */
+   0x00444042, /* 0x03: send extrinsrt 0 $r1 0x2 0x1 0 */
+   0x00464042, /* 0x04: send extrinsrt 0 $r1 0x3 0x1 0 */
+   0x00484042, /* 0x05: send extrinsrt 0 $r1 0x4 0x1 0 */
+   0x004a4042, /* 0x06: send extrinsrt 0 $r1 0x5 0x1 0 */
+   0x004c40c2, /* 0x07: exit send extrinsrt 0 $r1 0x6 0x1 0 */
+   0x004e4042, /* 0x08: send extrinsrt 0 $r1 0x7 0x1 0 */
+};
+
+/*
+ * uint64 limit = (parm(0) << 32) | parm(1);
+ * uint64 start = (parm(2) << 32);
+ *
+ * if (limit) {
+ *    start |= parm(3);
+ *    --limit;
+ * } else {
+ *    start |= 1;
+ * }
+ *
+ * [0x1c04 + (arg & 0xf) * 16 + 0] = (start >> 32) & 0xff;
+ * [0x1c04 + (arg & 0xf) * 16 + 4] = start & 0xffffffff;
+ * [0x1f00 + (arg & 0xf) * 8 + 0] = (limit >> 32) & 0xff;
+ * [0x1f00 + (arg & 0xf) * 8 + 4] = limit & 0xffffffff;
+ */
+static const uint32_t nvc0_9097_vertex_array_select[] =
+{
+   0x00000201, /* 0x00: parm $r2 */
+   0x00000301, /* 0x01: parm $r3 */
+   0x00000401, /* 0x02: parm $r4 */
+   0x00000501, /* 0x03: parm $r5 */
+   0x11004612, /* 0x04: mov $r6 extrinsrt 0 $r1 0 4 2 */
+   0x09004712, /* 0x05: mov $r7 extrinsrt 0 $r1 0 4 1 */
+   0x05c07621, /* 0x06: maddr $r6 add $6 0x1701 */
+   0x00002041, /* 0x07: send $r4 */
+   0x00002841, /* 0x08: send $r5 */
+   0x05f03f21, /* 0x09: maddr $r7 add $7 0x17c0 */
+   0x000010c1, /* 0x0a: exit send $r2 */
+   0x00001841, /* 0x0b: send $r3 */
+};
+
+static const uint32_t nvc0_9097_color_mask_brdc[] =
+{
+   0x05a00021, /* maddr [NVC0_3D_COLOR_MASK(0), increment = 4] */
+   0x00000841, /* send $r1 */
+   0x00000841, /* send $r1 */
+   0x00000841, /* send $r1 */
+   0x00000841, /* send $r1 */
+   0x00000841, /* send $r1 */
+   0x00000841, /* send $r1 */
+   0x000008c1, /* exit send $r1 */
+   0x00000841, /* send $r1 */
+};
+
+/*
+ * [GL_POLYGON_MODE_FRONT] = arg;
+ *
+ * if (BIT(31 of [0x3410]))
+ *    [1a24] = 0x7353;
+ *
+ * if ([NVC0_3D_SP_SELECT(3)] == 0x31 || [NVC0_3D_SP_SELECT(4)] == 0x41)
+ *    [02ec] = 0;
+ * else
+ * if ([GL_POLYGON_MODE_BACK] == GL_LINE || arg == GL_LINE)
+ *    [02ec] = BYTE(1 of [0x3410]) << 4;
+ * else
+ *    [02ec] = BYTE(0 of [0x3410]) << 4;
+ */
+static const uint32_t nvc0_9097_poly_mode_front[] =
+{
+   0x00db0215, /* 0x00: read $r2 [NVC0_3D_POLYGON_MODE_BACK] */
+   0x020c0315, /* 0x01: read $r3 [NVC0_3D_SP_SELECT(3)] */
+   0x00128f10, /* 0x02: mov $r7 or $r1 $r2 */
+   0x02100415, /* 0x03: read $r4 [NVC0_3D_SP_SELECT(4)] */
+   0x00004211, /* 0x04: mov $r2 0x1 */
+   0x00180611, /* 0x05: mov $r6 0x60 */
+   0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x07: braz $r7 0xa */
+   0x00dac021, /* 0x08: maddr 0x36b */
+   0x00800611, /* 0x09: mov $r6 0x200 */
+   0x00131f10, /* 0x0a: mov $r7 or $r3 $r4 */
+   0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x0c: braz $r7 0xf */
+   0x00000841, /* 0x0d: send $r1 */
+   0x00000611, /* 0x0e: mov $r6 0 */
+   0x002ec0a1, /* 0x0f: exit maddr [02ec] */
+   0x00003041  /* 0x10: send $r6 */
+};
+
+/*
+ * [GL_POLYGON_MODE_BACK] = arg;
+ *
+ * if (BIT(31 of [0x3410]))
+ *    [1a24] = 0x7353;
+ *
+ * if ([NVC0_3D_SP_SELECT(3)] == 0x31 || [NVC0_3D_SP_SELECT(4)] == 0x41)
+ *    [02ec] = 0;
+ * else
+ * if ([GL_POLYGON_MODE_FRONT] == GL_LINE || arg == GL_LINE)
+ *    [02ec] = BYTE(1 of [0x3410]) << 4;
+ * else
+ *    [02ec] = BYTE(0 of [0x3410]) << 4;
+ */
+/* NOTE: 0x3410 = 0x80002006 by default,
+ *  POLYGON_MODE == GL_LINE check replaced by (MODE & 1)
+ *  SP_SELECT(i) == (i << 4) | 1 check replaced by SP_SELECT(i) & 1
+ */
+static const uint32_t nvc0_9097_poly_mode_back[] =
+{
+   0x00dac215, /* 0x00: read $r2 [NVC0_3D_POLYGON_MODE_FRONT] */
+   0x020c0315, /* 0x01: read $r3 [NVC0_3D_SP_SELECT(3)] */
+   0x00128f10, /* 0x02: mov $r7 or $r1 $r2 */
+   0x02100415, /* 0x03: read $r4 [NVC0_3D_SP_SELECT(4)] */
+   0x00004211, /* 0x04: mov $r2 0x1 */
+   0x00180611, /* 0x05: mov $r6 0x60 */
+   0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x07: braz $r7 0xa */
+   0x00dac021, /* 0x08: maddr 0x36b */
+   0x00800611, /* 0x09: mov $r6 0x200 */
+   0x00131f10, /* 0x0a: mov $r7 or $r3 $r4 */
+   0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x0c: braz $r7 0xf */
+   0x00000841, /* 0x0d: send $r1 */
+   0x00000611, /* 0x0e: mov $r6 0 */
+   0x002ec0a1, /* 0x0f: exit maddr [02ec] */
+   0x00003041  /* 0x10: send $r6 */
+};
+
+/*
+ * [NVC0_3D_SP_SELECT(4)] = arg
+ *
+ * if BIT(31 of [0x3410]) == 0
+ *    [1a24] = 0x7353;
+ *
+ * if ([NVC0_3D_SP_SELECT(3)] == 0x31 || arg == 0x41)
+ *    [02ec] = 0
+ * else
+ * if (any POLYGON MODE == LINE)
+ *    [02ec] = BYTE(1 of [3410]) << 4;
+ * else
+ *    [02ec] = BYTE(0 of [3410]) << 4; // 02ec valid bits are 0xff1
+ */
+static const uint32_t nvc0_9097_gp_select[] = /* 0x0f */
+{
+   0x00dac215, /* 0x00: read $r2 0x36b */
+   0x00db0315, /* 0x01: read $r3 0x36c */
+   0x0012d710, /* 0x02: mov $r7 or $r2 $r3 */
+   0x020c0415, /* 0x03: read $r4 0x830 */
+   0x00004211, /* 0x04: mov $r2 0x1 */
+   0x00180611, /* 0x05: mov $r6 0x60 */
+   0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x07: braz $r7 0xa */
+   0x02100021, /* 0x08: maddr 0x840 */
+   0x00800611, /* 0x09: mov $r6 0x200 */
+   0x00130f10, /* 0x0a: mov $r7 or $r1 $r4 */
+   0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x0c: braz $r7 0xf */
+   0x00000841, /* 0x0d: send $r1 */
+   0x00000611, /* 0x0e: mov $r6 0 */
+   0x002ec0a1, /* 0x0f: exit maddr 0xbb */
+   0x00003041, /* 0x10: send $r6 */
+};
+
+/*
+ * [NVC0_3D_SP_SELECT(3)] = arg
+ *
+ * if BIT(31 of [0x3410]) == 0
+ *    [1a24] = 0x7353;
+ *
+ * if (arg == 0x31) {
+ *    if (BIT(2 of [0x3430])) {
+ *       int i = 15; do { --i; } while(i);
+ *       [0x1a2c] = 0;
+ *    }
+ * }
+ *
+ * if ([NVC0_3D_SP_SELECT(4)] == 0x41 || arg == 0x31)
+ *    [02ec] = 0
+ * else
+ * if ([any POLYGON_MODE] == GL_LINE)
+ *    [02ec] = BYTE(1 of [3410]) << 4;
+ * else
+ *    [02ec] = BYTE(0 of [3410]) << 4;
+ */
+static const uint32_t nvc0_9097_tep_select[] = /* 0x10 */
+{
+   0x00dac215, /* 0x00: read $r2 0x36b */
+   0x00db0315, /* 0x01: read $r3 0x36c */
+   0x0012d710, /* 0x02: mov $r7 or $r2 $r3 */
+   0x02100415, /* 0x03: read $r4 0x840 */
+   0x00004211, /* 0x04: mov $r2 0x1 */
+   0x00180611, /* 0x05: mov $r6 0x60 */
+   0x0014bf10, /* 0x06: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x07: braz $r7 0xa */
+   0x020c0021, /* 0x08: maddr 0x830 */
+   0x00800611, /* 0x09: mov $r6 0x200 */
+   0x00130f10, /* 0x0a: mov $r7 or $r1 $r4 */
+   0x0014bf10, /* 0x0b: mov $r7 and $r7 $r2 */
+   0x0000f807, /* 0x0c: braz $r7 0xf */
+   0x00000841, /* 0x0d: send $r1 */
+   0x00000611, /* 0x0e: mov $r6 0 */
+   0x002ec0a1, /* 0x0f: exit maddr 0xbb */
+   0x00003041, /* 0x10: send $r6 */
+};
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_m2mf.xml.h b/src/gallium/drivers/nvc0/nvc0_m2mf.xml.h
new file mode 100644 (file)
index 0000000..3bf628d
--- /dev/null
@@ -0,0 +1,138 @@
+#ifndef NVC0_M2MF_XML
+#define NVC0_M2MF_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nvc0_m2mf.xml  (   2227 bytes, from 2010-10-16 16:10:29)
+- copyright.xml  (   6498 bytes, from 2010-10-03 13:18:37)
+- nv_object.xml  (  11379 bytes, from 2010-10-16 11:43:24)
+- nvchipsets.xml (   2907 bytes, from 2010-10-15 16:28:21)
+- nv_defs.xml    (   4437 bytes, from 2010-07-06 07:43:58)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin KoÅ›cielnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NVC0_M2MF_TILING_MODE_IN                               0x00000204
+
+#define NVC0_M2MF_TILING_PITCH_IN                              0x00000208
+
+#define NVC0_M2MF_TILING_HEIGHT_IN                             0x0000020c
+
+#define NVC0_M2MF_TILING_DEPTH_IN                              0x00000210
+
+#define NVC0_M2MF_TILING_POSITION_IN_Z                         0x00000214
+
+#define NVC0_M2MF_TILING_MODE_OUT                              0x00000220
+
+#define NVC0_M2MF_TILING_PITCH_OUT                             0x00000224
+
+#define NVC0_M2MF_TILING_HEIGHT_OUT                            0x00000228
+
+#define NVC0_M2MF_TILING_DEPTH_OUT                             0x0000022c
+
+#define NVC0_M2MF_TILING_POSITION_OUT_Z                                0x00000230
+
+#define NVC0_M2MF_OFFSET_OUT_HIGH                              0x00000238
+
+#define NVC0_M2MF_OFFSET_OUT_LOW                               0x0000023c
+
+#define NVC0_M2MF_EXEC                                         0x00000300
+#define NVC0_M2MF_EXEC_PUSH                                    0x00000001
+#define NVC0_M2MF_EXEC_LINEAR_IN                               0x00000010
+#define NVC0_M2MF_EXEC_LINEAR_OUT                              0x00000100
+#define NVC0_M2MF_EXEC_NOTIFY                                  0x00002000
+#define NVC0_M2MF_EXEC_INC__MASK                               0x00f00000
+#define NVC0_M2MF_EXEC_INC__SHIFT                              20
+
+#define NVC0_M2MF_DATA                                         0x00000304
+
+#define NVC0_M2MF_OFFSET_IN_HIGH                               0x0000030c
+
+#define NVC0_M2MF_OFFSET_IN_LOW                                        0x00000310
+
+#define NVC0_M2MF_PITCH_IN                                     0x00000314
+
+#define NVC0_M2MF_PITCH_OUT                                    0x00000318
+
+#define NVC0_M2MF_LINE_LENGTH_IN                               0x0000031c
+
+#define NVC0_M2MF_LINE_COUNT                                   0x00000320
+
+#define NVC0_M2MF_NOTIFY_ADDRESS_HIGH                          0x0000032c
+
+#define NVC0_M2MF_NOTIFY_ADDRESS_LOW                           0x00000330
+
+#define NVC0_M2MF_NOTIFY                                       0x00000334
+
+#define NVC0_M2MF_TILING_POSITION_IN_X                         0x00000344
+
+#define NVC0_M2MF_TILING_POSITION_IN_Y                         0x00000348
+
+#define NVC0_M2MF_TILING_POSITION_OUT_X                                0x0000034c
+
+#define NVC0_M2MF_TILING_POSITION_OUT_Y                                0x00000350
+
+
+#endif /* NVC0_M2MF_XML */
diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c
new file mode 100644 (file)
index 0000000..7c7e134
--- /dev/null
@@ -0,0 +1,327 @@
+/*
+ * Copyright 2008 Ben Skeggs
+ *
+ * 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.
+ */
+
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+
+#include "nvc0_context.h"
+#include "nvc0_resource.h"
+#include "nvc0_transfer.h"
+
+static INLINE uint32_t
+get_tile_dims(unsigned nx, unsigned ny, unsigned nz)
+{
+   uint32_t tile_mode = 0x000;
+
+   if (ny > 64) tile_mode = 0x040; /* height 128 tiles */
+   else
+   if (ny > 32) tile_mode = 0x030; /* height 64 tiles */
+   else
+   if (ny > 16) tile_mode = 0x020; /* height 32 tiles */
+   else
+   if (ny >  8) tile_mode = 0x010; /* height 16 tiles */
+
+   if (nz == 1)
+      return tile_mode;
+   else
+   if (tile_mode > 0x020)
+      tile_mode = 0x020;
+
+   if (nz > 16 && tile_mode < 0x020)
+      return tile_mode | 0x500; /* depth 32 tiles */
+   if (nz > 8) return tile_mode | 0x400; /* depth 16 tiles */
+   if (nz > 4) return tile_mode | 0x300; /* depth 8 tiles */
+   if (nz > 2) return tile_mode | 0x200; /* depth 4 tiles */
+
+   return tile_mode | 0x100;
+}
+
+static INLINE unsigned
+calc_zslice_offset(uint32_t tile_mode, unsigned z, unsigned pitch, unsigned nbh)
+{
+   unsigned tile_h = NVC0_TILE_HEIGHT(tile_mode);
+   unsigned tile_d_shift = NVC0_TILE_DIM_SHIFT(tile_mode, 2);
+   unsigned tile_d = 1 << tile_d_shift;
+
+   /* stride_2d == to next slice within this volume tile */
+   /* stride_3d == size (in bytes) of a volume tile */
+   unsigned stride_2d = tile_h * NVC0_TILE_PITCH(tile_mode);
+   unsigned stride_3d = tile_d * align(nbh, tile_h) * pitch;
+
+   return (z & (tile_d - 1)) * stride_2d + (z >> tile_d_shift) * stride_3d;
+}
+
+static void
+nvc0_miptree_destroy(struct pipe_screen *pscreen, struct pipe_resource *pt)
+{
+   struct nvc0_miptree *mt = nvc0_miptree(pt);
+
+   nouveau_screen_bo_release(pscreen, mt->base.bo);
+
+   FREE(mt);
+}
+
+static boolean
+nvc0_miptree_get_handle(struct pipe_screen *pscreen,
+                        struct pipe_resource *pt,
+                        struct winsys_handle *whandle)
+{
+   struct nvc0_miptree *mt = nvc0_miptree(pt);
+   unsigned stride;
+
+   if (!mt || !mt->base.bo)
+      return FALSE;
+
+   stride = util_format_get_stride(mt->base.base.format,
+                                   mt->base.base.width0);
+
+   return nouveau_screen_bo_get_handle(pscreen,
+                                       mt->base.bo,
+                                       stride,
+                                       whandle);
+}
+
+const struct u_resource_vtbl nvc0_miptree_vtbl =
+{
+   nvc0_miptree_get_handle,         /* get_handle */
+   nvc0_miptree_destroy,            /* resource_destroy */
+   NULL,                            /* is_resource_referenced */
+   nvc0_miptree_transfer_new,       /* get_transfer */
+   nvc0_miptree_transfer_del,       /* transfer_destroy */
+   nvc0_miptree_transfer_map,        /* transfer_map */
+   u_default_transfer_flush_region, /* transfer_flush_region */
+   nvc0_miptree_transfer_unmap,     /* transfer_unmap */
+   u_default_transfer_inline_write  /* transfer_inline_write */
+};
+
+struct pipe_resource *
+nvc0_miptree_create(struct pipe_screen *pscreen,
+                    const struct pipe_resource *templ)
+{
+   struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+   struct nvc0_miptree *mt = CALLOC_STRUCT(nvc0_miptree);
+   struct pipe_resource *pt = &mt->base.base;
+   int ret;
+   unsigned w, h, d, l, alloc_size;
+   uint32_t tile_flags;
+
+   if (!mt)
+      return NULL;
+
+   mt->base.vtbl = &nvc0_miptree_vtbl;
+   *pt = *templ;
+   pipe_reference_init(&pt->reference, 1);
+   pt->screen = pscreen;
+
+   mt->layout_3d = pt->target == PIPE_TEXTURE_3D;
+
+   w = pt->width0;
+   h = pt->height0;
+   d = mt->layout_3d ? pt->depth0 : 1;
+
+   switch (pt->format) {
+   case PIPE_FORMAT_Z16_UNORM:
+      tile_flags = 0x0700; /* COMPRESSED */
+      tile_flags = 0x0200; /* NORMAL ? */
+      tile_flags = 0x0100; /* NORMAL ? */
+      break;
+   case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+      tile_flags = 0x5300; /* MSAA 4, COMPRESSED */
+      tile_flags = 0x4600; /* NORMAL */
+      break;
+   case PIPE_FORMAT_Z24X8_UNORM:
+   case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+      tile_flags = 0x1100; /* NORMAL */
+      if (w * h >= 128 * 128 && 0)
+         tile_flags = 0x1700; /* COMPRESSED, requires magic */
+      break;
+   case PIPE_FORMAT_R32G32B32A32_FLOAT:
+      tile_flags = 0xf500; /* COMPRESSED */
+      tile_flags = 0xf700; /* MSAA 2 */
+      tile_flags = 0xf900; /* MSAA 4 */
+      tile_flags = 0xfe00; /* NORMAL */
+      break;
+   case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED:
+      tile_flags = 0xce00; /* COMPRESSED */
+      tile_flags = 0xcf00; /* MSAA 2, COMPRESSED */
+      tile_flags = 0xd000; /* MSAA 4, COMPRESSED */
+      tile_flags = 0xc300; /* NORMAL */
+      break;
+   case PIPE_FORMAT_R16G16B16A16_UNORM:
+      tile_flags = 0xe900; /* COMPRESSED */
+      break;
+   default:
+      tile_flags = 0xe000; /* MSAA 4, COMPRESSED 32 BIT */
+      tile_flags = 0xfe00; /* NORMAL 32 BIT */
+      if (w * h >= 128 * 128 && 0)
+         tile_flags = 0xdb00; /* COMPRESSED 32 BIT, requires magic */
+      break;
+   }
+
+   /* For 3D textures, a mipmap is spanned by all the layers, for array
+    * textures and cube maps, each layer contains its own mipmaps.
+    */
+   for (l = 0; l <= pt->last_level; ++l) {
+      struct nvc0_miptree_level *lvl = &mt->level[l];
+      unsigned nbx = util_format_get_nblocksx(pt->format, w);
+      unsigned nby = util_format_get_nblocksy(pt->format, h);
+      unsigned blocksize = util_format_get_blocksize(pt->format);
+
+      lvl->offset = mt->total_size;
+      lvl->tile_mode = get_tile_dims(nbx, nby, d);
+      lvl->pitch = align(nbx * blocksize, NVC0_TILE_PITCH(lvl->tile_mode));
+
+      mt->total_size += lvl->pitch *
+         align(nby, NVC0_TILE_HEIGHT(lvl->tile_mode)) *
+         align(d, NVC0_TILE_DEPTH(lvl->tile_mode));
+
+      w = u_minify(w, 1);
+      h = u_minify(h, 1);
+      d = u_minify(d, 1);
+   }
+
+   if (pt->array_size > 1) {
+      mt->layer_stride = align(mt->total_size,
+                               NVC0_TILE_SIZE(mt->level[0].tile_mode));
+      mt->total_size = mt->layer_stride * pt->array_size;
+   }
+
+   alloc_size = mt->total_size;
+   if (tile_flags == 0x1700)
+      alloc_size *= 3; /* HiZ, XXX: correct size */
+
+   ret = nouveau_bo_new_tile(dev, NOUVEAU_BO_VRAM, 256, alloc_size,
+                             mt->level[0].tile_mode, tile_flags,
+                             &mt->base.bo);
+   if (ret) {
+      FREE(mt);
+      return NULL;
+   }
+   mt->base.domain = NOUVEAU_BO_VRAM;
+
+   return pt;
+}
+
+struct pipe_resource *
+nvc0_miptree_from_handle(struct pipe_screen *pscreen,
+                         const struct pipe_resource *templ,
+                         struct winsys_handle *whandle)
+{
+   struct nvc0_miptree *mt;
+   unsigned stride;
+
+   /* only supports 2D, non-mipmapped textures for the moment */
+   if ((templ->target != PIPE_TEXTURE_2D &&
+        templ->target != PIPE_TEXTURE_RECT) ||
+       templ->last_level != 0 ||
+       templ->depth0 != 1 ||
+       templ->array_size > 1)
+      return NULL;
+
+   mt = CALLOC_STRUCT(nvc0_miptree);
+   if (!mt)
+      return NULL;
+
+   mt->base.bo = nouveau_screen_bo_from_handle(pscreen, whandle, &stride);
+   if (mt->base.bo == NULL) {
+      FREE(mt);
+      return NULL;
+   }
+
+   mt->base.base = *templ;
+   mt->base.vtbl = &nvc0_miptree_vtbl;
+   pipe_reference_init(&mt->base.base.reference, 1);
+   mt->base.base.screen = pscreen;
+   mt->level[0].pitch = stride;
+   mt->level[0].offset = 0;
+   mt->level[0].tile_mode = mt->base.bo->tile_mode;
+
+   /* no need to adjust bo reference count */
+   return &mt->base.base;
+}
+
+
+/* Surface functions.
+ */
+
+struct pipe_surface *
+nvc0_miptree_surface_new(struct pipe_context *pipe,
+                         struct pipe_resource *pt,
+                         const struct pipe_surface *templ)
+{
+   struct nvc0_miptree *mt = nvc0_miptree(pt); /* guaranteed */
+   struct nvc0_surface *ns;
+   struct pipe_surface *ps;
+   struct nvc0_miptree_level *lvl = &mt->level[templ->u.tex.level];
+
+   ns = CALLOC_STRUCT(nvc0_surface);
+   if (!ns)
+      return NULL;
+   ps = &ns->base;
+
+   pipe_reference_init(&ps->reference, 1);
+   pipe_resource_reference(&ps->texture, pt);
+   ps->context = pipe;
+   ps->format = pt->format;
+   ps->usage = templ->usage;
+   ps->u.tex.level = templ->u.tex.level;
+   ps->u.tex.first_layer = templ->u.tex.first_layer;
+   ps->u.tex.last_layer = templ->u.tex.last_layer;
+
+   ns->width = u_minify(pt->width0, ps->u.tex.level);
+   ns->height = u_minify(pt->height0, ps->u.tex.level);
+   ns->depth = ps->u.tex.last_layer - ps->u.tex.first_layer + 1;
+   ns->offset = lvl->offset;
+
+   /* comment says there are going to be removed, but they're used by the st */
+   ps->width = ns->width;
+   ps->height = ns->height;
+
+   if (mt->layout_3d) {
+      unsigned zslice = ps->u.tex.first_layer;
+
+      /* TODO: re-layout the texture to use only depth 1 tiles in this case: */
+      if (ns->depth > 1 && (zslice & (NVC0_TILE_DEPTH(lvl->tile_mode) - 1)))
+         NOUVEAU_ERR("Creating unsupported 3D surface of slices [%u:%u].\n",
+                     zslice, ps->u.tex.last_layer);
+
+      ns->offset += calc_zslice_offset(lvl->tile_mode, zslice, lvl->pitch,
+                                       util_format_get_nblocksy(pt->format,
+                                                                ns->height));
+   } else {
+      ns->offset += mt->layer_stride * ps->u.tex.first_layer;
+   }
+
+   return ps;
+}
+
+void
+nvc0_miptree_surface_del(struct pipe_context *pipe, struct pipe_surface *ps)
+{
+   struct nvc0_surface *s = nvc0_surface(ps);
+
+   pipe_resource_reference(&ps->texture, NULL);
+
+   FREE(s);
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_mm.c b/src/gallium/drivers/nvc0/nvc0_mm.c
new file mode 100644 (file)
index 0000000..0629dad
--- /dev/null
@@ -0,0 +1,274 @@
+
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_double_list.h"
+
+#include "nvc0_screen.h"
+
+#define MM_MIN_ORDER 7
+#define MM_MAX_ORDER 20
+
+#define MM_NUM_BUCKETS (MM_MAX_ORDER - MM_MIN_ORDER + 1)
+
+#define MM_MIN_SIZE (1 << MM_MIN_ORDER)
+#define MM_MAX_SIZE (1 << MM_MAX_ORDER)
+
+struct mm_bucket {
+   struct list_head free;
+   struct list_head used;
+   struct list_head full;
+   int num_free;
+};
+
+struct nvc0_mman {
+   struct nouveau_device *dev;
+   struct mm_bucket bucket[MM_NUM_BUCKETS];
+   uint32_t storage_type;
+   uint32_t domain;
+   uint64_t allocated;
+};
+
+struct mm_slab {
+   struct list_head head;
+   struct nouveau_bo *bo;
+   struct nvc0_mman *cache;
+   int order;
+   int count;
+   int free;
+   uint32_t bits[0];
+};
+
+static int
+mm_slab_alloc(struct mm_slab *slab)
+{
+   int i, n, b;
+
+   if (slab->free == 0)
+      return -1;
+
+   for (i = 0; i < (slab->count + 31) / 32; ++i) {
+      b = ffs(slab->bits[i]) - 1;
+      if (b >= 0) {
+         n = i * 32 + b;
+         assert(n < slab->count);
+         slab->free--;
+         slab->bits[i] &= ~(1 << b);
+         return n;
+      }
+   }
+   return -1;
+}
+
+static INLINE void
+mm_slab_free(struct mm_slab *slab, int i)
+{
+   assert(i < slab->count);
+   slab->bits[i / 32] |= 1 << (i % 32);
+   slab->free++;
+   assert(slab->free <= slab->count);
+}
+
+static INLINE int
+mm_get_order(uint32_t size)
+{
+   int s = __builtin_clz(size) ^ 31;
+
+   if (size > (1 << s))
+      s += 1;
+   return s;
+}
+
+static struct mm_bucket *
+mm_bucket_by_order(struct nvc0_mman *cache, int order)
+{
+   if (order > MM_MAX_ORDER)
+      return NULL;
+   return &cache->bucket[MAX2(order, MM_MIN_ORDER) - MM_MIN_ORDER];
+}
+
+static struct mm_bucket *
+mm_bucket_by_size(struct nvc0_mman *cache, unsigned size)
+{
+   return mm_bucket_by_order(cache, mm_get_order(size));
+}
+
+/* size of bo allocation for slab with chunks of (1 << chunk_order) bytes */
+static INLINE uint32_t
+mm_default_slab_size(unsigned chunk_order)
+{
+   assert(chunk_order <= MM_MAX_ORDER && chunk_order >= MM_MIN_ORDER);
+
+   static const int8_t slab_order[MM_MAX_ORDER - MM_MIN_ORDER + 1] =
+   {
+      12, 12, 13, 14, 14, 17, 17, 17, 17, 19, 19, 20, 21, 22
+   };
+
+   return 1 << slab_order[chunk_order - MM_MIN_ORDER];
+}
+
+static int
+mm_slab_new(struct nvc0_mman *cache, int chunk_order)
+{
+   struct mm_slab *slab;
+   int words, ret;
+   const uint32_t size = mm_default_slab_size(chunk_order);
+
+   words = ((size >> chunk_order) + 31) / 32;
+   assert(words);
+
+   slab = MALLOC(sizeof(struct mm_slab) + words * 4);
+   if (!slab)
+      return PIPE_ERROR_OUT_OF_MEMORY;
+
+   memset(&slab->bits[0], ~0, words * 4);
+
+   slab->bo = NULL;
+   ret = nouveau_bo_new_tile(cache->dev, cache->domain, 0, size,
+                             0, cache->storage_type, &slab->bo);
+   if (ret) {
+      FREE(slab);
+      return PIPE_ERROR_OUT_OF_MEMORY;
+   }
+
+   LIST_INITHEAD(&slab->head);
+
+   slab->cache = cache;
+   slab->order = chunk_order;
+   slab->count = slab->free = size >> chunk_order;
+
+   LIST_ADD(&slab->head, &mm_bucket_by_order(cache, chunk_order)->free);
+
+   cache->allocated += size;
+
+   debug_printf("MM: new slab, total memory = %lu KiB\n",
+                cache->allocated / 1024);
+
+   return PIPE_OK;
+}
+
+/* @return token to identify slab or NULL if we just allocated a new bo */
+struct nvc0_mm_allocation *
+nvc0_mm_allocate(struct nvc0_mman *cache,
+                 uint32_t size, struct nouveau_bo **bo, uint32_t *offset)
+{
+   struct mm_bucket *bucket;
+   struct mm_slab *slab;
+   struct nvc0_mm_allocation *alloc;
+   int ret;
+
+   bucket = mm_bucket_by_size(cache, size);
+   if (!bucket) {
+      ret = nouveau_bo_new_tile(cache->dev, cache->domain, 0, size,
+                                0, cache->storage_type, bo);
+      if (ret)
+         debug_printf("bo_new(%x, %x): %i\n", size, cache->storage_type, ret);
+
+      *offset = 0;
+      return NULL;
+   }
+
+   if (!LIST_IS_EMPTY(&bucket->used)) {
+      slab = LIST_ENTRY(struct mm_slab, bucket->used.next, head);
+   } else {
+      if (LIST_IS_EMPTY(&bucket->free)) {
+         mm_slab_new(cache, MAX2(mm_get_order(size), MM_MIN_ORDER));
+      }
+      slab = LIST_ENTRY(struct mm_slab, bucket->free.next, head);
+
+      LIST_DEL(&slab->head);
+      LIST_ADD(&slab->head, &bucket->used);
+   }
+
+   *offset = mm_slab_alloc(slab) << slab->order;
+
+   alloc = MALLOC_STRUCT(nvc0_mm_allocation);
+   if (!alloc)
+      return NULL;
+
+   nouveau_bo_ref(slab->bo, bo);
+
+   if (slab->free == 0) {
+      LIST_DEL(&slab->head);
+      LIST_ADD(&slab->head, &bucket->full);
+   }
+
+   alloc->next = NULL;
+   alloc->offset = *offset;
+   alloc->priv = (void *)slab;
+
+   return alloc;
+}
+
+void
+nvc0_mm_free(struct nvc0_mm_allocation *alloc)
+{
+   struct mm_slab *slab = (struct mm_slab *)alloc->priv;
+   struct mm_bucket *bucket = mm_bucket_by_order(slab->cache, slab->order);
+
+   mm_slab_free(slab, alloc->offset >> slab->order);
+
+   if (slab->free == 1) {
+      LIST_DEL(&slab->head);
+
+      if (slab->count > 1)
+         LIST_ADDTAIL(&slab->head, &bucket->used);
+      else
+         LIST_ADDTAIL(&slab->head, &bucket->free);
+   }
+
+   FREE(alloc);
+}
+
+struct nvc0_mman *
+nvc0_mm_create(struct nouveau_device *dev, uint32_t domain,
+               uint32_t storage_type)
+{
+   struct nvc0_mman *cache = MALLOC_STRUCT(nvc0_mman);
+   int i;
+
+   if (!cache)
+      return NULL;
+
+   cache->dev = dev;
+   cache->domain = domain;
+   cache->storage_type = storage_type;
+   cache->allocated = 0;
+
+   for (i = 0; i < MM_NUM_BUCKETS; ++i) {
+      LIST_INITHEAD(&cache->bucket[i].free);
+      LIST_INITHEAD(&cache->bucket[i].used);
+      LIST_INITHEAD(&cache->bucket[i].full);
+   }
+
+   return cache;
+}
+
+static INLINE void
+nvc0_mm_free_slabs(struct list_head *head)
+{
+   struct mm_slab *slab, *next;
+
+   LIST_FOR_EACH_ENTRY_SAFE(slab, next, head, head) {
+      LIST_DEL(&slab->head);
+      nouveau_bo_ref(NULL, &slab->bo);
+      FREE(slab);
+   }
+}
+
+void
+nvc0_mm_destroy(struct nvc0_mman *cache)
+{
+   int i;
+
+   for (i = 0; i < MM_NUM_BUCKETS; ++i) {
+      if (!LIST_IS_EMPTY(&cache->bucket[i].used) ||
+          !LIST_IS_EMPTY(&cache->bucket[i].full))
+         debug_printf("WARNING: destroying GPU memory cache "
+                      "with some buffers still in use\n");
+
+      nvc0_mm_free_slabs(&cache->bucket[i].free);
+      nvc0_mm_free_slabs(&cache->bucket[i].used);
+      nvc0_mm_free_slabs(&cache->bucket[i].full);
+   }
+}
+
diff --git a/src/gallium/drivers/nvc0/nvc0_pc.c b/src/gallium/drivers/nvc0/nvc0_pc.c
new file mode 100644 (file)
index 0000000..304a191
--- /dev/null
@@ -0,0 +1,693 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#define NOUVEAU_DEBUG 1
+
+#include "nvc0_pc.h"
+#include "nvc0_program.h"
+
+boolean
+nvc0_insn_can_load(struct nv_instruction *nvi, int s,
+                   struct nv_instruction *ld)
+{
+   int i;
+
+   if (ld->opcode == NV_OP_MOV && ld->src[0]->value->reg.file == NV_FILE_IMM) {
+      if (s > 1 || !(nvc0_op_info_table[nvi->opcode].immediate & (1 << s)))
+         return FALSE;
+      if (!(nvc0_op_info_table[nvi->opcode].immediate & 4))
+         if (ld->src[0]->value->reg.imm.u32 & 0xfff)
+            return FALSE;
+   } else
+   if (!(nvc0_op_info_table[nvi->opcode].memory & (1 << s)))
+      return FALSE;
+
+   if (ld->indirect >= 0)
+      return FALSE;
+
+   for (i = 0; i < 3 && nvi->src[i]; ++i)
+      if (nvi->src[i]->value->reg.file == NV_FILE_IMM)
+         return FALSE;
+
+   return TRUE;
+}
+
+/* Return whether this instruction can be executed conditionally. */
+boolean
+nvc0_insn_is_predicateable(struct nv_instruction *nvi)
+{
+   int s;
+
+   if (!nv_op_predicateable(nvi->opcode))
+      return FALSE;
+   if (nvi->predicate >= 0)
+      return FALSE;
+   for (s = 0; s < 4 && nvi->src[s]; ++s)
+      if (nvi->src[s]->value->reg.file == NV_FILE_IMM)
+         return FALSE;
+   return TRUE;
+}
+
+int
+nvc0_insn_refcount(struct nv_instruction *nvi)
+{
+   int rc = 0;
+   int i;
+   for (i = 0; i < 5 && nvi->def[i]; ++i) {
+      if (!nvi->def[i])
+         return rc;
+      rc += nvi->def[i]->refc;
+   }
+   return rc;
+}
+
+int
+nvc0_pc_replace_value(struct nv_pc *pc,
+                     struct nv_value *old_val,
+                     struct nv_value *new_val)
+{
+   int i, n, s;
+
+   if (old_val == new_val)
+      return old_val->refc;
+
+   for (i = 0, n = 0; i < pc->num_refs; ++i) {
+      if (pc->refs[i]->value == old_val) {
+         ++n;
+         for (s = 0; s < 6 && pc->refs[i]->insn->src[s]; ++s)
+            if (pc->refs[i]->insn->src[s] == pc->refs[i])
+               break;
+         assert(s < 6);
+         nv_reference(pc, pc->refs[i]->insn, s, new_val);
+      }
+   }
+   return n;
+}
+
+struct nv_value *
+nvc0_pc_find_constant(struct nv_ref *ref)
+{
+   struct nv_value *src;
+
+   if (!ref)
+      return NULL;
+
+   src = ref->value;
+   while (src->insn && src->insn->opcode == NV_OP_MOV) {
+      assert(!src->insn->src[0]->mod);
+      src = src->insn->src[0]->value;
+   }
+   if ((src->reg.file == NV_FILE_IMM) ||
+       (src->insn &&
+        src->insn->opcode == NV_OP_LD &&
+        src->insn->src[0]->value->reg.file >= NV_FILE_MEM_C(0) &&
+        src->insn->src[0]->value->reg.file <= NV_FILE_MEM_C(15)))
+      return src;
+   return NULL;
+}
+
+struct nv_value *
+nvc0_pc_find_immediate(struct nv_ref *ref)
+{
+   struct nv_value *src = nvc0_pc_find_constant(ref);
+
+   return (src && src->reg.file == NV_FILE_IMM) ? src : NULL;
+}
+
+static void
+nv_pc_free_refs(struct nv_pc *pc)
+{
+   int i;
+   for (i = 0; i < pc->num_refs; i += 64)
+      FREE(pc->refs[i]);
+   FREE(pc->refs);
+}
+
+static const char *
+edge_name(ubyte type)
+{
+   switch (type) {
+   case CFG_EDGE_FORWARD: return "forward";
+   case CFG_EDGE_BACK: return "back";
+   case CFG_EDGE_LOOP_ENTER: return "loop";
+   case CFG_EDGE_LOOP_LEAVE: return "break";
+   case CFG_EDGE_FAKE: return "fake";
+   default:
+      return "?";
+   }
+}
+
+void
+nvc0_pc_pass_in_order(struct nv_basic_block *root, nv_pc_pass_func f,
+                      void *priv)
+{
+   struct nv_basic_block *bb[64], *bbb[16], *b;
+   int j, p, pp;
+
+   bb[0] = root;
+   p = 1;
+   pp = 0;
+
+   while (p > 0) {
+      b = bb[--p];
+      b->priv = 0;
+
+      for (j = 1; j >= 0; --j) {
+         if (!b->out[j])
+            continue;
+
+         switch (b->out_kind[j]) {
+         case CFG_EDGE_BACK:
+            continue;
+         case CFG_EDGE_FORWARD:
+         case CFG_EDGE_FAKE:
+            if (++b->out[j]->priv == b->out[j]->num_in)
+               bb[p++] = b->out[j];
+            break;
+         case CFG_EDGE_LOOP_ENTER:
+            bb[p++] = b->out[j];
+            break;
+         case CFG_EDGE_LOOP_LEAVE:
+            bbb[pp++] = b->out[j];
+            break;
+         default:
+            assert(0);
+            break;
+         }
+      }
+
+      f(priv, b);
+
+      if (!p) {
+         p = pp;
+         for (; pp > 0; --pp)
+            bb[pp - 1] = bbb[pp - 1];
+      }
+   }
+}
+
+static void
+nv_do_print_function(void *priv, struct nv_basic_block *b)
+{
+   struct nv_instruction *i;
+
+   debug_printf("=== BB %i ", b->id);
+   if (b->out[0])
+      debug_printf("[%s -> %i] ", edge_name(b->out_kind[0]), b->out[0]->id);
+   if (b->out[1])
+      debug_printf("[%s -> %i] ", edge_name(b->out_kind[1]), b->out[1]->id);
+   debug_printf("===\n");
+
+   i = b->phi;
+   if (!i)
+      i = b->entry;
+   for (; i; i = i->next)
+      nvc0_print_instruction(i);
+}
+
+void
+nvc0_print_function(struct nv_basic_block *root)
+{
+   if (root->subroutine)
+      debug_printf("SUBROUTINE %i\n", root->subroutine);
+   else
+      debug_printf("MAIN\n");
+
+   nvc0_pc_pass_in_order(root, nv_do_print_function, root);
+}
+
+void
+nvc0_print_program(struct nv_pc *pc)
+{
+   int i;
+   for (i = 0; i < pc->num_subroutines + 1; ++i)
+      if (pc->root[i])
+         nvc0_print_function(pc->root[i]);
+}
+
+#if NOUVEAU_DEBUG > 1
+static void
+nv_do_print_cfgraph(struct nv_pc *pc, FILE *f, struct nv_basic_block *b)
+{
+   int i;
+
+   b->pass_seq = pc->pass_seq;
+
+   fprintf(f, "\t%i [shape=box]\n", b->id);
+
+   for (i = 0; i < 2; ++i) {
+      if (!b->out[i])
+         continue;
+      switch (b->out_kind[i]) {
+      case CFG_EDGE_FORWARD:
+         fprintf(f, "\t%i -> %i;\n", b->id, b->out[i]->id);
+         break;
+      case CFG_EDGE_LOOP_ENTER:
+         fprintf(f, "\t%i -> %i [color=green];\n", b->id, b->out[i]->id);
+         break;
+      case CFG_EDGE_LOOP_LEAVE:
+         fprintf(f, "\t%i -> %i [color=red];\n", b->id, b->out[i]->id);
+         break;
+      case CFG_EDGE_BACK:
+         fprintf(f, "\t%i -> %i;\n", b->id, b->out[i]->id);
+         continue;
+      case CFG_EDGE_FAKE:
+         fprintf(f, "\t%i -> %i [style=dotted];\n", b->id, b->out[i]->id);
+         break;
+      default:
+         assert(0);
+         break;
+      }
+      if (b->out[i]->pass_seq < pc->pass_seq)
+         nv_do_print_cfgraph(pc, f, b->out[i]);
+   }
+}
+
+/* Print the control flow graph of subroutine @subr (0 == MAIN) to a file. */
+static void
+nv_print_cfgraph(struct nv_pc *pc, const char *filepath, int subr)
+{
+   FILE *f;
+
+   f = fopen(filepath, "a");
+   if (!f)
+      return;
+
+   fprintf(f, "digraph G {\n");
+
+   ++pc->pass_seq;
+
+   nv_do_print_cfgraph(pc, f, pc->root[subr]);
+
+   fprintf(f, "}\n");
+
+   fclose(f);
+}
+#endif
+
+static INLINE void
+nvc0_pc_print_binary(struct nv_pc *pc)
+{
+   unsigned i;
+
+   NOUVEAU_DBG("nvc0_pc_print_binary(%u ops)\n", pc->emit_size / 8);
+
+   for (i = 0; i < pc->emit_size / 4; i += 2) {
+      debug_printf("0x%08x ", pc->emit[i + 0]);
+      debug_printf("0x%08x ", pc->emit[i + 1]);
+      if ((i % 16) == 15)
+         debug_printf("\n");
+   }
+   debug_printf("\n");
+}
+
+static int
+nvc0_emit_program(struct nv_pc *pc)
+{
+   uint32_t *code = pc->emit;
+   int n;
+
+   NOUVEAU_DBG("emitting program: size = %u\n", pc->emit_size);
+
+   pc->emit_pos = 0;
+   for (n = 0; n < pc->num_blocks; ++n) {
+      struct nv_instruction *i;
+      struct nv_basic_block *b = pc->bb_list[n];
+
+      for (i = b->entry; i; i = i->next) {
+         nvc0_emit_instruction(pc, i);
+         pc->emit += 2;
+         pc->emit_pos += 8;
+      }
+   }
+   assert(pc->emit == &code[pc->emit_size / 4]);
+
+   pc->emit[0] = 0x00001de7;
+   pc->emit[1] = 0x80000000;
+   pc->emit_size += 8;
+
+   pc->emit = code;
+
+#ifdef NOUVEAU_DEBUG
+   nvc0_pc_print_binary(pc);
+#else
+   debug_printf("not printing binary\n");
+#endif
+   return 0;
+}
+
+int
+nvc0_generate_code(struct nvc0_translation_info *ti)
+{
+   struct nv_pc *pc;
+   int ret;
+   int i;
+
+   pc = CALLOC_STRUCT(nv_pc);
+   if (!pc)
+      return 1;
+
+   pc->is_fragprog = ti->prog->type == PIPE_SHADER_FRAGMENT;
+
+   pc->root = CALLOC(ti->num_subrs + 1, sizeof(pc->root[0]));
+   if (!pc->root) {
+      FREE(pc);
+      return 1;
+   }
+   pc->num_subroutines = ti->num_subrs;
+
+   ret = nvc0_tgsi_to_nc(pc, ti);
+   if (ret)
+      goto out;
+#if NOUVEAU_DEBUG > 1
+   nvc0_print_program(pc);
+#endif
+
+   pc->opt_reload_elim = ti->require_stores ? FALSE : TRUE;
+
+   /* optimization */
+   ret = nvc0_pc_exec_pass0(pc);
+   if (ret)
+      goto out;
+#ifdef NOUVEAU_DEBUG
+   nvc0_print_program(pc);
+#endif
+
+   /* register allocation */
+   ret = nvc0_pc_exec_pass1(pc);
+   if (ret)
+      goto out;
+#if NOUVEAU_DEBUG > 1
+   nvc0_print_program(pc);
+   nv_print_cfgraph(pc, "nvc0_shader_cfgraph.dot", 0);
+#endif
+
+   /* prepare for emission */
+   ret = nvc0_pc_exec_pass2(pc);
+   if (ret)
+      goto out;
+   assert(!(pc->emit_size % 8));
+
+   pc->emit = CALLOC(pc->emit_size / 4 + 2, 4);
+   if (!pc->emit) {
+      ret = 3;
+      goto out;
+   }
+   ret = nvc0_emit_program(pc);
+   if (ret)
+      goto out;
+
+   ti->prog->code = pc->emit;
+   ti->prog->code_base = 0;
+   ti->prog->code_size = pc->emit_size;
+   ti->prog->parm_size = 0;
+
+   ti->prog->max_gpr = MAX2(4, pc->max_reg[NV_FILE_GPR] + 1);
+
+   ti->prog->relocs = pc->reloc_entries;
+   ti->prog->num_relocs = pc->num_relocs;
+
+   NOUVEAU_DBG("SHADER TRANSLATION - %s\n", ret ? "failure" : "success");
+
+out:
+   nv_pc_free_refs(pc);
+
+   for (i = 0; i < pc->num_blocks; ++i)
+      FREE(pc->bb_list[i]);
+   if (pc->root)
+      FREE(pc->root);
+   if (ret) {
+      /* on success, these will be referenced by struct nvc0_program */
+      if (pc->emit)
+         FREE(pc->emit);
+      if (pc->immd_buf)
+         FREE(pc->immd_buf);
+      if (pc->reloc_entries)
+         FREE(pc->reloc_entries);
+   }
+   FREE(pc);
+   return ret;
+}
+
+static void
+nvbb_insert_phi(struct nv_basic_block *b, struct nv_instruction *i)
+{
+   if (!b->phi) {
+      i->prev = NULL;
+      b->phi = i;
+      i->next = b->entry;
+      if (b->entry) {
+         assert(!b->entry->prev && b->exit);
+         b->entry->prev = i;
+      } else {
+         b->entry = i;
+         b->exit = i;
+      }
+   } else {
+      assert(b->entry);
+      if (b->entry->opcode == NV_OP_PHI) { /* insert after entry */
+         assert(b->entry == b->exit);
+         b->entry->next = i;
+         i->prev = b->entry;
+         b->entry = i;
+         b->exit = i;
+      } else { /* insert before entry */
+         assert(b->entry->prev && b->exit);
+         i->next = b->entry;
+         i->prev = b->entry->prev;
+         b->entry->prev = i;
+         i->prev->next = i;
+      }
+   }
+}
+
+void
+nvc0_insn_append(struct nv_basic_block *b, struct nv_instruction *i)
+{
+   if (i->opcode == NV_OP_PHI) {
+      nvbb_insert_phi(b, i);
+   } else {
+      i->prev = b->exit;
+      if (b->exit)
+         b->exit->next = i;
+      b->exit = i;
+      if (!b->entry)
+         b->entry = i;
+      else
+      if (i->prev && i->prev->opcode == NV_OP_PHI)
+         b->entry = i;
+   }
+
+   i->bb = b;
+   b->num_instructions++;
+}
+
+void
+nvc0_insn_insert_after(struct nv_instruction *at, struct nv_instruction *ni)
+{
+   if (!at->next) {
+      nvc0_insn_append(at->bb, ni);
+      return;
+   }
+   ni->next = at->next;
+   ni->prev = at;
+   ni->next->prev = ni;
+   ni->prev->next = ni;
+}
+
+void
+nvc0_insn_insert_before(struct nv_instruction *at, struct nv_instruction *ni)
+{
+   nvc0_insn_insert_after(at, ni);
+   nvc0_insns_permute(at, ni);
+}
+
+void
+nvc0_insn_delete(struct nv_instruction *nvi)
+{
+   struct nv_basic_block *b = nvi->bb;
+   int s;
+
+   /* debug_printf("REM: "); nv_print_instruction(nvi); */
+
+   for (s = 0; s < 6 && nvi->src[s]; ++s)
+      nv_reference(NULL, nvi, s, NULL);
+
+   if (nvi->next)
+      nvi->next->prev = nvi->prev;
+   else {
+      assert(nvi == b->exit);
+      b->exit = nvi->prev;
+   }
+
+   if (nvi->prev)
+      nvi->prev->next = nvi->next;
+
+   if (nvi == b->entry) {
+      /* PHIs don't get hooked to b->entry */
+      b->entry = nvi->next;
+      assert(!nvi->prev || nvi->prev->opcode == NV_OP_PHI);
+   }
+
+   if (nvi == b->phi) {
+      if (nvi->opcode != NV_OP_PHI)
+         NOUVEAU_DBG("NOTE: b->phi points to non-PHI instruction\n");
+
+      assert(!nvi->prev);
+      if (!nvi->next || nvi->next->opcode != NV_OP_PHI)
+         b->phi = NULL;
+      else
+         b->phi = nvi->next;
+   }
+}
+
+void
+nvc0_insns_permute(struct nv_instruction *i1, struct nv_instruction *i2)
+{
+   struct nv_basic_block *b = i1->bb;
+
+   assert(i1->opcode != NV_OP_PHI &&
+          i2->opcode != NV_OP_PHI);
+   assert(i1->next == i2);
+
+   if (b->exit == i2)
+      b->exit = i1;
+
+   if (b->entry == i1)
+      b->entry = i2;
+
+   i2->prev = i1->prev;
+   i1->next = i2->next;
+   i2->next = i1;
+   i1->prev = i2;
+
+   if (i2->prev)
+      i2->prev->next = i2;
+   if (i1->next)
+      i1->next->prev = i1;
+}
+
+void
+nvc0_bblock_attach(struct nv_basic_block *parent,
+                  struct nv_basic_block *b, ubyte edge_kind)
+{
+   assert(b->num_in < 8);
+
+   if (parent->out[0]) {
+      assert(!parent->out[1]);
+      parent->out[1] = b;
+      parent->out_kind[1] = edge_kind;
+   } else {
+      parent->out[0] = b;
+      parent->out_kind[0] = edge_kind;
+   }
+
+   b->in[b->num_in] = parent;
+   b->in_kind[b->num_in++] = edge_kind;
+}
+
+/* NOTE: all BRKs are treated as conditional, so there are 2 outgoing BBs */
+
+boolean
+nvc0_bblock_dominated_by(struct nv_basic_block *b, struct nv_basic_block *d)
+{
+   int j;
+
+   if (b == d)
+      return TRUE;
+
+   for (j = 0; j < b->num_in; ++j)
+      if ((b->in_kind[j] != CFG_EDGE_BACK) &&
+          !nvc0_bblock_dominated_by(b->in[j], d))
+         return FALSE;
+
+   return j ? TRUE : FALSE;
+}
+
+/* check if @bf (future) can be reached from @bp (past), stop at @bt */
+boolean
+nvc0_bblock_reachable_by(struct nv_basic_block *bf, struct nv_basic_block *bp,
+                        struct nv_basic_block *bt)
+{
+   struct nv_basic_block *q[NV_PC_MAX_BASIC_BLOCKS], *b;
+   int i, p, n;
+
+   p = 0;
+   n = 1;
+   q[0] = bp;
+
+   while (p < n) {
+      b = q[p++];
+
+      if (b == bf)
+         break;
+      if (b == bt)
+         continue;
+      assert(n <= (1024 - 2));
+
+      for (i = 0; i < 2; ++i) {
+         if (b->out[i] && !IS_WALL_EDGE(b->out_kind[i]) && !b->out[i]->priv) {
+            q[n] = b->out[i];
+            q[n++]->priv = 1;
+         }
+      }
+   }
+   for (--n; n >= 0; --n)
+      q[n]->priv = 0;
+
+   return (b == bf);
+}
+
+static struct nv_basic_block *
+nvbb_find_dom_frontier(struct nv_basic_block *b, struct nv_basic_block *df)
+{
+   struct nv_basic_block *out;
+   int i;
+
+   if (!nvc0_bblock_dominated_by(df, b)) {
+      for (i = 0; i < df->num_in; ++i) {
+         if (df->in_kind[i] == CFG_EDGE_BACK)
+            continue;
+         if (nvc0_bblock_dominated_by(df->in[i], b))
+            return df;
+      }
+   }
+   for (i = 0; i < 2 && df->out[i]; ++i) {
+      if (df->out_kind[i] == CFG_EDGE_BACK)
+         continue;
+      if ((out = nvbb_find_dom_frontier(b, df->out[i])))
+         return out;
+   }
+   return NULL;
+}
+
+struct nv_basic_block *
+nvc0_bblock_dom_frontier(struct nv_basic_block *b)
+{
+   struct nv_basic_block *df;
+   int i;
+
+   for (i = 0; i < 2 && b->out[i]; ++i)
+      if ((df = nvbb_find_dom_frontier(b, b->out[i])))
+         return df;
+   return NULL;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_pc.h b/src/gallium/drivers/nvc0/nvc0_pc.h
new file mode 100644 (file)
index 0000000..969cc68
--- /dev/null
@@ -0,0 +1,653 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __NVC0_COMPILER_H__
+#define __NVC0_COMPILER_H__
+
+#include <stdio.h>
+
+#ifndef NOUVEAU_DBG
+#ifdef NOUVEAU_DEBUG
+# define NOUVEAU_DBG(args...) debug_printf(args);
+#else
+# define NOUVEAU_DBG(args...)
+#endif
+#endif
+
+#ifndef NOUVEAU_ERR
+#define NOUVEAU_ERR(fmt, args...) \
+   fprintf(stderr, "%s:%d -  "fmt, __FUNCTION__, __LINE__, ##args);
+#endif
+
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_double_list.h"
+
+/* pseudo opcodes */
+#define NV_OP_UNDEF      0
+#define NV_OP_BIND       1
+#define NV_OP_MERGE      2
+#define NV_OP_PHI        3
+#define NV_OP_SELECT     4
+#define NV_OP_NOP        5
+
+/**
+ * BIND forces source operand i into the same register as destination operand i,
+ *  and the operands will be assigned consecutive registers (needed for TEX)
+ * SELECT forces its multiple source operands and its destination operand into
+ *  one and the same register.
+ */
+
+/* base opcodes */
+#define NV_OP_LD         6
+#define NV_OP_ST         7
+#define NV_OP_MOV        8
+#define NV_OP_AND        9
+#define NV_OP_OR        10
+#define NV_OP_XOR       11
+#define NV_OP_SHL       12
+#define NV_OP_SHR       13
+#define NV_OP_NOT       14
+#define NV_OP_SET       15
+#define NV_OP_ADD       16
+#define NV_OP_SUB       17
+#define NV_OP_MUL       18
+#define NV_OP_MAD       19
+#define NV_OP_ABS       20
+#define NV_OP_NEG       21
+#define NV_OP_MAX       22
+#define NV_OP_MIN       23
+#define NV_OP_CVT       24
+#define NV_OP_CEIL      25
+#define NV_OP_FLOOR     26
+#define NV_OP_TRUNC     27
+#define NV_OP_SAD       28
+
+/* shader opcodes */
+#define NV_OP_VFETCH    29
+#define NV_OP_PFETCH    30
+#define NV_OP_EXPORT    31
+#define NV_OP_LINTERP   32
+#define NV_OP_PINTERP   33
+#define NV_OP_EMIT      34
+#define NV_OP_RESTART   35
+#define NV_OP_TEX       36
+#define NV_OP_TXB       37
+#define NV_OP_TXL       38
+#define NV_OP_TXF       39
+#define NV_OP_TXQ       40
+#define NV_OP_QUADOP    41
+#define NV_OP_DFDX      42
+#define NV_OP_DFDY      43
+#define NV_OP_KIL       44
+
+/* control flow opcodes */
+#define NV_OP_BRA       45
+#define NV_OP_CALL      46
+#define NV_OP_RET       47
+#define NV_OP_EXIT      48
+#define NV_OP_BREAK     49
+#define NV_OP_BREAKADDR 50
+#define NV_OP_JOINAT    51
+#define NV_OP_JOIN      52
+
+/* typed opcodes */
+#define NV_OP_ADD_F32   NV_OP_ADD
+#define NV_OP_ADD_B32   53
+#define NV_OP_MUL_F32   NV_OP_MUL
+#define NV_OP_MUL_B32   54
+#define NV_OP_ABS_F32   NV_OP_ABS
+#define NV_OP_ABS_S32   55
+#define NV_OP_NEG_F32   NV_OP_NEG
+#define NV_OP_NEG_S32   56
+#define NV_OP_MAX_F32   NV_OP_MAX
+#define NV_OP_MAX_S32   57
+#define NV_OP_MAX_U32   58
+#define NV_OP_MIN_F32   NV_OP_MIN
+#define NV_OP_MIN_S32   59
+#define NV_OP_MIN_U32   60
+#define NV_OP_SET_F32   61
+#define NV_OP_SET_S32   62
+#define NV_OP_SET_U32   63
+#define NV_OP_SAR       64
+#define NV_OP_RCP       65
+#define NV_OP_RSQ       66
+#define NV_OP_LG2       67
+#define NV_OP_SIN       68
+#define NV_OP_COS       69
+#define NV_OP_EX2       70
+#define NV_OP_PRESIN    71
+#define NV_OP_PREEX2    72
+#define NV_OP_SAT       73
+
+/* newly added opcodes */
+#define NV_OP_SET_F32_AND 74
+#define NV_OP_SET_F32_OR  75
+#define NV_OP_SET_F32_XOR 76
+#define NV_OP_SELP        77
+#define NV_OP_SLCT        78
+#define NV_OP_SLCT_F32    NV_OP_SLCT
+#define NV_OP_SLCT_S32    79
+#define NV_OP_SLCT_U32    80
+#define NV_OP_SUB_F32     NV_OP_SUB
+#define NV_OP_SUB_S32     81
+#define NV_OP_MAD_F32     NV_OP_MAD
+#define NV_OP_FSET_F32    82
+#define NV_OP_TXG         83
+
+#define NV_OP_COUNT     84
+
+/* nv50 files omitted */
+#define NV_FILE_GPR      0
+#define NV_FILE_COND     1
+#define NV_FILE_PRED     2
+#define NV_FILE_IMM      16
+#define NV_FILE_MEM_S    32
+#define NV_FILE_MEM_V    34
+#define NV_FILE_MEM_A    35
+#define NV_FILE_MEM_L    48
+#define NV_FILE_MEM_G    64
+#define NV_FILE_MEM_C(i) (80 + i)
+
+#define NV_IS_MEMORY_FILE(f) ((f) >= NV_FILE_MEM_S)
+
+#define NV_MOD_NEG 1
+#define NV_MOD_ABS 2
+#define NV_MOD_NOT 4
+#define NV_MOD_SAT 8
+
+#define NV_TYPE_U8  0x00
+#define NV_TYPE_S8  0x01
+#define NV_TYPE_U16 0x02
+#define NV_TYPE_S16 0x03
+#define NV_TYPE_U32 0x04
+#define NV_TYPE_S32 0x05
+#define NV_TYPE_P32 0x07
+#define NV_TYPE_F32 0x09
+#define NV_TYPE_F64 0x0b
+#define NV_TYPE_VEC(x, n) (NV_TYPE_##x | (n << 4))
+#define NV_TYPE_ANY 0xff
+
+#define NV_TYPE_ISINT(t) ((t) < 7)
+#define NV_TYPE_ISSGD(t) ((t) & 1)
+
+#define NV_CC_FL 0x0
+#define NV_CC_LT 0x1
+#define NV_CC_EQ 0x2
+#define NV_CC_LE 0x3
+#define NV_CC_GT 0x4
+#define NV_CC_NE 0x5
+#define NV_CC_GE 0x6
+#define NV_CC_U  0x8
+#define NV_CC_TR 0xf
+#define NV_CC_O  0x10
+#define NV_CC_C  0x11
+#define NV_CC_A  0x12
+#define NV_CC_S  0x13
+
+#define NV_PC_MAX_INSTRUCTIONS 2048
+#define NV_PC_MAX_VALUES (NV_PC_MAX_INSTRUCTIONS * 4)
+
+#define NV_PC_MAX_BASIC_BLOCKS 1024
+
+struct nv_op_info {
+   uint base;                /* e.g. ADD_S32 -> ADD */
+   char name[12];
+   uint8_t type;
+   uint8_t mods;
+   unsigned flow        : 1;
+   unsigned commutative : 1;
+   unsigned vector      : 1;
+   unsigned predicate   : 1;
+   unsigned pseudo      : 1;
+   unsigned immediate   : 3;
+   unsigned memory      : 3;
+};
+
+extern struct nv_op_info nvc0_op_info_table[];
+
+#define NV_BASEOP(op) (nvc0_op_info_table[op].base)
+#define NV_OPTYPE(op) (nvc0_op_info_table[op].type)
+
+static INLINE uint
+nv_op_base(uint opcode)
+{
+   return nvc0_op_info_table[opcode].base;
+}
+
+static INLINE boolean
+nv_is_texture_op(uint opcode)
+{
+   return (opcode >= NV_OP_TEX && opcode <= NV_OP_TXQ);
+}
+
+static INLINE boolean
+nv_is_vector_op(uint opcode)
+{
+   return nvc0_op_info_table[opcode].vector ? TRUE : FALSE;
+}
+
+static INLINE boolean
+nv_op_commutative(uint opcode)
+{
+   return nvc0_op_info_table[opcode].commutative ? TRUE : FALSE;
+}
+
+static INLINE uint8_t
+nv_op_supported_src_mods(uint opcode)
+{
+   return nvc0_op_info_table[opcode].mods;
+}
+
+static INLINE boolean
+nv_op_predicateable(uint opcode)
+{
+   return nvc0_op_info_table[opcode].predicate ? TRUE : FALSE;
+}
+
+static INLINE uint
+nv_type_order(ubyte type)
+{
+   switch (type & 0xf) {
+   case NV_TYPE_U8:
+   case NV_TYPE_S8:
+      return 0;
+   case NV_TYPE_U16:
+   case NV_TYPE_S16:
+      return 1;
+   case NV_TYPE_U32:
+   case NV_TYPE_F32:
+   case NV_TYPE_S32:
+   case NV_TYPE_P32:
+      return 2;
+   case NV_TYPE_F64:
+      return 3;
+   }
+   assert(0);
+   return 0;
+}
+
+static INLINE uint
+nv_type_sizeof(ubyte type)
+{
+   if (type & 0xf0)
+      return (1 << nv_type_order(type)) * (type >> 4);
+   return 1 << nv_type_order(type);
+}
+
+static INLINE uint
+nv_type_sizeof_base(ubyte type)
+{
+   return 1 << nv_type_order(type);
+}
+
+struct nv_reg {
+   uint32_t address; /* for memory locations */
+   int id; /* for registers */
+   ubyte file;
+   ubyte size;
+   union {
+      int32_t s32;
+      int64_t s64;
+      uint64_t u64;
+      uint32_t u32;
+      float f32;
+      double f64;
+   } imm;
+};
+
+struct nv_range {
+   struct nv_range *next;
+   int bgn;
+   int end;
+};
+
+struct nv_ref;
+
+struct nv_value {
+   struct nv_reg reg; 
+   struct nv_instruction *insn;
+   struct nv_value *join;
+   struct nv_ref *last_use;
+   int n;
+   struct nv_range *livei;
+   int refc;
+   struct nv_value *next;
+   struct nv_value *prev;
+};
+
+struct nv_ref {
+   struct nv_value *value;
+   struct nv_instruction *insn;
+   struct list_head list; /* connects uses of the same value */
+   uint8_t mod;
+   uint8_t flags;
+};
+
+struct nv_basic_block;
+
+struct nv_instruction {
+   struct nv_instruction *next;
+   struct nv_instruction *prev;
+   uint opcode;
+   uint serial;
+
+   struct nv_value *def[5];
+   struct nv_ref *src[6];
+
+   int8_t predicate; /* index of predicate src */
+   int8_t indirect;  /* index of pointer src */
+
+   union {
+      struct {
+         uint8_t t; /* TIC binding */
+         uint8_t s; /* TSC binding */
+      } tex;
+      struct {
+         uint8_t d; /* output type */
+         uint8_t s; /* input type */
+      } cvt;
+   } ext;
+
+   struct nv_basic_block *bb;
+   struct nv_basic_block *target; /* target block of control flow insn */
+
+   unsigned cc         : 5; /* condition code */
+   unsigned fixed      : 1; /* don't optimize away (prematurely) */
+   unsigned terminator : 1;
+   unsigned join       : 1;
+   unsigned set_cond   : 4; /* 2nd byte */
+   unsigned saturate   : 1;
+   unsigned centroid   : 1;
+   unsigned flat       : 1;
+   unsigned patch      : 1;
+   unsigned lanes      : 4; /* 3rd byte */
+   unsigned tex_dim    : 2;
+   unsigned tex_array  : 1;
+   unsigned tex_cube   : 1;
+   unsigned tex_shadow : 1; /* 4th byte */
+   unsigned tex_live   : 1;
+   unsigned tex_mask   : 4;
+
+   uint8_t quadop;
+};
+
+static INLINE int
+nvi_vector_size(struct nv_instruction *nvi)
+{
+   int i;
+   assert(nvi);
+   for (i = 0; i < 5 && nvi->def[i]; ++i);
+   return i;
+}
+
+#define CFG_EDGE_FORWARD     0
+#define CFG_EDGE_BACK        1
+#define CFG_EDGE_LOOP_ENTER  2
+#define CFG_EDGE_LOOP_LEAVE  4
+#define CFG_EDGE_FAKE        8
+
+/* 'WALL' edge means where reachability check doesn't follow */
+/* 'LOOP' edge means just having to do with loops */
+#define IS_LOOP_EDGE(k) ((k) & 7)
+#define IS_WALL_EDGE(k) ((k) & 9)
+
+struct nv_basic_block {
+   struct nv_instruction *entry; /* first non-phi instruction */
+   struct nv_instruction *exit;
+   struct nv_instruction *phi; /* very first instruction */
+   int num_instructions;
+
+   struct nv_basic_block *out[2]; /* no indirect branches -> 2 */
+   struct nv_basic_block *in[8]; /* hope that suffices */
+   uint num_in;
+   ubyte out_kind[2];
+   ubyte in_kind[8];
+
+   int id;
+   int subroutine;
+   uint priv; /* reset to 0 after you're done */
+   uint pass_seq;
+
+   uint32_t emit_pos; /* position, size in emitted code (in bytes) */
+   uint32_t emit_size;
+
+   uint32_t live_set[NV_PC_MAX_VALUES / 32];
+};
+
+struct nvc0_translation_info;
+
+struct nv_pc {
+   struct nv_basic_block **root;
+   struct nv_basic_block *current_block;
+   struct nv_basic_block *parent_block;
+
+   int loop_nesting_bound;
+   uint pass_seq;
+
+   struct nv_value values[NV_PC_MAX_VALUES];
+   struct nv_instruction instructions[NV_PC_MAX_INSTRUCTIONS];
+   struct nv_ref **refs;
+   struct nv_basic_block *bb_list[NV_PC_MAX_BASIC_BLOCKS];
+   int num_values;
+   int num_instructions;
+   int num_refs;
+   int num_blocks;
+   int num_subroutines;
+
+   int max_reg[4];
+
+   uint32_t *immd_buf; /* populated on emit */
+   unsigned immd_count;
+
+   uint32_t *emit;
+   uint32_t emit_size;
+   uint32_t emit_pos;
+
+   void *reloc_entries;
+   unsigned num_relocs;
+
+   /* optimization enables */
+   boolean opt_reload_elim;
+   boolean is_fragprog;
+};
+
+void nvc0_insn_append(struct nv_basic_block *, struct nv_instruction *);
+void nvc0_insn_insert_before(struct nv_instruction *, struct nv_instruction *);
+void nvc0_insn_insert_after(struct nv_instruction *, struct nv_instruction *);
+
+static INLINE struct nv_instruction *
+nv_alloc_instruction(struct nv_pc *pc, uint opcode)
+{
+   struct nv_instruction *insn;
+
+   insn = &pc->instructions[pc->num_instructions++];
+   assert(pc->num_instructions < NV_PC_MAX_INSTRUCTIONS);
+
+   insn->opcode = opcode;
+   insn->cc = 0;
+   insn->indirect = -1;
+   insn->predicate = -1;
+
+   return insn;
+}
+
+static INLINE struct nv_instruction *
+new_instruction(struct nv_pc *pc, uint opcode)
+{
+   struct nv_instruction *insn = nv_alloc_instruction(pc, opcode);
+
+   nvc0_insn_append(pc->current_block, insn);
+   return insn;
+}
+
+static INLINE struct nv_instruction *
+new_instruction_at(struct nv_pc *pc, struct nv_instruction *at, uint opcode)
+{
+   struct nv_instruction *insn = nv_alloc_instruction(pc, opcode);
+
+   nvc0_insn_insert_after(at, insn);
+   return insn;
+}
+
+static INLINE struct nv_value *
+new_value(struct nv_pc *pc, ubyte file, ubyte size)
+{
+   struct nv_value *value = &pc->values[pc->num_values];
+
+   assert(pc->num_values < NV_PC_MAX_VALUES - 1);
+
+   value->n = pc->num_values++;
+   value->join = value;
+   value->reg.id = -1;
+   value->reg.file = file;
+   value->reg.size = size;
+   return value;
+}
+
+static INLINE struct nv_value *
+new_value_like(struct nv_pc *pc, struct nv_value *like)
+{
+   return new_value(pc, like->reg.file, like->reg.size);
+}
+
+static INLINE struct nv_ref *
+new_ref(struct nv_pc *pc, struct nv_value *val)
+{
+   int i;
+   struct nv_ref *ref;
+
+   if ((pc->num_refs % 64) == 0) {
+      const unsigned old_size = pc->num_refs * sizeof(struct nv_ref *);
+      const unsigned new_size = (pc->num_refs + 64) * sizeof(struct nv_ref *);
+
+      pc->refs = REALLOC(pc->refs, old_size, new_size);
+
+      ref = CALLOC(64, sizeof(struct nv_ref));
+      for (i = 0; i < 64; ++i)
+         pc->refs[pc->num_refs + i] = &ref[i];
+   }
+
+   ref = pc->refs[pc->num_refs++];
+   ref->value = val;
+
+   LIST_INITHEAD(&ref->list);
+
+   ++val->refc;
+   return ref;
+}
+
+static INLINE struct nv_basic_block *
+new_basic_block(struct nv_pc *pc)
+{
+   struct nv_basic_block *bb;
+
+   if (pc->num_blocks >= NV_PC_MAX_BASIC_BLOCKS)
+      return NULL;
+
+   bb = CALLOC_STRUCT(nv_basic_block);
+
+   bb->id = pc->num_blocks;
+   pc->bb_list[pc->num_blocks++] = bb;
+   return bb;
+}
+
+static INLINE void
+nv_reference(struct nv_pc *pc,
+             struct nv_instruction *nvi, int c, struct nv_value *s)
+{
+   struct nv_ref **d = &nvi->src[c];
+   assert(c < 6);
+
+   if (*d) {
+      --(*d)->value->refc;
+      LIST_DEL(&(*d)->list);
+   }
+
+   if (s) {
+      if (!*d) {
+         *d = new_ref(pc, s);
+         (*d)->insn = nvi;
+      } else {
+         LIST_DEL(&(*d)->list);
+         (*d)->value = s;
+         ++(s->refc);
+      }
+      if (!s->last_use)
+         s->last_use = *d;
+      else
+         LIST_ADDTAIL(&s->last_use->list, &(*d)->list);
+
+      s->last_use = *d;
+      (*d)->insn = nvi;
+   } else {
+      *d = NULL;
+   }
+}
+
+/* nvc0_emit.c */
+void nvc0_emit_instruction(struct nv_pc *, struct nv_instruction *);
+
+/* nvc0_print.c */
+const char *nvc0_opcode_name(uint opcode);
+void nvc0_print_instruction(struct nv_instruction *);
+
+/* nvc0_pc.c */
+void nvc0_print_function(struct nv_basic_block *root);
+void nvc0_print_program(struct nv_pc *);
+
+boolean nvc0_insn_can_load(struct nv_instruction *, int s,
+                           struct nv_instruction *);
+boolean nvc0_insn_is_predicateable(struct nv_instruction *);
+
+int nvc0_insn_refcount(struct nv_instruction *);
+void nvc0_insn_delete(struct nv_instruction *);
+void nvc0_insns_permute(struct nv_instruction *prev, struct nv_instruction *);
+
+void nvc0_bblock_attach(struct nv_basic_block *parent,
+                        struct nv_basic_block *child, ubyte edge_kind);
+boolean nvc0_bblock_dominated_by(struct nv_basic_block *,
+                                 struct nv_basic_block *);
+boolean nvc0_bblock_reachable_by(struct nv_basic_block *future,
+                                 struct nv_basic_block *past,
+                                 struct nv_basic_block *final);
+struct nv_basic_block *nvc0_bblock_dom_frontier(struct nv_basic_block *);
+
+int nvc0_pc_replace_value(struct nv_pc *pc,
+                          struct nv_value *old_val,
+                          struct nv_value *new_val);
+
+struct nv_value *nvc0_pc_find_immediate(struct nv_ref *);
+struct nv_value *nvc0_pc_find_constant(struct nv_ref *);
+
+typedef void (*nv_pc_pass_func)(void *priv, struct nv_basic_block *b);
+
+void nvc0_pc_pass_in_order(struct nv_basic_block *, nv_pc_pass_func, void *);
+
+int nvc0_pc_exec_pass0(struct nv_pc *pc);
+int nvc0_pc_exec_pass1(struct nv_pc *pc);
+int nvc0_pc_exec_pass2(struct nv_pc *pc);
+
+int nvc0_tgsi_to_nc(struct nv_pc *, struct nvc0_translation_info *);
+
+#endif // NV50_COMPILER_H
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_emit.c b/src/gallium/drivers/nvc0/nvc0_pc_emit.c
new file mode 100644 (file)
index 0000000..db8055d
--- /dev/null
@@ -0,0 +1,979 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "nvc0_pc.h"
+#include "nvc0_program.h"
+
+#define NVC0_FIXUP_CODE_RELOC 0
+#define NVC0_FIXUP_DATA_RELOC 1
+
+struct nvc0_fixup {
+   uint8_t type;
+   int8_t shift;
+   uint32_t mask;
+   uint32_t data;
+   uint32_t ofst;
+};
+
+void
+nvc0_relocate_program(struct nvc0_program *prog,
+                      uint32_t code_base,
+                      uint32_t data_base)
+{
+   struct nvc0_fixup *f = (struct nvc0_fixup *)prog->relocs;
+   unsigned i;
+
+   for (i = 0; i < prog->num_relocs; ++i) {
+      uint32_t data;
+
+      switch (f[i].type) {
+      case NVC0_FIXUP_CODE_RELOC: data = code_base + f[i].data; break;
+      case NVC0_FIXUP_DATA_RELOC: data = data_base + f[i].data; break;
+      default:
+         data = f[i].data;
+         break;
+      }
+      data = (f[i].shift < 0) ? (data >> -f[i].shift) : (data << f[i].shift);
+
+      prog->code[f[i].ofst / 4] &= ~f[i].mask;
+      prog->code[f[i].ofst / 4] |= data & f[i].mask;
+   }
+}
+
+static void
+create_fixup(struct nv_pc *pc, uint8_t ty,
+             int w, uint32_t data, uint32_t m, int s)
+{
+   struct nvc0_fixup *f;
+
+   const unsigned size = sizeof(struct nvc0_fixup);
+   const unsigned n = pc->num_relocs;
+
+   if (!(n % 8))
+      pc->reloc_entries = REALLOC(pc->reloc_entries, n * size, (n + 8) * size);
+
+   f = (struct nvc0_fixup *)pc->reloc_entries;
+
+   f[n].ofst = pc->emit_pos + w * 4;
+   f[n].type = ty;
+   f[n].data = data;
+   f[n].mask = m;
+   f[n].shift = s;
+
+   ++pc->num_relocs;
+}
+
+static INLINE ubyte
+SSIZE(struct nv_instruction *nvi, int s)
+{
+   return nvi->src[s]->value->reg.size;
+}
+
+static INLINE ubyte
+DSIZE(struct nv_instruction *nvi, int d)
+{
+   return nvi->def[d]->reg.size;
+}
+
+static INLINE struct nv_reg *
+SREG(struct nv_ref *ref)
+{
+   if (!ref)
+      return NULL;
+   return &ref->value->join->reg;
+}
+
+static INLINE struct nv_reg *
+DREG(struct nv_value *val)
+{
+   if (!val)
+      return NULL;
+   return &val->join->reg;
+}
+
+static INLINE ubyte
+SFILE(struct nv_instruction *nvi, int s)
+{
+   return nvi->src[s]->value->reg.file;
+}
+
+static INLINE ubyte
+DFILE(struct nv_instruction *nvi, int d)
+{
+   return nvi->def[0]->reg.file;
+}
+
+static INLINE void
+SID(struct nv_pc *pc, struct nv_ref *ref, int pos)
+{
+   pc->emit[pos / 32] |= (SREG(ref) ? SREG(ref)->id : 63) << (pos % 32);
+}
+
+static INLINE void
+DID(struct nv_pc *pc, struct nv_value *val, int pos)
+{
+   pc->emit[pos / 32] |= (DREG(val) ? DREG(val)->id : 63) << (pos % 32);
+}
+
+static INLINE uint32_t
+get_immd_u32(struct nv_ref *ref) /* XXX: dependent on [0]:2 */
+{
+   assert(ref->value->reg.file == NV_FILE_IMM);
+   return ref->value->reg.imm.u32;
+}
+
+static INLINE void
+set_immd_u32_l(struct nv_pc *pc, uint32_t u32)
+{
+   pc->emit[0] |= (u32 & 0x3f) << 26;
+   pc->emit[1] |= u32 >> 6;
+}
+
+static INLINE void
+set_immd_u32(struct nv_pc *pc, uint32_t u32)
+{
+   if ((pc->emit[0] & 0xf) == 0x2) {
+      set_immd_u32_l(pc, u32);
+   } else
+   if ((pc->emit[0] & 0xf) == 0x3) {
+      assert(!(pc->emit[1] & 0xc000));
+      pc->emit[1] |= 0xc000;
+      assert(!(u32 & 0xfff00000));
+      set_immd_u32_l(pc, u32);
+   } else {
+      assert(!(pc->emit[1] & 0xc000));
+      pc->emit[1] |= 0xc000;
+      assert(!(u32 & 0xfff));
+      set_immd_u32_l(pc, u32 >> 12);
+   }
+}
+
+static INLINE void
+set_immd(struct nv_pc *pc, struct nv_instruction *i, int s)
+{
+   set_immd_u32(pc, get_immd_u32(i->src[s]));
+}
+
+static INLINE void
+DVS(struct nv_pc *pc, struct nv_instruction *i)
+{
+   uint s = i->def[0]->reg.size;
+   int n;
+   for (n = 1; n < 4 && i->def[n]; ++n)
+      s += i->def[n]->reg.size;
+   pc->emit[0] |= ((s / 4) - 1) << 5;
+}
+
+static INLINE void
+SVS(struct nv_pc *pc, struct nv_ref *src)
+{
+   pc->emit[0] |= (SREG(src)->size / 4 - 1) << 5;
+}
+
+static void
+set_pred(struct nv_pc *pc, struct nv_instruction *i)
+{
+   if (i->predicate >= 0) {
+      SID(pc, i->src[i->predicate], 6);
+      if (i->cc)
+         pc->emit[0] |= 0x2000; /* negate */
+   } else {
+      pc->emit[0] |= 0x1c00;
+   }      
+}
+
+static INLINE void
+set_address_16(struct nv_pc *pc, struct nv_ref *src)
+{
+   pc->emit[0] |= (src->value->reg.address & 0x003f) << 26;
+   pc->emit[1] |= (src->value->reg.address & 0xffc0) >> 6;
+}
+
+static INLINE unsigned
+const_space_index(struct nv_instruction *i, int s)
+{
+   return SFILE(i, s) - NV_FILE_MEM_C(0);
+}
+
+static void
+emit_flow(struct nv_pc *pc, struct nv_instruction *i, uint8_t op)
+{
+   pc->emit[0] = 0x00000007;
+   pc->emit[1] = op << 24;
+
+   if (op == 0x40 || (op >= 0x80 && op <= 0x98)) {
+      /* bra, exit, ret or kil */
+      pc->emit[0] |= 0x1e0;
+      set_pred(pc, i);
+   }
+
+   if (i->target) {
+      int32_t pcrel = i->target->emit_pos - (pc->emit_pos + 8);
+
+      /* we will need relocations only for global functions */
+      /*
+      create_fixup(pc, NVC0_FIXUP_CODE_RELOC, 0, pos, 26, 0xfc000000);
+      create_fixup(pc, NVC0_FIXUP_CODE_RELOC, 1, pos, -6, 0x0001ffff);
+      */
+
+      pc->emit[0] |= (pcrel & 0x3f) << 26;
+      pc->emit[1] |= (pcrel >> 6) & 0x1ffff;
+   }
+}
+
+/* doesn't work for vfetch, export, ld, st, mov ... */
+static void
+emit_form_0(struct nv_pc *pc, struct nv_instruction *i)
+{
+   int s;
+
+   set_pred(pc, i);
+
+   DID(pc, i->def[0], 14);
+
+   for (s = 0; s < 3 && i->src[s]; ++s) {
+      if (SFILE(i, s) >= NV_FILE_MEM_C(0) &&
+          SFILE(i, s) <= NV_FILE_MEM_C(15)) {
+         assert(!(pc->emit[1] & 0xc000));
+         assert(s <= 1);
+         pc->emit[1] |= 0x4000 | (const_space_index(i, s) << 10);
+         set_address_16(pc, i->src[s]);
+      } else
+      if (SFILE(i, s) == NV_FILE_GPR) {
+         SID(pc, i->src[s], s ? ((s == 2) ? 49 : 26) : 20);
+      } else
+      if (SFILE(i, s) == NV_FILE_IMM) {
+         assert(!(pc->emit[1] & 0xc000));
+         assert(s == 1 || i->opcode == NV_OP_MOV);
+         set_immd(pc, i, s);
+      }
+   }
+}
+
+static void
+emit_form_1(struct nv_pc *pc, struct nv_instruction *i)
+{
+   int s;
+
+   set_pred(pc, i);
+
+   DID(pc, i->def[0], 14);
+
+   for (s = 0; s < 1 && i->src[s]; ++s) {
+      if (SFILE(i, s) >= NV_FILE_MEM_C(0) &&
+          SFILE(i, s) <= NV_FILE_MEM_C(15)) {
+         assert(!(pc->emit[1] & 0xc000));
+         assert(s <= 1);
+         pc->emit[1] |= 0x4000 | (const_space_index(i, s) << 10);
+         set_address_16(pc, i->src[s]);
+      } else
+      if (SFILE(i, s) == NV_FILE_GPR) {
+         SID(pc, i->src[s], 26);
+      } else
+      if (SFILE(i, s) == NV_FILE_IMM) {
+         assert(!(pc->emit[1] & 0xc000));
+         assert(s == 1 || i->opcode == NV_OP_MOV);
+         set_immd(pc, i, s);
+      }
+   }
+}
+
+static void
+emit_neg_abs_1_2(struct nv_pc *pc, struct nv_instruction *i)
+{
+   if (i->src[0]->mod & NV_MOD_ABS)
+      pc->emit[0] |= 1 << 7;
+   if (i->src[0]->mod & NV_MOD_NEG)
+      pc->emit[0] |= 1 << 9;
+   if (i->src[1]->mod & NV_MOD_ABS)
+      pc->emit[0] |= 1 << 6;
+   if (i->src[1]->mod & NV_MOD_NEG)
+      pc->emit[0] |= 1 << 8;
+}
+
+static void
+emit_add_f32(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0x50000000;
+
+   emit_form_0(pc, i);
+
+   emit_neg_abs_1_2(pc, i);
+
+   if (i->saturate)
+      pc->emit[1] |= 1 << 17;
+}
+
+static void
+emit_mul_f32(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0x58000000;
+
+   emit_form_0(pc, i);
+
+   if ((i->src[0]->mod ^ i->src[1]->mod) & NV_MOD_NEG)
+      pc->emit[1] |= 1 << 25;
+
+   if (i->saturate)
+      pc->emit[0] |= 1 << 5;
+}
+
+static void
+emit_mad_f32(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0x30000000;
+
+   emit_form_0(pc, i);
+
+   if ((i->src[0]->mod ^ i->src[1]->mod) & NV_MOD_NEG)
+      pc->emit[0] |= 1 << 9;
+
+   if (i->src[2]->mod & NV_MOD_NEG)
+      pc->emit[0] |= 1 << 8;
+
+   if (i->saturate)
+      pc->emit[0] |= 1 << 5;
+}
+
+static void
+emit_minmax(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0x08000000;
+
+   if (NV_BASEOP(i->opcode) == NV_OP_MAX)
+      pc->emit[1] |= 0x001e0000;
+   else
+      pc->emit[1] |= 0x000e0000; /* predicate ? */
+
+   emit_form_0(pc, i);
+
+   emit_neg_abs_1_2(pc, i);
+
+   switch (i->opcode) {
+   case NV_OP_MIN_U32:
+   case NV_OP_MAX_U32:
+      pc->emit[0] |= 3;
+      break;
+   case NV_OP_MIN_S32:
+   case NV_OP_MAX_S32:
+      pc->emit[0] |= 3 | (1 << 5);
+      break;
+   case NV_OP_MIN_F32:
+   case NV_OP_MAX_F32:
+   default:
+      break;
+   }
+}
+
+static void
+emit_tex(struct nv_pc *pc, struct nv_instruction *i)
+{
+   int src1 = i->tex_array + i->tex_dim + i->tex_cube;
+
+   pc->emit[0] = 0x00000086;
+   pc->emit[1] = 0x80000000;
+
+   switch (i->opcode) {
+   case NV_OP_TEX: pc->emit[1] = 0x80000000; break;
+   case NV_OP_TXB: pc->emit[1] = 0x84000000; break;
+   case NV_OP_TXL: pc->emit[1] = 0x86000000; break;
+   case NV_OP_TXF: pc->emit[1] = 0x90000000; break;
+   case NV_OP_TXG: pc->emit[1] = 0xe0000000; break;
+   default:
+      assert(0);
+      break;
+   }
+
+   if (i->tex_array)
+      pc->emit[1] |= 0x00080000; /* layer index is u16, first value of SRC0 */
+   if (i->tex_shadow)
+      pc->emit[1] |= 0x01000000; /* shadow is part of SRC1, after bias/lod */
+
+   set_pred(pc, i);
+
+   DID(pc, i->def[0], 14);
+   SID(pc, i->src[0], 20);
+   SID(pc, i->src[src1], 26); /* may be NULL -> $r63 */
+
+   pc->emit[1] |= i->tex_mask << 14;
+   pc->emit[1] |= (i->tex_dim - 1) << 20;
+   if (i->tex_cube)
+      pc->emit[1] |= 3 << 20;
+
+   assert(i->ext.tex.s < 16);
+
+   pc->emit[1] |= i->ext.tex.t;
+   pc->emit[1] |= i->ext.tex.s << 8;
+
+   if (i->tex_live)
+      pc->emit[0] |= 1 << 9;
+}
+
+/* 0: cos, 1: sin, 2: ex2, 3: lg2, 4: rcp, 5: rsqrt */
+static void
+emit_flop(struct nv_pc *pc, struct nv_instruction *i, ubyte op)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0xc8000000;
+
+   set_pred(pc, i);
+
+   DID(pc, i->def[0], 14);
+   SID(pc, i->src[0], 20);
+
+   pc->emit[0] |= op << 26;
+
+   if (op >= 4) {
+      if (i->src[0]->mod & NV_MOD_NEG) pc->emit[0] |= 1 << 9;
+      if (i->src[0]->mod & NV_MOD_ABS) pc->emit[0] |= 1 << 7;
+   } else {
+      assert(!i->src[0]->mod);
+   }
+}
+
+static void
+emit_quadop(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0x48000000;
+
+   set_pred(pc, i);
+
+   assert(SFILE(i, 0) == NV_FILE_GPR && SFILE(i, 1) == NV_FILE_GPR);
+
+   DID(pc, i->def[0], 14);
+   SID(pc, i->src[0], 20);
+   SID(pc, i->src[0], 26);
+
+   pc->emit[0] |= i->lanes << 6; /* l0, l1, l2, l3, dx, dy */
+   pc->emit[1] |= i->quadop;
+}
+
+static void
+emit_ddx(struct nv_pc *pc, struct nv_instruction *i)
+{
+   i->quadop = 0x99;
+   i->lanes = 4;
+   emit_quadop(pc, i);
+}
+
+static void
+emit_ddy(struct nv_pc *pc, struct nv_instruction *i)
+{
+   i->quadop = 0xa5;
+   i->lanes = 5;
+   emit_quadop(pc, i);
+}
+
+/* preparation op (preex2, presin / convert to fixed point) */
+static void
+emit_preop(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0x60000000;
+
+   if (i->opcode == NV_OP_PREEX2)
+      pc->emit[0] |= 0x20;
+
+   emit_form_1(pc, i);
+
+   if (i->src[0]->mod & NV_MOD_NEG) pc->emit[0] |= 1 << 8;
+   if (i->src[0]->mod & NV_MOD_ABS) pc->emit[0] |= 1 << 6;
+}
+
+static void
+emit_shift(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000003;
+
+   switch (i->opcode) {
+   case NV_OP_SAR:
+      pc->emit[0] |= 0x20; /* fall through */
+   case NV_OP_SHR:
+      pc->emit[1] = 0x58000000;
+      break;
+   case NV_OP_SHL:
+   default:
+      pc->emit[1] = 0x60000000;
+      break;
+   }
+
+   emit_form_0(pc, i);
+}
+
+static void
+emit_bitop(struct nv_pc *pc, struct nv_instruction *i)
+{
+   if (SFILE(i, 1) == NV_FILE_IMM) {
+      pc->emit[0] = 0x00000002;
+      pc->emit[1] = 0x38000000;
+   } else {
+      pc->emit[0] = 0x00000003;
+      pc->emit[1] = 0x68000000;
+   }
+   
+   switch (i->opcode) {
+   case NV_OP_OR:
+      pc->emit[0] |= 0x40;
+      break;
+   case NV_OP_XOR:
+      pc->emit[0] |= 0x80;
+      break;
+   case NV_OP_AND:
+   default:
+      break;
+   }
+
+   emit_form_0(pc, i);
+}
+
+static void
+emit_set(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+
+   switch (i->opcode) {
+   case NV_OP_SET_S32:
+      pc->emit[0] |= 0x20; /* fall through */
+   case NV_OP_SET_U32:
+      pc->emit[0] |= 0x3;
+      pc->emit[1] = 0x100e0000;
+      break;
+   case NV_OP_SET_F32_AND:
+      pc->emit[1] = 0x18000000;
+      break;
+   case NV_OP_SET_F32_OR:
+      pc->emit[1] = 0x18200000;
+      break;
+   case NV_OP_SET_F32_XOR:
+      pc->emit[1] = 0x18400000;
+      break;
+   case NV_OP_FSET_F32:
+      pc->emit[0] |= 0x20; /* fall through */
+   case NV_OP_SET_F32:
+   default:
+      pc->emit[1] = 0x180e0000;
+      break;
+   }
+
+   if (DFILE(i, 0) == NV_FILE_PRED) {
+      pc->emit[0] |= 0x1c000;
+      pc->emit[1] += 0x08000000;
+   }
+
+   pc->emit[1] |= i->set_cond << 23;
+
+   emit_form_0(pc, i);
+
+   emit_neg_abs_1_2(pc, i); /* maybe assert that U/S32 don't use mods */
+}
+
+static void
+emit_selp(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000004;
+   pc->emit[1] = 0x20000000;
+
+   emit_form_0(pc, i);
+
+   if (i->cc || (i->src[2]->mod & NV_MOD_NOT))
+      pc->emit[1] |= 1 << 20;
+}
+
+static void
+emit_slct(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+
+   switch (i->opcode) {
+   case NV_OP_SLCT_S32:
+      pc->emit[0] |= 0x20; /* fall through */
+   case NV_OP_SLCT_U32:
+      pc->emit[0] |= 0x3;
+      pc->emit[1] = 0x30000000;
+      break;
+   case NV_OP_SLCT_F32:
+   default:
+      pc->emit[1] = 0x38000000;
+      break;
+   }
+
+   emit_form_0(pc, i);
+
+   pc->emit[1] |= i->set_cond << 23;
+}
+
+static void
+emit_cvt(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000004;
+   pc->emit[1] = 0x10000000;
+
+   if (i->opcode != NV_OP_CVT)
+      i->ext.cvt.d = i->ext.cvt.s = NV_OPTYPE(i->opcode);
+
+   switch (i->ext.cvt.d) {
+   case NV_TYPE_F32:
+      switch (i->ext.cvt.s) {
+      case NV_TYPE_F32: pc->emit[1] = 0x10000000; break;
+      case NV_TYPE_S32: pc->emit[0] |= 0x200;
+      case NV_TYPE_U32: pc->emit[1] = 0x18000000; break;
+      }
+      break;
+   case NV_TYPE_S32: pc->emit[0] |= 0x80;
+   case NV_TYPE_U32:
+      switch (i->ext.cvt.s) {
+      case NV_TYPE_F32: pc->emit[1] = 0x14000000; break;
+      case NV_TYPE_S32: pc->emit[0] |= 0x200;
+      case NV_TYPE_U32: pc->emit[1] = 0x1c000000; break;
+      }
+      break;
+   default:
+      assert(!"cvt: unknown type");
+      break;
+   }
+
+   if (i->opcode == NV_OP_FLOOR)
+      pc->emit[1] |= 0x00020000;
+   else
+   if (i->opcode == NV_OP_CEIL)
+      pc->emit[1] |= 0x00040000;
+   else
+   if (i->opcode == NV_OP_TRUNC)
+      pc->emit[1] |= 0x00060000;
+
+   if (i->saturate || i->opcode == NV_OP_SAT)
+      pc->emit[0] |= 0x20;
+
+   if (NV_BASEOP(i->opcode) == NV_OP_ABS || i->src[0]->mod & NV_MOD_ABS)
+      pc->emit[0] |= 1 << 6;
+   if (NV_BASEOP(i->opcode) == NV_OP_NEG || i->src[0]->mod & NV_MOD_NEG)
+      pc->emit[0] |= 1 << 8;
+
+   pc->emit[0] |= util_logbase2(DREG(i->def[0])->size) << 20;
+   pc->emit[0] |= util_logbase2(SREG(i->src[0])->size) << 23;
+
+   emit_form_1(pc, i);
+}
+
+static void
+emit_interp(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000000;
+   pc->emit[1] = 0xc07e0000;
+
+   DID(pc, i->def[0], 14);
+
+   set_pred(pc, i);
+
+   if (i->indirect)
+      SID(pc, i->src[i->indirect], 20);
+   else
+      SID(pc, NULL, 20);
+
+   if (i->opcode == NV_OP_PINTERP) {
+      pc->emit[0] |= 0x040;
+      SID(pc, i->src[1], 26);
+   } else {
+      SID(pc, NULL, 26);
+   }
+
+   pc->emit[1] |= i->src[0]->value->reg.address & 0xffff;
+
+   if (i->centroid)
+      pc->emit[0] |= 0x100;
+   else
+   if (i->flat)
+      pc->emit[0] |= 0x080;
+}
+
+static void
+emit_vfetch(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x03f00006;
+   pc->emit[1] = 0x06000000 | i->src[0]->value->reg.address;
+   if (i->patch)
+      pc->emit[0] |= 0x100;
+
+   set_pred(pc, i);
+
+   DVS(pc, i);
+   DID(pc, i->def[0], 14);
+
+   SID(pc, (i->indirect >= 0) ? i->src[i->indirect] : NULL, 26);
+}
+
+static void
+emit_export(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000006;
+   pc->emit[1] = 0x0a000000;
+   if (i->patch)
+      pc->emit[0] |= 0x100;
+
+   set_pred(pc, i);
+
+   assert(SFILE(i, 0) == NV_FILE_MEM_V);
+   assert(SFILE(i, 1) == NV_FILE_GPR);
+
+   SID(pc, i->src[1], 26); /* register source */
+   SVS(pc, i->src[0]);
+
+   pc->emit[1] |= i->src[0]->value->reg.address & 0xfff;
+
+   SID(pc, (i->indirect >= 0) ? i->src[i->indirect] : NULL, 20);
+}
+
+static void
+emit_mov(struct nv_pc *pc, struct nv_instruction *i)
+{
+   if (i->opcode == NV_OP_MOV)
+      i->lanes = 0xf;
+
+   if (SFILE(i, 0) == NV_FILE_IMM) {
+      pc->emit[0] = 0x000001e2;
+      pc->emit[1] = 0x18000000;
+   } else
+   if (SFILE(i, 0) == NV_FILE_PRED) {
+      pc->emit[0] = 0x1c000004;
+      pc->emit[1] = 0x080e0000;
+   } else {
+      pc->emit[0] = 0x00000004 | (i->lanes << 5);
+      pc->emit[1] = 0x28000000;
+   }
+
+   emit_form_1(pc, i);
+}
+
+static void
+emit_ldst_size(struct nv_pc *pc, struct nv_instruction *i)
+{
+   assert(NV_IS_MEMORY_FILE(SFILE(i, 0)));
+
+   switch (SSIZE(i, 0)) {
+   case 1:
+      if (NV_TYPE_ISSGD(i->ext.cvt.s))
+         pc->emit[0] |= 0x20;
+      break;
+   case 2:
+      pc->emit[0] |= 0x40;
+      if (NV_TYPE_ISSGD(i->ext.cvt.s))
+         pc->emit[0] |= 0x20;
+      break;
+   case 4: pc->emit[0] |= 0x80; break;
+   case 8: pc->emit[0] |= 0xa0; break;
+   case 16: pc->emit[0] |= 0xc0; break;
+   default:
+      NOUVEAU_ERR("invalid load/store size %u\n", SSIZE(i, 0));
+      break;
+   }
+}
+
+static void
+emit_ld_const(struct nv_pc *pc, struct nv_instruction *i)
+{
+   pc->emit[0] = 0x00000006;
+   pc->emit[1] = 0x14000000 | (const_space_index(i, 0) << 10);
+
+   emit_ldst_size(pc, i);
+
+   set_pred(pc, i);
+   set_address_16(pc, i->src[0]);
+
+   SID(pc, (i->indirect >= 0) ? i->src[i->indirect] : NULL, 20);
+   DID(pc, i->def[0], 14);
+}
+
+static void
+emit_ld(struct nv_pc *pc, struct nv_instruction *i)
+{
+   if (SFILE(i, 0) >= NV_FILE_MEM_C(0) &&
+       SFILE(i, 0) <= NV_FILE_MEM_C(15)) {
+      if (SSIZE(i, 0) == 4 && i->indirect < 0) {
+         i->lanes = 0xf;
+         emit_mov(pc, i);
+      } else {
+         emit_ld_const(pc, i);
+      }
+   } else {
+      NOUVEAU_ERR("emit_ld(%u): not handled yet\n", SFILE(i, 0));
+      abort();
+   }
+}
+
+static void
+emit_st(struct nv_pc *pc, struct nv_instruction *i)
+{
+   NOUVEAU_ERR("emit_st: not handled yet\n");
+   abort();
+}
+
+void
+nvc0_emit_instruction(struct nv_pc *pc, struct nv_instruction *i)
+{
+   debug_printf("EMIT: "); nvc0_print_instruction(i);
+
+   switch (i->opcode) {
+   case NV_OP_VFETCH:
+      emit_vfetch(pc, i);
+      break;
+   case NV_OP_EXPORT:
+      if (!pc->is_fragprog)
+         emit_export(pc, i);
+      break;
+   case NV_OP_MOV:
+      emit_mov(pc, i);
+      break;
+   case NV_OP_LD:
+      emit_ld(pc, i);
+      break;
+   case NV_OP_ST:
+      emit_st(pc, i);
+      break;
+   case NV_OP_LINTERP:
+   case NV_OP_PINTERP:
+      emit_interp(pc, i);
+      break;
+   case NV_OP_ADD_F32:
+      emit_add_f32(pc, i);
+      break;
+   case NV_OP_AND:
+   case NV_OP_OR:
+   case NV_OP_XOR:
+      emit_bitop(pc, i);
+      break;
+   case NV_OP_CVT:
+   case NV_OP_ABS_F32:
+   case NV_OP_ABS_S32:
+   case NV_OP_NEG_F32:
+   case NV_OP_NEG_S32:
+   case NV_OP_SAT:
+   case NV_OP_CEIL:
+   case NV_OP_FLOOR:
+   case NV_OP_TRUNC:
+      emit_cvt(pc, i);
+      break;
+   case NV_OP_DFDX:
+      emit_ddx(pc, i);
+      break;
+   case NV_OP_DFDY:
+      emit_ddy(pc, i);
+      break;
+   case NV_OP_COS:
+      emit_flop(pc, i, 0);
+      break;
+   case NV_OP_SIN:
+      emit_flop(pc, i, 1);
+      break;
+   case NV_OP_EX2:
+      emit_flop(pc, i, 2);
+      break;
+   case NV_OP_LG2:
+      emit_flop(pc, i, 3);
+      break;
+   case NV_OP_RCP:
+      emit_flop(pc, i, 4);
+      break;
+   case NV_OP_RSQ:
+      emit_flop(pc, i, 5);
+      break;
+   case NV_OP_PRESIN:
+   case NV_OP_PREEX2:
+      emit_preop(pc, i);
+      break;
+   case NV_OP_MAD_F32:
+      emit_mad_f32(pc, i);
+      break;
+   case NV_OP_MAX_F32:
+   case NV_OP_MAX_S32:
+   case NV_OP_MAX_U32:
+   case NV_OP_MIN_F32:
+   case NV_OP_MIN_S32:
+   case NV_OP_MIN_U32:
+      emit_minmax(pc, i);
+      break;
+   case NV_OP_MUL_F32:
+      emit_mul_f32(pc, i);
+      break;
+   case NV_OP_SET_F32:
+   case NV_OP_SET_F32_AND:
+   case NV_OP_SET_F32_OR:
+   case NV_OP_SET_F32_XOR:
+   case NV_OP_SET_S32:
+   case NV_OP_SET_U32:
+   case NV_OP_FSET_F32:
+      emit_set(pc, i);
+      break;
+   case NV_OP_SHL:
+   case NV_OP_SHR:
+   case NV_OP_SAR:
+      emit_shift(pc, i);
+      break;
+   case NV_OP_TEX:
+   case NV_OP_TXB:
+   case NV_OP_TXL:
+      emit_tex(pc, i);
+      break;
+   case NV_OP_BRA:
+      emit_flow(pc, i, 0x40);
+      break;
+   case NV_OP_CALL:
+      emit_flow(pc, i, 0x50);
+      break;
+   case NV_OP_JOINAT:
+      emit_flow(pc, i, 0x60);
+      break;
+   case NV_OP_EXIT:
+      emit_flow(pc, i, 0x80);
+      break;
+   case NV_OP_RET:
+      emit_flow(pc, i, 0x90);
+      break;
+   case NV_OP_KIL:
+      emit_flow(pc, i, 0x98);
+      break;
+   case NV_OP_JOIN:
+   case NV_OP_NOP:
+      pc->emit[0] = 0x00003de4;
+      pc->emit[1] = 0x40000000;
+      break;
+   case NV_OP_SELP:
+      emit_selp(pc, i);
+      break;
+   case NV_OP_SLCT_F32:
+   case NV_OP_SLCT_S32:
+   case NV_OP_SLCT_U32:
+      emit_slct(pc, i);
+      break;
+   default:
+      NOUVEAU_ERR("unhandled NV_OP: %d\n", i->opcode);
+      abort();
+      break;
+   }
+
+   if (i->join)
+      pc->emit[0] |= 0x10;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_optimize.c b/src/gallium/drivers/nvc0/nvc0_pc_optimize.c
new file mode 100644 (file)
index 0000000..acc72bf
--- /dev/null
@@ -0,0 +1,1236 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "nvc0_pc.h"
+#include "nvc0_program.h"
+
+#define DESCEND_ARBITRARY(j, f)                                 \
+do {                                                            \
+   b->pass_seq = ctx->pc->pass_seq;                             \
+                                                                \
+   for (j = 0; j < 2; ++j)                                      \
+      if (b->out[j] && b->out[j]->pass_seq < ctx->pc->pass_seq) \
+         f(ctx, b->out[j]);                                      \
+} while (0)
+
+static INLINE boolean
+registers_interfere(struct nv_value *a, struct nv_value *b)
+{
+   if (a->reg.file != b->reg.file)
+      return FALSE;
+   if (NV_IS_MEMORY_FILE(a->reg.file) || NV_IS_MEMORY_FILE(b->reg.file))
+      return FALSE;
+
+   assert(a->join->reg.id >= 0 && b->join->reg.id >= 0);
+
+   if (a->join->reg.id < b->join->reg.id) {
+      return (a->join->reg.id + a->reg.size >= b->join->reg.id);
+   } else
+   if (a->join->reg.id > b->join->reg.id) {
+      return (b->join->reg.id + b->reg.size >= a->join->reg.id);
+   }
+
+   return FALSE;
+}
+
+static INLINE boolean
+values_equal(struct nv_value *a, struct nv_value *b)
+{
+   if (a->reg.file != b->reg.file || a->reg.size != b->reg.size)
+      return FALSE;
+   if (NV_IS_MEMORY_FILE(a->reg.file))
+      return a->reg.address == b->reg.address;
+   else
+      return a->join->reg.id == b->join->reg.id;
+}
+
+#if 0
+static INLINE boolean
+inst_commutation_check(struct nv_instruction *a, struct nv_instruction *b)
+{
+   int si, di;
+
+   for (di = 0; di < 4 && a->def[di]; ++di)
+      for (si = 0; si < 5 && b->src[si]; ++si)
+         if (registers_interfere(a->def[di], b->src[si]->value))
+            return FALSE;
+
+   return TRUE;
+}
+
+/* Check whether we can swap the order of the instructions,
+ * where a & b may be either the earlier or the later one.
+ */
+static boolean
+inst_commutation_legal(struct nv_instruction *a, struct nv_instruction *b)
+{
+   return inst_commutation_check(a, b) && inst_commutation_check(b, a);
+}
+#endif
+
+static INLINE boolean
+inst_removable(struct nv_instruction *nvi)
+{
+   if (nvi->opcode == NV_OP_ST)
+      return FALSE;
+   return (!(nvi->terminator ||
+             nvi->join ||
+             nvi->target ||
+             nvi->fixed ||
+             nvc0_insn_refcount(nvi)));
+}
+
+static INLINE boolean
+inst_is_noop(struct nv_instruction *nvi)
+{
+   if (nvi->opcode == NV_OP_UNDEF || nvi->opcode == NV_OP_BIND)
+      return TRUE;
+   if (nvi->terminator || nvi->join)
+      return FALSE;
+   if (nvi->def[0] && nvi->def[0]->join->reg.id < 0)
+      return TRUE;
+   if (nvi->opcode != NV_OP_MOV && nvi->opcode != NV_OP_SELECT)
+      return FALSE;
+   if (nvi->def[0]->reg.file != nvi->src[0]->value->reg.file)
+      return FALSE;
+
+   if (nvi->src[0]->value->join->reg.id < 0) {
+      NOUVEAU_DBG("inst_is_noop: orphaned value detected\n");
+      return TRUE;
+   }
+
+   if (nvi->opcode == NV_OP_SELECT)
+      if (!values_equal(nvi->def[0], nvi->src[1]->value))
+         return FALSE;
+   return values_equal(nvi->def[0], nvi->src[0]->value);
+}
+
+struct nv_pass {
+   struct nv_pc *pc;
+   int n;
+   void *priv;
+};
+
+static int
+nv_pass_flatten(struct nv_pass *ctx, struct nv_basic_block *b);
+
+static void
+nv_pc_pass_pre_emission(void *priv, struct nv_basic_block *b)
+{
+   struct nv_pc *pc = (struct nv_pc *)priv;
+   struct nv_basic_block *in;
+   struct nv_instruction *nvi, *next;
+   int j;
+
+   for (j = pc->num_blocks - 1; j >= 0 && !pc->bb_list[j]->emit_size; --j);
+
+   if (j >= 0) {
+      in = pc->bb_list[j];
+
+      /* check for no-op branches (BRA $PC+8) */
+      if (in->exit && in->exit->opcode == NV_OP_BRA && in->exit->target == b) {
+         in->emit_size -= 8;
+         pc->emit_size -= 8;
+
+         for (++j; j < pc->num_blocks; ++j)
+            pc->bb_list[j]->emit_pos -= 8;
+
+         nvc0_insn_delete(in->exit);
+      }
+      b->emit_pos = in->emit_pos + in->emit_size;
+   }
+
+   pc->bb_list[pc->num_blocks++] = b;
+
+   /* visit node */
+
+   for (nvi = b->entry; nvi; nvi = next) {
+      next = nvi->next;
+      if (inst_is_noop(nvi) ||
+          (pc->is_fragprog && nvi->opcode == NV_OP_EXPORT)) {
+         nvc0_insn_delete(nvi);
+      } else
+         b->emit_size += 8;
+   }
+   pc->emit_size += b->emit_size;
+
+#ifdef NOUVEAU_DEBUG
+   if (!b->entry)
+      debug_printf("BB:%i is now empty\n", b->id);
+   else
+      debug_printf("BB:%i size = %u\n", b->id, b->emit_size);
+#endif
+}
+
+static int
+nv_pc_pass2(struct nv_pc *pc, struct nv_basic_block *root)
+{
+   struct nv_pass pass;
+
+   pass.pc = pc;
+
+   pc->pass_seq++;
+   nv_pass_flatten(&pass, root);
+
+   nvc0_pc_pass_in_order(root, nv_pc_pass_pre_emission, pc);
+
+   return 0;
+}
+
+int
+nvc0_pc_exec_pass2(struct nv_pc *pc)
+{
+   int i, ret;
+
+   NOUVEAU_DBG("preparing %u blocks for emission\n", pc->num_blocks);
+
+   pc->num_blocks = 0; /* will reorder bb_list */
+
+   for (i = 0; i < pc->num_subroutines + 1; ++i)
+      if (pc->root[i] && (ret = nv_pc_pass2(pc, pc->root[i])))
+         return ret;
+   return 0;
+}
+
+static INLINE boolean
+is_cspace_load(struct nv_instruction *nvi)
+{
+   if (!nvi)
+      return FALSE;
+   assert(nvi->indirect != 0);
+   return (nvi->opcode == NV_OP_LD &&
+           nvi->src[0]->value->reg.file >= NV_FILE_MEM_C(0) &&
+           nvi->src[0]->value->reg.file <= NV_FILE_MEM_C(15));
+}
+
+static INLINE boolean
+is_immd32_load(struct nv_instruction *nvi)
+{
+   if (!nvi)
+      return FALSE;
+   return (nvi->opcode == NV_OP_MOV &&
+           nvi->src[0]->value->reg.file == NV_FILE_IMM &&
+           nvi->src[0]->value->reg.size == 4);
+}
+
+static INLINE void
+check_swap_src_0_1(struct nv_instruction *nvi)
+{
+   static const uint8_t cc_swapped[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
+
+   struct nv_ref *src0 = nvi->src[0];
+   struct nv_ref *src1 = nvi->src[1];
+
+   if (!nv_op_commutative(nvi->opcode))
+      return;
+   assert(src0 && src1 && src0->value && src1->value);
+
+   if (is_cspace_load(src0->value->insn)) {
+      if (!is_cspace_load(src1->value->insn)) {
+         nvi->src[0] = src1;
+         nvi->src[1] = src0;
+      }
+   } else
+   if (is_immd32_load(src0->value->insn)) {
+      if (!is_cspace_load(src1->value->insn) &&
+          !is_immd32_load(src1->value->insn)) {
+         nvi->src[0] = src1;
+         nvi->src[1] = src0;
+      }
+   }
+
+   if (nvi->src[0] != src0 && nvi->opcode == NV_OP_SET)
+      nvi->set_cond = cc_swapped[nvi->set_cond];
+}
+
+static void
+nvi_set_indirect_load(struct nv_pc *pc,
+                      struct nv_instruction *nvi, struct nv_value *val)
+{
+   for (nvi->indirect = 0; nvi->indirect < 6 && nvi->src[nvi->indirect];
+        ++nvi->indirect);
+   assert(nvi->indirect < 6);
+   nv_reference(pc, nvi, nvi->indirect, val);
+}
+
+static int
+nvc0_pass_fold_loads(struct nv_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_instruction *nvi, *ld;
+   int s;
+
+   for (nvi = b->entry; nvi; nvi = nvi->next) {
+      check_swap_src_0_1(nvi);
+
+      for (s = 0; s < 3 && nvi->src[s]; ++s) {
+         ld = nvi->src[s]->value->insn;
+         if (!ld || (ld->opcode != NV_OP_LD && ld->opcode != NV_OP_MOV))
+            continue;
+         if (!nvc0_insn_can_load(nvi, s, ld))
+            continue;
+
+         /* fold it ! */
+         nv_reference(ctx->pc, nvi, s, ld->src[0]->value);
+         if (ld->indirect >= 0)
+            nvi_set_indirect_load(ctx->pc, nvi, ld->src[ld->indirect]->value);
+
+         if (!nvc0_insn_refcount(ld))
+            nvc0_insn_delete(ld);
+      }
+   }
+   DESCEND_ARBITRARY(s, nvc0_pass_fold_loads);
+
+   return 0;
+}
+
+/* NOTE: Assumes loads have not yet been folded. */
+static int
+nv_pass_lower_mods(struct nv_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_instruction *nvi, *mi, *next;
+   int j;
+   uint8_t mod;
+
+   for (nvi = b->entry; nvi; nvi = next) {
+      next = nvi->next;
+      if (nvi->opcode == NV_OP_SUB) {
+         nvi->src[1]->mod ^= NV_MOD_NEG;
+         nvi->opcode = NV_OP_ADD;
+      }
+
+      for (j = 0; j < 3 && nvi->src[j]; ++j) {
+         mi = nvi->src[j]->value->insn;
+         if (!mi)
+            continue;
+         if (mi->def[0]->refc > 1 || mi->predicate >= 0)
+            continue;
+
+         if (NV_BASEOP(mi->opcode) == NV_OP_NEG) mod = NV_MOD_NEG;
+         else
+         if (NV_BASEOP(mi->opcode) == NV_OP_ABS) mod = NV_MOD_ABS;
+         else
+            continue;
+         assert(!(mod & mi->src[0]->mod & NV_MOD_NEG));
+
+         mod |= mi->src[0]->mod;
+
+         if ((nvi->opcode == NV_OP_ABS) || (nvi->src[j]->mod & NV_MOD_ABS)) {
+            /* abs neg [abs] = abs */
+            mod &= ~(NV_MOD_NEG | NV_MOD_ABS);
+         } else
+         if ((nvi->opcode == NV_OP_NEG) && (mod & NV_MOD_NEG)) {
+            /* neg as opcode and modifier on same insn cannot occur */
+            /* neg neg abs = abs, neg neg = identity */
+            assert(j == 0);
+            if (mod & NV_MOD_ABS)
+               nvi->opcode = NV_OP_ABS;
+            else
+               nvi->opcode = NV_OP_MOV;
+            mod = 0;
+         }
+
+         if ((nv_op_supported_src_mods(nvi->opcode) & mod) != mod)
+            continue;
+
+         nv_reference(ctx->pc, nvi, j, mi->src[0]->value);
+
+         nvi->src[j]->mod ^= mod;
+      }
+
+      if (nvi->opcode == NV_OP_SAT) {
+         mi = nvi->src[0]->value->insn;
+
+         if (mi->def[0]->refc > 1 ||
+             (mi->opcode != NV_OP_ADD &&
+              mi->opcode != NV_OP_MUL &&
+              mi->opcode != NV_OP_MAD))
+            continue;
+         mi->saturate = 1;
+         mi->def[0] = nvi->def[0];
+         mi->def[0]->insn = mi;
+         nvc0_insn_delete(nvi);
+      }
+   }
+   DESCEND_ARBITRARY(j, nv_pass_lower_mods);
+
+   return 0;
+}
+
+#define SRC_IS_MUL(s) ((s)->insn && (s)->insn->opcode == NV_OP_MUL)
+
+static void
+apply_modifiers(uint32_t *val, uint8_t type, uint8_t mod)
+{
+   if (mod & NV_MOD_ABS) {
+      if (type == NV_TYPE_F32)
+         *val &= 0x7fffffff;
+      else
+      if ((*val) & (1 << 31))
+         *val = ~(*val) + 1;
+   }
+   if (mod & NV_MOD_NEG) {
+      if (type == NV_TYPE_F32)
+         *val ^= 0x80000000;
+      else
+         *val = ~(*val) + 1;
+   }
+   if (mod & NV_MOD_SAT) {
+      union {
+         float f;
+         uint32_t u;
+         int32_t i;
+      } u;
+      u.u = *val;
+      if (type == NV_TYPE_F32) {
+         u.f = CLAMP(u.f, -1.0f, 1.0f);
+      } else
+      if (type == NV_TYPE_U16) {
+         u.u = MIN2(u.u, 0xffff);
+      } else
+      if (type == NV_TYPE_S16) {
+         u.i = CLAMP(u.i, -32768, 32767);
+      }
+      *val = u.u;
+   }
+   if (mod & NV_MOD_NOT)
+      *val = ~*val;
+}
+
+static void
+constant_expression(struct nv_pc *pc, struct nv_instruction *nvi,
+                    struct nv_value *src0, struct nv_value *src1)
+{
+   struct nv_value *val;
+   union {
+      float f32;
+      uint32_t u32;
+      int32_t s32;
+   } u0, u1, u;
+   ubyte type;
+
+   if (!nvi->def[0])
+      return;
+   type = NV_OPTYPE(nvi->opcode);
+
+   u.u32 = 0;
+   u0.u32 = src0->reg.imm.u32;
+   u1.u32 = src1->reg.imm.u32;
+
+   apply_modifiers(&u0.u32, type, nvi->src[0]->mod);
+   apply_modifiers(&u1.u32, type, nvi->src[1]->mod);
+
+   switch (nvi->opcode) {
+   case NV_OP_MAD_F32:
+      if (nvi->src[2]->value->reg.file != NV_FILE_GPR)
+         return;
+      /* fall through */
+   case NV_OP_MUL_F32:
+      u.f32 = u0.f32 * u1.f32;
+      break;
+   case NV_OP_MUL_B32:
+      u.u32 = u0.u32 * u1.u32;
+      break;
+   case NV_OP_ADD_F32:
+      u.f32 = u0.f32 + u1.f32;
+      break;
+   case NV_OP_ADD_B32:
+      u.u32 = u0.u32 + u1.u32;
+      break;
+   case NV_OP_SUB_F32:
+      u.f32 = u0.f32 - u1.f32;
+      break;
+      /*
+   case NV_OP_SUB_B32:
+      u.u32 = u0.u32 - u1.u32;
+      break;
+      */
+   default:
+      return;
+   }
+
+   val = new_value(pc, NV_FILE_IMM, nv_type_sizeof(type));
+   val->reg.imm.u32 = u.u32;
+
+   nv_reference(pc, nvi, 1, NULL);
+   nv_reference(pc, nvi, 0, val);
+
+   if (nvi->opcode == NV_OP_MAD_F32) {
+      nvi->src[1] = nvi->src[0];
+      nvi->src[0] = nvi->src[2];
+      nvi->src[2] = NULL;
+      nvi->opcode = NV_OP_ADD_F32;
+
+      if (val->reg.imm.u32 == 0) {
+         nvi->src[1] = NULL;
+         nvi->opcode = NV_OP_MOV;
+      }
+   } else {
+      nvi->opcode = NV_OP_MOV;
+   }
+}
+
+static void
+constant_operand(struct nv_pc *pc,
+                 struct nv_instruction *nvi, struct nv_value *val, int s)
+{
+   union {
+      float f32;
+      uint32_t u32;
+      int32_t s32;
+   } u;
+   int shift;
+   int t = s ? 0 : 1;
+   uint op;
+   ubyte type;
+
+   if (!nvi->def[0])
+      return;
+   type = NV_OPTYPE(nvi->opcode);
+
+   u.u32 = val->reg.imm.u32;
+   apply_modifiers(&u.u32, type, nvi->src[s]->mod);
+
+   if (u.u32 == 0 && NV_BASEOP(nvi->opcode) == NV_OP_MUL) {
+      nvi->opcode = NV_OP_MOV;
+      nv_reference(pc, nvi, t, NULL);
+      if (s) {
+         nvi->src[0] = nvi->src[1];
+         nvi->src[1] = NULL;
+      }
+      return;
+   }
+
+   switch (nvi->opcode) {
+   case NV_OP_MUL_F32:
+      if (u.f32 == 1.0f || u.f32 == -1.0f) {
+         if (u.f32 == -1.0f)
+            nvi->src[t]->mod ^= NV_MOD_NEG;
+         switch (nvi->src[t]->mod) {
+         case 0: op = nvi->saturate ? NV_OP_SAT : NV_OP_MOV; break;
+         case NV_MOD_NEG: op = NV_OP_NEG_F32; break;
+         case NV_MOD_ABS: op = NV_OP_ABS_F32; break;
+         default:
+            return;
+         }
+         nvi->opcode = op;
+         nv_reference(pc, nvi, 0, nvi->src[t]->value);
+         nv_reference(pc, nvi, 1, NULL);
+         nvi->src[0]->mod = 0;
+      } else
+      if (u.f32 == 2.0f || u.f32 == -2.0f) {
+         if (u.f32 == -2.0f)
+            nvi->src[t]->mod ^= NV_MOD_NEG;
+         nvi->opcode = NV_OP_ADD_F32;
+         nv_reference(pc, nvi, s, nvi->src[t]->value);
+         nvi->src[s]->mod = nvi->src[t]->mod;
+      }
+   case NV_OP_ADD_F32:
+      if (u.u32 == 0) {
+         switch (nvi->src[t]->mod) {
+         case 0: op = nvi->saturate ? NV_OP_SAT : NV_OP_MOV; break;
+         case NV_MOD_NEG: op = NV_OP_NEG_F32; break;
+         case NV_MOD_ABS: op = NV_OP_ABS_F32; break;
+         case NV_MOD_NEG | NV_MOD_ABS:
+            op = NV_OP_CVT;
+            nvi->ext.cvt.s = nvi->ext.cvt.d = type;
+            break;
+         default:
+            return;
+         }
+         nvi->opcode = op;
+         nv_reference(pc, nvi, 0, nvi->src[t]->value);
+         nv_reference(pc, nvi, 1, NULL);
+         if (nvi->opcode != NV_OP_CVT)
+            nvi->src[0]->mod = 0;
+      }
+   case NV_OP_ADD_B32:
+      if (u.u32 == 0) {
+         assert(nvi->src[t]->mod == 0);
+         nvi->opcode = nvi->saturate ? NV_OP_CVT : NV_OP_MOV;
+         nvi->ext.cvt.s = nvi->ext.cvt.d = type;
+         nv_reference(pc, nvi, 0, nvi->src[t]->value);
+         nv_reference(pc, nvi, 1, NULL);
+      }
+      break;
+   case NV_OP_MUL_B32:
+      /* multiplication by 0 already handled above */
+      assert(nvi->src[s]->mod == 0);
+      shift = ffs(u.s32) - 1;
+      if (shift == 0) {
+         nvi->opcode = NV_OP_MOV;
+         nv_reference(pc, nvi, 0, nvi->src[t]->value);
+         nv_reference(pc, nvi, 1, NULL);
+      } else
+      if (u.s32 > 0 && u.s32 == (1 << shift)) {
+         nvi->opcode = NV_OP_SHL;
+         (val = new_value(pc, NV_FILE_IMM, NV_TYPE_U32))->reg.imm.s32 = shift;
+         nv_reference(pc, nvi, 0, nvi->src[t]->value);
+         nv_reference(pc, nvi, 1, val);
+         break;
+      }
+      break;
+   case NV_OP_RCP:
+      u.f32 = 1.0f / u.f32;
+      (val = new_value(pc, NV_FILE_IMM, NV_TYPE_F32))->reg.imm.f32 = u.f32;
+      nvi->opcode = NV_OP_MOV;
+      assert(s == 0);
+      nv_reference(pc, nvi, 0, val);
+      break;
+   case NV_OP_RSQ:
+      u.f32 = 1.0f / sqrtf(u.f32);
+      (val = new_value(pc, NV_FILE_IMM, NV_TYPE_F32))->reg.imm.f32 = u.f32;
+      nvi->opcode = NV_OP_MOV;
+      assert(s == 0);
+      nv_reference(pc, nvi, 0, val);
+      break;
+   default:
+      break;
+   }
+}
+
+static int
+nv_pass_lower_arith(struct nv_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_instruction *nvi, *next;
+   int j;
+
+   for (nvi = b->entry; nvi; nvi = next) {
+      struct nv_value *src0, *src1, *src;
+      int s;
+      uint8_t mod[4];
+
+      next = nvi->next;
+
+      src0 = nvc0_pc_find_immediate(nvi->src[0]);
+      src1 = nvc0_pc_find_immediate(nvi->src[1]);
+
+      if (src0 && src1)
+         constant_expression(ctx->pc, nvi, src0, src1);
+      else {
+         if (src0)
+            constant_operand(ctx->pc, nvi, src0, 0);
+         else
+         if (src1)
+            constant_operand(ctx->pc, nvi, src1, 1);
+      }
+
+      /* check if we can MUL + ADD -> MAD/FMA */
+      if (nvi->opcode != NV_OP_ADD)
+         continue;
+
+      src0 = nvi->src[0]->value;
+      src1 = nvi->src[1]->value;
+
+      if (SRC_IS_MUL(src0) && src0->refc == 1)
+         src = src0;
+      else
+      if (SRC_IS_MUL(src1) && src1->refc == 1)
+         src = src1;
+      else
+         continue;
+
+      /* could have an immediate from above constant_*  */
+      if (src0->reg.file != NV_FILE_GPR || src1->reg.file != NV_FILE_GPR)
+         continue;
+      s = (src == src0) ? 0 : 1;
+
+      mod[0] = nvi->src[0]->mod;
+      mod[1] = nvi->src[1]->mod;
+      mod[2] = src->insn->src[0]->mod;
+      mod[3] = src->insn->src[0]->mod;
+
+      if ((mod[0] | mod[1] | mod[2] | mod[3]) & ~NV_MOD_NEG)
+         continue;
+
+      nvi->opcode = NV_OP_MAD;
+      nv_reference(ctx->pc, nvi, s, NULL);
+      nvi->src[2] = nvi->src[!s];
+
+      nvi->src[0] = new_ref(ctx->pc, src->insn->src[0]->value);
+      nvi->src[1] = new_ref(ctx->pc, src->insn->src[1]->value);
+      nvi->src[0]->mod = mod[2] ^ mod[s];
+      nvi->src[1]->mod = mod[3];
+   }
+   DESCEND_ARBITRARY(j, nv_pass_lower_arith);
+
+   return 0;
+}
+
+/* TODO: redundant store elimination */
+
+struct mem_record {
+   struct mem_record *next;
+   struct nv_instruction *insn;
+   uint32_t ofst;
+   uint32_t base;
+   uint32_t size;
+};
+
+#define MEM_RECORD_POOL_SIZE 1024
+
+struct pass_reld_elim {
+   struct nv_pc *pc;
+
+   struct mem_record *imm;
+   struct mem_record *mem_v;
+   struct mem_record *mem_a;
+   struct mem_record *mem_c[16];
+   struct mem_record *mem_l;
+
+   struct mem_record pool[MEM_RECORD_POOL_SIZE];
+   int alloc;
+};
+
+static void
+combine_load(struct mem_record *rec, struct nv_instruction *ld)
+{
+   struct nv_instruction *fv = rec->insn;
+   struct nv_value *mem = ld->src[0]->value;
+   uint32_t size = rec->size + mem->reg.size;
+   int j;
+   int d = rec->size / 4;
+
+   assert(rec->size < 16);
+   if (rec->ofst > mem->reg.address) {
+      if ((size == 8 && mem->reg.address & 3) ||
+          (size > 8 && mem->reg.address & 7))
+         return;
+      rec->ofst = mem->reg.address;
+      for (j = 0; j < d; ++j)
+         fv->def[d + j] = fv->def[j];
+      d = 0;
+   } else
+   if ((size == 8 && rec->ofst & 3) ||
+       (size > 8 && rec->ofst & 7)) {
+      return;
+   }
+
+   for (j = 0; j < mem->reg.size / 4; ++j) {
+      fv->def[d] = ld->def[j];
+      fv->def[d++]->insn = fv;
+   }
+
+   fv->src[0]->value->reg.size = rec->size = size;
+
+   nvc0_insn_delete(ld);
+}
+
+static void
+combine_export(struct mem_record *rec, struct nv_instruction *ex)
+{
+
+}
+
+static INLINE void
+add_mem_record(struct pass_reld_elim *ctx, struct mem_record **rec,
+               uint32_t base, uint32_t ofst, struct nv_instruction *nvi)
+{
+   struct mem_record *it = &ctx->pool[ctx->alloc++];
+
+   it->next = *rec;
+   *rec = it;
+   it->base = base;
+   it->ofst = ofst;
+   it->insn = nvi;
+   it->size = nvi->src[0]->value->reg.size;
+}
+
+/* vectorize and reuse loads from memory or of immediates */
+static int
+nv_pass_mem_opt(struct pass_reld_elim *ctx, struct nv_basic_block *b)
+{
+   struct mem_record **rec, *it;
+   struct nv_instruction *ld, *next;
+   struct nv_value *mem;
+   uint32_t base, ofst;
+   int s;
+
+   for (ld = b->entry; ld; ld = next) {
+      next = ld->next;
+
+      if (is_cspace_load(ld)) {
+         mem = ld->src[0]->value;
+         rec = &ctx->mem_c[ld->src[0]->value->reg.file - NV_FILE_MEM_C(0)];
+      } else
+      if (ld->opcode == NV_OP_VFETCH) {
+         mem = ld->src[0]->value;
+         rec = &ctx->mem_a;
+      } else
+      if (ld->opcode == NV_OP_EXPORT) {
+         mem = ld->src[0]->value;
+         if (mem->reg.file != NV_FILE_MEM_V)
+            continue;
+         rec = &ctx->mem_v;
+      } else {
+         continue;
+      }
+      if (ld->def[0] && ld->def[0]->refc == 0)
+         continue;
+      ofst = mem->reg.address;
+      base = (ld->indirect >= 0) ? ld->src[ld->indirect]->value->n : 0;
+
+      for (it = *rec; it; it = it->next) {
+         if (it->base == base &&
+             ((it->ofst >> 4) == (ofst >> 4)) &&
+             ((it->ofst + it->size == ofst) ||
+              (it->ofst - mem->reg.size == ofst))) {
+            if (ld->opcode == NV_OP_LD && it->size + mem->reg.size == 12)
+               continue;
+            if (it->ofst < ofst) {
+               if ((it->ofst & 0xf) == 4)
+                  continue;
+            } else
+            if ((ofst & 0xf) == 4)
+               continue;
+            break;
+         }
+      }
+      if (it) {
+         switch (ld->opcode) {
+         case NV_OP_EXPORT: combine_export(it, ld); break;
+         default:
+            combine_load(it, ld);
+            break;
+         }
+      } else
+      if (ctx->alloc < MEM_RECORD_POOL_SIZE) {
+         add_mem_record(ctx, rec, base, ofst, ld);
+      }
+   }
+
+   DESCEND_ARBITRARY(s, nv_pass_mem_opt);
+   return 0;
+}
+
+static void
+eliminate_store(struct mem_record *rec, struct nv_instruction *st)
+{
+}
+
+/* elimination of redundant stores */
+static int
+pass_store_elim(struct pass_reld_elim *ctx, struct nv_basic_block *b)
+{
+   struct mem_record **rec, *it;
+   struct nv_instruction *st, *next;
+   struct nv_value *mem;
+   uint32_t base, ofst, size;
+   int s;
+
+   for (st = b->entry; st; st = next) {
+      next = st->next;
+
+      if (st->opcode == NV_OP_ST) {
+         mem = st->src[0]->value;
+         rec = &ctx->mem_l;
+      } else
+      if (st->opcode == NV_OP_EXPORT) {
+         mem = st->src[0]->value;
+         if (mem->reg.file != NV_FILE_MEM_V)
+            continue;
+         rec = &ctx->mem_v;
+      } else
+      if (st->opcode == NV_OP_ST) {
+         /* TODO: purge */
+      }
+      ofst = mem->reg.address;
+      base = (st->indirect >= 0) ? st->src[st->indirect]->value->n : 0;
+      size = mem->reg.size;
+
+      for (it = *rec; it; it = it->next) {
+         if (it->base == base &&
+             (it->ofst <= ofst && (it->ofst + size) > ofst))
+            break;
+      }
+      if (it)
+         eliminate_store(it, st);
+      else
+         add_mem_record(ctx, rec, base, ofst, st);
+   }
+
+   DESCEND_ARBITRARY(s, nv_pass_mem_opt);
+   return 0;
+}
+
+/* TODO: properly handle loads from l[] memory in the presence of stores */
+static int
+nv_pass_reload_elim(struct pass_reld_elim *ctx, struct nv_basic_block *b)
+{
+#if 0
+   struct load_record **rec, *it;
+   struct nv_instruction *ld, *next;
+   uint64_t data[2];
+   struct nv_value *val;
+   int j;
+
+   for (ld = b->entry; ld; ld = next) {
+      next = ld->next;
+      if (!ld->src[0])
+         continue;
+      val = ld->src[0]->value;
+      rec = NULL;
+
+      if (ld->opcode == NV_OP_LINTERP || ld->opcode == NV_OP_PINTERP) {
+         data[0] = val->reg.id;
+         data[1] = 0;
+         rec = &ctx->mem_v;
+      } else
+      if (ld->opcode == NV_OP_LDA) {
+         data[0] = val->reg.id;
+         data[1] = ld->src[4] ? ld->src[4]->value->n : ~0ULL;
+         if (val->reg.file >= NV_FILE_MEM_C(0) &&
+             val->reg.file <= NV_FILE_MEM_C(15))
+            rec = &ctx->mem_c[val->reg.file - NV_FILE_MEM_C(0)];
+         else
+         if (val->reg.file == NV_FILE_MEM_S)
+            rec = &ctx->mem_s;
+         else
+         if (val->reg.file == NV_FILE_MEM_L)
+            rec = &ctx->mem_l;
+      } else
+      if ((ld->opcode == NV_OP_MOV) && (val->reg.file == NV_FILE_IMM)) {
+         data[0] = val->reg.imm.u32;
+         data[1] = 0;
+         rec = &ctx->imm;
+      }
+
+      if (!rec || !ld->def[0]->refc)
+         continue;
+
+      for (it = *rec; it; it = it->next)
+         if (it->data[0] == data[0] && it->data[1] == data[1])
+            break;
+
+      if (it) {
+         if (ld->def[0]->reg.id >= 0)
+            it->value = ld->def[0];
+         else
+         if (!ld->fixed)
+            nvc0_pc_replace_value(ctx->pc, ld->def[0], it->value);
+      } else {
+         if (ctx->alloc == LOAD_RECORD_POOL_SIZE)
+            continue;
+         it = &ctx->pool[ctx->alloc++];
+         it->next = *rec;
+         it->data[0] = data[0];
+         it->data[1] = data[1];
+         it->value = ld->def[0];
+         *rec = it;
+      }
+   }
+
+   ctx->imm = NULL;
+   ctx->mem_s = NULL;
+   ctx->mem_v = NULL;
+   for (j = 0; j < 16; ++j)
+      ctx->mem_c[j] = NULL;
+   ctx->mem_l = NULL;
+   ctx->alloc = 0;
+
+   DESCEND_ARBITRARY(j, nv_pass_reload_elim);
+#endif
+   return 0;
+}
+
+static int
+nv_pass_tex_mask(struct nv_pass *ctx, struct nv_basic_block *b)
+{
+   int i, c, j;
+
+   for (i = 0; i < ctx->pc->num_instructions; ++i) {
+      struct nv_instruction *nvi = &ctx->pc->instructions[i];
+      struct nv_value *def[4];
+
+      if (!nv_is_texture_op(nvi->opcode))
+         continue;
+      nvi->tex_mask = 0;
+
+      for (c = 0; c < 4; ++c) {
+         if (nvi->def[c]->refc)
+            nvi->tex_mask |= 1 << c;
+         def[c] = nvi->def[c];
+      }
+
+      j = 0;
+      for (c = 0; c < 4; ++c)
+         if (nvi->tex_mask & (1 << c))
+            nvi->def[j++] = def[c];
+      for (c = 0; c < 4; ++c)
+         if (!(nvi->tex_mask & (1 << c)))
+           nvi->def[j++] = def[c];
+      assert(j == 4);
+   }
+   return 0;
+}
+
+struct nv_pass_dce {
+   struct nv_pc *pc;
+   uint removed;
+};
+
+static int
+nv_pass_dce(struct nv_pass_dce *ctx, struct nv_basic_block *b)
+{
+   int j;
+   struct nv_instruction *nvi, *next;
+
+   for (nvi = b->phi ? b->phi : b->entry; nvi; nvi = next) {
+      next = nvi->next;
+
+      if (inst_removable(nvi)) {
+         nvc0_insn_delete(nvi);
+         ++ctx->removed;
+      }
+   }
+   DESCEND_ARBITRARY(j, nv_pass_dce);
+
+   return 0;
+}
+
+#if 0
+/* Register allocation inserted ELSE blocks for all IF/ENDIF without ELSE.
+ * Returns TRUE if @bb initiates an IF/ELSE/ENDIF clause, or is an IF with
+ * BREAK and dummy ELSE block.
+ */
+static INLINE boolean
+bb_is_if_else_endif(struct nv_basic_block *bb)
+{
+   if (!bb->out[0] || !bb->out[1])
+      return FALSE;
+
+   if (bb->out[0]->out_kind[0] == CFG_EDGE_LOOP_LEAVE) {
+      return (bb->out[0]->out[1] == bb->out[1]->out[0] &&
+              !bb->out[1]->out[1]);
+   } else {
+      return (bb->out[0]->out[0] == bb->out[1]->out[0] &&
+              !bb->out[0]->out[1] &&
+              !bb->out[1]->out[1]);
+   }
+}
+
+/* predicate instructions and remove branch at the end */
+static void
+predicate_instructions(struct nv_pc *pc, struct nv_basic_block *b,
+                       struct nv_value *p, ubyte cc)
+{
+
+}
+#endif
+
+/* NOTE: Run this after register allocation, we can just cut out the cflow
+ * instructions and hook the predicates to the conditional OPs if they are
+ * not using immediates; better than inserting SELECT to join definitions.
+ *
+ * NOTE: Should adapt prior optimization to make this possible more often.
+ */
+static int
+nv_pass_flatten(struct nv_pass *ctx, struct nv_basic_block *b)
+{
+   return 0;
+}
+
+/* local common subexpression elimination, stupid O(n^2) implementation */
+static int
+nv_pass_cse(struct nv_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_instruction *ir, *ik, *next;
+   struct nv_instruction *entry = b->phi ? b->phi : b->entry;
+   int s;
+   unsigned int reps;
+
+   do {
+      reps = 0;
+      for (ir = entry; ir; ir = next) {
+         next = ir->next;
+         for (ik = entry; ik != ir; ik = ik->next) {
+            if (ir->opcode != ik->opcode || ir->fixed)
+               continue;
+
+            if (!ir->def[0] || !ik->def[0] || ir->def[1] || ik->def[1])
+               continue;
+
+            if (ik->indirect != ir->indirect || ik->predicate != ir->predicate)
+               continue;
+
+            if (!values_equal(ik->def[0], ir->def[0]))
+               continue;
+
+            for (s = 0; s < 3; ++s) {
+               struct nv_value *a, *b;
+
+               if (!ik->src[s]) {
+                  if (ir->src[s])
+                     break;
+                  continue;
+               }
+               if (ik->src[s]->mod != ir->src[s]->mod)
+                  break;
+               a = ik->src[s]->value;
+               b = ir->src[s]->value;
+               if (a == b)
+                  continue;
+               if (a->reg.file != b->reg.file ||
+                   a->reg.id < 0 ||
+                   a->reg.id != b->reg.id)
+                  break;
+            }
+            if (s == 3) {
+               nvc0_insn_delete(ir);
+               ++reps;
+               nvc0_pc_replace_value(ctx->pc, ir->def[0], ik->def[0]);
+               break;
+            }
+         }
+      }
+   } while(reps);
+
+   DESCEND_ARBITRARY(s, nv_pass_cse);
+
+   return 0;
+}
+
+/* Make sure all sources of an NV_OP_BIND are distinct, they need to occupy
+ * neighbouring registers. CSE might have messed this up.
+ */
+static int
+nv_pass_fix_bind(struct nv_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_value *val;
+   struct nv_instruction *bnd, *nvi, *next;
+   int s, t;
+
+   for (bnd = b->entry; bnd; bnd = next) {
+      next = bnd->next;
+      if (bnd->opcode != NV_OP_BIND)
+         continue;
+      for (s = 0; s < 4 && bnd->src[s]; ++s) {
+         val = bnd->src[s]->value;
+         for (t = s + 1; t < 4 && bnd->src[t]; ++t) {
+            if (bnd->src[t]->value != val)
+               continue;
+            nvi = nv_alloc_instruction(ctx->pc, NV_OP_MOV);
+            nvi->def[0] = new_value_like(ctx->pc, val);
+            nvi->def[0]->insn = nvi;
+            nv_reference(ctx->pc, nvi, 0, val);
+            nvc0_insn_insert_before(bnd, nvi);
+
+            nv_reference(ctx->pc, bnd, t, nvi->def[0]);
+         }
+      }
+   }
+   DESCEND_ARBITRARY(t, nv_pass_fix_bind);
+
+   return 0;
+}
+
+static int
+nv_pc_pass0(struct nv_pc *pc, struct nv_basic_block *root)
+{
+   struct pass_reld_elim *reldelim;
+   struct nv_pass pass;
+   struct nv_pass_dce dce;
+   int ret;
+
+   pass.n = 0;
+   pass.pc = pc;
+
+   /* Do this first, so we don't have to pay attention
+    * to whether sources are supported memory loads.
+    */
+   pc->pass_seq++;
+   ret = nv_pass_lower_arith(&pass, root);
+   if (ret)
+      return ret;
+
+   pc->pass_seq++;
+   ret = nv_pass_lower_mods(&pass, root);
+   if (ret)
+      return ret;
+
+   pc->pass_seq++;
+   ret = nvc0_pass_fold_loads(&pass, root);
+   if (ret)
+      return ret;
+
+   if (pc->opt_reload_elim) {
+      reldelim = CALLOC_STRUCT(pass_reld_elim);
+      reldelim->pc = pc;
+
+      pc->pass_seq++;
+      ret = nv_pass_reload_elim(reldelim, root);
+      if (ret) {
+         FREE(reldelim);
+         return ret;
+      }
+      memset(reldelim, 0, sizeof(struct pass_reld_elim));
+      reldelim->pc = pc;
+   }
+
+   pc->pass_seq++;
+   ret = nv_pass_cse(&pass, root);
+   if (ret)
+      return ret;
+
+   dce.pc = pc;
+   do {
+      dce.removed = 0;
+      pc->pass_seq++;
+      ret = nv_pass_dce(&dce, root);
+      if (ret)
+         return ret;
+   } while (dce.removed);
+
+   if (pc->opt_reload_elim) {
+      pc->pass_seq++;
+      ret = nv_pass_mem_opt(reldelim, root);
+      if (!ret) {
+         memset(reldelim, 0, sizeof(struct pass_reld_elim));
+         reldelim->pc = pc;
+
+         pc->pass_seq++;
+         ret = nv_pass_mem_opt(reldelim, root);
+      }
+      FREE(reldelim);
+      if (ret)
+         return ret;
+   }
+
+   ret = nv_pass_tex_mask(&pass, root);
+   if (ret)
+      return ret;
+
+   pc->pass_seq++;
+   ret = nv_pass_fix_bind(&pass, root);
+
+   return ret;
+}
+
+int
+nvc0_pc_exec_pass0(struct nv_pc *pc)
+{
+   int i, ret;
+
+   for (i = 0; i < pc->num_subroutines + 1; ++i)
+      if (pc->root[i] && (ret = nv_pc_pass0(pc, pc->root[i])))
+         return ret;
+   return 0;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_print.c b/src/gallium/drivers/nvc0/nvc0_pc_print.c
new file mode 100644 (file)
index 0000000..b038264
--- /dev/null
@@ -0,0 +1,377 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "nvc0_pc.h"
+
+#define PRINT(args...) debug_printf(args)
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#endif
+
+static const char *norm = "\x1b[00m";
+static const char *gree = "\x1b[32m";
+static const char *blue = "\x1b[34m";
+static const char *cyan = "\x1b[36m";
+static const char *yllw = "\x1b[33m";
+static const char *mgta = "\x1b[35m";
+
+static const char *nv_cond_names[] =
+{
+   "never", "lt" , "eq" , "le" , "gt" , "ne" , "ge" , "",
+   "never", "ltu", "equ", "leu", "gtu", "neu", "geu", "",
+   "o", "c", "a", "s"
+};
+
+static const char *nv_modifier_strings[] =
+{
+   "",
+   "neg",
+   "abs",
+   "neg abs",
+   "not",
+   "not neg"
+   "not abs",
+   "not neg abs",
+   "sat",
+   "BAD_MOD"
+};
+
+const char *
+nvc0_opcode_name(uint opcode)
+{
+   return nvc0_op_info_table[MIN2(opcode, NV_OP_COUNT)].name;
+}
+
+static INLINE const char *
+nv_type_name(ubyte type, ubyte size)
+{
+   switch (type) {
+   case NV_TYPE_U16: return "u16";
+   case NV_TYPE_S16: return "s16";
+   case NV_TYPE_F32: return "f32";
+   case NV_TYPE_U32: return "u32";
+   case NV_TYPE_S32: return "s32";
+   case NV_TYPE_P32: return "p32";
+   case NV_TYPE_F64: return "f64";
+   case NV_TYPE_ANY:
+   {
+      switch (size) {
+      case 1: return "b8";
+      case 2: return "b16";
+      case 4: return "b32";
+      case 8: return "b64";
+      case 12: return "b96";
+      case 16: return "b128";
+      default:
+         return "BAD_SIZE";
+      }
+   }
+   default:
+      return "BAD_TYPE";
+   }
+}
+
+static INLINE const char *
+nv_cond_name(ubyte cc)
+{
+   return nv_cond_names[MIN2(cc, 19)];
+}
+
+static INLINE const char *
+nv_modifier_string(ubyte mod)
+{
+   return nv_modifier_strings[MIN2(mod, 9)];
+}
+
+static INLINE int
+nv_value_id(struct nv_value *value)
+{
+   if (value->join->reg.id >= 0)
+      return value->join->reg.id;
+   return value->n;
+}
+
+static INLINE boolean
+nv_value_allocated(struct nv_value *value)
+{
+   return (value->reg.id >= 0) ? TRUE : FALSE;
+}
+
+static INLINE void
+nv_print_address(const char c, int buf, struct nv_value *a, int offset)
+{
+   const char ac = (a && nv_value_allocated(a)) ? '$' : '%';
+   char sg;
+
+   if (offset < 0) {
+      sg = '-';
+      offset = -offset;
+   } else {
+      sg = '+';
+   }
+
+   if (buf >= 0)
+      PRINT(" %s%c%i[", cyan, c, buf);
+   else
+      PRINT(" %s%c[", cyan, c);
+   if (a)
+      PRINT("%s%ca%i%s%c", mgta, ac, nv_value_id(a), cyan, sg);
+   PRINT("%s0x%x%s]", yllw, offset, cyan);
+}
+
+static INLINE void
+nv_print_value(struct nv_value *value, struct nv_value *indir, ubyte type)
+{
+   char reg_pfx = nv_value_allocated(value->join) ? '$' : '%';
+
+   if (value->reg.file != NV_FILE_PRED)
+      PRINT(" %s%s", gree, nv_type_name(type, value->reg.size));
+
+   switch (value->reg.file) {
+   case NV_FILE_GPR:
+      PRINT(" %s%cr%i", blue, reg_pfx, nv_value_id(value));
+      if (value->reg.size == 8)
+         PRINT("d");
+      if (value->reg.size == 16)
+         PRINT("q");
+      break;
+   case NV_FILE_PRED:
+      PRINT(" %s%cp%i", mgta, reg_pfx, nv_value_id(value));
+      break;
+   case NV_FILE_COND:
+      PRINT(" %s%cc%i", mgta, reg_pfx, nv_value_id(value));
+      break;
+   case NV_FILE_MEM_L:
+      nv_print_address('l', -1, indir, value->reg.address);
+      break;
+   case NV_FILE_MEM_G:
+      nv_print_address('g', -1, indir, value->reg.address);
+      break;
+   case NV_FILE_MEM_A:
+      nv_print_address('a', -1, indir, value->reg.address);
+      break;
+   case NV_FILE_MEM_V:
+      nv_print_address('v', -1, indir, value->reg.address);
+      break;
+   case NV_FILE_IMM:
+      switch (type) {
+      case NV_TYPE_U16:
+      case NV_TYPE_S16:
+         PRINT(" %s0x%04x", yllw, value->reg.imm.u32);
+         break;
+      case NV_TYPE_F32:
+         PRINT(" %s%f", yllw, value->reg.imm.f32);
+         break;
+      case NV_TYPE_F64:
+         PRINT(" %s%f", yllw, value->reg.imm.f64);
+         break;
+      case NV_TYPE_U32:
+      case NV_TYPE_S32:
+      case NV_TYPE_P32:
+      case NV_TYPE_ANY:
+         PRINT(" %s0x%08x", yllw, value->reg.imm.u32);
+         break;
+      }
+      break;
+   default:
+      if (value->reg.file >= NV_FILE_MEM_C(0) &&
+          value->reg.file <= NV_FILE_MEM_C(15))
+         nv_print_address('c', value->reg.file - NV_FILE_MEM_C(0), indir,
+                          value->reg.address);
+      else
+         NOUVEAU_ERR(" BAD_FILE[%i]", nv_value_id(value));
+      break;
+   }
+}
+
+static INLINE void
+nv_print_ref(struct nv_ref *ref, struct nv_value *indir, ubyte type)
+{
+   nv_print_value(ref->value, indir, type);
+}
+
+void
+nvc0_print_instruction(struct nv_instruction *i)
+{
+   int s;
+
+   PRINT("%i: ", i->serial);
+
+   if (i->predicate >= 0) {
+      PRINT("%s%s", gree, i->cc ? "fl" : "tr");
+      nv_print_ref(i->src[i->predicate], NULL, NV_TYPE_U8);
+      PRINT(" ");
+   }
+
+   PRINT("%s", gree);
+   if (NV_BASEOP(i->opcode) == NV_OP_SET)
+      PRINT("set %s", nv_cond_name(i->set_cond));
+   else
+   if (i->saturate)
+      PRINT("sat %s", nvc0_opcode_name(i->opcode));
+   else
+      PRINT("%s", nvc0_opcode_name(i->opcode));
+
+   if (i->opcode == NV_OP_CVT)
+      nv_print_value(i->def[0], NULL, i->ext.cvt.d);
+   else
+   if (i->def[0])
+      nv_print_value(i->def[0], NULL, NV_OPTYPE(i->opcode));
+   else
+   if (i->target)
+      PRINT(" %s(BB:%i)", yllw, i->target->id);
+   else
+      PRINT(" #");
+
+   for (s = 1; s < 4 && i->def[s]; ++s)
+      nv_print_value(i->def[s], NULL, NV_OPTYPE(i->opcode));
+   if (s > 1)
+      PRINT("%s ,", norm);
+
+   for (s = 0; s < 6 && i->src[s]; ++s) {
+      ubyte type;
+      if (s == i->indirect || s == i->predicate)
+         continue;
+      if (i->opcode == NV_OP_CVT)
+         type = i->ext.cvt.s;
+      else
+         type = NV_OPTYPE(i->opcode);
+
+      if (i->src[s]->mod)
+         PRINT(" %s%s", gree, nv_modifier_string(i->src[s]->mod));
+
+      if (i->indirect >= 0 &&
+          NV_IS_MEMORY_FILE(i->src[s]->value->reg.file))
+         nv_print_ref(i->src[s], i->src[i->indirect]->value, type);
+      else
+         nv_print_ref(i->src[s], NULL, type);
+   }
+   PRINT(" %s\n", norm);
+}
+
+#define NV_MOD_SGN NV_MOD_ABS | NV_MOD_NEG
+
+struct nv_op_info nvc0_op_info_table[NV_OP_COUNT + 1] =
+{
+   { NV_OP_UNDEF,  "undef",  NV_TYPE_ANY, 0, /* fcvpoi */ 0, 0, 0, 0, 1, 0, 0 },
+   { NV_OP_BIND,   "bind",   NV_TYPE_ANY, 0, /* fcvpoi */ 0, 0, 1, 0, 1, 0, 0 },
+   { NV_OP_MERGE,  "merge",  NV_TYPE_ANY, 0, /* fcvpoi */ 0, 0, 1, 0, 1, 0, 0 },
+   { NV_OP_PHI,    "phi",    NV_TYPE_ANY, 0, /* fcvpoi */ 0, 0, 0, 0, 1, 0, 0 },
+   { NV_OP_SELECT, "select", NV_TYPE_ANY, 0, /* fcvpoi */ 0, 0, 0, 0, 1, 0, 0 },
+   { NV_OP_NOP,    "nop",    NV_TYPE_ANY, 0, /* fcvpoi */ 0, 0, 0, 0, 0, 0, 0 },
+
+   { NV_OP_LD,  "ld",  NV_TYPE_ANY, 0, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_ST,  "st",  NV_TYPE_ANY, 0, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_MOV, "mov", NV_TYPE_ANY, 0, 0, 0, 0, 1, 0, 1, 0 },
+   { NV_OP_AND, "and", NV_TYPE_U32, NV_MOD_NOT, 0, 1, 0, 1, 0, 6, 0 },
+   { NV_OP_OR,  "or",  NV_TYPE_U32, NV_MOD_NOT, 0, 1, 0, 1, 0, 6, 0 },
+   { NV_OP_XOR, "xor", NV_TYPE_U32, NV_MOD_NOT, 0, 1, 0, 1, 0, 6, 0 },
+   { NV_OP_SHL, "shl", NV_TYPE_U32, 0, 0, 0, 0, 1, 0, 1, 0 },
+   { NV_OP_SHR, "shr", NV_TYPE_U32, 0, 0, 0, 0, 1, 0, 1, 0 },
+   { NV_OP_NOT, "not", NV_TYPE_U32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_SET, "set", NV_TYPE_ANY, NV_MOD_SGN, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_ADD, "add", NV_TYPE_F32, NV_MOD_SGN, 0, 1, 0, 1, 0, 2, 2 },
+   { NV_OP_SUB, "sub", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 1, 0, 2, 2 },
+   { NV_OP_MUL, "mul", NV_TYPE_F32, NV_MOD_SGN, 0, 1, 0, 1, 0, 2, 2 },
+   { NV_OP_MAD, "mad", NV_TYPE_F32, NV_MOD_SGN, 0, 1, 0, 1, 0, 2, 2 },
+   { NV_OP_ABS, "abs", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_NEG, "neg", NV_TYPE_F32, NV_MOD_ABS, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_MAX, "max", NV_TYPE_F32, NV_MOD_SGN, 0, 1, 0, 1, 0, 2, 2 },
+   { NV_OP_MIN, "min", NV_TYPE_F32, NV_MOD_SGN, 0, 1, 0, 1, 0, 2, 2 },
+   { NV_OP_CVT, "cvt", NV_TYPE_ANY, NV_MOD_SGN, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_CEIL,  "ceil",  NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_FLOOR, "floor", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_TRUNC, "floor", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_SAD, "sad", NV_TYPE_S32, 0, 0, 1, 0, 1, 0, 0, 0 },
+
+   { NV_OP_VFETCH,  "vfetch",  NV_TYPE_ANY, 0, 0, 0, 1, 1, 0, 0, 0 },
+   { NV_OP_PFETCH,  "pfetch",  NV_TYPE_U32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_EXPORT,  "export",  NV_TYPE_ANY, 0, 0, 0, 1, 1, 0, 0, 0 },
+   { NV_OP_LINTERP, "linterp", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_PINTERP, "pinterp", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_EMIT,    "emit",    NV_TYPE_ANY, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_RESTART, "restart", NV_TYPE_ANY, 0, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_TEX, "tex",      NV_TYPE_F32, 0, 0, 0, 1, 1, 0, 0, 0 },
+   { NV_OP_TXB, "texbias",  NV_TYPE_F32, 0, 0, 0, 1, 1, 0, 0, 0 },
+   { NV_OP_TXL, "texlod",   NV_TYPE_F32, 0, 0, 0, 1, 1, 0, 0, 0 },
+   { NV_OP_TXF, "texfetch", NV_TYPE_U32, 0, 0, 0, 1, 1, 0, 0, 0 },
+   { NV_OP_TXQ, "texquery", NV_TYPE_U32, 0, 0, 0, 1, 1, 0, 0, 0 },
+
+   { NV_OP_QUADOP, "quadop", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_DFDX,   "dfdx",   NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_DFDY,   "dfdy",   NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_KIL,  "kil",  NV_TYPE_ANY, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_BRA,  "bra",  NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_CALL, "call", NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_RET,  "ret",  NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_RET,  "exit", NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_NOP,  "ud",   NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_NOP,  "ud",   NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_JOINAT, "joinat", NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_JOIN,   "join",   NV_TYPE_ANY, 0, 1, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_ADD, "add", NV_TYPE_S32, 0, 0, 1, 0, 1, 0, 1, 0 },
+   { NV_OP_MUL, "mul", NV_TYPE_S32, 0, 0, 1, 0, 1, 0, 1, 0 },
+   { NV_OP_ABS, "abs", NV_TYPE_S32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_NEG, "neg", NV_TYPE_S32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_MAX, "max", NV_TYPE_S32, 0, 0, 1, 0, 1, 0, 0, 0 },
+   { NV_OP_MIN, "max", NV_TYPE_U32, 0, 0, 1, 0, 1, 0, 0, 0 },
+   { NV_OP_MAX, "min", NV_TYPE_S32, 0, 0, 1, 0, 1, 0, 0, 0 },
+   { NV_OP_MIN, "min", NV_TYPE_U32, 0, 0, 1, 0, 1, 0, 0, 0 },
+   { NV_OP_SET, "set", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 1, 0, 0, 2 },
+   { NV_OP_SET, "set", NV_TYPE_S32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_SET, "set", NV_TYPE_U32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_SHR, "sar", NV_TYPE_S32, 0, 0, 0, 0, 1, 0, 1, 0 },
+   { NV_OP_RCP, "rcp", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_RSQ, "rsqrt", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_LG2, "lg2", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_SIN, "sin", NV_TYPE_F32, 0, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_COS, "cos", NV_TYPE_F32, 0, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_EX2, "ex2", NV_TYPE_F32, 0, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_PRESIN, "presin", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_PREEX2, "preex2", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 0, 0, 0, 0 },
+   { NV_OP_SAT, "sat", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_SET_F32_AND, "and set", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_SET_F32_OR,  "or set",  NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_SET_F32_XOR, "xor set", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_SELP, "selp", NV_TYPE_U32, 0, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_SLCT_F32, "slct", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_SLCT_F32, "slct", NV_TYPE_S32, 0, 0, 0, 0, 1, 0, 0, 0 },
+   { NV_OP_SLCT_F32, "slct", NV_TYPE_U32, 0, 0, 0, 0, 1, 0, 0, 0 },
+
+   { NV_OP_ADD, "sub", NV_TYPE_F32, 0, 0, 0, 0, 1, 0, 1, 0 },
+
+   { NV_OP_FSET_F32, "fset", NV_TYPE_F32, NV_MOD_SGN, 0, 0, 0, 1, 0, 0, 2 },
+
+   { NV_OP_TXG, "texgrad", NV_TYPE_F32, 0, 0, 0, 1, 1, 0, 0, 0 },
+
+   { NV_OP_UNDEF, "BAD_OP", NV_TYPE_ANY, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
diff --git a/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c b/src/gallium/drivers/nvc0/nvc0_pc_regalloc.c
new file mode 100644 (file)
index 0000000..d24f09a
--- /dev/null
@@ -0,0 +1,927 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#define NOUVEAU_DEBUG 1
+
+/* #define NVC0_RA_DEBUG_LIVEI */
+/* #define NVC0_RA_DEBUG_LIVE_SETS */
+/* #define NVC0_RA_DEBUG_JOIN */
+
+#include "nvc0_pc.h"
+#include "util/u_simple_list.h"
+
+#define NVC0_NUM_REGISTER_FILES 3
+
+/* @unit_shift: log2 of min allocation unit for register */
+struct register_set {
+   uint32_t bits[NVC0_NUM_REGISTER_FILES][2];
+   uint32_t last[NVC0_NUM_REGISTER_FILES];
+   int log2_unit[NVC0_NUM_REGISTER_FILES];
+   struct nv_pc *pc;
+};
+
+struct nv_pc_pass {
+   struct nv_pc *pc;
+   struct nv_instruction **insns;
+   uint num_insns;
+   uint pass_seq;
+};
+
+static void
+ranges_coalesce(struct nv_range *range)
+{
+   while (range->next && range->end >= range->next->bgn) {
+      struct nv_range *rnn = range->next->next;
+      assert(range->bgn <= range->next->bgn);
+      range->end = MAX2(range->end, range->next->end);
+      FREE(range->next);
+      range->next = rnn;
+   }
+}
+
+static boolean
+add_range_ex(struct nv_value *val, int bgn, int end, struct nv_range *new_range)
+{
+   struct nv_range *range, **nextp = &val->livei;
+
+   for (range = val->livei; range; range = range->next) {
+      if (end < range->bgn)
+         break; /* insert before */
+
+      if (bgn > range->end) {
+         nextp = &range->next;
+         continue; /* insert after */
+      }
+
+      /* overlap */
+      if (bgn < range->bgn) {
+         range->bgn = bgn;
+         if (end > range->end)
+            range->end = end;
+         ranges_coalesce(range);
+         return TRUE;
+      }
+      if (end > range->end) {
+         range->end = end;
+         ranges_coalesce(range);
+         return TRUE;
+      }
+      assert(bgn >= range->bgn);
+      assert(end <= range->end);
+      return TRUE;
+   }
+
+   if (!new_range)
+      new_range = CALLOC_STRUCT(nv_range);
+
+   new_range->bgn = bgn;
+   new_range->end = end;
+   new_range->next = range;
+   *(nextp) = new_range;
+   return FALSE;
+}
+
+static void
+add_range(struct nv_value *val, struct nv_basic_block *b, int end)
+{
+   int bgn;
+
+   if (!val->insn) /* ignore non-def values */
+      return;
+   assert(b->entry->serial <= b->exit->serial);
+   assert(b->phi->serial <= end);
+   assert(b->exit->serial + 1 >= end);
+
+   bgn = val->insn->serial;
+   if (bgn < b->entry->serial || bgn > b->exit->serial)
+      bgn = b->entry->serial;
+
+   assert(bgn <= end);
+
+   add_range_ex(val, bgn, end, NULL);
+}
+
+#if defined(NVC0_RA_DEBUG_JOIN) || defined(NVC0_RA_DEBUG_LIVEI)
+static void
+livei_print(struct nv_value *a)
+{
+   struct nv_range *r = a->livei;
+
+   debug_printf("livei %i: ", a->n);
+   while (r) {
+      debug_printf("[%i, %i) ", r->bgn, r->end);
+      r = r->next;
+   }
+   debug_printf("\n");
+}
+#endif
+
+static void
+livei_unify(struct nv_value *dst, struct nv_value *src)
+{
+   struct nv_range *range, *next;
+
+   for (range = src->livei; range; range = next) {
+      next = range->next;
+      if (add_range_ex(dst, range->bgn, range->end, range))
+         FREE(range);
+   }
+   src->livei = NULL;
+}
+
+static void
+livei_release(struct nv_value *val)
+{
+   struct nv_range *range, *next;
+
+   for (range = val->livei; range; range = next) {
+      next = range->next;
+      FREE(range);
+   }
+}
+
+static boolean
+livei_have_overlap(struct nv_value *a, struct nv_value *b)
+{
+   struct nv_range *r_a, *r_b;
+
+   for (r_a = a->livei; r_a; r_a = r_a->next) {
+      for (r_b = b->livei; r_b; r_b = r_b->next) {
+         if (r_b->bgn < r_a->end &&
+             r_b->end > r_a->bgn)
+            return TRUE;
+      }
+   }
+   return FALSE;
+}
+
+static int
+livei_end(struct nv_value *a)
+{
+   struct nv_range *r = a->livei;
+
+   assert(r);
+   while (r->next)
+      r = r->next;
+   return r->end;
+}
+
+static boolean
+livei_contains(struct nv_value *a, int pos)
+{
+   struct nv_range *r;
+
+   for (r = a->livei; r && r->bgn <= pos; r = r->next)
+      if (r->end > pos)
+         return TRUE;
+   return FALSE;
+}
+
+static boolean
+reg_assign(struct register_set *set, struct nv_value **def, int n)
+{
+   int i, id, s, k;
+   uint32_t m;
+   int f = def[0]->reg.file;
+
+   k = n;
+   if (k == 3)
+      k = 4;
+   s = (k * def[0]->reg.size) >> set->log2_unit[f];
+   m = (1 << s) - 1;
+
+   id = set->last[f];
+
+   for (i = 0; i * 32 < set->last[f]; ++i) {
+      if (set->bits[f][i] == 0xffffffff)
+         continue;
+
+      for (id = 0; id < 32; id += s)
+         if (!(set->bits[f][i] & (m << id)))
+            break;
+      if (id < 32)
+         break;
+   }
+   if (i * 32 + id > set->last[f])
+      return FALSE;
+
+   set->bits[f][i] |= m << id;
+
+   id += i * 32;
+
+   set->pc->max_reg[f] = MAX2(set->pc->max_reg[f], id + s - 1);
+
+   for (i = 0; i < n; ++i)
+      if (def[i]->livei)
+         def[i]->reg.id = id++;
+
+   return TRUE;
+}
+
+static INLINE void
+reg_occupy(struct register_set *set, struct nv_value *val)
+{
+   int id = val->reg.id, f = val->reg.file;
+   uint32_t m;
+
+   if (id < 0)
+      return;
+   m = (1 << (val->reg.size >> set->log2_unit[f])) - 1;
+
+   set->bits[f][id / 32] |= m << (id % 32);
+
+   if (set->pc->max_reg[f] < id)
+      set->pc->max_reg[f] = id;
+}
+
+static INLINE void
+reg_release(struct register_set *set, struct nv_value *val)
+{
+   int id = val->reg.id, f = val->reg.file;
+   uint32_t m;
+
+   if (id < 0)
+      return;
+   m = (1 << (val->reg.size >> set->log2_unit[f])) - 1;
+
+   set->bits[f][id / 32] &= ~(m << (id % 32));
+}
+
+static INLINE boolean
+join_allowed(struct nv_pc_pass *ctx, struct nv_value *a, struct nv_value *b)
+{
+   int i;
+   struct nv_value *val;
+
+   if (a->reg.file != b->reg.file || a->reg.size != b->reg.size)
+      return FALSE;
+
+   if (a->join->reg.id == b->join->reg.id)
+      return TRUE;
+
+   /* either a or b or both have been assigned */
+
+   if (a->join->reg.id >= 0 && b->join->reg.id >= 0)
+      return FALSE;
+   else
+   if (b->join->reg.id >= 0) {
+      if (b->join->reg.id == 63)
+         return FALSE;
+      val = a;
+      a = b;
+      b = val;
+   } else
+   if (a->join->reg.id == 63)
+      return FALSE;
+
+   for (i = 0; i < ctx->pc->num_values; ++i) {
+      val = &ctx->pc->values[i];
+
+      if (val->join->reg.id != a->join->reg.id)
+         continue;
+      if (val->join != a->join && livei_have_overlap(val->join, b->join))
+         return FALSE;
+   }
+   return TRUE;
+}
+
+static INLINE void
+do_join_values(struct nv_pc_pass *ctx, struct nv_value *a, struct nv_value *b)
+{
+   int j;
+   struct nv_value *bjoin = b->join;
+
+   if (b->join->reg.id >= 0)
+      a->join->reg.id = b->join->reg.id;
+
+   livei_unify(a->join, b->join);
+
+#ifdef NVC0_RA_DEBUG_JOIN
+   debug_printf("joining %i to %i\n", b->n, a->n);
+#endif
+   
+   /* make a->join the new representative */
+   for (j = 0; j < ctx->pc->num_values; ++j) 
+      if (ctx->pc->values[j].join == bjoin)
+         ctx->pc->values[j].join = a->join;
+
+   assert(b->join == a->join);
+}
+
+static INLINE void
+try_join_values(struct nv_pc_pass *ctx, struct nv_value *a, struct nv_value *b)
+{
+   if (!join_allowed(ctx, a, b)) {
+#ifdef NVC0_RA_DEBUG_JOIN
+      debug_printf("cannot join %i to %i: not allowed\n", b->n, a->n);
+#endif
+      return;
+   }
+   if (livei_have_overlap(a->join, b->join)) {
+#ifdef NVC0_RA_DEBUG_JOIN
+      debug_printf("cannot join %i to %i: livei overlap\n", b->n, a->n);
+      livei_print(a);
+      livei_print(b);
+#endif
+      return;
+   }
+
+   do_join_values(ctx, a, b);
+}
+
+static INLINE boolean
+need_new_else_block(struct nv_basic_block *b, struct nv_basic_block *p)
+{
+   int i = 0, n = 0;
+
+   for (; i < 2; ++i)
+      if (p->out[i] && !IS_LOOP_EDGE(p->out_kind[i]))
+         ++n;
+
+   return (b->num_in > 1) && (n == 2);
+}
+
+static int
+phi_opnd_for_bb(struct nv_instruction *phi, struct nv_basic_block *b,
+                struct nv_basic_block *tb)
+{
+   int i, j;
+
+   for (j = -1, i = 0; i < 6 && phi->src[i]; ++i) {
+      if (!nvc0_bblock_reachable_by(b, phi->src[i]->value->insn->bb, tb))
+         continue;
+      /* NOTE: back-edges are ignored by the reachable-by check */
+      if (j < 0 || !nvc0_bblock_reachable_by(phi->src[j]->value->insn->bb,
+                                             phi->src[i]->value->insn->bb, tb))
+         j = i;
+   }
+   return j;
+}
+
+/* For each operand of each PHI in b, generate a new value by inserting a MOV
+ * at the end of the block it is coming from and replace the operand with its
+ * result. This eliminates liveness conflicts and enables us to let values be
+ * copied to the right register if such a conflict exists nonetheless.
+ *
+ * These MOVs are also crucial in making sure the live intervals of phi srces
+ * are extended until the end of the loop, since they are not included in the
+ * live-in sets.
+ */
+static int
+pass_generate_phi_movs(struct nv_pc_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_instruction *i, *ni;
+   struct nv_value *val;
+   struct nv_basic_block *p, *pn;
+   int n, j;
+
+   b->pass_seq = ctx->pc->pass_seq;
+
+   for (n = 0; n < b->num_in; ++n) {
+      p = pn = b->in[n];
+      assert(p);
+
+      if (need_new_else_block(b, p)) {
+         pn = new_basic_block(ctx->pc);
+
+         if (p->out[0] == b)
+            p->out[0] = pn;
+         else
+            p->out[1] = pn;
+
+         if (p->exit->target == b) /* target to new else-block */
+            p->exit->target = pn;
+
+         b->in[n] = pn;
+
+         pn->out[0] = b;
+         pn->in[0] = p;
+         pn->num_in = 1;
+      }
+      ctx->pc->current_block = pn;
+
+      for (i = b->phi; i && i->opcode == NV_OP_PHI; i = i->next) {
+         if ((j = phi_opnd_for_bb(i, p, b)) < 0)
+            continue;
+         val = i->src[j]->value;
+
+         if (i->src[j]->flags) {
+            /* value already encountered from a different in-block */
+            val = val->insn->src[0]->value;
+            while (j < 6 && i->src[j])
+               ++j;
+            assert(j < 6);
+         }
+
+         ni = new_instruction(ctx->pc, NV_OP_MOV);
+
+         /* TODO: insert instruction at correct position in the first place */
+         if (ni->prev && ni->prev->target)
+            nvc0_insns_permute(ni->prev, ni);
+
+         ni->def[0] = new_value_like(ctx->pc, val);
+         ni->def[0]->insn = ni;
+         nv_reference(ctx->pc, ni, 0, val);
+         nv_reference(ctx->pc, i, j, ni->def[0]); /* new phi source = MOV def */
+         i->src[j]->flags = 1;
+      }
+
+      if (pn != p && pn->exit) {
+         ctx->pc->current_block = b->in[n ? 0 : 1];
+         ni = new_instruction(ctx->pc, NV_OP_BRA);
+         ni->target = b;
+         ni->terminator = 1;
+      }
+   }
+
+   for (j = 0; j < 2; ++j)
+      if (b->out[j] && b->out[j]->pass_seq < ctx->pc->pass_seq)
+         pass_generate_phi_movs(ctx, b->out[j]);
+
+   return 0;
+}
+
+static int
+pass_join_values(struct nv_pc_pass *ctx, int iter)
+{
+   int c, n;
+
+   for (n = 0; n < ctx->num_insns; ++n) {
+      struct nv_instruction *i = ctx->insns[n];
+
+      switch (i->opcode) {
+      case NV_OP_PHI:
+         if (iter != 2)
+            break;
+         for (c = 0; c < 6 && i->src[c]; ++c)
+            try_join_values(ctx, i->def[0], i->src[c]->value);
+         break;
+      case NV_OP_MOV:
+         if ((iter == 2) && i->src[0]->value->insn &&
+             !nv_is_texture_op(i->src[0]->value->join->insn->opcode))
+            try_join_values(ctx, i->def[0], i->src[0]->value);
+         break;
+      case NV_OP_SELECT:
+         if (iter != 1)
+            break;
+         for (c = 0; c < 6 && i->src[c]; ++c) {
+            assert(join_allowed(ctx, i->def[0], i->src[c]->value));
+            do_join_values(ctx, i->def[0], i->src[c]->value);
+         }
+         break;
+      case NV_OP_TEX:
+      case NV_OP_TXB:
+      case NV_OP_TXL:
+      case NV_OP_TXQ:
+         /* on nvc0, TEX src and dst can differ */
+         break;
+      case NV_OP_BIND:
+         if (iter)
+            break;
+         for (c = 0; c < 6 && i->src[c]; ++c)
+            do_join_values(ctx, i->def[c], i->src[c]->value);
+         break;
+      default:
+         break;
+      }
+   }
+   return 0;
+}
+
+/* Order the instructions so that live intervals can be expressed in numbers. */
+static void
+pass_order_instructions(void *priv, struct nv_basic_block *b)
+{
+   struct nv_pc_pass *ctx = (struct nv_pc_pass *)priv;
+   struct nv_instruction *i;
+
+   b->pass_seq = ctx->pc->pass_seq;
+
+   assert(!b->exit || !b->exit->next);
+   for (i = b->phi; i; i = i->next) {
+      i->serial = ctx->num_insns;
+      ctx->insns[ctx->num_insns++] = i;
+   }
+}
+
+static void
+bb_live_set_print(struct nv_pc *pc, struct nv_basic_block *b)
+{
+#ifdef NVC0_RA_DEBUG_LIVE_SETS
+   struct nv_value *val;
+   int j;
+
+   debug_printf("LIVE-INs of BB:%i: ", b->id);
+
+   for (j = 0; j < pc->num_values; ++j) {
+      if (!(b->live_set[j / 32] & (1 << (j % 32))))
+         continue;
+      val = &pc->values[j];
+      if (!val->insn)
+         continue;
+      debug_printf("%i ", val->n);
+   }
+   debug_printf("\n");
+#endif
+}
+
+static INLINE void
+live_set_add(struct nv_basic_block *b, struct nv_value *val)
+{
+   if (!val->insn) /* don't add non-def values */
+      return;
+   b->live_set[val->n / 32] |= 1 << (val->n % 32);
+}
+
+static INLINE void
+live_set_rem(struct nv_basic_block *b, struct nv_value *val)
+{
+   b->live_set[val->n / 32] &= ~(1 << (val->n % 32));
+}
+
+static INLINE boolean
+live_set_test(struct nv_basic_block *b, struct nv_ref *ref)
+{
+   int n = ref->value->n;
+   return b->live_set[n / 32] & (1 << (n % 32));
+}
+
+/* The live set of a block contains those values that are live immediately
+ * before the beginning of the block, so do a backwards scan.
+ */
+static int
+pass_build_live_sets(struct nv_pc_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_instruction *i;
+   int j, n, ret = 0;
+
+   if (b->pass_seq >= ctx->pc->pass_seq)
+      return 0;
+   b->pass_seq = ctx->pc->pass_seq;
+
+   /* slight hack for undecidedness: set phi = entry if it's undefined */
+   if (!b->phi)
+      b->phi = b->entry;
+
+   for (n = 0; n < 2; ++n) {
+      if (!b->out[n] || b->out[n] == b)
+         continue;
+      ret = pass_build_live_sets(ctx, b->out[n]);
+      if (ret)
+         return ret;
+
+      if (n == 0) {
+         for (j = 0; j < (ctx->pc->num_values + 31) / 32; ++j)
+            b->live_set[j] = b->out[n]->live_set[j];
+      } else {
+         for (j = 0; j < (ctx->pc->num_values + 31) / 32; ++j)
+            b->live_set[j] |= b->out[n]->live_set[j];
+      }
+   }
+
+   if (!b->entry)
+      return 0;
+
+   bb_live_set_print(ctx->pc, b);
+
+   for (i = b->exit; i != b->entry->prev; i = i->prev) {
+      for (j = 0; j < 5 && i->def[j]; j++)
+         live_set_rem(b, i->def[j]);
+      for (j = 0; j < 6 && i->src[j]; j++)
+         live_set_add(b, i->src[j]->value);
+   }
+   for (i = b->phi; i && i->opcode == NV_OP_PHI; i = i->next)
+      live_set_rem(b, i->def[0]);
+
+   bb_live_set_print(ctx->pc, b);
+
+   return 0;
+}
+
+static void collect_live_values(struct nv_basic_block *b, const int n)
+{
+   int i;
+
+   if (b->out[0]) {
+      if (b->out[1]) { /* what to do about back-edges ? */
+         for (i = 0; i < n; ++i)
+            b->live_set[i] = b->out[0]->live_set[i] | b->out[1]->live_set[i];
+      } else {
+         memcpy(b->live_set, b->out[0]->live_set, n * sizeof(uint32_t));
+      }
+   } else
+   if (b->out[1]) {
+      memcpy(b->live_set, b->out[1]->live_set, n * sizeof(uint32_t));
+   } else {
+      memset(b->live_set, 0, n * sizeof(uint32_t));
+   }
+}
+
+/* NOTE: the live intervals of phi functions start at the first non-phi insn. */
+static int
+pass_build_intervals(struct nv_pc_pass *ctx, struct nv_basic_block *b)
+{
+   struct nv_instruction *i, *i_stop;
+   int j, s;
+   const int n = (ctx->pc->num_values + 31) / 32;
+
+   /* verify that first block does not have live-in values */
+   if (b->num_in == 0)
+      for (j = 0; j < n; ++j)
+         assert(b->live_set[j] == 0);
+
+   collect_live_values(b, n);
+
+   /* remove live-outs def'd in a parallel block, hopefully they're all phi'd */
+   for (j = 0; j < 2; ++j) {
+      if (!b->out[j] || !b->out[j]->phi)
+         continue;
+      for (i = b->out[j]->phi; i->opcode == NV_OP_PHI; i = i->next) {
+         live_set_rem(b, i->def[0]);
+
+         for (s = 0; s < 6 && i->src[s]; ++s) {
+            assert(i->src[s]->value->insn);
+            if (nvc0_bblock_reachable_by(b, i->src[s]->value->insn->bb,
+                                         b->out[j]))
+               live_set_add(b, i->src[s]->value);
+            else
+               live_set_rem(b, i->src[s]->value);
+         }
+      }
+   }
+
+   /* remaining live-outs are live until the end */
+   if (b->exit) {
+      for (j = 0; j < ctx->pc->num_values; ++j) {
+         if (!(b->live_set[j / 32] & (1 << (j % 32))))
+            continue;
+         add_range(&ctx->pc->values[j], b, b->exit->serial + 1);
+#ifdef NVC0_RA_DEBUG_LIVEI
+         debug_printf("adding range for live value %i: ", j);
+         livei_print(&ctx->pc->values[j]);
+#endif
+      }
+   }
+
+   i_stop = b->entry ? b->entry->prev : NULL;
+
+   /* don't have to include phi functions here (will have 0 live range) */
+   for (i = b->exit; i != i_stop; i = i->prev) {
+      assert(i->serial >= b->phi->serial && i->serial <= b->exit->serial);
+      for (j = 0; j < 4 && i->def[j]; ++j)
+         live_set_rem(b, i->def[j]);
+
+      for (j = 0; j < 6 && i->src[j]; ++j) {
+         if (!live_set_test(b, i->src[j])) {
+            live_set_add(b, i->src[j]->value);
+            add_range(i->src[j]->value, b, i->serial);
+#ifdef NVC0_RA_DEBUG_LIVEI
+            debug_printf("adding range for source %i (ends living): ",
+                         i->src[j]->value->n);
+            livei_print(i->src[j]->value);
+#endif
+         }
+      }
+   }
+
+   b->pass_seq = ctx->pc->pass_seq;
+
+   if (b->out[0] && b->out[0]->pass_seq < ctx->pc->pass_seq)
+      pass_build_intervals(ctx, b->out[0]);
+
+   if (b->out[1] && b->out[1]->pass_seq < ctx->pc->pass_seq)
+      pass_build_intervals(ctx, b->out[1]);
+
+   return 0;
+}
+
+static INLINE void
+nvc0_ctor_register_set(struct nv_pc *pc, struct register_set *set)
+{
+   memset(set, 0, sizeof(*set));
+
+   set->last[NV_FILE_GPR] = 62;
+   set->last[NV_FILE_PRED] = 6;
+   set->last[NV_FILE_COND] = 1;
+
+   set->log2_unit[NV_FILE_GPR] = 2;
+   set->log2_unit[NV_FILE_COND] = 0;
+   set->log2_unit[NV_FILE_PRED] = 0;
+
+   set->pc = pc;
+}
+
+static void
+insert_ordered_tail(struct nv_value *list, struct nv_value *nval)
+{
+   struct nv_value *elem;
+
+   for (elem = list->prev;
+        elem != list && elem->livei->bgn > nval->livei->bgn;
+        elem = elem->prev);
+   /* now elem begins before or at the same time as val */
+
+   nval->prev = elem;
+   nval->next = elem->next;
+   elem->next->prev = nval;
+   elem->next = nval;
+}
+
+static int
+pass_linear_scan(struct nv_pc_pass *ctx, int iter)
+{
+   struct nv_instruction *i;
+   struct register_set f, free;
+   int k, n;
+   struct nv_value *cur, *val, *tmp[2];
+   struct nv_value active, inactive, handled, unhandled;
+
+   make_empty_list(&active);
+   make_empty_list(&inactive);
+   make_empty_list(&handled);
+   make_empty_list(&unhandled);
+
+   nvc0_ctor_register_set(ctx->pc, &free);
+
+   /* joined values should have range = NULL and thus not be added;
+    * also, fixed memory values won't be added because they're not
+    * def'd, just used
+    */
+   for (n = 0; n < ctx->num_insns; ++n) {
+      i = ctx->insns[n];
+
+      for (k = 0; k < 5; ++k) {
+         if (i->def[k] && i->def[k]->livei)
+            insert_ordered_tail(&unhandled, i->def[k]);
+         else
+         if (0 && i->def[k])
+            debug_printf("skipping def'd value %i: no livei\n", i->def[k]->n);
+      }
+   }
+
+   for (val = unhandled.next; val != unhandled.prev; val = val->next) {
+      assert(val->join == val);
+      assert(val->livei->bgn <= val->next->livei->bgn);
+   }
+
+   foreach_s(cur, tmp[0], &unhandled) {
+      remove_from_list(cur);
+
+      foreach_s(val, tmp[1], &active) {
+         if (livei_end(val) <= cur->livei->bgn) {
+            reg_release(&free, val);
+            move_to_head(&handled, val);
+         } else
+         if (!livei_contains(val, cur->livei->bgn)) {
+            reg_release(&free, val);
+            move_to_head(&inactive, val);
+         }
+      }
+
+      foreach_s(val, tmp[1], &inactive) {
+         if (livei_end(val) <= cur->livei->bgn)
+            move_to_head(&handled, val);
+         else
+         if (livei_contains(val, cur->livei->bgn)) {
+            reg_occupy(&free, val);
+            move_to_head(&active, val);
+         }
+      }
+
+      f = free;
+
+      foreach(val, &inactive)
+         if (livei_have_overlap(val, cur))
+            reg_occupy(&f, val);
+
+      foreach(val, &unhandled)
+         if (val->reg.id >= 0 && livei_have_overlap(val, cur))
+            reg_occupy(&f, val);
+
+      if (cur->reg.id < 0) {
+         boolean mem = FALSE;
+         int v = nvi_vector_size(cur->insn);
+
+         if (v > 1)
+            mem = !reg_assign(&f, &cur->insn->def[0], v);
+         else
+         if (iter)
+            mem = !reg_assign(&f, &cur, 1);
+
+         if (mem) {
+            NOUVEAU_ERR("out of registers\n");
+            abort();
+         }
+      }
+      insert_at_head(&active, cur);
+      reg_occupy(&free, cur);
+   }
+
+   return 0;
+}
+
+static int
+nv_pc_pass1(struct nv_pc *pc, struct nv_basic_block *root)
+{
+   struct nv_pc_pass *ctx;
+   int i, ret;
+
+   NOUVEAU_DBG("REGISTER ALLOCATION - entering\n");
+
+   ctx = CALLOC_STRUCT(nv_pc_pass);
+   if (!ctx)
+      return -1;
+   ctx->pc = pc;
+
+   ctx->insns = CALLOC(NV_PC_MAX_INSTRUCTIONS, sizeof(struct nv_instruction *));
+   if (!ctx->insns) {
+      FREE(ctx);
+      return -1;
+   }
+
+   pc->pass_seq++;
+   ret = pass_generate_phi_movs(ctx, root);
+   assert(!ret);
+
+   for (i = 0; i < pc->loop_nesting_bound; ++i) {
+      pc->pass_seq++;
+      ret = pass_build_live_sets(ctx, root);
+      assert(!ret && "live sets");
+      if (ret) {
+         NOUVEAU_ERR("failed to build live sets (iteration %d)\n", i);
+         goto out;
+      }
+   }
+
+   pc->pass_seq++;
+   nvc0_pc_pass_in_order(root, pass_order_instructions, ctx);
+
+   pc->pass_seq++;
+   ret = pass_build_intervals(ctx, root);
+   assert(!ret && "build intervals");
+   if (ret) {
+      NOUVEAU_ERR("failed to build live intervals\n");
+      goto out;
+   }
+
+#ifdef NVC0_RA_DEBUG_LIVEI
+   for (i = 0; i < pc->num_values; ++i)
+      livei_print(&pc->values[i]);
+#endif
+
+   ret = pass_join_values(ctx, 0);
+   if (ret)
+      goto out;
+   ret = pass_linear_scan(ctx, 0);
+   if (ret)
+      goto out;
+   ret = pass_join_values(ctx, 1);
+   if (ret)
+      goto out;
+   ret = pass_join_values(ctx, 2);
+   if (ret)
+      goto out;
+   ret = pass_linear_scan(ctx, 1);
+   if (ret)
+      goto out;
+
+   for (i = 0; i < pc->num_values; ++i)
+      livei_release(&pc->values[i]);
+
+   NOUVEAU_DBG("REGISTER ALLOCATION - leaving\n");
+
+out:
+   FREE(ctx->insns);
+   FREE(ctx);
+   return ret;
+}
+
+int
+nvc0_pc_exec_pass1(struct nv_pc *pc)
+{
+   int i, ret;
+
+   for (i = 0; i < pc->num_subroutines + 1; ++i)
+      if (pc->root[i] && (ret = nv_pc_pass1(pc, pc->root[i])))
+         return ret;
+   return 0;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c
new file mode 100644 (file)
index 0000000..57a0874
--- /dev/null
@@ -0,0 +1,678 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "pipe/p_shader_tokens.h"
+#include "pipe/p_defines.h"
+
+#define NOUVEAU_DEBUG
+
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_util.h"
+#include "tgsi/tgsi_dump.h"
+
+#include "nvc0_context.h"
+#include "nvc0_pc.h"
+
+static unsigned
+nvc0_tgsi_src_mask(const struct tgsi_full_instruction *inst, int c)
+{
+   unsigned mask = inst->Dst[0].Register.WriteMask;
+
+   switch (inst->Instruction.Opcode) {
+   case TGSI_OPCODE_COS:
+   case TGSI_OPCODE_SIN:
+      return (mask & 0x8) | ((mask & 0x7) ? 0x1 : 0x0);
+   case TGSI_OPCODE_DP3:
+      return 0x7;
+   case TGSI_OPCODE_DP4:
+   case TGSI_OPCODE_DPH:
+   case TGSI_OPCODE_KIL: /* WriteMask ignored */
+      return 0xf;
+   case TGSI_OPCODE_DST:
+      return mask & (c ? 0xa : 0x6);
+   case TGSI_OPCODE_EX2:
+   case TGSI_OPCODE_EXP:
+   case TGSI_OPCODE_LG2:
+   case TGSI_OPCODE_LOG:
+   case TGSI_OPCODE_POW:
+   case TGSI_OPCODE_RCP:
+   case TGSI_OPCODE_RSQ:
+   case TGSI_OPCODE_SCS:
+      return 0x1;
+   case TGSI_OPCODE_IF:
+      return 0x1;
+   case TGSI_OPCODE_LIT:
+      return 0xb;
+   case TGSI_OPCODE_TEX:
+   case TGSI_OPCODE_TXB:
+   case TGSI_OPCODE_TXL:
+   case TGSI_OPCODE_TXP:
+   {
+      const struct tgsi_instruction_texture *tex;
+
+      assert(inst->Instruction.Texture);
+      tex = &inst->Texture;
+
+      mask = 0x7;
+      if (inst->Instruction.Opcode != TGSI_OPCODE_TEX &&
+          inst->Instruction.Opcode != TGSI_OPCODE_TXD)
+         mask |= 0x8; /* bias, lod or proj */
+
+      switch (tex->Texture) {
+      case TGSI_TEXTURE_1D:
+         mask &= 0x9;
+         break;
+      case TGSI_TEXTURE_SHADOW1D:
+         mask &= 0x5;
+         break;
+      case TGSI_TEXTURE_2D:
+         mask &= 0xb;
+         break;
+      default:
+         break;
+      }
+   }
+          return mask;
+   case TGSI_OPCODE_XPD:
+   {
+      unsigned x = 0;
+      if (mask & 1) x |= 0x6;
+      if (mask & 2) x |= 0x5;
+      if (mask & 4) x |= 0x3;
+      return x;
+   }
+   default:
+      break;
+   }
+
+   return mask;
+}
+
+static void
+nvc0_indirect_inputs(struct nvc0_translation_info *ti, int id)
+{
+   int i, c;
+
+   for (i = 0; i < PIPE_MAX_SHADER_INPUTS; ++i)
+      for (c = 0; c < 4; ++c)
+         ti->input_access[i][c] = id;
+
+   ti->indirect_inputs = TRUE;
+}
+
+static void
+nvc0_indirect_outputs(struct nvc0_translation_info *ti, int id)
+{
+   int i, c;
+
+   for (i = 0; i < PIPE_MAX_SHADER_OUTPUTS; ++i)
+      for (c = 0; c < 4; ++c)
+         ti->output_access[i][c] = id;
+
+   ti->indirect_outputs = TRUE;
+}
+
+static INLINE unsigned
+nvc0_system_value_location(unsigned sn, unsigned si)
+{
+   /* NOTE: locations 0xfxx indicate special regs */
+   switch (sn) {
+      /*
+   case TGSI_SEMANTIC_VERTEXID:
+      return 0x2fc;
+      */
+   case TGSI_SEMANTIC_PRIMID:
+      return 0x60;
+      /*
+   case TGSI_SEMANTIC_LAYER_INDEX:
+      return 0x64;
+   case TGSI_SEMANTIC_VIEWPORT_INDEX:
+      return 0x68;
+      */
+   case TGSI_SEMANTIC_INSTANCEID:
+      return 0x2f8;
+   case TGSI_SEMANTIC_FACE:
+      return 0x3fc;
+      /*
+   case TGSI_SEMANTIC_INVOCATIONID:
+      return 0xf11;
+      */
+   default:
+      assert(0);
+      return 0x000;
+   }
+}
+
+static INLINE unsigned
+nvc0_varying_location(unsigned sn, unsigned si)
+{
+   switch (sn) {
+   case TGSI_SEMANTIC_POSITION:
+      return 0x70;
+   case TGSI_SEMANTIC_COLOR:
+      return 0x280 + (si * 16); /* are these hard-wired ? */
+   case TGSI_SEMANTIC_BCOLOR:
+      return 0x2a0 + (si * 16);
+   case TGSI_SEMANTIC_FOG:
+      return 0x270;
+   case TGSI_SEMANTIC_PSIZE:
+      return 0x6c;
+      /*
+   case TGSI_SEMANTIC_PNTC:
+      return 0x2e0;
+      */
+   case TGSI_SEMANTIC_GENERIC:
+      assert(si < 31);
+      return 0x80 + (si * 16);
+   case TGSI_SEMANTIC_NORMAL:
+      return 0x360;
+   case TGSI_SEMANTIC_PRIMID:
+      return 0x40;
+   case TGSI_SEMANTIC_FACE:
+      return 0x3fc;
+      /*
+   case TGSI_SEMANTIC_CLIP_DISTANCE:
+      return 0x2c0 + (si * 4);
+      */
+   default:
+      assert(0);
+      return 0x000;
+   }
+}
+
+static INLINE unsigned
+nvc0_interp_mode(const struct tgsi_full_declaration *decl)
+{
+   unsigned mode;
+
+   if (decl->Declaration.Interpolate == TGSI_INTERPOLATE_CONSTANT)
+      mode = NVC0_INTERP_FLAT;
+   else
+   if (decl->Declaration.Interpolate == TGSI_INTERPOLATE_PERSPECTIVE)
+      mode = NVC0_INTERP_PERSPECTIVE;
+   else
+      mode = NVC0_INTERP_LINEAR;
+
+   if (decl->Declaration.Centroid)
+      mode |= NVC0_INTERP_CENTROID;
+
+   return mode;
+}
+
+static void
+prog_immediate(struct nvc0_translation_info *ti,
+               const struct tgsi_full_immediate *imm)
+{
+   int c;
+   unsigned n = ti->immd32_nr++;
+
+   assert(ti->immd32_nr <= ti->scan.immediate_count);
+
+   for (c = 0; c < 4; ++c)
+      ti->immd32[n * 4 + c] = imm->u[c].Uint;
+
+   ti->immd32_ty[n] = imm->Immediate.DataType;
+}
+
+static boolean
+prog_decl(struct nvc0_translation_info *ti,
+          const struct tgsi_full_declaration *decl)
+{
+   unsigned i, c;
+   unsigned sn = TGSI_SEMANTIC_GENERIC;
+   unsigned si = 0;
+   const unsigned first = decl->Range.First;
+   const unsigned last = decl->Range.Last;
+
+   if (decl->Declaration.Semantic) {
+      sn = decl->Semantic.Name;
+      si = decl->Semantic.Index;
+   }
+   
+   switch (decl->Declaration.File) {
+   case TGSI_FILE_INPUT:
+      for (i = first; i <= last; ++i) {
+         if (ti->prog->type == PIPE_SHADER_VERTEX) {
+            sn = TGSI_SEMANTIC_GENERIC;
+            si = i;
+         }
+         for (c = 0; c < 4; ++c)
+            ti->input_loc[i][c] = nvc0_varying_location(sn, si) + c * 4;
+
+         if (ti->prog->type == PIPE_SHADER_FRAGMENT)
+            ti->interp_mode[i] = nvc0_interp_mode(decl);
+      }
+      break;
+   case TGSI_FILE_OUTPUT:
+      for (i = first; i <= last; ++i, ++si) {
+         if (ti->prog->type == PIPE_SHADER_FRAGMENT) {
+            si = i;
+            if (i == ti->fp_depth_output) {
+               ti->output_loc[i][2] = (ti->scan.num_outputs - 1) * 4;
+            } else {
+               if (i > ti->fp_depth_output)
+                  si -= 1;
+               for (c = 0; c < 4; ++c)
+                  ti->output_loc[i][c] = si * 4 + c;
+            }
+         } else {
+            for (c = 0; c < 4; ++c)
+               ti->output_loc[i][c] = nvc0_varying_location(sn, si) + c * 4;
+         }
+      }
+      break;
+   case TGSI_FILE_SYSTEM_VALUE:
+      ti->sysval_loc[i] = nvc0_system_value_location(sn, si);
+      assert(first == last);
+      break;
+   case TGSI_FILE_NULL:
+   case TGSI_FILE_CONSTANT:
+   case TGSI_FILE_TEMPORARY:
+   case TGSI_FILE_SAMPLER:
+   case TGSI_FILE_ADDRESS:
+   case TGSI_FILE_IMMEDIATE:
+   case TGSI_FILE_PREDICATE:
+      break;
+   default:
+      NOUVEAU_ERR("unhandled TGSI_FILE %d\n", decl->Declaration.File);
+      return FALSE;
+   }
+   return TRUE;
+}
+
+static void
+prog_inst(struct nvc0_translation_info *ti,
+          const struct tgsi_full_instruction *inst, int id)
+{
+   const struct tgsi_dst_register *dst;
+   const struct tgsi_src_register *src;
+   int s, c, k;
+   unsigned mask;
+
+   if (inst->Instruction.Opcode == TGSI_OPCODE_BGNSUB) {
+      ti->subr[ti->num_subrs].first_insn = id - 1;
+      ti->subr[ti->num_subrs].id = ti->num_subrs + 1; /* id 0 is main program */
+      ++ti->num_subrs;
+   }
+
+   if (inst->Dst[0].Register.File == TGSI_FILE_OUTPUT) {
+      dst = &inst->Dst[0].Register;
+
+      for (c = 0; c < 4; ++c) {
+         if (dst->Indirect)
+            nvc0_indirect_outputs(ti, id);
+         if (!(dst->WriteMask & (1 << c)))
+            continue;
+         ti->output_access[dst->Index][c] = id;
+      }
+
+      if (inst->Instruction.Opcode == TGSI_OPCODE_MOV &&
+          inst->Src[0].Register.File == TGSI_FILE_INPUT &&
+          dst->Index == ti->edgeflag_out)
+         ti->prog->vp.edgeflag = inst->Src[0].Register.Index;
+   } else
+   if (inst->Dst[0].Register.File == TGSI_FILE_TEMPORARY) {
+      if (inst->Dst[0].Register.Indirect)
+         ti->require_stores = TRUE;
+   }
+
+   for (s = 0; s < inst->Instruction.NumSrcRegs; ++s) {
+      src = &inst->Src[s].Register;
+      if (src->File == TGSI_FILE_TEMPORARY)
+         if (inst->Src[s].Register.Indirect)
+            ti->require_stores = TRUE;
+      if (src->File != TGSI_FILE_INPUT)
+         continue;
+      mask = nvc0_tgsi_src_mask(inst, s);
+
+      if (inst->Src[s].Register.Indirect)
+         nvc0_indirect_inputs(ti, id);
+
+      for (c = 0; c < 4; ++c) {
+         if (!(mask & (1 << c)))
+            continue;
+         k = tgsi_util_get_full_src_register_swizzle(&inst->Src[s], c);
+         if (k <= TGSI_SWIZZLE_W)
+            ti->input_access[src->Index][k] = id;
+      }
+   }
+}
+
+/* Probably should introduce something like struct tgsi_function_declaration
+ * instead of trying to guess inputs/outputs.
+ */
+static void
+prog_subroutine_inst(struct nvc0_subroutine *subr,
+                     const struct tgsi_full_instruction *inst)
+{
+   const struct tgsi_dst_register *dst;
+   const struct tgsi_src_register *src;
+   int s, c, k;
+   unsigned mask;
+
+   for (s = 0; s < inst->Instruction.NumSrcRegs; ++s) {
+      src = &inst->Src[s].Register;
+      if (src->File != TGSI_FILE_TEMPORARY)
+         continue;
+      mask = nvc0_tgsi_src_mask(inst, s);
+
+      for (c = 0; c < 4; ++c) {
+         k = tgsi_util_get_full_src_register_swizzle(&inst->Src[s], c);
+
+         if ((mask & (1 << c)) && k < TGSI_SWIZZLE_W)
+            if (!(subr->retv[src->Index / 32][k] & (1 << (src->Index % 32))))
+               subr->argv[src->Index / 32][k] |= 1 << (src->Index % 32);
+      }
+   }
+
+   if (inst->Dst[0].Register.File == TGSI_FILE_TEMPORARY) {
+      dst = &inst->Dst[0].Register;
+
+      for (c = 0; c < 4; ++c)
+         if (dst->WriteMask & (1 << c))
+            subr->retv[dst->Index / 32][c] |= 1 << (dst->Index % 32);
+   }
+}
+
+static int
+nvc0_vp_gp_gen_header(struct nvc0_program *vp, struct nvc0_translation_info *ti)
+{
+   int i, c;
+   unsigned a;
+
+   for (a = 0x80/4, i = 0; i <= ti->scan.file_max[TGSI_FILE_INPUT]; ++i) {
+      for (c = 0; c < 4; ++c, ++a)
+         if (ti->input_access[i][c])
+            vp->hdr[5 + a / 32] |= 1 << (a % 32); /* VP_ATTR_EN */
+   }
+
+   for (i = 0; i <= ti->scan.file_max[TGSI_FILE_OUTPUT]; ++i) {
+      a = (ti->output_loc[i][0] - 0x40) / 4;
+      for (c = 0; c < 4; ++c, ++a) {
+         if (!ti->output_access[i][c])
+            continue;
+         vp->hdr[13 + a / 32] |= 1 << (a % 32); /* VP_EXPORT_EN */
+      }
+   }
+
+   return 0;
+}
+
+static int
+nvc0_vp_gen_header(struct nvc0_program *vp, struct nvc0_translation_info *ti)
+{
+   vp->hdr[0] = 0x20461;
+   vp->hdr[4] = 0xff000;
+
+   vp->hdr[18] = (1 << vp->vp.num_ucps) - 1;
+
+   return nvc0_vp_gp_gen_header(vp, ti);
+}
+
+static int
+nvc0_gp_gen_header(struct nvc0_program *gp, struct nvc0_translation_info *ti)
+{
+   unsigned invocations = 1;
+   unsigned max_output_verts, output_prim;
+   unsigned i;
+
+   gp->hdr[0] = 0x21061;
+
+   for (i = 0; i < ti->scan.num_properties; ++i) {
+      switch (ti->scan.properties[i].name) {
+      case TGSI_PROPERTY_GS_OUTPUT_PRIM:
+         output_prim = ti->scan.properties[i].data[0];
+         break;
+      case TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES:
+         max_output_verts = ti->scan.properties[i].data[0];
+         assert(max_output_verts < 512);
+         break;
+         /*
+      case TGSI_PROPERTY_GS_INVOCATIONS:
+         invocations = ti->scan.properties[i].data[0];
+         assert(invocations <= 32);
+         break;
+         */
+      default:
+         break;
+      }
+   }
+
+   gp->hdr[2] = MIN2(invocations, 32) << 24;
+
+   switch (output_prim) {
+   case PIPE_PRIM_POINTS:
+      gp->hdr[3] = 0x01000000;
+      gp->hdr[0] |= 0xf0000000;
+      break;
+   case PIPE_PRIM_LINE_STRIP:
+      gp->hdr[3] = 0x06000000;
+      gp->hdr[0] |= 0x10000000;
+      break;
+   case PIPE_PRIM_TRIANGLE_STRIP:
+      gp->hdr[3] = 0x07000000;
+      gp->hdr[0] |= 0x10000000;
+      break;
+   default:
+      assert(0);
+      break;
+   }
+
+   gp->hdr[4] = max_output_verts & 0x1ff;
+
+   return nvc0_vp_gp_gen_header(gp, ti);
+}
+
+static int
+nvc0_fp_gen_header(struct nvc0_program *fp, struct nvc0_translation_info *ti)
+{
+   int i, c;
+   unsigned a, m;
+   
+   fp->hdr[0] = 0x21462;
+   fp->hdr[5] = 0x80000000; /* getting a trap if FRAG_COORD_UMASK.w = 0 */
+
+   if (ti->scan.uses_kill)
+      fp->hdr[0] |= 0x8000;
+   if (ti->scan.writes_z) {
+      fp->hdr[19] |= 0x2;
+      if (ti->scan.num_outputs > 2)
+         fp->hdr[0] |= 0x4000; /* FP_MULTIPLE_COLOR_OUTPUTS */
+   } else {
+   if (ti->scan.num_outputs > 1)
+      fp->hdr[0] |= 0x4000; /* FP_MULTIPLE_COLOR_OUTPUTS */
+   }
+
+   for (i = 0; i <= ti->scan.file_max[TGSI_FILE_INPUT]; ++i) {
+      m = ti->interp_mode[i];
+      for (c = 0; c < 4; ++c) {
+         if (!ti->input_access[i][c])
+            continue;
+         a = ti->input_loc[i][c] / 2;
+         if ((a & ~7) == 0x70/2)
+            fp->hdr[5] |= 1 << (28 + (a & 7) / 2); /* FRAG_COORD_UMASK */
+         else
+            fp->hdr[4 + a / 32] |= m << (a % 32);
+      }
+   }
+
+   for (i = 0; i <= ti->scan.file_max[TGSI_FILE_OUTPUT]; ++i) {
+      if (i != ti->fp_depth_output)
+         fp->hdr[18] |= 0xf << ti->output_loc[i][0];
+   }
+
+   return 0;
+}
+
+static boolean
+nvc0_prog_scan(struct nvc0_translation_info *ti)
+{
+   struct nvc0_program *prog = ti->prog;
+   struct tgsi_parse_context parse;
+   int ret;
+   unsigned i;
+
+#ifdef NOUVEAU_DEBUG
+   tgsi_dump(prog->pipe.tokens, 0);
+#endif
+
+   tgsi_scan_shader(prog->pipe.tokens, &ti->scan);
+
+   if (ti->prog->type == PIPE_SHADER_FRAGMENT) {
+      ti->fp_depth_output = 255;
+      for (i = 0; i < ti->scan.num_outputs; ++i)
+         if (ti->scan.output_semantic_name[i] == TGSI_SEMANTIC_POSITION)
+            ti->fp_depth_output = i;
+   }
+
+   ti->subr =
+      CALLOC(ti->scan.opcode_count[TGSI_OPCODE_BGNSUB], sizeof(ti->subr[0]));
+
+   ti->immd32 = (uint32_t *)MALLOC(ti->scan.immediate_count * 16);
+   ti->immd32_ty = (ubyte *)MALLOC(ti->scan.immediate_count * sizeof(ubyte));
+
+   ti->insns = MALLOC(ti->scan.num_instructions * sizeof(ti->insns[0]));
+
+   tgsi_parse_init(&parse, prog->pipe.tokens);
+   while (!tgsi_parse_end_of_tokens(&parse)) {
+      tgsi_parse_token(&parse);
+
+      switch (parse.FullToken.Token.Type) {
+      case TGSI_TOKEN_TYPE_IMMEDIATE:
+         prog_immediate(ti, &parse.FullToken.FullImmediate);
+         break;
+      case TGSI_TOKEN_TYPE_DECLARATION:
+         prog_decl(ti, &parse.FullToken.FullDeclaration);
+         break;
+      case TGSI_TOKEN_TYPE_INSTRUCTION:
+         ti->insns[ti->num_insns] = parse.FullToken.FullInstruction;
+         prog_inst(ti, &parse.FullToken.FullInstruction, ++ti->num_insns);
+         break;
+      default:
+         break;
+      }
+   }
+
+   for (i = 0; i < ti->num_subrs; ++i) {
+      unsigned pc = ti->subr[i].id;
+      while (ti->insns[pc].Instruction.Opcode != TGSI_OPCODE_ENDSUB)
+         prog_subroutine_inst(&ti->subr[i], &ti->insns[pc++]);
+   }
+
+   switch (prog->type) {
+   case PIPE_SHADER_VERTEX:
+      ti->input_file = NV_FILE_MEM_A;
+      ti->output_file = NV_FILE_MEM_V;
+      ret = nvc0_vp_gen_header(prog, ti);
+      break;
+      /*
+   case PIPE_SHADER_TESSELLATION_CONTROL:
+      ret = nvc0_tcp_gen_header(ti);
+      break;
+   case PIPE_SHADER_TESSELLATION_EVALUATION:
+      ret = nvc0_tep_gen_header(ti);
+      break;
+   case PIPE_SHADER_GEOMETRY:
+      ret = nvc0_gp_gen_header(ti);
+      break;
+      */
+   case PIPE_SHADER_FRAGMENT:
+      ti->input_file = NV_FILE_MEM_V;
+      ti->output_file = NV_FILE_GPR;
+
+      if (ti->scan.writes_z)
+         prog->flags[0] = 0x11; /* ? */
+      else
+      if (!ti->global_stores)
+         prog->fp.early_z = 1;
+
+      ret = nvc0_fp_gen_header(prog, ti);
+      break;
+   default:
+      assert(!"unsupported program type");
+      ret = -1;
+      break;
+   }
+
+   assert(!ret);
+   return ret;
+}
+
+boolean
+nvc0_program_translate(struct nvc0_program *prog)
+{
+   struct nvc0_translation_info *ti;
+   int ret;
+
+   ti = CALLOC_STRUCT(nvc0_translation_info);
+   ti->prog = prog;
+
+   ti->edgeflag_out = PIPE_MAX_SHADER_OUTPUTS;
+
+   if (prog->type == PIPE_SHADER_VERTEX && prog->vp.num_ucps)
+      ti->append_ucp = TRUE;
+
+   ret = nvc0_prog_scan(ti);
+   if (ret) {
+      NOUVEAU_ERR("unsupported shader program\n");
+      goto out;
+   }
+
+   ret = nvc0_generate_code(ti);
+   if (ret)
+      NOUVEAU_ERR("shader translation failed\n");
+
+   {
+      unsigned i;
+      for (i = 0; i < sizeof(prog->hdr) / sizeof(prog->hdr[0]); ++i)
+         debug_printf("HDR[%02lx] = 0x%08x\n",
+                      i * sizeof(prog->hdr[0]), prog->hdr[i]);
+   }
+
+out:
+   if (ti->immd32)
+      FREE(ti->immd32);
+   if (ti->immd32_ty)
+      FREE(ti->immd32_ty);
+   if (ti->insns)
+      FREE(ti->insns);
+   if (ti->subr)
+      FREE(ti->subr);
+   FREE(ti);
+   return ret ? FALSE : TRUE;
+}
+
+void
+nvc0_program_destroy(struct nvc0_context *nvc0, struct nvc0_program *prog)
+{
+   if (prog->res)
+      nouveau_resource_free(&prog->res);
+
+   if (prog->code)
+      FREE(prog->code);
+   if (prog->relocs)
+      FREE(prog->relocs);
+
+   memset(prog->hdr, 0, sizeof(prog->hdr));
+
+   prog->translated = FALSE;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_program.h b/src/gallium/drivers/nvc0/nvc0_program.h
new file mode 100644 (file)
index 0000000..2e84cae
--- /dev/null
@@ -0,0 +1,88 @@
+
+#ifndef __NVC0_PROGRAM_H__
+#define __NVC0_PROGRAM_H__
+
+#include "pipe/p_state.h"
+#include "tgsi/tgsi_scan.h"
+
+#define NVC0_CAP_MAX_PROGRAM_TEMPS 64
+
+#define NVC0_SHADER_HEADER_SIZE (20 * 4)
+
+struct nvc0_program {
+   struct pipe_shader_state pipe;
+
+   ubyte type;
+   boolean translated;
+   ubyte max_gpr;
+
+   uint32_t *code;
+   unsigned code_base;
+   unsigned code_size;
+   unsigned parm_size;
+
+   uint32_t hdr[20];
+
+   uint32_t flags[2];
+
+   struct {
+      uint8_t edgeflag;
+      uint8_t num_ucps;
+   } vp;
+   struct {
+      uint8_t early_z;
+   } fp;
+
+   void *relocs;
+   unsigned num_relocs;
+
+   struct nouveau_resource *res;
+};
+
+/* first 2 bits are written into the program header, for each input */
+#define NVC0_INTERP_FLAT          (1 << 0)
+#define NVC0_INTERP_PERSPECTIVE   (2 << 0)
+#define NVC0_INTERP_LINEAR        (3 << 0)
+#define NVC0_INTERP_CENTROID      (1 << 2)
+
+/* analyze TGSI and see which TEMP[] are used as subroutine inputs/outputs */
+struct nvc0_subroutine {
+   unsigned id;
+   unsigned first_insn;
+   uint32_t argv[NVC0_CAP_MAX_PROGRAM_TEMPS][4];
+   uint32_t retv[NVC0_CAP_MAX_PROGRAM_TEMPS][4];
+};
+
+struct nvc0_translation_info {
+   struct nvc0_program *prog;
+   struct tgsi_full_instruction *insns;
+   unsigned num_insns;
+   ubyte input_file;
+   ubyte output_file;
+   ubyte fp_depth_output;
+   uint16_t input_loc[PIPE_MAX_SHADER_INPUTS][4];
+   uint16_t output_loc[PIPE_MAX_SHADER_OUTPUTS][4];
+   uint16_t sysval_loc[TGSI_SEMANTIC_COUNT];
+   int input_access[PIPE_MAX_SHADER_INPUTS][4];
+   int output_access[PIPE_MAX_SHADER_OUTPUTS][4];
+   ubyte interp_mode[PIPE_MAX_SHADER_INPUTS];
+   boolean indirect_inputs;
+   boolean indirect_outputs;
+   boolean require_stores;
+   boolean global_stores;
+   uint32_t *immd32;
+   ubyte *immd32_ty;
+   unsigned immd32_nr;
+   ubyte edgeflag_out;
+   struct nvc0_subroutine *subr;
+   unsigned num_subrs;
+   boolean append_ucp;
+   struct tgsi_shader_info scan;
+};
+
+int nvc0_generate_code(struct nvc0_translation_info *);
+
+void nvc0_relocate_program(struct nvc0_program *,
+                           uint32_t code_base, uint32_t data_base);
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_push.c b/src/gallium/drivers/nvc0/nvc0_push.c
new file mode 100644 (file)
index 0000000..941be67
--- /dev/null
@@ -0,0 +1,279 @@
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "translate/translate.h"
+
+#include "nvc0_context.h"
+#include "nvc0_resource.h"
+
+#include "nvc0_3d.xml.h"
+
+struct push_context {
+   struct nouveau_channel *chan;
+
+   void *idxbuf;
+
+   float edgeflag;
+   int edgeflag_attr;
+
+   uint32_t vertex_words;
+   uint32_t packet_vertex_limit;
+
+   struct translate *translate;
+
+   boolean primitive_restart;
+   uint32_t prim;
+   uint32_t restart_index;
+};
+
+static INLINE unsigned
+prim_restart_search_i08(uint8_t *elts, unsigned push, uint8_t index)
+{
+   unsigned i;
+   for (i = 0; i < push; ++i)
+      if (elts[i] == index)
+         break;
+   return i;
+}
+
+static INLINE unsigned
+prim_restart_search_i16(uint16_t *elts, unsigned push, uint16_t index)
+{
+   unsigned i;
+   for (i = 0; i < push; ++i)
+      if (elts[i] == index)
+         break;
+   return i;
+}
+
+static INLINE unsigned
+prim_restart_search_i32(uint32_t *elts, unsigned push, uint32_t index)
+{
+   unsigned i;
+   for (i = 0; i < push; ++i)
+      if (elts[i] == index)
+         break;
+   return i;
+}
+
+static void
+emit_vertices_i08(struct push_context *ctx, unsigned start, unsigned count)
+{
+   uint8_t *elts = (uint8_t *)ctx->idxbuf + start;
+
+   while (count) {
+      unsigned push = MIN2(count, ctx->packet_vertex_limit);
+      unsigned size, nr;
+
+      nr = push;
+      if (ctx->primitive_restart)
+         nr = prim_restart_search_i08(elts, push, ctx->restart_index);
+
+      size = ctx->vertex_words * nr;
+
+      BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size);
+
+      ctx->translate->run_elts8(ctx->translate, elts, nr, 0, ctx->chan->cur);
+
+      ctx->chan->cur += size;
+      count -= nr;
+      elts += nr;
+
+      if (nr != push) {
+         count--;
+         elts++;
+         BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
+         OUT_RING  (ctx->chan, 0);
+         OUT_RING  (ctx->chan, ctx->prim);
+      }
+   }
+}
+
+static void
+emit_vertices_i16(struct push_context *ctx, unsigned start, unsigned count)
+{
+   uint16_t *elts = (uint16_t *)ctx->idxbuf + start;
+
+   while (count) {
+      unsigned push = MIN2(count, ctx->packet_vertex_limit);
+      unsigned size, nr;
+
+      nr = push;
+      if (ctx->primitive_restart)
+         nr = prim_restart_search_i16(elts, push, ctx->restart_index);
+
+      size = ctx->vertex_words * nr;
+
+      BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size);
+
+      ctx->translate->run_elts16(ctx->translate, elts, nr, 0, ctx->chan->cur);
+
+      ctx->chan->cur += size;
+      count -= nr;
+      elts += nr;
+
+      if (nr != push) {
+         count--;
+         elts++;
+         BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
+         OUT_RING  (ctx->chan, 0);
+         OUT_RING  (ctx->chan, ctx->prim);
+      }
+   }
+}
+
+static void
+emit_vertices_i32(struct push_context *ctx, unsigned start, unsigned count)
+{
+   uint32_t *elts = (uint32_t *)ctx->idxbuf + start;
+
+   while (count) {
+      unsigned push = MIN2(count, ctx->packet_vertex_limit);
+      unsigned size, nr;
+
+      nr = push;
+      if (ctx->primitive_restart)
+         nr = prim_restart_search_i32(elts, push, ctx->restart_index);
+
+      size = ctx->vertex_words * nr;
+
+      BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size);
+
+      ctx->translate->run_elts(ctx->translate, elts, nr, 0, ctx->chan->cur);
+
+      ctx->chan->cur += size;
+      count -= nr;
+      elts += nr;
+
+      if (nr != push) {
+         count--;
+         elts++;
+         BEGIN_RING(ctx->chan, RING_3D(VERTEX_END_GL), 2);
+         OUT_RING  (ctx->chan, 0);
+         OUT_RING  (ctx->chan, ctx->prim);
+      }
+   }
+}
+
+static void
+emit_vertices_seq(struct push_context *ctx, unsigned start, unsigned count)
+{
+   while (count) {
+      unsigned push = MIN2(count, ctx->packet_vertex_limit);
+      unsigned size = ctx->vertex_words * push;
+
+      BEGIN_RING_NI(ctx->chan, RING_3D(VERTEX_DATA), size);
+
+      ctx->translate->run(ctx->translate, start, push, 0, ctx->chan->cur);
+      ctx->chan->cur += size;
+      count -= push;
+      start += push;
+   }
+}
+
+
+#define NVC0_PRIM_GL_CASE(n) \
+   case PIPE_PRIM_##n: return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n
+
+static INLINE unsigned
+nvc0_prim_gl(unsigned prim)
+{
+   switch (prim) {
+   NVC0_PRIM_GL_CASE(POINTS);
+   NVC0_PRIM_GL_CASE(LINES);
+   NVC0_PRIM_GL_CASE(LINE_LOOP);
+   NVC0_PRIM_GL_CASE(LINE_STRIP);
+   NVC0_PRIM_GL_CASE(TRIANGLES);
+   NVC0_PRIM_GL_CASE(TRIANGLE_STRIP);
+   NVC0_PRIM_GL_CASE(TRIANGLE_FAN);
+   NVC0_PRIM_GL_CASE(QUADS);
+   NVC0_PRIM_GL_CASE(QUAD_STRIP);
+   NVC0_PRIM_GL_CASE(POLYGON);
+   NVC0_PRIM_GL_CASE(LINES_ADJACENCY);
+   NVC0_PRIM_GL_CASE(LINE_STRIP_ADJACENCY);
+   NVC0_PRIM_GL_CASE(TRIANGLES_ADJACENCY);
+   NVC0_PRIM_GL_CASE(TRIANGLE_STRIP_ADJACENCY);
+   /*
+   NVC0_PRIM_GL_CASE(PATCHES); */
+   default:
+      return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_POINTS;
+      break;
+   }
+}
+
+void
+nvc0_push_vbo(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
+{
+   struct push_context ctx;
+   unsigned i, index_size;
+   unsigned inst = info->instance_count;
+
+   ctx.chan = nvc0->screen->base.channel;
+   ctx.translate = nvc0->vertex->translate;
+   ctx.packet_vertex_limit = nvc0->vertex->vtx_per_packet_max;
+   ctx.vertex_words = nvc0->vertex->vtx_size;
+
+   for (i = 0; i < nvc0->num_vtxbufs; ++i) {
+      uint8_t *data;
+      struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[i];
+      struct nvc0_resource *res = nvc0_resource(vb->buffer);
+
+      data = nvc0_resource_map_offset(nvc0, res,
+                                      vb->buffer_offset, NOUVEAU_BO_RD);
+      if (info->indexed)
+         data += info->index_bias * vb->stride;
+
+      ctx.translate->set_buffer(ctx.translate, i, data, vb->stride, ~0);
+   }
+
+   if (info->indexed) {
+      ctx.idxbuf = nvc0_resource_map_offset(nvc0,
+                                            nvc0_resource(nvc0->idxbuf.buffer),
+                                            nvc0->idxbuf.offset, NOUVEAU_BO_RD);
+      if (!ctx.idxbuf)
+         return;
+      index_size = nvc0->idxbuf.index_size;
+      ctx.primitive_restart = info->primitive_restart;
+      ctx.restart_index = info->restart_index;
+   } else {
+      ctx.idxbuf = NULL;
+      index_size = 0;
+      ctx.primitive_restart = FALSE;
+      ctx.restart_index = 0;
+   }
+
+   ctx.prim = nvc0_prim_gl(info->mode);
+
+   while (inst--) {
+      BEGIN_RING(ctx.chan, RING_3D(VERTEX_BEGIN_GL), 1);
+      OUT_RING  (ctx.chan, ctx.prim);
+      switch (index_size) {
+      case 0:
+         emit_vertices_seq(&ctx, info->start, info->count);
+         break;
+      case 1:
+         emit_vertices_i08(&ctx, info->start, info->count);
+         break;
+      case 2:
+         emit_vertices_i16(&ctx, info->start, info->count);
+         break;
+      case 4:
+         emit_vertices_i32(&ctx, info->start, info->count);
+         break;
+      default:
+         assert(0);
+         break;
+      }
+      IMMED_RING(ctx.chan, RING_3D(VERTEX_END_GL), 0);
+
+      ctx.prim |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
+   }
+
+   if (info->indexed)
+      nvc0_resource_unmap(nvc0_resource(nvc0->idxbuf.buffer));
+
+   for (i = 0; i < nvc0->num_vtxbufs; ++i)
+      nvc0_resource_unmap(nvc0_resource(nvc0->vtxbuf[i].buffer));
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_push2.c b/src/gallium/drivers/nvc0/nvc0_push2.c
new file mode 100644 (file)
index 0000000..6f51600
--- /dev/null
@@ -0,0 +1,333 @@
+
+#if 0 /* not used, kept for now to compare with util/translate */
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "translate/translate.h"
+
+#include "nvc0_context.h"
+#include "nvc0_resource.h"
+
+#include "nvc0_3d.xml.h"
+
+struct push_context {
+   struct nvc0_context *nvc0;
+
+   uint vertex_size;
+
+   void *idxbuf;
+   uint idxsize;
+
+   float edgeflag;
+   int edgeflag_input;
+
+   struct {
+      void *map;
+      void (*push)(struct nouveau_channel *, void *);
+      uint32_t stride;
+      uint32_t divisor;
+      uint32_t step;
+   } attr[32];
+   int num_attrs;
+};
+
+static void
+emit_b32_1(struct nouveau_channel *chan, void *data)
+{
+   uint32_t *v = data;
+
+   OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b32_2(struct nouveau_channel *chan, void *data)
+{
+   uint32_t *v = data;
+
+   OUT_RING(chan, v[0]);
+   OUT_RING(chan, v[1]);
+}
+
+static void
+emit_b32_3(struct nouveau_channel *chan, void *data)
+{
+   uint32_t *v = data;
+
+   OUT_RING(chan, v[0]);
+   OUT_RING(chan, v[1]);
+   OUT_RING(chan, v[2]);
+}
+
+static void
+emit_b32_4(struct nouveau_channel *chan, void *data)
+{
+   uint32_t *v = data;
+
+   OUT_RING(chan, v[0]);
+   OUT_RING(chan, v[1]);
+   OUT_RING(chan, v[2]);
+   OUT_RING(chan, v[3]);
+}
+
+static void
+emit_b16_1(struct nouveau_channel *chan, void *data)
+{
+   uint16_t *v = data;
+
+   OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b16_3(struct nouveau_channel *chan, void *data)
+{
+   uint16_t *v = data;
+
+   OUT_RING(chan, (v[1] << 16) | v[0]);
+   OUT_RING(chan, v[2]);
+}
+
+static void
+emit_b08_1(struct nouveau_channel *chan, void *data)
+{
+   uint8_t *v = data;
+
+   OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b08_3(struct nouveau_channel *chan, void *data)
+{
+   uint8_t *v = data;
+
+   OUT_RING(chan, (v[2] << 16) | (v[1] << 8) | v[0]);
+}
+
+static void
+emit_b64_1(struct nouveau_channel *chan, void *data)
+{
+   double *v = data;
+
+   OUT_RINGf(chan, v[0]);
+}
+
+static void
+emit_b64_2(struct nouveau_channel *chan, void *data)
+{
+   double *v = data;
+
+   OUT_RINGf(chan, v[0]);
+   OUT_RINGf(chan, v[1]);
+}
+
+static void
+emit_b64_3(struct nouveau_channel *chan, void *data)
+{
+   double *v = data;
+
+   OUT_RINGf(chan, v[0]);
+   OUT_RINGf(chan, v[1]);
+   OUT_RINGf(chan, v[2]);
+}
+
+static void
+emit_b64_4(struct nouveau_channel *chan, void *data)
+{
+   double *v = data;
+
+   OUT_RINGf(chan, v[0]);
+   OUT_RINGf(chan, v[1]);
+   OUT_RINGf(chan, v[2]);
+   OUT_RINGf(chan, v[3]);   
+}
+
+static INLINE void
+emit_vertex(struct push_context *ctx, unsigned n)
+{
+   struct nouveau_channel *chan = ctx->nvc0->screen->base.channel;
+   int i;
+
+   if (ctx->edgeflag_input < 32) {
+      /* TODO */
+   }
+
+   BEGIN_RING_NI(chan, RING_3D(VERTEX_DATA), ctx->vertex_size);
+   for (i = 0; i < ctx->num_attrs; ++i)
+      ctx->attr[i].push(chan,
+                        (uint8_t *)ctx->attr[i].map + n * ctx->attr[i].stride);
+}
+
+static void
+emit_edgeflag(struct push_context *ctx, boolean enabled)
+{
+   struct nouveau_channel *chan = ctx->nvc0->screen->base.channel;
+   
+   IMMED_RING(chan, RING_3D(EDGEFLAG_ENABLE), enabled);
+}
+
+static void
+emit_elt08(struct push_context *ctx, unsigned start, unsigned count)
+{
+   uint8_t *idxbuf = ctx->idxbuf;
+
+   while (count--)
+      emit_vertex(ctx, idxbuf[start++]);
+}
+
+static void
+emit_elt16(struct push_context *ctx, unsigned start, unsigned count)
+{
+   uint16_t *idxbuf = ctx->idxbuf;
+
+   while (count--)
+      emit_vertex(ctx, idxbuf[start++]);
+}
+
+static void
+emit_elt32(struct push_context *ctx, unsigned start, unsigned count)
+{
+   uint32_t *idxbuf = ctx->idxbuf;
+
+   while (count--)
+      emit_vertex(ctx, idxbuf[start++]);
+}
+
+static void
+emit_seq(struct push_context *ctx, unsigned start, unsigned count)
+{
+   while (count--)
+      emit_vertex(ctx, start++);
+}
+
+#define NVC0_PRIM_GL_CASE(n) \
+   case PIPE_PRIM_##n: return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n
+
+static INLINE unsigned
+nvc0_prim_gl(unsigned prim)
+{
+   switch (prim) {
+   NVC0_PRIM_GL_CASE(POINTS);
+   NVC0_PRIM_GL_CASE(LINES);
+   NVC0_PRIM_GL_CASE(LINE_LOOP);
+   NVC0_PRIM_GL_CASE(LINE_STRIP);
+   NVC0_PRIM_GL_CASE(TRIANGLES);
+   NVC0_PRIM_GL_CASE(TRIANGLE_STRIP);
+   NVC0_PRIM_GL_CASE(TRIANGLE_FAN);
+   NVC0_PRIM_GL_CASE(QUADS);
+   NVC0_PRIM_GL_CASE(QUAD_STRIP);
+   NVC0_PRIM_GL_CASE(POLYGON);
+   NVC0_PRIM_GL_CASE(LINES_ADJACENCY);
+   NVC0_PRIM_GL_CASE(LINE_STRIP_ADJACENCY);
+   NVC0_PRIM_GL_CASE(TRIANGLES_ADJACENCY);
+   NVC0_PRIM_GL_CASE(TRIANGLE_STRIP_ADJACENCY);
+   /*
+   NVC0_PRIM_GL_CASE(PATCHES); */
+   default:
+      return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_POINTS;
+      break;
+   }
+}
+
+void
+nvc0_push_vbo2(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
+{
+   struct push_context ctx;
+   unsigned i, n;
+   unsigned inst = info->instance_count;
+   unsigned prim = nvc0_prim_gl(info->mode);
+
+   ctx.nvc0 = nvc0;
+   ctx.vertex_size = nvc0->vertex->vtx_size;
+   ctx.idxbuf = NULL;
+   ctx.num_attrs = 0;
+   ctx.edgeflag = 0.5f;
+   ctx.edgeflag_input = 32;
+
+   for (i = 0; i < nvc0->vertex->num_elements; ++i) {
+      struct pipe_vertex_element *ve = &nvc0->vertex->element[i].pipe;
+      struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[ve->vertex_buffer_index];
+      struct nouveau_bo *bo = nvc0_resource(vb->buffer)->bo;
+      unsigned nr_components;
+
+      if (!(nvc0->vbo_fifo & (1 << i)))
+         continue;
+      n = ctx.num_attrs++;
+
+      if (nouveau_bo_map(bo, NOUVEAU_BO_RD))
+         return;
+      ctx.attr[n].map = (uint8_t *)bo->map + vb->buffer_offset + ve->src_offset;
+
+      nouveau_bo_unmap(bo);
+
+      ctx.attr[n].stride = vb->stride;
+      ctx.attr[n].divisor = ve->instance_divisor;
+
+      nr_components = util_format_get_nr_components(ve->src_format);
+      switch (util_format_get_component_bits(ve->src_format,
+                                             UTIL_FORMAT_COLORSPACE_RGB, 0)) {
+      case 8:
+         switch (nr_components) {
+         case 1: ctx.attr[n].push = emit_b08_1; break;
+         case 2: ctx.attr[n].push = emit_b16_1; break;
+         case 3: ctx.attr[n].push = emit_b08_3; break;
+         case 4: ctx.attr[n].push = emit_b32_1; break;
+         }
+         break;
+      case 16:
+         switch (nr_components) {
+         case 1: ctx.attr[n].push = emit_b16_1; break;
+         case 2: ctx.attr[n].push = emit_b32_1; break;
+         case 3: ctx.attr[n].push = emit_b16_3; break;
+         case 4: ctx.attr[n].push = emit_b32_2; break;
+         }
+         break;
+      case 32:
+         switch (nr_components) {
+         case 1: ctx.attr[n].push = emit_b32_1; break;
+         case 2: ctx.attr[n].push = emit_b32_2; break;
+         case 3: ctx.attr[n].push = emit_b32_3; break;
+         case 4: ctx.attr[n].push = emit_b32_4; break;
+         }
+         break;
+      default:
+         assert(0);
+         break;
+      }
+   }
+
+   if (info->indexed) {
+      struct nvc0_resource *res = nvc0_resource(nvc0->idxbuf.buffer);
+      if (!res || nouveau_bo_map(res->bo, NOUVEAU_BO_RD))
+         return;
+      ctx.idxbuf = (uint8_t *)res->bo->map + nvc0->idxbuf.offset + res->offset;
+      nouveau_bo_unmap(res->bo);
+      ctx.idxsize = nvc0->idxbuf.index_size;
+   } else {
+      ctx.idxsize = 0;
+   }
+
+   while (inst--) {
+      BEGIN_RING(nvc0->screen->base.channel, RING_3D(VERTEX_BEGIN_GL), 1);
+      OUT_RING  (nvc0->screen->base.channel, prim);
+      switch (ctx.idxsize) {
+      case 0:
+         emit_seq(&ctx, info->start, info->count);
+         break;
+      case 1:
+         emit_elt08(&ctx, info->start, info->count);
+         break;
+      case 2:
+         emit_elt16(&ctx, info->start, info->count);
+         break;
+      case 4:
+         emit_elt32(&ctx, info->start, info->count);
+         break;
+      }
+      IMMED_RING(nvc0->screen->base.channel, RING_3D(VERTEX_END_GL), 0);
+
+      prim |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
+   }
+}
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_query.c b/src/gallium/drivers/nvc0/nvc0_query.c
new file mode 100644 (file)
index 0000000..cc83fbe
--- /dev/null
@@ -0,0 +1,337 @@
+/*
+ * Copyright 2011 Nouveau Project
+ *
+ * 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.
+ *
+ * Authors: Christoph Bumiller
+ */
+
+#include "nvc0_context.h"
+#include "nouveau/nv_object.xml.h"
+
+/* XXX: Nested queries, and simultaneous queries on multiple gallium contexts
+ * (since we use only a single GPU channel per screen) will not work properly.
+ *
+ * The first is not that big of an issue because OpenGL does not allow nested
+ * queries anyway.
+ */
+
+struct nvc0_query {
+   uint32_t *data;
+   uint32_t type;
+   uint32_t sequence;
+   struct nouveau_bo *bo;
+   uint32_t base;
+   uint32_t offset; /* base + i * 16 */
+   boolean ready;
+   boolean is64bit;
+   struct nvc0_mm_allocation *mm;
+};
+
+#define NVC0_QUERY_ALLOC_SPACE 128
+
+static INLINE struct nvc0_query *
+nvc0_query(struct pipe_query *pipe)
+{
+   return (struct nvc0_query *)pipe;
+}
+
+static boolean
+nvc0_query_allocate(struct nvc0_context *nvc0, struct nvc0_query *q, int size)
+{
+   struct nvc0_screen *screen = nvc0->screen;
+   int ret;
+
+   if (q->bo) {
+      nouveau_bo_ref(NULL, &q->bo);
+      if (q->mm) {
+         if (q->ready)
+            nvc0_mm_free(q->mm);
+         else
+            nvc0_fence_sched_release(screen->fence.current, q->mm);
+      }
+   }
+   if (size) {
+      q->mm = nvc0_mm_allocate(screen->mm_GART, size, &q->bo, &q->base);
+      if (!q->bo)
+         return FALSE;
+      q->offset = q->base;
+
+      ret = nouveau_bo_map_range(q->bo, q->base, size, NOUVEAU_BO_RD |
+                                 NOUVEAU_BO_NOSYNC);
+      if (ret) {
+         nvc0_query_allocate(nvc0, q, 0);
+         return FALSE;
+      }
+      q->data = q->bo->map;
+      nouveau_bo_unmap(q->bo);
+   }
+   return TRUE;
+}
+
+static void
+nvc0_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
+{
+   nvc0_query_allocate(nvc0_context(pipe), nvc0_query(pq), 0);
+   FREE(nvc0_query(pq));
+}
+
+static struct pipe_query *
+nvc0_query_create(struct pipe_context *pipe, unsigned type)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nvc0_query *q;
+
+   q = CALLOC_STRUCT(nvc0_query);
+   if (!q)
+      return NULL;
+
+   if (!nvc0_query_allocate(nvc0, q, NVC0_QUERY_ALLOC_SPACE)) {
+      FREE(q);
+      return NULL;
+   }
+
+   q->is64bit = (type == PIPE_QUERY_PRIMITIVES_GENERATED ||
+                 type == PIPE_QUERY_PRIMITIVES_EMITTED ||
+                 type == PIPE_QUERY_SO_STATISTICS);
+   q->type = type;
+
+   if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
+      q->offset -= 16;
+      q->data -= 16 / sizeof(*q->data); /* we advance before query_begin ! */
+   }
+
+   return (struct pipe_query *)q;
+}
+
+static void
+nvc0_query_get(struct nouveau_channel *chan, struct nvc0_query *q,
+               unsigned offset, uint32_t get)
+{
+   offset += q->offset;
+
+   MARK_RING (chan, 5, 2);
+   BEGIN_RING(chan, RING_3D(QUERY_ADDRESS_HIGH), 4);
+   OUT_RELOCh(chan, q->bo, offset, NOUVEAU_BO_GART | NOUVEAU_BO_WR);
+   OUT_RELOCl(chan, q->bo, offset, NOUVEAU_BO_GART | NOUVEAU_BO_WR);
+   OUT_RING  (chan, q->sequence);
+   OUT_RING  (chan, get);
+}
+
+static void
+nvc0_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_query *q = nvc0_query(pq);
+
+   /* For occlusion queries we have to change the storage, because a previous
+    * query might set the initial render conition to FALSE even *after* we re-
+    * initialized it to TRUE.
+    */
+   if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
+      q->offset += 16;
+      q->data += 16 / sizeof(*q->data);
+      if (q->offset - q->base == NVC0_QUERY_ALLOC_SPACE)
+         nvc0_query_allocate(nvc0, q, NVC0_QUERY_ALLOC_SPACE);
+
+      /* XXX: can we do this with the GPU, and sync with respect to a previous
+       *  query ?
+       */
+      q->data[1] = 1; /* initial render condition = TRUE */
+   }
+   if (!q->is64bit)
+      q->data[0] = q->sequence++; /* the previously used one */
+
+   switch (q->type) {
+   case PIPE_QUERY_OCCLUSION_COUNTER:
+      IMMED_RING(chan, RING_3D(COUNTER_RESET), NVC0_3D_COUNTER_RESET_SAMPLECNT);
+      IMMED_RING(chan, RING_3D(SAMPLECNT_ENABLE), 1);
+      break;
+   case PIPE_QUERY_PRIMITIVES_GENERATED: /* store before & after instead ? */
+      IMMED_RING(chan, RING_3D(COUNTER_RESET),
+                 NVC0_3D_COUNTER_RESET_GENERATED_PRIMITIVES);
+      break;
+   case PIPE_QUERY_PRIMITIVES_EMITTED:
+      IMMED_RING(chan, RING_3D(COUNTER_RESET),
+                 NVC0_3D_COUNTER_RESET_EMITTED_PRIMITIVES);
+      break;
+   case PIPE_QUERY_SO_STATISTICS:
+      BEGIN_RING_NI(chan, RING_3D(COUNTER_RESET), 2);
+      OUT_RING  (chan, NVC0_3D_COUNTER_RESET_EMITTED_PRIMITIVES);
+      OUT_RING  (chan, NVC0_3D_COUNTER_RESET_GENERATED_PRIMITIVES);
+      break;
+   case PIPE_QUERY_TIMESTAMP_DISJOINT:
+   case PIPE_QUERY_TIME_ELAPSED:
+      nvc0_query_get(chan, q, 0x10, 0x00005002);
+      break;
+   default:
+      break;
+   }
+   q->ready = FALSE;
+}
+
+static void
+nvc0_query_end(struct pipe_context *pipe, struct pipe_query *pq)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_query *q = nvc0_query(pq);
+
+   const int index = 0; /* for multiple vertex streams */
+
+   switch (q->type) {
+   case PIPE_QUERY_OCCLUSION_COUNTER:
+      nvc0_query_get(chan, q, 0, 0x0100f002);
+      BEGIN_RING(chan, RING_3D(SAMPLECNT_ENABLE), 1);
+      OUT_RING  (chan, 0);
+      break;
+   case PIPE_QUERY_PRIMITIVES_GENERATED:
+      nvc0_query_get(chan, q, 0, 0x09005002 | (index << 5));
+      break;
+   case PIPE_QUERY_PRIMITIVES_EMITTED:
+      nvc0_query_get(chan, q, 0, 0x05805002 | (index << 5));
+      break;
+   case PIPE_QUERY_SO_STATISTICS:
+      nvc0_query_get(chan, q, 0x00, 0x05805002 | (index << 5));
+      nvc0_query_get(chan, q, 0x10, 0x09005002 | (index << 5));
+      break;
+   case PIPE_QUERY_TIMESTAMP_DISJOINT:
+   case PIPE_QUERY_TIME_ELAPSED:
+      nvc0_query_get(chan, q, 0, 0x00005002);
+      break;
+   case PIPE_QUERY_GPU_FINISHED:
+      nvc0_query_get(chan, q, 0, 0x1000f010);
+      break;
+   default:
+      assert(0);
+      break;
+   }
+}
+
+static INLINE boolean
+nvc0_query_ready(struct nvc0_query *q)
+{
+   return q->ready || (!q->is64bit && (q->data[0] == q->sequence));
+}
+
+static INLINE boolean
+nvc0_query_wait(struct nvc0_query *q)
+{
+   int ret = nouveau_bo_map(q->bo, NOUVEAU_BO_RD);
+   if (ret)
+      return FALSE;
+   nouveau_bo_unmap(q->bo);
+   return TRUE;
+}
+
+static boolean
+nvc0_query_result(struct pipe_context *pipe, struct pipe_query *pq,
+                  boolean wait, void *result)
+{
+   struct nvc0_query *q = nvc0_query(pq);
+   uint64_t *res64 = result;
+   uint32_t *res32 = result;
+   boolean *res8 = result;
+   uint64_t *data64 = (uint64_t *)q->data;
+
+   if (q->type == PIPE_QUERY_GPU_FINISHED) {
+      res8[0] = nvc0_query_ready(q);
+      return TRUE;
+   }
+
+   if (!q->ready) /* update ? */
+      q->ready = nvc0_query_ready(q);
+   if (!q->ready) {
+      struct nouveau_channel *chan = nvc0_context(pipe)->screen->base.channel;
+      if (!wait) {
+         if (nouveau_bo_pending(q->bo) & NOUVEAU_BO_WR) /* for daft apps */
+            FIRE_RING(chan);
+         return FALSE;
+      }
+      if (!nvc0_query_wait(q))
+         return FALSE;
+   }
+   q->ready = TRUE;
+
+   switch (q->type) {
+   case PIPE_QUERY_OCCLUSION_COUNTER: /* u32 sequence, u32 count, u64 time */
+      res32[0] = q->data[1];
+      break;
+   case PIPE_QUERY_PRIMITIVES_GENERATED: /* u64 count, u64 time */
+   case PIPE_QUERY_PRIMITIVES_EMITTED: /* u64 count, u64 time */
+      res64[0] = data64[0];
+      break;
+   case PIPE_QUERY_SO_STATISTICS:
+      res64[0] = data64[0];
+      res64[1] = data64[1];
+      break;
+   case PIPE_QUERY_TIMESTAMP_DISJOINT: /* u32 sequence, u32 0, u64 time */
+      res64[0] = 1000000000;
+      res8[8] = (data64[0] == data64[2]) ? FALSE : TRUE;
+      break;
+   case PIPE_QUERY_TIME_ELAPSED:
+      res64[0] = data64[1] - data64[3];
+      break;
+   default:
+      return FALSE;
+   }
+
+   return TRUE;
+}
+
+static void
+nvc0_render_condition(struct pipe_context *pipe,
+                      struct pipe_query *pq, uint mode)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_query *q;
+
+   if (!pq) {
+      IMMED_RING(chan, RING_3D(COND_MODE), NVC0_3D_COND_MODE_ALWAYS);
+      return;
+   }
+   q = nvc0_query(pq);
+
+   if (mode == PIPE_RENDER_COND_WAIT ||
+       mode == PIPE_RENDER_COND_BY_REGION_WAIT) {
+      BEGIN_RING(chan, RING_3D_(NV84_SUBCHAN_QUERY_ADDRESS_HIGH), 4);
+      OUT_RELOCh(chan, q->bo, q->offset, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+      OUT_RELOCl(chan, q->bo, q->offset, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+      OUT_RING  (chan, q->sequence);
+      OUT_RING  (chan, 0x00001001);
+   }
+
+   BEGIN_RING(chan, RING_3D(COND_ADDRESS_HIGH), 3);
+   OUT_RELOCh(chan, q->bo, q->offset, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+   OUT_RELOCl(chan, q->bo, q->offset, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+   OUT_RING  (chan, NVC0_3D_COND_MODE_RES_NON_ZERO);
+}
+
+void
+nvc0_init_query_functions(struct nvc0_context *nvc0)
+{
+   nvc0->pipe.create_query = nvc0_query_create;
+   nvc0->pipe.destroy_query = nvc0_query_destroy;
+   nvc0->pipe.begin_query = nvc0_query_begin;
+   nvc0->pipe.end_query = nvc0_query_end;
+   nvc0->pipe.get_query_result = nvc0_query_result;
+   nvc0->pipe.render_condition = nvc0_render_condition;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_resource.c b/src/gallium/drivers/nvc0/nvc0_resource.c
new file mode 100644 (file)
index 0000000..7e42ced
--- /dev/null
@@ -0,0 +1,71 @@
+
+#include "pipe/p_context.h"
+#include "nvc0_resource.h"
+#include "nouveau/nouveau_screen.h"
+
+static unsigned
+nvc0_resource_is_referenced(struct pipe_context *pipe,
+                            struct pipe_resource *resource,
+                            unsigned face, int layer)
+{
+   struct nvc0_resource *res = nvc0_resource(resource);
+   unsigned flags = 0;
+
+#ifdef NOUVEAU_USERSPACE_MM
+   flags = res->status;
+#else
+   unsigned bo_flags = nouveau_bo_pending(res->bo);
+   if (bo_flags & NOUVEAU_BO_RD)
+      flags = PIPE_REFERENCED_FOR_READ;
+   if (bo_flags & NOUVEAU_BO_WR)
+      flags |= PIPE_REFERENCED_FOR_WRITE;
+#endif
+   return flags;
+}
+
+static struct pipe_resource *
+nvc0_resource_create(struct pipe_screen *screen,
+                     const struct pipe_resource *templ)
+{
+   switch (templ->target) {
+   case PIPE_BUFFER:
+      return nvc0_buffer_create(screen, templ);
+   default:
+      return nvc0_miptree_create(screen, templ);
+   }
+}
+
+static struct pipe_resource *
+nvc0_resource_from_handle(struct pipe_screen * screen,
+                          const struct pipe_resource *templ,
+                          struct winsys_handle *whandle)
+{
+   if (templ->target == PIPE_BUFFER)
+      return NULL;
+   else
+      return nvc0_miptree_from_handle(screen, templ, whandle);
+}
+
+void
+nvc0_init_resource_functions(struct pipe_context *pcontext)
+{
+   pcontext->get_transfer = u_get_transfer_vtbl;
+   pcontext->transfer_map = u_transfer_map_vtbl;
+   pcontext->transfer_flush_region = u_transfer_flush_region_vtbl;
+   pcontext->transfer_unmap = u_transfer_unmap_vtbl;
+   pcontext->transfer_destroy = u_transfer_destroy_vtbl;
+   pcontext->transfer_inline_write = u_transfer_inline_write_vtbl;
+   pcontext->is_resource_referenced = nvc0_resource_is_referenced;
+   pcontext->create_surface = nvc0_miptree_surface_new;
+   pcontext->surface_destroy = nvc0_miptree_surface_del;
+}
+
+void
+nvc0_screen_init_resource_functions(struct pipe_screen *pscreen)
+{
+   pscreen->resource_create = nvc0_resource_create;
+   pscreen->resource_from_handle = nvc0_resource_from_handle;
+   pscreen->resource_get_handle = u_resource_get_handle_vtbl;
+   pscreen->resource_destroy = u_resource_destroy_vtbl;
+   pscreen->user_buffer_create = nvc0_user_buffer_create;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_resource.h b/src/gallium/drivers/nvc0/nvc0_resource.h
new file mode 100644 (file)
index 0000000..17e7964
--- /dev/null
@@ -0,0 +1,201 @@
+
+#ifndef __NVC0_RESOURCE_H__
+#define __NVC0_RESOURCE_H__
+
+#include "util/u_transfer.h"
+#include "util/u_double_list.h"
+#define NOUVEAU_NVC0
+#include "nouveau/nouveau_winsys.h"
+#undef NOUVEAU_NVC0
+
+#include "nvc0_fence.h"
+
+struct pipe_resource;
+struct nouveau_bo;
+struct nvc0_context;
+
+#define NVC0_BUFFER_SCORE_MIN -25000
+#define NVC0_BUFFER_SCORE_MAX  25000
+#define NVC0_BUFFER_SCORE_VRAM_THRESHOLD 20000
+
+/* DIRTY: buffer was (or will be after the next flush) written to by GPU and
+ *  resource->data has not been updated to reflect modified VRAM contents
+ *
+ * USER_MEMORY: resource->data is a pointer to client memory and may change
+ *  between GL calls
+ */
+#define NVC0_BUFFER_STATUS_DIRTY       (1 << 0)
+#define NVC0_BUFFER_STATUS_USER_MEMORY (1 << 7)
+
+/* Resources, if mapped into the GPU's address space, are guaranteed to
+ * have constant virtual addresses.
+ * The address of a resource will lie within the nouveau_bo referenced,
+ * and this bo should be added to the memory manager's validation list.
+ */
+struct nvc0_resource {
+   struct pipe_resource base;
+   const struct u_resource_vtbl *vtbl;
+
+   uint8_t *data;
+   struct nouveau_bo *bo;
+   uint32_t offset;
+
+   uint8_t status;
+   uint8_t domain;
+
+   int16_t score; /* low if mapped very often, if high can move to VRAM */
+
+   struct nvc0_fence *fence;
+   struct nvc0_fence *fence_wr;
+
+   struct nvc0_mm_allocation *mm;
+};
+
+boolean
+nvc0_buffer_download(struct nvc0_context *, struct nvc0_resource *,
+                     unsigned start, unsigned size);
+
+boolean
+nvc0_buffer_migrate(struct nvc0_context *,
+                    struct nvc0_resource *, unsigned domain);
+
+static INLINE void
+nvc0_buffer_adjust_score(struct nvc0_context *nvc0, struct nvc0_resource *res,
+                         int16_t score)
+{
+   if (score < 0) {
+      if (res->score > NVC0_BUFFER_SCORE_MIN)
+         res->score += score;
+   } else
+   if (score > 0){
+      if (res->score < NVC0_BUFFER_SCORE_MAX)
+         res->score += score;
+      if (res->domain == NOUVEAU_BO_GART &&
+          res->score > NVC0_BUFFER_SCORE_VRAM_THRESHOLD)
+         nvc0_buffer_migrate(nvc0, res, NOUVEAU_BO_VRAM);
+   }
+}
+
+/* XXX: wait for fence (atm only using this for vertex push) */
+static INLINE void *
+nvc0_resource_map_offset(struct nvc0_context *nvc0,
+                         struct nvc0_resource *res, uint32_t offset,
+                         uint32_t flags)
+{
+   void *map;
+
+   nvc0_buffer_adjust_score(nvc0, res, -250);
+
+   if ((res->domain == NOUVEAU_BO_VRAM) &&
+       (res->status & NVC0_BUFFER_STATUS_DIRTY))
+      nvc0_buffer_download(nvc0, res, 0, res->base.width0);
+
+   if ((res->domain != NOUVEAU_BO_GART) ||
+       (res->status & NVC0_BUFFER_STATUS_USER_MEMORY))
+      return res->data + offset;
+
+   if (res->mm)
+      flags |= NOUVEAU_BO_NOSYNC;
+
+   if (nouveau_bo_map_range(res->bo, res->offset + offset,
+                            res->base.width0, flags))
+      return NULL;
+
+   map = res->bo->map;
+   nouveau_bo_unmap(res->bo);
+   return map;
+}
+
+static INLINE void
+nvc0_resource_unmap(struct nvc0_resource *res)
+{
+   /* no-op */
+}
+
+#define NVC0_TILE_DIM_SHIFT(m, d) (((m) >> (d * 4)) & 0xf)
+
+#define NVC0_TILE_PITCH(m)  (64 << NVC0_TILE_DIM_SHIFT(m, 0))
+#define NVC0_TILE_HEIGHT(m) ( 8 << NVC0_TILE_DIM_SHIFT(m, 1))
+#define NVC0_TILE_DEPTH(m)  ( 1 << NVC0_TILE_DIM_SHIFT(m, 2))
+
+#define NVC0_TILE_SIZE_2D(m) (((64 * 8) <<                     \
+                               NVC0_TILE_DIM_SHIFT(m, 0)) <<   \
+                              NVC0_TILE_DIM_SHIFT(m, 1))
+
+#define NVC0_TILE_SIZE(m) (NVC0_TILE_SIZE_2D(m) << NVC0_TILE_DIM_SHIFT(m, 2))
+
+struct nvc0_miptree_level {
+   uint32_t offset;
+   uint32_t pitch;
+   uint32_t tile_mode;
+};
+
+#define NVC0_MAX_TEXTURE_LEVELS 16
+
+struct nvc0_miptree {
+   struct nvc0_resource base;
+   struct nvc0_miptree_level level[NVC0_MAX_TEXTURE_LEVELS];
+   uint32_t total_size;
+   uint32_t layer_stride;
+   boolean layout_3d; /* TRUE if layer count varies with mip level */
+};
+
+static INLINE struct nvc0_miptree *
+nvc0_miptree(struct pipe_resource *pt)
+{
+   return (struct nvc0_miptree *)pt;
+}
+
+static INLINE struct nvc0_resource *
+nvc0_resource(struct pipe_resource *resource)
+{
+   return (struct nvc0_resource *)resource;
+}
+
+/* is resource mapped into the GPU's address space (i.e. VRAM or GART) ? */
+static INLINE boolean
+nvc0_resource_mapped_by_gpu(struct pipe_resource *resource)
+{
+   return nvc0_resource(resource)->domain != 0;
+}
+
+void
+nvc0_init_resource_functions(struct pipe_context *pcontext);
+
+void
+nvc0_screen_init_resource_functions(struct pipe_screen *pscreen);
+
+/* Internal functions:
+ */
+struct pipe_resource *
+nvc0_miptree_create(struct pipe_screen *pscreen,
+                    const struct pipe_resource *tmp);
+
+struct pipe_resource *
+nvc0_miptree_from_handle(struct pipe_screen *pscreen,
+                         const struct pipe_resource *template,
+                         struct winsys_handle *whandle);
+
+struct pipe_resource *
+nvc0_buffer_create(struct pipe_screen *pscreen,
+                   const struct pipe_resource *templ);
+
+struct pipe_resource *
+nvc0_user_buffer_create(struct pipe_screen *screen,
+                        void *ptr,
+                        unsigned bytes,
+                        unsigned usage);
+
+
+struct pipe_surface *
+nvc0_miptree_surface_new(struct pipe_context *,
+                         struct pipe_resource *,
+                         const struct pipe_surface *templ);
+
+void
+nvc0_miptree_surface_del(struct pipe_context *, struct pipe_surface *);
+
+boolean
+nvc0_user_buffer_upload(struct nvc0_resource *, unsigned base, unsigned size);
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c
new file mode 100644 (file)
index 0000000..54eec66
--- /dev/null
@@ -0,0 +1,669 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "util/u_format_s3tc.h"
+#include "pipe/p_screen.h"
+
+#include "nvc0_fence.h"
+#include "nvc0_context.h"
+#include "nvc0_screen.h"
+
+#include "nouveau/nv_object.xml.h"
+#include "nvc0_graph_macros.h"
+
+static boolean
+nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
+                                enum pipe_format format,
+                                enum pipe_texture_target target,
+                                unsigned sample_count,
+                                unsigned bindings, unsigned geom_flags)
+{
+   if (sample_count > 1)
+      return FALSE;
+
+   if (!util_format_s3tc_enabled) {
+      switch (format) {
+      case PIPE_FORMAT_DXT1_RGB:
+      case PIPE_FORMAT_DXT1_RGBA:
+      case PIPE_FORMAT_DXT3_RGBA:
+      case PIPE_FORMAT_DXT5_RGBA:
+         return FALSE;
+      default:
+         break;
+      }
+   }
+
+   /* transfers & shared are always supported */
+   bindings &= ~(PIPE_BIND_TRANSFER_READ |
+                 PIPE_BIND_TRANSFER_WRITE |
+                 PIPE_BIND_SHARED);
+
+   return (nvc0_format_table[format].usage & bindings) == bindings;
+}
+
+static int
+nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
+{
+   switch (param) {
+   case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
+   case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
+      return 32;
+   case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+      return 64;
+   case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
+      return 13;
+   case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
+      return 10;
+   case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
+      return 13;
+   case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
+   case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
+   case PIPE_CAP_TEXTURE_SWIZZLE:
+   case PIPE_CAP_TEXTURE_SHADOW_MAP:
+   case PIPE_CAP_NPOT_TEXTURES:
+   case PIPE_CAP_ANISOTROPIC_FILTER:
+      return 1;
+   case PIPE_CAP_TWO_SIDED_STENCIL:
+   case PIPE_CAP_DEPTH_CLAMP:
+   case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
+   case PIPE_CAP_POINT_SPRITE:
+      return 1;
+   case PIPE_CAP_GLSL:
+   case PIPE_CAP_SM3:
+      return 1;
+   case PIPE_CAP_MAX_RENDER_TARGETS:
+      return 8;
+   case PIPE_CAP_TIMER_QUERY:
+   case PIPE_CAP_OCCLUSION_QUERY:
+      return 1;
+   case PIPE_CAP_STREAM_OUTPUT:
+      return 0;
+   case PIPE_CAP_BLEND_EQUATION_SEPARATE:
+   case PIPE_CAP_INDEP_BLEND_ENABLE:
+   case PIPE_CAP_INDEP_BLEND_FUNC:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+      return 1;
+   case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+   case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+      return 0;
+   case PIPE_CAP_SHADER_STENCIL_EXPORT:
+      return 0;
+   case PIPE_CAP_PRIMITIVE_RESTART:
+      return 1;
+   default:
+      NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
+      return 0;
+   }
+}
+
+static int
+nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
+                             enum pipe_shader_cap param)
+{
+   switch (shader) {
+   case PIPE_SHADER_VERTEX:
+      /*
+   case PIPE_SHADER_TESSELLATION_CONTROL:
+   case PIPE_SHADER_TESSELLATION_EVALUATION:
+      */
+   case PIPE_SHADER_GEOMETRY:
+   case PIPE_SHADER_FRAGMENT:
+      break;
+   default:
+      return 0;
+   }
+   
+   switch (param) {
+   case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+   case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+   case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+   case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+      return 16384;
+   case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+      return 4;
+   case PIPE_SHADER_CAP_MAX_INPUTS:
+      if (shader == PIPE_SHADER_VERTEX)
+         return 32;
+      return 0x300 / 16;
+   case PIPE_SHADER_CAP_MAX_CONSTS:
+      return 65536 / 16;
+   case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+      return 14;
+   case PIPE_SHADER_CAP_MAX_ADDRS:
+      return 1;
+   case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR:
+   case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR:
+      return shader != PIPE_SHADER_FRAGMENT;
+   case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR:
+   case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
+      return 1;
+   case PIPE_SHADER_CAP_MAX_PREDS:
+      return 0;
+   case PIPE_SHADER_CAP_MAX_TEMPS:
+      return NVC0_CAP_MAX_PROGRAM_TEMPS;
+   case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+      return 1;
+   case PIPE_SHADER_CAP_SUBROUTINES:
+      return 0; /* please inline, or provide function declarations */
+   default:
+      NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
+      return 0;
+   }
+}
+
+static float
+nvc0_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param)
+{
+   switch (param) {
+   case PIPE_CAP_MAX_LINE_WIDTH:
+   case PIPE_CAP_MAX_LINE_WIDTH_AA:
+      return 10.0f;
+   case PIPE_CAP_MAX_POINT_WIDTH:
+   case PIPE_CAP_MAX_POINT_WIDTH_AA:
+      return 64.0f;
+   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
+      return 16.0f;
+   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
+      return 4.0f;
+   default:
+      NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
+      return 0.0f;
+   }
+}
+
+static void
+nvc0_screen_destroy(struct pipe_screen *pscreen)
+{
+   struct nvc0_screen *screen = nvc0_screen(pscreen);
+
+   nvc0_fence_wait(screen->fence.current);
+   nvc0_fence_reference(&screen->fence.current, NULL);
+
+   nouveau_bo_ref(NULL, &screen->text);
+   nouveau_bo_ref(NULL, &screen->tls);
+   nouveau_bo_ref(NULL, &screen->txc);
+   nouveau_bo_ref(NULL, &screen->fence.bo);
+   nouveau_bo_ref(NULL, &screen->mp_stack_bo);
+
+   nouveau_resource_destroy(&screen->text_heap);
+
+   if (screen->tic.entries)
+      FREE(screen->tic.entries);
+
+   nvc0_mm_destroy(screen->mm_GART);
+   nvc0_mm_destroy(screen->mm_VRAM);
+   nvc0_mm_destroy(screen->mm_VRAM_fe0);
+
+   nouveau_grobj_free(&screen->fermi);
+   nouveau_grobj_free(&screen->eng2d);
+   nouveau_grobj_free(&screen->m2mf);
+
+   nouveau_screen_fini(&screen->base);
+
+   FREE(screen);
+}
+
+static int
+nvc0_graph_set_macro(struct nvc0_screen *screen, uint32_t m, unsigned pos,
+                     unsigned size, const uint32_t *data)
+{
+   struct nouveau_channel *chan = screen->base.channel;
+
+   size /= 4;
+
+   BEGIN_RING(chan, RING_3D_(NVC0_GRAPH_MACRO_ID), 2);
+   OUT_RING  (chan, (m - 0x3800) / 8);
+   OUT_RING  (chan, pos);
+   BEGIN_RING_1I(chan, RING_3D_(NVC0_GRAPH_MACRO_UPLOAD_POS), size + 1);
+   OUT_RING  (chan, pos);
+   OUT_RINGp (chan, data, size);
+
+   return pos + size;
+}
+
+static void
+nvc0_screen_fence_reference(struct pipe_screen *pscreen,
+                            struct pipe_fence_handle **ptr,
+                            struct pipe_fence_handle *fence)
+{
+   nvc0_fence_reference((struct nvc0_fence **)ptr, nvc0_fence(fence));
+}
+
+static int
+nvc0_screen_fence_signalled(struct pipe_screen *pscreen,
+                            struct pipe_fence_handle *fence,
+                            unsigned flags)
+{
+   return !(nvc0_fence_signalled(nvc0_fence(fence)));
+}
+
+static int
+nvc0_screen_fence_finish(struct pipe_screen *pscreen,
+                         struct pipe_fence_handle *fence,
+                         unsigned flags)
+{
+   return nvc0_fence_wait((struct nvc0_fence *)fence) != TRUE;
+}
+
+static void
+nvc0_magic_3d_init(struct nouveau_channel *chan)
+{
+   BEGIN_RING(chan, RING_3D_(0x10cc), 1);
+   OUT_RING  (chan, 0xff);
+   BEGIN_RING(chan, RING_3D_(0x10e0), 2);
+   OUT_RING(chan, 0xff);
+   OUT_RING(chan, 0xff);
+   BEGIN_RING(chan, RING_3D_(0x10ec), 2);
+   OUT_RING(chan, 0xff);
+   OUT_RING(chan, 0xff);
+   BEGIN_RING(chan, RING_3D_(0x074c), 1);
+   OUT_RING  (chan, 0x3f);
+
+   BEGIN_RING(chan, RING_3D_(0x10f8), 1);
+   OUT_RING  (chan, 0x0101);
+
+   BEGIN_RING(chan, RING_3D_(0x16a8), 1);
+   OUT_RING  (chan, (3 << 16) | 3);
+   BEGIN_RING(chan, RING_3D_(0x1794), 1);
+   OUT_RING  (chan, (2 << 16) | 2);
+   BEGIN_RING(chan, RING_3D_(0x0de8), 1);
+   OUT_RING  (chan, 1);
+
+#if 0 /* software method */
+   BEGIN_RING(chan, RING_3D_(0x1528), 1); /* MP poke */
+   OUT_RING  (chan, 0);
+#endif
+
+   BEGIN_RING(chan, RING_3D_(0x12ac), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D_(0x0218), 1);
+   OUT_RING  (chan, 0x10);
+   BEGIN_RING(chan, RING_3D_(0x10fc), 1);
+   OUT_RING  (chan, 0x10);
+   BEGIN_RING(chan, RING_3D_(0x1290), 1);
+   OUT_RING  (chan, 0x10);
+   BEGIN_RING(chan, RING_3D_(0x12d8), 2);
+   OUT_RING  (chan, 0x10);
+   OUT_RING  (chan, 0x10);
+   BEGIN_RING(chan, RING_3D_(0x06d4), 1);
+   OUT_RING  (chan, 8);
+   BEGIN_RING(chan, RING_3D_(0x1140), 1);
+   OUT_RING  (chan, 0x10);
+   BEGIN_RING(chan, RING_3D_(0x1610), 1);
+   OUT_RING  (chan, 0xe);
+
+   BEGIN_RING(chan, RING_3D_(0x164c), 1);
+   OUT_RING  (chan, 1 << 12);
+   BEGIN_RING(chan, RING_3D_(0x151c), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D_(0x020c), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D_(0x030c), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D_(0x0300), 1);
+   OUT_RING  (chan, 3);
+#if 0 /* software method */
+   BEGIN_RING(chan, RING_3D_(0x1280), 1); /* PGRAPH poke */
+   OUT_RING  (chan, 0);
+#endif
+   BEGIN_RING(chan, RING_3D_(0x02d0), 1);
+   OUT_RING  (chan, 0x1f40);
+   BEGIN_RING(chan, RING_3D_(0x00fdc), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D_(0x19c0), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D_(0x075c), 1);
+   OUT_RING  (chan, 3);
+
+   BEGIN_RING(chan, RING_3D_(0x0fac), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D_(0x0f90), 1);
+   OUT_RING  (chan, 0);
+}
+
+#define FAIL_SCREEN_INIT(str, err)                    \
+   do {                                               \
+      NOUVEAU_ERR(str, err);                          \
+      nvc0_screen_destroy(pscreen);                   \
+      return NULL;                                    \
+   } while(0)
+
+struct pipe_screen *
+nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
+{
+   struct nvc0_screen *screen;
+   struct nouveau_channel *chan;
+   struct pipe_screen *pscreen;
+   int ret;
+   unsigned i;
+
+   screen = CALLOC_STRUCT(nvc0_screen);
+   if (!screen)
+      return NULL;
+   pscreen = &screen->base.base;
+
+   ret = nouveau_screen_init(&screen->base, dev);
+   if (ret) {
+      nvc0_screen_destroy(pscreen);
+      return NULL;
+   }
+   chan = screen->base.channel;
+
+   pscreen->winsys = ws;
+   pscreen->destroy = nvc0_screen_destroy;
+   pscreen->context_create = nvc0_create;
+   pscreen->is_format_supported = nvc0_screen_is_format_supported;
+   pscreen->get_param = nvc0_screen_get_param;
+   pscreen->get_shader_param = nvc0_screen_get_shader_param;
+   pscreen->get_paramf = nvc0_screen_get_paramf;
+   pscreen->fence_reference = nvc0_screen_fence_reference;
+   pscreen->fence_signalled = nvc0_screen_fence_signalled;
+   pscreen->fence_finish = nvc0_screen_fence_finish;
+
+   nvc0_screen_init_resource_functions(pscreen);
+
+   screen->base.vertex_buffer_flags = NOUVEAU_BO_GART;
+   screen->base.index_buffer_flags = 0;
+
+   ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, 4096,
+                        &screen->fence.bo);
+   if (ret)
+      goto fail;
+   nouveau_bo_map(screen->fence.bo, NOUVEAU_BO_RDWR);
+   screen->fence.map = screen->fence.bo->map;
+   nouveau_bo_unmap(screen->fence.bo);
+
+   for (i = 0; i < NVC0_SCRATCH_NR_BUFFERS; ++i) {
+      ret = nouveau_bo_new(dev, NOUVEAU_BO_GART, 0, NVC0_SCRATCH_SIZE,
+                           &screen->scratch.bo[i]);
+      if (ret)
+         goto fail;
+   }
+
+   ret = nouveau_grobj_alloc(chan, 0xbeef9039, NVC0_M2MF, &screen->m2mf);
+   if (ret)
+      FAIL_SCREEN_INIT("Error allocating PGRAPH context for M2MF: %d\n", ret);
+
+   BIND_RING (chan, screen->m2mf, NVC0_SUBCH_MF);
+   BEGIN_RING(chan, RING_MF(NOTIFY_ADDRESS_HIGH), 3);
+   OUT_RELOCh(chan, screen->fence.bo, 16, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
+   OUT_RELOCl(chan, screen->fence.bo, 16, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
+   OUT_RING  (chan, 0);
+
+   ret = nouveau_grobj_alloc(chan, 0xbeef902d, NVC0_2D, &screen->eng2d);
+   if (ret)
+      FAIL_SCREEN_INIT("Error allocating PGRAPH context for 2D: %d\n", ret);
+
+   BIND_RING (chan, screen->eng2d, NVC0_SUBCH_2D);
+   BEGIN_RING(chan, RING_2D(OPERATION), 1);
+   OUT_RING  (chan, NVC0_2D_OPERATION_SRCCOPY);
+   BEGIN_RING(chan, RING_2D(CLIP_ENABLE), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_2D(COLOR_KEY_ENABLE), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_2D_(0x0884), 1);
+   OUT_RING  (chan, 0x3f);
+   BEGIN_RING(chan, RING_2D_(0x0888), 1);
+   OUT_RING  (chan, 1);
+
+   ret = nouveau_grobj_alloc(chan, 0xbeef9097, NVC0_3D, &screen->fermi);
+   if (ret)
+      FAIL_SCREEN_INIT("Error allocating PGRAPH context for 3D: %d\n", ret);
+
+   BIND_RING (chan, screen->fermi, NVC0_SUBCH_3D);
+   BEGIN_RING(chan, RING_3D(NOTIFY_ADDRESS_HIGH), 3);
+   OUT_RELOCh(chan, screen->fence.bo, 32, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
+   OUT_RELOCl(chan, screen->fence.bo, 32, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
+   OUT_RING  (chan, 0);
+
+   BEGIN_RING(chan, RING_3D(COND_MODE), 1);
+   OUT_RING  (chan, NVC0_3D_COND_MODE_ALWAYS);
+
+   BEGIN_RING(chan, RING_3D(RT_CONTROL), 1);
+   OUT_RING  (chan, 1);
+
+   BEGIN_RING(chan, RING_3D(CSAA_ENABLE), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(MULTISAMPLE_ENABLE), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(MULTISAMPLE_MODE), 1);
+   OUT_RING  (chan, NVC0_3D_MULTISAMPLE_MODE_1X);
+   BEGIN_RING(chan, RING_3D(MULTISAMPLE_CTRL), 1);
+   OUT_RING  (chan, 0);
+
+   nvc0_magic_3d_init(chan);
+
+   ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 17, 1 << 20, &screen->text);
+   if (ret)
+      goto fail;
+
+   nouveau_resource_init(&screen->text_heap, 0, 1 << 20);
+
+   ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 12, 6 << 16,
+                        &screen->uniforms);
+   if (ret)
+      goto fail;
+
+   /* auxiliary constants (6 user clip planes, base instance id) */
+   BEGIN_RING(chan, RING_3D(CB_SIZE), 3);
+   OUT_RING  (chan, 256);
+   OUT_RELOCh(chan, screen->uniforms, 5 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   OUT_RELOCl(chan, screen->uniforms, 5 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   for (i = 0; i < 5; ++i) {
+      BEGIN_RING(chan, RING_3D(CB_BIND(i)), 1);
+      OUT_RING  (chan, (15 << 4) | 1);
+   }
+
+   screen->tls_size = 4 * 4 * 32 * 128 * 4;
+   ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 17,
+                        screen->tls_size, &screen->tls);
+   if (ret)
+      goto fail;
+
+   BEGIN_RING(chan, RING_3D(CODE_ADDRESS_HIGH), 2);
+   OUT_RELOCh(chan, screen->text, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   OUT_RELOCl(chan, screen->text, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   BEGIN_RING(chan, RING_3D(LOCAL_ADDRESS_HIGH), 4);
+   OUT_RELOCh(chan, screen->tls, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+   OUT_RELOCl(chan, screen->tls, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+   OUT_RING  (chan, screen->tls_size >> 32);
+   OUT_RING  (chan, screen->tls_size);
+   BEGIN_RING(chan, RING_3D(LOCAL_BASE), 1);
+   OUT_RING  (chan, 0);
+
+   for (i = 0; i < 5; ++i) {
+      BEGIN_RING(chan, RING_3D(TEX_LIMITS(i)), 1);
+      OUT_RING  (chan, 0x54);
+   }
+   BEGIN_RING(chan, RING_3D(LINKED_TSC), 1);
+   OUT_RING  (chan, 0);
+
+   ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 17, 1 << 20,
+                        &screen->mp_stack_bo);
+   if (ret)
+      goto fail;
+
+   BEGIN_RING(chan, RING_3D_(0x17bc), 3);
+   OUT_RELOCh(chan, screen->mp_stack_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+   OUT_RELOCl(chan, screen->mp_stack_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+   OUT_RING  (chan, 1);
+
+   ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 17, 1 << 17, &screen->txc);
+   if (ret)
+      goto fail;
+
+   BEGIN_RING(chan, RING_3D(TIC_ADDRESS_HIGH), 3);
+   OUT_RELOCh(chan, screen->txc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   OUT_RELOCl(chan, screen->txc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   OUT_RING  (chan, NVC0_TIC_MAX_ENTRIES - 1);
+
+   BEGIN_RING(chan, RING_3D(TSC_ADDRESS_HIGH), 3);
+   OUT_RELOCh(chan, screen->txc, 65536, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   OUT_RELOCl(chan, screen->txc, 65536, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+   OUT_RING  (chan, NVC0_TSC_MAX_ENTRIES - 1);
+
+   BEGIN_RING(chan, RING_3D(SCREEN_Y_CONTROL), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(WINDOW_OFFSET_X), 2);
+   OUT_RING  (chan, 0);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D_(0x1590), 1); /* deactivate ZCULL */
+   OUT_RING  (chan, 0x3f);
+
+   BEGIN_RING(chan, RING_3D(VIEWPORT_CLIP_RECTS_EN), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(CLIPID_ENABLE), 1);
+   OUT_RING  (chan, 0);
+
+   BEGIN_RING(chan, RING_3D(VIEWPORT_TRANSFORM_EN), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D(DEPTH_RANGE_NEAR(0)), 2);
+   OUT_RINGf (chan, 0.0f);
+   OUT_RINGf (chan, 1.0f);
+
+   /* We use scissors instead of exact view volume clipping,
+    * so they're always enabled.
+    */
+   BEGIN_RING(chan, RING_3D(SCISSOR_ENABLE(0)), 3);
+   OUT_RING  (chan, 1);
+   OUT_RING  (chan, 8192 << 16);
+   OUT_RING  (chan, 8192 << 16);
+
+   BEGIN_RING(chan, RING_3D_(0x0fac), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D_(0x3484), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D_(0x0dbc), 1);
+   OUT_RING  (chan, 0x00010000);
+   BEGIN_RING(chan, RING_3D_(0x0dd8), 1);
+   OUT_RING  (chan, 0xff800006);
+   BEGIN_RING(chan, RING_3D_(0x3488), 1);
+   OUT_RING  (chan, 0);
+
+#define MK_MACRO(m, n) i = nvc0_graph_set_macro(screen, m, i, sizeof(n), n);
+
+   i = 0;
+   MK_MACRO(NVC0_3D_BLEND_ENABLES, nvc0_9097_blend_enables);
+   MK_MACRO(NVC0_3D_VERTEX_ARRAY_SELECT, nvc0_9097_vertex_array_select);
+   MK_MACRO(NVC0_3D_TEP_SELECT, nvc0_9097_tep_select);
+   MK_MACRO(NVC0_3D_GP_SELECT, nvc0_9097_gp_select);
+   MK_MACRO(NVC0_3D_POLYGON_MODE_FRONT, nvc0_9097_poly_mode_front);
+   MK_MACRO(NVC0_3D_POLYGON_MODE_BACK, nvc0_9097_poly_mode_back);
+   MK_MACRO(NVC0_3D_COLOR_MASK_BROADCAST, nvc0_9097_color_mask_brdc);
+
+   BEGIN_RING(chan, RING_3D(RASTERIZE_ENABLE), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D(GP_SELECT), 1);
+   OUT_RING  (chan, 0x40);
+   BEGIN_RING(chan, RING_3D(GP_BUILTIN_RESULT_EN), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(TEP_SELECT), 1);
+   OUT_RING  (chan, 0x30);
+   BEGIN_RING(chan, RING_3D(PATCH_VERTICES), 1);
+   OUT_RING  (chan, 3);
+   BEGIN_RING(chan, RING_3D(SP_SELECT(2)), 1);
+   OUT_RING  (chan, 0x20);
+   BEGIN_RING(chan, RING_3D(SP_SELECT(0)), 1);
+   OUT_RING  (chan, 0x00);
+
+   BEGIN_RING(chan, RING_3D(POINT_COORD_REPLACE), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(POINT_RASTER_RULES), 1);
+   OUT_RING  (chan, NVC0_3D_POINT_RASTER_RULES_OGL);
+
+   BEGIN_RING(chan, RING_3D(FRAG_COLOR_CLAMP_EN), 1);
+   OUT_RING  (chan, 0x11111111);
+   BEGIN_RING(chan, RING_3D(EDGEFLAG_ENABLE), 1);
+   OUT_RING  (chan, 1);
+
+   BEGIN_RING(chan, RING_3D(VERTEX_RUNOUT_ADDRESS_HIGH), 2);
+   OUT_RING  (chan, 0xab);
+   OUT_RING  (chan, 0x00000000);
+
+   FIRE_RING (chan);
+
+   screen->tic.entries = CALLOC(4096, sizeof(void *));
+   screen->tsc.entries = screen->tic.entries + 2048;
+
+   screen->mm_GART = nvc0_mm_create(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
+                                    0x000);
+   screen->mm_VRAM = nvc0_mm_create(dev, NOUVEAU_BO_VRAM, 0x000);
+   screen->mm_VRAM_fe0 = nvc0_mm_create(dev, NOUVEAU_BO_VRAM, 0xfe0);
+
+   nvc0_screen_fence_new(screen, &screen->fence.current, FALSE);
+
+   return pscreen;
+
+fail:
+   nvc0_screen_destroy(pscreen);
+   return NULL;
+}
+
+void
+nvc0_screen_make_buffers_resident(struct nvc0_screen *screen)
+{
+   struct nouveau_channel *chan = screen->base.channel;
+
+   const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
+
+   nouveau_bo_validate(chan, screen->text, flags);
+   nouveau_bo_validate(chan, screen->uniforms, flags);
+   nouveau_bo_validate(chan, screen->txc, flags);
+   nouveau_bo_validate(chan, screen->tls, flags);
+   nouveau_bo_validate(chan, screen->mp_stack_bo, flags);
+}
+
+int
+nvc0_screen_tic_alloc(struct nvc0_screen *screen, void *entry)
+{
+   int i = screen->tic.next;
+
+   while (screen->tic.lock[i / 32] & (1 << (i % 32)))
+      i = (i + 1) & (NVC0_TIC_MAX_ENTRIES - 1);
+
+   screen->tic.next = (i + 1) & (NVC0_TIC_MAX_ENTRIES - 1);
+
+   if (screen->tic.entries[i])
+      nvc0_tic_entry(screen->tic.entries[i])->id = -1;
+
+   screen->tic.entries[i] = entry;
+   return i;
+}
+
+int
+nvc0_screen_tsc_alloc(struct nvc0_screen *screen, void *entry)
+{
+   int i = screen->tsc.next;
+
+   while (screen->tsc.lock[i / 32] & (1 << (i % 32)))
+      i = (i + 1) & (NVC0_TSC_MAX_ENTRIES - 1);
+
+   screen->tsc.next = (i + 1) & (NVC0_TSC_MAX_ENTRIES - 1);
+
+   if (screen->tsc.entries[i])
+      nvc0_tsc_entry(screen->tsc.entries[i])->id = -1;
+
+   screen->tsc.entries[i] = entry;
+   return i;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.h b/src/gallium/drivers/nvc0/nvc0_screen.h
new file mode 100644 (file)
index 0000000..1fac142
--- /dev/null
@@ -0,0 +1,192 @@
+#ifndef __NVC0_SCREEN_H__
+#define __NVC0_SCREEN_H__
+
+#define NOUVEAU_NVC0
+#include "nouveau/nouveau_screen.h"
+#undef NOUVEAU_NVC0
+#include "nvc0_winsys.h"
+#include "nvc0_stateobj.h"
+
+#define NVC0_TIC_MAX_ENTRIES 2048
+#define NVC0_TSC_MAX_ENTRIES 2048
+
+struct nvc0_mman;
+struct nvc0_context;
+struct nvc0_fence;
+
+#define NVC0_SCRATCH_SIZE (2 << 20)
+#define NVC0_SCRATCH_NR_BUFFERS 2
+
+struct nvc0_screen {
+   struct nouveau_screen base;
+   struct nouveau_winsys *nvws;
+
+   struct nvc0_context *cur_ctx;
+
+   struct nouveau_bo *text;
+   struct nouveau_bo *uniforms;
+   struct nouveau_bo *tls;
+   struct nouveau_bo *txc; /* TIC (offset 0) and TSC (65536) */
+   struct nouveau_bo *mp_stack_bo;
+
+   uint64_t tls_size;
+
+   struct nouveau_resource *text_heap;
+
+   struct {
+      struct nouveau_bo *bo[NVC0_SCRATCH_NR_BUFFERS];
+      uint8_t *buf;
+      int index;
+      uint32_t offset;
+   } scratch;
+
+   struct {
+      void **entries;
+      int next;
+      uint32_t lock[NVC0_TIC_MAX_ENTRIES / 32];
+   } tic;
+   
+   struct {
+      void **entries;
+      int next;
+      uint32_t lock[NVC0_TSC_MAX_ENTRIES / 32];
+   } tsc;
+
+   struct {
+      uint32_t *map;
+      struct nvc0_fence *head;
+      struct nvc0_fence *tail;
+      struct nvc0_fence *current;
+      uint32_t sequence;
+      uint32_t sequence_ack;
+      struct nouveau_bo *bo;
+   } fence;
+
+   struct nvc0_mman *mm_GART;
+   struct nvc0_mman *mm_VRAM;
+   struct nvc0_mman *mm_VRAM_fe0;
+
+   struct nouveau_grobj *fermi;
+   struct nouveau_grobj *eng2d;
+   struct nouveau_grobj *m2mf;
+};
+
+static INLINE struct nvc0_screen *
+nvc0_screen(struct pipe_screen *screen)
+{
+   return (struct nvc0_screen *)screen;
+}
+
+/* Since a resource can be migrated, we need to decouple allocations from
+ * them. This struct is linked with fences for delayed freeing of allocs.
+ */
+struct nvc0_mm_allocation {
+   struct nvc0_mm_allocation *next;
+   void *priv;
+   uint32_t offset;
+};
+
+static INLINE void
+nvc0_fence_sched_release(struct nvc0_fence *nf, struct nvc0_mm_allocation *mm)
+{
+   mm->next = nf->buffers;
+   nf->buffers = mm;
+}
+
+extern struct nvc0_mman *
+nvc0_mm_create(struct nouveau_device *, uint32_t domain, uint32_t storage_type);
+
+extern void
+nvc0_mm_destroy(struct nvc0_mman *);
+
+extern struct nvc0_mm_allocation *
+nvc0_mm_allocate(struct nvc0_mman *,
+                 uint32_t size, struct nouveau_bo **, uint32_t *offset);
+extern void
+nvc0_mm_free(struct nvc0_mm_allocation *);
+
+void nvc0_screen_make_buffers_resident(struct nvc0_screen *);
+
+int nvc0_screen_tic_alloc(struct nvc0_screen *, void *);
+int nvc0_screen_tsc_alloc(struct nvc0_screen *, void *);
+
+static INLINE void
+nvc0_resource_fence(struct nvc0_resource *res, uint32_t flags)
+{
+   struct nvc0_screen *screen = nvc0_screen(res->base.screen);
+
+   if (res->mm) {
+      nvc0_fence_reference(&res->fence, screen->fence.current);
+
+      if (flags & NOUVEAU_BO_WR)
+         nvc0_fence_reference(&res->fence_wr, screen->fence.current);
+   }
+}
+
+static INLINE void
+nvc0_resource_validate(struct nvc0_resource *res, uint32_t flags)
+{
+   struct nvc0_screen *screen = nvc0_screen(res->base.screen);
+
+   nouveau_bo_validate(screen->base.channel, res->bo, flags);
+
+   nvc0_resource_fence(res, flags);
+}
+
+
+boolean
+nvc0_screen_fence_new(struct nvc0_screen *, struct nvc0_fence **, boolean emit);
+
+void
+nvc0_screen_fence_next(struct nvc0_screen *);
+
+static INLINE boolean
+nvc0_screen_fence_emit(struct nvc0_screen *screen)
+{
+   nvc0_fence_emit(screen->fence.current);
+
+   return nvc0_screen_fence_new(screen, &screen->fence.current, FALSE);
+}
+
+struct nvc0_format {
+   uint32_t rt;
+   uint32_t tic;
+   uint32_t vtx;
+   uint32_t usage;
+};
+
+extern const struct nvc0_format nvc0_format_table[];
+
+static INLINE void
+nvc0_screen_tic_unlock(struct nvc0_screen *screen, struct nvc0_tic_entry *tic)
+{
+   if (tic->id >= 0)
+      screen->tic.lock[tic->id / 32] &= ~(1 << (tic->id % 32));
+}
+
+static INLINE void
+nvc0_screen_tsc_unlock(struct nvc0_screen *screen, struct nvc0_tsc_entry *tsc)
+{
+   if (tsc->id >= 0)
+      screen->tsc.lock[tsc->id / 32] &= ~(1 << (tsc->id % 32));
+}
+
+static INLINE void
+nvc0_screen_tic_free(struct nvc0_screen *screen, struct nvc0_tic_entry *tic)
+{
+   if (tic->id >= 0) {
+      screen->tic.entries[tic->id] = NULL;
+      screen->tic.lock[tic->id / 32] &= ~(1 << (tic->id % 32));
+   }
+}
+
+static INLINE void
+nvc0_screen_tsc_free(struct nvc0_screen *screen, struct nvc0_tsc_entry *tsc)
+{
+   if (tsc->id >= 0) {
+      screen->tsc.entries[tsc->id] = NULL;
+      screen->tsc.lock[tsc->id / 32] &= ~(1 << (tsc->id % 32));
+   }
+}
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nvc0/nvc0_shader_state.c
new file mode 100644 (file)
index 0000000..981b548
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_state.h"
+#include "util/u_inlines.h"
+
+#include "nvc0_context.h"
+
+static boolean
+nvc0_program_validate(struct nvc0_context *nvc0, struct nvc0_program *prog)
+{
+   int ret;
+   unsigned size;
+
+   if (prog->translated)
+      return TRUE;
+
+   prog->translated = nvc0_program_translate(prog);
+   if (!prog->translated)
+      return FALSE;
+
+   size = align(prog->code_size + NVC0_SHADER_HEADER_SIZE, 0x100);
+
+   ret = nouveau_resource_alloc(nvc0->screen->text_heap, size, prog,
+                                &prog->res);
+   if (ret)
+      return FALSE;
+
+   prog->code_base = prog->res->start;
+
+   nvc0_m2mf_push_linear(nvc0, nvc0->screen->text, NOUVEAU_BO_VRAM,
+                         prog->code_base, NVC0_SHADER_HEADER_SIZE, prog->hdr);
+   nvc0_m2mf_push_linear(nvc0, nvc0->screen->text, NOUVEAU_BO_VRAM,
+                         prog->code_base + NVC0_SHADER_HEADER_SIZE,
+                         prog->code_size, prog->code);
+
+   BEGIN_RING(nvc0->screen->base.channel, RING_3D_(0x021c), 1);
+   OUT_RING  (nvc0->screen->base.channel, 0x1111);
+
+   return TRUE;
+}
+
+void
+nvc0_vertprog_validate(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_program *vp = nvc0->vertprog;
+
+   if (nvc0->clip.nr > vp->vp.num_ucps) {
+      assert(nvc0->clip.nr <= 6);
+      vp->vp.num_ucps = 6;
+
+      if (vp->translated)
+         nvc0_program_destroy(nvc0, vp);
+   }
+
+   if (!nvc0_program_validate(nvc0, vp))
+         return;
+
+   BEGIN_RING(chan, RING_3D(SP_SELECT(1)), 2);
+   OUT_RING  (chan, 0x11);
+   OUT_RING  (chan, vp->code_base);
+   BEGIN_RING(chan, RING_3D(SP_GPR_ALLOC(1)), 1);
+   OUT_RING  (chan, vp->max_gpr);
+
+   // BEGIN_RING(chan, RING_3D_(0x163c), 1);
+   // OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(VERT_COLOR_CLAMP_EN), 1);
+   OUT_RING  (chan, 1);
+}
+
+void
+nvc0_fragprog_validate(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_program *fp = nvc0->fragprog;
+
+   if (!nvc0_program_validate(nvc0, fp))
+         return;
+
+   BEGIN_RING(chan, RING_3D(EARLY_FRAGMENT_TESTS), 1);
+   OUT_RING  (chan, fp->fp.early_z);
+   BEGIN_RING(chan, RING_3D(SP_SELECT(5)), 2);
+   OUT_RING  (chan, 0x51);
+   OUT_RING  (chan, fp->code_base);
+   BEGIN_RING(chan, RING_3D(SP_GPR_ALLOC(5)), 1);
+   OUT_RING  (chan, fp->max_gpr);
+
+   BEGIN_RING(chan, RING_3D_(0x0360), 2);
+   OUT_RING  (chan, 0x20164010);
+   OUT_RING  (chan, 0x20);
+   BEGIN_RING(chan, RING_3D_(0x196c), 1);
+   OUT_RING  (chan, fp->flags[0]);
+}
+
+void
+nvc0_tctlprog_validate(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_program *tp = nvc0->tctlprog;
+
+   if (!tp) {
+      BEGIN_RING(chan, RING_3D(SP_SELECT(2)), 1);
+      OUT_RING  (chan, 0x20);
+      return;
+   }
+   if (!nvc0_program_validate(nvc0, tp))
+         return;
+
+   BEGIN_RING(chan, RING_3D(SP_SELECT(2)), 2);
+   OUT_RING  (chan, 0x21);
+   OUT_RING  (chan, tp->code_base);
+   BEGIN_RING(chan, RING_3D(SP_GPR_ALLOC(2)), 1);
+   OUT_RING  (chan, tp->max_gpr);   
+}
+
+void
+nvc0_tevlprog_validate(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_program *tp = nvc0->tevlprog;
+
+   if (!tp) {
+      BEGIN_RING(chan, RING_3D(TEP_SELECT), 1);
+      OUT_RING  (chan, 0x30);
+      return;
+   }
+   if (!nvc0_program_validate(nvc0, tp))
+         return;
+
+   BEGIN_RING(chan, RING_3D(TEP_SELECT), 1);
+   OUT_RING  (chan, 0x31);
+   BEGIN_RING(chan, RING_3D(SP_START_ID(3)), 1);
+   OUT_RING  (chan, tp->code_base);
+   BEGIN_RING(chan, RING_3D(SP_GPR_ALLOC(3)), 1);
+   OUT_RING  (chan, tp->max_gpr);   
+}
+
+void
+nvc0_gmtyprog_validate(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_program *gp = nvc0->gmtyprog;
+
+   if (!gp) {
+      BEGIN_RING(chan, RING_3D(GP_SELECT), 1);
+      OUT_RING  (chan, 0x40);
+      return;
+   }
+   if (!nvc0_program_validate(nvc0, gp))
+         return;
+
+   BEGIN_RING(chan, RING_3D(GP_SELECT), 1);
+   OUT_RING  (chan, 0x41);
+   BEGIN_RING(chan, RING_3D(SP_START_ID(4)), 1);
+   OUT_RING  (chan, gp->code_base);
+   BEGIN_RING(chan, RING_3D(SP_GPR_ALLOC(4)), 1);
+   OUT_RING  (chan, gp->max_gpr);   
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c
new file mode 100644 (file)
index 0000000..c08f369
--- /dev/null
@@ -0,0 +1,865 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
+
+#include "tgsi/tgsi_parse.h"
+
+#include "nvc0_stateobj.h"
+#include "nvc0_context.h"
+
+#include "nvc0_3d.xml.h"
+#include "nv50_texture.xml.h"
+
+#include "nouveau/nouveau_gldefs.h"
+
+static INLINE uint32_t
+nvc0_colormask(unsigned mask)
+{
+    uint32_t ret = 0;
+
+    if (mask & PIPE_MASK_R)
+        ret |= 0x0001;
+    if (mask & PIPE_MASK_G)
+        ret |= 0x0010;
+    if (mask & PIPE_MASK_B)
+        ret |= 0x0100;
+    if (mask & PIPE_MASK_A)
+        ret |= 0x1000;
+
+    return ret;
+}
+
+static INLINE uint32_t
+nvc0_blend_fac(unsigned factor)
+{
+    static const uint16_t bf[] = {
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x00 */
+        NV50_3D_BLEND_FACTOR_ONE,
+        NV50_3D_BLEND_FACTOR_SRC_COLOR,
+        NV50_3D_BLEND_FACTOR_SRC_ALPHA,
+        NV50_3D_BLEND_FACTOR_DST_ALPHA,
+        NV50_3D_BLEND_FACTOR_DST_COLOR,
+        NV50_3D_BLEND_FACTOR_SRC_ALPHA_SATURATE,
+        NV50_3D_BLEND_FACTOR_CONSTANT_COLOR,
+        NV50_3D_BLEND_FACTOR_CONSTANT_ALPHA,
+        NV50_3D_BLEND_FACTOR_SRC1_COLOR,
+        NV50_3D_BLEND_FACTOR_SRC1_ALPHA,
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x0b */
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x0c */
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x0d */
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x0e */
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x0f */
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x10 */
+        NV50_3D_BLEND_FACTOR_ZERO, /* 0x11 */
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC_COLOR,
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_DST_ALPHA,
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_DST_COLOR,
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA,
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
+        NV50_3D_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
+    };
+
+    assert(factor < (sizeof(bf) / sizeof(bf[0])));
+    return bf[factor];
+}
+
+static void *
+nvc0_blend_state_create(struct pipe_context *pipe,
+                        const struct pipe_blend_state *cso)
+{
+    struct nvc0_blend_stateobj *so = CALLOC_STRUCT(nvc0_blend_stateobj);
+    int i;
+
+    so->pipe = *cso;
+
+    SB_IMMED_3D(so, BLEND_INDEPENDENT, cso->independent_blend_enable);
+
+    if (!cso->independent_blend_enable) {
+        SB_BEGIN_3D(so, BLEND_ENABLES, 1);
+        SB_DATA    (so, cso->rt[0].blend_enable ? 0xff : 0);
+
+        if (cso->rt[0].blend_enable) {
+            SB_BEGIN_3D(so, BLEND_EQUATION_RGB, 5);
+            SB_DATA    (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[0].rgb_src_factor));
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[0].rgb_dst_factor));
+            SB_DATA    (so, nvgl_blend_eqn(cso->rt[0].alpha_func));
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[0].alpha_src_factor));
+            SB_BEGIN_3D(so, BLEND_FUNC_DST_ALPHA, 1);
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[0].alpha_dst_factor));
+        }
+
+        SB_BEGIN_3D(so, COLOR_MASK_BROADCAST, 1);
+        SB_DATA    (so, nvc0_colormask(cso->rt[0].colormask));
+    } else {
+        uint8_t en = 0;
+
+        for (i = 0; i < 8; ++i) {
+            if (!cso->rt[i].blend_enable)
+                continue;
+            en |= 1 << i;
+
+            SB_BEGIN_3D(so, IBLEND_EQUATION_RGB(i), 6);
+            SB_DATA    (so, nvgl_blend_eqn(cso->rt[i].rgb_func));
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[i].rgb_src_factor));
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[i].rgb_dst_factor));
+            SB_DATA    (so, nvgl_blend_eqn(cso->rt[i].alpha_func));
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[i].alpha_src_factor));
+            SB_DATA    (so, nvc0_blend_fac(cso->rt[i].alpha_dst_factor));
+        }
+        SB_BEGIN_3D(so, BLEND_ENABLES, 1);
+        SB_DATA    (so, en);
+
+        SB_BEGIN_3D(so, COLOR_MASK(0), 8);
+        for (i = 0; i < 8; ++i)
+            SB_DATA(so, nvc0_colormask(cso->rt[i].colormask));
+    }
+
+    if (cso->logicop_enable) {
+       SB_BEGIN_3D(so, LOGIC_OP_ENABLE, 2);
+       SB_DATA    (so, 1);
+       SB_DATA    (so, nvgl_logicop_func(cso->logicop_func));
+    } else {
+       SB_IMMED_3D(so, LOGIC_OP_ENABLE, 0);
+    }
+
+    assert(so->size < (sizeof(so->state) / sizeof(so->state[0])));
+    return so;
+}
+
+static void
+nvc0_blend_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->blend = hwcso;
+    nvc0->dirty |= NVC0_NEW_BLEND;
+}
+
+static void
+nvc0_blend_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+    FREE(hwcso);
+}
+
+static void *
+nvc0_rasterizer_state_create(struct pipe_context *pipe,
+                             const struct pipe_rasterizer_state *cso)
+{
+    struct nvc0_rasterizer_stateobj *so;
+
+    so = CALLOC_STRUCT(nvc0_rasterizer_stateobj);
+    if (!so)
+        return NULL;
+    so->pipe = *cso;
+
+#ifndef NVC0_SCISSORS_CLIPPING
+    SB_IMMED_3D(so, SCISSOR_ENABLE(0), cso->scissor);
+#endif
+    
+    SB_BEGIN_3D(so, SHADE_MODEL, 1);
+    SB_DATA    (so, cso->flatshade ? NVC0_3D_SHADE_MODEL_FLAT :
+                                     NVC0_3D_SHADE_MODEL_SMOOTH);
+    SB_IMMED_3D(so, PROVOKING_VERTEX_LAST, !cso->flatshade_first);
+    SB_IMMED_3D(so, VERTEX_TWO_SIDE_ENABLE, cso->light_twoside);
+
+    SB_BEGIN_3D(so, LINE_WIDTH, 1);
+    SB_DATA    (so, fui(cso->line_width));
+    SB_IMMED_3D(so, LINE_SMOOTH_ENABLE, cso->line_smooth);
+
+    SB_BEGIN_3D(so, LINE_STIPPLE_ENABLE, 1);
+    if (cso->line_stipple_enable) {
+        SB_DATA    (so, 1);
+        SB_BEGIN_3D(so, LINE_STIPPLE_PATTERN, 1);
+        SB_DATA    (so, (cso->line_stipple_pattern << 8) |
+                         cso->line_stipple_factor);
+                    
+    } else {
+        SB_DATA    (so, 0);
+    }
+
+    SB_IMMED_3D(so, VP_POINT_SIZE_EN, cso->point_size_per_vertex);
+    if (!cso->point_size_per_vertex) {
+       SB_BEGIN_3D(so, POINT_SIZE, 1);
+       SB_DATA    (so, fui(cso->point_size));
+    }
+    SB_IMMED_3D(so, POINT_SPRITE_ENABLE, cso->point_quad_rasterization);
+    SB_IMMED_3D(so, POINT_SMOOTH_ENABLE, cso->point_smooth);
+
+    SB_BEGIN_3D(so, POLYGON_MODE_FRONT, 1);
+    SB_DATA    (so, nvgl_polygon_mode(cso->fill_front));
+    SB_BEGIN_3D(so, POLYGON_MODE_BACK, 1);
+    SB_DATA    (so, nvgl_polygon_mode(cso->fill_back));
+    SB_IMMED_3D(so, POLYGON_SMOOTH_ENABLE, cso->poly_smooth);
+
+    SB_BEGIN_3D(so, CULL_FACE_ENABLE, 3);
+    SB_DATA    (so, cso->cull_face != PIPE_FACE_NONE);
+    SB_DATA    (so, cso->front_ccw ? NVC0_3D_FRONT_FACE_CCW :
+                                     NVC0_3D_FRONT_FACE_CW);
+    switch (cso->cull_face) {
+    case PIPE_FACE_FRONT_AND_BACK:
+       SB_DATA(so, NVC0_3D_CULL_FACE_FRONT_AND_BACK);
+       break;
+    case PIPE_FACE_FRONT:
+       SB_DATA(so, NVC0_3D_CULL_FACE_FRONT);
+       break;
+    case PIPE_FACE_BACK:
+    default:
+       SB_DATA(so, NVC0_3D_CULL_FACE_BACK);
+       break;
+    }
+
+    SB_IMMED_3D(so, POLYGON_STIPPLE_ENABLE, cso->poly_stipple_enable);
+    SB_BEGIN_3D(so, POLYGON_OFFSET_POINT_ENABLE, 3);
+    SB_DATA    (so, cso->offset_point);
+    SB_DATA    (so, cso->offset_line);
+    SB_DATA    (so, cso->offset_tri);
+
+    if (cso->offset_point || cso->offset_line || cso->offset_tri) {
+        SB_BEGIN_3D(so, POLYGON_OFFSET_FACTOR, 1);
+        SB_DATA    (so, fui(cso->offset_scale));
+        SB_BEGIN_3D(so, POLYGON_OFFSET_UNITS, 1);
+        SB_DATA    (so, fui(cso->offset_units)); /* XXX: multiply by 2 ? */
+    }
+
+    assert(so->size < (sizeof(so->state) / sizeof(so->state[0])));
+    return (void *)so;
+}
+
+static void
+nvc0_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+   nvc0->rast = hwcso;
+   nvc0->dirty |= NVC0_NEW_RASTERIZER;
+}
+
+static void
+nvc0_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+   FREE(hwcso);
+}
+
+static void *
+nvc0_zsa_state_create(struct pipe_context *pipe,
+                      const struct pipe_depth_stencil_alpha_state *cso)
+{
+   struct nvc0_zsa_stateobj *so = CALLOC_STRUCT(nvc0_zsa_stateobj);
+
+   so->pipe = *cso;
+
+   SB_IMMED_3D(so, DEPTH_WRITE_ENABLE, cso->depth.writemask);
+   SB_BEGIN_3D(so, DEPTH_TEST_ENABLE, 1);
+   if (cso->depth.enabled) {
+      SB_DATA    (so, 1);
+      SB_BEGIN_3D(so, DEPTH_TEST_FUNC, 1);
+      SB_DATA    (so, nvgl_comparison_op(cso->depth.func));
+   } else {
+      SB_DATA    (so, 0);
+   }
+
+   if (cso->stencil[0].enabled) {
+      SB_BEGIN_3D(so, STENCIL_FRONT_ENABLE, 5);
+      SB_DATA    (so, 1);
+      SB_DATA    (so, nvgl_stencil_op(cso->stencil[0].fail_op));
+      SB_DATA    (so, nvgl_stencil_op(cso->stencil[0].zfail_op));
+      SB_DATA    (so, nvgl_stencil_op(cso->stencil[0].zpass_op));
+      SB_DATA    (so, nvgl_comparison_op(cso->stencil[0].func));
+      SB_BEGIN_3D(so, STENCIL_FRONT_MASK, 2);
+      SB_DATA    (so, cso->stencil[0].writemask);
+      SB_DATA    (so, cso->stencil[0].valuemask);
+   } else {
+      SB_IMMED_3D(so, STENCIL_FRONT_ENABLE, 0);
+   }
+
+   if (cso->stencil[1].enabled) {
+      SB_BEGIN_3D(so, STENCIL_TWO_SIDE_ENABLE, 5);
+      SB_DATA    (so, 1);
+      SB_DATA    (so, nvgl_stencil_op(cso->stencil[1].fail_op));
+      SB_DATA    (so, nvgl_stencil_op(cso->stencil[1].zfail_op));
+      SB_DATA    (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
+      SB_DATA    (so, nvgl_comparison_op(cso->stencil[1].func));
+      SB_BEGIN_3D(so, STENCIL_BACK_MASK, 2);
+      SB_DATA    (so, cso->stencil[1].writemask);
+      SB_DATA    (so, cso->stencil[1].valuemask);
+   } else {
+      SB_IMMED_3D(so, STENCIL_TWO_SIDE_ENABLE, 0);
+   }
+    
+   SB_BEGIN_3D(so, ALPHA_TEST_ENABLE, 1);
+   if (cso->alpha.enabled) {
+      SB_DATA    (so, 1);
+      SB_BEGIN_3D(so, ALPHA_TEST_REF, 2);
+      SB_DATA    (so, fui(cso->alpha.ref_value));
+      SB_DATA    (so, nvgl_comparison_op(cso->alpha.func));
+   } else {
+      SB_DATA    (so, 0);
+   }
+
+   assert(so->size < (sizeof(so->state) / sizeof(so->state[0])));
+   return (void *)so;
+}
+
+static void
+nvc0_zsa_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+   nvc0->zsa = hwcso;
+   nvc0->dirty |= NVC0_NEW_ZSA;
+}
+
+static void
+nvc0_zsa_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+   FREE(hwcso);
+}
+
+/* ====================== SAMPLERS AND TEXTURES ================================
+ */
+
+#define NV50_TSC_WRAP_CASE(n) \
+    case PIPE_TEX_WRAP_##n: return NV50_TSC_WRAP_##n
+
+static INLINE unsigned
+nv50_tsc_wrap_mode(unsigned wrap)
+{
+   switch (wrap) {
+   NV50_TSC_WRAP_CASE(REPEAT);
+   NV50_TSC_WRAP_CASE(MIRROR_REPEAT);
+   NV50_TSC_WRAP_CASE(CLAMP_TO_EDGE);
+   NV50_TSC_WRAP_CASE(CLAMP_TO_BORDER);
+   NV50_TSC_WRAP_CASE(CLAMP);
+   NV50_TSC_WRAP_CASE(MIRROR_CLAMP_TO_EDGE);
+   NV50_TSC_WRAP_CASE(MIRROR_CLAMP_TO_BORDER);
+   NV50_TSC_WRAP_CASE(MIRROR_CLAMP);
+   default:
+       NOUVEAU_ERR("unknown wrap mode: %d\n", wrap);
+       return NV50_TSC_WRAP_REPEAT;
+   }
+}
+
+static void *
+nvc0_sampler_state_create(struct pipe_context *pipe,
+                          const struct pipe_sampler_state *cso)
+{
+   struct nvc0_tsc_entry *so = CALLOC_STRUCT(nvc0_tsc_entry);
+   float f[2];
+
+   so->id = -1;
+
+   so->tsc[0] = (0x00026000 |
+                 (nv50_tsc_wrap_mode(cso->wrap_s) << 0) |
+                 (nv50_tsc_wrap_mode(cso->wrap_t) << 3) |
+                 (nv50_tsc_wrap_mode(cso->wrap_r) << 6));
+
+   switch (cso->mag_img_filter) {
+   case PIPE_TEX_FILTER_LINEAR:
+      so->tsc[1] |= NV50_TSC_1_MAGF_LINEAR;
+      break;
+   case PIPE_TEX_FILTER_NEAREST:
+   default:
+      so->tsc[1] |= NV50_TSC_1_MAGF_NEAREST;
+      break;
+   }
+
+   switch (cso->min_img_filter) {
+   case PIPE_TEX_FILTER_LINEAR:
+      so->tsc[1] |= NV50_TSC_1_MINF_LINEAR;
+      break;
+   case PIPE_TEX_FILTER_NEAREST:
+   default:
+      so->tsc[1] |= NV50_TSC_1_MINF_NEAREST;
+      break;
+   }
+
+   switch (cso->min_mip_filter) {
+   case PIPE_TEX_MIPFILTER_LINEAR:
+      so->tsc[1] |= NV50_TSC_1_MIPF_LINEAR;
+      break;
+   case PIPE_TEX_MIPFILTER_NEAREST:
+      so->tsc[1] |= NV50_TSC_1_MIPF_NEAREST;
+      break;
+   case PIPE_TEX_MIPFILTER_NONE:
+   default:
+      so->tsc[1] |= NV50_TSC_1_MIPF_NONE;
+      break;
+   }
+
+   if (cso->max_anisotropy >= 16)
+      so->tsc[0] |= (7 << 20);
+   else
+   if (cso->max_anisotropy >= 12)
+      so->tsc[0] |= (6 << 20);
+   else {
+      so->tsc[0] |= (cso->max_anisotropy >> 1) << 20;
+
+      if (cso->max_anisotropy >= 4)
+         so->tsc[1] |= NV50_TSC_1_UNKN_ANISO_35;
+      else
+      if (cso->max_anisotropy >= 2)
+         so->tsc[1] |= NV50_TSC_1_UNKN_ANISO_15;
+   }
+
+   if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
+      /* NOTE: must be deactivated for non-shadow textures */
+      so->tsc[0] |= (1 << 9);
+      so->tsc[0] |= (nvgl_comparison_op(cso->compare_func) & 0x7) << 10;
+   }
+
+   f[0] = CLAMP(cso->lod_bias, -16.0f, 15.0f);
+   so->tsc[1] |= ((int)(f[0] * 256.0f) & 0x1fff) << 12;
+
+   f[0] = CLAMP(cso->min_lod, 0.0f, 15.0f);
+   f[1] = CLAMP(cso->max_lod, 0.0f, 15.0f);
+   so->tsc[2] |=
+      (((int)(f[1] * 256.0f) & 0xfff) << 12) | ((int)(f[0] * 256.0f) & 0xfff);
+
+   so->tsc[4] = fui(cso->border_color[0]);
+   so->tsc[5] = fui(cso->border_color[1]);
+   so->tsc[6] = fui(cso->border_color[2]);
+   so->tsc[7] = fui(cso->border_color[3]);
+
+   return (void *)so;
+}
+
+static void
+nvc0_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+   unsigned s, i;
+
+   for (s = 0; s < 5; ++s)
+      for (i = 0; i < nvc0_context(pipe)->num_samplers[s]; ++i)
+         if (nvc0_context(pipe)->samplers[s][i] == hwcso)
+            nvc0_context(pipe)->samplers[s][i] = NULL;
+
+   nvc0_screen_tsc_free(nvc0_context(pipe)->screen, nvc0_tsc_entry(hwcso));
+
+   FREE(hwcso);
+}
+
+static INLINE void
+nvc0_stage_sampler_states_bind(struct nvc0_context *nvc0, int s,
+                               unsigned nr, void **hwcso)
+{
+   unsigned i;
+
+   for (i = 0; i < nr; ++i) {
+      struct nvc0_tsc_entry *old = nvc0->samplers[s][i];
+
+      nvc0->samplers[s][i] = nvc0_tsc_entry(hwcso[i]);
+      if (old)
+         nvc0_screen_tsc_unlock(nvc0->screen, old);
+   }
+   for (; i < nvc0->num_samplers[s]; ++i)
+      if (nvc0->samplers[s][i])
+         nvc0_screen_tsc_unlock(nvc0->screen, nvc0->samplers[s][i]);
+
+   nvc0->num_samplers[s] = nr;
+
+   nvc0->dirty |= NVC0_NEW_SAMPLERS;
+}
+
+static void
+nvc0_vp_sampler_states_bind(struct pipe_context *pipe, unsigned nr, void **s)
+{
+   nvc0_stage_sampler_states_bind(nvc0_context(pipe), 0, nr, s);
+}
+
+static void
+nvc0_fp_sampler_states_bind(struct pipe_context *pipe, unsigned nr, void **s)
+{
+   nvc0_stage_sampler_states_bind(nvc0_context(pipe), 4, nr, s);
+}
+
+static void
+nvc0_gp_sampler_states_bind(struct pipe_context *pipe, unsigned nr, void **s)
+{
+   nvc0_stage_sampler_states_bind(nvc0_context(pipe), 3, nr, s);
+}
+
+/* NOTE: only called when not referenced anywhere, won't be bound */
+static void
+nvc0_sampler_view_destroy(struct pipe_context *pipe,
+                          struct pipe_sampler_view *view)
+{
+   pipe_resource_reference(&view->texture, NULL);
+
+   nvc0_screen_tic_free(nvc0_context(pipe)->screen, nvc0_tic_entry(view));
+
+   FREE(nvc0_tic_entry(view));
+}
+
+static INLINE void
+nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s,
+                             unsigned nr,
+                             struct pipe_sampler_view **views)
+{
+   unsigned i;
+
+   for (i = 0; i < nr; ++i) {
+      struct nvc0_tic_entry *old = nvc0_tic_entry(nvc0->textures[s][i]);
+      if (old)
+         nvc0_screen_tic_unlock(nvc0->screen, old);
+
+      pipe_sampler_view_reference(&nvc0->textures[s][i], views[i]);
+   }
+
+   for (i = nr; i < nvc0->num_textures[s]; ++i) {
+      struct nvc0_tic_entry *old = nvc0_tic_entry(nvc0->textures[s][i]);
+      if (!old)
+         continue;
+      nvc0_screen_tic_unlock(nvc0->screen, old);
+
+      pipe_sampler_view_reference(&nvc0->textures[s][i], NULL);
+   }
+
+   nvc0->num_textures[s] = nr;
+
+   nvc0_bufctx_reset(nvc0, NVC0_BUFCTX_TEXTURES);
+
+   nvc0->dirty |= NVC0_NEW_TEXTURES;
+}
+
+static void
+nvc0_vp_set_sampler_views(struct pipe_context *pipe,
+                          unsigned nr,
+                          struct pipe_sampler_view **views)
+{
+   nvc0_stage_set_sampler_views(nvc0_context(pipe), 0, nr, views);
+}
+
+static void
+nvc0_fp_set_sampler_views(struct pipe_context *pipe,
+                          unsigned nr,
+                          struct pipe_sampler_view **views)
+{
+   nvc0_stage_set_sampler_views(nvc0_context(pipe), 4, nr, views);
+}
+
+static void
+nvc0_gp_set_sampler_views(struct pipe_context *pipe,
+                          unsigned nr,
+                          struct pipe_sampler_view **views)
+{
+   nvc0_stage_set_sampler_views(nvc0_context(pipe), 3, nr, views);
+}
+
+/* ============================= SHADERS =======================================
+ */
+
+static void *
+nvc0_sp_state_create(struct pipe_context *pipe,
+                     const struct pipe_shader_state *cso, unsigned type)
+{
+   struct nvc0_program *prog;
+
+   prog = CALLOC_STRUCT(nvc0_program);
+   if (!prog)
+      return NULL;
+
+   prog->type = type;
+   prog->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+
+   return (void *)prog;
+}
+
+static void
+nvc0_sp_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+   struct nvc0_program *prog = (struct nvc0_program *)hwcso;
+
+   nvc0_program_destroy(nvc0_context(pipe), prog);
+
+   FREE((void *)prog->pipe.tokens);
+   FREE(prog);
+}
+
+static void *
+nvc0_vp_state_create(struct pipe_context *pipe,
+                     const struct pipe_shader_state *cso)
+{
+   return nvc0_sp_state_create(pipe, cso, PIPE_SHADER_VERTEX);
+}
+
+static void
+nvc0_vp_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->vertprog = hwcso;
+    nvc0->dirty |= NVC0_NEW_VERTPROG;
+}
+
+static void *
+nvc0_fp_state_create(struct pipe_context *pipe,
+                     const struct pipe_shader_state *cso)
+{
+   return nvc0_sp_state_create(pipe, cso, PIPE_SHADER_FRAGMENT);
+}
+
+static void
+nvc0_fp_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->fragprog = hwcso;
+    nvc0->dirty |= NVC0_NEW_FRAGPROG;
+}
+
+static void *
+nvc0_gp_state_create(struct pipe_context *pipe,
+                     const struct pipe_shader_state *cso)
+{
+   return nvc0_sp_state_create(pipe, cso, PIPE_SHADER_GEOMETRY);
+}
+
+static void
+nvc0_gp_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->gmtyprog = hwcso;
+    nvc0->dirty |= NVC0_NEW_GMTYPROG;
+}
+
+static void
+nvc0_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
+                         struct pipe_resource *res)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+   switch (shader) {
+   case PIPE_SHADER_VERTEX: shader = 0; break;
+      /*
+   case PIPE_SHADER_TESSELLATION_CONTROL: shader = 1; break;
+   case PIPE_SHADER_TESSELLATION_EVALUATION: shader = 2; break;
+      */
+   case PIPE_SHADER_GEOMETRY: shader = 3; break;
+   case PIPE_SHADER_FRAGMENT: shader = 4; break;
+   default:
+      assert(0);
+      break;
+   }
+
+   if (nvc0->constbuf[shader][index])
+      nvc0_bufctx_del_resident(nvc0, NVC0_BUFCTX_CONSTANT,
+                              nvc0_resource(
+                                      nvc0->constbuf[shader][index]));
+
+   pipe_resource_reference(&nvc0->constbuf[shader][index], res);
+
+   nvc0->constbuf_dirty[shader] |= 1 << index;
+
+   nvc0->dirty |= NVC0_NEW_CONSTBUF;
+}
+
+/* =============================================================================
+ */
+
+static void
+nvc0_set_blend_color(struct pipe_context *pipe,
+                     const struct pipe_blend_color *bcol)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->blend_colour = *bcol;
+    nvc0->dirty |= NVC0_NEW_BLEND_COLOUR;
+}
+
+static void
+nvc0_set_stencil_ref(struct pipe_context *pipe,
+                     const struct pipe_stencil_ref *sr)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->stencil_ref = *sr;
+    nvc0->dirty |= NVC0_NEW_STENCIL_REF;
+}
+
+static void
+nvc0_set_clip_state(struct pipe_context *pipe,
+                    const struct pipe_clip_state *clip)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+    const unsigned size = clip->nr * sizeof(clip->ucp[0]);
+
+    memcpy(&nvc0->clip.ucp[0][0], &clip->ucp[0][0], size);
+    nvc0->clip.nr = clip->nr;
+
+    nvc0->clip.depth_clamp = clip->depth_clamp;
+
+    nvc0->dirty |= NVC0_NEW_CLIP;
+}
+
+static void
+nvc0_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->sample_mask = sample_mask;
+    nvc0->dirty |= NVC0_NEW_SAMPLE_MASK;
+}
+
+
+static void
+nvc0_set_framebuffer_state(struct pipe_context *pipe,
+                           const struct pipe_framebuffer_state *fb)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->framebuffer = *fb;
+    nvc0->dirty |= NVC0_NEW_FRAMEBUFFER;
+}
+
+static void
+nvc0_set_polygon_stipple(struct pipe_context *pipe,
+                         const struct pipe_poly_stipple *stipple)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->stipple = *stipple;
+    nvc0->dirty |= NVC0_NEW_STIPPLE;
+}
+
+static void
+nvc0_set_scissor_state(struct pipe_context *pipe,
+                       const struct pipe_scissor_state *scissor)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->scissor = *scissor;
+    nvc0->dirty |= NVC0_NEW_SCISSOR;
+}
+
+static void
+nvc0_set_viewport_state(struct pipe_context *pipe,
+                        const struct pipe_viewport_state *vpt)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->viewport = *vpt;
+    nvc0->dirty |= NVC0_NEW_VIEWPORT;
+}
+
+static void
+nvc0_set_vertex_buffers(struct pipe_context *pipe,
+                        unsigned count,
+                        const struct pipe_vertex_buffer *vb)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+    unsigned i;
+
+    for (i = 0; i < count; ++i)
+       pipe_resource_reference(&nvc0->vtxbuf[i].buffer, vb[i].buffer);
+    for (; i < nvc0->num_vtxbufs; ++i)
+       pipe_resource_reference(&nvc0->vtxbuf[i].buffer, NULL);
+
+    memcpy(nvc0->vtxbuf, vb, sizeof(*vb) * count);
+    nvc0->num_vtxbufs = count;
+
+    nvc0_bufctx_reset(nvc0, NVC0_BUFCTX_VERTEX);
+
+    nvc0->dirty |= NVC0_NEW_ARRAYS;
+}
+
+static void
+nvc0_set_index_buffer(struct pipe_context *pipe,
+                      const struct pipe_index_buffer *ib)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    if (ib)
+        memcpy(&nvc0->idxbuf, ib, sizeof(nvc0->idxbuf));
+    else
+        nvc0->idxbuf.buffer = NULL;
+}
+
+static void
+nvc0_vertex_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+    struct nvc0_context *nvc0 = nvc0_context(pipe);
+
+    nvc0->vertex = hwcso;
+    nvc0->dirty |= NVC0_NEW_VERTEX;
+}
+
+void
+nvc0_init_state_functions(struct nvc0_context *nvc0)
+{
+    nvc0->pipe.create_blend_state = nvc0_blend_state_create;
+    nvc0->pipe.bind_blend_state = nvc0_blend_state_bind;
+    nvc0->pipe.delete_blend_state = nvc0_blend_state_delete;
+
+    nvc0->pipe.create_rasterizer_state = nvc0_rasterizer_state_create;
+    nvc0->pipe.bind_rasterizer_state = nvc0_rasterizer_state_bind;
+    nvc0->pipe.delete_rasterizer_state = nvc0_rasterizer_state_delete;
+
+    nvc0->pipe.create_depth_stencil_alpha_state = nvc0_zsa_state_create;
+    nvc0->pipe.bind_depth_stencil_alpha_state = nvc0_zsa_state_bind;
+    nvc0->pipe.delete_depth_stencil_alpha_state = nvc0_zsa_state_delete;
+
+    nvc0->pipe.create_sampler_state = nvc0_sampler_state_create;
+    nvc0->pipe.delete_sampler_state = nvc0_sampler_state_delete;
+    nvc0->pipe.bind_vertex_sampler_states   = nvc0_vp_sampler_states_bind;
+    nvc0->pipe.bind_fragment_sampler_states = nvc0_fp_sampler_states_bind;
+    nvc0->pipe.bind_geometry_sampler_states = nvc0_gp_sampler_states_bind;
+
+    nvc0->pipe.create_sampler_view = nvc0_create_sampler_view;
+    nvc0->pipe.sampler_view_destroy = nvc0_sampler_view_destroy;
+    nvc0->pipe.set_vertex_sampler_views   = nvc0_vp_set_sampler_views;
+    nvc0->pipe.set_fragment_sampler_views = nvc0_fp_set_sampler_views;
+    nvc0->pipe.set_geometry_sampler_views = nvc0_gp_set_sampler_views;
+
+    nvc0->pipe.create_vs_state = nvc0_vp_state_create;
+    nvc0->pipe.create_fs_state = nvc0_fp_state_create;
+    nvc0->pipe.create_gs_state = nvc0_gp_state_create;
+    nvc0->pipe.bind_vs_state = nvc0_vp_state_bind;
+    nvc0->pipe.bind_fs_state = nvc0_fp_state_bind;
+    nvc0->pipe.bind_gs_state = nvc0_gp_state_bind;
+    nvc0->pipe.delete_vs_state = nvc0_sp_state_delete;
+    nvc0->pipe.delete_fs_state = nvc0_sp_state_delete;
+    nvc0->pipe.delete_gs_state = nvc0_sp_state_delete;
+
+    nvc0->pipe.set_blend_color = nvc0_set_blend_color;
+    nvc0->pipe.set_stencil_ref = nvc0_set_stencil_ref;
+    nvc0->pipe.set_clip_state = nvc0_set_clip_state;
+    nvc0->pipe.set_sample_mask = nvc0_set_sample_mask;
+    nvc0->pipe.set_constant_buffer = nvc0_set_constant_buffer;
+    nvc0->pipe.set_framebuffer_state = nvc0_set_framebuffer_state;
+    nvc0->pipe.set_polygon_stipple = nvc0_set_polygon_stipple;
+    nvc0->pipe.set_scissor_state = nvc0_set_scissor_state;
+    nvc0->pipe.set_viewport_state = nvc0_set_viewport_state;
+
+    nvc0->pipe.create_vertex_elements_state = nvc0_vertex_state_create;
+    nvc0->pipe.delete_vertex_elements_state = nvc0_vertex_state_delete;
+    nvc0->pipe.bind_vertex_elements_state = nvc0_vertex_state_bind;
+
+    nvc0->pipe.set_vertex_buffers = nvc0_set_vertex_buffers;
+    nvc0->pipe.set_index_buffer = nvc0_set_index_buffer;
+}
+
diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c
new file mode 100644 (file)
index 0000000..25aec02
--- /dev/null
@@ -0,0 +1,430 @@
+
+#include "nvc0_context.h"
+#include "os/os_time.h"
+
+static void
+nvc0_validate_zcull(struct nvc0_context *nvc0)
+{
+    struct nouveau_channel *chan = nvc0->screen->base.channel;
+    struct pipe_framebuffer_state *fb = &nvc0->framebuffer;
+    struct nvc0_surface *sf = nvc0_surface(fb->zsbuf);
+    struct nvc0_miptree *mt = nvc0_miptree(sf->base.texture);
+    struct nouveau_bo *bo = mt->base.bo;
+    uint32_t size;
+    uint32_t offset = align(mt->total_size, 1 << 17);
+    unsigned width, height;
+
+    assert(mt->base.base.depth0 == 1 && mt->base.base.array_size < 2);
+
+    size = mt->total_size * 2;
+
+    height = align(fb->height, 32);
+    width = fb->width % 224;
+    if (width)
+       width = fb->width + (224 - width);
+    else
+       width = fb->width;
+
+    BEGIN_RING(chan, RING_3D_(0x1590), 1); /* ZCULL_REGION_INDEX (bits 0x3f) */
+    OUT_RING  (chan, 0);
+    BEGIN_RING(chan, RING_3D_(0x07e8), 2); /* ZCULL_ADDRESS_A_HIGH */
+    OUT_RELOCh(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+    OUT_RELOCl(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+    offset += 1 << 17;
+    BEGIN_RING(chan, RING_3D_(0x07f0), 2); /* ZCULL_ADDRESS_B_HIGH */
+    OUT_RELOCh(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+    OUT_RELOCl(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+    BEGIN_RING(chan, RING_3D_(0x07e0), 2);
+    OUT_RING  (chan, size);
+    OUT_RING  (chan, size >> 16);
+    BEGIN_RING(chan, RING_3D_(0x15c8), 1); /* bits 0x3 */
+    OUT_RING  (chan, 2);
+    BEGIN_RING(chan, RING_3D_(0x07c0), 4); /* ZCULL dimensions */
+    OUT_RING  (chan, width);
+    OUT_RING  (chan, height);
+    OUT_RING  (chan, 1);
+    OUT_RING  (chan, 0);
+    BEGIN_RING(chan, RING_3D_(0x15fc), 2);
+    OUT_RING  (chan, 0); /* bits 0xffff */
+    OUT_RING  (chan, 0); /* bits 0xffff */
+    BEGIN_RING(chan, RING_3D_(0x1958), 1);
+    OUT_RING  (chan, 0); /* bits ~0 */
+}
+
+static void
+nvc0_validate_fb(struct nvc0_context *nvc0)
+{
+    struct nouveau_channel *chan = nvc0->screen->base.channel;
+    struct pipe_framebuffer_state *fb = &nvc0->framebuffer;
+    unsigned i;
+
+    nvc0_bufctx_reset(nvc0, NVC0_BUFCTX_FRAME);
+
+    BEGIN_RING(chan, RING_3D(RT_CONTROL), 1);
+    OUT_RING  (chan, (076543210 << 4) | fb->nr_cbufs);
+    BEGIN_RING(chan, RING_3D(SCREEN_SCISSOR_HORIZ), 2);
+    OUT_RING  (chan, fb->width << 16);
+    OUT_RING  (chan, fb->height << 16);
+
+    for (i = 0; i < fb->nr_cbufs; ++i) {
+        struct nvc0_miptree *mt = nvc0_miptree(fb->cbufs[i]->texture);
+        struct nvc0_surface *sf = nvc0_surface(fb->cbufs[i]);
+        struct nouveau_bo *bo = mt->base.bo;
+        uint32_t offset = sf->offset;
+        
+        BEGIN_RING(chan, RING_3D(RT_ADDRESS_HIGH(i)), 8);
+        OUT_RELOCh(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+        OUT_RELOCl(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+        OUT_RING  (chan, sf->width);
+        OUT_RING  (chan, sf->height);
+        OUT_RING  (chan, nvc0_format_table[sf->base.format].rt);
+        OUT_RING  (chan, (mt->layout_3d << 16) |
+                   mt->level[sf->base.u.tex.level].tile_mode);
+        OUT_RING  (chan, sf->depth);
+        OUT_RING  (chan, mt->layer_stride >> 2);
+
+        nvc0_bufctx_add_resident(nvc0, NVC0_BUFCTX_FRAME, &mt->base,
+                                 NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+    }
+
+    if (fb->zsbuf) {
+        struct nvc0_miptree *mt = nvc0_miptree(fb->zsbuf->texture);
+        struct nvc0_surface *sf = nvc0_surface(fb->zsbuf);
+        struct nouveau_bo *bo = mt->base.bo;
+        int unk = mt->base.base.target == PIPE_TEXTURE_2D;
+        uint32_t offset = sf->offset;
+        
+        BEGIN_RING(chan, RING_3D(ZETA_ADDRESS_HIGH), 5);
+        OUT_RELOCh(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+        OUT_RELOCl(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+        OUT_RING  (chan, nvc0_format_table[fb->zsbuf->format].rt);
+        OUT_RING  (chan, mt->level[sf->base.u.tex.level].tile_mode);
+        OUT_RING  (chan, mt->layer_stride >> 2);
+        BEGIN_RING(chan, RING_3D(ZETA_ENABLE), 1);
+        OUT_RING  (chan, 1);
+        BEGIN_RING(chan, RING_3D(ZETA_HORIZ), 3);
+        OUT_RING  (chan, sf->width);
+        OUT_RING  (chan, sf->height);
+        OUT_RING  (chan, (unk << 16) | sf->depth);
+
+        nvc0_bufctx_add_resident(nvc0, NVC0_BUFCTX_FRAME, &mt->base,
+                                 NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+    } else {
+        BEGIN_RING(chan, RING_3D(ZETA_ENABLE), 1);
+        OUT_RING  (chan, 0);
+    }
+
+#ifndef NVC0_SCISSORS_CLIPPING
+    BEGIN_RING(chan, RING_3D(VIEWPORT_HORIZ(0)), 2);
+    OUT_RING  (chan, fb->width << 16);
+    OUT_RING  (chan, fb->height << 16);
+#endif
+}
+
+static void
+nvc0_validate_blend_colour(struct nvc0_context *nvc0)
+{
+    struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+    BEGIN_RING(chan, RING_3D(BLEND_COLOR(0)), 4);
+    OUT_RINGf (chan, nvc0->blend_colour.color[0]);
+    OUT_RINGf (chan, nvc0->blend_colour.color[1]);
+    OUT_RINGf (chan, nvc0->blend_colour.color[2]);
+    OUT_RINGf (chan, nvc0->blend_colour.color[3]);    
+}
+
+static void
+nvc0_validate_stencil_ref(struct nvc0_context *nvc0)
+{
+    struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+    BEGIN_RING(chan, RING_3D(STENCIL_FRONT_FUNC_REF), 1);
+    OUT_RING  (chan, nvc0->stencil_ref.ref_value[0]);
+    BEGIN_RING(chan, RING_3D(STENCIL_BACK_FUNC_REF), 1);
+    OUT_RING  (chan, nvc0->stencil_ref.ref_value[1]);
+}
+
+static void
+nvc0_validate_stipple(struct nvc0_context *nvc0)
+{
+    struct nouveau_channel *chan = nvc0->screen->base.channel;
+    unsigned i;
+
+    BEGIN_RING(chan, RING_3D(POLYGON_STIPPLE_PATTERN(0)), 32);
+    for (i = 0; i < 32; ++i)
+        OUT_RING(chan, util_bswap32(nvc0->stipple.stipple[i]));
+}
+
+static void
+nvc0_validate_scissor(struct nvc0_context *nvc0)
+{
+    struct nouveau_channel *chan = nvc0->screen->base.channel;
+    struct pipe_scissor_state *s = &nvc0->scissor;
+#ifdef NVC0_SCISSORS_CLIPPING
+    struct pipe_viewport_state *vp = &nvc0->viewport;
+    int minx, maxx, miny, maxy;
+
+    if (!(nvc0->dirty &
+          (NVC0_NEW_SCISSOR | NVC0_NEW_VIEWPORT | NVC0_NEW_FRAMEBUFFER)) &&
+        nvc0->state.scissor == nvc0->rast->pipe.scissor)
+       return;
+    nvc0->state.scissor = nvc0->rast->pipe.scissor;
+
+    if (nvc0->state.scissor) {
+       minx = s->minx;
+       maxx = s->maxx;
+       miny = s->miny;
+       maxy = s->maxy;
+    } else {
+       minx = 0;
+       maxx = nvc0->framebuffer.width;
+       miny = 0;
+       maxy = nvc0->framebuffer.height;
+    }
+
+    minx = MAX2(minx, (int)(vp->translate[0] - fabsf(vp->scale[0])));
+    maxx = MIN2(maxx, (int)(vp->translate[0] + fabsf(vp->scale[0])));
+    miny = MAX2(miny, (int)(vp->translate[1] - fabsf(vp->scale[1])));
+    maxy = MIN2(maxy, (int)(vp->translate[1] + fabsf(vp->scale[1])));
+
+    BEGIN_RING(chan, RING_3D(SCISSOR_HORIZ(0)), 2);
+    OUT_RING  (chan, (maxx << 16) | minx);
+    OUT_RING  (chan, (maxy << 16) | miny);
+    BEGIN_RING(chan, RING_3D(VIEWPORT_HORIZ(0)), 2);
+    OUT_RING  (chan, ((maxx - minx) << 16) | minx);
+    OUT_RING  (chan, ((maxy - miny) << 16) | miny);
+#else
+    BEGIN_RING(chan, RING_3D(SCISSOR_HORIZ(0)), 2);
+    OUT_RING  (chan, (s->maxx << 16) | s->minx);
+    OUT_RING  (chan, (s->maxy << 16) | s->miny);
+#endif
+}
+
+static void
+nvc0_validate_viewport(struct nvc0_context *nvc0)
+{
+    struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+    BEGIN_RING(chan, RING_3D(VIEWPORT_TRANSLATE_X(0)), 3);
+    OUT_RINGf (chan, nvc0->viewport.translate[0]);
+    OUT_RINGf (chan, nvc0->viewport.translate[1]);
+    OUT_RINGf (chan, nvc0->viewport.translate[2]);
+    BEGIN_RING(chan, RING_3D(VIEWPORT_SCALE_X(0)), 3);
+    OUT_RINGf (chan, nvc0->viewport.scale[0]);
+    OUT_RINGf (chan, nvc0->viewport.scale[1]);
+    OUT_RINGf (chan, nvc0->viewport.scale[2]);
+
+#ifdef NVC0_SCISSORS_CLIPPING
+    BEGIN_RING(chan, RING_3D(DEPTH_RANGE_NEAR(0)), 2);
+    OUT_RINGf (chan, nvc0->viewport.translate[2] - nvc0->viewport.scale[2]);
+    OUT_RINGf (chan, nvc0->viewport.translate[2] + nvc0->viewport.scale[2]);
+#endif
+}
+
+static void
+nvc0_validate_clip(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   uint32_t clip;
+
+   clip = nvc0->clip.depth_clamp ? 0x201a : 0x0002;
+#ifndef NVC0_SCISSORS_CLIPPING
+   clip |= 0x1080;
+#endif
+
+   BEGIN_RING(chan, RING_3D(VIEW_VOLUME_CLIP_CTRL), 1);
+   OUT_RING  (chan, clip);
+
+   if (nvc0->clip.nr) {
+      struct nouveau_bo *bo = nvc0->screen->uniforms;
+
+      BEGIN_RING(chan, RING_3D(CB_SIZE), 3);
+      OUT_RING  (chan, 256);
+      OUT_RELOCh(chan, bo, 5 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+      OUT_RELOCl(chan, bo, 5 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+      BEGIN_RING_1I(chan, RING_3D(CB_POS), nvc0->clip.nr * 4 + 1);
+      OUT_RING  (chan, 0);
+      OUT_RINGp (chan, &nvc0->clip.ucp[0][0], nvc0->clip.nr * 4);
+
+      BEGIN_RING(chan, RING_3D(VP_CLIP_DISTANCE_ENABLE), 1);
+      OUT_RING  (chan, (1 << nvc0->clip.nr) - 1);
+   } else {
+      IMMED_RING(chan, RING_3D(VP_CLIP_DISTANCE_ENABLE), 0);
+   }
+}
+
+static void
+nvc0_validate_blend(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+   WAIT_RING(chan, nvc0->blend->size);
+   OUT_RINGp(chan, nvc0->blend->state, nvc0->blend->size);
+}
+
+static void
+nvc0_validate_zsa(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+   WAIT_RING(chan, nvc0->zsa->size);
+   OUT_RINGp(chan, nvc0->zsa->state, nvc0->zsa->size);
+}
+
+static void
+nvc0_validate_rasterizer(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+   WAIT_RING(chan, nvc0->rast->size);
+   OUT_RINGp(chan, nvc0->rast->state, nvc0->rast->size);
+}
+
+static void
+nvc0_constbufs_validate(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nouveau_bo *bo;
+   unsigned s;
+
+   for (s = 0; s < 5; ++s) {
+      struct nvc0_resource *res;
+      int i;
+
+      while (nvc0->constbuf_dirty[s]) {
+         unsigned base = 0;
+         unsigned offset = 0, words = 0;
+         boolean rebind = TRUE;
+
+         i = ffs(nvc0->constbuf_dirty[s]) - 1;
+         nvc0->constbuf_dirty[s] &= ~(1 << i);
+
+         res = nvc0_resource(nvc0->constbuf[s][i]);
+         if (!res) {
+            BEGIN_RING(chan, RING_3D(CB_BIND(s)), 1);
+            OUT_RING  (chan, (i << 4) | 0);
+            if (i == 0)
+               nvc0->state.uniform_buffer_bound[s] = 0;
+            continue;
+         }
+
+         if (!nvc0_resource_mapped_by_gpu(&res->base)) {
+            if (i == 0) {
+               base = s << 16;
+               bo = nvc0->screen->uniforms;
+
+               if (nvc0->state.uniform_buffer_bound[s] >= res->base.width0)
+                  rebind = FALSE;
+               else
+                  nvc0->state.uniform_buffer_bound[s] =
+                     align(res->base.width0, 0x100);
+            } else {
+               bo = res->bo;
+            }
+#if 0
+            nvc0_m2mf_push_linear(nvc0, bo, NOUVEAU_BO_VRAM,
+                                  base, res->base.width0, res->data);
+            BEGIN_RING(chan, RING_3D_(0x021c), 1);
+            OUT_RING  (chan, 0x1111);
+#else
+            words = res->base.width0 / 4;
+#endif
+         } else {
+            bo = res->bo;
+            if (i == 0)
+               nvc0->state.uniform_buffer_bound[s] = 0;
+         }
+
+         if (bo != nvc0->screen->uniforms)
+            nvc0_bufctx_add_resident(nvc0, NVC0_BUFCTX_CONSTANT, res,
+                                     NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+
+         if (rebind) {
+            BEGIN_RING(chan, RING_3D(CB_SIZE), 3);
+            OUT_RING  (chan, align(res->base.width0, 0x100));
+            OUT_RELOCh(chan, bo, base, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+            OUT_RELOCl(chan, bo, base, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+            BEGIN_RING(chan, RING_3D(CB_BIND(s)), 1);
+            OUT_RING  (chan, (i << 4) | 1);
+         }
+
+         while (words) {
+            unsigned nr = AVAIL_RING(chan);
+
+            if (nr < 16) {
+               FIRE_RING(chan);
+               continue;
+            }
+            nr = MIN2(MIN2(nr - 6, words), NV04_PFIFO_MAX_PACKET_LEN - 1);
+
+            BEGIN_RING(chan, RING_3D(CB_SIZE), 3);
+            OUT_RING  (chan, align(res->base.width0, 0x100));
+            OUT_RELOCh(chan, bo, base, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+            OUT_RELOCl(chan, bo, base, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+            BEGIN_RING_1I(chan, RING_3D(CB_POS), nr + 1);
+            OUT_RING  (chan, offset);
+            OUT_RINGp (chan, &res->data[offset], nr);
+
+            offset += nr * 4;
+            words -= nr;
+         }
+      }
+   }
+}
+
+static struct state_validate {
+    void (*func)(struct nvc0_context *);
+    uint32_t states;
+} validate_list[] = {
+    { nvc0_validate_fb,            NVC0_NEW_FRAMEBUFFER },
+    { nvc0_validate_blend,         NVC0_NEW_BLEND },
+    { nvc0_validate_zsa,           NVC0_NEW_ZSA },
+    { nvc0_validate_rasterizer,    NVC0_NEW_RASTERIZER },
+    { nvc0_validate_blend_colour,  NVC0_NEW_BLEND_COLOUR },
+    { nvc0_validate_stencil_ref,   NVC0_NEW_STENCIL_REF },
+    { nvc0_validate_stipple,       NVC0_NEW_STIPPLE },
+#ifdef NVC0_SCISSORS_CLIPPING
+    { nvc0_validate_scissor,       NVC0_NEW_SCISSOR | NVC0_NEW_VIEWPORT |
+                                   NVC0_NEW_RASTERIZER |
+                                   NVC0_NEW_FRAMEBUFFER },
+#else
+    { nvc0_validate_scissor,       NVC0_NEW_SCISSOR },
+#endif
+    { nvc0_validate_viewport,      NVC0_NEW_VIEWPORT },
+    { nvc0_validate_clip,          NVC0_NEW_CLIP },
+    { nvc0_vertprog_validate,      NVC0_NEW_VERTPROG },
+    { nvc0_tctlprog_validate,      NVC0_NEW_TCTLPROG },
+    { nvc0_tevlprog_validate,      NVC0_NEW_TEVLPROG },
+    { nvc0_gmtyprog_validate,      NVC0_NEW_GMTYPROG },
+    { nvc0_fragprog_validate,      NVC0_NEW_FRAGPROG },
+    { nvc0_constbufs_validate,     NVC0_NEW_CONSTBUF },
+    { nvc0_validate_textures,      NVC0_NEW_TEXTURES },
+    { nvc0_validate_samplers,      NVC0_NEW_SAMPLERS },
+    { nvc0_vertex_arrays_validate, NVC0_NEW_VERTEX | NVC0_NEW_ARRAYS }
+};
+#define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))
+
+boolean
+nvc0_state_validate(struct nvc0_context *nvc0)
+{
+   unsigned i;
+#if 0
+   if (nvc0->screen->cur_ctx != nvc0) /* FIXME: not everything is valid */
+      nvc0->dirty = 0xffffffff;
+#endif
+   nvc0->screen->cur_ctx = nvc0;
+
+   if (nvc0->dirty) {
+      for (i = 0; i < validate_list_len; ++i) {
+         struct state_validate *validate = &validate_list[i];
+
+         if (nvc0->dirty & validate->states)
+            validate->func(nvc0);
+      }
+      nvc0->dirty = 0;
+   }
+
+   nvc0_bufctx_emit_relocs(nvc0);
+
+   return TRUE;
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_stateobj.h b/src/gallium/drivers/nvc0/nvc0_stateobj.h
new file mode 100644 (file)
index 0000000..ee788c5
--- /dev/null
@@ -0,0 +1,81 @@
+
+#ifndef __NVC0_STATEOBJ_H__
+#define __NVC0_STATEOBJ_H__
+
+#include "pipe/p_state.h"
+
+#define NVC0_SCISSORS_CLIPPING
+
+#define SB_BEGIN_3D(so, m, s)                                                  \
+   (so)->state[(so)->size++] =                                                 \
+      (0x2 << 28) | ((s) << 16) | (NVC0_SUBCH_3D << 13) | ((NVC0_3D_##m) >> 2)
+
+#define SB_IMMED_3D(so, m, d)                                                  \
+   (so)->state[(so)->size++] =                                                 \
+      (0x8 << 28) | ((d) << 16) | (NVC0_SUBCH_3D << 13) | ((NVC0_3D_##m) >> 2)
+
+#define SB_DATA(so, u) (so)->state[(so)->size++] = (u)
+
+struct nvc0_blend_stateobj {
+   struct pipe_blend_state pipe;
+   int size;
+   uint32_t state[72];
+};
+
+struct nvc0_tsc_entry {
+   int id;
+   uint32_t tsc[8];
+};
+
+static INLINE struct nvc0_tsc_entry *
+nvc0_tsc_entry(void *hwcso)
+{
+   return (struct nvc0_tsc_entry *)hwcso;
+}
+
+struct nvc0_tic_entry {
+   struct pipe_sampler_view pipe;
+   int id;
+   uint32_t tic[8];
+};
+
+static INLINE struct nvc0_tic_entry *
+nvc0_tic_entry(struct pipe_sampler_view *view)
+{
+   return (struct nvc0_tic_entry *)view;
+}
+
+struct nvc0_rasterizer_stateobj {
+   struct pipe_rasterizer_state pipe;
+   int size;
+   uint32_t state[36];
+};
+
+struct nvc0_zsa_stateobj {
+   struct pipe_depth_stencil_alpha_state pipe;
+   int size;
+   uint32_t state[29];
+};
+
+struct nvc0_vertex_element {
+   struct pipe_vertex_element pipe;
+   uint32_t state;
+};
+
+struct nvc0_vertex_stateobj {
+   struct translate *translate;
+   unsigned num_elements;
+   uint32_t instance_bits;
+   unsigned vtx_size;
+   unsigned vtx_per_packet_max;
+   struct nvc0_vertex_element element[1];
+};
+
+/* will have to lookup index -> location qualifier from nvc0_program */
+struct nvc0_tfb_state {
+   uint8_t varying_count[4];
+   uint32_t stride[4];
+   uint8_t varying_indices[1];
+};
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c
new file mode 100644 (file)
index 0000000..cc0a656
--- /dev/null
@@ -0,0 +1,377 @@
+/*
+ * Copyright 2008 Ben Skeggs
+ *
+ * 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.
+ */
+
+#include <stdint.h>
+
+#include "pipe/p_defines.h"
+
+#include "util/u_inlines.h"
+#include "util/u_pack_color.h"
+#include "util/u_format.h"
+
+#include "nvc0_context.h"
+#include "nvc0_resource.h"
+
+#include "nv50_defs.xml.h"
+
+/* return TRUE for formats that can be converted among each other by NVC0_2D */
+static INLINE boolean
+nvc0_2d_format_faithful(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_B8G8R8A8_UNORM:
+   case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_B8G8R8A8_SRGB:
+   case PIPE_FORMAT_B8G8R8X8_SRGB:
+   case PIPE_FORMAT_B5G6R5_UNORM:
+   case PIPE_FORMAT_B5G5R5A1_UNORM:
+   case PIPE_FORMAT_B10G10R10A2_UNORM:
+   case PIPE_FORMAT_R8_UNORM:
+   case PIPE_FORMAT_R32G32B32A32_FLOAT:
+   case PIPE_FORMAT_R32G32B32_FLOAT:
+      return TRUE;
+   default:
+      return FALSE;
+   }
+}
+
+static INLINE uint8_t
+nvc0_2d_format(enum pipe_format format)
+{
+   uint8_t id = nvc0_format_table[format].rt;
+
+   /* Hardware values for color formats range from 0xc0 to 0xff,
+    * but the 2D engine doesn't support all of them.
+    */
+   if ((id >= 0xc0) && (0xff0843e080608409ULL & (1ULL << (id - 0xc0))))
+      return id;
+
+   switch (util_format_get_blocksize(format)) {
+   case 1:
+      return NV50_SURFACE_FORMAT_R8_UNORM;
+   case 2:
+      return NV50_SURFACE_FORMAT_R16_UNORM;
+   case 4:
+      return NV50_SURFACE_FORMAT_A8R8G8B8_UNORM;
+   default:
+      return 0;
+   }
+}
+
+static int
+nvc0_2d_texture_set(struct nouveau_channel *chan, int dst,
+                    struct nvc0_miptree *mt, unsigned level, unsigned layer)
+{
+   struct nouveau_bo *bo = mt->base.bo;
+   uint32_t width, height, depth;
+   uint32_t format;
+   uint32_t mthd = dst ? NVC0_2D_DST_FORMAT : NVC0_2D_SRC_FORMAT;
+   uint32_t flags = mt->base.domain | (dst ? NOUVEAU_BO_WR : NOUVEAU_BO_RD);
+   uint32_t offset = mt->level[level].offset;
+
+   format = nvc0_2d_format(mt->base.base.format);
+   if (!format) {
+      NOUVEAU_ERR("invalid/unsupported surface format: %s\n",
+                  util_format_name(mt->base.base.format));
+      return 1;
+   }
+
+   width = u_minify(mt->base.base.width0, level);
+   height = u_minify(mt->base.base.height0, level);
+
+   offset = mt->level[level].offset;
+   if (!mt->layout_3d) {
+      offset += mt->layer_stride * layer;
+      depth = 1;
+      layer = 0;
+   } else {
+      depth = u_minify(mt->base.base.depth0, level);
+   }
+
+   if (!(bo->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK)) {
+      BEGIN_RING(chan, RING_2D_(mthd), 2);
+      OUT_RING  (chan, format);
+      OUT_RING  (chan, 1);
+      BEGIN_RING(chan, RING_2D_(mthd + 0x14), 5);
+      OUT_RING  (chan, mt->level[level].pitch);
+      OUT_RING  (chan, width);
+      OUT_RING  (chan, height);
+      OUT_RELOCh(chan, bo, offset, flags);
+      OUT_RELOCl(chan, bo, offset, flags);
+   } else {
+      BEGIN_RING(chan, RING_2D_(mthd), 5);
+      OUT_RING  (chan, format);
+      OUT_RING  (chan, 0);
+      OUT_RING  (chan, mt->level[level].tile_mode);
+      OUT_RING  (chan, depth);
+      OUT_RING  (chan, layer);
+      BEGIN_RING(chan, RING_2D_(mthd + 0x18), 4);
+      OUT_RING  (chan, width);
+      OUT_RING  (chan, height);
+      OUT_RELOCh(chan, bo, offset, flags);
+      OUT_RELOCl(chan, bo, offset, flags);
+   }
+
+#if 0
+   if (dst) {
+      BEGIN_RING(chan, RING_2D_(NVC0_2D_CLIP_X), 4);
+      OUT_RING  (chan, 0);
+      OUT_RING  (chan, 0);
+      OUT_RING  (chan, width);
+      OUT_RING  (chan, height);
+   }
+#endif
+   return 0;
+}
+
+static int
+nvc0_2d_texture_do_copy(struct nouveau_channel *chan,
+                        struct nvc0_miptree *dst, unsigned dst_level,
+                        unsigned dx, unsigned dy, unsigned dz,
+                        struct nvc0_miptree *src, unsigned src_level,
+                        unsigned sx, unsigned sy, unsigned sz,
+                        unsigned w, unsigned h)
+{
+   int ret;
+
+   ret = MARK_RING(chan, 2 * 16 + 32, 4);
+   if (ret)
+      return ret;
+
+   ret = nvc0_2d_texture_set(chan, 1, dst, dst_level, dz);
+   if (ret)
+      return ret;
+
+   ret = nvc0_2d_texture_set(chan, 0, src, src_level, sz);
+   if (ret)
+      return ret;
+
+   /* 0/1 = CENTER/CORNER, 10/00 = POINT/BILINEAR */
+   BEGIN_RING(chan, RING_2D(BLIT_CONTROL), 1);
+   OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_2D(BLIT_DST_X), 4);
+   OUT_RING  (chan, dx);
+   OUT_RING  (chan, dy);
+   OUT_RING  (chan, w);
+   OUT_RING  (chan, h);
+   BEGIN_RING(chan, RING_2D(BLIT_DU_DX_FRACT), 4);
+   OUT_RING  (chan, 0);
+   OUT_RING  (chan, 1);
+   OUT_RING  (chan, 0);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_2D(BLIT_SRC_X_FRACT), 4);
+   OUT_RING  (chan, 0);
+   OUT_RING  (chan, sx);
+   OUT_RING  (chan, 0);
+   OUT_RING  (chan, sy);
+
+   return 0;
+}
+
+static void
+nvc0_resource_copy_region(struct pipe_context *pipe,
+                          struct pipe_resource *dst, unsigned dst_level,
+                          unsigned dstx, unsigned dsty, unsigned dstz,
+                          struct pipe_resource *src, unsigned src_level,
+                          const struct pipe_box *src_box)
+{
+   struct nvc0_screen *screen = nvc0_context(pipe)->screen;
+   int ret;
+   unsigned dst_layer = dstz, src_layer = src_box->z;
+
+   assert((src->format == dst->format) ||
+          (nvc0_2d_format_faithful(src->format) &&
+           nvc0_2d_format_faithful(dst->format)));
+
+   for (; dst_layer < dstz + src_box->depth; ++dst_layer, ++src_layer) {
+      ret = nvc0_2d_texture_do_copy(screen->base.channel,
+                                    nvc0_miptree(dst), dst_level,
+                                    dstx, dsty, dst_layer,
+                                    nvc0_miptree(src), src_level,
+                                    src_box->x, src_box->y, src_layer,
+                                    src_box->width, src_box->height);
+      if (ret)
+         return;
+   }
+}
+
+static void
+nvc0_clear_render_target(struct pipe_context *pipe,
+                         struct pipe_surface *dst,
+                         const float *rgba,
+                         unsigned dstx, unsigned dsty,
+                         unsigned width, unsigned height)
+{
+       struct nvc0_context *nv50 = nvc0_context(pipe);
+       struct nvc0_screen *screen = nv50->screen;
+       struct nouveau_channel *chan = screen->base.channel;
+       struct nvc0_miptree *mt = nvc0_miptree(dst->texture);
+       struct nvc0_surface *sf = nvc0_surface(dst);
+       struct nouveau_bo *bo = mt->base.bo;
+
+       BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4);
+       OUT_RINGf (chan, rgba[0]);
+       OUT_RINGf (chan, rgba[1]);
+       OUT_RINGf (chan, rgba[2]);
+       OUT_RINGf (chan, rgba[3]);
+
+       if (MARK_RING(chan, 18, 2))
+               return;
+
+       BEGIN_RING(chan, RING_3D(RT_CONTROL), 1);
+       OUT_RING  (chan, 1);
+       BEGIN_RING(chan, RING_3D(RT_ADDRESS_HIGH(0)), 8);
+       OUT_RELOCh(chan, bo, sf->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCl(chan, bo, sf->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RING  (chan, sf->width);
+       OUT_RING  (chan, sf->height);
+       OUT_RING  (chan, nvc0_format_table[dst->format].rt);
+       OUT_RING  (chan, mt->level[sf->base.u.tex.level].tile_mode);
+       OUT_RING  (chan, 1);
+       OUT_RING  (chan, 0);
+
+       /* NOTE: only works with D3D clear flag (5097/0x143c bit 4) */
+
+       BEGIN_RING(chan, RING_3D(VIEWPORT_HORIZ(0)), 2);
+       OUT_RING  (chan, (width << 16) | dstx);
+       OUT_RING  (chan, (height << 16) | dsty);
+
+       BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1);
+       OUT_RING  (chan, 0x3c);
+
+       nv50->dirty |= NVC0_NEW_FRAMEBUFFER;
+}
+
+static void
+nvc0_clear_depth_stencil(struct pipe_context *pipe,
+                         struct pipe_surface *dst,
+                         unsigned clear_flags,
+                         double depth,
+                         unsigned stencil,
+                         unsigned dstx, unsigned dsty,
+                         unsigned width, unsigned height)
+{
+       struct nvc0_context *nv50 = nvc0_context(pipe);
+       struct nvc0_screen *screen = nv50->screen;
+       struct nouveau_channel *chan = screen->base.channel;
+       struct nvc0_miptree *mt = nvc0_miptree(dst->texture);
+       struct nvc0_surface *sf = nvc0_surface(dst);
+       struct nouveau_bo *bo = mt->base.bo;
+       uint32_t mode = 0;
+
+       if (clear_flags & PIPE_CLEAR_DEPTH) {
+               BEGIN_RING(chan, RING_3D(CLEAR_DEPTH), 1);
+               OUT_RINGf (chan, depth);
+               mode |= NVC0_3D_CLEAR_BUFFERS_Z;
+       }
+
+       if (clear_flags & PIPE_CLEAR_STENCIL) {
+               BEGIN_RING(chan, RING_3D(CLEAR_STENCIL), 1);
+               OUT_RING  (chan, stencil & 0xff);
+               mode |= NVC0_3D_CLEAR_BUFFERS_S;
+       }
+
+       if (MARK_RING(chan, 17, 2))
+               return;
+
+       BEGIN_RING(chan, RING_3D(ZETA_ADDRESS_HIGH), 5);
+       OUT_RELOCh(chan, bo, sf->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RELOCl(chan, bo, sf->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+       OUT_RING  (chan, nvc0_format_table[dst->format].rt);
+       OUT_RING  (chan, mt->level[sf->base.u.tex.level].tile_mode);
+       OUT_RING  (chan, 0);
+       BEGIN_RING(chan, RING_3D(ZETA_ENABLE), 1);
+       OUT_RING  (chan, 1);
+       BEGIN_RING(chan, RING_3D(ZETA_HORIZ), 3);
+       OUT_RING  (chan, sf->width);
+       OUT_RING  (chan, sf->height);
+       OUT_RING  (chan, (1 << 16) | 1);
+
+       BEGIN_RING(chan, RING_3D(VIEWPORT_HORIZ(0)), 2);
+       OUT_RING  (chan, (width << 16) | dstx);
+       OUT_RING  (chan, (height << 16) | dsty);
+
+       BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1);
+       OUT_RING  (chan, mode);
+
+       nv50->dirty |= NVC0_NEW_FRAMEBUFFER;
+}
+
+void
+nvc0_clear(struct pipe_context *pipe, unsigned buffers,
+           const float *rgba, double depth, unsigned stencil)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct pipe_framebuffer_state *fb = &nvc0->framebuffer;
+   unsigned i;
+   const unsigned dirty = nvc0->dirty;
+   uint32_t mode = 0;
+
+   /* don't need NEW_BLEND, COLOR_MASK doesn't affect CLEAR_BUFFERS */
+   nvc0->dirty &= NVC0_NEW_FRAMEBUFFER;
+   if (!nvc0_state_validate(nvc0))
+      return;
+
+   if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
+      BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4);
+      OUT_RINGf (chan, rgba[0]);
+      OUT_RINGf (chan, rgba[1]);
+      OUT_RINGf (chan, rgba[2]);
+      OUT_RINGf (chan, rgba[3]);
+      mode =
+         NVC0_3D_CLEAR_BUFFERS_R | NVC0_3D_CLEAR_BUFFERS_G |
+         NVC0_3D_CLEAR_BUFFERS_B | NVC0_3D_CLEAR_BUFFERS_A;
+   }
+
+   if (buffers & PIPE_CLEAR_DEPTH) {
+      BEGIN_RING(chan, RING_3D(CLEAR_DEPTH), 1);
+      OUT_RING  (chan, fui(depth));
+      mode |= NVC0_3D_CLEAR_BUFFERS_Z;
+   }
+
+   if (buffers & PIPE_CLEAR_STENCIL) {
+      BEGIN_RING(chan, RING_3D(CLEAR_STENCIL), 1);
+      OUT_RING  (chan, stencil & 0xff);
+      mode |= NVC0_3D_CLEAR_BUFFERS_S;
+   }
+
+   BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1);
+   OUT_RING  (chan, mode);
+
+   for (i = 1; i < fb->nr_cbufs; i++) {
+      BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1);
+      OUT_RING  (chan, (i << 6) | 0x3c);
+   }
+
+   nvc0->dirty = dirty & ~NVC0_NEW_FRAMEBUFFER;
+}
+
+void
+nvc0_init_surface_functions(struct nvc0_context *nvc0)
+{
+       nvc0->pipe.resource_copy_region = nvc0_resource_copy_region;
+       nvc0->pipe.clear_render_target = nvc0_clear_render_target;
+       nvc0->pipe.clear_depth_stencil = nvc0_clear_depth_stencil;
+}
+
+
diff --git a/src/gallium/drivers/nvc0/nvc0_tex.c b/src/gallium/drivers/nvc0/nvc0_tex.c
new file mode 100644 (file)
index 0000000..b219f82
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2008 Ben Skeggs
+ *
+ * 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.
+ */
+
+#include "nvc0_context.h"
+#include "nvc0_resource.h"
+#include "nv50_texture.xml.h"
+
+#include "util/u_format.h"
+
+static INLINE uint32_t
+nv50_tic_swizzle(uint32_t tc, unsigned swz)
+{
+   switch (swz) {
+   case PIPE_SWIZZLE_RED:
+      return (tc & NV50_TIC_0_MAPR__MASK) >> NV50_TIC_0_MAPR__SHIFT;
+   case PIPE_SWIZZLE_GREEN:
+      return (tc & NV50_TIC_0_MAPG__MASK) >> NV50_TIC_0_MAPG__SHIFT;
+   case PIPE_SWIZZLE_BLUE:
+      return (tc & NV50_TIC_0_MAPB__MASK) >> NV50_TIC_0_MAPB__SHIFT;
+   case PIPE_SWIZZLE_ALPHA:
+      return (tc & NV50_TIC_0_MAPA__MASK) >> NV50_TIC_0_MAPA__SHIFT;
+   case PIPE_SWIZZLE_ONE:
+      return NV50_TIC_MAP_ONE;
+   case PIPE_SWIZZLE_ZERO:
+   default:
+      return NV50_TIC_MAP_ZERO;
+   }
+}
+
+struct pipe_sampler_view *
+nvc0_create_sampler_view(struct pipe_context *pipe,
+                         struct pipe_resource *texture,
+                         const struct pipe_sampler_view *templ)
+{
+   const struct util_format_description *desc;
+   uint32_t *tic;
+   uint32_t swz[4];
+   uint32_t depth;
+   struct nvc0_tic_entry *view;
+   struct nvc0_miptree *mt = nvc0_miptree(texture);
+
+   view = MALLOC_STRUCT(nvc0_tic_entry);
+   if (!view)
+      return NULL;
+
+   view->pipe = *templ;
+   view->pipe.reference.count = 1;
+   view->pipe.texture = NULL;
+   view->pipe.context = pipe;
+
+   view->id = -1;
+
+   pipe_resource_reference(&view->pipe.texture, texture);
+
+   tic = &view->tic[0];
+
+   desc = util_format_description(mt->base.base.format);
+
+   /* TIC[0] */
+
+   tic[0] = nvc0_format_table[view->pipe.format].tic;
+
+   swz[0] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_r);
+   swz[1] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_g);
+   swz[2] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_b);
+   swz[3] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_a);
+   tic[0] = (tic[0] & ~NV50_TIC_0_SWIZZLE__MASK) |
+      (swz[0] << NV50_TIC_0_MAPR__SHIFT) |
+      (swz[1] << NV50_TIC_0_MAPG__SHIFT) |
+      (swz[2] << NV50_TIC_0_MAPB__SHIFT) |
+      (swz[3] << NV50_TIC_0_MAPA__SHIFT);
+
+   /* tic[1] = mt->base.bo->offset; */
+   tic[2] = /* mt->base.bo->offset >> 32 */ 0;
+
+   tic[2] |= 0x10001000 | /* NV50_TIC_2_NO_BORDER */ 0x40000000;
+
+   if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
+      tic[2] |= NV50_TIC_2_COLORSPACE_SRGB;
+
+   if (mt->base.base.target != PIPE_TEXTURE_RECT)
+      tic[2] |= NV50_TIC_2_NORMALIZED_COORDS;
+
+   tic[2] |=
+      ((mt->base.bo->tile_mode & 0x0f0) << (22 - 4)) |
+      ((mt->base.bo->tile_mode & 0xf00) << (25 - 8));
+
+   depth = MAX2(mt->base.base.array_size, mt->base.base.depth0);
+
+   switch (mt->base.base.target) {
+   case PIPE_TEXTURE_1D:
+      tic[2] |= NV50_TIC_2_TARGET_1D;
+      break;
+   case PIPE_TEXTURE_2D:
+      tic[2] |= NV50_TIC_2_TARGET_2D;
+      break;
+   case PIPE_TEXTURE_RECT:
+      tic[2] |= NV50_TIC_2_TARGET_RECT;
+      break;
+   case PIPE_TEXTURE_3D:
+      tic[2] |= NV50_TIC_2_TARGET_3D;
+      break;
+   case PIPE_TEXTURE_CUBE:
+      depth /= 6;
+      if (depth > 1)
+         tic[2] |= NV50_TIC_2_TARGET_CUBE_ARRAY;
+      else
+         tic[2] |= NV50_TIC_2_TARGET_CUBE;
+      break;
+   case PIPE_TEXTURE_1D_ARRAY:
+      tic[2] |= NV50_TIC_2_TARGET_1D_ARRAY;
+      break;
+   case PIPE_TEXTURE_2D_ARRAY:
+      tic[2] |= NV50_TIC_2_TARGET_2D_ARRAY;
+      break;
+   case PIPE_BUFFER:
+      tic[2] |= NV50_TIC_2_TARGET_BUFFER | /* NV50_TIC_2_LINEAR */ (1 << 18);
+   default:
+      NOUVEAU_ERR("invalid texture target: %d\n", mt->base.base.target);
+      return FALSE;
+   }
+
+   if (mt->base.base.target == PIPE_BUFFER)
+      tic[3] = mt->base.base.width0;
+   else
+      tic[3] = 0x00300000;
+
+   tic[4] = (1 << 31) | mt->base.base.width0;
+
+   tic[5] = mt->base.base.height0 & 0xffff;
+   tic[5] |= depth << 16;
+   tic[5] |= mt->base.base.last_level << 28;
+
+   tic[6] = 0x03000000;
+
+   tic[7] = (view->pipe.u.tex.last_level << 4) | view->pipe.u.tex.first_level;
+
+   return &view->pipe;
+}
+
+static boolean
+nvc0_validate_tic(struct nvc0_context *nvc0, int s)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nouveau_bo *txc = nvc0->screen->txc;
+   unsigned i;
+   boolean need_flush = FALSE;
+
+   for (i = 0; i < nvc0->num_textures[s]; ++i) {
+      struct nvc0_tic_entry *tic = nvc0_tic_entry(nvc0->textures[s][i]);
+      struct nvc0_resource *res;
+
+      if (!tic) {
+         BEGIN_RING(chan, RING_3D(BIND_TIC(s)), 1);
+         OUT_RING  (chan, (i << 1) | 0);
+         continue;
+      }
+      res = &nvc0_miptree(tic->pipe.texture)->base;
+
+      if (tic->id < 0) {
+         tic->id = nvc0_screen_tic_alloc(nvc0->screen, tic);
+
+         MARK_RING (chan, 9 + 8, 4);
+         BEGIN_RING(chan, RING_MF(OFFSET_OUT_HIGH), 2);
+         OUT_RELOCh(chan, txc, tic->id * 32, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+         OUT_RELOCl(chan, txc, tic->id * 32, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+         BEGIN_RING(chan, RING_MF(LINE_LENGTH_IN), 2);
+         OUT_RING  (chan, 32);
+         OUT_RING  (chan, 1);
+         BEGIN_RING(chan, RING_MF(EXEC), 1);
+         OUT_RING  (chan, 0x100111);
+         BEGIN_RING_NI(chan, RING_MF(DATA), 8);
+         OUT_RING  (chan, tic->tic[0]);
+         OUT_RELOCl(chan, res->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+         OUT_RELOC (chan, res->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+                    NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, tic->tic[2], tic->tic[2]);
+         OUT_RINGp (chan, &tic->tic[3], 5);
+
+         need_flush = TRUE;
+      }
+      nvc0->screen->tic.lock[tic->id / 32] |= 1 << (tic->id % 32);
+
+      nvc0_bufctx_add_resident(nvc0, NVC0_BUFCTX_TEXTURES, res,
+                               NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+
+      BEGIN_RING(chan, RING_3D(BIND_TIC(s)), 1);
+      OUT_RING  (chan, (tic->id << 9) | (i << 1) | 1);
+   }
+   for (; i < nvc0->state.num_textures[s]; ++i) {
+      BEGIN_RING(chan, RING_3D(BIND_TIC(s)), 1);
+      OUT_RING  (chan, (i << 1) | 0);
+   }
+   nvc0->state.num_textures[s] = nvc0->num_textures[s];
+
+   return need_flush;
+}
+
+void nvc0_validate_textures(struct nvc0_context *nvc0)
+{
+   boolean need_flush;
+
+   need_flush  = nvc0_validate_tic(nvc0, 0);
+   need_flush |= nvc0_validate_tic(nvc0, 4);
+
+   if (need_flush) {
+      BEGIN_RING(nvc0->screen->base.channel, RING_3D(TIC_FLUSH), 1);
+      OUT_RING  (nvc0->screen->base.channel, 0);
+   }
+}
+
+static boolean
+nvc0_validate_tsc(struct nvc0_context *nvc0, int s)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   unsigned i;
+   boolean need_flush = FALSE;
+
+   for (i = 0; i < nvc0->num_samplers[s]; ++i) {
+      struct nvc0_tsc_entry *tsc = nvc0_tsc_entry(nvc0->samplers[s][i]);
+
+      if (!tsc) {
+         BEGIN_RING(chan, RING_3D(BIND_TSC(s)), 1);
+         OUT_RING  (chan, (i << 4) | 0);
+         continue;
+      }
+      if (tsc->id < 0) {
+         tsc->id = nvc0_screen_tsc_alloc(nvc0->screen, tsc);
+
+         nvc0_m2mf_push_linear(nvc0, nvc0->screen->txc, NOUVEAU_BO_VRAM,
+                               65536 + tsc->id * 32, 32, tsc->tsc);
+         need_flush = TRUE;
+      }
+      nvc0->screen->tsc.lock[tsc->id / 32] |= 1 << (tsc->id % 32);
+
+      BEGIN_RING(chan, RING_3D(BIND_TSC(s)), 1);
+      OUT_RING  (chan, (tsc->id << 12) | (i << 4) | 1);
+   }
+   for (; i < nvc0->state.num_samplers[s]; ++i) {
+      BEGIN_RING(chan, RING_3D(BIND_TSC(s)), 1);
+      OUT_RING  (chan, (i << 4) | 0);
+   }
+   nvc0->state.num_samplers[s] = nvc0->num_samplers[s];
+
+   return need_flush;
+}
+
+void nvc0_validate_samplers(struct nvc0_context *nvc0)
+{
+   boolean need_flush;
+
+   need_flush  = nvc0_validate_tsc(nvc0, 0);
+   need_flush |= nvc0_validate_tsc(nvc0, 4);
+
+   if (need_flush) {
+      BEGIN_RING(nvc0->screen->base.channel, RING_3D(TSC_FLUSH), 1);
+      OUT_RING  (nvc0->screen->base.channel, 0);
+   }
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
new file mode 100644 (file)
index 0000000..fecfc76
--- /dev/null
@@ -0,0 +1,2004 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include <unistd.h>
+
+#define NOUVEAU_DEBUG 1
+
+#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_util.h"
+#include "tgsi/tgsi_dump.h"
+#include "util/u_dynarray.h"
+
+#include "nvc0_pc.h"
+#include "nvc0_program.h"
+
+/* Arbitrary internal limits. */
+#define BLD_MAX_TEMPS 64
+#define BLD_MAX_ADDRS 4
+#define BLD_MAX_PREDS 4
+#define BLD_MAX_IMMDS 128
+#define BLD_MAX_OUTPS PIPE_MAX_SHADER_OUTPUTS
+
+#define BLD_MAX_COND_NESTING 8
+#define BLD_MAX_LOOP_NESTING 4
+#define BLD_MAX_CALL_NESTING 2
+
+/* This structure represents a TGSI register. */
+struct bld_register {
+   struct nv_value *current;
+   /* collect all SSA values assigned to it */
+   struct util_dynarray vals;
+   /* 1 bit per loop level, indicates if used/defd, reset when loop ends */
+   uint16_t loop_use;
+   uint16_t loop_def;
+};
+
+static INLINE struct nv_value **
+bld_register_access(struct bld_register *reg, unsigned i)
+{
+   return util_dynarray_element(&reg->vals, struct nv_value *, i);
+}
+
+static INLINE void
+bld_register_add_val(struct bld_register *reg, struct nv_value *val)
+{
+   util_dynarray_append(&reg->vals, struct nv_value *, val);
+}
+
+static INLINE boolean
+bld_register_del_val(struct bld_register *reg, struct nv_value *val)
+{
+   unsigned i;
+
+   for (i = reg->vals.size / sizeof(struct nv_value *); i > 0; --i)
+      if (*bld_register_access(reg, i - 1) == val)
+         break;
+   if (!i)
+      return FALSE;
+
+   if (i != reg->vals.size / sizeof(struct nv_value *))
+      *bld_register_access(reg, i - 1) = util_dynarray_pop(&reg->vals,
+                                                           struct nv_value *);
+   else
+      reg->vals.size -= sizeof(struct nv_value *);
+
+   return TRUE;
+}
+
+struct bld_context {
+   struct nvc0_translation_info *ti;
+
+   struct nv_pc *pc;
+   struct nv_basic_block *b;
+
+   struct tgsi_parse_context parse[BLD_MAX_CALL_NESTING];
+   int call_lvl;
+
+   struct nv_basic_block *cond_bb[BLD_MAX_COND_NESTING];
+   struct nv_basic_block *join_bb[BLD_MAX_COND_NESTING];
+   struct nv_basic_block *else_bb[BLD_MAX_COND_NESTING];
+   int cond_lvl;
+   struct nv_basic_block *loop_bb[BLD_MAX_LOOP_NESTING];
+   struct nv_basic_block *brkt_bb[BLD_MAX_LOOP_NESTING];
+   int loop_lvl;
+
+   ubyte out_kind; /* CFG_EDGE_FORWARD, or FAKE in case of BREAK/CONT */
+
+   struct bld_register tvs[BLD_MAX_TEMPS][4]; /* TGSI_FILE_TEMPORARY */
+   struct bld_register avs[BLD_MAX_ADDRS][4]; /* TGSI_FILE_ADDRESS */
+   struct bld_register pvs[BLD_MAX_PREDS][4]; /* TGSI_FILE_PREDICATE */
+   struct bld_register ovs[BLD_MAX_OUTPS][4]; /* TGSI_FILE_OUTPUT, FP only */
+
+   uint32_t outputs_written[(PIPE_MAX_SHADER_OUTPUTS + 7) / 8];
+   int hpos_index;
+
+   struct nv_value *zero;
+   struct nv_value *frag_coord[4];
+
+   /* wipe on new BB */
+   struct nv_value *saved_sysvals[4];
+   struct nv_value *saved_addr[4][2];
+   struct nv_value *saved_inputs[PIPE_MAX_SHADER_INPUTS][4];
+   struct nv_value *saved_immd[BLD_MAX_IMMDS];
+   uint num_immds;
+};
+
+static INLINE ubyte
+bld_register_file(struct bld_context *bld, struct bld_register *reg)
+{
+   if (reg < &bld->avs[0][0]) return NV_FILE_GPR;
+   else
+   if (reg < &bld->pvs[0][0]) return NV_FILE_GPR;
+   else
+   if (reg < &bld->ovs[0][0]) return NV_FILE_PRED;
+   else
+      return NV_FILE_MEM_V;
+}
+
+static INLINE struct nv_value *
+bld_fetch(struct bld_context *bld, struct bld_register *regs, int i, int c)
+{
+   regs[i * 4 + c].loop_use |= 1 << bld->loop_lvl;
+   return regs[i * 4 + c].current;
+}
+
+static struct nv_value *
+bld_loop_phi(struct bld_context *, struct bld_register *, struct nv_value *);
+
+/* If a variable is defined in a loop without prior use, we don't need
+ * a phi in the loop header to account for backwards flow.
+ *
+ * However, if this variable is then also used outside the loop, we do
+ * need a phi after all. But we must not use this phi's def inside the
+ * loop, so we can eliminate the phi if it is unused later.
+ */
+static INLINE void
+bld_store(struct bld_context *bld,
+          struct bld_register *regs, int i, int c, struct nv_value *val)
+{
+   const uint16_t m = 1 << bld->loop_lvl;
+   struct bld_register *reg = &regs[i * 4 + c];
+
+   if (bld->loop_lvl && !(m & (reg->loop_def | reg->loop_use)))
+      bld_loop_phi(bld, reg, val);
+
+   reg->current = val;
+   bld_register_add_val(reg, reg->current);
+
+   reg->loop_def |= 1 << bld->loop_lvl;
+}
+
+#define FETCH_TEMP(i, c)    bld_fetch(bld, &bld->tvs[0][0], i, c)
+#define STORE_TEMP(i, c, v) bld_store(bld, &bld->tvs[0][0], i, c, (v))
+#define FETCH_ADDR(i, c)    bld_fetch(bld, &bld->avs[0][0], i, c)
+#define STORE_ADDR(i, c, v) bld_store(bld, &bld->avs[0][0], i, c, (v))
+#define FETCH_PRED(i, c)    bld_fetch(bld, &bld->pvs[0][0], i, c)
+#define STORE_PRED(i, c, v) bld_store(bld, &bld->pvs[0][0], i, c, (v))
+#define STORE_OUTP(i, c, v)                                         \
+   do {                                                             \
+      bld_store(bld, &bld->ovs[0][0], i, c, (v));                   \
+      bld->outputs_written[(i) / 8] |= 1 << (((i) * 4 + (c)) % 32); \
+   } while (0)
+
+static INLINE void
+bld_clear_def_use(struct bld_register *regs, int n, int lvl)
+{
+   int i;
+   const uint16_t mask = ~(1 << lvl);
+
+   for (i = 0; i < n * 4; ++i) {
+      regs[i].loop_def &= mask;
+      regs[i].loop_use &= mask;
+   }
+}
+
+static INLINE void
+bld_warn_uninitialized(struct bld_context *bld, int kind,
+                       struct bld_register *reg, struct nv_basic_block *b)
+{
+#ifdef NOUVEAU_DEBUG
+   long i = (reg - &bld->tvs[0][0]) / 4;
+   long c = (reg - &bld->tvs[0][0]) & 3;
+
+   if (c == 3)
+      c = -1;
+   debug_printf("WARNING: TEMP[%li].%c %s used uninitialized in BB:%i\n",
+                i, (int)('x' + c), kind ? "may be" : "is", b->id);
+#endif
+}
+
+static INLINE struct nv_value *
+bld_def(struct nv_instruction *i, int c, struct nv_value *value)
+{
+   i->def[c] = value;
+   value->insn = i;
+   return value;
+}
+
+static INLINE struct nv_value *
+find_by_bb(struct bld_register *reg, struct nv_basic_block *b)
+{
+   int i;
+
+   if (reg->current && reg->current->insn->bb == b)
+      return reg->current;
+
+   for (i = 0; i < reg->vals.size / sizeof(struct nv_value *); ++i)
+      if ((*bld_register_access(reg, i))->insn->bb == b)
+         return *bld_register_access(reg, i);
+   return NULL;
+}
+
+/* Fetch value from register that was defined in the specified BB,
+ * or search for first definitions in all of its predecessors.
+ */
+static void
+fetch_by_bb(struct bld_register *reg,
+            struct nv_value **vals, int *n,
+            struct nv_basic_block *b)
+{
+   int i;
+   struct nv_value *val;
+
+   assert(*n < 16); /* MAX_COND_NESTING */
+
+   val = find_by_bb(reg, b);
+   if (val) {
+      for (i = 0; i < *n; ++i)
+         if (vals[i] == val)
+            return;
+      vals[(*n)++] = val;
+      return;
+   }
+   for (i = 0; i < b->num_in; ++i)
+      if (!IS_WALL_EDGE(b->in_kind[i]))
+         fetch_by_bb(reg, vals, n, b->in[i]);
+}
+
+static INLINE struct nv_value *
+bld_load_imm_u32(struct bld_context *bld, uint32_t u);
+
+static INLINE struct nv_value *
+bld_undef(struct bld_context *bld, ubyte file)
+{
+   struct nv_instruction *nvi = new_instruction(bld->pc, NV_OP_UNDEF);
+
+   return bld_def(nvi, 0, new_value(bld->pc, file, 4));
+}
+
+static struct nv_value *
+bld_phi(struct bld_context *bld, struct nv_basic_block *b,
+        struct bld_register *reg)
+{
+   struct nv_basic_block *in;
+   struct nv_value *vals[16] = { NULL };
+   struct nv_value *val;
+   struct nv_instruction *phi;
+   int i, j, n;
+
+   do {
+      i = n = 0;
+      fetch_by_bb(reg, vals, &n, b);
+
+      if (!n) {
+         bld_warn_uninitialized(bld, 0, reg, b);
+         return NULL;
+      }
+
+      if (n == 1) {
+         if (nvc0_bblock_dominated_by(b, vals[0]->insn->bb))
+            break;
+
+         bld_warn_uninitialized(bld, 1, reg, b);
+
+         /* back-tracking to insert missing value of other path */
+         in = b;
+         while (in->in[0]) {
+            if (in->num_in == 1) {
+               in = in->in[0];
+            } else {
+               if (!nvc0_bblock_reachable_by(in->in[0], vals[0]->insn->bb, b))
+                  in = in->in[0];
+               else
+               if (!nvc0_bblock_reachable_by(in->in[1], vals[0]->insn->bb, b))
+                  in = in->in[1];
+               else
+                  in = in->in[0];
+            }
+         }
+         bld->pc->current_block = in;
+
+         /* should make this a no-op */
+         bld_register_add_val(reg, bld_undef(bld, vals[0]->reg.file));
+         continue;
+      }
+
+      for (i = 0; i < n; ++i) {
+         /* if value dominates b, continue to the redefinitions */
+         if (nvc0_bblock_dominated_by(b, vals[i]->insn->bb))
+            continue;
+
+         /* if value dominates any in-block, b should be the dom frontier */
+         for (j = 0; j < b->num_in; ++j)
+            if (nvc0_bblock_dominated_by(b->in[j], vals[i]->insn->bb))
+               break;
+         /* otherwise, find the dominance frontier and put the phi there */
+         if (j == b->num_in) {
+            in = nvc0_bblock_dom_frontier(vals[i]->insn->bb);
+            val = bld_phi(bld, in, reg);
+            bld_register_add_val(reg, val);
+            break;
+         }
+      }
+   } while(i < n);
+
+   bld->pc->current_block = b;
+
+   if (n == 1)
+      return vals[0];
+
+   phi = new_instruction(bld->pc, NV_OP_PHI);
+
+   bld_def(phi, 0, new_value(bld->pc, vals[0]->reg.file, vals[0]->reg.size));
+   for (i = 0; i < n; ++i)
+      nv_reference(bld->pc, phi, i, vals[i]);
+
+   return phi->def[0];
+}
+
+/* Insert a phi function in the loop header.
+ * For nested loops, we need to insert phi functions in all the outer
+ * loop headers if they don't have one yet.
+ *
+ * @def: redefinition from inside loop, or NULL if to be replaced later
+ */
+static struct nv_value *
+bld_loop_phi(struct bld_context *bld, struct bld_register *reg,
+             struct nv_value *def)
+{
+   struct nv_instruction *phi;
+   struct nv_basic_block *bb = bld->pc->current_block;
+   struct nv_value *val = NULL;
+
+   if (bld->loop_lvl > 1) {
+      --bld->loop_lvl;
+      if (!((reg->loop_def | reg->loop_use) & (1 << bld->loop_lvl)))
+         val = bld_loop_phi(bld, reg, NULL);
+      ++bld->loop_lvl;
+   }
+
+   if (!val)
+      val = bld_phi(bld, bld->pc->current_block, reg); /* old definition */
+   if (!val) {
+      bld->pc->current_block = bld->loop_bb[bld->loop_lvl - 1]->in[0];
+      val = bld_undef(bld, bld_register_file(bld, reg));
+   }
+
+   bld->pc->current_block = bld->loop_bb[bld->loop_lvl - 1];
+
+   phi = new_instruction(bld->pc, NV_OP_PHI);
+
+   bld_def(phi, 0, new_value_like(bld->pc, val));
+   if (!def)
+      def = phi->def[0];
+
+   bld_register_add_val(reg, phi->def[0]);
+
+   phi->target = (struct nv_basic_block *)reg; /* cheat */
+
+   nv_reference(bld->pc, phi, 0, val);
+   nv_reference(bld->pc, phi, 1, def);
+
+   bld->pc->current_block = bb;
+
+   return phi->def[0];
+}
+
+static INLINE struct nv_value *
+bld_fetch_global(struct bld_context *bld, struct bld_register *reg)
+{
+   const uint16_t m = 1 << bld->loop_lvl;
+   const uint16_t use = reg->loop_use;
+
+   reg->loop_use |= m;
+
+   /* If neither used nor def'd inside the loop, build a phi in foresight,
+    * so we don't have to replace stuff later on, which requires tracking.
+    */
+   if (bld->loop_lvl && !((use | reg->loop_def) & m))
+      return bld_loop_phi(bld, reg, NULL);
+
+   return bld_phi(bld, bld->pc->current_block, reg);
+}
+
+static INLINE struct nv_value *
+bld_imm_u32(struct bld_context *bld, uint32_t u)
+{
+   int i;
+   unsigned n = bld->num_immds;
+
+   for (i = 0; i < n; ++i)
+      if (bld->saved_immd[i]->reg.imm.u32 == u)
+         return bld->saved_immd[i];
+
+   assert(n < BLD_MAX_IMMDS);
+   bld->num_immds++;
+
+   bld->saved_immd[n] = new_value(bld->pc, NV_FILE_IMM, 4);
+   bld->saved_immd[n]->reg.imm.u32 = u;
+   return bld->saved_immd[n];
+}
+
+static void
+bld_replace_value(struct nv_pc *, struct nv_basic_block *, struct nv_value *,
+                  struct nv_value *);
+
+/* Replace the source of the phi in the loop header by the last assignment,
+ * or eliminate the phi function if there is no assignment inside the loop.
+ *
+ * Redundancy situation 1 - (used) but (not redefined) value:
+ *  %3 = phi %0, %3 = %3 is used
+ *  %3 = phi %0, %4 = is new definition
+ *
+ * Redundancy situation 2 - (not used) but (redefined) value:
+ *  %3 = phi %0, %2 = %2 is used, %3 could be used outside, deleted by DCE
+ */
+static void
+bld_loop_end(struct bld_context *bld, struct nv_basic_block *bb)
+{
+   struct nv_basic_block *save = bld->pc->current_block;
+   struct nv_instruction *phi, *next;
+   struct nv_value *val;
+   struct bld_register *reg;
+   int i, s, n;
+
+   for (phi = bb->phi; phi && phi->opcode == NV_OP_PHI; phi = next) {
+      next = phi->next;
+
+      reg = (struct bld_register *)phi->target;
+      phi->target = NULL;
+
+      for (s = 1, n = 0; n < bb->num_in; ++n) {
+         if (bb->in_kind[n] != CFG_EDGE_BACK)
+            continue;
+
+         assert(s < 4);
+         bld->pc->current_block = bb->in[n];
+         val = bld_fetch_global(bld, reg);
+
+         for (i = 0; i < 4; ++i)
+            if (phi->src[i] && phi->src[i]->value == val)
+               break;
+         if (i == 4)
+            nv_reference(bld->pc, phi, s++, val);
+      }
+      bld->pc->current_block = save;
+
+      if (phi->src[0]->value == phi->def[0] ||
+          phi->src[0]->value == phi->src[1]->value)
+         s = 1;
+      else
+      if (phi->src[1]->value == phi->def[0])
+         s = 0;
+      else
+         continue;
+
+      if (s >= 0) {
+         /* eliminate the phi */
+         bld_register_del_val(reg, phi->def[0]);
+
+         ++bld->pc->pass_seq;
+         bld_replace_value(bld->pc, bb, phi->def[0], phi->src[s]->value);
+
+         nvc0_insn_delete(phi);
+      }
+   }
+}
+
+static INLINE struct nv_value *
+bld_imm_f32(struct bld_context *bld, float f)
+{
+   return bld_imm_u32(bld, fui(f));
+}
+
+static struct nv_value *
+bld_insn_1(struct bld_context *bld, uint opcode, struct nv_value *src0)
+{
+   struct nv_instruction *insn = new_instruction(bld->pc, opcode);
+
+   nv_reference(bld->pc, insn, 0, src0);
+   
+   return bld_def(insn, 0, new_value(bld->pc, NV_FILE_GPR, src0->reg.size));
+}
+
+static struct nv_value *
+bld_insn_2(struct bld_context *bld, uint opcode,
+           struct nv_value *src0, struct nv_value *src1)
+{
+   struct nv_instruction *insn = new_instruction(bld->pc, opcode);
+
+   nv_reference(bld->pc, insn, 0, src0);
+   nv_reference(bld->pc, insn, 1, src1);
+
+   return bld_def(insn, 0, new_value(bld->pc, NV_FILE_GPR, src0->reg.size));
+}
+
+static struct nv_value *
+bld_insn_3(struct bld_context *bld, uint opcode,
+           struct nv_value *src0, struct nv_value *src1,
+           struct nv_value *src2)
+{
+   struct nv_instruction *insn = new_instruction(bld->pc, opcode);
+
+   nv_reference(bld->pc, insn, 0, src0);
+   nv_reference(bld->pc, insn, 1, src1);
+   nv_reference(bld->pc, insn, 2, src2);
+
+   return bld_def(insn, 0, new_value(bld->pc, NV_FILE_GPR, src0->reg.size));
+}
+
+static INLINE void
+bld_src_predicate(struct bld_context *bld,
+                  struct nv_instruction *nvi, int s, struct nv_value *val)
+{
+   nvi->predicate = s;
+   nv_reference(bld->pc, nvi, s, val);
+}
+
+static INLINE void
+bld_src_pointer(struct bld_context *bld,
+                struct nv_instruction *nvi, int s, struct nv_value *val)
+{
+   nvi->indirect = s;
+   nv_reference(bld->pc, nvi, s, val);
+}
+
+static void
+bld_lmem_store(struct bld_context *bld, struct nv_value *ptr, int ofst,
+               struct nv_value *val)
+{
+   struct nv_instruction *insn = new_instruction(bld->pc, NV_OP_ST);
+   struct nv_value *loc;
+
+   loc = new_value(bld->pc, NV_FILE_MEM_L, nv_type_sizeof(NV_TYPE_U32));
+
+   loc->reg.id = ofst * 4;
+
+   nv_reference(bld->pc, insn, 0, loc);
+   nv_reference(bld->pc, insn, 1, ptr);
+   nv_reference(bld->pc, insn, 2, val);
+}
+
+static struct nv_value *
+bld_lmem_load(struct bld_context *bld, struct nv_value *ptr, int ofst)
+{
+   struct nv_value *loc, *val;
+
+   loc = new_value(bld->pc, NV_FILE_MEM_L, nv_type_sizeof(NV_TYPE_U32));
+
+   loc->reg.address = ofst * 4;
+
+   val = bld_insn_2(bld, NV_OP_LD, loc, ptr);
+
+   return val;
+}
+
+static struct nv_value *
+bld_pow(struct bld_context *bld, struct nv_value *x, struct nv_value *e)
+{
+   struct nv_value *val;
+
+   val = bld_insn_1(bld, NV_OP_LG2, x);
+   val = bld_insn_2(bld, NV_OP_MUL_F32, e, val);
+
+   val = bld_insn_1(bld, NV_OP_PREEX2, val);
+   val = bld_insn_1(bld, NV_OP_EX2, val);
+
+   return val;
+}
+
+static INLINE struct nv_value *
+bld_load_imm_f32(struct bld_context *bld, float f)
+{
+   if (f == 0.0f)
+      return bld->zero;
+   return bld_insn_1(bld, NV_OP_MOV, bld_imm_f32(bld, f));
+}
+
+static INLINE struct nv_value *
+bld_load_imm_u32(struct bld_context *bld, uint32_t u)
+{
+   if (u == 0)
+      return bld->zero;
+   return bld_insn_1(bld, NV_OP_MOV, bld_imm_u32(bld, u));
+}
+
+static INLINE struct nv_value *
+bld_setp(struct bld_context *bld, uint op, uint8_t cc,
+         struct nv_value *src0, struct nv_value *src1)
+{
+   struct nv_value *val = bld_insn_2(bld, op, src0, src1);
+
+   val->reg.file = NV_FILE_PRED;
+   val->reg.size = 1;
+   val->insn->set_cond = cc & 0xf;
+   return val;
+}
+
+static INLINE struct nv_value *
+bld_cvt(struct bld_context *bld, uint8_t dt, uint8_t st, struct nv_value *src)
+{
+   struct nv_value *val = bld_insn_1(bld, NV_OP_CVT, src);
+   val->insn->ext.cvt.d = dt;
+   val->insn->ext.cvt.s = st;
+   return val;
+}
+
+static void
+bld_kil(struct bld_context *bld, struct nv_value *src)
+{
+   struct nv_instruction *nvi;
+
+   src = bld_setp(bld, NV_OP_SET_F32, NV_CC_LT, src, bld->zero);
+
+   nvi = new_instruction(bld->pc, NV_OP_KIL);
+   nvi->fixed = 1;
+
+   bld_src_predicate(bld, nvi, 0, src);
+}
+
+static void
+bld_flow(struct bld_context *bld, uint opcode,
+         struct nv_value *src, struct nv_basic_block *target,
+         boolean reconverge)
+{
+   struct nv_instruction *nvi;
+
+   if (reconverge)
+      new_instruction(bld->pc, NV_OP_JOINAT)->fixed = 1;
+
+   nvi = new_instruction(bld->pc, opcode);
+   nvi->target = target;
+   nvi->terminator = 1;
+   if (src)
+      bld_src_predicate(bld, nvi, 0, src);
+}
+
+static ubyte
+translate_setcc(unsigned opcode)
+{
+   switch (opcode) {
+   case TGSI_OPCODE_SLT: return NV_CC_LT;
+   case TGSI_OPCODE_SGE: return NV_CC_GE;
+   case TGSI_OPCODE_SEQ: return NV_CC_EQ;
+   case TGSI_OPCODE_SGT: return NV_CC_GT;
+   case TGSI_OPCODE_SLE: return NV_CC_LE;
+   case TGSI_OPCODE_SNE: return NV_CC_NE | NV_CC_U;
+   case TGSI_OPCODE_STR: return NV_CC_TR;
+   case TGSI_OPCODE_SFL: return NV_CC_FL;
+
+   case TGSI_OPCODE_ISLT: return NV_CC_LT;
+   case TGSI_OPCODE_ISGE: return NV_CC_GE;
+   case TGSI_OPCODE_USEQ: return NV_CC_EQ;
+   case TGSI_OPCODE_USGE: return NV_CC_GE;
+   case TGSI_OPCODE_USLT: return NV_CC_LT;
+   case TGSI_OPCODE_USNE: return NV_CC_NE;
+   default:
+      assert(0);
+      return NV_CC_FL;
+   }
+}
+
+static uint
+translate_opcode(uint opcode)
+{
+   switch (opcode) {
+   case TGSI_OPCODE_ABS: return NV_OP_ABS_F32;
+   case TGSI_OPCODE_ADD: return NV_OP_ADD_F32;
+   case TGSI_OPCODE_SUB: return NV_OP_SUB_F32;
+   case TGSI_OPCODE_UADD: return NV_OP_ADD_B32;
+   case TGSI_OPCODE_AND: return NV_OP_AND;
+   case TGSI_OPCODE_EX2: return NV_OP_EX2;
+   case TGSI_OPCODE_CEIL: return NV_OP_CEIL;
+   case TGSI_OPCODE_FLR: return NV_OP_FLOOR;
+   case TGSI_OPCODE_TRUNC: return NV_OP_TRUNC;
+   case TGSI_OPCODE_COS: return NV_OP_COS;
+   case TGSI_OPCODE_SIN: return NV_OP_SIN;
+   case TGSI_OPCODE_DDX: return NV_OP_DFDX;
+   case TGSI_OPCODE_DDY: return NV_OP_DFDY;
+   case TGSI_OPCODE_F2I:
+   case TGSI_OPCODE_F2U:
+   case TGSI_OPCODE_I2F:
+   case TGSI_OPCODE_U2F: return NV_OP_CVT;
+   case TGSI_OPCODE_INEG: return NV_OP_NEG_S32;
+   case TGSI_OPCODE_LG2: return NV_OP_LG2;
+   case TGSI_OPCODE_ISHR: return NV_OP_SAR;
+   case TGSI_OPCODE_USHR: return NV_OP_SHR;
+   case TGSI_OPCODE_MAD: return NV_OP_MAD_F32;
+   case TGSI_OPCODE_MAX: return NV_OP_MAX_F32;
+   case TGSI_OPCODE_IMAX: return NV_OP_MAX_S32;
+   case TGSI_OPCODE_UMAX: return NV_OP_MAX_U32;
+   case TGSI_OPCODE_MIN: return NV_OP_MIN_F32;
+   case TGSI_OPCODE_IMIN: return NV_OP_MIN_S32;
+   case TGSI_OPCODE_UMIN: return NV_OP_MIN_U32;
+   case TGSI_OPCODE_MUL: return NV_OP_MUL_F32;
+   case TGSI_OPCODE_UMUL: return NV_OP_MUL_B32;
+   case TGSI_OPCODE_OR: return NV_OP_OR;
+   case TGSI_OPCODE_RCP: return NV_OP_RCP;
+   case TGSI_OPCODE_RSQ: return NV_OP_RSQ;
+   case TGSI_OPCODE_SAD: return NV_OP_SAD;
+   case TGSI_OPCODE_SHL: return NV_OP_SHL;
+   case TGSI_OPCODE_SLT:
+   case TGSI_OPCODE_SGE:
+   case TGSI_OPCODE_SEQ:
+   case TGSI_OPCODE_SGT:
+   case TGSI_OPCODE_SLE:
+   case TGSI_OPCODE_SNE: return NV_OP_FSET_F32;
+   case TGSI_OPCODE_ISLT:
+   case TGSI_OPCODE_ISGE: return NV_OP_SET_S32;
+   case TGSI_OPCODE_USEQ:
+   case TGSI_OPCODE_USGE:
+   case TGSI_OPCODE_USLT:
+   case TGSI_OPCODE_USNE: return NV_OP_SET_U32;
+   case TGSI_OPCODE_TEX: return NV_OP_TEX;
+   case TGSI_OPCODE_TXP: return NV_OP_TEX;
+   case TGSI_OPCODE_TXB: return NV_OP_TXB;
+   case TGSI_OPCODE_TXL: return NV_OP_TXL;
+   case TGSI_OPCODE_XOR: return NV_OP_XOR;
+   default:
+      return NV_OP_NOP;
+   }
+}
+
+#if 0
+static ubyte
+infer_src_type(unsigned opcode)
+{
+   switch (opcode) {
+   case TGSI_OPCODE_MOV:
+   case TGSI_OPCODE_AND:
+   case TGSI_OPCODE_OR:
+   case TGSI_OPCODE_XOR:
+   case TGSI_OPCODE_SAD:
+   case TGSI_OPCODE_U2F:
+   case TGSI_OPCODE_UADD:
+   case TGSI_OPCODE_UDIV:
+   case TGSI_OPCODE_UMOD:
+   case TGSI_OPCODE_UMAD:
+   case TGSI_OPCODE_UMUL:
+   case TGSI_OPCODE_UMAX:
+   case TGSI_OPCODE_UMIN:
+   case TGSI_OPCODE_USEQ:
+   case TGSI_OPCODE_USGE:
+   case TGSI_OPCODE_USLT:
+   case TGSI_OPCODE_USNE:
+   case TGSI_OPCODE_USHR:
+      return NV_TYPE_U32;
+   case TGSI_OPCODE_I2F:
+   case TGSI_OPCODE_IDIV:
+   case TGSI_OPCODE_IMAX:
+   case TGSI_OPCODE_IMIN:
+   case TGSI_OPCODE_INEG:
+   case TGSI_OPCODE_ISGE:
+   case TGSI_OPCODE_ISHR:
+   case TGSI_OPCODE_ISLT:
+      return NV_TYPE_S32;
+   default:
+      return NV_TYPE_F32;
+   }
+}
+
+static ubyte
+infer_dst_type(unsigned opcode)
+{
+   switch (opcode) {
+   case TGSI_OPCODE_MOV:
+   case TGSI_OPCODE_F2U:
+   case TGSI_OPCODE_AND:
+   case TGSI_OPCODE_OR:
+   case TGSI_OPCODE_XOR:
+   case TGSI_OPCODE_SAD:
+   case TGSI_OPCODE_UADD:
+   case TGSI_OPCODE_UDIV:
+   case TGSI_OPCODE_UMOD:
+   case TGSI_OPCODE_UMAD:
+   case TGSI_OPCODE_UMUL:
+   case TGSI_OPCODE_UMAX:
+   case TGSI_OPCODE_UMIN:
+   case TGSI_OPCODE_USEQ:
+   case TGSI_OPCODE_USGE:
+   case TGSI_OPCODE_USLT:
+   case TGSI_OPCODE_USNE:
+   case TGSI_OPCODE_USHR:
+      return NV_TYPE_U32;
+   case TGSI_OPCODE_F2I:
+   case TGSI_OPCODE_IDIV:
+   case TGSI_OPCODE_IMAX:
+   case TGSI_OPCODE_IMIN:
+   case TGSI_OPCODE_INEG:
+   case TGSI_OPCODE_ISGE:
+   case TGSI_OPCODE_ISHR:
+   case TGSI_OPCODE_ISLT:
+      return NV_TYPE_S32;
+   default:
+      return NV_TYPE_F32;
+   }
+}
+#endif
+
+static void
+emit_store(struct bld_context *bld, const struct tgsi_full_instruction *inst,
+           unsigned chan, struct nv_value *res)
+{
+   const struct tgsi_full_dst_register *reg = &inst->Dst[0];
+   struct nv_instruction *nvi;
+   struct nv_value *mem;
+   struct nv_value *ptr = NULL;
+   int idx;
+
+   idx = reg->Register.Index;
+   assert(chan < 4);
+
+   if (reg->Register.Indirect)
+      ptr = FETCH_ADDR(reg->Indirect.Index,
+                       tgsi_util_get_src_register_swizzle(&reg->Indirect, 0));
+
+   switch (inst->Instruction.Saturate) {
+   case TGSI_SAT_NONE:
+      break;
+   case TGSI_SAT_ZERO_ONE:
+      res = bld_insn_1(bld, NV_OP_SAT, res);
+      break;
+   case TGSI_SAT_MINUS_PLUS_ONE:
+      res = bld_insn_2(bld, NV_OP_MAX_F32, res, bld_load_imm_f32(bld, -1.0f));
+      res = bld_insn_2(bld, NV_OP_MIN_F32, res, bld_load_imm_f32(bld, 1.0f));
+      break;
+   }
+
+   switch (reg->Register.File) {
+   case TGSI_FILE_OUTPUT:
+      if (!res->insn)
+         res = bld_insn_1(bld, NV_OP_MOV, res);
+
+      if (bld->pc->is_fragprog) {
+         assert(!ptr);
+         STORE_OUTP(idx, chan, res);
+      } else {
+         nvi = new_instruction(bld->pc, NV_OP_EXPORT);
+         mem = new_value(bld->pc, bld->ti->output_file, res->reg.size);
+         nv_reference(bld->pc, nvi, 0, mem);
+         nv_reference(bld->pc, nvi, 1, res);
+         if (!ptr)
+            mem->reg.address = bld->ti->output_loc[idx][chan];
+         else
+            mem->reg.address = 0x80 + idx * 16 + chan * 4;
+         nvi->fixed = 1;
+      }
+      break;
+   case TGSI_FILE_TEMPORARY:
+      assert(idx < BLD_MAX_TEMPS);
+      if (!res->insn)
+         res = bld_insn_1(bld, NV_OP_MOV, res);
+
+      assert(res->reg.file == NV_FILE_GPR);
+      assert(res->insn->bb = bld->pc->current_block);
+
+      if (bld->ti->require_stores)
+         bld_lmem_store(bld, ptr, idx * 4 + chan, res);
+      else
+         STORE_TEMP(idx, chan, res);
+      break;
+   case TGSI_FILE_ADDRESS:
+      assert(idx < BLD_MAX_ADDRS);
+      STORE_ADDR(idx, chan, res);
+      break;
+   }
+}
+
+static INLINE uint32_t
+bld_is_output_written(struct bld_context *bld, int i, int c)
+{
+   if (c < 0)
+      return bld->outputs_written[i / 8] & (0xf << ((i * 4) % 32));
+   return bld->outputs_written[i / 8] & (1 << ((i * 4 + c) % 32));
+}
+
+static void
+bld_append_vp_ucp(struct bld_context *bld)
+{
+   struct nv_value *res[6];
+   struct nv_value *ucp, *vtx, *out;
+   struct nv_instruction *insn;
+   int i, c;
+
+   assert(bld->ti->prog->vp.num_ucps <= 6);
+
+   for (c = 0; c < 4; ++c) {
+      vtx = bld_fetch_global(bld, &bld->ovs[bld->hpos_index][c]);
+
+      for (i = 0; i < bld->ti->prog->vp.num_ucps; ++i) {
+         ucp = new_value(bld->pc, NV_FILE_MEM_C(15), 4);
+         ucp->reg.address = i * 16 + c * 4;
+
+         if (c == 0)
+            res[i] = bld_insn_2(bld, NV_OP_MUL_F32, vtx, ucp);
+         else
+            res[i] = bld_insn_3(bld, NV_OP_MAD_F32, vtx, ucp, res[i]);
+      }
+   }
+
+   for (i = 0; i < bld->ti->prog->vp.num_ucps; ++i) {
+      (out = new_value(bld->pc, NV_FILE_MEM_V, 4))->reg.address = 0x2c0 + i * 4;
+      (insn = new_instruction(bld->pc, NV_OP_EXPORT))->fixed = 1;
+      nv_reference(bld->pc, insn, 0, out);
+      nv_reference(bld->pc, insn, 1, res[i]);
+   }
+}
+
+static void
+bld_export_fp_outputs(struct bld_context *bld)
+{
+   struct nv_value *vals[4];
+   struct nv_instruction *nvi;
+   int i, c, n;
+
+   for (i = 0; i < PIPE_MAX_SHADER_OUTPUTS; ++i) {
+      if (!bld_is_output_written(bld, i, -1))
+         continue;
+      for (n = 0, c = 0; c < 4; ++c) {
+         if (!bld_is_output_written(bld, i, c))
+            continue;
+         vals[n] = bld_fetch_global(bld, &bld->ovs[i][c]);
+         assert(vals[n]);
+         vals[n] = bld_insn_1(bld, NV_OP_MOV, vals[n]);
+         vals[n++]->reg.id = bld->ti->output_loc[i][c];
+      }
+      assert(n);
+
+      (nvi = new_instruction(bld->pc, NV_OP_EXPORT))->fixed = 1;
+      for (c = 0; c < n; ++c)
+         nv_reference(bld->pc, nvi, c, vals[c]);
+   }
+}
+
+static void
+bld_new_block(struct bld_context *bld, struct nv_basic_block *b)
+{
+   int i, c;
+
+   bld->pc->current_block = b;
+
+   for (i = 0; i < 4; ++i)
+      bld->saved_addr[i][0] = NULL;
+   for (i = 0; i < PIPE_MAX_SHADER_INPUTS; ++i)
+      for (c = 0; c < 4; ++c)
+         bld->saved_inputs[i][c] = NULL;
+
+   bld->out_kind = CFG_EDGE_FORWARD;
+}
+
+static struct nv_value *
+bld_get_saved_input(struct bld_context *bld, unsigned i, unsigned c)
+{
+   if (bld->saved_inputs[i][c])
+      return bld->saved_inputs[i][c];
+   return NULL;
+}
+
+static struct nv_value *
+bld_interp(struct bld_context *bld, unsigned mode, struct nv_value *val)
+{
+   unsigned cent = mode & NVC0_INTERP_CENTROID;
+
+   mode &= ~NVC0_INTERP_CENTROID;
+   
+   if (val->reg.address == 0x3fc) {
+      /* gl_FrontFacing: 0/~0 to -1.0/+1.0 */
+      val = bld_insn_1(bld, NV_OP_LINTERP, val);
+      val->insn->flat = 1;
+      val = bld_insn_2(bld, NV_OP_SHL, val, bld_imm_u32(bld, 31));
+      val = bld_insn_2(bld, NV_OP_XOR, val, bld_imm_f32(bld, -1.0f));
+      return val;
+   } else
+   if (mode == NVC0_INTERP_PERSPECTIVE) {
+      val = bld_insn_2(bld, NV_OP_PINTERP, val, bld->frag_coord[3]);
+   } else {
+      val = bld_insn_1(bld, NV_OP_LINTERP, val);
+   }
+
+   val->insn->flat = mode == NVC0_INTERP_FLAT ? 1 : 0;
+   val->insn->centroid = cent ? 1 : 0;
+   return val;
+}
+
+static struct nv_value *
+emit_fetch(struct bld_context *bld, const struct tgsi_full_instruction *insn,
+           const unsigned s, const unsigned chan)
+{
+   const struct tgsi_full_src_register *src = &insn->Src[s];
+   struct nv_value *res = NULL;
+   struct nv_value *ptr = NULL;
+   int idx, ind_idx, dim_idx;
+   unsigned swz, ind_swz, sgn;
+
+   idx = src->Register.Index;
+   swz = tgsi_util_get_full_src_register_swizzle(src, chan);
+
+   if (src->Register.Indirect) {
+      ind_idx = src->Indirect.Index;
+      ind_swz = tgsi_util_get_src_register_swizzle(&src->Indirect, 0);
+
+      ptr = FETCH_ADDR(ind_idx, ind_swz);
+   }
+
+   if (src->Register.Dimension)
+      dim_idx = src->Dimension.Index;
+   else
+      dim_idx = 0;
+
+   switch (src->Register.File) {
+   case TGSI_FILE_CONSTANT:
+      assert(dim_idx < 14);
+      res = new_value(bld->pc, NV_FILE_MEM_C(dim_idx), 4);
+      res->reg.address = idx * 16 + swz * 4;
+      res = bld_insn_1(bld, NV_OP_LD, res);
+      if (ptr)
+         bld_src_pointer(bld, res->insn, 1, ptr);
+      break;
+   case TGSI_FILE_IMMEDIATE: /* XXX: type for MOV TEMP[0], -IMM[0] */
+      assert(idx < bld->ti->immd32_nr);
+      res = bld_load_imm_u32(bld, bld->ti->immd32[idx * 4 + swz]);
+      break;
+   case TGSI_FILE_INPUT:
+      assert(!src->Register.Dimension);
+      if (!ptr) {
+         res = bld_get_saved_input(bld, idx, swz);
+         if (res)
+            return res;
+      }
+      res = new_value(bld->pc, bld->ti->input_file, 4);
+      if (ptr)
+         res->reg.address = 0x80 + idx * 16 + swz * 4;
+      else
+         res->reg.address = bld->ti->input_loc[idx][swz];
+
+      if (bld->pc->is_fragprog)
+         res = bld_interp(bld, bld->ti->interp_mode[idx], res);
+      else
+         res = bld_insn_1(bld, NV_OP_VFETCH, res);
+
+      if (ptr)
+         bld_src_pointer(bld, res->insn, res->insn->src[1] ? 2 : 1, ptr);
+      else
+         bld->saved_inputs[idx][swz] = res;
+      break;
+   case TGSI_FILE_TEMPORARY:
+      if (bld->ti->require_stores)
+         res = bld_lmem_load(bld, ptr, idx * 4 + swz);
+      else
+         res = bld_fetch_global(bld, &bld->tvs[idx][swz]);
+      break;
+   case TGSI_FILE_ADDRESS:
+      res = bld_fetch_global(bld, &bld->avs[idx][swz]);
+      break;
+   case TGSI_FILE_PREDICATE:
+      res = bld_fetch_global(bld, &bld->pvs[idx][swz]);
+      break;
+   default:
+      NOUVEAU_ERR("illegal/unhandled src reg file: %d\n", src->Register.File);
+      abort();
+      break;      
+   }
+   if (!res)
+      return bld_undef(bld, NV_FILE_GPR);
+
+   sgn = tgsi_util_get_full_src_register_sign_mode(src, chan);
+
+   switch (sgn) {
+   case TGSI_UTIL_SIGN_KEEP:
+      break;
+   case TGSI_UTIL_SIGN_CLEAR:
+      res = bld_insn_1(bld, NV_OP_ABS_F32, res);
+      break;
+   case TGSI_UTIL_SIGN_TOGGLE:
+      res = bld_insn_1(bld, NV_OP_NEG_F32, res);
+      break;
+   case TGSI_UTIL_SIGN_SET:
+      res = bld_insn_1(bld, NV_OP_ABS_F32, res);
+      res = bld_insn_1(bld, NV_OP_NEG_F32, res);
+      break;
+   default:
+      NOUVEAU_ERR("illegal/unhandled src reg sign mode\n");
+      abort();
+      break;
+   }
+
+   return res;
+}
+
+static void
+bld_lit(struct bld_context *bld, struct nv_value *dst0[4],
+        const struct tgsi_full_instruction *insn)
+{
+   struct nv_value *val0 = NULL;
+   unsigned mask = insn->Dst[0].Register.WriteMask;
+
+   if (mask & ((1 << 0) | (1 << 3)))
+      dst0[3] = dst0[0] = bld_load_imm_f32(bld, 1.0f);
+
+   if (mask & (3 << 1)) {
+      val0 = bld_insn_2(bld, NV_OP_MAX, emit_fetch(bld, insn, 0, 0), bld->zero);
+      if (mask & (1 << 1))
+         dst0[1] = val0;
+   }
+
+   if (mask & (1 << 2)) {
+      struct nv_value *val1, *val3, *src1, *src3, *pred;
+      struct nv_value *pos128 = bld_load_imm_f32(bld, 127.999999f);
+      struct nv_value *neg128 = bld_load_imm_f32(bld, -127.999999f);
+
+      src1 = emit_fetch(bld, insn, 0, 1);
+      src3 = emit_fetch(bld, insn, 0, 3);
+
+      pred = bld_setp(bld, NV_OP_SET_F32, NV_CC_LE, val0, bld->zero);
+
+      val1 = bld_insn_2(bld, NV_OP_MAX_F32, src1, bld->zero);
+      val3 = bld_insn_2(bld, NV_OP_MAX_F32, src3, neg128);
+      val3 = bld_insn_2(bld, NV_OP_MIN_F32, val3, pos128);
+      val3 = bld_pow(bld, val1, val3);
+
+      dst0[2] = bld_insn_1(bld, NV_OP_MOV, bld->zero);
+      bld_src_predicate(bld, dst0[2]->insn, 1, pred);
+
+      dst0[2] = bld_insn_2(bld, NV_OP_SELECT, val3, dst0[2]);
+   }
+}
+
+static INLINE void
+describe_texture_target(unsigned target, int *dim,
+                        int *array, int *cube, int *shadow)
+{
+   *array = *cube = *shadow = 0;
+
+   switch (target) {
+   case TGSI_TEXTURE_1D:
+      *dim = 1;
+      break;
+   case TGSI_TEXTURE_SHADOW1D:
+      *dim = *shadow = 1;
+      break;
+   case TGSI_TEXTURE_UNKNOWN:
+   case TGSI_TEXTURE_2D:
+   case TGSI_TEXTURE_RECT:
+      *dim = 2;
+      break;
+   case TGSI_TEXTURE_SHADOW2D:
+   case TGSI_TEXTURE_SHADOWRECT:
+      *dim = 2;
+      *shadow = 1;
+      break;
+   case TGSI_TEXTURE_3D:
+      *dim = 3;
+      break;
+   case TGSI_TEXTURE_CUBE:
+      *dim = 2;
+      *cube = 1;
+      break;
+      /*
+   case TGSI_TEXTURE_CUBE_ARRAY:
+      *dim = 2;
+      *cube = *array = 1;
+      break;
+   case TGSI_TEXTURE_1D_ARRAY:
+      *dim = *array = 1;
+      break;
+   case TGSI_TEXTURE_2D_ARRAY:
+      *dim = 2;
+      *array = 1;
+      break;
+   case TGSI_TEXTURE_SHADOW1D_ARRAY:
+      *dim = *array = *shadow = 1;
+      break;
+   case TGSI_TEXTURE_SHADOW2D_ARRAY:
+      *dim = 2;
+      *array = *shadow = 1;
+      break;
+   case TGSI_TEXTURE_CUBE_ARRAY:
+      *dim = 2;
+      *array = *cube = 1;
+      break;
+      */
+   default:
+      assert(0);
+      break;
+   }
+}
+
+static struct nv_value *
+bld_clone(struct bld_context *bld, struct nv_instruction *nvi)
+{
+   struct nv_instruction *dupi = new_instruction(bld->pc, nvi->opcode);
+   struct nv_instruction *next, *prev;
+   int c;
+
+   next = dupi->next;
+   prev = dupi->prev;
+
+   *dupi = *nvi;
+
+   dupi->next = next;
+   dupi->prev = prev;
+
+   for (c = 0; c < 5 && nvi->def[c]; ++c)
+      bld_def(dupi, c, new_value_like(bld->pc, nvi->def[c]));
+
+   for (c = 0; c < 6 && nvi->src[c]; ++c) {
+      dupi->src[c] = NULL;
+      nv_reference(bld->pc, dupi, c, nvi->src[c]->value);
+   }
+
+   return dupi->def[0];
+}
+
+/* NOTE: proj(t0) = (t0 / w) / (tc3 / w) = tc0 / tc2 handled by optimizer */
+static void
+load_proj_tex_coords(struct bld_context *bld,
+                     struct nv_value *t[4], int dim, int shadow,
+                     const struct tgsi_full_instruction *insn)
+{
+   int c;
+   unsigned mask = (1 << dim) - 1;
+
+   if (shadow)
+      mask |= 4; /* depth comparison value */
+
+   t[3] = emit_fetch(bld, insn, 0, 3);
+   if (t[3]->insn->opcode == NV_OP_PINTERP) {
+      t[3] = bld_clone(bld, t[3]->insn);
+      t[3]->insn->opcode = NV_OP_LINTERP;
+      nv_reference(bld->pc, t[3]->insn, 1, NULL);
+   }
+   t[3] = bld_insn_1(bld, NV_OP_RCP, t[3]);
+
+   for (c = 0; c < 4; ++c) {
+      if (!(mask & (1 << c)))
+         continue;
+      t[c] = emit_fetch(bld, insn, 0, c);
+
+      if (t[c]->insn->opcode != NV_OP_PINTERP)
+         continue;
+      mask &= ~(1 << c);
+
+      t[c] = bld_clone(bld, t[c]->insn);
+      nv_reference(bld->pc, t[c]->insn, 1, t[3]);
+   }
+   if (mask == 0)
+      return;
+
+   t[3] = emit_fetch(bld, insn, 0, 3);
+   t[3] = bld_insn_1(bld, NV_OP_RCP, t[3]);
+
+   for (c = 0; c < 4; ++c)
+      if (mask & (1 << c))
+         t[c] = bld_insn_2(bld, NV_OP_MUL_F32, t[c], t[3]);
+}
+
+/* For a quad of threads / top left, top right, bottom left, bottom right
+ * pixels, do a different operation, and take src0 from a specific thread.
+ */
+#define QOP_ADD 0
+#define QOP_SUBR 1
+#define QOP_SUB 2
+#define QOP_MOV1 3
+
+#define QOP(a, b, c, d) \
+   ((QOP_##a << 0) | (QOP_##b << 2) | (QOP_##c << 4) | (QOP_##d << 6))
+
+static INLINE struct nv_value *
+bld_quadop(struct bld_context *bld, ubyte qop, struct nv_value *src0, int lane,
+           struct nv_value *src1, boolean wp)
+{
+   struct nv_value *val = bld_insn_2(bld, NV_OP_QUADOP, src0, src1);
+   val->insn->lanes = lane;
+   val->insn->quadop = qop;
+   if (wp) {
+      assert(!"quadop predicate write");
+   }
+   return val;
+}
+
+/* order of TGSI operands: x y z layer shadow lod/bias */
+/* order of native operands: layer x y z | lod/bias shadow */
+static struct nv_instruction *
+emit_tex(struct bld_context *bld, uint opcode, int tic, int tsc,
+         struct nv_value *dst[4], struct nv_value *arg[4],
+         int dim, int array, int cube, int shadow)
+{
+   struct nv_value *src[4];
+   struct nv_instruction *nvi, *bnd;
+   int c;
+   int s = 0;
+   boolean lodbias = opcode == NV_OP_TXB || opcode == NV_OP_TXL;
+
+   if (array)
+      arg[dim] = bld_cvt(bld, NV_TYPE_U32, NV_TYPE_F32, arg[dim]);
+
+   /* ensure that all inputs reside in a GPR */
+   for (c = 0; c < dim + array + cube + shadow; ++c)
+      (src[c] = bld_insn_1(bld, NV_OP_MOV, arg[c]))->insn->fixed = 1;
+
+   /* bind { layer x y z } and { lod/bias shadow } to adjacent regs */
+
+   bnd = new_instruction(bld->pc, NV_OP_BIND);
+   if (array) {
+      src[s] = new_value(bld->pc, NV_FILE_GPR, 4);
+      bld_def(bnd, s, src[s]);
+      nv_reference(bld->pc, bnd, s++, arg[dim + cube]);
+   }
+   for (c = 0; c < dim + cube; ++c, ++s) {
+      src[s] = bld_def(bnd, s, new_value(bld->pc, NV_FILE_GPR, 4));
+      nv_reference(bld->pc, bnd, s, arg[c]);
+   }
+
+   if (shadow || lodbias) {
+      bnd = new_instruction(bld->pc, NV_OP_BIND);
+
+      if (lodbias) {
+         src[s] = new_value(bld->pc, NV_FILE_GPR, 4);
+         bld_def(bnd, 0, src[s++]);
+         nv_reference(bld->pc, bnd, 0, arg[dim + cube + array + shadow]);
+      }
+      if (shadow) {
+         src[s] = new_value(bld->pc, NV_FILE_GPR, 4);
+         bld_def(bnd, lodbias, src[s++]);
+         nv_reference(bld->pc, bnd, lodbias, arg[dim + cube + array]);
+      }
+   }
+
+   nvi = new_instruction(bld->pc, opcode);
+   for (c = 0; c < 4; ++c)
+      dst[c] = bld_def(nvi, c, new_value(bld->pc, NV_FILE_GPR, 4));
+   for (c = 0; c < s; ++c)
+      nv_reference(bld->pc, nvi, c, src[c]);
+
+   nvi->ext.tex.t = tic;
+   nvi->ext.tex.s = tsc;
+   nvi->tex_mask = 0xf;
+   nvi->tex_cube = cube;
+   nvi->tex_dim = dim;
+   nvi->tex_cube = cube;
+   nvi->tex_shadow = shadow;
+   nvi->tex_live = 0;
+
+   return nvi;
+}
+
+/*
+static boolean
+bld_is_constant(struct nv_value *val)
+{
+   if (val->reg.file == NV_FILE_IMM)
+      return TRUE;
+   return val->insn && nvCG_find_constant(val->insn->src[0]);
+}
+*/
+
+static void
+bld_tex(struct bld_context *bld, struct nv_value *dst0[4],
+        const struct tgsi_full_instruction *insn)
+{
+   struct nv_value *t[4], *s[3];
+   uint opcode = translate_opcode(insn->Instruction.Opcode);
+   int c, dim, array, cube, shadow;
+   const int lodbias = opcode == NV_OP_TXB || opcode == NV_OP_TXL;
+   const int tic = insn->Src[1].Register.Index;
+   const int tsc = tic;
+
+   describe_texture_target(insn->Texture.Texture, &dim, &array, &cube, &shadow);
+
+   assert(dim + array + shadow + lodbias <= 5);
+
+   if (!cube && insn->Instruction.Opcode == TGSI_OPCODE_TXP)
+      load_proj_tex_coords(bld, t, dim, shadow, insn);
+   else {
+      for (c = 0; c < dim + cube + array; ++c)
+         t[c] = emit_fetch(bld, insn, 0, c);
+      if (shadow)
+         t[c] = emit_fetch(bld, insn, 0, MAX2(c, 2));
+   }
+
+   if (cube) {
+      for (c = 0; c < 3; ++c)
+         s[c] = bld_insn_1(bld, NV_OP_ABS_F32, t[c]);
+
+      s[0] = bld_insn_2(bld, NV_OP_MAX_F32, s[0], s[1]);
+      s[0] = bld_insn_2(bld, NV_OP_MAX_F32, s[0], s[2]);
+      s[0] = bld_insn_1(bld, NV_OP_RCP, s[0]);
+
+      for (c = 0; c < 3; ++c)
+         t[c] = bld_insn_2(bld, NV_OP_MUL_F32, t[c], s[0]);
+   }
+
+   if (lodbias)
+      t[dim + cube + array + shadow] = emit_fetch(bld, insn, 0, 3);
+
+   emit_tex(bld, opcode, tic, tsc, dst0, t, dim, array, cube, shadow);
+}
+
+static INLINE struct nv_value *
+bld_dot(struct bld_context *bld, const struct tgsi_full_instruction *insn,
+        int n)
+{
+   struct nv_value *dotp, *src0, *src1;
+   int c;
+
+   src0 = emit_fetch(bld, insn, 0, 0);
+   src1 = emit_fetch(bld, insn, 1, 0);
+   dotp = bld_insn_2(bld, NV_OP_MUL_F32, src0, src1);
+
+   for (c = 1; c < n; ++c) {
+      src0 = emit_fetch(bld, insn, 0, c);
+      src1 = emit_fetch(bld, insn, 1, c);
+      dotp = bld_insn_3(bld, NV_OP_MAD_F32, src0, src1, dotp);
+   }
+   return dotp;
+}
+
+#define FOR_EACH_DST0_ENABLED_CHANNEL(chan, inst) \
+   for (chan = 0; chan < 4; ++chan)               \
+      if ((inst)->Dst[0].Register.WriteMask & (1 << chan))
+
+static void
+bld_instruction(struct bld_context *bld,
+                const struct tgsi_full_instruction *insn)
+{
+   struct nv_value *src0;
+   struct nv_value *src1;
+   struct nv_value *src2;
+   struct nv_value *dst0[4] = { NULL };
+   struct nv_value *temp;
+   int c;
+   uint opcode = translate_opcode(insn->Instruction.Opcode);
+   uint8_t mask = insn->Dst[0].Register.WriteMask;
+
+#ifdef NOUVEAU_DEBUG
+   debug_printf("bld_instruction:"); tgsi_dump_instruction(insn, 1);
+#endif
+       
+   switch (insn->Instruction.Opcode) {
+   case TGSI_OPCODE_ADD:
+   case TGSI_OPCODE_MAX:
+   case TGSI_OPCODE_MIN:
+   case TGSI_OPCODE_MUL:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         src1 = emit_fetch(bld, insn, 1, c);
+         dst0[c] = bld_insn_2(bld, opcode, src0, src1);
+      }
+      break;
+   case TGSI_OPCODE_ARL:
+      src1 = bld_imm_u32(bld, 4);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         src0 = bld_insn_1(bld, NV_OP_FLOOR, src0);
+         src0->insn->ext.cvt.d = NV_TYPE_S32;
+         src0->insn->ext.cvt.s = NV_TYPE_F32;
+         dst0[c] = bld_insn_2(bld, NV_OP_SHL, src0, src1);
+      }
+      break;
+   case TGSI_OPCODE_CMP:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         src0 = bld_setp(bld, NV_OP_SET_F32, NV_CC_LT, src0, bld->zero);
+         src1 = emit_fetch(bld, insn, 1, c);
+         src2 = emit_fetch(bld, insn, 2, c);
+         dst0[c] = bld_insn_3(bld, NV_OP_SELP, src1, src2, src0);
+      }
+      break;
+   case TGSI_OPCODE_COS:
+   case TGSI_OPCODE_SIN:
+      src0 = emit_fetch(bld, insn, 0, 0);
+      temp = bld_insn_1(bld, NV_OP_PRESIN, src0);
+      if (insn->Dst[0].Register.WriteMask & 7)
+         temp = bld_insn_1(bld, opcode, temp);
+      for (c = 0; c < 3; ++c)
+         if (insn->Dst[0].Register.WriteMask & (1 << c))
+            dst0[c] = temp;
+      if (!(insn->Dst[0].Register.WriteMask & (1 << 3)))
+         break;
+      src0 = emit_fetch(bld, insn, 0, 3);
+      temp = bld_insn_1(bld, NV_OP_PRESIN, src0);
+      dst0[3] = bld_insn_1(bld, opcode, temp);
+      break;
+   case TGSI_OPCODE_DP2:
+      temp = bld_dot(bld, insn, 2);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_DP3:
+      temp = bld_dot(bld, insn, 3);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_DP4:
+      temp = bld_dot(bld, insn, 4);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_DPH:
+      src0 = bld_dot(bld, insn, 3);
+      src1 = emit_fetch(bld, insn, 1, 3);
+      temp = bld_insn_2(bld, NV_OP_ADD_F32, src0, src1);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_DST:
+      if (insn->Dst[0].Register.WriteMask & 1)
+         dst0[0] = bld_imm_f32(bld, 1.0f);
+      if (insn->Dst[0].Register.WriteMask & 2) {
+         src0 = emit_fetch(bld, insn, 0, 1);
+         src1 = emit_fetch(bld, insn, 1, 1);
+         dst0[1] = bld_insn_2(bld, NV_OP_MUL_F32, src0, src1);
+      }
+      if (insn->Dst[0].Register.WriteMask & 4)
+         dst0[2] = emit_fetch(bld, insn, 0, 2);
+      if (insn->Dst[0].Register.WriteMask & 8)
+         dst0[3] = emit_fetch(bld, insn, 1, 3);
+      break;
+   case TGSI_OPCODE_EXP:
+      src0 = emit_fetch(bld, insn, 0, 0);
+      temp = bld_insn_1(bld, NV_OP_FLOOR, src0);
+
+      if (insn->Dst[0].Register.WriteMask & 2)
+         dst0[1] = bld_insn_2(bld, NV_OP_SUB_F32, src0, temp);
+      if (insn->Dst[0].Register.WriteMask & 1) {
+         temp = bld_insn_1(bld, NV_OP_PREEX2, temp);
+         dst0[0] = bld_insn_1(bld, NV_OP_EX2, temp);
+      }
+      if (insn->Dst[0].Register.WriteMask & 4) {
+         temp = bld_insn_1(bld, NV_OP_PREEX2, src0);
+         dst0[2] = bld_insn_1(bld, NV_OP_EX2, temp);
+      }
+      if (insn->Dst[0].Register.WriteMask & 8)
+         dst0[3] = bld_imm_f32(bld, 1.0f);
+      break;
+   case TGSI_OPCODE_EX2:
+      src0 = emit_fetch(bld, insn, 0, 0);
+      temp = bld_insn_1(bld, NV_OP_PREEX2, src0);
+      temp = bld_insn_1(bld, NV_OP_EX2, temp);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_FRC:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         dst0[c] = bld_insn_1(bld, NV_OP_FLOOR, src0);
+         dst0[c] = bld_insn_2(bld, NV_OP_SUB_F32, src0, dst0[c]);
+      }
+      break;
+   case TGSI_OPCODE_KIL:
+      for (c = 0; c < 4; ++c)
+         bld_kil(bld, emit_fetch(bld, insn, 0, c));
+      break;
+   case TGSI_OPCODE_KILP:
+      (new_instruction(bld->pc, NV_OP_KIL))->fixed = 1;
+      break;
+   case TGSI_OPCODE_IF:
+   {
+      struct nv_basic_block *b = new_basic_block(bld->pc);
+
+      assert(bld->cond_lvl < BLD_MAX_COND_NESTING);
+
+      nvc0_bblock_attach(bld->pc->current_block, b, CFG_EDGE_FORWARD);
+
+      bld->join_bb[bld->cond_lvl] = bld->pc->current_block;
+      bld->cond_bb[bld->cond_lvl] = bld->pc->current_block;
+
+      src1 = bld_setp(bld, NV_OP_SET_U32, NV_CC_EQ,
+                      emit_fetch(bld, insn, 0, 0), bld->zero);
+
+      bld_flow(bld, NV_OP_BRA, src1, NULL, (bld->cond_lvl == 0));
+
+      ++bld->cond_lvl;
+      bld_new_block(bld, b);
+   }
+      break;
+   case TGSI_OPCODE_ELSE:
+   {
+      struct nv_basic_block *b = new_basic_block(bld->pc);
+
+      --bld->cond_lvl;
+      nvc0_bblock_attach(bld->join_bb[bld->cond_lvl], b, CFG_EDGE_FORWARD);
+
+      bld->cond_bb[bld->cond_lvl]->exit->target = b;
+      bld->cond_bb[bld->cond_lvl] = bld->pc->current_block;
+
+      new_instruction(bld->pc, NV_OP_BRA)->terminator = 1;
+
+      ++bld->cond_lvl;
+      bld_new_block(bld, b);
+   }
+      break;
+   case TGSI_OPCODE_ENDIF:
+   {
+      struct nv_basic_block *b = new_basic_block(bld->pc);
+
+      --bld->cond_lvl;
+      nvc0_bblock_attach(bld->pc->current_block, b, bld->out_kind);
+      nvc0_bblock_attach(bld->cond_bb[bld->cond_lvl], b, CFG_EDGE_FORWARD);
+
+      bld->cond_bb[bld->cond_lvl]->exit->target = b;
+
+      bld_new_block(bld, b);
+
+      if (!bld->cond_lvl && bld->join_bb[bld->cond_lvl]) {
+         bld->join_bb[bld->cond_lvl]->exit->prev->target = b;
+         new_instruction(bld->pc, NV_OP_JOIN)->join = 1;
+      }
+   }
+      break;
+   case TGSI_OPCODE_BGNLOOP:
+   {
+      struct nv_basic_block *bl = new_basic_block(bld->pc);
+      struct nv_basic_block *bb = new_basic_block(bld->pc);
+
+      assert(bld->loop_lvl < BLD_MAX_LOOP_NESTING);
+
+      bld->loop_bb[bld->loop_lvl] = bl;
+      bld->brkt_bb[bld->loop_lvl] = bb;
+
+      nvc0_bblock_attach(bld->pc->current_block, bl, CFG_EDGE_LOOP_ENTER);
+
+      bld_new_block(bld, bld->loop_bb[bld->loop_lvl++]);
+
+      if (bld->loop_lvl == bld->pc->loop_nesting_bound)
+         bld->pc->loop_nesting_bound++;
+
+      bld_clear_def_use(&bld->tvs[0][0], BLD_MAX_TEMPS, bld->loop_lvl);
+      bld_clear_def_use(&bld->avs[0][0], BLD_MAX_ADDRS, bld->loop_lvl);
+      bld_clear_def_use(&bld->pvs[0][0], BLD_MAX_PREDS, bld->loop_lvl);
+   }
+      break;
+   case TGSI_OPCODE_BRK:
+   {
+      struct nv_basic_block *bb = bld->brkt_bb[bld->loop_lvl - 1];
+
+      bld_flow(bld, NV_OP_BRA, NULL, bb, FALSE);
+
+      if (bld->out_kind == CFG_EDGE_FORWARD) /* else we already had BRK/CONT */
+         nvc0_bblock_attach(bld->pc->current_block, bb, CFG_EDGE_LOOP_LEAVE);
+
+      bld->out_kind = CFG_EDGE_FAKE;
+   }
+      break;
+   case TGSI_OPCODE_CONT:
+   {
+      struct nv_basic_block *bb = bld->loop_bb[bld->loop_lvl - 1];
+
+      bld_flow(bld, NV_OP_BRA, NULL, bb, FALSE);
+
+      nvc0_bblock_attach(bld->pc->current_block, bb, CFG_EDGE_BACK);
+
+      if ((bb = bld->join_bb[bld->cond_lvl - 1])) {
+         bld->join_bb[bld->cond_lvl - 1] = NULL;
+         nvc0_insn_delete(bb->exit->prev);
+      }
+      bld->out_kind = CFG_EDGE_FAKE;
+   }
+      break;
+   case TGSI_OPCODE_ENDLOOP:
+   {
+      struct nv_basic_block *bb = bld->loop_bb[bld->loop_lvl - 1];
+
+      bld_flow(bld, NV_OP_BRA, NULL, bb, FALSE);
+
+      nvc0_bblock_attach(bld->pc->current_block, bb, CFG_EDGE_BACK);
+
+      bld_loop_end(bld, bb); /* replace loop-side operand of the phis */
+
+      bld_new_block(bld, bld->brkt_bb[--bld->loop_lvl]);
+   }
+      break;
+   case TGSI_OPCODE_ABS:
+   case TGSI_OPCODE_CEIL:
+   case TGSI_OPCODE_FLR:
+   case TGSI_OPCODE_TRUNC:
+   case TGSI_OPCODE_DDX:
+   case TGSI_OPCODE_DDY:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         dst0[c] = bld_insn_1(bld, opcode, src0);
+      }           
+      break;
+   case TGSI_OPCODE_LIT:
+      bld_lit(bld, dst0, insn);
+      break;
+   case TGSI_OPCODE_LRP:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         src1 = emit_fetch(bld, insn, 1, c);
+         src2 = emit_fetch(bld, insn, 2, c);
+         dst0[c] = bld_insn_2(bld, NV_OP_SUB_F32, src1, src2);
+         dst0[c] = bld_insn_3(bld, NV_OP_MAD_F32, dst0[c], src0, src2);
+      }
+      break;
+   case TGSI_OPCODE_MOV:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = emit_fetch(bld, insn, 0, c);
+      break;
+   case TGSI_OPCODE_MAD:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         src1 = emit_fetch(bld, insn, 1, c);
+         src2 = emit_fetch(bld, insn, 2, c);
+         dst0[c] = bld_insn_3(bld, opcode, src0, src1, src2);
+      }
+      break;
+   case TGSI_OPCODE_POW:
+      src0 = emit_fetch(bld, insn, 0, 0);
+      src1 = emit_fetch(bld, insn, 1, 0);
+      temp = bld_pow(bld, src0, src1);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_LOG:
+      src0 = emit_fetch(bld, insn, 0, 0);
+      src0 = bld_insn_1(bld, NV_OP_ABS_F32, src0);
+      temp = bld_insn_1(bld, NV_OP_LG2, src0);
+      dst0[2] = temp;
+      if (insn->Dst[0].Register.WriteMask & 3) {
+         temp = bld_insn_1(bld, NV_OP_FLOOR, temp);
+         dst0[0] = temp;
+      }
+      if (insn->Dst[0].Register.WriteMask & 2) {
+         temp = bld_insn_1(bld, NV_OP_PREEX2, temp);
+         temp = bld_insn_1(bld, NV_OP_EX2, temp);
+         temp = bld_insn_1(bld, NV_OP_RCP, temp);
+         dst0[1] = bld_insn_2(bld, NV_OP_MUL_F32, src0, temp);
+      }
+      if (insn->Dst[0].Register.WriteMask & 8)
+         dst0[3] = bld_imm_f32(bld, 1.0f);
+      break;
+   case TGSI_OPCODE_RCP:
+   case TGSI_OPCODE_LG2:
+      src0 = emit_fetch(bld, insn, 0, 0);
+      temp = bld_insn_1(bld, opcode, src0);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_RSQ:
+      src0 = emit_fetch(bld, insn, 0, 0);
+      temp = bld_insn_1(bld, NV_OP_ABS_F32, src0);
+      temp = bld_insn_1(bld, NV_OP_RSQ, temp);
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn)
+         dst0[c] = temp;
+      break;
+   case TGSI_OPCODE_SLT:
+   case TGSI_OPCODE_SGE:
+   case TGSI_OPCODE_SEQ:
+   case TGSI_OPCODE_SGT:
+   case TGSI_OPCODE_SLE:
+   case TGSI_OPCODE_SNE:
+   case TGSI_OPCODE_ISLT:
+   case TGSI_OPCODE_ISGE:
+   case TGSI_OPCODE_USEQ:
+   case TGSI_OPCODE_USGE:
+   case TGSI_OPCODE_USLT:
+   case TGSI_OPCODE_USNE:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         src1 = emit_fetch(bld, insn, 1, c);
+         dst0[c] = bld_insn_2(bld, opcode, src0, src1);
+         dst0[c]->insn->set_cond = translate_setcc(insn->Instruction.Opcode);
+      }
+      break;
+   case TGSI_OPCODE_SCS:
+      if (insn->Dst[0].Register.WriteMask & 0x3) {
+         src0 = emit_fetch(bld, insn, 0, 0);
+         temp = bld_insn_1(bld, NV_OP_PRESIN, src0);
+         if (insn->Dst[0].Register.WriteMask & 0x1)
+            dst0[0] = bld_insn_1(bld, NV_OP_COS, temp);
+         if (insn->Dst[0].Register.WriteMask & 0x2)
+            dst0[1] = bld_insn_1(bld, NV_OP_SIN, temp);
+      }
+      if (insn->Dst[0].Register.WriteMask & 0x4)
+         dst0[2] = bld_imm_f32(bld, 0.0f);
+      if (insn->Dst[0].Register.WriteMask & 0x8)
+         dst0[3] = bld_imm_f32(bld, 1.0f);
+      break;
+   case TGSI_OPCODE_SSG:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) { /* XXX: set lt, set gt, sub */
+         src0 = emit_fetch(bld, insn, 0, c);
+         src1 = bld_setp(bld, NV_OP_SET_F32, NV_CC_EQ, src0, bld->zero);
+         temp = bld_insn_2(bld, NV_OP_AND, src0, bld_imm_u32(bld, 0x80000000));
+         temp = bld_insn_2(bld, NV_OP_OR,  temp, bld_imm_f32(bld, 1.0f));
+         dst0[c] = bld_insn_1(bld, NV_OP_MOV, temp);
+         bld_src_predicate(bld, dst0[c]->insn, 1, src1);
+      }
+      break;
+   case TGSI_OPCODE_SUB:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         src0 = emit_fetch(bld, insn, 0, c);
+         src1 = emit_fetch(bld, insn, 1, c);
+         dst0[c] = bld_insn_2(bld, NV_OP_SUB_F32, src0, src1);
+      }
+      break;
+   case TGSI_OPCODE_TEX:
+   case TGSI_OPCODE_TXB:
+   case TGSI_OPCODE_TXL:
+   case TGSI_OPCODE_TXP:
+      bld_tex(bld, dst0, insn);
+      break;
+   case TGSI_OPCODE_XPD:
+      FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {
+         if (c == 3) {
+            dst0[3] = bld_imm_f32(bld, 1.0f);
+            break;
+         }
+         src0 = emit_fetch(bld, insn, 1, (c + 1) % 3);
+         src1 = emit_fetch(bld, insn, 0, (c + 2) % 3);
+         dst0[c] = bld_insn_2(bld, NV_OP_MUL_F32, src0, src1);
+
+         src0 = emit_fetch(bld, insn, 0, (c + 1) % 3);
+         src1 = emit_fetch(bld, insn, 1, (c + 2) % 3);
+         dst0[c] = bld_insn_3(bld, NV_OP_MAD_F32, src0, src1, dst0[c]);
+
+         dst0[c]->insn->src[2]->mod ^= NV_MOD_NEG;
+      }
+      break;
+   case TGSI_OPCODE_RET:
+      (new_instruction(bld->pc, NV_OP_RET))->fixed = 1;
+      break;
+   case TGSI_OPCODE_END:
+      /* VP outputs are exported in-place as scalars, optimization later */
+      if (bld->pc->is_fragprog)
+         bld_export_fp_outputs(bld);
+      if (bld->ti->append_ucp)
+         bld_append_vp_ucp(bld);
+      return;
+   default:
+      NOUVEAU_ERR("unhandled opcode %u\n", insn->Instruction.Opcode);
+      abort();
+      return;
+   }
+
+   if (insn->Dst[0].Register.File == TGSI_FILE_OUTPUT &&
+       !bld->pc->is_fragprog) {
+      struct nv_instruction *mi = NULL;
+      uint size;
+
+      if (bld->ti->append_ucp) {
+         if (bld->ti->output_loc[insn->Dst[0].Register.Index][0] == 0x70) {
+            bld->hpos_index = insn->Dst[0].Register.Index;
+            for (c = 0; c < 4; ++c)
+               if (mask & (1 << c))
+                  STORE_OUTP(insn->Dst[0].Register.Index, c, dst0[c]);
+         }
+      }
+
+      for (c = 0; c < 4; ++c)
+         if ((mask & (1 << c)) &&
+             ((dst0[c]->reg.file == NV_FILE_IMM) ||
+              (dst0[c]->reg.id == 63 && dst0[c]->reg.file == NV_FILE_GPR)))
+            dst0[c] = bld_insn_1(bld, NV_OP_MOV, dst0[c]);
+
+      c = 0;
+      if ((mask & 0x3) == 0x3) {
+         mask &= ~0x3;
+         size = 8;
+         mi = bld_insn_2(bld, NV_OP_BIND, dst0[0], dst0[1])->insn;
+      }
+      if ((mask & 0xc) == 0xc) {
+         mask &= ~0xc;
+         if (mi) {
+            size = 16;
+            nv_reference(bld->pc, mi, 2, dst0[2]);
+            nv_reference(bld->pc, mi, 3, dst0[3]);
+         } else {
+            c = 2;
+            size = 8;
+            mi = bld_insn_2(bld, NV_OP_BIND, dst0[2], dst0[3])->insn;
+         }
+      } else
+      if (mi && (mask & 0x4)) {
+         size = 12;
+         mask &= ~0x4;
+         nv_reference(bld->pc, mi, 2, dst0[2]);
+      }
+
+      if (mi) {
+         struct nv_instruction *ex = new_instruction(bld->pc, NV_OP_EXPORT);
+         int s;
+
+         nv_reference(bld->pc, ex, 0, new_value(bld->pc, NV_FILE_MEM_V, 4));
+         nv_reference(bld->pc, ex, 1, mi->def[0]);
+
+         for (s = 1; s < size / 4; ++s) {
+            bld_def(mi, s, new_value(bld->pc, NV_FILE_GPR, 4));
+            nv_reference(bld->pc, ex, s + 1, mi->def[s]);
+         }
+
+         ex->fixed = 1;
+         ex->src[0]->value->reg.size = size;
+         ex->src[0]->value->reg.address =
+            bld->ti->output_loc[insn->Dst[0].Register.Index][c];
+      }
+   }
+
+   for (c = 0; c < 4; ++c)
+      if (mask & (1 << c))
+         emit_store(bld, insn, c, dst0[c]);
+}
+
+static INLINE void
+bld_free_registers(struct bld_register *base, int n)
+{
+   int i, c;
+
+   for (i = 0; i < n; ++i)
+      for (c = 0; c < 4; ++c)
+         util_dynarray_fini(&base[i * 4 + c].vals);
+}
+
+int
+nvc0_tgsi_to_nc(struct nv_pc *pc, struct nvc0_translation_info *ti)
+{
+   struct bld_context *bld = CALLOC_STRUCT(bld_context);
+   unsigned ip;
+
+   pc->root[0] = pc->current_block = new_basic_block(pc);
+
+   bld->pc = pc;
+   bld->ti = ti;
+
+   pc->loop_nesting_bound = 1;
+
+   bld->zero = new_value(pc, NV_FILE_GPR, 4);
+   bld->zero->reg.id = 63;
+
+   if (pc->is_fragprog) {
+      struct nv_value *mem = new_value(pc, NV_FILE_MEM_V, 4);
+      mem->reg.address = 0x7c;
+
+      bld->frag_coord[3] = bld_insn_1(bld, NV_OP_LINTERP, mem);
+      bld->frag_coord[3] = bld_insn_1(bld, NV_OP_RCP, bld->frag_coord[3]);
+   }
+
+   for (ip = 0; ip < ti->num_insns; ++ip)
+      bld_instruction(bld, &ti->insns[ip]);
+
+   bld_free_registers(&bld->tvs[0][0], BLD_MAX_TEMPS);
+   bld_free_registers(&bld->avs[0][0], BLD_MAX_ADDRS);
+   bld_free_registers(&bld->pvs[0][0], BLD_MAX_PREDS);
+   bld_free_registers(&bld->ovs[0][0], PIPE_MAX_SHADER_OUTPUTS);
+
+   FREE(bld);
+   return 0;
+}
+
+/* If a variable is assigned in a loop, replace all references to the value
+ * from outside the loop with a phi value.
+ */
+static void
+bld_replace_value(struct nv_pc *pc, struct nv_basic_block *b,
+                  struct nv_value *old_val,
+                  struct nv_value *new_val)
+{
+   struct nv_instruction *nvi;
+
+   for (nvi = b->phi ? b->phi : b->entry; nvi; nvi = nvi->next) {
+      int s;
+      for (s = 0; s < 6 && nvi->src[s]; ++s)
+         if (nvi->src[s]->value == old_val)
+            nv_reference(pc, nvi, s, new_val);
+   }
+
+   b->pass_seq = pc->pass_seq;
+
+   if (b->out[0] && b->out[0]->pass_seq < pc->pass_seq)
+      bld_replace_value(pc, b->out[0], old_val, new_val);
+
+   if (b->out[1] && b->out[1]->pass_seq < pc->pass_seq)
+      bld_replace_value(pc, b->out[1], old_val, new_val);
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_transfer.c b/src/gallium/drivers/nvc0/nvc0_transfer.c
new file mode 100644 (file)
index 0000000..286b382
--- /dev/null
@@ -0,0 +1,381 @@
+
+#include "util/u_format.h"
+
+#include "nvc0_context.h"
+#include "nvc0_transfer.h"
+
+#include "nv50_defs.xml.h"
+
+struct nvc0_transfer {
+   struct pipe_transfer base;
+   struct nvc0_m2mf_rect rect[2];
+   uint32_t nblocksx;
+   uint32_t nblocksy;
+};
+
+static void
+nvc0_m2mf_transfer_rect(struct pipe_screen *pscreen,
+                        const struct nvc0_m2mf_rect *dst,
+                        const struct nvc0_m2mf_rect *src,
+                        uint32_t nblocksx, uint32_t nblocksy)
+{
+   struct nouveau_channel *chan = nouveau_screen(pscreen)->channel;
+   const int cpp = dst->cpp;
+   uint32_t src_ofst = src->base;
+   uint32_t dst_ofst = dst->base;
+   uint32_t height = nblocksy;
+   uint32_t sy = src->y;
+   uint32_t dy = dst->y;
+   uint32_t exec = (1 << 20);
+
+   assert(dst->cpp == src->cpp);
+
+   if (nouveau_bo_tile_layout(src->bo)) {
+      BEGIN_RING(chan, RING_MF(TILING_MODE_IN), 5);
+      OUT_RING  (chan, src->tile_mode);
+      OUT_RING  (chan, src->width * cpp);
+      OUT_RING  (chan, src->height);
+      OUT_RING  (chan, src->depth);
+      OUT_RING  (chan, src->z);
+   } else {
+      src_ofst += src->y * src->pitch + src->x * cpp;
+
+      BEGIN_RING(chan, RING_MF(PITCH_IN), 1);
+      OUT_RING  (chan, src->width * cpp);
+
+      exec |= NVC0_M2MF_EXEC_LINEAR_IN;
+   }
+
+   if (nouveau_bo_tile_layout(dst->bo)) {
+      BEGIN_RING(chan, RING_MF(TILING_MODE_OUT), 5);
+      OUT_RING  (chan, dst->tile_mode);
+      OUT_RING  (chan, dst->width * cpp);
+      OUT_RING  (chan, dst->height);
+      OUT_RING  (chan, dst->depth);
+      OUT_RING  (chan, dst->z);
+   } else {
+      dst_ofst += dst->y * dst->pitch + dst->x * cpp;
+
+      BEGIN_RING(chan, RING_MF(PITCH_OUT), 1);
+      OUT_RING  (chan, dst->width * cpp);
+
+      exec |= NVC0_M2MF_EXEC_LINEAR_OUT;
+   }
+
+   while (height) {
+      int line_count = height > 2047 ? 2047 : height;
+
+      MARK_RING (chan, 17, 4);
+
+      BEGIN_RING(chan, RING_MF(OFFSET_IN_HIGH), 2);
+      OUT_RELOCh(chan, src->bo, src_ofst, src->domain | NOUVEAU_BO_RD);
+      OUT_RELOCl(chan, src->bo, src_ofst, src->domain | NOUVEAU_BO_RD);
+
+      BEGIN_RING(chan, RING_MF(OFFSET_OUT_HIGH), 2);
+      OUT_RELOCh(chan, dst->bo, dst_ofst, dst->domain | NOUVEAU_BO_WR);
+      OUT_RELOCl(chan, dst->bo, dst_ofst, dst->domain | NOUVEAU_BO_WR);
+
+      if (!(exec & NVC0_M2MF_EXEC_LINEAR_IN)) {
+         BEGIN_RING(chan, RING_MF(TILING_POSITION_IN_X), 2);
+         OUT_RING  (chan, src->x * cpp);
+         OUT_RING  (chan, sy);
+      } else {
+         src_ofst += line_count * src->pitch;
+      }
+      if (!(exec & NVC0_M2MF_EXEC_LINEAR_OUT)) {
+         BEGIN_RING(chan, RING_MF(TILING_POSITION_OUT_X), 2);
+         OUT_RING  (chan, dst->x * cpp);
+         OUT_RING  (chan, dy);
+      } else {
+         dst_ofst += line_count * dst->pitch;
+      }
+
+      BEGIN_RING(chan, RING_MF(LINE_LENGTH_IN), 2);
+      OUT_RING  (chan, nblocksx * cpp);
+      OUT_RING  (chan, line_count);
+      BEGIN_RING(chan, RING_MF(EXEC), 1);
+      OUT_RING  (chan, exec);
+
+      height -= line_count;
+      sy += line_count;
+      dy += line_count;
+   }
+}
+
+void
+nvc0_m2mf_push_linear(struct nvc0_context *nvc0,
+                      struct nouveau_bo *dst, unsigned domain, int offset,
+                      unsigned size, void *data)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   uint32_t *src = (uint32_t *)data;
+   unsigned count = (size + 3) / 4;
+
+   MARK_RING (chan, 8, 2);
+
+   BEGIN_RING(chan, RING_MF(OFFSET_OUT_HIGH), 2);
+   OUT_RELOCh(chan, dst, offset, domain | NOUVEAU_BO_WR);
+   OUT_RELOCl(chan, dst, offset, domain | NOUVEAU_BO_WR);
+   BEGIN_RING(chan, RING_MF(LINE_LENGTH_IN), 2);
+   OUT_RING  (chan, size);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_MF(EXEC), 1);
+   OUT_RING  (chan, 0x100111);
+
+   while (count) {
+      unsigned nr = AVAIL_RING(chan);
+
+      if (nr < 9) {
+         FIRE_RING(chan);
+         nouveau_bo_validate(chan, dst, NOUVEAU_BO_WR);
+         continue;
+      }
+      nr = MIN2(count, nr - 1);
+      nr = MIN2(nr, NV04_PFIFO_MAX_PACKET_LEN);
+   
+      BEGIN_RING_NI(chan, RING_MF(DATA), nr);
+      OUT_RINGp (chan, src, nr);
+
+      src += nr;
+      count -= nr;
+   }
+}
+
+void
+nvc0_m2mf_copy_linear(struct nvc0_context *nvc0,
+                      struct nouveau_bo *dst, unsigned dstoff, unsigned dstdom,
+                      struct nouveau_bo *src, unsigned srcoff, unsigned srcdom,
+                      unsigned size)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+   while (size) {
+      unsigned bytes = MIN2(size, 1 << 17);
+
+      MARK_RING (chan, 11, 4);
+
+      BEGIN_RING(chan, RING_MF(OFFSET_OUT_HIGH), 2);
+      OUT_RELOCh(chan, dst, dstoff, dstdom | NOUVEAU_BO_WR);
+      OUT_RELOCl(chan, dst, dstoff, dstdom | NOUVEAU_BO_WR);
+      BEGIN_RING(chan, RING_MF(OFFSET_IN_HIGH), 2);
+      OUT_RELOCh(chan, src, srcoff, srcdom | NOUVEAU_BO_RD);
+      OUT_RELOCl(chan, src, srcoff, srcdom | NOUVEAU_BO_RD);
+      BEGIN_RING(chan, RING_MF(LINE_LENGTH_IN), 2);
+      OUT_RING  (chan, bytes);
+      OUT_RING  (chan, 1);
+      BEGIN_RING(chan, RING_MF(EXEC), 1);
+      OUT_RING  (chan, (1 << NVC0_M2MF_EXEC_INC__SHIFT) |
+                 NVC0_M2MF_EXEC_LINEAR_IN | NVC0_M2MF_EXEC_LINEAR_OUT);
+
+      srcoff += bytes;
+      dstoff += bytes;
+      size -= bytes;
+   }
+}
+
+static void
+nvc0_m2mf_push_rect(struct pipe_screen *pscreen,
+                    const struct nvc0_m2mf_rect *dst,
+                    const void *data,
+                    unsigned nblocksx, unsigned nblocksy)
+{
+   struct nouveau_channel *chan;
+   const uint8_t *src = (const uint8_t *)data;
+   const int cpp = dst->cpp;
+   const int line_len = nblocksx * cpp;
+   int dy = dst->y;
+
+   assert(nouveau_bo_tile_layout(dst->bo));
+
+   BEGIN_RING(chan, RING_MF(TILING_MODE_OUT), 5);
+   OUT_RING  (chan, dst->tile_mode);
+   OUT_RING  (chan, dst->width * cpp);
+   OUT_RING  (chan, dst->height);
+   OUT_RING  (chan, dst->depth);
+   OUT_RING  (chan, dst->z);
+
+   while (nblocksy) {
+      int line_count, words;
+      int size = MIN2(AVAIL_RING(chan), NV04_PFIFO_MAX_PACKET_LEN);
+
+      if (size < (12 + words)) {
+         FIRE_RING(chan);
+         continue;
+      }
+      line_count = (size * 4) / line_len;
+      words = (line_count * line_len + 3) / 4;
+
+      BEGIN_RING(chan, RING_MF(OFFSET_OUT_HIGH), 2);
+      OUT_RELOCh(chan, dst->bo, dst->base, dst->domain | NOUVEAU_BO_WR);
+      OUT_RELOCl(chan, dst->bo, dst->base, dst->domain | NOUVEAU_BO_WR);
+
+      BEGIN_RING(chan, RING_MF(TILING_POSITION_OUT_X), 2);
+      OUT_RING  (chan, dst->x * cpp);
+      OUT_RING  (chan, dy);
+      BEGIN_RING(chan, RING_MF(LINE_LENGTH_IN), 2);
+      OUT_RING  (chan, line_len);
+      OUT_RING  (chan, line_count);
+      BEGIN_RING(chan, RING_MF(EXEC), 1);
+      OUT_RING  (chan, (1 << NVC0_M2MF_EXEC_INC__SHIFT) |
+                 NVC0_M2MF_EXEC_PUSH | NVC0_M2MF_EXEC_LINEAR_IN);
+
+      BEGIN_RING_NI(chan, RING_MF(DATA), words);
+      OUT_RINGp (chan, src, words);
+
+      dy += line_count;
+      src += line_len * line_count;
+      nblocksy -= line_count;
+   }
+}
+
+struct pipe_transfer *
+nvc0_miptree_transfer_new(struct pipe_context *pctx,
+                          struct pipe_resource *res,
+                          unsigned level,
+                          unsigned usage,
+                          const struct pipe_box *box)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pctx);
+   struct pipe_screen *pscreen = pctx->screen;
+   struct nouveau_device *dev = nvc0->screen->base.device;
+   struct nvc0_miptree *mt = nvc0_miptree(res);
+   struct nvc0_miptree_level *lvl = &mt->level[level];
+   struct nvc0_transfer *tx;
+   uint32_t size;
+   uint32_t w, h, d, z, layer;
+   int ret;
+
+   if (mt->layout_3d) {
+      z = box->z;
+      d = u_minify(res->depth0, level);
+      layer = 0;
+   } else {
+      z = 0;
+      d = 1;
+      layer = box->z;
+   }
+
+   tx = CALLOC_STRUCT(nvc0_transfer);
+   if (!tx)
+      return NULL;
+
+   pipe_resource_reference(&tx->base.resource, res);
+
+   tx->base.level = level;
+   tx->base.usage = usage;
+   tx->base.box = *box;
+
+   tx->nblocksx = util_format_get_nblocksx(res->format, box->width);
+   tx->nblocksy = util_format_get_nblocksy(res->format, box->height);
+
+   tx->base.stride = tx->nblocksx * util_format_get_blocksize(res->format);
+   tx->base.layer_stride = tx->nblocksy * tx->base.stride;
+
+   w = u_minify(res->width0, level);
+   h = u_minify(res->height0, level);
+
+   tx->rect[0].cpp = tx->rect[1].cpp = util_format_get_blocksize(res->format);
+
+   tx->rect[0].bo = mt->base.bo;
+   tx->rect[0].base = lvl->offset + layer * mt->layer_stride;
+   tx->rect[0].tile_mode = lvl->tile_mode;
+   tx->rect[0].x = util_format_get_nblocksx(res->format, box->x);
+   tx->rect[0].y = util_format_get_nblocksy(res->format, box->y);
+   tx->rect[0].z = z;
+   tx->rect[0].width = util_format_get_nblocksx(res->format, w);
+   tx->rect[0].height = util_format_get_nblocksy(res->format, h);
+   tx->rect[0].depth = d;
+   tx->rect[0].pitch = lvl->pitch;
+   tx->rect[0].domain = NOUVEAU_BO_VRAM;
+
+   size = tx->base.layer_stride;
+
+   ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0,
+                        size * tx->base.box.depth, &tx->rect[1].bo);
+   if (ret) {
+      FREE(tx);
+      return NULL;
+   }
+
+   tx->rect[1].width = tx->nblocksx;
+   tx->rect[1].height = tx->nblocksy;
+   tx->rect[1].depth = 1;
+   tx->rect[1].pitch = tx->base.stride;
+   tx->rect[1].domain = NOUVEAU_BO_GART;
+
+   if (usage & PIPE_TRANSFER_READ) {
+      unsigned i;
+      for (i = 0; i < box->depth; ++i) {
+         nvc0_m2mf_transfer_rect(pscreen, &tx->rect[1], &tx->rect[0],
+                                 tx->nblocksx, tx->nblocksy);
+         if (mt->layout_3d)
+            tx->rect[0].z++;
+         else
+            tx->rect[0].base += mt->layer_stride;
+         tx->rect[1].base += size;
+      }
+   }
+   tx->rect[0].z = z;
+   tx->rect[1].base = 0;
+
+   return &tx->base;
+}
+
+void
+nvc0_miptree_transfer_del(struct pipe_context *pctx,
+                          struct pipe_transfer *transfer)
+{
+   struct pipe_screen *pscreen = pctx->screen;
+   struct nvc0_transfer *tx = (struct nvc0_transfer *)transfer;
+   struct nvc0_miptree *mt = nvc0_miptree(tx->base.resource);
+   unsigned i;
+
+   if (tx->base.usage & PIPE_TRANSFER_WRITE) {
+      for (i = 0; i < tx->base.box.depth; ++i) {
+         nvc0_m2mf_transfer_rect(pscreen, &tx->rect[0], &tx->rect[1],
+                                 tx->nblocksx, tx->nblocksy);
+         if (mt->layout_3d)
+            tx->rect[0].z++;
+         else
+            tx->rect[0].base += mt->layer_stride;
+         tx->rect[1].base += tx->nblocksy * tx->base.stride;
+      }
+   }
+
+   nouveau_bo_ref(NULL, &tx->rect[1].bo);
+   pipe_resource_reference(&transfer->resource, NULL);
+
+   FREE(tx);
+}
+
+void *
+nvc0_miptree_transfer_map(struct pipe_context *pctx,
+                          struct pipe_transfer *transfer)
+{
+   struct nvc0_transfer *tx = (struct nvc0_transfer *)transfer;
+   int ret;
+   unsigned flags = 0;
+
+   if (tx->rect[1].bo->map)
+      return tx->rect[1].bo->map;
+
+   if (transfer->usage & PIPE_TRANSFER_READ)
+      flags = NOUVEAU_BO_RD;
+   if (transfer->usage & PIPE_TRANSFER_WRITE)
+      flags |= NOUVEAU_BO_WR;
+
+   ret = nouveau_bo_map(tx->rect[1].bo, flags);
+   if (ret)
+      return NULL;
+   return tx->rect[1].bo->map;
+}
+
+void
+nvc0_miptree_transfer_unmap(struct pipe_context *pctx,
+                            struct pipe_transfer *transfer)
+{
+   struct nvc0_transfer *tx = (struct nvc0_transfer *)transfer;
+
+   nouveau_bo_unmap(tx->rect[1].bo);
+}
+
diff --git a/src/gallium/drivers/nvc0/nvc0_transfer.h b/src/gallium/drivers/nvc0/nvc0_transfer.h
new file mode 100644 (file)
index 0000000..222f72d
--- /dev/null
@@ -0,0 +1,38 @@
+
+#ifndef __NVC0_TRANSFER_H__
+#define __NVC0_TRANSFER_H__
+
+#include "pipe/p_state.h"
+
+struct pipe_transfer *
+nvc0_miptree_transfer_new(struct pipe_context *pcontext,
+                          struct pipe_resource *pt,
+                          unsigned level,
+                          unsigned usage,
+                          const struct pipe_box *box);
+void
+nvc0_miptree_transfer_del(struct pipe_context *pcontext,
+                          struct pipe_transfer *ptx);
+void *
+nvc0_miptree_transfer_map(struct pipe_context *pcontext,
+                          struct pipe_transfer *ptx);
+void
+nvc0_miptree_transfer_unmap(struct pipe_context *pcontext,
+                            struct pipe_transfer *ptx);
+
+struct nvc0_m2mf_rect {
+   struct nouveau_bo *bo;
+   uint32_t base;
+   unsigned domain;
+   uint32_t pitch;
+   uint32_t width;
+   uint32_t x;
+   uint32_t height;
+   uint32_t y;
+   uint16_t depth;
+   uint16_t z;
+   uint16_t tile_mode;
+   uint16_t cpp;
+};
+
+#endif
diff --git a/src/gallium/drivers/nvc0/nvc0_vbo.c b/src/gallium/drivers/nvc0/nvc0_vbo.c
new file mode 100644 (file)
index 0000000..a14e955
--- /dev/null
@@ -0,0 +1,654 @@
+/*
+ * Copyright 2010 Christoph Bumiller
+ *
+ * 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.
+ */
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "translate/translate.h"
+
+#include "nvc0_context.h"
+#include "nvc0_resource.h"
+
+#include "nvc0_3d.xml.h"
+
+void
+nvc0_vertex_state_delete(struct pipe_context *pipe,
+                         void *hwcso)
+{
+   struct nvc0_vertex_stateobj *so = hwcso;
+
+   if (so->translate)
+      so->translate->release(so->translate);
+   FREE(hwcso);
+}
+
+void *
+nvc0_vertex_state_create(struct pipe_context *pipe,
+                         unsigned num_elements,
+                         const struct pipe_vertex_element *elements)
+{
+    struct nvc0_vertex_stateobj *so;
+    struct translate_key transkey;
+    unsigned i;
+
+    assert(num_elements);
+
+    so = MALLOC(sizeof(*so) +
+                (num_elements - 1) * sizeof(struct nvc0_vertex_element));
+    if (!so)
+        return NULL;
+    so->num_elements = num_elements;
+    so->instance_bits = 0;
+
+    transkey.nr_elements = 0;
+    transkey.output_stride = 0;
+
+    for (i = 0; i < num_elements; ++i) {
+        const struct pipe_vertex_element *ve = &elements[i];
+        const unsigned vbi = ve->vertex_buffer_index;
+        enum pipe_format fmt = ve->src_format;
+
+        so->element[i].pipe = elements[i];
+        so->element[i].state = nvc0_format_table[fmt].vtx;
+
+        if (!so->element[i].state) {
+            switch (util_format_get_nr_components(fmt)) {
+            case 1: fmt = PIPE_FORMAT_R32_FLOAT; break;
+            case 2: fmt = PIPE_FORMAT_R32G32_FLOAT; break;
+            case 3: fmt = PIPE_FORMAT_R32G32B32_FLOAT; break;
+            case 4: fmt = PIPE_FORMAT_R32G32B32A32_FLOAT; break;
+            default:
+                assert(0);
+                return NULL;
+            }
+            so->element[i].state = nvc0_format_table[fmt].vtx;
+        }
+        so->element[i].state |= i;
+
+        if (likely(!ve->instance_divisor)) {
+            unsigned j = transkey.nr_elements++;
+
+            transkey.element[j].type = TRANSLATE_ELEMENT_NORMAL;
+            transkey.element[j].input_format = ve->src_format;
+            transkey.element[j].input_buffer = vbi;
+            transkey.element[j].input_offset = ve->src_offset;
+            transkey.element[j].instance_divisor = ve->instance_divisor;
+
+            transkey.element[j].output_format = fmt;
+            transkey.element[j].output_offset = transkey.output_stride;
+            transkey.output_stride += (util_format_get_stride(fmt, 1) + 3) & ~3;
+        } else {
+           so->instance_bits |= 1 << i;
+        }
+    }
+
+    so->translate = translate_create(&transkey);
+    so->vtx_size = transkey.output_stride / 4;
+    so->vtx_per_packet_max = NV04_PFIFO_MAX_PACKET_LEN / MAX2(so->vtx_size, 1);
+
+    return so;
+}
+
+#define NVC0_3D_VERTEX_ATTRIB_INACTIVE                                       \
+   NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_FLOAT |                                 \
+   NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32 | NVC0_3D_VERTEX_ATTRIB_FORMAT_CONST
+
+#define VTX_ATTR(a, c, t, s)                            \
+   ((NVC0_3D_VTX_ATTR_DEFINE_TYPE_##t) |                \
+    (NVC0_3D_VTX_ATTR_DEFINE_SIZE_##s) |                \
+    ((a) << NVC0_3D_VTX_ATTR_DEFINE_ATTR__SHIFT) |      \
+    ((c) << NVC0_3D_VTX_ATTR_DEFINE_COMP__SHIFT))
+
+static void
+nvc0_emit_vtxattr(struct nvc0_context *nvc0, struct pipe_vertex_buffer *vb,
+                  struct pipe_vertex_element *ve, unsigned attr)
+{
+   const void *data;
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_resource *res = nvc0_resource(vb->buffer);
+   float v[4];
+   int i;
+   const unsigned nc = util_format_get_nr_components(ve->src_format);
+
+   data = nvc0_resource_map_offset(nvc0, res, vb->buffer_offset +
+                                   ve->src_offset, NOUVEAU_BO_RD);
+
+   util_format_read_4f(ve->src_format, v, 0, data, 0, 0, 0, 1, 1);
+
+   BEGIN_RING(chan, RING_3D(VTX_ATTR_DEFINE), nc + 1);
+   OUT_RING  (chan, VTX_ATTR(attr, nc, FLOAT, 32));
+   for (i = 0; i < nc; ++i)
+      OUT_RINGf(chan, v[i]);
+}
+
+static void
+nvc0_prevalidate_vbufs(struct nvc0_context *nvc0)
+{
+   struct pipe_vertex_buffer *vb;
+   struct nvc0_resource *buf;
+   int i;
+   uint32_t base, size;
+
+   nvc0->vbo_fifo = nvc0->vbo_user = 0;
+
+   for (i = 0; i < nvc0->num_vtxbufs; ++i) {
+      vb = &nvc0->vtxbuf[i];
+      if (!vb->stride)
+         continue;
+      buf = nvc0_resource(vb->buffer);
+
+      if (!nvc0_resource_mapped_by_gpu(vb->buffer)) {
+         if (nvc0->vbo_push_hint) {
+            nvc0->vbo_fifo = ~0;
+            continue;
+         } else {
+            if (buf->status & NVC0_BUFFER_STATUS_USER_MEMORY) {
+               nvc0->vbo_user |= 1 << i;
+               assert(vb->stride > vb->buffer_offset);
+               size = vb->stride * (nvc0->vbo_max_index -
+                                    nvc0->vbo_min_index + 1);
+               base = vb->stride * nvc0->vbo_min_index;
+               nvc0_user_buffer_upload(buf, base, size);
+            } else {
+               nvc0_buffer_migrate(nvc0, buf, NOUVEAU_BO_GART);
+            }
+            nvc0->vbo_dirty = TRUE;
+         }
+      }
+      nvc0_bufctx_add_resident(nvc0, NVC0_BUFCTX_VERTEX, buf, NOUVEAU_BO_RD);
+      nvc0_buffer_adjust_score(nvc0, buf, 1);
+   }
+}
+
+static void
+nvc0_update_user_vbufs(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   const uint32_t vertex_count = nvc0->vbo_max_index - nvc0->vbo_min_index + 1;
+   uint32_t base, offset, size;
+   int i;
+   uint32_t written = 0;
+
+   for (i = 0; i < nvc0->vertex->num_elements; ++i) {
+      struct pipe_vertex_element *ve = &nvc0->vertex->element[i].pipe;
+      const int b = ve->vertex_buffer_index;
+      struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[b];
+      struct nvc0_resource *buf = nvc0_resource(vb->buffer);
+
+      if (!(nvc0->vbo_user & (1 << b)))
+         continue;
+
+      if (!vb->stride) {
+         nvc0_emit_vtxattr(nvc0, vb, ve, i);
+         continue;
+      }
+      size = vb->stride * vertex_count;
+      base = vb->stride * nvc0->vbo_min_index;
+
+      if (!(written & (1 << b))) {
+         written |= 1 << b;
+         nvc0_user_buffer_upload(buf, base, size);
+      }
+      offset = vb->buffer_offset + ve->src_offset;
+
+      BEGIN_RING_1I(chan, RING_3D(VERTEX_ARRAY_SELECT), 5);
+      OUT_RING  (chan, i);
+      OUT_RESRCh(chan, buf, size - 1, NOUVEAU_BO_RD);
+      OUT_RESRCl(chan, buf, size - 1, NOUVEAU_BO_RD);
+      OUT_RESRCh(chan, buf, offset, NOUVEAU_BO_RD);
+      OUT_RESRCl(chan, buf, offset, NOUVEAU_BO_RD);
+   }
+   nvc0->vbo_dirty = TRUE;
+}
+
+void
+nvc0_vertex_arrays_validate(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nvc0_vertex_stateobj *vertex = nvc0->vertex;
+   struct pipe_vertex_buffer *vb;
+   struct nvc0_vertex_element *ve;
+   unsigned i;
+
+   nvc0_prevalidate_vbufs(nvc0);
+
+   BEGIN_RING(chan, RING_3D(VERTEX_ATTRIB_FORMAT(0)), vertex->num_elements);
+   for (i = 0; i < vertex->num_elements; ++i) {
+      ve = &vertex->element[i];
+      vb = &nvc0->vtxbuf[ve->pipe.vertex_buffer_index];
+
+      if (likely(vb->stride) || nvc0->vbo_fifo) {
+         OUT_RING(chan, ve->state);
+      } else {
+         OUT_RING(chan, ve->state | NVC0_3D_VERTEX_ATTRIB_FORMAT_CONST);
+         nvc0->vbo_fifo &= ~(1 << i);
+      }
+   }
+
+   for (i = 0; i < vertex->num_elements; ++i) {
+      struct nvc0_resource *res;
+      unsigned size, offset;
+      
+      ve = &vertex->element[i];
+      vb = &nvc0->vtxbuf[ve->pipe.vertex_buffer_index];
+
+      if (unlikely(ve->pipe.instance_divisor)) {
+         if (!(nvc0->state.instance_bits & (1 << i))) {
+            IMMED_RING(chan, RING_3D(VERTEX_ARRAY_PER_INSTANCE(i)), 1);
+         }
+         BEGIN_RING(chan, RING_3D(VERTEX_ARRAY_DIVISOR(i)), 1);
+         OUT_RING  (chan, ve->pipe.instance_divisor);
+      } else
+      if (unlikely(nvc0->state.instance_bits & (1 << i))) {
+         IMMED_RING(chan, RING_3D(VERTEX_ARRAY_PER_INSTANCE(i)), 0);
+      }
+
+      res = nvc0_resource(vb->buffer);
+
+      if (nvc0->vbo_fifo || unlikely(vb->stride == 0)) {
+         if (!nvc0->vbo_fifo)
+            nvc0_emit_vtxattr(nvc0, vb, &ve->pipe, i);
+         BEGIN_RING(chan, RING_3D(VERTEX_ARRAY_FETCH(i)), 1);
+         OUT_RING  (chan, 0);
+         continue;
+      }
+
+      size = vb->buffer->width0;
+      offset = ve->pipe.src_offset + vb->buffer_offset;
+
+      BEGIN_RING(chan, RING_3D(VERTEX_ARRAY_FETCH(i)), 1);
+      OUT_RING  (chan, (1 << 12) | vb->stride);
+      BEGIN_RING_1I(chan, RING_3D(VERTEX_ARRAY_SELECT), 5);
+      OUT_RING  (chan, i);
+      OUT_RESRCh(chan, res, size - 1, NOUVEAU_BO_RD);
+      OUT_RESRCl(chan, res, size - 1, NOUVEAU_BO_RD);
+      OUT_RESRCh(chan, res, offset, NOUVEAU_BO_RD);
+      OUT_RESRCl(chan, res, offset, NOUVEAU_BO_RD);
+   }
+   for (; i < nvc0->state.num_vtxelts; ++i) {
+      BEGIN_RING(chan, RING_3D(VERTEX_ATTRIB_FORMAT(i)), 1);
+      OUT_RING  (chan, NVC0_3D_VERTEX_ATTRIB_INACTIVE);
+      BEGIN_RING(chan, RING_3D(VERTEX_ARRAY_FETCH(i)), 1);
+      OUT_RING  (chan, 0);
+   }
+
+   nvc0->state.num_vtxelts = vertex->num_elements;
+   nvc0->state.instance_bits = vertex->instance_bits;
+}
+
+#define NVC0_PRIM_GL_CASE(n) \
+   case PIPE_PRIM_##n: return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_##n
+
+static INLINE unsigned
+nvc0_prim_gl(unsigned prim)
+{
+   switch (prim) {
+   NVC0_PRIM_GL_CASE(POINTS);
+   NVC0_PRIM_GL_CASE(LINES);
+   NVC0_PRIM_GL_CASE(LINE_LOOP);
+   NVC0_PRIM_GL_CASE(LINE_STRIP);
+   NVC0_PRIM_GL_CASE(TRIANGLES);
+   NVC0_PRIM_GL_CASE(TRIANGLE_STRIP);
+   NVC0_PRIM_GL_CASE(TRIANGLE_FAN);
+   NVC0_PRIM_GL_CASE(QUADS);
+   NVC0_PRIM_GL_CASE(QUAD_STRIP);
+   NVC0_PRIM_GL_CASE(POLYGON);
+   NVC0_PRIM_GL_CASE(LINES_ADJACENCY);
+   NVC0_PRIM_GL_CASE(LINE_STRIP_ADJACENCY);
+   NVC0_PRIM_GL_CASE(TRIANGLES_ADJACENCY);
+   NVC0_PRIM_GL_CASE(TRIANGLE_STRIP_ADJACENCY);
+   /*
+   NVC0_PRIM_GL_CASE(PATCHES); */
+   default:
+      return NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_POINTS;
+      break;
+   }
+}
+
+static void
+nvc0_draw_vbo_flush_notify(struct nouveau_channel *chan)
+{
+   struct nvc0_context *nvc0 = chan->user_private;
+
+   nvc0_bufctx_emit_relocs(nvc0);
+}
+
+#if 0
+static struct nouveau_bo *
+nvc0_tfb_setup(struct nvc0_context *nvc0)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   struct nouveau_bo *tfb = NULL;
+   int ret, i;
+
+   ret = nouveau_bo_new(nvc0->screen->base.device,
+                        NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, 4096, &tfb);
+   if (ret)
+      return NULL;
+
+   ret = nouveau_bo_map(tfb, NOUVEAU_BO_WR);
+   if (ret)
+      return NULL;
+   memset(tfb->map, 0xee, 8 * 4 * 3);
+   nouveau_bo_unmap(tfb);
+
+   BEGIN_RING(chan, RING_3D(TFB_ENABLE), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D(TFB_BUFFER_ENABLE(0)), 5);
+   OUT_RING  (chan, 1);
+   OUT_RELOCh(chan, tfb, 0, NOUVEAU_BO_GART | NOUVEAU_BO_WR);
+   OUT_RELOCl(chan, tfb, 0, NOUVEAU_BO_GART | NOUVEAU_BO_WR);
+   OUT_RING  (chan, tfb->size);
+   OUT_RING  (chan, 0); /* TFB_PRIMITIVE_ID(0) */
+   BEGIN_RING(chan, RING_3D(TFB_UNK0700(0)), 3);
+   OUT_RING  (chan, 0);
+   OUT_RING  (chan, 8); /* TFB_VARYING_COUNT(0) */
+   OUT_RING  (chan, 32); /* TFB_BUFFER_STRIDE(0) */
+   BEGIN_RING(chan, RING_3D(TFB_VARYING_LOCS(0)), 2);
+   OUT_RING  (chan, 0x1f1e1d1c);
+   OUT_RING  (chan, 0xa3a2a1a0);
+   for (i = 1; i < 4; ++i) {
+      BEGIN_RING(chan, RING_3D(TFB_BUFFER_ENABLE(i)), 1);
+      OUT_RING  (chan, 0);
+   }
+   BEGIN_RING(chan, RING_3D(TFB_ENABLE), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D_(0x135c), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D_(0x135c), 1);
+   OUT_RING  (chan, 0);
+
+   return tfb;
+}
+#endif
+
+static void
+nvc0_draw_arrays(struct nvc0_context *nvc0,
+                 unsigned mode, unsigned start, unsigned count,
+                 unsigned instance_count)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   unsigned prim;
+
+   chan->flush_notify = nvc0_draw_vbo_flush_notify;
+   chan->user_private = nvc0;
+
+   prim = nvc0_prim_gl(mode);
+
+   while (instance_count--) {
+      BEGIN_RING(chan, RING_3D(VERTEX_BEGIN_GL), 1);
+      OUT_RING  (chan, prim);
+      BEGIN_RING(chan, RING_3D(VERTEX_BUFFER_FIRST), 2);
+      OUT_RING  (chan, start);
+      OUT_RING  (chan, count);
+      IMMED_RING(chan, RING_3D(VERTEX_END_GL), 0);
+
+      prim |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
+   }
+
+   chan->flush_notify = NULL;
+}
+
+static void
+nvc0_draw_elements_inline_u08(struct nouveau_channel *chan, uint8_t *map,
+                              unsigned start, unsigned count)
+{
+   map += start;
+
+   if (count & 3) {
+      unsigned i;
+      BEGIN_RING_NI(chan, RING_3D(VB_ELEMENT_U32), count & 3);
+      for (i = 0; i < (count & 3); ++i)
+         OUT_RING(chan, *map++);
+      count &= ~3;
+   }
+   while (count) {
+      unsigned i, nr = MIN2(count, NV04_PFIFO_MAX_PACKET_LEN * 4) / 4;
+
+      BEGIN_RING_NI(chan, RING_3D(VB_ELEMENT_U8), nr);
+      for (i = 0; i < nr; ++i) {
+         OUT_RING(chan,
+                  (map[3] << 24) | (map[2] << 16) | (map[1] << 8) | map[0]);
+         map += 4;
+      }
+      count -= nr * 4;
+   }
+}
+
+static void
+nvc0_draw_elements_inline_u16(struct nouveau_channel *chan, uint16_t *map,
+                              unsigned start, unsigned count)
+{
+   map += start;
+
+   if (count & 1) {
+      count &= ~1;
+      BEGIN_RING(chan, RING_3D(VB_ELEMENT_U32), 1);
+      OUT_RING  (chan, *map++);
+   }
+   while (count) {
+      unsigned i, nr = MIN2(count, NV04_PFIFO_MAX_PACKET_LEN * 2) / 2;
+
+      BEGIN_RING_NI(chan, RING_3D(VB_ELEMENT_U16), nr);
+      for (i = 0; i < nr; ++i) {
+         OUT_RING(chan, (map[1] << 16) | map[0]);
+         map += 2;
+      }
+      count -= nr * 2;
+   }
+}
+
+static void
+nvc0_draw_elements_inline_u32(struct nouveau_channel *chan, uint32_t *map,
+                              unsigned start, unsigned count)
+{
+   map += start;
+
+   while (count) {
+      const unsigned nr = MIN2(count, NV04_PFIFO_MAX_PACKET_LEN);
+
+      BEGIN_RING_NI(chan, RING_3D(VB_ELEMENT_U32), nr);
+      OUT_RINGp    (chan, map, nr);
+
+      map += nr;
+      count -= nr;
+   }
+}
+
+static void
+nvc0_draw_elements_inline_u32_short(struct nouveau_channel *chan, uint32_t *map,
+                                    unsigned start, unsigned count)
+{
+   map += start;
+
+   if (count & 1) {
+      count--;
+      BEGIN_RING(chan, RING_3D(VB_ELEMENT_U32), 1);
+      OUT_RING  (chan, *map++);
+   }
+   while (count) {
+      unsigned i, nr = MIN2(count, NV04_PFIFO_MAX_PACKET_LEN * 2) / 2;
+
+      BEGIN_RING_NI(chan, RING_3D(VB_ELEMENT_U16), nr);
+      for (i = 0; i < nr; ++i) {
+         OUT_RING(chan, (map[1] << 16) | map[0]);
+         map += 2;
+      }
+      count -= nr * 2;
+   }
+}
+
+static void
+nvc0_draw_elements(struct nvc0_context *nvc0, boolean shorten,
+                   unsigned mode, unsigned start, unsigned count,
+                   unsigned instance_count, int32_t index_bias)
+{
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+   void *data;
+   unsigned prim;
+   const unsigned index_size = nvc0->idxbuf.index_size;
+
+   chan->flush_notify = nvc0_draw_vbo_flush_notify;
+   chan->user_private = nvc0;
+
+   prim = nvc0_prim_gl(mode);
+
+   if (index_bias != nvc0->state.index_bias) {
+      BEGIN_RING(chan, RING_3D(VB_ELEMENT_BASE), 1);
+      OUT_RING  (chan, index_bias);
+      nvc0->state.index_bias = index_bias;
+   }
+
+   if (nvc0_resource_mapped_by_gpu(nvc0->idxbuf.buffer)) {
+      struct nvc0_resource *res = nvc0_resource(nvc0->idxbuf.buffer);
+      unsigned offset = nvc0->idxbuf.offset;
+      unsigned limit = nvc0->idxbuf.buffer->width0 - 1;
+
+      nvc0_buffer_adjust_score(nvc0, res, 1);
+
+      while (instance_count--) {
+         MARK_RING (chan, 11, 4);
+         BEGIN_RING(chan, RING_3D(VERTEX_BEGIN_GL), 1);
+         OUT_RING  (chan, mode);
+         BEGIN_RING(chan, RING_3D(INDEX_ARRAY_START_HIGH), 7);
+         OUT_RESRCh(chan, res, offset, NOUVEAU_BO_RD);
+         OUT_RESRCl(chan, res, offset, NOUVEAU_BO_RD);
+         OUT_RESRCh(chan, res, limit, NOUVEAU_BO_RD);
+         OUT_RESRCl(chan, res, limit, NOUVEAU_BO_RD);
+         OUT_RING  (chan, index_size >> 1);
+         OUT_RING  (chan, start);
+         OUT_RING  (chan, count);
+         IMMED_RING(chan, RING_3D(VERTEX_END_GL), 0);
+
+         nvc0_resource_fence(res, NOUVEAU_BO_RD);
+
+         mode |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
+      }
+   } else {
+      data = nvc0_resource_map_offset(nvc0, nvc0_resource(nvc0->idxbuf.buffer),
+                                      nvc0->idxbuf.offset, NOUVEAU_BO_RD);
+      if (!data)
+         return;
+
+      while (instance_count--) {
+         BEGIN_RING(chan, RING_3D(VERTEX_BEGIN_GL), 1);
+         OUT_RING  (chan, prim);
+         switch (index_size) {
+         case 1:
+            nvc0_draw_elements_inline_u08(chan, data, start, count);
+            break;
+         case 2:
+            nvc0_draw_elements_inline_u16(chan, data, start, count);
+            break;
+         case 4:
+            if (shorten)
+               nvc0_draw_elements_inline_u32_short(chan, data, start, count);
+            else
+               nvc0_draw_elements_inline_u32(chan, data, start, count);
+            break;
+         default:
+            assert(0);
+            return;
+         }
+         IMMED_RING(chan, RING_3D(VERTEX_END_GL), 0);
+
+         prim |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
+      }
+   }
+
+   chan->flush_notify = NULL;
+}
+
+void
+nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
+{
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nouveau_channel *chan = nvc0->screen->base.channel;
+
+   /* For picking only a few vertices from a large user buffer, push is better,
+    * if index count is larger and we expect repeated vertices, suggest upload.
+    */
+   nvc0->vbo_push_hint = /* the 64 is heuristic */
+      !(info->indexed &&
+        ((info->max_index - info->min_index + 64) < info->count));
+
+   nvc0->vbo_min_index = info->min_index;
+   nvc0->vbo_max_index = info->max_index;
+
+   if (nvc0->vbo_user && !(nvc0->dirty & (NVC0_NEW_VERTEX | NVC0_NEW_ARRAYS)))
+      nvc0_update_user_vbufs(nvc0);
+
+   nvc0_state_validate(nvc0);
+
+   if (nvc0->state.instance_base != info->start_instance) {
+      nvc0->state.instance_base = info->start_instance;
+      BEGIN_RING(chan, RING_3D(VB_INSTANCE_BASE), 1);
+      OUT_RING  (chan, info->start_instance);
+   }
+
+   if (nvc0->vbo_fifo) {
+      nvc0_push_vbo(nvc0, info);
+      return;
+   }
+
+   if (nvc0->vbo_dirty) {
+      BEGIN_RING(chan, RING_3D(VERTEX_ARRAY_FLUSH), 1);
+      OUT_RING  (chan, 0);
+      nvc0->vbo_dirty = FALSE;
+   }
+
+   if (!info->indexed) {
+      nvc0_draw_arrays(nvc0,
+                       info->mode, info->start, info->count,
+                       info->instance_count);
+   } else {
+      boolean shorten = info->max_index <= 65535;
+
+      assert(nvc0->idxbuf.buffer);
+
+      if (info->primitive_restart != nvc0->state.prim_restart) {
+         if (info->primitive_restart) {
+            BEGIN_RING(chan, RING_3D(PRIM_RESTART_ENABLE), 2);
+            OUT_RING  (chan, 1);
+            OUT_RING  (chan, info->restart_index);
+
+            if (info->restart_index > 65535)
+               shorten = FALSE;
+         } else {
+            IMMED_RING(chan, RING_3D(PRIM_RESTART_ENABLE), 0);
+         }
+         nvc0->state.prim_restart = info->primitive_restart;
+      } else
+      if (info->primitive_restart) {
+         BEGIN_RING(chan, RING_3D(PRIM_RESTART_INDEX), 1);
+         OUT_RING  (chan, info->restart_index);
+
+         if (info->restart_index > 65535)
+            shorten = FALSE;
+      }
+
+      nvc0_draw_elements(nvc0, shorten,
+                         info->mode, info->start, info->count,
+                         info->instance_count, info->index_bias);
+   }
+}
diff --git a/src/gallium/drivers/nvc0/nvc0_winsys.h b/src/gallium/drivers/nvc0/nvc0_winsys.h
new file mode 100644 (file)
index 0000000..1544fb7
--- /dev/null
@@ -0,0 +1,120 @@
+
+#ifndef __NVC0_WINSYS_H__
+#define __NVC0_WINSYS_H__
+
+#include <stdint.h>
+#include <unistd.h>
+#include "pipe/p_defines.h"
+
+#include "nouveau/nouveau_bo.h"
+#include "nouveau/nouveau_channel.h"
+#include "nouveau/nouveau_grobj.h"
+#include "nouveau/nouveau_device.h"
+#include "nouveau/nouveau_resource.h"
+#include "nouveau/nouveau_pushbuf.h"
+#include "nouveau/nouveau_reloc.h"
+
+#include "nvc0_resource.h" /* OUT_RESRC */
+
+#ifndef NV04_PFIFO_MAX_PACKET_LEN
+#define NV04_PFIFO_MAX_PACKET_LEN 2047
+#endif
+
+#define NVC0_SUBCH_3D 1
+#define NVC0_SUBCH_2D 2
+#define NVC0_SUBCH_MF 3
+
+#define NVC0_MF_(n) NVC0_M2MF_##n
+
+#define RING_3D(n) ((NVC0_SUBCH_3D << 13) | (NVC0_3D_##n >> 2))
+#define RING_2D(n) ((NVC0_SUBCH_2D << 13) | (NVC0_2D_##n >> 2))
+#define RING_MF(n) ((NVC0_SUBCH_MF << 13) | (NVC0_MF_(n) >> 2))
+
+#define RING_3D_(m) ((NVC0_SUBCH_3D << 13) | ((m) >> 2))
+#define RING_2D_(m) ((NVC0_SUBCH_2D << 13) | ((m) >> 2))
+#define RING_MF_(m) ((NVC0_SUBCH_MF << 13) | ((m) >> 2))
+
+#define RING_GR(gr, m) (((gr)->subc << 13) | ((m) >> 2))
+
+int nouveau_pushbuf_flush(struct nouveau_channel *, unsigned min);
+
+static inline uint32_t
+nouveau_bo_tile_layout(struct nouveau_bo *bo)
+{
+   return bo->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK;
+}
+
+static INLINE void
+nouveau_bo_validate(struct nouveau_channel *chan,
+                    struct nouveau_bo *bo, unsigned flags)
+{
+   nouveau_reloc_emit(chan, NULL, 0, NULL, bo, 0, 0, flags, 0, 0);
+}
+
+/* incremental methods */
+static INLINE void
+BEGIN_RING(struct nouveau_channel *chan, uint32_t mthd, unsigned size)
+{
+   WAIT_RING(chan, size + 1);
+   OUT_RING (chan, (0x2 << 28) | (size << 16) | mthd);
+}
+
+/* non-incremental */
+static INLINE void
+BEGIN_RING_NI(struct nouveau_channel *chan, uint32_t mthd, unsigned size)
+{
+   WAIT_RING(chan, size + 1);
+   OUT_RING (chan, (0x6 << 28) | (size << 16) | mthd);
+}
+
+/* increment-once */
+static INLINE void
+BEGIN_RING_1I(struct nouveau_channel *chan, uint32_t mthd, unsigned size)
+{
+   WAIT_RING(chan, size + 1);
+   OUT_RING (chan, (0xa << 28) | (size << 16) | mthd);
+}
+
+/* inline-data */
+static INLINE void
+IMMED_RING(struct nouveau_channel *chan, uint32_t mthd, unsigned data)
+{
+   WAIT_RING(chan, 1);
+   OUT_RING (chan, (0x8 << 28) | (data << 16) | mthd);
+}
+
+static INLINE int
+OUT_RESRCh(struct nouveau_channel *chan, struct nvc0_resource *res,
+           unsigned delta, unsigned flags)
+{
+   return OUT_RELOCh(chan, res->bo, res->offset + delta, res->domain | flags);
+}
+
+static INLINE int
+OUT_RESRCl(struct nouveau_channel *chan, struct nvc0_resource *res,
+           unsigned delta, unsigned flags)
+{
+   if (flags & NOUVEAU_BO_WR)
+      res->status |= NVC0_BUFFER_STATUS_DIRTY;
+   return OUT_RELOCl(chan, res->bo, res->offset + delta, res->domain | flags);
+}
+
+static INLINE void
+BIND_RING(struct nouveau_channel *chan, struct nouveau_grobj *gr, unsigned s)
+{
+   struct nouveau_subchannel *subc = &gr->channel->subc[s];
+
+   assert(s < 8);
+   if (subc->gr) {
+      assert(subc->gr->bound != NOUVEAU_GROBJ_BOUND_EXPLICIT);
+      subc->gr->bound = NOUVEAU_GROBJ_UNBOUND;
+   }
+   subc->gr = gr;
+   subc->gr->subc = s;
+   subc->gr->bound = NOUVEAU_GROBJ_BOUND_EXPLICIT;
+
+   BEGIN_RING(chan, RING_GR(gr, 0x0000), 1);
+   OUT_RING  (chan, gr->grclass);
+}
+
+#endif
index e0e65e7a87ff6eb46a93992e75dc3e18aa2205d1..e2fadd33e1c7d81c624b57a915260d333efef9dd 100644 (file)
 #include <stdio.h>
 #include <stdint.h>
 #include <nouveau/nouveau_device.h>
-#include <nouveau/nouveau_pushbuf.h>
 #include <nouveau/nouveau_channel.h>
 #include <nouveau/nouveau_bo.h>
 #include <nouveau/nouveau_notifier.h>
 #include <nouveau/nouveau_grobj.h>
+#include <nouveau/nv04_pushbuf.h>
 #include "nv04_2d.h"
 
 #include "nouveau/nv_object.xml.h"
index d6ede5b40a1a9be08d0c24565124006c58f7d53b..b609891d316424081576f0bfc889ab43231dcdbd 100644 (file)
@@ -37,12 +37,12 @@ nv30_sampler_view_init(struct pipe_context *pipe,
        struct pipe_resource* pt = sv->base.texture;
        struct nvfx_texture_format *tf = &nvfx_texture_formats[sv->base.format];
        unsigned txf;
-       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : sv->base.first_level;
+       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : sv->base.u.tex.first_level;
 
        assert(tf->fmt[0] >= 0);
 
        txf = sv->u.init_fmt;
-       txf |= (level != sv->base.last_level ? NV30_3D_TEX_FORMAT_MIPMAP : 0);
+       txf |= (level != sv->base.u.tex.last_level ? NV30_3D_TEX_FORMAT_MIPMAP : 0);
        txf |= util_logbase2(u_minify(pt->width0, level)) << NV30_3D_TEX_FORMAT_BASE_SIZE_U__SHIFT;
        txf |= util_logbase2(u_minify(pt->height0, level)) << NV30_3D_TEX_FORMAT_BASE_SIZE_V__SHIFT;
        txf |= util_logbase2(u_minify(pt->depth0, level)) << NV30_3D_TEX_FORMAT_BASE_SIZE_W__SHIFT;
@@ -60,8 +60,8 @@ nv30_sampler_view_init(struct pipe_context *pipe,
        else
                sv->u.nv30.rect = !!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR);
 
-       sv->lod_offset = sv->base.first_level - level;
-       sv->max_lod_limit = sv->base.last_level - level;
+       sv->lod_offset = sv->base.u.tex.first_level - level;
+       sv->max_lod_limit = sv->base.u.tex.last_level - level;
 }
 
 void
@@ -71,6 +71,7 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit)
        struct nvfx_sampler_view* sv = (struct nvfx_sampler_view*)nvfx->fragment_sampler_views[unit];
        struct nouveau_bo *bo = ((struct nvfx_miptree *)sv->base.texture)->base.bo;
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        unsigned txf;
        unsigned tex_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
        unsigned use_rect;
@@ -102,7 +103,7 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit)
        txf = sv->u.nv30.fmt[ps->compare + (use_rect ? 2 : 0)];
 
        MARK_RING(chan, 9, 2);
-       OUT_RING(chan, RING_3D(NV30_3D_TEX_OFFSET(unit), 8));
+       BEGIN_RING(chan, eng3d, NV30_3D_TEX_OFFSET(unit), 8);
        OUT_RELOC(chan, bo, sv->offset, tex_flags | NOUVEAU_BO_LOW, 0, 0);
        OUT_RELOC(chan, bo, txf,
                tex_flags | NOUVEAU_BO_OR,
index d4fb73702daaff49b41993b2678fe54cc370cc79..563183d9d0ca460cd1717f868c5c53d29db9f3ac 100644 (file)
@@ -46,7 +46,7 @@ nv40_sampler_view_init(struct pipe_context *pipe,
        struct nvfx_miptree* mt = (struct nvfx_miptree*)pt;
        struct nvfx_texture_format *tf = &nvfx_texture_formats[sv->base.format];
        unsigned txf;
-       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : sv->base.first_level;
+       unsigned level = pt->target == PIPE_TEXTURE_CUBE ? 0 : sv->base.u.tex.first_level;
        assert(tf->fmt[4] >= 0);
 
        txf = sv->u.init_fmt;
@@ -54,7 +54,7 @@ nv40_sampler_view_init(struct pipe_context *pipe,
        if(pt->target == PIPE_TEXTURE_CUBE)
                txf |= ((pt->last_level + 1) << NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
        else
-               txf |= (((sv->base.last_level - sv->base.first_level) + 1) << NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
+               txf |= (((sv->base.u.tex.last_level - sv->base.u.tex.first_level) + 1) << NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
 
        if (!mt->linear_pitch)
                sv->u.nv40.npot_size2 = 0;
@@ -68,14 +68,15 @@ nv40_sampler_view_init(struct pipe_context *pipe,
 
        sv->u.nv40.npot_size2 |= (u_minify(pt->depth0, level) << NV40_3D_TEX_SIZE1_DEPTH__SHIFT);
 
-       sv->lod_offset = (sv->base.first_level - level) * 256;
-       sv->max_lod_limit = (sv->base.last_level - level) * 256;
+       sv->lod_offset = (sv->base.u.tex.first_level - level) * 256;
+       sv->max_lod_limit = (sv->base.u.tex.last_level - level) * 256;
 }
 
 void
 nv40_fragtex_set(struct nvfx_context *nvfx, int unit)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit];
        struct nvfx_sampler_view* sv = (struct nvfx_sampler_view*)nvfx->fragment_sampler_views[unit];
        struct nouveau_bo *bo = ((struct nvfx_miptree *)sv->base.texture)->base.bo;
@@ -87,7 +88,7 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit)
        txf = sv->u.nv40.fmt[ps->compare] | ps->fmt;
 
        MARK_RING(chan, 11, 2);
-       OUT_RING(chan, RING_3D(NV30_3D_TEX_OFFSET(unit), 8));
+       BEGIN_RING(chan, eng3d, NV30_3D_TEX_OFFSET(unit), 8);
        OUT_RELOC(chan, bo, sv->offset, tex_flags | NOUVEAU_BO_LOW, 0, 0);
        OUT_RELOC(chan, bo, txf, tex_flags | NOUVEAU_BO_OR,
                        NV30_3D_TEX_FORMAT_DMA0, NV30_3D_TEX_FORMAT_DMA1);
@@ -97,7 +98,7 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit)
        OUT_RING(chan, ps->filt | sv->filt);
        OUT_RING(chan, sv->npot_size);
        OUT_RING(chan, ps->bcol);
-       OUT_RING(chan, RING_3D(NV40_3D_TEX_SIZE1(unit), 1));
+       BEGIN_RING(chan, eng3d, NV40_3D_TEX_SIZE1(unit), 1);
        OUT_RING(chan, sv->u.nv40.npot_size2);
 
        nvfx->hw_txf[unit] = txf;
index 041099e0e568ca953464fc4aa09468077f8409be..b407429731f94f3d1ee6276972464be754523d44 100644 (file)
@@ -64,6 +64,7 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen,
        buffer->base.base.width0 = bytes;
        buffer->base.base.height0 = 1;
        buffer->base.base.depth0 = 1;
+       buffer->base.base.array_size = 1;
        buffer->data = ptr;
        buffer->size = bytes;
        buffer->bytes_to_draw_until_static = bytes * screen->static_reuse_threshold;
index 95834d23273882eed7139158c9a4de420a31933a..6c8934d3a4a2a6d61d23892b0ee6f7fe2f0d94d1 100644 (file)
@@ -13,13 +13,13 @@ nvfx_flush(struct pipe_context *pipe, unsigned flags,
        struct nvfx_context *nvfx = nvfx_context(pipe);
        struct nvfx_screen *screen = nvfx->screen;
        struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *eng3d = screen->eng3d;
 
        /* XXX: we need to actually be intelligent here */
        if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
-               WAIT_RING(chan, 4);
-               OUT_RING(chan, RING_3D(0x1fd8, 1));
+               BEGIN_RING(chan, eng3d, 0x1fd8, 1);
                OUT_RING(chan, 2);
-               OUT_RING(chan, RING_3D(0x1fd8, 1));
+               BEGIN_RING(chan, eng3d, 0x1fd8, 1);
                OUT_RING(chan, 1);
        }
 
index 6ef2a6945d7a612a64b81fb36e796712efd53e24..2238aa1ad0e812b8c4b42cfc620d2434e47325a5 100644 (file)
@@ -339,30 +339,31 @@ extern void nvfx_init_vertprog_functions(struct nvfx_context *nvfx);
 /* nvfx_push.c */
 extern void nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info);
 
-/* must WAIT_RING(chan, ncomp + 1) or equivalent beforehand! */
-static inline void nvfx_emit_vtx_attr(struct nouveau_channel* chan, unsigned attrib, const float* v, unsigned ncomp)
+static inline void nvfx_emit_vtx_attr(struct nouveau_channel* chan,
+               struct nouveau_grobj *eng3d, unsigned attrib, const float* v,
+               unsigned ncomp)
 {
        switch (ncomp) {
        case 4:
-               OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_4F_X(attrib), 4));
+               BEGIN_RING(chan, eng3d, NV30_3D_VTX_ATTR_4F_X(attrib), 4);
                OUT_RING(chan, fui(v[0]));
                OUT_RING(chan, fui(v[1]));
                OUT_RING(chan,  fui(v[2]));
                OUT_RING(chan,  fui(v[3]));
                break;
        case 3:
-               OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_3F_X(attrib), 3));
+               BEGIN_RING(chan, eng3d, NV30_3D_VTX_ATTR_3F_X(attrib), 3);
                OUT_RING(chan,  fui(v[0]));
                OUT_RING(chan,  fui(v[1]));
                OUT_RING(chan,  fui(v[2]));
                break;
        case 2:
-               OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_2F_X(attrib), 2));
+               BEGIN_RING(chan, eng3d, NV30_3D_VTX_ATTR_2F_X(attrib), 2);
                OUT_RING(chan,  fui(v[0]));
                OUT_RING(chan,  fui(v[1]));
                break;
        case 1:
-               OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_1F(attrib), 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VTX_ATTR_1F(attrib), 1);
                OUT_RING(chan,  fui(v[0]));
                break;
        }
index 61f888a8ea25ad8b0c4ca740890c0696d7c3f860..81f1ec485d3411d89fbc14488ccbcea2f47d31ae 100644 (file)
@@ -28,10 +28,10 @@ nvfx_render_flush(struct draw_stage *stage, unsigned flags)
        struct nvfx_render_stage *rs = nvfx_render_stage(stage);
        struct nvfx_context *nvfx = rs->nvfx;
        struct nouveau_channel *chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
 
        if (rs->prim != NV30_3D_VERTEX_BEGIN_END_STOP) {
-               assert(AVAIL_RING(chan) >= 2);
-               OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VERTEX_BEGIN_END, 1);
                OUT_RING(chan, NV30_3D_VERTEX_BEGIN_END_STOP);
                rs->prim = NV30_3D_VERTEX_BEGIN_END_STOP;
        }
@@ -46,6 +46,7 @@ nvfx_render_prim(struct draw_stage *stage, struct prim_header *prim,
 
        struct nvfx_screen *screen = nvfx->screen;
        struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *eng3d = screen->eng3d;
        boolean no_elements = nvfx->vertprog->draw_no_elements;
        unsigned num_attribs = nvfx->vertprog->draw_elements;
 
@@ -63,7 +64,7 @@ nvfx_render_prim(struct draw_stage *stage, struct prim_header *prim,
        /* Switch primitive modes if necessary */
        if (rs->prim != mode) {
                if (rs->prim != NV30_3D_VERTEX_BEGIN_END_STOP) {
-                       OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
+                       BEGIN_RING(chan, eng3d, NV30_3D_VERTEX_BEGIN_END, 1);
                        OUT_RING(chan, NV30_3D_VERTEX_BEGIN_END_STOP);
                }
 
@@ -74,23 +75,24 @@ nvfx_render_prim(struct draw_stage *stage, struct prim_header *prim,
                        int i;
                        for(i = 0; i < 32; ++i)
                        {
-                               OUT_RING(chan, RING_3D(0x1dac, 1));
+                               BEGIN_RING(chan, eng3d, 0x1dac, 1);
                                OUT_RING(chan, 0);
                        }
                }
 
-               OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VERTEX_BEGIN_END, 1);
                OUT_RING  (chan, mode);
                rs->prim = mode;
        }
 
-       OUT_RING(chan, RING_3D_NI(NV30_3D_VERTEX_DATA, num_attribs * 4 * count));
        if(no_elements) {
+               BEGIN_RING_NI(chan, eng3d, NV30_3D_VERTEX_DATA, 4);
                OUT_RING(chan, 0);
                OUT_RING(chan, 0);
                OUT_RING(chan, 0);
                OUT_RING(chan, 0);
        } else {
+               BEGIN_RING_NI(chan, eng3d, NV30_3D_VERTEX_DATA, num_attribs * 4 * count);
                for (unsigned i = 0; i < count; ++i)
                {
                        struct vertex_header* v = prim->v[i];
index 13e8beed4794a503c5fd4668893356c2d1d40b82..dbd7c77346512d4ae00afa0d1308c1a1ce3f59ab 100644 (file)
@@ -1189,12 +1189,12 @@ out_err:
 static inline void
 nvfx_fp_memcpy(void* dst, const void* src, size_t len)
 {
-#ifndef WORDS_BIGENDIAN
+#ifndef PIPE_ARCH_BIG_ENDIAN
        memcpy(dst, src, len);
 #else
        size_t i;
        for(i = 0; i < len; i += 4) {
-               uint32_t v = (uint32_t*)((char*)src + i);
+               uint32_t v = *(uint32_t*)((char*)src + i);
                *(uint32_t*)((char*)dst + i) = (v >> 16) | (v << 16);
        }
 #endif
@@ -1233,6 +1233,7 @@ void
 nvfx_fragprog_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog;
        struct nvfx_vertex_program* vp;
 
@@ -1499,17 +1500,17 @@ update:
                nvfx->hw_fragprog = fp;
 
                MARK_RING(chan, 8, 1);
-               OUT_RING(chan, RING_3D(NV30_3D_FP_ACTIVE_PROGRAM, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_FP_ACTIVE_PROGRAM, 1);
                OUT_RELOC(chan, fp->fpbo->bo, offset, NOUVEAU_BO_VRAM |
                              NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW |
                              NOUVEAU_BO_OR, NV30_3D_FP_ACTIVE_PROGRAM_DMA0,
                              NV30_3D_FP_ACTIVE_PROGRAM_DMA1);
-               OUT_RING(chan, RING_3D(NV30_3D_FP_CONTROL, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_FP_CONTROL, 1);
                OUT_RING(chan, fp->fp_control);
                if(!nvfx->is_nv4x) {
-                       OUT_RING(chan, RING_3D(NV30_3D_FP_REG_CONTROL, 1));
+                       BEGIN_RING(chan, eng3d, NV30_3D_FP_REG_CONTROL, 1);
                        OUT_RING(chan, (1<<16)|0x4);
-                       OUT_RING(chan, RING_3D(NV30_3D_TEX_UNITS_ENABLE, 1));
+                       BEGIN_RING(chan, eng3d, NV30_3D_TEX_UNITS_ENABLE, 1);
                        OUT_RING(chan, fp->samplers);
                }
        }
@@ -1518,8 +1519,7 @@ update:
                unsigned pointsprite_control = fp->point_sprite_control | nvfx->rasterizer->pipe.point_quad_rasterization;
                if(pointsprite_control != nvfx->hw_pointsprite_control)
                {
-                       WAIT_RING(chan, 2);
-                       OUT_RING(chan, RING_3D(NV30_3D_POINT_SPRITE, 1));
+                       BEGIN_RING(chan, eng3d, NV30_3D_POINT_SPRITE, 1);
                        OUT_RING(chan, pointsprite_control);
                        nvfx->hw_pointsprite_control = pointsprite_control;
                }
index 1d6b4e24cbc97d5a4b2839cbf55102f8a03f4232..1c4901df0e2273572ae0614171337d07a4b505b5 100644 (file)
@@ -122,8 +122,8 @@ nvfx_create_sampler_view(struct pipe_context *pipe,
        }
        else
        {
-               sv->offset = nvfx_subresource_offset(pt, 0, sv->base.first_level, 0);
-               sv->npot_size = (u_minify(pt->width0, sv->base.first_level) << NV30_3D_TEX_NPOT_SIZE_W__SHIFT) | u_minify(pt->height0, sv->base.first_level);
+               sv->offset = nvfx_subresource_offset(pt, 0, sv->base.u.tex.first_level, 0);
+               sv->npot_size = (u_minify(pt->width0, sv->base.u.tex.first_level) << NV30_3D_TEX_NPOT_SIZE_W__SHIFT) | u_minify(pt->height0, sv->base.u.tex.first_level);
 
                /* apparently, we need to ignore the t coordinate for 1D textures to fix piglit tex1d-2dborder */
                if(pt->target == PIPE_TEXTURE_1D)
@@ -177,6 +177,7 @@ void
 nvfx_fragtex_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        unsigned samplers, unit;
 
        samplers = nvfx->dirty_samplers;
@@ -197,9 +198,8 @@ nvfx_fragtex_validate(struct nvfx_context *nvfx)
                        else
                                nv40_fragtex_set(nvfx, unit);
                } else {
-                       WAIT_RING(chan, 2);
                        /* this is OK for nv40 too */
-                       OUT_RING(chan, RING_3D(NV30_3D_TEX_ENABLE(unit), 1));
+                       BEGIN_RING(chan, eng3d, NV30_3D_TEX_ENABLE(unit), 1);
                        OUT_RING(chan, 0);
                        nvfx->hw_samplers &= ~(1 << unit);
                }
index 7677fde40cbfe9e806adf43ce291651d74e8124f..8c043b867bae6b8d0a122d37b02097853dbbf4f0 100644 (file)
@@ -190,25 +190,27 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen, const struct pipe_resource
 }
 
 struct pipe_surface *
-nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt,
-                        unsigned face, unsigned level, unsigned zslice,
-                        unsigned flags)
+nvfx_miptree_surface_new(struct pipe_context *pipe, struct pipe_resource *pt,
+                        const struct pipe_surface *surf_tmpl)
 {
-       struct nvfx_miptree* mt = (struct nvfx_miptree*)pt;
-       struct nvfx_surface *ns;
-
-       ns = (struct nvfx_surface*)util_surfaces_get(&mt->surfaces, sizeof(struct nvfx_surface), pscreen, pt, face, level, zslice, flags);
-       if(ns->base.base.offset == ~0) {
-               util_dirty_surface_init(&ns->base);
-               ns->pitch = nvfx_subresource_pitch(pt, level);
-               ns->base.base.offset = nvfx_subresource_offset(pt, face, level, zslice);
+       struct nvfx_miptree *mt = (struct nvfx_miptree *)pt;
+       unsigned level = surf_tmpl->u.tex.level;
+       struct nvfx_surface *ns = NULL;
+
+       assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
+       if(util_surfaces_get(&mt->surfaces, sizeof(struct nvfx_surface), pipe,
+                             pt, level, surf_tmpl->u.tex.first_layer,
+                             surf_tmpl->usage, (struct pipe_surface **)&ns)) {
+                util_dirty_surface_init(&ns->base);
+                ns->pitch = nvfx_subresource_pitch(pt, level);
+                ns->offset = nvfx_subresource_offset(pt, surf_tmpl->u.tex.first_layer, level, surf_tmpl->u.tex.first_layer);
        }
 
        return &ns->base.base;
 }
 
 void
-nvfx_miptree_surface_del(struct pipe_surface *ps)
+nvfx_miptree_surface_del(struct pipe_context *pipe, struct pipe_surface *ps)
 {
        struct nvfx_surface* ns = (struct nvfx_surface*)ps;
 
index ebf47e6ed30715f249be2cac3a4bc73f2d72f6fe..6391741a2e5cbb6ee550ee553a5c12ba90accfd4 100644 (file)
@@ -10,6 +10,7 @@
 
 struct push_context {
        struct nouveau_channel* chan;
+       struct nouveau_grobj *eng3d;
 
        void *idxbuf;
        int32_t idxbias;
@@ -27,9 +28,10 @@ static void
 emit_edgeflag(void *priv, boolean enabled)
 {
        struct push_context* ctx = priv;
+       struct nouveau_grobj *eng3d = ctx->eng3d;
        struct nouveau_channel *chan = ctx->chan;
 
-       OUT_RING(chan, RING_3D(NV30_3D_EDGEFLAG, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_EDGEFLAG, 1);
        OUT_RING(chan, enabled ? 1 : 0);
 }
 
@@ -37,6 +39,7 @@ static void
 emit_vertices_lookup8(void *priv, unsigned start, unsigned count)
 {
         struct push_context *ctx = priv;
+        struct nouveau_grobj *eng3d = ctx->eng3d;
         uint8_t* elts = (uint8_t*)ctx->idxbuf + start;
 
         while(count)
@@ -44,7 +47,7 @@ emit_vertices_lookup8(void *priv, unsigned start, unsigned count)
                 unsigned push = MIN2(count, ctx->max_vertices_per_packet);
                 unsigned length = push * ctx->vertex_length;
 
-                OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
+                BEGIN_RING_NI(ctx->chan, eng3d, NV30_3D_VERTEX_DATA, length);
                 ctx->translate->run_elts8(ctx->translate, elts, push, 0, ctx->chan->cur);
                 ctx->chan->cur += length;
 
@@ -57,6 +60,7 @@ static void
 emit_vertices_lookup16(void *priv, unsigned start, unsigned count)
 {
        struct push_context *ctx = priv;
+       struct nouveau_grobj *eng3d = ctx->eng3d;
         uint16_t* elts = (uint16_t*)ctx->idxbuf + start;
 
         while(count)
@@ -64,7 +68,7 @@ emit_vertices_lookup16(void *priv, unsigned start, unsigned count)
                 unsigned push = MIN2(count, ctx->max_vertices_per_packet);
                 unsigned length = push * ctx->vertex_length;
 
-                OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
+                BEGIN_RING_NI(ctx->chan, eng3d, NV30_3D_VERTEX_DATA, length);
                 ctx->translate->run_elts16(ctx->translate, elts, push, 0, ctx->chan->cur);
                 ctx->chan->cur += length;
 
@@ -77,6 +81,7 @@ static void
 emit_vertices_lookup32(void *priv, unsigned start, unsigned count)
 {
         struct push_context *ctx = priv;
+        struct nouveau_grobj *eng3d = ctx->eng3d;
         uint32_t* elts = (uint32_t*)ctx->idxbuf + start;
 
         while(count)
@@ -84,7 +89,7 @@ emit_vertices_lookup32(void *priv, unsigned start, unsigned count)
                 unsigned push = MIN2(count, ctx->max_vertices_per_packet);
                 unsigned length = push * ctx->vertex_length;
 
-                OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
+                BEGIN_RING_NI(ctx->chan, eng3d, NV30_3D_VERTEX_DATA, length);
                 ctx->translate->run_elts(ctx->translate, elts, push, 0, ctx->chan->cur);
                 ctx->chan->cur += length;
 
@@ -97,13 +102,14 @@ static void
 emit_vertices(void *priv, unsigned start, unsigned count)
 {
         struct push_context *ctx = priv;
+        struct nouveau_grobj *eng3d = ctx->eng3d;
 
         while(count)
         {
                unsigned push = MIN2(count, ctx->max_vertices_per_packet);
                unsigned length = push * ctx->vertex_length;
 
-               OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
+               BEGIN_RING_NI(ctx->chan, eng3d, NV30_3D_VERTEX_DATA, length);
                ctx->translate->run(ctx->translate, start, push, 0, ctx->chan->cur);
                ctx->chan->cur += length;
 
@@ -116,10 +122,11 @@ static void
 emit_ranges(void* priv, unsigned start, unsigned vc, unsigned reg)
 {
        struct push_context* ctx = priv;
+       struct nouveau_grobj *eng3d = ctx->eng3d;
        struct nouveau_channel *chan = ctx->chan;
        unsigned nr = (vc & 0xff);
        if (nr) {
-               OUT_RING(chan, RING_3D(reg, 1));
+               BEGIN_RING(chan, eng3d, reg, 1);
                OUT_RING  (chan, ((nr - 1) << 24) | start);
                start += nr;
        }
@@ -130,7 +137,7 @@ emit_ranges(void* priv, unsigned start, unsigned vc, unsigned reg)
 
                nr -= push;
 
-               OUT_RING(chan, RING_3D_NI(reg, push));
+               BEGIN_RING_NI(chan, eng3d, reg, push);
                while (push--) {
                        OUT_RING(chan, ((0x100 - 1) << 24) | start);
                        start += 0x100;
@@ -154,12 +161,13 @@ static INLINE void
 emit_elt8(void* priv, unsigned start, unsigned vc)
 {
        struct push_context* ctx = priv;
+       struct nouveau_grobj *eng3d = ctx->eng3d;
        struct nouveau_channel *chan = ctx->chan;
        uint8_t *elts = (uint8_t *)ctx->idxbuf + start;
        int idxbias = ctx->idxbias;
 
        if (vc & 1) {
-               OUT_RING(chan, RING_3D(NV30_3D_VB_ELEMENT_U32, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VB_ELEMENT_U32, 1);
                OUT_RING  (chan, elts[0]);
                elts++; vc--;
        }
@@ -168,7 +176,7 @@ emit_elt8(void* priv, unsigned start, unsigned vc)
                unsigned i;
                unsigned push = MIN2(vc, 2047 * 2);
 
-               OUT_RING(chan, RING_3D_NI(NV30_3D_VB_ELEMENT_U16, push >> 1));
+               BEGIN_RING_NI(chan, eng3d, NV30_3D_VB_ELEMENT_U16, push >> 1);
                for (i = 0; i < push; i+=2)
                        OUT_RING(chan, ((elts[i+1] + idxbias) << 16) | (elts[i] + idxbias));
 
@@ -181,12 +189,13 @@ static INLINE void
 emit_elt16(void* priv, unsigned start, unsigned vc)
 {
        struct push_context* ctx = priv;
+       struct nouveau_grobj *eng3d = ctx->eng3d;
        struct nouveau_channel *chan = ctx->chan;
        uint16_t *elts = (uint16_t *)ctx->idxbuf + start;
        int idxbias = ctx->idxbias;
 
        if (vc & 1) {
-               OUT_RING(chan, RING_3D(NV30_3D_VB_ELEMENT_U32, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VB_ELEMENT_U32, 1);
                OUT_RING  (chan, elts[0]);
                elts++; vc--;
        }
@@ -195,7 +204,7 @@ emit_elt16(void* priv, unsigned start, unsigned vc)
                unsigned i;
                unsigned push = MIN2(vc, 2047 * 2);
 
-               OUT_RING(chan, RING_3D_NI(NV30_3D_VB_ELEMENT_U16, push >> 1));
+               BEGIN_RING_NI(chan, eng3d, NV30_3D_VB_ELEMENT_U16, push >> 1);
                for (i = 0; i < push; i+=2)
                        OUT_RING(chan, ((elts[i+1] + idxbias) << 16) | (elts[i] + idxbias));
 
@@ -208,6 +217,7 @@ static INLINE void
 emit_elt32(void* priv, unsigned start, unsigned vc)
 {
        struct push_context* ctx = priv;
+       struct nouveau_grobj *eng3d = ctx->eng3d;
        struct nouveau_channel *chan = ctx->chan;
        uint32_t *elts = (uint32_t *)ctx->idxbuf + start;
        int idxbias = ctx->idxbias;
@@ -215,8 +225,7 @@ emit_elt32(void* priv, unsigned start, unsigned vc)
        while (vc) {
                unsigned push = MIN2(vc, 2047);
 
-               OUT_RING(chan, RING_3D_NI(NV30_3D_VB_ELEMENT_U32, push));
-               assert(AVAIL_RING(chan) >= push);
+               BEGIN_RING_NI(chan, eng3d, NV30_3D_VB_ELEMENT_U32, push);
                if(idxbias)
                {
                        for(unsigned i = 0; i < push; ++i)
@@ -235,6 +244,7 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
 {
        struct nvfx_context *nvfx = nvfx_context(pipe);
        struct nouveau_channel *chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct push_context ctx;
        struct util_split_prim s;
        unsigned instances_left = info->instance_count;
@@ -251,6 +261,7 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
                        + 4; /* potential edgeflag enable/disable */
 
        ctx.chan = nvfx->screen->base.channel;
+       ctx.eng3d = nvfx->screen->eng3d;
        ctx.translate = nvfx->vtxelt->translate;
        ctx.idxbuf = NULL;
        ctx.vertex_length = nvfx->vtxelt->vertex_length;
@@ -333,8 +344,9 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
 
                nvfx->vtxelt->per_instance[i].base.fetch_rgba_float(v, per_instance[i].map, 0, 0);
 
-               WAIT_RING(chan, 5);
-               nvfx_emit_vtx_attr(chan, nvfx->vtxelt->per_instance[i].base.idx, v, nvfx->vtxelt->per_instance[i].base.ncomp);
+               nvfx_emit_vtx_attr(chan, eng3d,
+                                  nvfx->vtxelt->per_instance[i].base.idx, v,
+                                  nvfx->vtxelt->per_instance[i].base.ncomp);
        }
 
        /* per-instance loop */
@@ -374,15 +386,18 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
                                        int i;
                                        for(i = 0; i < 32; ++i)
                                        {
-                                               OUT_RING(chan, RING_3D(0x1dac, 1));
+                                               BEGIN_RING(chan, eng3d,
+                                                          0x1dac, 1);
                                                OUT_RING(chan, 0);
                                        }
                                }
 
-                               OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
+                               BEGIN_RING(chan, eng3d,
+                                          NV30_3D_VERTEX_BEGIN_END, 1);
                                OUT_RING(chan, hw_mode);
                                done = util_split_prim_next(&s, max_verts);
-                               OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
+                               BEGIN_RING(chan, eng3d,
+                                          NV30_3D_VERTEX_BEGIN_END, 1);
                                OUT_RING(chan, 0);
 
                                if(done)
@@ -406,8 +421,10 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
                                per_instance[i].step = 0;
 
                                nvfx->vtxelt->per_instance[i].base.fetch_rgba_float(v, per_instance[i].map, 0, 0);
-                               WAIT_RING(chan, 5);
-                               nvfx_emit_vtx_attr(chan, nvfx->vtxelt->per_instance[i].base.idx, v, nvfx->vtxelt->per_instance[i].base.ncomp);
+                               nvfx_emit_vtx_attr(chan, eng3d,
+                                                  nvfx->vtxelt->per_instance[i].base.idx,
+                                                  v,
+                                                  nvfx->vtxelt->per_instance[i].base.ncomp);
                        }
                }
        }
index 3935ffd7f92938366437e86c34f7724ed00f2da7..3cd6bf1e477d6870a96afecdf5ed90779549322f 100644 (file)
@@ -49,6 +49,7 @@ nvfx_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
        struct nvfx_query *q = nvfx_query(pq);
        struct nvfx_screen *screen = nvfx->screen;
        struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *eng3d = screen->eng3d;
        uint64_t tmp;
 
        assert(!nvfx->query);
@@ -72,10 +73,9 @@ nvfx_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
 
        nouveau_notifier_reset(nvfx->screen->query, q->object->start);
 
-       WAIT_RING(chan, 4);
-       OUT_RING(chan, RING_3D(NV30_3D_QUERY_RESET, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_QUERY_RESET, 1);
        OUT_RING(chan, 1);
-       OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_QUERY_ENABLE, 1);
        OUT_RING(chan, 1);
 
        q->ready = FALSE;
@@ -88,15 +88,15 @@ nvfx_query_end(struct pipe_context *pipe, struct pipe_query *pq)
 {
        struct nvfx_context *nvfx = nvfx_context(pipe);
        struct nouveau_channel *chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct nvfx_query *q = nvfx_query(pq);
 
        assert(nvfx->query == pq);
 
-       WAIT_RING(chan, 4);
-       OUT_RING(chan, RING_3D(NV30_3D_QUERY_GET, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_QUERY_GET, 1);
        OUT_RING  (chan, (0x01 << NV30_3D_QUERY_GET_UNK24__SHIFT) |
                   ((q->object->start * 32) << NV30_3D_QUERY_GET_OFFSET__SHIFT));
-       OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_QUERY_ENABLE, 1);
        OUT_RING(chan, 0);
        FIRE_RING(chan);
 
index 39ae893f1b3b8c589453f2080e810c1ef4c96051..c60a7bb8b93c86c2314ce194d169914d11f5a1d5 100644 (file)
@@ -7,7 +7,7 @@
 static unsigned int
 nvfx_resource_is_referenced(struct pipe_context *pipe,
                            struct pipe_resource *pr,
-                           unsigned face, unsigned level)
+                           unsigned level, int layer)
 {
        return !!nouveau_reference_flags(nvfx_resource(pr)->bo);
 }
@@ -59,6 +59,9 @@ void
 nvfx_init_resource_functions(struct pipe_context *pipe)
 {
        pipe->is_resource_referenced = nvfx_resource_is_referenced;
+
+       pipe->create_surface = nvfx_miptree_surface_new;
+       pipe->surface_destroy = nvfx_miptree_surface_del;
 }
 
 void
@@ -69,7 +72,4 @@ nvfx_screen_init_resource_functions(struct pipe_screen *pscreen)
        pscreen->resource_get_handle = nvfx_resource_get_handle;
        pscreen->resource_destroy = nvfx_resource_destroy;
        pscreen->user_buffer_create = nvfx_user_buffer_create;
-
-       pscreen->get_tex_surface = nvfx_miptree_surface_new;
-       pscreen->tex_surface_destroy = nvfx_miptree_surface_del;
 }
index 583be4de2ae2596bca94c091fd1163fd701254b3..070f89794429254e4b7a8493dc620d73473cf361 100644 (file)
@@ -74,6 +74,7 @@ struct nvfx_miptree {
 struct nvfx_surface {
        struct util_dirty_surface base;
        unsigned pitch;
+       unsigned offset;
 
        struct nvfx_miptree* temp;
 };
@@ -116,12 +117,11 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen,
                         struct winsys_handle *whandle);
 
 void
-nvfx_miptree_surface_del(struct pipe_surface *ps);
+nvfx_miptree_surface_del(struct pipe_context *pipe, struct pipe_surface *ps);
 
 struct pipe_surface *
-nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt,
-                        unsigned face, unsigned level, unsigned zslice,
-                        unsigned flags);
+nvfx_miptree_surface_new(struct pipe_context *pipe, struct pipe_resource *pt,
+                        const struct pipe_surface *surf_tmpl);
 
 /* only for miptrees, don't use for buffers */
 
index 92e1d330907572d3dd23c3667acb7af7082adb34..aa1e9567d313c8591f67e25a8244a93c97ce549a 100644 (file)
@@ -301,98 +301,100 @@ nvfx_screen_destroy(struct pipe_screen *pscreen)
 static void nv30_screen_init(struct nvfx_screen *screen)
 {
        struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *eng3d = screen->eng3d;
        int i;
 
        /* TODO: perhaps we should do some of this on nv40 too? */
        for (i=1; i<8; i++) {
-               OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_CLIP_HORIZ(i), 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VIEWPORT_CLIP_HORIZ(i), 1);
                OUT_RING(chan, 0);
-               OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_CLIP_VERT(i), 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VIEWPORT_CLIP_VERT(i), 1);
                OUT_RING(chan, 0);
        }
 
-       OUT_RING(chan, RING_3D(0x220, 1));
+       BEGIN_RING(chan, eng3d, 0x220, 1);
        OUT_RING(chan, 1);
 
-       OUT_RING(chan, RING_3D(0x03b0, 1));
+       BEGIN_RING(chan, eng3d, 0x03b0, 1);
        OUT_RING(chan, 0x00100000);
-       OUT_RING(chan, RING_3D(0x1454, 1));
+       BEGIN_RING(chan, eng3d, 0x1454, 1);
        OUT_RING(chan, 0);
-       OUT_RING(chan, RING_3D(0x1d80, 1));
+       BEGIN_RING(chan, eng3d, 0x1d80, 1);
        OUT_RING(chan, 3);
-       OUT_RING(chan, RING_3D(0x1450, 1));
+       BEGIN_RING(chan, eng3d, 0x1450, 1);
        OUT_RING(chan, 0x00030004);
 
        /* NEW */
-       OUT_RING(chan, RING_3D(0x1e98, 1));
+       BEGIN_RING(chan, eng3d, 0x1e98, 1);
        OUT_RING(chan, 0);
-       OUT_RING(chan, RING_3D(0x17e0, 3));
+       BEGIN_RING(chan, eng3d, 0x17e0, 3);
        OUT_RING(chan, fui(0.0));
        OUT_RING(chan, fui(0.0));
        OUT_RING(chan, fui(1.0));
-       OUT_RING(chan, RING_3D(0x1f80, 16));
+       BEGIN_RING(chan, eng3d, 0x1f80, 16);
        for (i=0; i<16; i++) {
                OUT_RING(chan, (i==8) ? 0x0000ffff : 0);
        }
 
-       OUT_RING(chan, RING_3D(0x120, 3));
+       BEGIN_RING(chan, eng3d, 0x120, 3);
        OUT_RING(chan, 0);
        OUT_RING(chan, 1);
        OUT_RING(chan, 2);
 
-       OUT_RING(chan, RING_3D(0x1d88, 1));
+       BEGIN_RING(chan, eng3d, 0x1d88, 1);
        OUT_RING(chan, 0x00001200);
 
-       OUT_RING(chan, RING_3D(NV30_3D_RC_ENABLE, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_RC_ENABLE, 1);
        OUT_RING(chan, 0);
 
-       OUT_RING(chan, RING_3D(NV30_3D_DEPTH_RANGE_NEAR, 2));
+       BEGIN_RING(chan, eng3d, NV30_3D_DEPTH_RANGE_NEAR, 2);
        OUT_RING(chan, fui(0.0));
        OUT_RING(chan, fui(1.0));
 
-       OUT_RING(chan, RING_3D(NV30_3D_MULTISAMPLE_CONTROL, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_MULTISAMPLE_CONTROL, 1);
        OUT_RING(chan, 0xffff0000);
 
        /* enables use of vp rather than fixed-function somehow */
-       OUT_RING(chan, RING_3D(0x1e94, 1));
+       BEGIN_RING(chan, eng3d, 0x1e94, 1);
        OUT_RING(chan, 0x13);
 }
 
 static void nv40_screen_init(struct nvfx_screen *screen)
 {
        struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *eng3d = screen->eng3d;
 
-       OUT_RING(chan, RING_3D(NV40_3D_DMA_COLOR2, 2));
+       BEGIN_RING(chan, eng3d, NV40_3D_DMA_COLOR2, 2);
        OUT_RING(chan, screen->base.channel->vram->handle);
        OUT_RING(chan, screen->base.channel->vram->handle);
 
-       OUT_RING(chan, RING_3D(0x1450, 1));
+       BEGIN_RING(chan, eng3d, 0x1450, 1);
        OUT_RING(chan, 0x00000004);
 
-       OUT_RING(chan, RING_3D(0x1ea4, 3));
+       BEGIN_RING(chan, eng3d, 0x1ea4, 3);
        OUT_RING(chan, 0x00000010);
        OUT_RING(chan, 0x01000100);
        OUT_RING(chan, 0xff800006);
 
        /* vtxprog output routing */
-       OUT_RING(chan, RING_3D(0x1fc4, 1));
+       BEGIN_RING(chan, eng3d, 0x1fc4, 1);
        OUT_RING(chan, 0x06144321);
-       OUT_RING(chan, RING_3D(0x1fc8, 2));
+       BEGIN_RING(chan, eng3d, 0x1fc8, 2);
        OUT_RING(chan, 0xedcba987);
        OUT_RING(chan, 0x0000006f);
-       OUT_RING(chan, RING_3D(0x1fd0, 1));
+       BEGIN_RING(chan, eng3d, 0x1fd0, 1);
        OUT_RING(chan, 0x00171615);
-       OUT_RING(chan, RING_3D(0x1fd4, 1));
+       BEGIN_RING(chan, eng3d, 0x1fd4, 1);
        OUT_RING(chan, 0x001b1a19);
 
-       OUT_RING(chan, RING_3D(0x1ef8, 1));
+       BEGIN_RING(chan, eng3d, 0x1ef8, 1);
        OUT_RING(chan, 0x0020ffff);
-       OUT_RING(chan, RING_3D(0x1d64, 1));
+       BEGIN_RING(chan, eng3d, 0x1d64, 1);
        OUT_RING(chan, 0x01d300d4);
-       OUT_RING(chan, RING_3D(0x1e94, 1));
+       BEGIN_RING(chan, eng3d, 0x1e94, 1);
        OUT_RING(chan, 0x00000001);
 
-       OUT_RING(chan, RING_3D(NV40_3D_MIPMAP_ROUNDING, 1));
+       BEGIN_RING(chan, eng3d, NV40_3D_MIPMAP_ROUNDING, 1);
        OUT_RING(chan, NV40_3D_MIPMAP_ROUNDING_MODE_DOWN);
 }
 
@@ -571,25 +573,25 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
 
        /* Static eng3d initialisation */
        /* note that we just started using the channel, so we must have space in the pushbuffer */
-       OUT_RING(chan, RING_3D(NV30_3D_DMA_NOTIFY, 1));
+       BEGIN_RING(chan, screen->eng3d, NV30_3D_DMA_NOTIFY, 1);
        OUT_RING(chan, screen->sync->handle);
-       OUT_RING(chan, RING_3D(NV30_3D_DMA_TEXTURE0, 2));
+       BEGIN_RING(chan, screen->eng3d, NV30_3D_DMA_TEXTURE0, 2);
        OUT_RING(chan, chan->vram->handle);
        OUT_RING(chan, chan->gart->handle);
-       OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR1, 1));
+       BEGIN_RING(chan, screen->eng3d, NV30_3D_DMA_COLOR1, 1);
        OUT_RING(chan, chan->vram->handle);
-       OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR0, 2));
+       BEGIN_RING(chan, screen->eng3d, NV30_3D_DMA_COLOR0, 2);
        OUT_RING(chan, chan->vram->handle);
        OUT_RING(chan, chan->vram->handle);
-       OUT_RING(chan, RING_3D(NV30_3D_DMA_VTXBUF0, 2));
+       BEGIN_RING(chan, screen->eng3d, NV30_3D_DMA_VTXBUF0, 2);
        OUT_RING(chan, chan->vram->handle);
        OUT_RING(chan, chan->gart->handle);
 
-       OUT_RING(chan, RING_3D(NV30_3D_DMA_FENCE, 2));
+       BEGIN_RING(chan, screen->eng3d, NV30_3D_DMA_FENCE, 2);
        OUT_RING(chan, 0);
        OUT_RING(chan, screen->query->handle);
 
-       OUT_RING(chan, RING_3D(NV30_3D_DMA_UNK1AC, 2));
+       BEGIN_RING(chan, screen->eng3d, NV30_3D_DMA_UNK1AC, 2);
        OUT_RING(chan, chan->vram->handle);
        OUT_RING(chan, chan->vram->handle);
 
index 54619037d82844529e43718b3398c83c750e41c2..f3dcb205c61b933c97cc78c06f504fa0f5fb0fe5 100644 (file)
@@ -304,7 +304,7 @@ nvfx_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
 {
        struct nvfx_context *nvfx = nvfx_context(pipe);
 
-       nvfx->constbuf[shader] = buf;
+       pipe_resource_reference(&nvfx->constbuf[shader], buf);
        nvfx->constbuf_nr[shader] = buf ? (buf->width0 / (4 * sizeof(float))) : 0;
 
        if (shader == PIPE_SHADER_VERTEX) {
index 501fdd4430c986a63f11f639ce43766cca302487..40ae4f5bd2108c971c015f3506059af32d5c6682 100644 (file)
@@ -7,11 +7,11 @@ void
 nvfx_state_viewport_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel *chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct pipe_viewport_state *vpt = &nvfx->viewport;
 
-       WAIT_RING(chan, 11);
        if(nvfx->render_mode == HW) {
-               OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_TRANSLATE_X, 8));
+               BEGIN_RING(chan, eng3d, NV30_3D_VIEWPORT_TRANSLATE_X, 8);
                OUT_RINGf(chan, vpt->translate[0]);
                OUT_RINGf(chan, vpt->translate[1]);
                OUT_RINGf(chan, vpt->translate[2]);
@@ -20,10 +20,10 @@ nvfx_state_viewport_validate(struct nvfx_context *nvfx)
                OUT_RINGf(chan, vpt->scale[1]);
                OUT_RINGf(chan, vpt->scale[2]);
                OUT_RINGf(chan, vpt->scale[3]);
-               OUT_RING(chan, RING_3D(0x1d78, 1));
+               BEGIN_RING(chan, eng3d, 0x1d78, 1);
                OUT_RING(chan, 1);
        } else {
-               OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_TRANSLATE_X, 8));
+               BEGIN_RING(chan, eng3d, NV30_3D_VIEWPORT_TRANSLATE_X, 8);
                OUT_RINGf(chan, 0.0f);
                OUT_RINGf(chan, 0.0f);
                OUT_RINGf(chan, 0.0f);
@@ -32,7 +32,7 @@ nvfx_state_viewport_validate(struct nvfx_context *nvfx)
                OUT_RINGf(chan, 1.0f);
                OUT_RINGf(chan, 1.0f);
                OUT_RINGf(chan, 1.0f);
-               OUT_RING(chan, RING_3D(0x1d78, 1));
+               BEGIN_RING(chan, eng3d, 0x1d78, 1);
                OUT_RING(chan, nvfx->is_nv4x ? 0x110 : 1);
        }
 }
@@ -41,6 +41,7 @@ void
 nvfx_state_scissor_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel *chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe;
        struct pipe_scissor_state *s = &nvfx->scissor;
 
@@ -48,8 +49,7 @@ nvfx_state_scissor_validate(struct nvfx_context *nvfx)
                return;
        nvfx->state.scissor_enabled = rast->scissor;
 
-       WAIT_RING(chan, 3);
-       OUT_RING(chan, RING_3D(NV30_3D_SCISSOR_HORIZ, 2));
+       BEGIN_RING(chan, eng3d, NV30_3D_SCISSOR_HORIZ, 2);
        if (nvfx->state.scissor_enabled) {
                OUT_RING(chan, ((s->maxx - s->minx) << 16) | s->minx);
                OUT_RING(chan, ((s->maxy - s->miny) << 16) | s->miny);
@@ -63,12 +63,12 @@ void
 nvfx_state_sr_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct pipe_stencil_ref *sr = &nvfx->stencil_ref;
 
-       WAIT_RING(chan, 4);
-       OUT_RING(chan, RING_3D(NV30_3D_STENCIL_FUNC_REF(0), 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_STENCIL_FUNC_REF(0), 1);
        OUT_RING(chan, sr->ref_value[0]);
-       OUT_RING(chan, RING_3D(NV30_3D_STENCIL_FUNC_REF(1), 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_STENCIL_FUNC_REF(1), 1);
        OUT_RING(chan, sr->ref_value[1]);
 }
 
@@ -76,10 +76,10 @@ void
 nvfx_state_blend_colour_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        struct pipe_blend_color *bcol = &nvfx->blend_colour;
 
-       WAIT_RING(chan, 2);
-       OUT_RING(chan, RING_3D(NV30_3D_BLEND_COLOR, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_BLEND_COLOR, 1);
        OUT_RING(chan, ((float_to_ubyte(bcol->color[3]) << 24) |
                       (float_to_ubyte(bcol->color[0]) << 16) |
                       (float_to_ubyte(bcol->color[1]) <<  8) |
@@ -90,9 +90,9 @@ void
 nvfx_state_stipple_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel *chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
 
-       WAIT_RING(chan, 33);
-       OUT_RING(chan, RING_3D(NV30_3D_POLYGON_STIPPLE_PATTERN(0), 32));
+       BEGIN_RING(chan, eng3d, NV30_3D_POLYGON_STIPPLE_PATTERN(0), 32);
        OUT_RINGp(chan, nvfx->stipple, 32);
 }
 
@@ -100,12 +100,12 @@ static void
 nvfx_coord_conventions_validate(struct nvfx_context* nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        unsigned value = nvfx->hw_fragprog->coord_conventions;
        if(value & NV30_3D_COORD_CONVENTIONS_ORIGIN_INVERTED)
                value |= nvfx->framebuffer.height << NV30_3D_COORD_CONVENTIONS_HEIGHT__SHIFT;
 
-       WAIT_RING(chan, 2);
-       OUT_RING(chan, RING_3D(NV30_3D_COORD_CONVENTIONS, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_COORD_CONVENTIONS, 1);
        OUT_RING(chan, value);
 }
 
@@ -113,6 +113,7 @@ static void
 nvfx_ucp_validate(struct nvfx_context* nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        unsigned enables[7] =
        {
                        0,
@@ -126,17 +127,15 @@ nvfx_ucp_validate(struct nvfx_context* nvfx)
 
        if(!nvfx->use_vp_clipping)
        {
-               WAIT_RING(chan, 2);
-               OUT_RING(chan, RING_3D(NV30_3D_VP_CLIP_PLANES_ENABLE, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_CLIP_PLANES_ENABLE, 1);
                OUT_RING(chan, 0);
 
-               WAIT_RING(chan, 6 * 4 + 1);
-               OUT_RING(chan, RING_3D(NV30_3D_VP_CLIP_PLANE(0, 0), nvfx->clip.nr * 4));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_CLIP_PLANE(0, 0),
+                          nvfx->clip.nr * 4);
                OUT_RINGp(chan, &nvfx->clip.ucp[0][0], nvfx->clip.nr * 4);
        }
 
-       WAIT_RING(chan, 2);
-       OUT_RING(chan, RING_3D(NV30_3D_VP_CLIP_PLANES_ENABLE, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_VP_CLIP_PLANES_ENABLE, 1);
        OUT_RING(chan, enables[nvfx->clip.nr]);
 }
 
@@ -144,38 +143,37 @@ static void
 nvfx_vertprog_ucp_validate(struct nvfx_context* nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        unsigned i;
        struct nvfx_vertex_program* vp = nvfx->hw_vertprog;
        if(nvfx->clip.nr != vp->clip_nr)
        {
                unsigned idx;
-               WAIT_RING(chan, 14);
 
                /* remove last instruction bit */
                if(vp->clip_nr >= 0)
                {
                        idx = vp->nr_insns - 7 + vp->clip_nr;
-                       OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_FROM_ID, 1));
+                       BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_FROM_ID, 1);
                        OUT_RING(chan,  vp->exec->start + idx);
-                       OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_INST(0), 4));
+                       BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_INST(0), 4);
                        OUT_RINGp (chan, vp->insns[idx].data, 4);
                }
 
                 /* set last instruction bit */
                idx = vp->nr_insns - 7 + nvfx->clip.nr;
-               OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_FROM_ID, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_FROM_ID, 1);
                OUT_RING(chan,  vp->exec->start + idx);
-               OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_INST(0), 4));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_INST(0), 4);
                OUT_RINGp(chan, vp->insns[idx].data, 3);
                OUT_RING(chan, vp->insns[idx].data[3] | 1);
                vp->clip_nr = nvfx->clip.nr;
        }
 
        // TODO: only do this for the ones changed
-       WAIT_RING(chan, 6 * 6);
        for(i = 0; i < nvfx->clip.nr; ++i)
        {
-               OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_CONST_ID, 5));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_CONST_ID, 5);
                OUT_RING(chan, vp->data->start + i);
                OUT_RINGp (chan, nvfx->clip.ucp[i], 4);
        }
@@ -185,6 +183,7 @@ static boolean
 nvfx_state_validate_common(struct nvfx_context *nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        unsigned dirty;
        unsigned still_dirty = 0;
        int new_fb_mode = -1; /* 1 = all swizzled, 0 = make all linear */
@@ -287,8 +286,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
 
                if(vp_output != nvfx->hw_vp_output)
                {
-                       WAIT_RING(chan, 2);
-                       OUT_RING(chan, RING_3D(NV40_3D_VP_RESULT_EN, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_VP_RESULT_EN, 1);
                        OUT_RING(chan, vp_output);
                        nvfx->hw_vp_output = vp_output;
                }
@@ -320,8 +318,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
 
        if(dirty & NVFX_NEW_ZSA || (new_fb_mode >= 0))
        {
-               WAIT_RING(chan, 3);
-               OUT_RING(chan, RING_3D(NV30_3D_DEPTH_WRITE_ENABLE, 2));
+               BEGIN_RING(chan, eng3d, NV30_3D_DEPTH_WRITE_ENABLE, 2);
                OUT_RING(chan, nvfx->framebuffer.zsbuf && nvfx->zsa->pipe.depth.writemask);
                OUT_RING(chan, nvfx->framebuffer.zsbuf && nvfx->zsa->pipe.depth.enabled);
        }
@@ -334,10 +331,9 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
                // TODO: what about nv30?
                if(nvfx->is_nv4x)
                {
-                       WAIT_RING(chan, 4);
-                       OUT_RING(chan, RING_3D(NV40_3D_TEX_CACHE_CTL, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_TEX_CACHE_CTL, 1);
                        OUT_RING(chan, 2);
-                       OUT_RING(chan, RING_3D(NV40_3D_TEX_CACHE_CTL, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_TEX_CACHE_CTL, 1);
                        OUT_RING(chan, 1);
                }
        }
index 30e48c807354c59d560d37561453802849d928e1..f9fed94044a3efa14a8eb53a78ca129dd3f07895 100644 (file)
@@ -7,7 +7,7 @@ nvfx_surface_linear_renderable(struct pipe_surface* surf)
 {
        /* TODO: precompute this in nvfx_surface creation */
        return (surf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
-               && !(surf->offset & 63)
+               && !(((struct nvfx_surface*)surf)->offset & 63)
                && !(((struct nvfx_surface*)surf)->pitch & 63);
 }
 
@@ -16,8 +16,8 @@ nvfx_surface_swizzled_renderable(struct pipe_framebuffer_state* fb, struct pipe_
 {
        /* TODO: precompute this in nvfx_surface creation */
        return !((struct nvfx_miptree*)surf->texture)->linear_pitch
-               && (surf->texture->target != PIPE_TEXTURE_3D || u_minify(surf->texture->depth0, surf->level) <= 1)
-               && !(surf->offset & 127)
+               && (surf->texture->target != PIPE_TEXTURE_3D || u_minify(surf->texture->depth0, surf->u.tex.level) <= 1)
+               && !(((struct nvfx_surface*)surf)->offset & 127)
                && (surf->width == fb->width)
                && (surf->height == fb->height)
                && !((struct nvfx_surface*)surf)->temp
@@ -31,7 +31,7 @@ nvfx_surface_get_render_target(struct pipe_surface* surf, int all_swizzled, stru
        if(!ns->temp)
        {
                target->bo = ((struct nvfx_miptree*)surf->texture)->base.bo;
-               target->offset = surf->offset;
+               target->offset = ns->offset;
                target->pitch = align(ns->pitch, 64);
                assert(target->pitch);
                return FALSE;
@@ -54,7 +54,7 @@ nvfx_framebuffer_prepare(struct nvfx_context *nvfx)
        int all_swizzled = 1;
 
        if(!nvfx->is_nv4x)
-               assert(fb->nr_cbufs <= 2);
+               assert(fb->nr_cbufs <= 1);
        else
                assert(fb->nr_cbufs <= 4);
 
@@ -96,6 +96,7 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
 {
        struct pipe_framebuffer_state *fb = &nvfx->framebuffer;
        struct nouveau_channel *chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        uint32_t rt_enable, rt_format;
        int i;
        unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
@@ -113,7 +114,9 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
                nvfx->state.render_temps |= nvfx_surface_get_render_target(fb->cbufs[i], prepare_result, &nvfx->hw_rt[i]) << i;
 
        for(; i < 4; ++i)
-               nvfx->hw_rt[i].bo = 0;
+               nvfx->hw_rt[i].bo = NULL;
+
+       nvfx->hw_zeta.bo = NULL;
 
        if (fb->zsbuf) {
                nvfx->state.render_temps |= nvfx_surface_get_render_target(fb->zsbuf, prepare_result, &nvfx->hw_zeta) << 7;
@@ -202,11 +205,11 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
 
                //printf("rendering to bo %p [%i] at offset %i with pitch %i\n", rt0->bo, rt0->bo->handle, rt0->offset, pitch);
 
-               OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR0, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_DMA_COLOR0, 1);
                OUT_RELOC(chan, rt0->bo, 0,
                              rt_flags | NOUVEAU_BO_OR,
                              chan->vram->handle, chan->gart->handle);
-               OUT_RING(chan, RING_3D(NV30_3D_COLOR0_PITCH, 2));
+               BEGIN_RING(chan, eng3d, NV30_3D_COLOR0_PITCH, 2);
                OUT_RING(chan, pitch);
                OUT_RELOC(chan, rt0->bo,
                              rt0->offset, rt_flags | NOUVEAU_BO_LOW,
@@ -214,11 +217,11 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
        }
 
        if (rt_enable & NV30_3D_RT_ENABLE_COLOR1) {
-               OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR1, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_DMA_COLOR1, 1);
                OUT_RELOC(chan, nvfx->hw_rt[1].bo, 0,
                              rt_flags | NOUVEAU_BO_OR,
                              chan->vram->handle, chan->gart->handle);
-               OUT_RING(chan, RING_3D(NV30_3D_COLOR1_OFFSET, 2));
+               BEGIN_RING(chan, eng3d, NV30_3D_COLOR1_OFFSET, 2);
                OUT_RELOC(chan, nvfx->hw_rt[1].bo,
                                nvfx->hw_rt[1].offset, rt_flags | NOUVEAU_BO_LOW,
                              0, 0);
@@ -228,68 +231,68 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
        if(nvfx->is_nv4x)
        {
                if (rt_enable & NV40_3D_RT_ENABLE_COLOR2) {
-                       OUT_RING(chan, RING_3D(NV40_3D_DMA_COLOR2, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_DMA_COLOR2, 1);
                        OUT_RELOC(chan, nvfx->hw_rt[2].bo, 0,
                                      rt_flags | NOUVEAU_BO_OR,
                                      chan->vram->handle, chan->gart->handle);
-                       OUT_RING(chan, RING_3D(NV40_3D_COLOR2_OFFSET, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_COLOR2_OFFSET, 1);
                        OUT_RELOC(chan, nvfx->hw_rt[2].bo,
                                      nvfx->hw_rt[2].offset, rt_flags | NOUVEAU_BO_LOW,
                                      0, 0);
-                       OUT_RING(chan, RING_3D(NV40_3D_COLOR2_PITCH, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_COLOR2_PITCH, 1);
                        OUT_RING(chan, nvfx->hw_rt[2].pitch);
                }
 
                if (rt_enable & NV40_3D_RT_ENABLE_COLOR3) {
-                       OUT_RING(chan, RING_3D(NV40_3D_DMA_COLOR3, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_DMA_COLOR3, 1);
                        OUT_RELOC(chan, nvfx->hw_rt[3].bo, 0,
                                      rt_flags | NOUVEAU_BO_OR,
                                      chan->vram->handle, chan->gart->handle);
-                       OUT_RING(chan, RING_3D(NV40_3D_COLOR3_OFFSET, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_COLOR3_OFFSET, 1);
                        OUT_RELOC(chan, nvfx->hw_rt[3].bo,
                                        nvfx->hw_rt[3].offset, rt_flags | NOUVEAU_BO_LOW,
                                      0, 0);
-                       OUT_RING(chan, RING_3D(NV40_3D_COLOR3_PITCH, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_COLOR3_PITCH, 1);
                        OUT_RING(chan, nvfx->hw_rt[3].pitch);
                }
        }
 
        if (fb->zsbuf) {
-               OUT_RING(chan, RING_3D(NV30_3D_DMA_ZETA, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_DMA_ZETA, 1);
                OUT_RELOC(chan, nvfx->hw_zeta.bo, 0,
                              rt_flags | NOUVEAU_BO_OR,
                              chan->vram->handle, chan->gart->handle);
-               OUT_RING(chan, RING_3D(NV30_3D_ZETA_OFFSET, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_ZETA_OFFSET, 1);
                /* TODO: reverse engineer LMA */
                OUT_RELOC(chan, nvfx->hw_zeta.bo,
                             nvfx->hw_zeta.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0);
                if(nvfx->is_nv4x) {
-                       OUT_RING(chan, RING_3D(NV40_3D_ZETA_PITCH, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_ZETA_PITCH, 1);
                        OUT_RING(chan, nvfx->hw_zeta.pitch);
                }
        }
        else if(nvfx->is_nv4x) {
-               OUT_RING(chan, RING_3D(NV40_3D_ZETA_PITCH, 1));
+               BEGIN_RING(chan, eng3d, NV40_3D_ZETA_PITCH, 1);
                OUT_RING(chan, 64);
        }
 
-       OUT_RING(chan, RING_3D(NV30_3D_RT_ENABLE, 1));
+       BEGIN_RING(chan, eng3d, NV30_3D_RT_ENABLE, 1);
        OUT_RING(chan, rt_enable);
-       OUT_RING(chan, RING_3D(NV30_3D_RT_HORIZ, 3));
+       BEGIN_RING(chan, eng3d, NV30_3D_RT_HORIZ, 3);
        OUT_RING(chan, (w << 16) | 0);
        OUT_RING(chan, (h << 16) | 0);
        OUT_RING(chan, rt_format);
-       OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_HORIZ, 2));
+       BEGIN_RING(chan, eng3d, NV30_3D_VIEWPORT_HORIZ, 2);
        OUT_RING(chan, (w << 16) | 0);
        OUT_RING(chan, (h << 16) | 0);
-       OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_CLIP_HORIZ(0), 2));
+       BEGIN_RING(chan, eng3d, NV30_3D_VIEWPORT_CLIP_HORIZ(0), 2);
        OUT_RING(chan, ((w - 1) << 16) | 0);
        OUT_RING(chan, ((h - 1) << 16) | 0);
 
        if(!nvfx->is_nv4x) {
                /* Wonder why this is needed, context should all be set to zero on init */
                /* TODO: we can most likely remove this, after putting it in context init */
-               OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_TX_ORIGIN, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VIEWPORT_TX_ORIGIN, 1);
                OUT_RING(chan, 0);
        }
        nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAMEBUFFER;
index 70adebc1be5d4dd826f1d49dde0c1bbaddccf434..be31853d7177c99e5651941b280d4e62a9dabebb 100644 (file)
@@ -99,17 +99,17 @@ nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf,
                        util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(&surf->base.base), &surf->base);
        } else {
                rgn->bo = ((struct nvfx_resource*)surf->base.base.texture)->bo;
-               rgn->offset = surf->base.base.offset;
+               rgn->offset = surf->offset;
 
                if(surf->base.base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
                        rgn->pitch = surf->pitch;
                else
                {
                        rgn->pitch = 0;
-                       rgn->z = surf->base.base.zslice;
+                       rgn->z = surf->base.base.u.tex.first_layer;
                        rgn->w = surf->base.base.width;
                        rgn->h = surf->base.base.height;
-                       rgn->d = u_minify(surf->base.base.texture->depth0, surf->base.base.level);
+                       rgn->d = u_minify(surf->base.base.texture->depth0, surf->base.base.u.tex.level);
                }
        }
 
@@ -119,11 +119,11 @@ nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf,
 }
 
 static INLINE void
-nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource* pt, struct pipe_subresource sub, unsigned x, unsigned y, unsigned z, bool for_write)
+nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource* pt, unsigned level, unsigned x, unsigned y, unsigned z, bool for_write)
 {
        if(pt->target != PIPE_BUFFER)
        {
-               struct nvfx_surface* ns = (struct nvfx_surface*)util_surfaces_peek(&((struct nvfx_miptree*)pt)->surfaces, pt, sub.face, sub.level, z);
+               struct nvfx_surface* ns = (struct nvfx_surface*)util_surfaces_peek(&((struct nvfx_miptree*)pt)->surfaces, pt, level, z);
                if(ns && util_dirty_surface_is_dirty(&ns->base))
                {
                        nvfx_region_init_for_surface(rgn, ns, x, y, for_write);
@@ -132,22 +132,22 @@ nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource*
        }
 
        rgn->bo = ((struct nvfx_resource*)pt)->bo;
-       rgn->offset = nvfx_subresource_offset(pt, sub.face, sub.level, z);
+       rgn->offset = nvfx_subresource_offset(pt, z, level, z);
        rgn->x = x;
        rgn->y = y;
 
        if(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)
        {
-               rgn->pitch = nvfx_subresource_pitch(pt, sub.level);
+               rgn->pitch = nvfx_subresource_pitch(pt, level);
                rgn->z = 0;
        }
        else
        {
                rgn->pitch = 0;
                rgn->z = z;
-               rgn->w = u_minify(pt->width0, sub.level);
-               rgn->h = u_minify(pt->height0, sub.level);
-               rgn->d = u_minify(pt->depth0, sub.level);
+               rgn->w = u_minify(pt->width0, level);
+               rgn->h = u_minify(pt->height0, level);
+               rgn->d = u_minify(pt->depth0, level);
        }
 
        nvfx_region_set_format(rgn, pt->format);
@@ -168,8 +168,8 @@ nvfx_get_blitter(struct pipe_context* pipe, int copy)
        if(nvfx->query && !nvfx->blitters_in_use)
        {
                struct nouveau_channel* chan = nvfx->screen->base.channel;
-               WAIT_RING(chan, 2);
-               OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+               struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+               BEGIN_RING(chan, eng3d, NV30_3D_QUERY_ENABLE, 1);
                OUT_RING(chan, 0);
        }
 
@@ -209,8 +209,8 @@ nvfx_put_blitter(struct pipe_context* pipe, struct blitter_context* blitter)
        if(nvfx->query && !nvfx->blitters_in_use)
        {
                struct nouveau_channel* chan = nvfx->screen->base.channel;
-               WAIT_RING(chan, 2);
-               OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+               struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+               BEGIN_RING(chan, eng3d, NV30_3D_QUERY_ENABLE, 1);
                OUT_RING(chan, 1);
        }
 }
@@ -234,11 +234,10 @@ nvfx_region_clone(struct nv04_2d_context* ctx, struct nv04_region* rgn, unsigned
 
 static void
 nvfx_resource_copy_region(struct pipe_context *pipe,
-                 struct pipe_resource *dstr, struct pipe_subresource subdst,
-                 unsigned dstx, unsigned dsty, unsigned dstz,
-                 struct pipe_resource *srcr, struct pipe_subresource subsrc,
-                 unsigned srcx, unsigned srcy, unsigned srcz,
-                 unsigned w, unsigned h)
+                         struct pipe_resource *dstr, unsigned dst_level,
+                         unsigned dstx, unsigned dsty, unsigned dstz,
+                         struct pipe_resource *srcr, unsigned src_level,
+                         const struct pipe_box *src_box)
 {
        static int copy_threshold = -1;
        struct nv04_2d_context *ctx = nvfx_screen(pipe->screen)->eng2d;
@@ -247,6 +246,8 @@ nvfx_resource_copy_region(struct pipe_context *pipe,
        int src_on_gpu;
        boolean small;
        int ret;
+       unsigned w = src_box->width;
+       unsigned h = src_box->height;
 
        if(!w || !h)
                return;
@@ -257,8 +258,8 @@ nvfx_resource_copy_region(struct pipe_context *pipe,
        dst_to_gpu = dstr->usage != PIPE_USAGE_DYNAMIC && dstr->usage != PIPE_USAGE_STAGING;
        src_on_gpu = nvfx_resource_on_gpu(srcr);
 
-       nvfx_region_init_for_subresource(&dst, dstr, subdst, dstx, dsty, dstz, TRUE);
-       nvfx_region_init_for_subresource(&src, srcr, subsrc, srcx, srcy, srcz, FALSE);
+       nvfx_region_init_for_subresource(&dst, dstr, dst_level, dstx, dsty, dstz, TRUE);
+       nvfx_region_init_for_subresource(&src, srcr, src_level, src_box->x, src_box->y, src_box->z, FALSE);
        w = util_format_get_stride(dstr->format, w) >> dst.bpps;
        h = util_format_get_nblocksy(dstr->format, h);
 
@@ -279,7 +280,7 @@ nvfx_resource_copy_region(struct pipe_context *pipe,
                 * TODO: perhaps support reinterpreting the formats
                 */
                struct blitter_context* blitter = nvfx_get_blitter(pipe, 1);
-               util_blitter_copy_region(blitter, dstr, subdst, dstx, dsty, dstz, srcr, subsrc, srcx, srcy, srcz, w, h, TRUE);
+               util_blitter_copy_region(blitter, dstr, dst_level, dstx, dsty, dstz, srcr, src_level, src_box, TRUE);
                nvfx_put_blitter(pipe, blitter);
        }
        else
@@ -371,7 +372,7 @@ static void
 nvfx_surface_copy_temp(struct pipe_context* pipe, struct pipe_surface* surf, int to_temp)
 {
        struct nvfx_surface* ns = (struct nvfx_surface*)surf;
-       struct pipe_subresource tempsr, surfsr;
+       struct pipe_box box;
        struct nvfx_context* nvfx = nvfx_context(pipe);
        struct nvfx_miptree* temp;
        unsigned use_vertex_buffers;
@@ -387,15 +388,20 @@ nvfx_surface_copy_temp(struct pipe_context* pipe, struct pipe_surface* surf, int
        use_index_buffer = nvfx->use_index_buffer;
        base_vertex = nvfx->base_vertex;
 
-       tempsr.face = 0;
-       tempsr.level = 0;
-       surfsr.face = surf->face;
-       surfsr.level = surf->level;
+       box.x = box.y = 0;
+       assert(surf->u.tex.first_layer == surf->u.tex.last_layer);
+       box.width = surf->width;
+       box.height = surf->height;
+       box.depth = 1;
 
-       if(to_temp)
-               nvfx_resource_copy_region(pipe, &temp->base.base, tempsr, 0, 0, 0, surf->texture, surfsr, 0, 0, surf->zslice, surf->width, surf->height);
-       else
-               nvfx_resource_copy_region(pipe, surf->texture, surfsr, 0, 0, surf->zslice, &temp->base.base, tempsr, 0, 0, 0, surf->width, surf->height);
+       if(to_temp) {
+               box.z = surf->u.tex.first_layer;
+               nvfx_resource_copy_region(pipe, &temp->base.base, 0, 0, 0, 0, surf->texture, surf->u.tex.level, &box);
+       }
+       else {
+               box.z = 0;
+               nvfx_resource_copy_region(pipe, surf->texture, surf->u.tex.level, 0, 0, surf->u.tex.first_layer, &temp->base.base, 0, &box);
+       }
 
        /* If this triggers, it probably means we attempted to use the blitter
         * but failed due to non-renderability of the target.
index 7cb47a20f645818ecb046b24a258051b3e312c4f..2debcb6eb8f92578fcb9221009438f0f16321549 100644 (file)
@@ -21,10 +21,10 @@ struct nvfx_staging_transfer
 
 struct pipe_transfer *
 nvfx_transfer_new(struct pipe_context *pipe,
-                         struct pipe_resource *pt,
-                         struct pipe_subresource sr,
-                         unsigned usage,
-                         const struct pipe_box *box)
+                 struct pipe_resource *pt,
+                 unsigned level,
+                 unsigned usage,
+                 const struct pipe_box *box)
 {
         if((usage & (PIPE_TRANSFER_UNSYNCHRONIZED | PIPE_TRANSFER_DONTBLOCK)) == PIPE_TRANSFER_DONTBLOCK)
         {
@@ -44,11 +44,11 @@ nvfx_transfer_new(struct pipe_context *pipe,
                        return NULL;
 
                pipe_resource_reference(&tx->resource, pt);
-               tx->sr = sr;
+               tx->level = level;
                tx->usage = usage;
                tx->box = *box;
 
-               tx->slice_stride = tx->stride = util_format_get_stride(pt->format, box->width);
+               tx->layer_stride = tx->stride = util_format_get_stride(pt->format, box->width);
                tx->data = buffer->data + util_format_get_stride(pt->format, box->x);
 
                return tx;
@@ -62,20 +62,20 @@ nvfx_transfer_new(struct pipe_context *pipe,
                if(!tx)
                        return NULL;
 
-               util_staging_transfer_init(pipe, pt, sr, usage, box, direct, &tx->base);
+               util_staging_transfer_init(pipe, pt, level, usage, box, direct, &tx->base);
 
                if(direct)
                {
-                       tx->base.base.stride = nvfx_subresource_pitch(pt, sr.level);
-                       tx->base.base.slice_stride = tx->base.base.stride * u_minify(pt->height0, sr.level);
-                       tx->offset = nvfx_subresource_offset(pt, sr.face, sr.level, box->z)
+                       tx->base.base.stride = nvfx_subresource_pitch(pt, level);
+                       tx->base.base.layer_stride = tx->base.base.stride * u_minify(pt->height0, level);
+                       tx->offset = nvfx_subresource_offset(pt, box->z, level, box->z)
                                + util_format_get_2d_size(pt->format, tx->base.base.stride, box->y)
                                + util_format_get_stride(pt->format, box->x);
                }
                else
                {
                        tx->base.base.stride = nvfx_subresource_pitch(tx->base.staging_resource, 0);
-                       tx->base.base.slice_stride = tx->base.base.stride * tx->base.staging_resource->height0;
+                       tx->base.base.layer_stride = tx->base.base.stride * tx->base.staging_resource->height0;
                        tx->offset = 0;
                }
 
@@ -187,7 +187,7 @@ nvfx_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx)
 
 static void nvfx_transfer_inline_write( struct pipe_context *pipe,
                                      struct pipe_resource *pr,
-                                     struct pipe_subresource sr,
+                                     unsigned level,
                                      unsigned usage,
                                      const struct pipe_box *box,
                                      const void *data,
@@ -196,7 +196,7 @@ static void nvfx_transfer_inline_write( struct pipe_context *pipe,
 {
        if(pr->target != PIPE_BUFFER)
        {
-               u_default_transfer_inline_write(pipe, pr, sr, usage, box, data, stride, slice_stride);
+               u_default_transfer_inline_write(pipe, pr, level, usage, box, data, stride, slice_stride);
        }
        else
        {
index 20f20d5b0b8b0e0ae106670282853d9f71b5cc0b..682f428b793dd478d410d82f02e8157933a17472 100644 (file)
@@ -9,7 +9,7 @@
 struct pipe_transfer *
 nvfx_transfer_new(struct pipe_context *pcontext,
                          struct pipe_resource *pt,
-                         struct pipe_subresource sr,
+                         unsigned level,
                          unsigned usage,
                          const struct pipe_box *box);
 
index 597664e77161eb50e1f25dcb6dd9d422130d0930..01dacb43dad1155b77d350e72c3e4da2c7a78456 100644 (file)
@@ -9,8 +9,7 @@
 #include "nvfx_resource.h"
 
 #include "nouveau/nouveau_channel.h"
-
-#include "nouveau/nouveau_pushbuf.h"
+#include "nouveau/nv04_pushbuf.h"
 
 static inline unsigned
 util_guess_unique_indices_count(unsigned mode, unsigned indices)
@@ -247,6 +246,7 @@ boolean
 nvfx_vbo_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        int i;
        int elements = MAX2(nvfx->vtxelt->num_elements, nvfx->hw_vtxelt_nr);
        unsigned vb_flags = nvfx->screen->vertex_buffer_reloc_flags | NOUVEAU_BO_RD;
@@ -262,11 +262,11 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
                struct nvfx_buffer* buffer = nvfx_buffer(vb->buffer);
                float v[4];
                ve->fetch_rgba_float(v, buffer->data + vb->buffer_offset + ve->src_offset, 0, 0);
-               nvfx_emit_vtx_attr(chan, ve->idx, v, ve->ncomp);
+               nvfx_emit_vtx_attr(chan, eng3d, ve->idx, v, ve->ncomp);
        }
 
 
-       OUT_RING(chan, RING_3D(NV30_3D_VTXFMT(0), elements));
+       BEGIN_RING(chan, eng3d, NV30_3D_VTXFMT(0), elements);
        if(nvfx->use_vertex_buffers)
        {
                unsigned idx = 0;
@@ -297,12 +297,12 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
                unsigned i;
                /* seems to be some kind of cache flushing */
                for(i = 0; i < 3; ++i) {
-                       OUT_RING(chan, RING_3D(0x1718, 1));
+                       BEGIN_RING(chan, eng3d, 0x1718, 1);
                        OUT_RING(chan, 0);
                }
        }
 
-       OUT_RING(chan, RING_3D(NV30_3D_VTXBUF(0), elements));
+       BEGIN_RING(chan, eng3d, NV30_3D_VTXBUF(0), elements);
        if(nvfx->use_vertex_buffers)
        {
                unsigned idx = 0;
@@ -330,7 +330,7 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
                        OUT_RING(chan, 0);
        }
 
-       OUT_RING(chan, RING_3D(0x1710, 1));
+       BEGIN_RING(chan, eng3d, 0x1710, 1);
        OUT_RING(chan, 0);
 
        nvfx->hw_vtxelt_nr = nvfx->vtxelt->num_elements;
@@ -342,15 +342,14 @@ void
 nvfx_vbo_swtnl_validate(struct nvfx_context *nvfx)
 {
        struct nouveau_channel* chan = nvfx->screen->base.channel;
+       struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
        unsigned num_outputs = nvfx->vertprog->draw_elements;
        int elements = MAX2(num_outputs, nvfx->hw_vtxelt_nr);
 
        if (!elements)
                return;
 
-       WAIT_RING(chan, (1 + 6 + 1 + 2) + elements * 2);
-
-       OUT_RING(chan, RING_3D(NV30_3D_VTXFMT(0), elements));
+       BEGIN_RING(chan, eng3d, NV30_3D_VTXFMT(0), elements);
        for(unsigned i = 0; i < num_outputs; ++i)
                OUT_RING(chan, (4 << NV30_3D_VTXFMT_SIZE__SHIFT) | NV30_3D_VTXFMT_TYPE_V32_FLOAT);
        for(unsigned i = num_outputs; i < elements; ++i)
@@ -360,16 +359,16 @@ nvfx_vbo_swtnl_validate(struct nvfx_context *nvfx)
                unsigned i;
                /* seems to be some kind of cache flushing */
                for(i = 0; i < 3; ++i) {
-                       OUT_RING(chan, RING_3D(0x1718, 1));
+                       BEGIN_RING(chan, eng3d, 0x1718, 1);
                        OUT_RING(chan, 0);
                }
        }
 
-       OUT_RING(chan, RING_3D(NV30_3D_VTXBUF(0), elements));
+       BEGIN_RING(chan, eng3d, NV30_3D_VTXBUF(0), elements);
        for (unsigned i = 0; i < elements; i++)
                OUT_RING(chan, 0);
 
-       OUT_RING(chan, RING_3D(0x1710, 1));
+       BEGIN_RING(chan, eng3d, 0x1710, 1);
        OUT_RING(chan, 0);
 
        nvfx->hw_vtxelt_nr = num_outputs;
@@ -592,18 +591,10 @@ nvfx_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
 {
        struct nvfx_context *nvfx = nvfx_context(pipe);
 
-       for(unsigned i = 0; i < count; ++i)
-       {
-               pipe_resource_reference(&nvfx->vtxbuf[i].buffer, vb[i].buffer);
-               nvfx->vtxbuf[i].buffer_offset = vb[i].buffer_offset;
-               nvfx->vtxbuf[i].max_index = vb[i].max_index;
-               nvfx->vtxbuf[i].stride = vb[i].stride;
-       }
-
-       for(unsigned i = count; i < nvfx->vtxbuf_nr; ++i)
-               pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0);
+        util_copy_vertex_buffers(nvfx->vtxbuf,
+                                 &nvfx->vtxbuf_nr,
+                                 vb, count);
 
-       nvfx->vtxbuf_nr = count;
        nvfx->use_vertex_buffers = -1;
        nvfx->draw_dirty |= NVFX_NEW_ARRAYS;
 }
index e543fda50ef18c7ab413a3fc7dc932ba94a13e18..a11941f3d51ee89b0f43d098e1e382c451ba5ba1 100644 (file)
@@ -1182,6 +1182,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 {
        struct nvfx_screen *screen = nvfx->screen;
        struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *eng3d = screen->eng3d;
        struct nvfx_pipe_vertex_program *pvp = nvfx->vertprog;
        struct nvfx_vertex_program* vp;
        struct pipe_resource *constbuf;
@@ -1341,7 +1342,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
                }
                */
 
-               WAIT_RING(chan, 6 * vp->nr_consts);
                for (i = nvfx->use_vp_clipping ? 6 : 0; i < vp->nr_consts; i++) {
                        struct nvfx_vertex_program_data *vpd = &vp->consts[i];
 
@@ -1356,7 +1356,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 
                        //printf("upload into %i + %i: %f %f %f %f\n", vp->data->start, i, vpd->value[0], vpd->value[1], vpd->value[2], vpd->value[3]);
 
-                       OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_CONST_ID, 5));
+                       BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_CONST_ID, 5);
                        OUT_RING(chan, i + vp->data->start);
                        OUT_RINGp(chan, (uint32_t *)vpd->value, 4);
                }
@@ -1364,11 +1364,10 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 
        /* Upload vtxprog */
        if (upload_code) {
-               WAIT_RING(chan, 2 + 5 * vp->nr_insns);
-               OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_FROM_ID, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_FROM_ID, 1);
                OUT_RING(chan, vp->exec->start);
                for (i = 0; i < vp->nr_insns; i++) {
-                       OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_INST(0), 4));
+                       BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_INST(0), 4);
                        //printf("%08x %08x %08x %08x\n", vp->insns[i].data[0], vp->insns[i].data[1], vp->insns[i].data[2], vp->insns[i].data[3]);
                        OUT_RINGp(chan, vp->insns[i].data, 4);
                }
@@ -1377,11 +1376,10 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 
        if(nvfx->dirty & (NVFX_NEW_VERTPROG))
        {
-               WAIT_RING(chan, 6);
-               OUT_RING(chan, RING_3D(NV30_3D_VP_START_FROM_ID, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_START_FROM_ID, 1);
                OUT_RING(chan, vp->exec->start);
                if(nvfx->is_nv4x) {
-                       OUT_RING(chan, RING_3D(NV40_3D_VP_ATTRIB_EN, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_VP_ATTRIB_EN, 1);
                        OUT_RING(chan, vp->ir);
                }
        }
index 0ac4e4c6f128cd4fd5d7a3dec9caf0abeef421bb..a43e83c0d363c11db33a984b700b8fa3d84809e0 100644 (file)
@@ -179,6 +179,12 @@ static void r300_clear(struct pipe_context* pipe,
     boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
     uint32_t hyperz_dcv = hyperz->zb_depthclearvalue;
 
+    /* Decompress zbuffers that are bound as textures. If we didn't flush here,
+     * it would happen inside the blitter when updating derived state,
+     * causing a blitter operation to be called from inside the blitter,
+     * which would overwrite saved states and they would never get restored. */
+    r300_flush_depth_textures(r300);
+
     /* Enable fast Z clear.
      * The zbuffer must be in micro-tiled mode, otherwise it locks up. */
     if ((buffers & PIPE_CLEAR_DEPTHSTENCIL) && can_hyperz) {
@@ -186,12 +192,12 @@ static void r300_clear(struct pipe_context* pipe,
             r300_depth_clear_value(fb->zsbuf->format, depth, stencil);
 
         r300_mark_fb_state_dirty(r300, R300_CHANGED_ZCLEAR_FLAG);
-        if (zstex->zmask_mem[fb->zsbuf->level]) {
-            r300->zmask_clear.dirty = TRUE;
+        if (zstex->zmask_mem[fb->zsbuf->u.tex.level]) {
+            r300_mark_atom_dirty(r300, &r300->zmask_clear);
             buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
         }
-        if (zstex->hiz_mem[fb->zsbuf->level])
-            r300->hiz_clear.dirty = TRUE;
+        if (zstex->hiz_mem[fb->zsbuf->u.tex.level])
+            r300_mark_atom_dirty(r300, &r300->hiz_clear);
     }
 
     /* Enable CBZB clear. */
@@ -230,7 +236,7 @@ static void r300_clear(struct pipe_context* pipe,
                  r300_get_num_cs_end_dwords(r300);
 
         /* Reserve CS space. */
-        if (dwords > (r300->cs->ndw - r300->cs->cdw)) {
+        if (dwords > (R300_MAX_CMDBUF_DWORDS - r300->cs->cdw)) {
             r300->context.flush(&r300->context, 0, NULL);
         }
 
@@ -259,9 +265,9 @@ static void r300_clear(struct pipe_context* pipe,
      * If we cleared zmask/hiz, it's in use now. The Hyper-Z state update
      * looks if zmask/hiz is in use and enables fastfill accordingly. */
     if (zstex &&
-        (zstex->zmask_in_use[fb->zsbuf->level] ||
-         zstex->hiz_in_use[fb->zsbuf->level])) {
-        r300->hyperz_state.dirty = TRUE;
+        (zstex->zmask_in_use[fb->zsbuf->u.tex.level] ||
+         zstex->hiz_in_use[fb->zsbuf->u.tex.level])) {
+        r300_mark_atom_dirty(r300, &r300->hyperz_state);
     }
 }
 
@@ -274,6 +280,12 @@ static void r300_clear_render_target(struct pipe_context *pipe,
 {
     struct r300_context *r300 = r300_context(pipe);
 
+    /* Decompress zbuffers that are bound as textures. If we didn't flush here,
+     * it would happen inside the blitter when updating derived state,
+     * causing a blitter operation to be called from inside the blitter,
+     * which would overwrite saved states and they would never get restored. */
+    r300_flush_depth_textures(r300);
+
     r300_blitter_begin(r300, R300_CLEAR_SURFACE);
     util_blitter_clear_render_target(r300->blitter, dst, rgba,
                                      dstx, dsty, width, height);
@@ -291,6 +303,12 @@ static void r300_clear_depth_stencil(struct pipe_context *pipe,
 {
     struct r300_context *r300 = r300_context(pipe);
 
+    /* Decompress zbuffers that are bound as textures. If we didn't flush here,
+     * it would happen inside the blitter when updating derived state,
+     * causing a blitter operation to be called from inside the blitter,
+     * which would overwrite saved states and they would never get restored. */
+    r300_flush_depth_textures(r300);
+
     r300_blitter_begin(r300, R300_CLEAR_SURFACE);
     util_blitter_clear_depth_stencil(r300->blitter, dst, clear_flags, depth, stencil,
                                      dstx, dsty, width, height);
@@ -298,64 +316,103 @@ static void r300_clear_depth_stencil(struct pipe_context *pipe,
 }
 
 /* Flush a depth stencil buffer. */
-void r300_flush_depth_stencil(struct pipe_context *pipe,
-                              struct pipe_resource *dst,
-                              struct pipe_subresource subdst,
-                              unsigned zslice)
+static void r300_flush_depth_stencil(struct pipe_context *pipe,
+                                     struct pipe_resource *dst,
+                                     unsigned level,
+                                     unsigned layer)
 {
     struct r300_context *r300 = r300_context(pipe);
-    struct pipe_surface *dstsurf;
+    struct pipe_surface *dstsurf, surf_tmpl;
     struct r300_texture *tex = r300_texture(dst);
 
-    if (!tex->zmask_mem[subdst.level])
+    if (!tex->zmask_mem[level])
         return;
-    if (!tex->zmask_in_use[subdst.level])
+    if (!tex->zmask_in_use[level])
         return;
 
-    dstsurf = pipe->screen->get_tex_surface(pipe->screen, dst,
-                                            subdst.face, subdst.level, zslice,
-                                            PIPE_BIND_DEPTH_STENCIL);
+    surf_tmpl.format = dst->format;
+    surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL;
+    surf_tmpl.u.tex.level = level;
+    surf_tmpl.u.tex.first_layer = layer;
+    surf_tmpl.u.tex.last_layer = layer;
+    dstsurf = pipe->create_surface(pipe, dst, &surf_tmpl);
+
     r300->z_decomp_rd = TRUE;
+
     r300_blitter_begin(r300, R300_CLEAR_SURFACE);
     util_blitter_flush_depth_stencil(r300->blitter, dstsurf);
     r300_blitter_end(r300);
     r300->z_decomp_rd = FALSE;
 
-    tex->zmask_in_use[subdst.level] = FALSE;
+    tex->zmask_in_use[level] = FALSE;
+    pipe_surface_reference(&dstsurf, NULL);
+}
+
+/* We can't use compressed zbuffers as samplers. */
+void r300_flush_depth_textures(struct r300_context *r300)
+{
+    struct r300_textures_state *state =
+        (struct r300_textures_state*)r300->textures_state.state;
+    unsigned i, level;
+    unsigned count = MIN2(state->sampler_view_count,
+                          state->sampler_state_count);
+
+    if (r300->z_decomp_rd)
+        return;
+
+    for (i = 0; i < count; i++)
+        if (state->sampler_views[i] && state->sampler_states[i]) {
+            struct pipe_resource *tex = state->sampler_views[i]->base.texture;
+
+            if (tex->target == PIPE_TEXTURE_3D ||
+                tex->target == PIPE_TEXTURE_CUBE)
+                continue;
+
+            /* Ignore non-depth textures.
+             * Also ignore reinterpreted depth textures, e.g. resource_copy. */
+            if (!util_format_is_depth_or_stencil(tex->format))
+                continue;
+
+            for (level = 0; level <= tex->last_level; level++)
+                if (r300_texture(tex)->zmask_in_use[level]) {
+                    /* We don't handle 3D textures and cubemaps yet. */
+                    r300_flush_depth_stencil(&r300->context, tex, level, 0);
+                 }
+        }
 }
 
 /* Copy a block of pixels from one surface to another using HW. */
 static void r300_hw_copy_region(struct pipe_context* pipe,
                                 struct pipe_resource *dst,
-                                struct pipe_subresource subdst,
+                                unsigned dst_level,
                                 unsigned dstx, unsigned dsty, unsigned dstz,
                                 struct pipe_resource *src,
-                                struct pipe_subresource subsrc,
-                                unsigned srcx, unsigned srcy, unsigned srcz,
-                                unsigned width, unsigned height)
+                                unsigned src_level,
+                                const struct pipe_box *src_box)
 {
     struct r300_context* r300 = r300_context(pipe);
 
     r300_blitter_begin(r300, R300_COPY);
-    util_blitter_copy_region(r300->blitter, dst, subdst, dstx, dsty, dstz,
-                             src, subsrc, srcx, srcy, srcz, width, height,
-                             TRUE);
+
+    /* Do a copy */
+    util_blitter_copy_region(r300->blitter, dst, dst_level, dstx, dsty, dstz,
+                             src, src_level, src_box, TRUE);
     r300_blitter_end(r300);
 }
 
 /* Copy a block of pixels from one surface to another. */
 static void r300_resource_copy_region(struct pipe_context *pipe,
                                       struct pipe_resource *dst,
-                                      struct pipe_subresource subdst,
+                                      unsigned dst_level,
                                       unsigned dstx, unsigned dsty, unsigned dstz,
                                       struct pipe_resource *src,
-                                      struct pipe_subresource subsrc,
-                                      unsigned srcx, unsigned srcy, unsigned srcz,
-                                      unsigned width, unsigned height)
+                                      unsigned src_level,
+                                      const struct pipe_box *src_box)
 {
     enum pipe_format old_format = dst->format;
     enum pipe_format new_format = old_format;
     boolean is_depth;
+
     if (!pipe->screen->is_format_supported(pipe->screen,
                                            old_format, src->target,
                                            src->nr_samples,
@@ -384,8 +441,9 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
 
     is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
     if (is_depth) {
-        r300_flush_depth_stencil(pipe, src, subsrc, srcz);
+        r300_flush_depth_stencil(pipe, src, src_level, src_box->z);
     }
+
     if (old_format != new_format) {
         r300_texture_reinterpret_format(pipe->screen,
                                         dst, new_format);
@@ -393,8 +451,8 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
                                         src, new_format);
     }
 
-    r300_hw_copy_region(pipe, dst, subdst, dstx, dsty, dstz,
-                        src, subsrc, srcx, srcy, srcz, width, height);
+    r300_hw_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
+                        src, src_level, src_box);
 
     if (old_format != new_format) {
         r300_texture_reinterpret_format(pipe->screen,
index 48c24092114013332c04e5134ca2ec3120989b8e..2b183f62c56e3284683c86c151d8ba62b9af2fe3 100644 (file)
@@ -366,7 +366,7 @@ void r300_parse_chipset(struct r300_capabilities* caps)
             caps->family = CHIP_FAMILY_RV530;
             caps->num_vert_fpus = 5;
             caps->is_r500 = TRUE;
-            /*caps->hiz_ram = RV530_HIZ_LIMIT;*/
+            caps->hiz_ram = RV530_HIZ_LIMIT;
             caps->zmask_ram = PIPE_ZMASK_SIZE;
             break;
 
@@ -424,4 +424,5 @@ void r300_parse_chipset(struct r300_capabilities* caps)
     }
 
     caps->is_rv350 = caps->family >= CHIP_FAMILY_RV350;
+    caps->dxtc_swizzle = caps->is_r400 || caps->is_r500;
 }
index e7ca642b4f3e4876901410018cc7e6bbdd99847f..f2035d2009243733f58548bcf1b153e3d65682c6 100644 (file)
@@ -79,6 +79,10 @@ struct r300_capabilities {
     boolean is_r500;
     /* Whether or not the second pixel pipe is accessed with the high bit */
     boolean high_second_pipe;
+    /* DXTC texture swizzling. */
+    boolean dxtc_swizzle;
+    /* Index bias (AKA index offset). */
+    boolean index_bias_supported;
 };
 
 /* Enumerations for legibility and telling which card we're running on. */
index e8c09b214af4fa8e189bc64e11792f786757515f..91263ad7bcdb1c2c78922e33fd1f586051aa3ab0 100644 (file)
@@ -35,7 +35,9 @@
 #include "r300_screen_buffer.h"
 #include "r300_winsys.h"
 
-#include <inttypes.h>
+#ifdef HAVE_LLVM
+#include "gallivm/lp_bld_init.h"
+#endif
 
 static void r300_update_num_contexts(struct r300_screen *r300screen,
                                      int diff)
@@ -44,14 +46,14 @@ static void r300_update_num_contexts(struct r300_screen *r300screen,
         p_atomic_inc(&r300screen->num_contexts);
 
         if (r300screen->num_contexts > 1)
-            util_mempool_set_thread_safety(&r300screen->pool_buffers,
-                                           UTIL_MEMPOOL_MULTITHREADED);
+            util_slab_set_thread_safety(&r300screen->pool_buffers,
+                                        UTIL_SLAB_MULTITHREADED);
     } else {
         p_atomic_dec(&r300screen->num_contexts);
 
         if (r300screen->num_contexts <= 1)
-            util_mempool_set_thread_safety(&r300screen->pool_buffers,
-                                           UTIL_MEMPOOL_SINGLETHREADED);
+            util_slab_set_thread_safety(&r300screen->pool_buffers,
+                                        UTIL_SLAB_SINGLETHREADED);
     }
 }
 
@@ -88,6 +90,7 @@ static void r300_release_referenced_objects(struct r300_context *r300)
     /* Vertex buffers. */
     for (i = 0; i < r300->vertex_buffer_count; i++) {
         pipe_resource_reference(&r300->vertex_buffer[i].buffer, NULL);
+        pipe_resource_reference(&r300->valid_vertex_buffer[i], NULL);
     }
 
     /* If there are any queries pending or not destroyed, remove them now. */
@@ -100,21 +103,15 @@ static void r300_release_referenced_objects(struct r300_context *r300)
 static void r300_destroy_context(struct pipe_context* context)
 {
     struct r300_context* r300 = r300_context(context);
-    struct r300_atom *atom;
 
     if (r300->blitter)
         util_blitter_destroy(r300->blitter);
-    if (r300->draw)
+    if (r300->draw) {
         draw_destroy(r300->draw);
 
-    /* Print stats, if enabled. */
-    if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) {
-        fprintf(stderr, "r300: Stats for context %p:\n", r300);
-        fprintf(stderr, "    : Flushes: %" PRIu64 "\n", r300->flush_counter);
-        foreach(atom, &r300->atom_list) {
-            fprintf(stderr, "    : %s: %" PRIu64 " emits\n",
-                atom->name, atom->counter);
-        }
+#ifdef HAVE_LLVM
+        gallivm_destroy(r300->gallivm);
+#endif
     }
 
     if (r300->upload_vb)
@@ -135,7 +132,7 @@ static void r300_destroy_context(struct pipe_context* context)
         r300->rws->cs_destroy(r300->cs);
 
     /* XXX: No way to tell if this was initialized or not? */
-    util_mempool_destroy(&r300->pool_transfers);
+    util_slab_destroy(&r300->pool_transfers);
 
     r300_update_num_contexts(r300->screen, -1);
 
@@ -177,10 +174,16 @@ void r300_flush_cb(void *data)
     r300->atomname.size = atomsize; \
     r300->atomname.emit = r300_emit_##atomname; \
     r300->atomname.dirty = FALSE; \
-    insert_at_tail(&r300->atom_list, &r300->atomname); \
  } while (0)
 
-static void r300_setup_atoms(struct r300_context* r300)
+#define R300_ALLOC_ATOM(atomname, statetype) \
+do { \
+    r300->atomname.state = CALLOC_STRUCT(statetype); \
+    if (r300->atomname.state == NULL) \
+        return FALSE; \
+} while (0)
+
+static boolean r300_setup_atoms(struct r300_context* r300)
 {
     boolean is_rv350 = r300->screen->caps.is_rv350;
     boolean is_r500 = r300->screen->caps.is_r500;
@@ -191,9 +194,6 @@ static void r300_setup_atoms(struct r300_context* r300)
     boolean has_hiz_ram = r300->screen->caps.hiz_ram > 0;
 
     /* Create the actual atom list.
-     *
-     * Each atom is examined and emitted in the order it appears here, which
-     * can affect performance and conformance if not handled with care.
      *
      * Some atoms never change size, others change every emit - those have
      * the size of 0 here.
@@ -206,7 +206,6 @@ static void r300_setup_atoms(struct r300_context* r300)
      * - fb_state_pipelined (pipelined regs)
      * The motivation behind this is to be able to emit a strict
      * subset of the regs, and to have reasonable register ordering. */
-    make_empty_list(&r300->atom_list);
     /* SC, GB (unpipelined), RB3D (unpipelined), ZB (unpipelined). */
     R300_INIT_ATOM(gpu_flush, 9);
     R300_INIT_ATOM(aa_state, 4);
@@ -261,23 +260,23 @@ static void r300_setup_atoms(struct r300_context* r300)
     }
 
     /* Some non-CSO atoms need explicit space to store the state locally. */
-    r300->aa_state.state = CALLOC_STRUCT(r300_aa_state);
-    r300->blend_color_state.state = CALLOC_STRUCT(r300_blend_color_state);
-    r300->clip_state.state = CALLOC_STRUCT(r300_clip_state);
-    r300->fb_state.state = CALLOC_STRUCT(pipe_framebuffer_state);
-    r300->gpu_flush.state = CALLOC_STRUCT(pipe_framebuffer_state);
-    r300->hyperz_state.state = CALLOC_STRUCT(r300_hyperz_state);
-    r300->invariant_state.state = CALLOC_STRUCT(r300_invariant_state);
-    r300->rs_block_state.state = CALLOC_STRUCT(r300_rs_block);
-    r300->scissor_state.state = CALLOC_STRUCT(pipe_scissor_state);
-    r300->textures_state.state = CALLOC_STRUCT(r300_textures_state);
-    r300->vap_invariant_state.state = CALLOC_STRUCT(r300_vap_invariant_state);
-    r300->viewport_state.state = CALLOC_STRUCT(r300_viewport_state);
-    r300->ztop_state.state = CALLOC_STRUCT(r300_ztop_state);
-    r300->fs_constants.state = CALLOC_STRUCT(r300_constant_buffer);
-    r300->vs_constants.state = CALLOC_STRUCT(r300_constant_buffer);
+    R300_ALLOC_ATOM(aa_state, r300_aa_state);
+    R300_ALLOC_ATOM(blend_color_state, r300_blend_color_state);
+    R300_ALLOC_ATOM(clip_state, r300_clip_state);
+    R300_ALLOC_ATOM(hyperz_state, r300_hyperz_state);
+    R300_ALLOC_ATOM(invariant_state, r300_invariant_state);
+    R300_ALLOC_ATOM(textures_state, r300_textures_state);
+    R300_ALLOC_ATOM(vap_invariant_state, r300_vap_invariant_state);
+    R300_ALLOC_ATOM(viewport_state, r300_viewport_state);
+    R300_ALLOC_ATOM(ztop_state, r300_ztop_state);
+    R300_ALLOC_ATOM(fb_state, pipe_framebuffer_state);
+    R300_ALLOC_ATOM(gpu_flush, pipe_framebuffer_state);
+    R300_ALLOC_ATOM(scissor_state, pipe_scissor_state);
+    R300_ALLOC_ATOM(rs_block_state, r300_rs_block);
+    R300_ALLOC_ATOM(fs_constants, r300_constant_buffer);
+    R300_ALLOC_ATOM(vs_constants, r300_constant_buffer);
     if (!r300->screen->caps.has_tcl) {
-        r300->vertex_stream_state.state = CALLOC_STRUCT(r300_vertex_stream_state);
+        R300_ALLOC_ATOM(vertex_stream_state, r300_vertex_stream_state);
     }
 
     /* Some non-CSO atoms don't use the state pointer. */
@@ -289,11 +288,13 @@ static void r300_setup_atoms(struct r300_context* r300)
 
     /* Some states must be marked as dirty here to properly set up
      * hardware in the first command stream. */
-    r300->invariant_state.dirty = TRUE;
-    r300->pvs_flush.dirty = TRUE;
-    r300->vap_invariant_state.dirty = TRUE;
-    r300->texture_cache_inval.dirty = TRUE;
-    r300->textures_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->invariant_state);
+    r300_mark_atom_dirty(r300, &r300->pvs_flush);
+    r300_mark_atom_dirty(r300, &r300->vap_invariant_state);
+    r300_mark_atom_dirty(r300, &r300->texture_cache_inval);
+    r300_mark_atom_dirty(r300, &r300->textures_state);
+
+    return TRUE;
 }
 
 /* Not every state tracker calls every driver function before the first draw
@@ -319,7 +320,7 @@ static void r300_init_states(struct pipe_context *pipe)
     pipe->set_scissor_state(pipe, &ss);
 
     /* Initialize the clip state. */
-    if (r300_context(pipe)->screen->caps.has_tcl) {
+    if (r300->screen->caps.has_tcl) {
         pipe->set_clip_state(pipe, &cs);
     } else {
         BEGIN_CB(clip->cb, 2);
@@ -421,9 +422,9 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
     make_empty_list(&r300->query_list);
 
-    util_mempool_create(&r300->pool_transfers,
-                        sizeof(struct pipe_transfer), 64,
-                        UTIL_MEMPOOL_SINGLETHREADED);
+    util_slab_create(&r300->pool_transfers,
+                     sizeof(struct pipe_transfer), 64,
+                     UTIL_SLAB_SINGLETHREADED);
 
     r300->cs = rws->cs_create(rws);
     if (r300->cs == NULL)
@@ -431,7 +432,14 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
     if (!r300screen->caps.has_tcl) {
         /* Create a Draw. This is used for SW TCL. */
+#ifdef HAVE_LLVM
+        r300->gallivm = gallivm_create();
+        r300->draw = draw_create_gallivm(&r300->context, r300->gallivm);
+#else
         r300->draw = draw_create(&r300->context);
+#endif
+        if (r300->draw == NULL)
+            goto fail;
         /* Enable our renderer. */
         draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
         /* Disable converting points/lines to triangles. */
@@ -439,7 +447,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         draw_wide_point_threshold(r300->draw, 10000000.f);
     }
 
-    r300_setup_atoms(r300);
+    if (!r300_setup_atoms(r300))
+        goto fail;
 
     r300_init_blit_functions(r300);
     r300_init_flush_functions(r300);
@@ -462,14 +471,14 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
             goto fail;
 
     r300->upload_ib = u_upload_create(&r300->context,
-                                     32 * 1024, 16,
+                                     64 * 1024, 16,
                                      PIPE_BIND_INDEX_BUFFER);
 
     if (r300->upload_ib == NULL)
         goto fail;
 
     r300->upload_vb = u_upload_create(&r300->context,
-                                     128 * 1024, 16,
+                                     1024 * 1024, 16,
                                      PIPE_BIND_VERTEX_BUFFER);
     if (r300->upload_vb == NULL)
         goto fail;
index 7217c51b9516cf05307a6c99d391de3a69718e38..e09cf87f733eac04572145cfa2f7a6c3f9e68475 100644 (file)
@@ -43,12 +43,8 @@ struct r300_vertex_shader;
 struct r300_stencilref_context;
 
 struct r300_atom {
-    /* List pointers. */
-    struct r300_atom *prev, *next;
     /* Name, for debugging. */
     const char* name;
-    /* Stat counter. */
-    uint64_t counter;
     /* Opaque state. */
     void* state;
     /* Emit the state to the context. */
@@ -258,6 +254,8 @@ struct r300_constant_buffer {
     uint32_t *ptr;
     /* Remapping table. */
     unsigned *remap_table;
+    /* const buffer base */
+    uint32_t buffer_base;
 };
 
 /* Query object.
@@ -282,6 +280,7 @@ struct r300_query {
 
     /* The buffer where query results are stored. */
     struct r300_winsys_buffer *buffer;
+    struct r300_winsys_cs_buffer *cs_buffer;
     /* The size of the buffer. */
     unsigned buffer_size;
     /* The domain of the buffer. */
@@ -313,6 +312,7 @@ struct r300_surface {
 
     /* Winsys buffer backing the texture. */
     struct r300_winsys_buffer *buffer;
+    struct r300_winsys_cs_buffer *cs_buffer;
 
     enum r300_buffer_domain domain;
 
@@ -396,6 +396,7 @@ struct r300_texture {
 
     /* Pipe buffer backing this texture. */
     struct r300_winsys_buffer *buffer;
+    struct r300_winsys_cs_buffer *cs_buffer;
 
     /* Registers carrying texture format data. */
     /* Only format-independent bits should be filled in. */
@@ -439,9 +440,6 @@ struct r300_translate_context {
     /* Translate cache for incompatible vertex offset/stride/format fallback. */
     struct translate_cache *translate_cache;
 
-    /* The vertex buffer slot containing the translated buffer. */
-    unsigned vb_slot;
-
     /* Saved and new vertex element state. */
     void *saved_velems, *new_velems;
 };
@@ -458,6 +456,7 @@ struct r300_context {
     struct r300_screen *screen;
 
     /* Draw module. Used mostly for SW TCL. */
+    struct gallivm_state *gallivm;
     struct draw_context* draw;
     /* Vertex buffer for SW TCL. */
     struct pipe_resource* vbo;
@@ -492,73 +491,79 @@ struct r300_context {
     struct r300_query query_list;
 
     /* Various CSO state objects. */
-    /* Beginning of atom list. */
-    struct r300_atom atom_list;
+
+    /* Each atom is emitted in the order it appears here, which can affect
+     * performance and stability if not handled with care. */
+    /* GPU flush. */
+    struct r300_atom gpu_flush;
     /* Anti-aliasing (MSAA) state. */
     struct r300_atom aa_state;
+    /* Framebuffer state. */
+    struct r300_atom fb_state;
+    /* HyperZ state (various SC/ZB bits). */
+    struct r300_atom hyperz_state;
+    /* ZTOP state. */
+    struct r300_atom ztop_state;
+    /* Depth, stencil, and alpha state. */
+    struct r300_atom dsa_state;
     /* Blend state. */
     struct r300_atom blend_state;
     /* Blend color state. */
     struct r300_atom blend_color_state;
+    /* Scissor state. */
+    struct r300_atom scissor_state;
+    /* Invariant state. This must be emitted to get the engine started. */
+    struct r300_atom invariant_state;
+    /* Viewport state. */
+    struct r300_atom viewport_state;
+    /* PVS flush. */
+    struct r300_atom pvs_flush;
+    /* VAP invariant state. */
+    struct r300_atom vap_invariant_state;
+    /* Vertex stream formatting state. */
+    struct r300_atom vertex_stream_state;
+    /* Vertex shader. */
+    struct r300_atom vs_state;
     /* User clip planes. */
     struct r300_atom clip_state;
-    /* Depth, stencil, and alpha state. */
-    struct r300_atom dsa_state;
+    /* RS block state + VAP (vertex shader) output mapping state. */
+    struct r300_atom rs_block_state;
+    /* Rasterizer state. */
+    struct r300_atom rs_state;
+    /* Framebuffer state (pipelined regs). */
+    struct r300_atom fb_state_pipelined;
     /* Fragment shader. */
     struct r300_atom fs;
     /* Fragment shader RC_CONSTANT_STATE variables. */
     struct r300_atom fs_rc_constant_state;
     /* Fragment shader constant buffer. */
     struct r300_atom fs_constants;
-    /* Framebuffer state. */
-    struct r300_atom fb_state;
-    /* Framebuffer state (pipelined regs). */
-    struct r300_atom fb_state_pipelined;
-    /* HyperZ state (various SC/ZB bits). */
-    struct r300_atom hyperz_state;
-    /* Occlusion query. */
-    struct r300_atom query_start;
-    /* Rasterizer state. */
-    struct r300_atom rs_state;
-    /* RS block state + VAP (vertex shader) output mapping state. */
-    struct r300_atom rs_block_state;
-    /* Scissor state. */
-    struct r300_atom scissor_state;
-    /* Textures state. */
-    struct r300_atom textures_state;
-    /* Vertex stream formatting state. */
-    struct r300_atom vertex_stream_state;
-    /* Vertex shader. */
-    struct r300_atom vs_state;
     /* Vertex shader constant buffer. */
     struct r300_atom vs_constants;
-    /* Viewport state. */
-    struct r300_atom viewport_state;
-    /* ZTOP state. */
-    struct r300_atom ztop_state;
-    /* PVS flush. */
-    struct r300_atom pvs_flush;
-    /* VAP invariant state. */
-    struct r300_atom vap_invariant_state;
     /* Texture cache invalidate. */
     struct r300_atom texture_cache_inval;
-    /* GPU flush. */
-    struct r300_atom gpu_flush;
+    /* Textures state. */
+    struct r300_atom textures_state;
     /* HiZ clear */
     struct r300_atom hiz_clear;
     /* zmask clear */
     struct r300_atom zmask_clear;
+    /* Occlusion query. */
+    struct r300_atom query_start;
 
-    /* Invariant state. This must be emitted to get the engine started. */
-    struct r300_atom invariant_state;
+    /* The pointers to the first and the last atom. */
+    struct r300_atom *first_dirty, *last_dirty;
 
     /* Vertex buffers for Gallium. */
+    /* May contain user buffers. */
     struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+    /* Contains only non-user buffers. */
+    struct pipe_resource *valid_vertex_buffer[PIPE_MAX_ATTRIBS];
     int vertex_buffer_count;
     int vertex_buffer_max_index;
+    boolean any_user_vbs;
     /* Vertex elements for Gallium. */
     struct r300_vertex_element_state *velems;
-    bool any_user_vbs;
 
     struct pipe_index_buffer index_buffer;
 
@@ -599,12 +604,32 @@ struct r300_context {
     struct u_upload_mgr *upload_vb;
     struct u_upload_mgr *upload_ib;
 
-    struct util_mempool pool_transfers;
+    struct util_slab_mempool pool_transfers;
 
     /* Stat counter. */
     uint64_t flush_counter;
+
+    /* const tracking for VS */
+    int vs_const_base;
+
+    /* AOS (PACKET3_3D_LOAD_VBPNTR) command buffer for the case offset=0. */
+    uint32_t vertex_arrays_cb[(16 * 3 + 1) / 2];
+    boolean vertex_arrays_dirty;
+
+    /* Whether any buffer (FB, textures, VBOs) has been set, but buffers
+     * haven't been validated yet. */
+    boolean validate_buffers;
+    /* Whether user buffers have been validated. */
+    boolean upload_vb_validated;
+    boolean upload_ib_validated;
 };
 
+#define foreach_atom(r300, atom) \
+    for (atom = &r300->gpu_flush; atom != (&r300->query_start)+1; atom++)
+
+#define foreach_dirty_atom(r300, atom) \
+    for (atom = r300->first_dirty; atom != r300->last_dirty; atom++)
+
 /* Convenience cast wrappers. */
 static INLINE struct r300_query* r300_query(struct pipe_query* q)
 {
@@ -631,6 +656,22 @@ static INLINE struct r300_fragment_shader *r300_fs(struct r300_context *r300)
     return (struct r300_fragment_shader*)r300->fs.state;
 }
 
+static INLINE void r300_mark_atom_dirty(struct r300_context *r300,
+                                        struct r300_atom *atom)
+{
+    atom->dirty = TRUE;
+
+    if (!r300->first_dirty) {
+        r300->first_dirty = atom;
+        r300->last_dirty = atom+1;
+    } else {
+        if (atom < r300->first_dirty)
+            r300->first_dirty = atom;
+        else if (atom+1 > r300->last_dirty)
+            r300->last_dirty = atom+1;
+    }
+}
+
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
                                          void *priv);
 
@@ -647,10 +688,7 @@ void r300_init_state_functions(struct r300_context* r300);
 void r300_init_resource_functions(struct r300_context* r300);
 
 /* r300_blit.c */
-void r300_flush_depth_stencil(struct pipe_context *pipe,
-                              struct pipe_resource *dst,
-                              struct pipe_subresource subdst,
-                              unsigned zslice);
+void r300_flush_depth_textures(struct r300_context *r300);
 
 /* r300_query.c */
 void r300_resume_query(struct r300_context *r300,
@@ -658,7 +696,8 @@ void r300_resume_query(struct r300_context *r300,
 void r300_stop_query(struct r300_context *r300);
 
 /* r300_render_translate.c */
-void r300_begin_vertex_translate(struct r300_context *r300);
+void r300_begin_vertex_translate(struct r300_context *r300,
+                                 int min_index, int max_index);
 void r300_end_vertex_translate(struct r300_context *r300);
 void r300_translate_index_buffer(struct r300_context *r300,
                                  struct pipe_resource **index_buffer,
@@ -670,20 +709,23 @@ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300);
 
 /* r300_render.c */
 void r300_draw_flush_vbuf(struct r300_context *r300);
-boolean r500_index_bias_supported(struct r300_context *r300);
 void r500_emit_index_bias(struct r300_context *r300, int index_bias);
 
 /* r300_state.c */
 enum r300_fb_state_change {
     R300_CHANGED_FB_STATE = 0,
     R300_CHANGED_CBZB_FLAG,
-    R300_CHANGED_ZCLEAR_FLAG
+    R300_CHANGED_ZCLEAR_FLAG,
+    R300_CHANGED_MULTIWRITE
 };
 
 void r300_mark_fb_state_dirty(struct r300_context *r300,
                               enum r300_fb_state_change change);
 void r300_mark_fs_code_dirty(struct r300_context *r300);
 
+/* r300_state_derived.c */
+void r300_update_derived_state(struct r300_context* r300);
+
 /* r300_debug.c */
 void r500_dump_rs_block(struct r300_rs_block *rs);
 
index c194d6a1b08c3ebff2c61b5e8d78efe58f2f7c8d..6726f100e1b9ae562123e78582d29b487d60f047 100644 (file)
@@ -51,7 +51,7 @@
     int cs_count = 0; (void) cs_count; (void) cs_winsys;
 
 #define BEGIN_CS(size) do { \
-    assert(size <= (cs_copy->ndw - cs_copy->cdw)); \
+    assert(size <= (R300_MAX_CMDBUF_DWORDS - cs_copy->cdw)); \
     CS_DEBUG(cs_count = size;) \
 } while (0)
 
@@ -72,7 +72,7 @@
  */
 
 #define OUT_CS(value) do { \
-    cs_copy->ptr[cs_copy->cdw++] = (value); \
+    cs_copy->buf[cs_copy->cdw++] = (value); \
     CS_DEBUG(cs_count--;) \
 } while (0)
 
@@ -96,7 +96,7 @@
     OUT_CS(CP_PACKET3(op, count))
 
 #define OUT_CS_TABLE(values, count) do { \
-    memcpy(cs_copy->ptr + cs_copy->cdw, values, count * 4); \
+    memcpy(cs_copy->buf + cs_copy->cdw, values, count * 4); \
     cs_copy->cdw += count; \
     CS_DEBUG(cs_count -= count;) \
 } while (0)
  * Writing relocations.
  */
 
-#define OUT_CS_RELOC(bo, offset, rd, wd) do { \
+#define OUT_CS_RELOC(bo, offset) do { \
     assert(bo); \
     OUT_CS(offset); \
-    cs_winsys->cs_write_reloc(cs_copy, bo, rd, wd); \
+    cs_winsys->cs_write_reloc(cs_copy, bo); \
     CS_DEBUG(cs_count -= 2;) \
 } while (0)
 
-#define OUT_CS_BUF_RELOC(bo, offset, rd, wd) do { \
+#define OUT_CS_BUF_RELOC(bo, offset) do { \
     assert(bo); \
-    OUT_CS_RELOC(r300_buffer(bo)->buf, offset, rd, wd); \
+    OUT_CS_RELOC(r300_buffer(bo)->cs_buf, offset); \
 } while (0)
 
-#define OUT_CS_TEX_RELOC(tex, offset, rd, wd) do { \
+#define OUT_CS_TEX_RELOC(tex, offset) do { \
     assert(tex); \
-    OUT_CS_RELOC(tex->buffer, offset, rd, wd); \
+    OUT_CS_RELOC(tex->cs_buffer, offset); \
 } while (0)
 
-#define OUT_CS_BUF_RELOC_NO_OFFSET(bo, rd, wd) do { \
+#define OUT_CS_BUF_RELOC_NO_OFFSET(bo) do { \
     assert(bo); \
-    cs_winsys->cs_write_reloc(cs_copy, r300_buffer(bo)->buf, rd, wd); \
+    cs_winsys->cs_write_reloc(cs_copy, r300_buffer(bo)->cs_buf); \
     CS_DEBUG(cs_count -= 2;) \
 } while (0)
 
 
 #define WRITE_CS_TABLE(values, count) do { \
     CS_DEBUG(assert(cs_count == 0);) \
-    memcpy(cs_copy->ptr + cs_copy->cdw, (values), (count) * 4); \
+    memcpy(cs_copy->buf + cs_copy->cdw, (values), (count) * 4); \
     cs_copy->cdw += (count); \
 } while (0)
 
index f78fe34790c47847fd69bdca08c621fb3beb7bb1..d6aa90bd0530d38190806acff463694732e174fa 100644 (file)
@@ -40,8 +40,8 @@ static const struct debug_named_value debug_options[] = {
     { "rs", DBG_RS, "Log rasterizer" },
     { "fb", DBG_FB, "Log framebuffer" },
     { "cbzb", DBG_CBZB, "Log fast color clear info" },
-    { "stats", DBG_STATS, "Log emission statistics" },
     { "hyperz", DBG_HYPERZ, "Log HyperZ info" },
+    { "upload", DBG_UPLOAD, "Log user buffer upload info" },
     { "scissor", DBG_SCISSOR, "Log scissor info" },
     { "fakeocc", DBG_FAKE_OCC, "Use fake occlusion queries" },
     { "anisohq", DBG_ANISOHQ, "Use high quality anisotropic filtering" },
index 896aeef395d7544c0b443d531958fe24e5aa7aa6..2d111f9158d0db9dec79eaf928ea22c10a1274cd 100644 (file)
@@ -43,8 +43,8 @@ enum r300_buffer_tiling {
 };
 
 enum r300_buffer_domain { /* bitfield */
-    R300_DOMAIN_GTT  = 1,
-    R300_DOMAIN_VRAM = 2
+    R300_DOMAIN_GTT  = 2,
+    R300_DOMAIN_VRAM = 4
 };
 
 #endif
index 5b6f82cd8910792324cbcbbaaf75a70be5571d0f..d14cdcbbaf0629a9a59411e5191a31ec1efaedd5 100644 (file)
@@ -26,9 +26,9 @@
 #include "util/u_format.h"
 #include "util/u_math.h"
 #include "util/u_mm.h"
-#include "util/u_simple_list.h"
 
 #include "r300_context.h"
+#include "r300_cb.h"
 #include "r300_cs.h"
 #include "r300_emit.h"
 #include "r300_fs.h"
@@ -353,10 +353,10 @@ void r300_emit_aa_state(struct r300_context *r300, unsigned size, void *state)
 
     if (aa->dest) {
         OUT_CS_REG_SEQ(R300_RB3D_AARESOLVE_OFFSET, 1);
-        OUT_CS_RELOC(aa->dest->buffer, aa->dest->offset, 0, aa->dest->domain);
+        OUT_CS_RELOC(aa->dest->cs_buffer, aa->dest->offset);
 
         OUT_CS_REG_SEQ(R300_RB3D_AARESOLVE_PITCH, 1);
-        OUT_CS_RELOC(aa->dest->buffer, aa->dest->pitch, 0, aa->dest->domain);
+        OUT_CS_RELOC(aa->dest->cs_buffer, aa->dest->pitch);
     }
 
     OUT_CS_REG(R300_RB3D_AARESOLVE_CTL, aa->aaresolve_ctl);
@@ -369,6 +369,8 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
     struct r300_surface* surf;
     unsigned i;
     boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
+    uint32_t rb3d_cctl = 0;
+
     CS_LOCALS(r300);
 
     BEGIN_CS(size);
@@ -376,21 +378,24 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
     /* NUM_MULTIWRITES replicates COLOR[0] to all colorbuffers, which is not
      * what we usually want. */
     if (r300->screen->caps.is_r500) {
-        OUT_CS_REG(R300_RB3D_CCTL,
-            R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE);
-    } else {
-        OUT_CS_REG(R300_RB3D_CCTL, 0);
+        rb3d_cctl = R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE;
+    }
+    if (fb->nr_cbufs &&
+        r300_fragment_shader_writes_all(r300_fs(r300))) {
+        rb3d_cctl |= R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs);
     }
 
+    OUT_CS_REG(R300_RB3D_CCTL, rb3d_cctl);
+
     /* Set up colorbuffers. */
     for (i = 0; i < fb->nr_cbufs; i++) {
         surf = r300_surface(fb->cbufs[i]);
 
         OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
-        OUT_CS_RELOC(surf->buffer, surf->offset, 0, surf->domain);
+        OUT_CS_RELOC(surf->cs_buffer, surf->offset);
 
         OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0 + (4 * i), 1);
-        OUT_CS_RELOC(surf->buffer, surf->pitch, 0, surf->domain);
+        OUT_CS_RELOC(surf->cs_buffer, surf->pitch);
     }
 
     /* Set up the ZB part of the CBZB clear. */
@@ -400,10 +405,10 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
         OUT_CS_REG(R300_ZB_FORMAT, surf->cbzb_format);
 
         OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
-        OUT_CS_RELOC(surf->buffer, surf->cbzb_midpoint_offset, 0, surf->domain);
+        OUT_CS_RELOC(surf->cs_buffer, surf->cbzb_midpoint_offset);
 
         OUT_CS_REG_SEQ(R300_ZB_DEPTHPITCH, 1);
-        OUT_CS_RELOC(surf->buffer, surf->cbzb_pitch, 0, surf->domain);
+        OUT_CS_RELOC(surf->cs_buffer, surf->cbzb_pitch);
 
         DBG(r300, DBG_CBZB,
             "CBZB clearing cbuf %08x %08x\n", surf->cbzb_format,
@@ -416,15 +421,15 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
         OUT_CS_REG(R300_ZB_FORMAT, surf->format);
 
         OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
-        OUT_CS_RELOC(surf->buffer, surf->offset, 0, surf->domain);
+        OUT_CS_RELOC(surf->cs_buffer, surf->offset);
 
         OUT_CS_REG_SEQ(R300_ZB_DEPTHPITCH, 1);
-        OUT_CS_RELOC(surf->buffer, surf->pitch, 0, surf->domain);
+        OUT_CS_RELOC(surf->cs_buffer, surf->pitch);
 
         if (can_hyperz) {
             uint32_t surf_pitch;
             struct r300_texture *tex;
-            int level = surf->base.level;
+            int level = surf->base.u.tex.level;
             tex = r300_texture(surf->base.texture);
 
             surf_pitch = surf->pitch & R300_DEPTHPITCH_MASK;
@@ -482,15 +487,21 @@ void r300_emit_fb_state_pipelined(struct r300_context *r300,
 {
     struct pipe_framebuffer_state* fb =
             (struct pipe_framebuffer_state*)r300->fb_state.state;
-    unsigned i;
+    unsigned i, num_cbufs = fb->nr_cbufs;
     CS_LOCALS(r300);
 
+    /* If we use the multiwrite feature, the colorbuffers 2,3,4 must be
+     * marked as UNUSED in the US block. */
+    if (r300_fragment_shader_writes_all(r300_fs(r300))) {
+        num_cbufs = MIN2(num_cbufs, 1);
+    }
+
     BEGIN_CS(size);
 
     /* Colorbuffer format in the US block.
      * (must be written after unpipelined regs) */
     OUT_CS_REG_SEQ(R300_US_OUT_FMT_0, 4);
-    for (i = 0; i < fb->nr_cbufs; i++) {
+    for (i = 0; i < num_cbufs; i++) {
         OUT_CS(r300_surface(fb->cbufs[i])->format);
     }
     for (; i < 4; i++) {
@@ -559,7 +570,7 @@ static void r300_emit_query_end_frag_pipes(struct r300_context *r300,
                                            struct r300_query *query)
 {
     struct r300_capabilities* caps = &r300->screen->caps;
-    struct r300_winsys_buffer *buf = r300->query_current->buffer;
+    struct r300_winsys_cs_buffer *buf = r300->query_current->cs_buffer;
     CS_LOCALS(r300);
 
     assert(caps->num_frag_pipes);
@@ -578,28 +589,24 @@ static void r300_emit_query_end_frag_pipes(struct r300_context *r300,
             /* pipe 3 only */
             OUT_CS_REG(R300_SU_REG_DEST, 1 << 3);
             OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
-            OUT_CS_RELOC(buf, (query->num_results + 3) * 4,
-                    0, query->domain);
+            OUT_CS_RELOC(buf, (query->num_results + 3) * 4);
         case 3:
             /* pipe 2 only */
             OUT_CS_REG(R300_SU_REG_DEST, 1 << 2);
             OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
-            OUT_CS_RELOC(buf, (query->num_results + 2) * 4,
-                    0, query->domain);
+            OUT_CS_RELOC(buf, (query->num_results + 2) * 4);
         case 2:
             /* pipe 1 only */
             /* As mentioned above, accomodate RV380 and older. */
             OUT_CS_REG(R300_SU_REG_DEST,
                     1 << (caps->high_second_pipe ? 3 : 1));
             OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
-            OUT_CS_RELOC(buf, (query->num_results + 1) * 4,
-                    0, query->domain);
+            OUT_CS_RELOC(buf, (query->num_results + 1) * 4);
         case 1:
             /* pipe 0 only */
             OUT_CS_REG(R300_SU_REG_DEST, 1 << 0);
             OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
-            OUT_CS_RELOC(buf, (query->num_results + 0) * 4,
-                    0, query->domain);
+            OUT_CS_RELOC(buf, (query->num_results + 0) * 4);
             break;
         default:
             fprintf(stderr, "r300: Implementation error: Chipset reports %d"
@@ -615,13 +622,13 @@ static void r300_emit_query_end_frag_pipes(struct r300_context *r300,
 static void rv530_emit_query_end_single_z(struct r300_context *r300,
                                           struct r300_query *query)
 {
-    struct r300_winsys_buffer *buf = r300->query_current->buffer;
+    struct r300_winsys_cs_buffer *buf = r300->query_current->cs_buffer;
     CS_LOCALS(r300);
 
     BEGIN_CS(8);
     OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
     OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
-    OUT_CS_RELOC(buf, query->num_results * 4, 0, query->domain);
+    OUT_CS_RELOC(buf, query->num_results * 4);
     OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
     END_CS;
 }
@@ -629,16 +636,16 @@ static void rv530_emit_query_end_single_z(struct r300_context *r300,
 static void rv530_emit_query_end_double_z(struct r300_context *r300,
                                           struct r300_query *query)
 {
-    struct r300_winsys_buffer *buf = r300->query_current->buffer;
+    struct r300_winsys_cs_buffer *buf = r300->query_current->cs_buffer;
     CS_LOCALS(r300);
 
     BEGIN_CS(14);
     OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
     OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
-    OUT_CS_RELOC(buf, (query->num_results + 0) * 4, 0, query->domain);
+    OUT_CS_RELOC(buf, (query->num_results + 0) * 4);
     OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_1);
     OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
-    OUT_CS_RELOC(buf, (query->num_results + 1) * 4, 0, query->domain);
+    OUT_CS_RELOC(buf, (query->num_results + 1) * 4);
     OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
     END_CS;
 }
@@ -799,56 +806,100 @@ void r300_emit_textures_state(struct r300_context *r300,
             OUT_CS_REG(R300_TX_FORMAT2_0 + (i * 4), texstate->format.format2);
 
             OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (i * 4), 1);
-            OUT_CS_TEX_RELOC(tex, texstate->format.tile_config, tex->domain,
-                             0);
+            OUT_CS_TEX_RELOC(tex, texstate->format.tile_config);
         }
     }
     END_CS;
 }
 
-void r300_emit_aos(struct r300_context* r300, int offset, boolean indexed)
+static void r300_update_vertex_arrays_cb(struct r300_context *r300, unsigned packet_size)
 {
     struct pipe_vertex_buffer *vb1, *vb2, *vbuf = r300->vertex_buffer;
     struct pipe_vertex_element *velem = r300->velems->velem;
-    struct r300_buffer *buf;
-    int i;
     unsigned *hw_format_size = r300->velems->hw_format_size;
-    unsigned size1, size2, aos_count = r300->velems->count;
-    unsigned packet_size = (aos_count * 3 + 1) / 2;
-    CS_LOCALS(r300);
-
-    BEGIN_CS(2 + packet_size + aos_count * 2);
-    OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size);
-    OUT_CS(aos_count | (!indexed ? R300_VC_FORCE_PREFETCH : 0));
+    unsigned size1, size2, vertex_array_count = r300->velems->count;
+    int i;
+    CB_LOCALS;
 
-    for (i = 0; i < aos_count - 1; i += 2) {
+    BEGIN_CB(r300->vertex_arrays_cb, packet_size);
+    for (i = 0; i < vertex_array_count - 1; i += 2) {
         vb1 = &vbuf[velem[i].vertex_buffer_index];
         vb2 = &vbuf[velem[i+1].vertex_buffer_index];
         size1 = hw_format_size[i];
         size2 = hw_format_size[i+1];
 
-        OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) |
+        OUT_CB(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) |
                R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(vb2->stride));
-        OUT_CS(vb1->buffer_offset + velem[i].src_offset   + offset * vb1->stride);
-        OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride);
+        OUT_CB(vb1->buffer_offset + velem[i].src_offset);
+        OUT_CB(vb2->buffer_offset + velem[i+1].src_offset);
     }
 
-    if (aos_count & 1) {
+    if (vertex_array_count & 1) {
         vb1 = &vbuf[velem[i].vertex_buffer_index];
         size1 = hw_format_size[i];
 
-        OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride));
-        OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride);
+        OUT_CB(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride));
+        OUT_CB(vb1->buffer_offset + velem[i].src_offset);
     }
+    END_CB;
+
+    r300->vertex_arrays_dirty = FALSE;
+}
+
+void r300_emit_vertex_arrays(struct r300_context* r300, int offset, boolean indexed)
+{
+    struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
+    struct pipe_resource **valid_vbuf = r300->valid_vertex_buffer;
+    struct pipe_vertex_element *velem = r300->velems->velem;
+    struct r300_buffer *buf;
+    int i;
+    unsigned vertex_array_count = r300->velems->count;
+    unsigned packet_size = (vertex_array_count * 3 + 1) / 2;
+    CS_LOCALS(r300);
 
-    for (i = 0; i < aos_count; i++) {
-        buf = r300_buffer(vbuf[velem[i].vertex_buffer_index].buffer);
-        OUT_CS_BUF_RELOC_NO_OFFSET(&buf->b.b, buf->domain, 0);
+    BEGIN_CS(2 + packet_size + vertex_array_count * 2);
+    OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size);
+    OUT_CS(vertex_array_count | (!indexed ? R300_VC_FORCE_PREFETCH : 0));
+
+    if (!offset) {
+        if (r300->vertex_arrays_dirty) {
+            r300_update_vertex_arrays_cb(r300, packet_size);
+        }
+        OUT_CS_TABLE(r300->vertex_arrays_cb, packet_size);
+    } else {
+        struct pipe_vertex_buffer *vb1, *vb2;
+        unsigned *hw_format_size = r300->velems->hw_format_size;
+        unsigned size1, size2;
+
+        for (i = 0; i < vertex_array_count - 1; i += 2) {
+            vb1 = &vbuf[velem[i].vertex_buffer_index];
+            vb2 = &vbuf[velem[i+1].vertex_buffer_index];
+            size1 = hw_format_size[i];
+            size2 = hw_format_size[i+1];
+
+            OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) |
+                   R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(vb2->stride));
+            OUT_CS(vb1->buffer_offset + velem[i].src_offset   + offset * vb1->stride);
+            OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride);
+        }
+
+        if (vertex_array_count & 1) {
+            vb1 = &vbuf[velem[i].vertex_buffer_index];
+            size1 = hw_format_size[i];
+
+            OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride));
+            OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride);
+        }
+    }
+
+    for (i = 0; i < vertex_array_count; i++) {
+        buf = r300_buffer(valid_vbuf[velem[i].vertex_buffer_index]);
+        OUT_CS_BUF_RELOC_NO_OFFSET(&buf->b.b);
     }
     END_CS;
 }
 
-void r300_emit_aos_swtcl(struct r300_context *r300, boolean indexed)
+void r300_emit_vertex_arrays_swtcl(struct r300_context *r300, boolean indexed)
 {
     CS_LOCALS(r300);
 
@@ -868,7 +919,7 @@ void r300_emit_aos_swtcl(struct r300_context *r300, boolean indexed)
     OUT_CS(r300->vertex_info.size |
             (r300->vertex_info.size << 8));
     OUT_CS(r300->draw_vbo_offset);
-    OUT_CS_BUF_RELOC(r300->vbo, 0, r300_buffer(r300->vbo)->domain, 0);
+    OUT_CS_BUF_RELOC(r300->vbo, 0);
     END_CS;
 }
 
@@ -924,7 +975,6 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
     struct r300_vertex_program_code* code = &vs->code;
     struct r300_screen* r300screen = r300->screen;
     unsigned instruction_count = code->length / 4;
-    unsigned i;
 
     unsigned vtx_mem_size = r300screen->caps.is_r500 ? 128 : 72;
     unsigned input_count = MAX2(util_bitcount(code->InputsRead), 1);
@@ -935,10 +985,6 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
                                   vtx_mem_size / output_count, 10);
     unsigned pvs_num_controllers = MIN2(vtx_mem_size / temp_count, 5);
 
-    unsigned imm_first = vs->externals_count;
-    unsigned imm_end = vs->code.constants.Count;
-    unsigned imm_count = vs->immediates_count;
-
     CS_LOCALS(r300);
 
     BEGIN_CS(size);
@@ -947,12 +993,10 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
      * R300_VAP_PVS_CONST_CNTL
      * R300_VAP_PVS_CODE_CNTL_1
      * See the r5xx docs for instructions on how to use these. */
-    OUT_CS_REG_SEQ(R300_VAP_PVS_CODE_CNTL_0, 3);
-    OUT_CS(R300_PVS_FIRST_INST(0) |
-            R300_PVS_XYZW_VALID_INST(instruction_count - 1) |
-            R300_PVS_LAST_INST(instruction_count - 1));
-    OUT_CS(R300_PVS_MAX_CONST_ADDR(code->constants.Count - 1));
-    OUT_CS(instruction_count - 1);
+    OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) |
+              R300_PVS_XYZW_VALID_INST(instruction_count - 1) |
+              R300_PVS_LAST_INST(instruction_count - 1));
+    OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, instruction_count - 1);
 
     OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0);
     OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, code->length);
@@ -964,19 +1008,6 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
             R300_PVS_VF_MAX_VTX_NUM(12) |
             (r300screen->caps.is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0));
 
-    /* Emit immediates. */
-    if (imm_count) {
-        OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
-                   (r300->screen->caps.is_r500 ?
-                   R500_PVS_CONST_START : R300_PVS_CONST_START) +
-                   imm_first);
-        OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, imm_count * 4);
-        for (i = imm_first; i < imm_end; i++) {
-            const float *data = vs->code.constants.Constants[i].u.Immediate;
-            OUT_CS_TABLE(data, 4);
-        }
-    }
-
     /* Emit flow control instructions. */
     if (code->num_fc_ops) {
 
@@ -1001,24 +1032,43 @@ void r300_emit_vs_constants(struct r300_context* r300,
     unsigned count =
         ((struct r300_vertex_shader*)r300->vs_state.state)->externals_count;
     struct r300_constant_buffer *buf = (struct r300_constant_buffer*)state;
+    struct r300_vertex_shader *vs = (struct r300_vertex_shader*)r300->vs_state.state;
     unsigned i;
+    int imm_first = vs->externals_count;
+    int imm_end = vs->code.constants.Count;
+    int imm_count = vs->immediates_count;
     CS_LOCALS(r300);
 
-    if (!count)
-        return;
-
     BEGIN_CS(size);
-    OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
-               (r300->screen->caps.is_r500 ?
-               R500_PVS_CONST_START : R300_PVS_CONST_START));
-    OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, count * 4);
-    if (buf->remap_table){
-        for (i = 0; i < count; i++) {
-            uint32_t *data = &buf->ptr[buf->remap_table[i]*4];
+    OUT_CS_REG(R300_VAP_PVS_CONST_CNTL,
+               R300_PVS_CONST_BASE_OFFSET(buf->buffer_base) |
+               R300_PVS_MAX_CONST_ADDR(MAX2(imm_end - 1, 0)));
+    if (vs->externals_count) {
+        OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
+                   (r300->screen->caps.is_r500 ?
+                   R500_PVS_CONST_START : R300_PVS_CONST_START) + buf->buffer_base);
+        OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, count * 4);
+        if (buf->remap_table){
+            for (i = 0; i < count; i++) {
+                uint32_t *data = &buf->ptr[buf->remap_table[i]*4];
+                OUT_CS_TABLE(data, 4);
+            }
+        } else {
+            OUT_CS_TABLE(buf->ptr, count * 4);
+        }
+    }
+
+    /* Emit immediates. */
+    if (imm_count) {
+        OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
+                   (r300->screen->caps.is_r500 ?
+                   R500_PVS_CONST_START : R300_PVS_CONST_START) +
+                   buf->buffer_base + imm_first);
+        OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, imm_count * 4);
+        for (i = imm_first; i < imm_end; i++) {
+            const float *data = vs->code.constants.Constants[i].u.Immediate;
             OUT_CS_TABLE(data, 4);
         }
-    } else {
-        OUT_CS_TABLE(buf->ptr, count * 4);
     }
     END_CS;
 }
@@ -1073,8 +1123,8 @@ void r300_emit_hiz_clear(struct r300_context *r300, unsigned size, void *state)
 
     tex = r300_texture(fb->zsbuf->texture);
 
-    offset = tex->hiz_mem[fb->zsbuf->level]->ofs;
-    stride = tex->desc.stride_in_pixels[fb->zsbuf->level];
+    offset = tex->hiz_mem[fb->zsbuf->u.tex.level]->ofs;
+    stride = tex->desc.stride_in_pixels[fb->zsbuf->u.tex.level];
 
     /* convert from pixels to 4x4 blocks */
     stride = ALIGN_DIVUP(stride, 4);
@@ -1096,7 +1146,7 @@ void r300_emit_hiz_clear(struct r300_context *r300, unsigned size, void *state)
     z->current_func = -1;
 
     /* Mark the current zbuffer's hiz ram as in use. */
-    tex->hiz_in_use[fb->zsbuf->level] = TRUE;
+    tex->hiz_in_use[fb->zsbuf->u.tex.level] = TRUE;
 }
 
 void r300_emit_zmask_clear(struct r300_context *r300, unsigned size, void *state)
@@ -1110,9 +1160,9 @@ void r300_emit_zmask_clear(struct r300_context *r300, unsigned size, void *state
     int mult, offset_shift;
 
     tex = r300_texture(fb->zsbuf->texture);
-    stride = tex->desc.stride_in_pixels[fb->zsbuf->level];
+    stride = tex->desc.stride_in_pixels[fb->zsbuf->u.tex.level];
 
-    offset = tex->zmask_mem[fb->zsbuf->level]->ofs;
+    offset = tex->zmask_mem[fb->zsbuf->u.tex.level]->ofs;
 
     if (r300->z_compression == RV350_Z_COMPRESS_88)
         mult = 8;
@@ -1138,7 +1188,7 @@ void r300_emit_zmask_clear(struct r300_context *r300, unsigned size, void *state
     }
 
     /* Mark the current zbuffer's zmask as in use. */
-    tex->zmask_in_use[fb->zsbuf->level] = TRUE;
+    tex->zmask_in_use[fb->zsbuf->u.tex.level] = TRUE;
 }
 
 void r300_emit_ztop_state(struct r300_context* r300,
@@ -1165,72 +1215,77 @@ boolean r300_emit_buffer_validate(struct r300_context *r300,
                                   boolean do_validate_vertex_buffers,
                                   struct pipe_resource *index_buffer)
 {
-    struct pipe_framebuffer_statefb =
+    struct pipe_framebuffer_state *fb =
         (struct pipe_framebuffer_state*)r300->fb_state.state;
     struct r300_textures_state *texstate =
         (struct r300_textures_state*)r300->textures_state.state;
-    struct r300_texture* tex;
-    struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
-    struct pipe_vertex_element *velem = r300->velems->velem;
-    struct pipe_resource *pbuf;
+    struct r300_texture *tex;
     unsigned i;
-
-    /* upload buffers first */
-    if (r300->screen->caps.has_tcl && r300->any_user_vbs) {
-        r300_upload_user_buffers(r300);
-        r300->any_user_vbs = false;
+    boolean flushed = FALSE;
+
+validate:
+    if (r300->fb_state.dirty) {
+        /* Color buffers... */
+        for (i = 0; i < fb->nr_cbufs; i++) {
+            tex = r300_texture(fb->cbufs[i]->texture);
+            assert(tex && tex->buffer && "cbuf is marked, but NULL!");
+            r300->rws->cs_add_reloc(r300->cs, tex->cs_buffer, 0,
+                                    r300_surface(fb->cbufs[i])->domain);
+        }
+        /* ...depth buffer... */
+        if (fb->zsbuf) {
+            tex = r300_texture(fb->zsbuf->texture);
+            assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
+            r300->rws->cs_add_reloc(r300->cs, tex->cs_buffer, 0,
+                                    r300_surface(fb->zsbuf)->domain);
+        }
     }
+    if (r300->textures_state.dirty) {
+        /* ...textures... */
+        for (i = 0; i < texstate->count; i++) {
+            if (!(texstate->tx_enable & (1 << i))) {
+                continue;
+            }
 
-    /* Clean out BOs. */
-    r300->rws->cs_reset_buffers(r300->cs);
-
-    /* Color buffers... */
-    for (i = 0; i < fb->nr_cbufs; i++) {
-        tex = r300_texture(fb->cbufs[i]->texture);
-        assert(tex && tex->buffer && "cbuf is marked, but NULL!");
-        r300->rws->cs_add_buffer(r300->cs, tex->buffer, 0,
-                                 r300_surface(fb->cbufs[i])->domain);
-    }
-    /* ...depth buffer... */
-    if (fb->zsbuf) {
-        tex = r300_texture(fb->zsbuf->texture);
-        assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
-        r300->rws->cs_add_buffer(r300->cs, tex->buffer, 0,
-                                 r300_surface(fb->zsbuf)->domain);
-    }
-    /* ...textures... */
-    for (i = 0; i < texstate->count; i++) {
-        if (!(texstate->tx_enable & (1 << i))) {
-            continue;
+            tex = r300_texture(texstate->sampler_views[i]->base.texture);
+            r300->rws->cs_add_reloc(r300->cs, tex->cs_buffer, tex->domain, 0);
         }
-
-        tex = r300_texture(texstate->sampler_views[i]->base.texture);
-        r300->rws->cs_add_buffer(r300->cs, tex->buffer, tex->domain, 0);
     }
     /* ...occlusion query buffer... */
     if (r300->query_current)
-        r300->rws->cs_add_buffer(r300->cs, r300->query_current->buffer,
-                                 0, r300->query_current->domain);
+        r300->rws->cs_add_reloc(r300->cs, r300->query_current->cs_buffer,
+                                0, r300->query_current->domain);
     /* ...vertex buffer for SWTCL path... */
     if (r300->vbo)
-        r300->rws->cs_add_buffer(r300->cs, r300_buffer(r300->vbo)->buf,
-                                 r300_buffer(r300->vbo)->domain, 0);
+        r300->rws->cs_add_reloc(r300->cs, r300_buffer(r300->vbo)->cs_buf,
+                                r300_buffer(r300->vbo)->domain, 0);
     /* ...vertex buffers for HWTCL path... */
     if (do_validate_vertex_buffers) {
-        for (i = 0; i < r300->velems->count; i++) {
-            pbuf = vbuf[velem[i].vertex_buffer_index].buffer;
-
-            r300->rws->cs_add_buffer(r300->cs, r300_buffer(pbuf)->buf,
-                                     r300_buffer(pbuf)->domain, 0);
+        struct pipe_resource **buf = r300->valid_vertex_buffer;
+        struct pipe_resource **last = r300->valid_vertex_buffer +
+                                      r300->vertex_buffer_count;
+        for (; buf != last; buf++) {
+            if (!*buf)
+                continue;
+
+            r300->rws->cs_add_reloc(r300->cs, r300_buffer(*buf)->cs_buf,
+                                    r300_buffer(*buf)->domain, 0);
         }
     }
     /* ...and index buffer for HWTCL path. */
     if (index_buffer)
-        r300->rws->cs_add_buffer(r300->cs, r300_buffer(index_buffer)->buf,
-                                 r300_buffer(index_buffer)->domain, 0);
+        r300->rws->cs_add_reloc(r300->cs, r300_buffer(index_buffer)->cs_buf,
+                                r300_buffer(index_buffer)->domain, 0);
 
+    /* Now do the validation. */
     if (!r300->rws->cs_validate(r300->cs)) {
-        return FALSE;
+        /* Ooops, an infinite loop, give up. */
+        if (flushed)
+            return FALSE;
+
+        r300->context.flush(&r300->context, 0, NULL);
+        flushed = TRUE;
+        goto validate;
     }
 
     return TRUE;
@@ -1241,7 +1296,7 @@ unsigned r300_get_num_dirty_dwords(struct r300_context *r300)
     struct r300_atom* atom;
     unsigned dwords = 0;
 
-    foreach(atom, &r300->atom_list) {
+    foreach_dirty_atom(r300, atom) {
         if (atom->dirty) {
             dwords += atom->size;
         }
@@ -1260,7 +1315,7 @@ unsigned r300_get_num_cs_end_dwords(struct r300_context *r300)
     /* Emitted in flush. */
     dwords += 26; /* emit_query_end */
     dwords += r300->hyperz_state.size + 2; /* emit_hyperz_end + zcache flush */
-    if (r500_index_bias_supported(r300))
+    if (r300->screen->caps.index_bias_supported)
         dwords += 2;
 
     return dwords;
@@ -1269,17 +1324,16 @@ unsigned r300_get_num_cs_end_dwords(struct r300_context *r300)
 /* Emit all dirty state. */
 void r300_emit_dirty_state(struct r300_context* r300)
 {
-    struct r300_atomatom;
+    struct r300_atom *atom;
 
-    foreach(atom, &r300->atom_list) {
+    foreach_dirty_atom(r300, atom) {
         if (atom->dirty) {
             atom->emit(r300, atom->size, atom->state);
-            if (SCREEN_DBG_ON(r300->screen, DBG_STATS)) {
-                atom->counter++;
-            }
             atom->dirty = FALSE;
         }
     }
 
+    r300->first_dirty = NULL;
+    r300->last_dirty = NULL;
     r300->dirty_hw++;
 }
index 278dbcb4c7cb5c4222a783d03e8d00968cd09059..acea51d942f131f7d6b83cd89dc494b6d8334e02 100644 (file)
@@ -31,7 +31,7 @@ struct r300_vertex_program_code;
 
 uint32_t pack_float24(float f);
 
-void r300_emit_aos(struct r300_context* r300, int offset, boolean indexed);
+void r300_emit_vertex_arrays(struct r300_context* r300, int offset, boolean indexed);
 
 void r300_emit_blend_state(struct r300_context* r300,
                            unsigned size, void* state);
@@ -86,7 +86,7 @@ void r300_emit_scissor_state(struct r300_context* r300,
 void r300_emit_textures_state(struct r300_context *r300,
                               unsigned size, void *state);
 
-void r300_emit_aos_swtcl(struct r300_context *r300, boolean indexed);
+void r300_emit_vertex_arrays_swtcl(struct r300_context *r300, boolean indexed);
 
 void r300_emit_vap_invariant_state(struct r300_context *r300,
                                    unsigned size, void *state);
index 1afd27f0938210fb9fdf71cd634d1b07e0ee4c94..b250532ba92c581b1818b9d2ca0504375f876369 100644 (file)
@@ -49,7 +49,7 @@ static void r300_flush(struct pipe_context* pipe,
     if (r300->dirty_hw) {
         r300_emit_hyperz_end(r300);
         r300_emit_query_end(r300);
-        if (r500_index_bias_supported(r300))
+        if (r300->screen->caps.index_bias_supported)
             r500_emit_index_bias(r300, 0);
 
         r300->flush_counter++;
@@ -57,9 +57,9 @@ static void r300_flush(struct pipe_context* pipe,
         r300->dirty_hw = 0;
 
         /* New kitchen sink, baby. */
-        foreach(atom, &r300->atom_list) {
+        foreach_atom(r300, atom) {
             if (atom->state || atom->allow_null_state) {
-                atom->dirty = TRUE;
+                r300_mark_atom_dirty(r300, atom);
             }
         }
 
@@ -68,6 +68,14 @@ static void r300_flush(struct pipe_context* pipe,
             r300->vs_state.dirty = FALSE;
             r300->vs_constants.dirty = FALSE;
         }
+
+        r300->validate_buffers = TRUE;
+        r300->upload_vb_validated = FALSE;
+        r300->upload_ib_validated = FALSE;
+    } else {
+        /* Even if hw is not dirty, we should at least reset the CS in case
+         * the space checking failed for the first draw operation. */
+        r300->rws->cs_flush(r300->cs);
     }
 
     /* reset flushed query */
index c91532eb7b30bfff3c18b778a328c5463895efc0..6d4091dc87da2180f4c1de8fa56d962a6ff718ef 100644 (file)
@@ -390,12 +390,18 @@ static void r300_translate_fragment_shader(
     compiler.Base.max_temp_regs = compiler.Base.is_r500 ? 128 : 32;
     compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32;
     compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64;
-    compiler.Base.remove_unused_constants = TRUE;
     compiler.AllocateHwInputs = &allocate_hardware_inputs;
     compiler.UserData = &shader->inputs;
 
     find_output_registers(&compiler, shader);
 
+    shader->write_all = FALSE;
+    for (i = 0; i < shader->info.num_properties; i++) {
+        if (shader->info.properties[i].name == TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS) {
+            shader->write_all = TRUE;
+        }
+    }
+
     if (compiler.Base.Debug & RC_DBG_LOG) {
         DBG(r300, DBG_FP, "r300: Initial fragment program\n");
         tgsi_dump(tokens, 0);
@@ -408,6 +414,11 @@ static void r300_translate_fragment_shader(
 
     r300_tgsi_to_rc(&ttr, tokens);
 
+    if (!r300->screen->caps.is_r500 ||
+        compiler.Base.Program.Constants.Count > 200) {
+        compiler.Base.remove_unused_constants = TRUE;
+    }
+
     /**
      * Transform the program to support WPOS.
      *
index 51bfa88c5ef221bb731864385fbed90c62218357..c86a90b85ae40059ff5fec747d066d3673bebc3c 100644 (file)
@@ -54,6 +54,9 @@ struct r300_fragment_shader_code {
     uint32_t *cb_code;
 
     struct r300_fragment_shader_code* next;
+
+    boolean write_all;
+
 };
 
 struct r300_fragment_shader {
@@ -81,4 +84,10 @@ static INLINE boolean r300_fragment_shader_writes_depth(struct r300_fragment_sha
     return (fs->shader->code.writes_depth) ? TRUE : FALSE;
 }
 
+static INLINE boolean r300_fragment_shader_writes_all(struct r300_fragment_shader *fs)
+{
+    if (!fs)
+        return FALSE;
+    return (fs->shader->write_all) ? TRUE : FALSE;
+}
 #endif /* R300_FS_H */
index 79f7f8abe9bd7fb48192308c5703786f82cf8c92..c22e307c679a11c251d9131902d5379faff7c6e3 100644 (file)
@@ -158,8 +158,8 @@ static void r300_update_hyperz(struct r300_context* r300)
     if (!r300->rws->get_value(r300->rws, R300_CAN_HYPERZ))
         return;
 
-    zmask_in_use = zstex->zmask_in_use[fb->zsbuf->level];
-    hiz_in_use = zstex->hiz_in_use[fb->zsbuf->level];
+    zmask_in_use = zstex->zmask_in_use[fb->zsbuf->u.tex.level];
+    hiz_in_use = zstex->hiz_in_use[fb->zsbuf->u.tex.level];
 
     /* Z fastfill. */
     if (zmask_in_use) {
@@ -282,7 +282,7 @@ static void r300_update_ztop(struct r300_context* r300)
         ztop_state->z_buffer_top = R300_ZTOP_ENABLE;
     }
     if (ztop_state->z_buffer_top != old_ztop)
-        r300->ztop_state.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->ztop_state);
 }
 
 #define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y))
@@ -333,7 +333,7 @@ void r300_hiz_alloc_block(struct r300_context *r300, struct r300_surface *surf)
 {
     struct r300_texture *tex;
     uint32_t zsize, ndw;
-    int level = surf->base.level;
+    int level = surf->base.u.tex.level;
 
     tex = r300_texture(surf->base.texture);
 
@@ -352,7 +352,7 @@ void r300_zmask_alloc_block(struct r300_context *r300, struct r300_surface *surf
 {
     int bsize = 256;
     uint32_t zsize, ndw;
-    int level = surf->base.level;
+    int level = surf->base.u.tex.level;
     struct r300_texture *tex;
 
     tex = r300_texture(surf->base.texture);
index 5f34fcb274485bd5307d46f2ee83f5fa87eb695b..6223e043210b92c94abee375f4b5c6974de582c9 100644 (file)
@@ -60,6 +60,7 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
     q->buffer = r300->rws->buffer_create(r300->rws, q->buffer_size, 4096,
                                          PIPE_BIND_CUSTOM, PIPE_USAGE_STREAM,
                                          q->domain);
+    q->cs_buffer = r300->rws->buffer_get_cs_handle(r300->rws, q->buffer);
 
     return (struct pipe_query*)q;
 }
@@ -79,7 +80,7 @@ void r300_resume_query(struct r300_context *r300,
                        struct r300_query *query)
 {
     r300->query_current = query;
-    r300->query_start.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->query_start);
 }
 
 static void r300_begin_query(struct pipe_context* pipe,
index 6bea783f69703f55f9e73dc8721a8e850a363388..d1154dee40a16297682965b520cf788a290e5ae7 100644 (file)
@@ -427,7 +427,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_PVS_CONST_START          512
 #       define R500_PVS_CONST_START          1024
 #       define R300_MAX_PVS_CONST_VECS       256
-#       define R500_MAX_PVS_CONST_VECS       1024
+#       define R500_MAX_PVS_CONST_VECS       256
 #       define R300_PVS_UCP_START            1024
 #       define R500_PVS_UCP_START            1536
 #       define R300_POINT_VPORT_SCALE_OFFSET 1030
@@ -553,6 +553,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* Addresses are relative to the vertex program parameters area. */
 #define R300_VAP_PVS_CONST_CNTL             0x22D4
 #       define R300_PVS_CONST_BASE_OFFSET_SHIFT  0
+#       define R300_PVS_CONST_BASE_OFFSET(x)     (x)
 #       define R300_PVS_MAX_CONST_ADDR_SHIFT     16
 #       define R300_PVS_MAX_CONST_ADDR(x)        ((x) << 16)
 #define R300_VAP_PVS_CODE_CNTL_1           0x22D8
@@ -1520,11 +1521,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_TX_TRI_PERF_3_8            (3<<15)
 #      define R300_ANISO_THRESHOLD_MASK       (7<<17)
 
+#       define R400_DXTC_SWIZZLE_ENABLE        (1<<21)
 #      define R500_MACRO_SWITCH               (1<<22)
 #       define R500_TX_MAX_ANISO(x)            ((x) << 23)
 #       define R500_TX_MAX_ANISO_MASK          (63 << 23)
 #       define R500_TX_ANISO_HIGH_QUALITY      (1 << 30)
-
 #      define R500_BORDER_FIX                 (1<<31)
 
 #define R300_TX_FORMAT0_0                   0x4480
@@ -2630,8 +2631,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define R300_ZB_BW_CNTL                     0x4f1c
 #      define R300_HIZ_DISABLE                              (0 << 0)
 #      define R300_HIZ_ENABLE                               (1 << 0)
-#      define R300_HIZ_MIN                                  (0 << 1)
-#      define R300_HIZ_MAX                                  (1 << 1)
+#      define R300_HIZ_MAX                                  (0 << 1)
+#      define R300_HIZ_MIN                                  (1 << 1)
 #      define R300_FAST_FILL_DISABLE                        (0 << 2)
 #      define R300_FAST_FILL_ENABLE                         (1 << 2)
 #      define R300_RD_COMP_DISABLE                          (0 << 3)
index 60700cf30372888d7f726f85854860395194df98..b35822c82f83e37e785ffd34f95f9cbae8f95f31 100644 (file)
@@ -39,7 +39,6 @@
 #include "r300_screen_buffer.h"
 #include "r300_emit.h"
 #include "r300_reg.h"
-#include "r300_state_derived.h"
 
 #include <limits.h>
 
@@ -118,12 +117,6 @@ static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300,
     return color_control;
 }
 
-boolean r500_index_bias_supported(struct r300_context *r300)
-{
-    return r300->screen->caps.is_r500 &&
-           r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0);
-}
-
 void r500_emit_index_bias(struct r300_context *r300, int index_bias)
 {
     CS_LOCALS(r300);
@@ -136,7 +129,7 @@ void r500_emit_index_bias(struct r300_context *r300, int index_bias)
 
 /* This function splits the index bias value into two parts:
  * - buffer_offset: the value that can be safely added to buffer offsets
- *   in r300_emit_aos (it must yield a positive offset when added to
+ *   in r300_emit_vertex_arrays (it must yield a positive offset when added to
  *   a vertex buffer offset)
  * - index_offset: the value that must be manually subtracted from indices
  *   in an index buffer to achieve negative offsets. */
@@ -172,8 +165,8 @@ static void r300_split_index_bias(struct r300_context *r300, int index_bias,
 enum r300_prepare_flags {
     PREP_FIRST_DRAW     = (1 << 0), /* call emit_dirty_state and friends? */
     PREP_VALIDATE_VBOS  = (1 << 1), /* validate VBOs? */
-    PREP_EMIT_AOS       = (1 << 2), /* call emit_aos? */
-    PREP_EMIT_AOS_SWTCL = (1 << 3), /* call emit_aos_swtcl? */
+    PREP_EMIT_AOS       = (1 << 2), /* call emit_vertex_arrays? */
+    PREP_EMIT_AOS_SWTCL = (1 << 3), /* call emit_vertex_arrays_swtcl? */
     PREP_INDEXED        = (1 << 4)  /* is this draw_elements? */
 };
 
@@ -191,28 +184,27 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
 {
     boolean flushed        = FALSE;
     boolean first_draw     = flags & PREP_FIRST_DRAW;
-    boolean emit_aos       = flags & PREP_EMIT_AOS;
-    boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
-    boolean hw_index_bias  = r500_index_bias_supported(r300);
+    boolean emit_vertex_arrays       = flags & PREP_EMIT_AOS;
+    boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_AOS_SWTCL;
 
     /* Add dirty state, index offset, and AOS. */
     if (first_draw) {
         cs_dwords += r300_get_num_dirty_dwords(r300);
 
-        if (hw_index_bias)
+        if (r300->screen->caps.index_bias_supported)
             cs_dwords += 2; /* emit_index_offset */
 
-        if (emit_aos)
-            cs_dwords += 55; /* emit_aos */
+        if (emit_vertex_arrays)
+            cs_dwords += 55; /* emit_vertex_arrays */
 
-        if (emit_aos_swtcl)
-            cs_dwords += 7; /* emit_aos_swtcl */
+        if (emit_vertex_arrays_swtcl)
+            cs_dwords += 7; /* emit_vertex_arrays_swtcl */
     }
 
     cs_dwords += r300_get_num_cs_end_dwords(r300);
 
     /* Reserve requested CS space. */
-    if (cs_dwords > (r300->cs->ndw - r300->cs->cdw)) {
+    if (cs_dwords > (R300_MAX_CMDBUF_DWORDS - r300->cs->cdw)) {
         r300->context.flush(&r300->context, 0, NULL);
         flushed = TRUE;
     }
@@ -225,44 +217,57 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
  * \param r300          The context.
  * \param flags         See r300_prepare_flags.
  * \param index_buffer  The index buffer to validate. The parameter may be NULL.
- * \param aos_offset    The offset passed to emit_aos.
+ * \param buffer_offset The offset passed to emit_vertex_arrays.
  * \param index_bias    The index bias to emit.
  * \return TRUE if rendering should be skipped
  */
 static boolean r300_emit_states(struct r300_context *r300,
                                 enum r300_prepare_flags flags,
                                 struct pipe_resource *index_buffer,
-                                int aos_offset,
+                                int buffer_offset,
                                 int index_bias)
 {
     boolean first_draw     = flags & PREP_FIRST_DRAW;
-    boolean emit_aos       = flags & PREP_EMIT_AOS;
-    boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
+    boolean emit_vertex_arrays       = flags & PREP_EMIT_AOS;
+    boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_AOS_SWTCL;
     boolean indexed        = flags & PREP_INDEXED;
-    boolean hw_index_bias  = r500_index_bias_supported(r300);
+    boolean validate_vbos  = flags & PREP_VALIDATE_VBOS;
 
     /* Validate buffers and emit dirty state if needed. */
     if (first_draw) {
-        if (!r300_emit_buffer_validate(r300, flags & PREP_VALIDATE_VBOS,
-                                       index_buffer)) {
-            fprintf(stderr, "r300: CS space validation failed. "
-                    "(not enough memory?) Skipping rendering.\n");
-            return FALSE;
+        if (r300->validate_buffers) {
+            if (!r300_emit_buffer_validate(r300, validate_vbos,
+                                           index_buffer)) {
+                fprintf(stderr, "r300: CS space validation failed. "
+                        "(not enough memory?) Skipping rendering.\n");
+                return FALSE;
+            }
+
+            /* Consider the validation done only if everything was validated. */
+            if (validate_vbos) {
+                r300->validate_buffers = FALSE;
+                if (r300->any_user_vbs)
+                    r300->upload_vb_validated = TRUE;
+                if (r300->index_buffer.buffer &&
+                    r300_is_user_buffer(r300->index_buffer.buffer)) {
+                    r300->upload_ib_validated = TRUE;
+                }
+            }
         }
 
         r300_emit_dirty_state(r300);
-        if (hw_index_bias) {
+        if (r300->screen->caps.index_bias_supported) {
             if (r300->screen->caps.has_tcl)
                 r500_emit_index_bias(r300, index_bias);
             else
                 r500_emit_index_bias(r300, 0);
         }
 
-        if (emit_aos)
-            r300_emit_aos(r300, aos_offset, indexed);
+        if (emit_vertex_arrays)
+            r300_emit_vertex_arrays(r300, buffer_offset, indexed);
 
-        if (emit_aos_swtcl)
-            r300_emit_aos_swtcl(r300, indexed);
+        if (emit_vertex_arrays_swtcl)
+            r300_emit_vertex_arrays_swtcl(r300, indexed);
     }
 
     return TRUE;
@@ -275,7 +280,7 @@ static boolean r300_emit_states(struct r300_context *r300,
  * \param flags         See r300_prepare_flags.
  * \param index_buffer  The index buffer to validate. The parameter may be NULL.
  * \param cs_dwords     The number of dwords to reserve in CS.
- * \param aos_offset    The offset passed to emit_aos.
+ * \param buffer_offset The offset passed to emit_vertex_arrays.
  * \param index_bias    The index bias to emit.
  * \return TRUE if rendering should be skipped
  */
@@ -283,20 +288,20 @@ static boolean r300_prepare_for_rendering(struct r300_context *r300,
                                           enum r300_prepare_flags flags,
                                           struct pipe_resource *index_buffer,
                                           unsigned cs_dwords,
-                                          int aos_offset,
+                                          int buffer_offset,
                                           int index_bias)
 {
     if (r300_reserve_cs_dwords(r300, flags, cs_dwords))
         flags |= PREP_FIRST_DRAW;
 
-    return r300_emit_states(r300, flags, index_buffer, aos_offset, index_bias);
+    return r300_emit_states(r300, flags, index_buffer, buffer_offset, index_bias);
 }
 
 static boolean immd_is_good_idea(struct r300_context *r300,
                                  unsigned count)
 {
     struct pipe_vertex_element* velem;
-    struct pipe_vertex_buffer* vbuf;
+    struct pipe_resource *buf;
     boolean checked[PIPE_MAX_ATTRIBS] = {0};
     unsigned vertex_element_count = r300->velems->count;
     unsigned i, vbi;
@@ -320,14 +325,13 @@ static boolean immd_is_good_idea(struct r300_context *r300,
         vbi = velem->vertex_buffer_index;
 
         if (!checked[vbi]) {
-            vbuf = &r300->vertex_buffer[vbi];
+            buf = r300->valid_vertex_buffer[vbi];
 
-            if (!(r300_buffer(vbuf->buffer)->domain & R300_DOMAIN_GTT)) {
+            if (!(r300_buffer(buf)->domain & R300_DOMAIN_GTT)) {
                 return FALSE;
             }
 
-            if (r300_buffer_is_referenced(&r300->context,
-                                          vbuf->buffer,
+            if (r300_buffer_is_referenced(&r300->context, buf,
                                           R300_REF_CS | R300_REF_HW)) {
                 /* It's a very bad idea to map it... */
                 return FALSE;
@@ -386,7 +390,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
         /* Map the buffer. */
         if (!transfer[vbi]) {
             map[vbi] = (uint32_t*)pipe_buffer_map(&r300->context,
-                                                  vbuf->buffer,
+                                                  r300->valid_vertex_buffer[vbi],
                                                   PIPE_TRANSFER_READ,
                                                  &transfer[vbi]);
             map[vbi] += (vbuf->buffer_offset / 4) + stride[i] * start;
@@ -418,8 +422,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
         vbi = r300->velems->velem[i].vertex_buffer_index;
 
         if (transfer[vbi]) {
-            vbuf = &r300->vertex_buffer[vbi];
-            pipe_buffer_unmap(&r300->context, vbuf->buffer, transfer[vbi]);
+            pipe_buffer_unmap(&r300->context, transfer[vbi]);
             transfer[vbi] = NULL;
         }
     }
@@ -461,10 +464,10 @@ static void r300_emit_draw_elements(struct r300_context *r300,
                                     unsigned maxIndex,
                                     unsigned mode,
                                     unsigned start,
-                                    unsigned count)
+                                    unsigned count,
+                                    uint16_t *imm_indices3)
 {
-    uint32_t count_dwords;
-    uint32_t offset_dwords = indexSize * start / sizeof(uint32_t);
+    uint32_t count_dwords, offset_dwords;
     boolean alt_num_verts = count > 65535;
     CS_LOCALS(r300);
 
@@ -474,20 +477,42 @@ static void r300_emit_draw_elements(struct r300_context *r300,
         return;
     }
 
-    maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index);
-
     DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n",
         count, minIndex, maxIndex);
 
-    BEGIN_CS(13 + (alt_num_verts ? 2 : 0));
-    if (alt_num_verts) {
-        OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
-    }
+    BEGIN_CS(5);
     OUT_CS_REG(R300_GA_COLOR_CONTROL,
             r300_provoking_vertex_fixes(r300, mode));
     OUT_CS_REG_SEQ(R300_VAP_VF_MAX_VTX_INDX, 2);
     OUT_CS(maxIndex);
     OUT_CS(minIndex);
+    END_CS;
+
+    /* If start is odd, render the first triangle with indices embedded
+     * in the command stream. This will increase start by 3 and make it
+     * even. We can then proceed without a fallback. */
+    if (indexSize == 2 && (start & 1) &&
+        mode == PIPE_PRIM_TRIANGLES) {
+        BEGIN_CS(4);
+        OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 2);
+        OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (3 << 16) |
+               R300_VAP_VF_CNTL__PRIM_TRIANGLES);
+        OUT_CS(imm_indices3[1] << 16 | imm_indices3[0]);
+        OUT_CS(imm_indices3[2]);
+        END_CS;
+
+        start += 3;
+        count -= 3;
+        if (!count)
+           return;
+    }
+
+    offset_dwords = indexSize * start / sizeof(uint32_t);
+
+    BEGIN_CS(8 + (alt_num_verts ? 2 : 0));
+    if (alt_num_verts) {
+        OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
+    }
     OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0);
     if (indexSize == 4) {
         count_dwords = count;
@@ -511,16 +536,13 @@ static void r300_emit_draw_elements(struct r300_context *r300,
     OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2) |
            (0 << R300_INDX_BUFFER_SKIP_SHIFT));
     OUT_CS(offset_dwords << 2);
-    OUT_CS_BUF_RELOC(indexBuffer, count_dwords,
-                     r300_buffer(indexBuffer)->domain, 0);
+    OUT_CS_BUF_RELOC(indexBuffer, count_dwords);
 
     END_CS;
 }
 
 /* This is the fast-path drawing & emission for HW TCL. */
 static void r300_draw_range_elements(struct pipe_context* pipe,
-                                     struct pipe_resource* indexBuffer,
-                                     unsigned indexSize,
                                      int indexBias,
                                      unsigned minIndex,
                                      unsigned maxIndex,
@@ -529,41 +551,66 @@ static void r300_draw_range_elements(struct pipe_context* pipe,
                                      unsigned count)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct pipe_resource *indexBuffer = r300->index_buffer.buffer;
+    unsigned indexSize = r300->index_buffer.index_size;
     struct pipe_resource* orgIndexBuffer = indexBuffer;
     boolean alt_num_verts = r300->screen->caps.is_r500 &&
                             count > 65536 &&
                             r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0);
     unsigned short_count;
     int buffer_offset = 0, index_offset = 0; /* for index bias emulation */
-    unsigned new_offset;
+    uint16_t indices3[3];
 
-    if (indexBias && !r500_index_bias_supported(r300)) {
+    if (indexBias && !r300->screen->caps.index_bias_supported) {
         r300_split_index_bias(r300, indexBias, &buffer_offset, &index_offset);
     }
 
     r300_translate_index_buffer(r300, &indexBuffer, &indexSize, index_offset,
                                 &start, count);
 
-    r300_update_derived_state(r300);
-    r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count, &new_offset);
+    /* Fallback for misaligned ushort indices. */
+    if (indexSize == 2 && (start & 1) &&
+        !r300_is_user_buffer(indexBuffer)) {
+        struct pipe_transfer *transfer;
+        struct pipe_resource *userbuf;
 
-    start = new_offset;
+        uint16_t *ptr = pipe_buffer_map(pipe, indexBuffer,
+                                        PIPE_TRANSFER_READ, &transfer);
 
-    /* 15 dwords for emit_draw_elements. Give up if the function fails. */
+        if (mode == PIPE_PRIM_TRIANGLES) {
+           memcpy(indices3, ptr + start, 6);
+        } else {
+            /* Copy the mapped index buffer directly to the upload buffer.
+             * The start index will be aligned simply from the fact that
+             * every sub-buffer in u_upload_mgr is aligned. */
+            userbuf = pipe->screen->user_buffer_create(pipe->screen,
+                                                       ptr, 0,
+                                                       PIPE_BIND_INDEX_BUFFER);
+            indexBuffer = userbuf;
+            r300_upload_index_buffer(r300, &indexBuffer, indexSize, &start, count);
+            pipe_resource_reference(&userbuf, NULL);
+        }
+        pipe_buffer_unmap(pipe, transfer);
+    } else {
+        if (r300_is_user_buffer(indexBuffer))
+            r300_upload_index_buffer(r300, &indexBuffer, indexSize, &start, count);
+    }
+
+    /* 19 dwords for emit_draw_elements. Give up if the function fails. */
     if (!r300_prepare_for_rendering(r300,
             PREP_FIRST_DRAW | PREP_VALIDATE_VBOS | PREP_EMIT_AOS |
-            PREP_INDEXED, indexBuffer, 15, buffer_offset, indexBias))
+            PREP_INDEXED, indexBuffer, 19, buffer_offset, indexBias))
         goto done;
 
     if (alt_num_verts || count <= 65535) {
         r300_emit_draw_elements(r300, indexBuffer, indexSize,
-                               minIndex, maxIndex, mode, start, count);
+                               minIndex, maxIndex, mode, start, count, indices3);
     } else {
         do {
             short_count = MIN2(count, 65534);
             r300_emit_draw_elements(r300, indexBuffer, indexSize,
                                      minIndex, maxIndex,
-                                     mode, start, short_count);
+                                     mode, start, short_count, indices3);
 
             start += short_count;
             count -= short_count;
@@ -572,7 +619,7 @@ static void r300_draw_range_elements(struct pipe_context* pipe,
             if (count) {
                 if (!r300_prepare_for_rendering(r300,
                         PREP_VALIDATE_VBOS | PREP_EMIT_AOS | PREP_INDEXED,
-                        indexBuffer, 15, buffer_offset, indexBias))
+                        indexBuffer, 19, buffer_offset, indexBias))
                     goto done;
             }
         } while (count);
@@ -593,8 +640,6 @@ static void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
                             r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0);
     unsigned short_count;
 
-    r300_update_derived_state(r300);
-
     if (immd_is_good_idea(r300, count)) {
         r300_emit_draw_arrays_immediate(r300, mode, start, count);
     } else {
@@ -633,7 +678,8 @@ static void r300_draw_vbo(struct pipe_context* pipe,
     unsigned count = info->count;
     boolean translate = FALSE;
     boolean indexed = info->indexed && r300->index_buffer.buffer;
-    unsigned start_indexed = 0;
+    unsigned min_index = 0;
+    unsigned max_index = r300->vertex_buffer_max_index;
 
     if (r300->skip_rendering) {
         return;
@@ -643,43 +689,65 @@ static void r300_draw_vbo(struct pipe_context* pipe,
         return;
     }
 
-    /* Index buffer range checking. */
     if (indexed) {
-        assert(r300->index_buffer.offset % r300->index_buffer.index_size == 0);
-
-        /* Compute start for draw_elements, taking the offset into account. */
-        start_indexed =
+        int real_min_index, real_max_index;
+        /* Compute the start for draw_elements, taking the offset into account. */
+        unsigned start_indexed =
             info->start +
             (r300->index_buffer.offset / r300->index_buffer.index_size);
 
+        assert(r300->index_buffer.offset % r300->index_buffer.index_size == 0);
+
+        /* Index buffer range checking. */
         if ((start_indexed + count) * r300->index_buffer.index_size >
             r300->index_buffer.buffer->width0) {
             fprintf(stderr, "r300: Invalid index buffer range. Skipping rendering.\n");
             return;
         }
-    }
 
-    /* Set up fallback for incompatible vertex layout if needed. */
-    if (r300->incompatible_vb_layout || r300->velems->incompatible_layout) {
-        r300_begin_vertex_translate(r300);
-        translate = TRUE;
-    }
+        min_index = MAX2(min_index, info->min_index);
+        max_index = MIN2(max_index, info->max_index);
+        real_min_index = (int)min_index - info->index_bias;
+        real_max_index = (int)max_index - info->index_bias;
 
-    if (indexed) {
-        r300_draw_range_elements(pipe,
-                                 r300->index_buffer.buffer,
-                                 r300->index_buffer.index_size,
-                                 info->index_bias,
-                                 info->min_index,
-                                 info->max_index,
-                                 info->mode,
-                                 start_indexed,
-                                 count);
+        if (max_index >= (1 << 24) - 1) {
+            fprintf(stderr, "r300: Invalid max_index: %i. Skipping rendering...\n", max_index);
+            return;
+        }
+
+        r300_update_derived_state(r300);
+
+        /* Set up the fallback for an incompatible vertex layout if needed. */
+        if (r300->incompatible_vb_layout || r300->velems->incompatible_layout) {
+            r300_begin_vertex_translate(r300, real_min_index, real_max_index);
+            translate = TRUE;
+        }
+
+        /* Upload vertex buffers. */
+        if (r300->any_user_vbs) {
+            r300_upload_user_buffers(r300, real_min_index, real_max_index);
+        }
+
+        r300_draw_range_elements(pipe, info->index_bias, min_index, max_index,
+                                 info->mode, start_indexed, count);
     } else {
-        r300_draw_arrays(pipe,
-                         info->mode,
-                         info->start,
-                         count);
+        min_index = MAX2(min_index, info->start);
+        max_index = MIN2(max_index, info->start + count - 1);
+
+        r300_update_derived_state(r300);
+
+        /* Set up the fallback for an incompatible vertex layout if needed. */
+        if (r300->incompatible_vb_layout || r300->velems->incompatible_layout) {
+            r300_begin_vertex_translate(r300, min_index, max_index);
+            translate = TRUE;
+        }
+
+        /* Upload vertex buffers. */
+        if (r300->any_user_vbs) {
+            r300_upload_user_buffers(r300, min_index, max_index);
+        }
+
+        r300_draw_arrays(pipe, info->mode, info->start, count);
     }
 
     if (translate) {
@@ -744,14 +812,13 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
 
     for (i = 0; i < r300->vertex_buffer_count; i++) {
         if (r300->vertex_buffer[i].buffer) {
-            pipe_buffer_unmap(pipe, r300->vertex_buffer[i].buffer,
-                              vb_transfer[i]);
+            pipe_buffer_unmap(pipe, vb_transfer[i]);
             draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
         }
     }
 
     if (indexed) {
-        pipe_buffer_unmap(pipe, r300->index_buffer.buffer, ib_transfer);
+        pipe_buffer_unmap(pipe, ib_transfer);
         draw_set_mapped_index_buffer(r300->draw, NULL);
     }
 }
@@ -810,6 +877,7 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render,
                                       R300_MAX_DRAW_VBO_SIZE);
         r300->draw_vbo_offset = 0;
         r300->draw_vbo_size = R300_MAX_DRAW_VBO_SIZE;
+        r300->validate_buffers = TRUE;
     }
 
     r300render->vertex_size = vertex_size;
@@ -850,7 +918,7 @@ static void r300_render_unmap_vertices(struct vbuf_render* render,
 
     r300render->vbo_max_used = MAX2(r300render->vbo_max_used,
                                     r300render->vertex_size * (max + 1));
-    pipe_buffer_unmap(context, r300->vbo, r300render->vbo_transfer);
+    pipe_buffer_unmap(context, r300render->vbo_transfer);
 
     r300render->vbo_transfer = NULL;
 }
@@ -967,7 +1035,7 @@ static void r300_render_draw_elements(struct vbuf_render* render,
     end_cs_dwords = r300_get_num_cs_end_dwords(r300);
 
     while (count) {
-        free_dwords = r300->cs->ndw - r300->cs->cdw;
+        free_dwords = R300_MAX_CMDBUF_DWORDS - r300->cs->cdw;
 
         short_count = MIN2(count, (free_dwords - end_cs_dwords - 6) * 2);
 
@@ -1015,8 +1083,7 @@ static struct vbuf_render* r300_render_create(struct r300_context* r300)
 
     r300render->r300 = r300;
 
-    /* XXX find real numbers plz */
-    r300render->base.max_vertex_buffer_bytes = 128 * 1024;
+    r300render->base.max_vertex_buffer_bytes = 1024 * 1024;
     r300render->base.max_indices = 16 * 1024;
 
     r300render->base.get_vertex_info = r300_render_get_vertex_info;
@@ -1088,6 +1155,8 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
     const float zeros[4] = {0, 0, 0, 0};
     CS_LOCALS(r300);
 
+    r300->context.set_vertex_buffers(&r300->context, 0, NULL);
+
     if (type == UTIL_BLITTER_ATTRIB_TEXCOORD)
         r300->sprite_coord_enable = 1;
 
@@ -1144,37 +1213,45 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
 
 done:
     /* Restore the state. */
-    r300->clip_state.dirty = TRUE;
-    r300->rs_state.dirty = TRUE;
-    r300->viewport_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->clip_state);
+    r300_mark_atom_dirty(r300, &r300->rs_state);
+    r300_mark_atom_dirty(r300, &r300->viewport_state);
 
     r300->sprite_coord_enable = last_sprite_coord_enable;
 }
 
 static void r300_resource_resolve(struct pipe_context* pipe,
                                   struct pipe_resource* dest,
-                                  struct pipe_subresource subdest,
+                                  unsigned dst_layer,
                                   struct pipe_resource* src,
-                                  struct pipe_subresource subsrc)
+                                  unsigned src_layer)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct pipe_surface* srcsurf, surf_tmpl;
     struct r300_aa_state *aa = (struct r300_aa_state*)r300->aa_state.state;
-    struct pipe_surface* srcsurf = src->screen->get_tex_surface(src->screen,
-            src, subsrc.face, subsrc.level, 0, 0);
     float color[] = {0, 0, 0, 0};
 
+    memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+    surf_tmpl.format = src->format;
+    surf_tmpl.usage = 0; /* not really a surface hence no bind flags */
+    surf_tmpl.u.tex.level = 0; /* msaa resources cannot have mipmaps */
+    surf_tmpl.u.tex.first_layer = src_layer;
+    surf_tmpl.u.tex.last_layer = src_layer;
+    srcsurf = pipe->create_surface(pipe, src, &surf_tmpl);
+    surf_tmpl.format = dest->format;
+    surf_tmpl.u.tex.first_layer = dst_layer;
+    surf_tmpl.u.tex.last_layer = dst_layer;
+
     DBG(r300, DBG_DRAW, "r300: Resolving resource...\n");
 
     /* Enable AA resolve. */
-    aa->dest = r300_surface(
-            dest->screen->get_tex_surface(dest->screen, dest, subdest.face,
-                                          subdest.level, 0, 0));
+    aa->dest = r300_surface(pipe->create_surface(pipe, dest, &surf_tmpl));
 
     aa->aaresolve_ctl =
         R300_RB3D_AARESOLVE_CTL_AARESOLVE_MODE_RESOLVE |
         R300_RB3D_AARESOLVE_CTL_AARESOLVE_ALPHA_AVERAGE;
     r300->aa_state.size = 12;
-    r300->aa_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->aa_state);
 
     /* Resolve the surface. */
     r300->context.clear_render_target(pipe,
@@ -1183,7 +1260,7 @@ static void r300_resource_resolve(struct pipe_context* pipe,
     /* Disable AA resolve. */
     aa->aaresolve_ctl = 0;
     r300->aa_state.size = 4;
-    r300->aa_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->aa_state);
 
     pipe_surface_reference((struct pipe_surface**)&srcsurf, NULL);
     pipe_surface_reference((struct pipe_surface**)&aa->dest, NULL);
index 1f035d64a28450d75d67db3669a9c28f1d5ea30d..747594afaf2763fa7952afeb176c5f2564e7d82a 100644 (file)
@@ -66,7 +66,7 @@ static void r300_stencilref_begin(struct r300_context *r300)
     /* We *cull* pixels, therefore no need to mask out the bits. */
     rs->cb_main[rs->cull_mode_index] |= R300_CULL_BACK;
 
-    r300->rs_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->rs_state);
 }
 
 /* Set drawing for back faces. */
@@ -80,8 +80,8 @@ static void r300_stencilref_switch_side(struct r300_context *r300)
     dsa->stencil_ref_mask = dsa->stencil_ref_bf;
     r300->stencil_ref.ref_value[0] = r300->stencil_ref.ref_value[1];
 
-    r300->rs_state.dirty = TRUE;
-    r300->dsa_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->rs_state);
+    r300_mark_atom_dirty(r300, &r300->dsa_state);
 }
 
 /* Restore the original state. */
@@ -96,8 +96,8 @@ static void r300_stencilref_end(struct r300_context *r300)
     dsa->stencil_ref_mask = sr->zb_stencilrefmask;
     r300->stencil_ref.ref_value[0] = sr->ref_value_front;
 
-    r300->rs_state.dirty = TRUE;
-    r300->dsa_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->rs_state);
+    r300_mark_atom_dirty(r300, &r300->dsa_state);
 }
 
 static void r300_stencilref_draw_vbo(struct pipe_context *pipe,
index 9247064508f86cd5ec411d31bb941b2334c7105c..c48062c80845392b8ff0d02105abd8dad588b082 100644 (file)
 #include "translate/translate.h"
 #include "util/u_index_modify.h"
 
-void r300_begin_vertex_translate(struct r300_context *r300)
+/* XXX Optimization: use min_index and translate only that range. */
+/* XXX Use the uploader. */
+void r300_begin_vertex_translate(struct r300_context *r300,
+                                 int min_index, int max_index)
 {
     struct pipe_context *pipe = &r300->context;
     struct translate_key key = {0};
@@ -44,6 +47,7 @@ void r300_begin_vertex_translate(struct r300_context *r300)
     struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {0}, *out_transfer;
     struct pipe_resource *out_buffer;
     unsigned i, num_verts;
+    unsigned slot;
 
     /* Initialize the translate key, i.e. the recipe how vertices should be
      * translated. */
@@ -108,12 +112,12 @@ void r300_begin_vertex_translate(struct r300_context *r300)
             vb_map[i] = pipe_buffer_map(pipe, vb->buffer,
                                         PIPE_TRANSFER_READ, &vb_transfer[i]);
 
-            tr->set_buffer(tr, i, vb_map[i], vb->stride, vb->max_index);
+            tr->set_buffer(tr, i, vb_map[i], vb->stride, max_index);
         }
     }
 
     /* Create and map the output buffer. */
-    num_verts = r300->vertex_buffer_max_index + 1;
+    num_verts = max_index + 1;
 
     out_buffer = pipe_buffer_create(&r300->screen->screen,
                                     PIPE_BIND_VERTEX_BUFFER,
@@ -128,26 +132,30 @@ void r300_begin_vertex_translate(struct r300_context *r300)
     /* Unmap all buffers. */
     for (i = 0; i < r300->vertex_buffer_count; i++) {
         if (vb_translated[i]) {
-            pipe_buffer_unmap(pipe, r300->vertex_buffer[i].buffer,
-                              vb_transfer[i]);
+            pipe_buffer_unmap(pipe, vb_transfer[i]);
         }
     }
 
-    pipe_buffer_unmap(pipe, out_buffer, out_transfer);
+    pipe_buffer_unmap(pipe, out_transfer);
 
     /* Setup the new vertex buffer in the first free slot. */
+    slot = ~0;
     for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
         struct pipe_vertex_buffer *vb = &r300->vertex_buffer[i];
 
         if (!vb->buffer) {
-            pipe_resource_reference(&vb->buffer, out_buffer);
+            pipe_resource_reference(&r300->valid_vertex_buffer[i], out_buffer);
             vb->buffer_offset = 0;
-            vb->max_index = num_verts - 1;
             vb->stride = key.output_stride;
-            r300->tran.vb_slot = i;
+            slot = i;
+            /* XXX probably need to preserve the real count for u_blitter_save_*. */
+            r300->vertex_buffer_count = MAX2(r300->vertex_buffer_count, i+1);
+            r300->validate_buffers = TRUE;
             break;
         }
     }
+    /* XXX This may fail. */
+    assert(slot != ~0);
 
     /* Save and replace vertex elements. */
     {
@@ -161,7 +169,7 @@ void r300_begin_vertex_translate(struct r300_context *r300)
                 new_velems[i].instance_divisor = ve->velem[i].instance_divisor;
                 new_velems[i].src_format = te->output_format;
                 new_velems[i].src_offset = te->output_offset;
-                new_velems[i].vertex_buffer_index = r300->tran.vb_slot;
+                new_velems[i].vertex_buffer_index = slot;
             } else {
                 memcpy(&new_velems[i], &ve->velem[i],
                        sizeof(struct pipe_vertex_element));
@@ -183,12 +191,9 @@ void r300_end_vertex_translate(struct r300_context *r300)
     /* Restore vertex elements. */
     pipe->bind_vertex_elements_state(pipe, r300->tran.saved_velems);
     pipe->delete_vertex_elements_state(pipe, r300->tran.new_velems);
-
-    /* Delete the now-unused VBO. */
-    pipe_resource_reference(&r300->vertex_buffer[r300->tran.vb_slot].buffer,
-                            NULL);
 }
 
+/* XXX Use the uploader. */
 void r300_translate_index_buffer(struct r300_context *r300,
                                  struct pipe_resource **index_buffer,
                                  unsigned *index_size, unsigned index_offset,
@@ -199,12 +204,14 @@ void r300_translate_index_buffer(struct r300_context *r300,
             util_shorten_ubyte_elts(&r300->context, index_buffer, index_offset, *start, count);
             *index_size = 2;
             *start = 0;
+            r300->validate_buffers = TRUE;
             break;
 
         case 2:
-            if (*start % 2 != 0 || index_offset) {
+            if (index_offset) {
                 util_rebuild_ushort_elts(&r300->context, index_buffer, index_offset, *start, count);
                 *start = 0;
+                r300->validate_buffers = TRUE;
             }
             break;
 
@@ -212,6 +219,7 @@ void r300_translate_index_buffer(struct r300_context *r300,
             if (index_offset) {
                 util_rebuild_uint_elts(&r300->context, index_buffer, index_offset, *start, count);
                 *start = 0;
+                r300->validate_buffers = TRUE;
             }
             break;
     }
index f6f33028dc60b15007e74407681458713b7ffee4..dd1df970594c00c1ec3b25970b56a08e2c230eb4 100644 (file)
@@ -58,6 +58,8 @@ void r300_init_resource_functions(struct r300_context *r300)
    r300->context.transfer_destroy = u_transfer_destroy_vtbl;
    r300->context.transfer_inline_write = u_transfer_inline_write_vtbl;
    r300->context.is_resource_referenced = u_is_resource_referenced_vtbl;
+   r300->context.create_surface = r300_create_surface;
+   r300->context.surface_destroy = r300_surface_destroy;
 }
 
 void r300_init_screen_resource_functions(struct r300_screen *r300screen)
@@ -67,7 +69,4 @@ void r300_init_screen_resource_functions(struct r300_screen *r300screen)
    r300screen->screen.resource_get_handle = u_resource_get_handle_vtbl;
    r300screen->screen.resource_destroy = u_resource_destroy_vtbl;
    r300screen->screen.user_buffer_create = r300_user_buffer_create;
-
-   r300screen->screen.get_tex_surface = r300_get_tex_surface;
-   r300screen->screen.tex_surface_destroy = r300_tex_surface_destroy;
 }
index 5332866188fbf50e2287a64e1512e39d8ddcfbab..c75aeaa10a7f2155ff15ed8c5cb1f4f87fdff4b7 100644 (file)
 
 #include "draw/draw_context.h"
 
+#ifdef HAVE_LLVM
+#include "gallivm/lp_bld_init.h"
+#endif
+
 /* Return the identifier behind whom the brave coders responsible for this
  * amalgamation of code, sweat, and duct tape, routinely obscure their names.
  *
@@ -116,8 +120,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
         case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
         case PIPE_CAP_BLEND_EQUATION_SEPARATE:
-        case PIPE_CAP_TEXTURE_SWIZZLE:
             return 1;
+        case PIPE_CAP_TEXTURE_SWIZZLE:
+            return util_format_s3tc_enabled ? r300screen->caps.dxtc_swizzle : 1;
 
         /* Unsupported features (boolean caps). */
         case PIPE_CAP_TIMER_QUERY:
@@ -308,7 +313,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
                                         unsigned usage,
                                         unsigned geom_flags)
 {
+    struct r300_winsys_screen *rws = r300_screen(screen)->rws;
     uint32_t retval = 0;
+    boolean drm_2_8_0 = rws->get_value(rws, R300_VID_DRM_2_8_0);
     boolean is_r500 = r300_screen(screen)->caps.is_r500;
     boolean is_r400 = r300_screen(screen)->caps.is_r400;
     boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM ||
@@ -362,7 +369,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
                   PIPE_BIND_SCANOUT |
                   PIPE_BIND_SHARED)) &&
         /* 2101010 cannot be rendered to on non-r5xx. */
-        (is_r500 || !is_color2101010) &&
+        (!is_color2101010 || (is_r500 && drm_2_8_0)) &&
         r300_is_colorbuffer_format_supported(format)) {
         retval |= usage &
             (PIPE_BIND_RENDER_TARGET |
@@ -399,7 +406,7 @@ static void r300_destroy_screen(struct pipe_screen* pscreen)
     struct r300_screen* r300screen = r300_screen(pscreen);
     struct r300_winsys_screen *rws = r300_winsys_screen(pscreen);
 
-    util_mempool_destroy(&r300screen->pool_buffers);
+    util_slab_destroy(&r300screen->pool_buffers);
 
     if (rws)
       rws->destroy(rws);
@@ -456,9 +463,13 @@ struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
     r300_init_debug(r300screen);
     r300_parse_chipset(&r300screen->caps);
 
-    util_mempool_create(&r300screen->pool_buffers,
-                        sizeof(struct r300_buffer), 64,
-                        UTIL_MEMPOOL_SINGLETHREADED);
+    r300screen->caps.index_bias_supported =
+            r300screen->caps.is_r500 &&
+            rws->get_value(rws, R300_VID_DRM_2_3_0);
+
+    util_slab_create(&r300screen->pool_buffers,
+                     sizeof(struct r300_buffer), 64,
+                     UTIL_SLAB_SINGLETHREADED);
 
     r300screen->rws = rws;
     r300screen->screen.winsys = (struct pipe_winsys*)rws;
@@ -479,5 +490,9 @@ struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
 
     util_format_s3tc_init();
 
+#ifdef HAVE_LLVM
+    lp_build_init();
+#endif
+
     return &r300screen->screen;
 }
index 8b7f1fab61bb170021fdd6d49f80f00e82af2845..752f53b7579842a43faeca29c43848e4c2843176 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "r300_chipset.h"
 
-#include "util/u_mempool.h"
+#include "util/u_slab.h"
 
 #include <stdio.h>
 
@@ -44,7 +44,7 @@ struct r300_screen {
     struct r300_capabilities caps;
 
     /* Memory pools. */
-    struct util_mempool pool_buffers;
+    struct util_slab_mempool pool_buffers;
 
     /** Combination of DBG_xxx flags */
     unsigned debug;
@@ -93,6 +93,7 @@ r300_winsys_screen(struct pipe_screen *screen) {
 #define DBG_CBZB        (1 << 11)
 #define DBG_HYPERZ      (1 << 12)
 #define DBG_SCISSOR     (1 << 13)
+#define DBG_UPLOAD      (1 << 14)
 /* Features. */
 #define DBG_ANISOHQ     (1 << 16)
 #define DBG_NO_TILING   (1 << 17)
@@ -101,7 +102,6 @@ r300_winsys_screen(struct pipe_screen *screen) {
 #define DBG_NO_OPT      (1 << 20)
 #define DBG_NO_CBZB     (1 << 21)
 /* Statistics. */
-#define DBG_STATS       (1 << 24)
 #define DBG_P_STAT      (1 << 25)
 /*@}*/
 
index 37a080ba48b940bf5850d0a8967c51349d63d9c3..cc3c1d7687edebb807036cbfdc1e31a823f783f5 100644 (file)
@@ -40,10 +40,10 @@ unsigned r300_buffer_is_referenced(struct pipe_context *context,
     struct r300_context *r300 = r300_context(context);
     struct r300_buffer *rbuf = r300_buffer(buf);
 
-    if (r300_buffer_is_user_buffer(buf))
+    if (r300_is_user_buffer(buf))
        return PIPE_UNREFERENCED;
 
-    if (r300->rws->cs_is_buffer_referenced(r300->cs, rbuf->buf, domain))
+    if (r300->rws->cs_is_buffer_referenced(r300->cs, rbuf->cs_buf, domain))
         return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
 
     return PIPE_UNREFERENCED;
@@ -51,76 +51,86 @@ unsigned r300_buffer_is_referenced(struct pipe_context *context,
 
 static unsigned r300_buffer_is_referenced_by_cs(struct pipe_context *context,
                                                 struct pipe_resource *buf,
-                                                unsigned face, unsigned level)
+                                                unsigned level, int layer)
 {
     return r300_buffer_is_referenced(context, buf, R300_REF_CS);
 }
 
-/* External helper, not required to implent u_resource_vtbl:
- */
-int r300_upload_index_buffer(struct r300_context *r300,
-                            struct pipe_resource **index_buffer,
-                            unsigned index_size,
-                            unsigned start,
-                            unsigned count,
-                            unsigned *out_offset)
+void r300_upload_index_buffer(struct r300_context *r300,
+                             struct pipe_resource **index_buffer,
+                             unsigned index_size, unsigned *start,
+                             unsigned count)
 {
-   struct pipe_resource *upload_buffer = NULL;
-   unsigned index_offset = start * index_size;
-   int ret = 0;
-
-    if (r300_buffer_is_user_buffer(*index_buffer)) {
-       ret = u_upload_buffer(r300->upload_ib,
-                             index_offset,
-                             count * index_size,
-                             *index_buffer,
-                             &index_offset,
-                             &upload_buffer);
-       if (ret) {
-           goto done;
-       }
-       *index_buffer = upload_buffer;
-       *out_offset = index_offset / index_size;
-    } else
-        *out_offset = start;
-
- done:
-    //    if (upload_buffer)
-    // pipe_resource_reference(&upload_buffer, NULL);
-    return ret;
+    unsigned index_offset;
+    uint8_t *ptr = r300_buffer(*index_buffer)->user_buffer;
+    boolean flushed;
+
+    *index_buffer = NULL;
+
+    u_upload_data(r300->upload_ib,
+                  0, count * index_size,
+                  ptr + (*start * index_size),
+                  &index_offset,
+                  index_buffer, &flushed);
+
+    *start = index_offset / index_size;
+
+    if (flushed || !r300->upload_ib_validated) {
+        r300->upload_ib_validated = FALSE;
+        r300->validate_buffers = TRUE;
+    }
 }
 
-/* External helper, not required to implement u_resource_vtbl:
- */
-int r300_upload_user_buffers(struct r300_context *r300)
+void r300_upload_user_buffers(struct r300_context *r300,
+                              int min_index, int max_index)
 {
-    enum pipe_error ret = PIPE_OK;
-    int i, nr;
-
-    nr = r300->velems->count;
+    int i, nr = r300->velems->count;
+    unsigned count = max_index + 1 - min_index;
+    boolean flushed;
+    boolean uploaded[16] = {0};
 
     for (i = 0; i < nr; i++) {
-        struct pipe_vertex_buffer *vb =
-            &r300->vertex_buffer[r300->velems->velem[i].vertex_buffer_index];
-
-        if (r300_buffer_is_user_buffer(vb->buffer)) {
-            struct pipe_resource *upload_buffer = NULL;
-            unsigned offset = 0; /*vb->buffer_offset * 4;*/
-            unsigned size = vb->buffer->width0;
-            unsigned upload_offset;
-            ret = u_upload_buffer(r300->upload_vb,
-                                  offset, size,
-                                  vb->buffer,
-                                  &upload_offset, &upload_buffer);
-            if (ret)
-                return ret;
-
-            pipe_resource_reference(&vb->buffer, NULL);
-            vb->buffer = upload_buffer;
-            vb->buffer_offset = upload_offset;
+        unsigned index = r300->velems->velem[i].vertex_buffer_index;
+        struct pipe_vertex_buffer *vb = &r300->vertex_buffer[index];
+        struct r300_buffer *userbuf = r300_buffer(vb->buffer);
+
+        if (userbuf && userbuf->user_buffer && !uploaded[index]) {
+            unsigned first, size;
+
+            if (vb->stride) {
+                first = vb->stride * min_index;
+                size = vb->stride * count;
+            } else {
+                first = 0;
+                size = r300->velems->hw_format_size[i];
+            }
+
+            DBG(r300, DBG_UPLOAD,
+                "Uploading %i bytes, index: %i, buffer: %p, userptr: %p "
+                "offset: %i, stride: %i.\n",
+                size, index, userbuf, userbuf->user_buffer,
+                vb->buffer_offset, vb->stride);
+
+            u_upload_data(r300->upload_vb, first, size,
+                          userbuf->user_buffer + first,
+                          &vb->buffer_offset,
+                          &r300->valid_vertex_buffer[index],
+                          &flushed);
+
+            vb->buffer_offset -= first;
+
+            r300->vertex_arrays_dirty = TRUE;
+
+            if (flushed || !r300->upload_vb_validated) {
+                r300->upload_vb_validated = FALSE;
+                r300->validate_buffers = TRUE;
+            }
+            uploaded[index] = TRUE;
+        } else {
+            assert(r300->valid_vertex_buffer[index]);
         }
     }
-    return ret;
+    DBG(r300, DBG_UPLOAD, "-------\n");
 }
 
 static void r300_buffer_destroy(struct pipe_screen *screen,
@@ -136,26 +146,26 @@ static void r300_buffer_destroy(struct pipe_screen *screen,
     if (rbuf->buf)
         rws->buffer_reference(rws, &rbuf->buf, NULL);
 
-    util_mempool_free(&r300screen->pool_buffers, rbuf);
+    util_slab_free(&r300screen->pool_buffers, rbuf);
 }
 
 static struct pipe_transfer*
-r300_default_get_transfer(struct pipe_context *context,
-                          struct pipe_resource *resource,
-                          struct pipe_subresource sr,
-                          unsigned usage,
-                          const struct pipe_box *box)
+r300_buffer_get_transfer(struct pipe_context *context,
+                         struct pipe_resource *resource,
+                         unsigned level,
+                         unsigned usage,
+                         const struct pipe_box *box)
 {
    struct r300_context *r300 = r300_context(context);
    struct pipe_transfer *transfer =
-         util_mempool_malloc(&r300->pool_transfers);
+         util_slab_alloc(&r300->pool_transfers);
 
    transfer->resource = resource;
-   transfer->sr = sr;
+   transfer->level = level;
    transfer->usage = usage;
    transfer->box = *box;
    transfer->stride = 0;
-   transfer->slice_stride = 0;
+   transfer->layer_stride = 0;
    transfer->data = NULL;
 
    /* Note strides are zero, this is ok for buffers, but not for
@@ -164,11 +174,11 @@ r300_default_get_transfer(struct pipe_context *context,
    return transfer;
 }
 
-static void r300_default_transfer_destroy(struct pipe_context *pipe,
-                                          struct pipe_transfer *transfer)
+static void r300_buffer_transfer_destroy(struct pipe_context *pipe,
+                                         struct pipe_transfer *transfer)
 {
    struct r300_context *r300 = r300_context(pipe);
-   util_mempool_free(&r300->pool_transfers, transfer);
+   util_slab_free(&r300->pool_transfers, transfer);
 }
 
 static void *
@@ -180,46 +190,17 @@ r300_buffer_transfer_map( struct pipe_context *pipe,
     struct r300_winsys_screen *rws = r300screen->rws;
     struct r300_buffer *rbuf = r300_buffer(transfer->resource);
     uint8_t *map;
-    boolean flush = FALSE;
-    unsigned i;
 
     if (rbuf->user_buffer)
         return (uint8_t *) rbuf->user_buffer + transfer->box.x;
     if (rbuf->constant_buffer)
         return (uint8_t *) rbuf->constant_buffer + transfer->box.x;
 
-    /* check if the mapping is to a range we already flushed */
-    if (transfer->usage & PIPE_TRANSFER_DISCARD) {
-       for (i = 0; i < rbuf->num_ranges; i++) {
-           if ((transfer->box.x >= rbuf->ranges[i].start) &&
-               (transfer->box.x < rbuf->ranges[i].end))
-               flush = TRUE;
-
-           if (flush) {
-               /* unreference this hw buffer and allocate a new one */
-               rws->buffer_reference(rws, &rbuf->buf, NULL);
-
-               rbuf->num_ranges = 0;
-                rbuf->buf =
-                    r300screen->rws->buffer_create(r300screen->rws,
-                                                   rbuf->b.b.width0, 16,
-                                                   rbuf->b.b.bind,
-                                                   rbuf->b.b.usage,
-                                                   rbuf->domain);
-               break;
-           }
-       }
-    }
-
     map = rws->buffer_map(rws, rbuf->buf, r300->cs, transfer->usage);
 
     if (map == NULL)
         return NULL;
 
-    /* map_buffer() returned a pointer to the beginning of the buffer,
-     * but transfers are expected to return a pointer to just the
-     * region specified in the box.
-     */
     return map + transfer->box.x;
 }
 
@@ -227,30 +208,7 @@ static void r300_buffer_transfer_flush_region( struct pipe_context *pipe,
                                               struct pipe_transfer *transfer,
                                               const struct pipe_box *box)
 {
-    struct r300_buffer *rbuf = r300_buffer(transfer->resource);
-    unsigned i;
-    unsigned offset = transfer->box.x + box->x;
-    unsigned length = box->width;
-
-    assert(box->x + box->width <= transfer->box.width);
-
-    if (rbuf->user_buffer)
-       return;
-    if (rbuf->constant_buffer)
-        return;
-
-    /* mark the range as used */
-    for(i = 0; i < rbuf->num_ranges; ++i) {
-       if(offset <= rbuf->ranges[i].end && rbuf->ranges[i].start <= (offset+box->width)) {
-           rbuf->ranges[i].start = MIN2(rbuf->ranges[i].start, offset);
-           rbuf->ranges[i].end   = MAX2(rbuf->ranges[i].end, (offset+length));
-           return;
-       }
-    }
-
-    rbuf->ranges[rbuf->num_ranges].start = offset;
-    rbuf->ranges[rbuf->num_ranges].end = offset+length;
-    rbuf->num_ranges++;
+    /* no-op */
 }
 
 static void r300_buffer_transfer_unmap( struct pipe_context *pipe,
@@ -265,17 +223,45 @@ static void r300_buffer_transfer_unmap( struct pipe_context *pipe,
     }
 }
 
-struct u_resource_vtbl r300_buffer_vtbl = 
+static void r300_buffer_transfer_inline_write(struct pipe_context *pipe,
+                                              struct pipe_resource *resource,
+                                              unsigned level,
+                                              unsigned usage,
+                                              const struct pipe_box *box,
+                                              const void *data,
+                                              unsigned stride,
+                                              unsigned layer_stride)
+{
+    struct r300_context *r300 = r300_context(pipe);
+    struct r300_winsys_screen *rws = r300->screen->rws;
+    struct r300_buffer *rbuf = r300_buffer(resource);
+    uint8_t *map = NULL;
+
+    if (rbuf->constant_buffer) {
+        memcpy(rbuf->constant_buffer + box->x, data, box->width);
+        return;
+    }
+    assert(rbuf->user_buffer == NULL);
+
+    map = rws->buffer_map(rws, rbuf->buf, r300->cs,
+                          PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | usage);
+
+    memcpy(map + box->x, data, box->width);
+
+    rws->buffer_unmap(rws, rbuf->buf);
+}
+
+struct u_resource_vtbl r300_buffer_vtbl =
 {
    u_default_resource_get_handle,      /* get_handle */
    r300_buffer_destroy,                /* resource_destroy */
    r300_buffer_is_referenced_by_cs,    /* is_buffer_referenced */
-   r300_default_get_transfer,          /* get_transfer */
-   r300_default_transfer_destroy,      /* transfer_destroy */
+   r300_buffer_get_transfer,           /* get_transfer */
+   r300_buffer_transfer_destroy,       /* transfer_destroy */
    r300_buffer_transfer_map,           /* transfer_map */
    r300_buffer_transfer_flush_region,  /* transfer_flush_region */
    r300_buffer_transfer_unmap,         /* transfer_unmap */
-   u_default_transfer_inline_write     /* transfer_inline_write */
+   r300_buffer_transfer_inline_write   /* transfer_inline_write */
 };
 
 struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
@@ -285,7 +271,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
     struct r300_buffer *rbuf;
     unsigned alignment = 16;
 
-    rbuf = util_mempool_malloc(&r300screen->pool_buffers);
+    rbuf = util_slab_alloc(&r300screen->pool_buffers);
 
     rbuf->magic = R300_BUFFER_MAGIC;
 
@@ -294,7 +280,6 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
     pipe_reference_init(&rbuf->b.b.reference, 1);
     rbuf->b.b.screen = screen;
     rbuf->domain = R300_DOMAIN_GTT;
-    rbuf->num_ranges = 0;
     rbuf->buf = NULL;
     rbuf->constant_buffer = NULL;
     rbuf->user_buffer = NULL;
@@ -310,9 +295,11 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
                                        rbuf->b.b.width0, alignment,
                                        rbuf->b.b.bind, rbuf->b.b.usage,
                                        rbuf->domain);
+    rbuf->cs_buf =
+        r300screen->rws->buffer_get_cs_handle(r300screen->rws, rbuf->buf);
 
     if (!rbuf->buf) {
-        util_mempool_free(&r300screen->pool_buffers, rbuf);
+        util_slab_free(&r300screen->pool_buffers, rbuf);
         return NULL;
     }
 
@@ -320,14 +307,13 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
 }
 
 struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
-                                             void *ptr,
-                                             unsigned bytes,
+                                             void *ptr, unsigned size,
                                              unsigned bind)
 {
     struct r300_screen *r300screen = r300_screen(screen);
     struct r300_buffer *rbuf;
 
-    rbuf = util_mempool_malloc(&r300screen->pool_buffers);
+    rbuf = util_slab_alloc(&r300screen->pool_buffers);
 
     rbuf->magic = R300_BUFFER_MAGIC;
 
@@ -338,12 +324,12 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
     rbuf->b.b.format = PIPE_FORMAT_R8_UNORM;
     rbuf->b.b.usage = PIPE_USAGE_IMMUTABLE;
     rbuf->b.b.bind = bind;
-    rbuf->b.b.width0 = bytes;
+    rbuf->b.b.width0 = ~0;
     rbuf->b.b.height0 = 1;
     rbuf->b.b.depth0 = 1;
+    rbuf->b.b.array_size = 1;
     rbuf->b.b.flags = 0;
     rbuf->domain = R300_DOMAIN_GTT;
-    rbuf->num_ranges = 0;
     rbuf->buf = NULL;
     rbuf->constant_buffer = NULL;
     rbuf->user_buffer = ptr;
index cafa9f96f20f957e5f8874541b6baca8b93c1708..58dec8539b668e390ca58518edbf75019fc3ce49 100644 (file)
@@ -51,32 +51,30 @@ struct r300_buffer
     uint32_t magic;
 
     struct r300_winsys_buffer *buf;
+    struct r300_winsys_cs_buffer *cs_buf;
 
     enum r300_buffer_domain domain;
 
-    void *user_buffer;
-    void *constant_buffer;
-    struct r300_buffer_range ranges[R300_BUFFER_MAX_RANGES];
-    unsigned num_ranges;
+    uint8_t *user_buffer;
+    uint8_t *constant_buffer;
 };
 
 /* Functions. */
 
-int r300_upload_user_buffers(struct r300_context *r300);
+void r300_upload_user_buffers(struct r300_context *r300,
+                             int min_index, int max_index);
 
-int r300_upload_index_buffer(struct r300_context *r300,
-                            struct pipe_resource **index_buffer,
-                            unsigned index_size,
-                            unsigned start,
-                            unsigned count, unsigned *out_offset);
+void r300_upload_index_buffer(struct r300_context *r300,
+                             struct pipe_resource **index_buffer,
+                             unsigned index_size, unsigned *start,
+                             unsigned count);
 
 struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
                                         const struct pipe_resource *templ);
 
 struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
-                                             void *ptr,
-                                             unsigned bytes,
-                                             unsigned usage);
+                                             void *ptr, unsigned size,
+                                             unsigned bind);
 
 unsigned r300_buffer_is_referenced(struct pipe_context *context,
                                   struct pipe_resource *buf,
@@ -86,14 +84,10 @@ unsigned r300_buffer_is_referenced(struct pipe_context *context,
 
 static INLINE struct r300_buffer *r300_buffer(struct pipe_resource *buffer)
 {
-    if (buffer) {
-       assert(((struct r300_buffer *)buffer)->magic == R300_BUFFER_MAGIC);
-       return (struct r300_buffer *)buffer;
-    }
-    return NULL;
+    return (struct r300_buffer *)buffer;
 }
 
-static INLINE boolean r300_buffer_is_user_buffer(struct pipe_resource *buffer)
+static INLINE boolean r300_is_user_buffer(struct pipe_resource *buffer)
 {
     return r300_buffer(buffer)->user_buffer ? true : false;
 }
index 247c22216e18806bc573e9958d50b8eb4c0ab355..3a97b76a4c8187bb1532757972c5f22e468c4474 100644 (file)
@@ -52,7 +52,7 @@
 #define UPDATE_STATE(cso, atom) \
     if (cso != atom.state) { \
         atom.state = cso;    \
-        atom.dirty = TRUE;   \
+        r300_mark_atom_dirty(r300, &(atom));   \
     }
 
 static boolean blend_discard_if_src_alpha_0(unsigned srcRGB, unsigned srcA,
@@ -417,7 +417,7 @@ static void r300_set_blend_color(struct pipe_context* pipe,
         END_CB;
     }
 
-    r300->blend_color_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->blend_color_state);
 }
 
 static void r300_set_clip_state(struct pipe_context* pipe,
@@ -446,7 +446,7 @@ static void r300_set_clip_state(struct pipe_context* pipe,
                 (state->depth_clamp ? R300_CLIP_DISABLE : 0));
         END_CB;
 
-        r300->clip_state.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->clip_state);
     } else {
         draw_set_clip_state(r300->draw, state);
     }
@@ -594,7 +594,7 @@ static void r300_bind_dsa_state(struct pipe_context* pipe,
 
     UPDATE_STATE(state, r300->dsa_state);
 
-    r300->hyperz_state.dirty = TRUE; /* Will be updated before the emission. */
+    r300_mark_atom_dirty(r300, &r300->hyperz_state); /* Will be updated before the emission. */
     r300_dsa_inject_stencilref(r300);
 }
 
@@ -613,7 +613,7 @@ static void r300_set_stencil_ref(struct pipe_context* pipe,
     r300->stencil_ref = *sr;
 
     r300_dsa_inject_stencilref(r300);
-    r300->dsa_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->dsa_state);
 }
 
 static void r300_tex_set_tiling_flags(struct r300_context *r300,
@@ -626,7 +626,7 @@ static void r300_tex_set_tiling_flags(struct r300_context *r300,
         /* Tiling determines how DRM treats the buffer data.
          * We must flush CS when changing it if the buffer is referenced. */
         if (r300->rws->cs_is_buffer_referenced(r300->cs,
-                                               tex->buffer, R300_REF_CS))
+                                               tex->cs_buffer, R300_REF_CS))
             r300->context.flush(&r300->context, 0, NULL);
 
         r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
@@ -647,12 +647,12 @@ static void r300_fb_set_tiling_flags(struct r300_context *r300,
     for (i = 0; i < state->nr_cbufs; i++) {
         r300_tex_set_tiling_flags(r300,
                                   r300_texture(state->cbufs[i]->texture),
-                                  state->cbufs[i]->level);
+                                  state->cbufs[i]->u.tex.level);
     }
     if (state->zsbuf) {
         r300_tex_set_tiling_flags(r300,
                                   r300_texture(state->zsbuf->texture),
-                                  state->zsbuf->level);
+                                  state->zsbuf->u.tex.level);
     }
 }
 
@@ -663,14 +663,14 @@ static void r300_print_fb_surf_info(struct pipe_surface *surf, unsigned index,
     struct r300_texture *rtex = r300_texture(tex);
 
     fprintf(stderr,
-            "r300:   %s[%i] Dim: %ix%i, Offset: %i, ZSlice: %i, "
-            "Face: %i, Level: %i, Format: %s\n"
+            "r300:   %s[%i] Dim: %ix%i, Firstlayer: %i, "
+            "Lastlayer: %i, Level: %i, Format: %s\n"
 
             "r300:     TEX: Macro: %s, Micro: %s, Pitch: %i, "
             "Dim: %ix%ix%i, LastLevel: %i, Format: %s\n",
 
-            binding, index, surf->width, surf->height, surf->offset,
-            surf->zslice, surf->face, surf->level,
+            binding, index, surf->width, surf->height,
+            surf->u.tex.first_layer, surf->u.tex.last_layer, surf->u.tex.level,
             util_format_short_name(surf->format),
 
             rtex->desc.macrotile[0] ? "YES" : " NO",
@@ -686,14 +686,23 @@ void r300_mark_fb_state_dirty(struct r300_context *r300,
     struct pipe_framebuffer_state *state = r300->fb_state.state;
     boolean can_hyperz = r300->rws->get_value(r300->rws, R300_CAN_HYPERZ);
 
-    /* What is marked as dirty depends on the enum r300_fb_state_change. */
-    r300->gpu_flush.dirty = TRUE;
-    r300->fb_state.dirty = TRUE;
-    r300->hyperz_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->gpu_flush);
+    r300_mark_atom_dirty(r300, &r300->fb_state);
 
+    /* What is marked as dirty depends on the enum r300_fb_state_change. */
     if (change == R300_CHANGED_FB_STATE) {
-        r300->aa_state.dirty = TRUE;
-        r300->fb_state_pipelined.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->aa_state);
+    }
+
+    if (change == R300_CHANGED_FB_STATE ||
+        change == R300_CHANGED_CBZB_FLAG ||
+        change == R300_CHANGED_ZCLEAR_FLAG) {
+        r300_mark_atom_dirty(r300, &r300->hyperz_state);
+    }
+
+    if (change == R300_CHANGED_FB_STATE ||
+        change == R300_CHANGED_MULTIWRITE) {
+        r300_mark_atom_dirty(r300, &r300->fb_state_pipelined);
     }
 
     /* Now compute the fb_state atom size. */
@@ -738,11 +747,11 @@ static void
 
     /* If nr_cbufs is changed from zero to non-zero or vice versa... */
     if (!!old_state->nr_cbufs != !!state->nr_cbufs) {
-        r300->blend_state.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->blend_state);
     }
     /* If zsbuf is set from NULL to non-NULL or vice versa.. */
     if (!!old_state->zsbuf != !!state->zsbuf) {
-        r300->dsa_state.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->dsa_state);
     }
 
     /* The tiling flags are dependent on the surface miplevel, unfortunately. */
@@ -751,6 +760,7 @@ static void
     util_copy_framebuffer_state(r300->fb_state.state, state);
 
     r300_mark_fb_state_dirty(r300, R300_CHANGED_FB_STATE);
+    r300->validate_buffers = TRUE;
 
     r300->z_compression = false;
     
@@ -768,7 +778,7 @@ static void
             struct r300_surface *zs_surf = r300_surface(state->zsbuf);
             struct r300_texture *tex;
             int compress = r300->screen->caps.is_rv350 ? RV350_Z_COMPRESS_88 : R300_Z_COMPRESS_44;
-            int level = zs_surf->base.level;
+            int level = zs_surf->base.u.tex.level;
 
             tex = r300_texture(zs_surf->base.texture);
 
@@ -795,7 +805,7 @@ static void
             r300->zbuffer_bpp = zbuffer_bpp;
 
             if (r300->polygon_offset_enabled)
-                r300->rs_state.dirty = TRUE;
+                r300_mark_atom_dirty(r300, &r300->rs_state);
         }
     }
 
@@ -853,9 +863,9 @@ void r300_mark_fs_code_dirty(struct r300_context *r300)
 {
     struct r300_fragment_shader* fs = r300_fs(r300);
 
-    r300->fs.dirty = TRUE;
-    r300->fs_rc_constant_state.dirty = TRUE;
-    r300->fs_constants.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->fs);
+    r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
+    r300_mark_atom_dirty(r300, &r300->fs_constants);
     r300->fs.size = fs->shader->cb_code_size;
 
     if (r300->screen->caps.is_r500) {
@@ -875,17 +885,26 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
 {
     struct r300_context* r300 = r300_context(pipe);
     struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader;
+    struct pipe_framebuffer_state *fb = r300->fb_state.state;
+    boolean last_multi_write;
 
     if (fs == NULL) {
         r300->fs.state = NULL;
         return;
     }
 
+    last_multi_write = r300_fragment_shader_writes_all(r300_fs(r300));
+
     r300->fs.state = fs;
     r300_pick_fragment_shader(r300);
     r300_mark_fs_code_dirty(r300);
 
-    r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */
+    if (fb->nr_cbufs > 1 &&
+        last_multi_write != r300_fragment_shader_writes_all(fs)) {
+        r300_mark_fb_state_dirty(r300, R300_CHANGED_MULTIWRITE);
+    }
+
+    r300_mark_atom_dirty(r300, &r300->rs_block_state); /* Will be updated before the emission. */
 }
 
 /* Delete fragment shader state. */
@@ -1137,7 +1156,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
 
     if (last_sprite_coord_enable != r300->sprite_coord_enable ||
         last_two_sided_color != r300->two_sided_color) {
-        r300->rs_block_state.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->rs_block_state);
     }
 }
 
@@ -1235,7 +1254,7 @@ static void r300_bind_sampler_states(struct pipe_context* pipe,
     memcpy(state->sampler_states, states, sizeof(void*) * count);
     state->sampler_state_count = count;
 
-    r300->textures_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->textures_state);
 }
 
 static void r300_lacks_vertex_textures(struct pipe_context* pipe,
@@ -1297,29 +1316,27 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
     }
 
     for (i = 0; i < count; i++) {
-        if (&state->sampler_views[i]->base != views[i]) {
-            pipe_sampler_view_reference(
-                    (struct pipe_sampler_view**)&state->sampler_views[i],
-                    views[i]);
+        pipe_sampler_view_reference(
+                (struct pipe_sampler_view**)&state->sampler_views[i],
+                views[i]);
 
-            if (!views[i]) {
-                continue;
-            }
+        if (!views[i]) {
+            continue;
+        }
 
-            /* A new sampler view (= texture)... */
-            dirty_tex = TRUE;
+        /* A new sampler view (= texture)... */
+        dirty_tex = TRUE;
 
-            /* Set the texrect factor in the fragment shader.
+        /* Set the texrect factor in the fragment shader.
              * Needed for RECT and NPOT fallback. */
-            texture = r300_texture(views[i]->texture);
-            if (texture->desc.is_npot) {
-                r300->fs_rc_constant_state.dirty = TRUE;
-            }
+        texture = r300_texture(views[i]->texture);
+        if (texture->desc.is_npot) {
+            r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
+        }
 
-            state->sampler_views[i]->texcache_region =
+        state->sampler_views[i]->texcache_region =
                 r300_assign_texture_cache_region(view_index, real_num_views);
-            view_index++;
-        }
+        view_index++;
     }
 
     for (i = count; i < tex_units; i++) {
@@ -1332,10 +1349,11 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
 
     state->sampler_view_count = count;
 
-    r300->textures_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->textures_state);
+    r300->validate_buffers = TRUE;
 
     if (dirty_tex) {
-        r300->texture_cache_inval.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->texture_cache_inval);
     }
 }
 
@@ -1347,6 +1365,7 @@ r300_create_sampler_view(struct pipe_context *pipe,
     struct r300_sampler_view *view = CALLOC_STRUCT(r300_sampler_view);
     struct r300_texture *tex = r300_texture(texture);
     boolean is_r500 = r300_screen(pipe->screen)->caps.is_r500;
+    boolean dxtc_swizzle = r300_screen(pipe->screen)->caps.dxtc_swizzle;
 
     if (view) {
         view->base = *templ;
@@ -1363,7 +1382,8 @@ r300_create_sampler_view(struct pipe_context *pipe,
         view->format = tex->tx_format;
         view->format.format1 |= r300_translate_texformat(templ->format,
                                                          view->swizzle,
-                                                         is_r500);
+                                                         is_r500,
+                                                         dxtc_swizzle);
         if (is_r500) {
             view->format.format2 |= r500_tx_format_msb_bit(templ->format);
         }
@@ -1388,7 +1408,7 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
     memcpy(r300->scissor_state.state, state,
         sizeof(struct pipe_scissor_state));
 
-    r300->scissor_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->scissor_state);
 }
 
 static void r300_set_viewport_state(struct pipe_context* pipe,
@@ -1434,9 +1454,9 @@ static void r300_set_viewport_state(struct pipe_context* pipe,
         viewport->vte_control |= R300_VPORT_Z_OFFSET_ENA;
     }
 
-    r300->viewport_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->viewport_state);
     if (r300->fs.state && r300_fs(r300)->shader->inputs.wpos != ATTR_UNUSED) {
-        r300->fs_rc_constant_state.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
     }
 }
 
@@ -1445,15 +1465,15 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
                                     const struct pipe_vertex_buffer* buffers)
 {
     struct r300_context* r300 = r300_context(pipe);
-    struct pipe_vertex_buffer *vbo;
+    const struct pipe_vertex_buffer *vbo;
     unsigned i, max_index = (1 << 24) - 1;
     boolean any_user_buffer = FALSE;
+    boolean any_nonuser_buffer = FALSE;
     struct pipe_vertex_buffer dummy_vb = {0};
 
     /* There must be at least one vertex buffer set, otherwise it locks up. */
     if (!count) {
         dummy_vb.buffer = r300->dummy_vb;
-        dummy_vb.max_index = r300->dummy_vb->width0 / 4;
         buffers = &dummy_vb;
         count = 1;
     }
@@ -1480,34 +1500,41 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
         }
 
         for (i = 0; i < count; i++) {
-            /* Why, yes, I AM casting away constness. How did you know? */
-            vbo = (struct pipe_vertex_buffer*)&buffers[i];
+            vbo = &buffers[i];
 
             /* Skip NULL buffers */
-            if (!buffers[i].buffer) {
+            if (!vbo->buffer) {
                 continue;
             }
 
-            if (r300_buffer_is_user_buffer(vbo->buffer)) {
+            /* User buffers have no info about maximum index,
+             * we will have to compute it in draw_vbo. */
+            if (r300_is_user_buffer(vbo->buffer)) {
                 any_user_buffer = TRUE;
+                continue;
             }
+            any_nonuser_buffer = TRUE;
 
-            if (vbo->max_index == ~0) {
-                /* if no VBO stride then only one vertex value so max index is 1 */
-                /* should think about converting to VS constants like svga does */
-                if (!vbo->stride)
-                    vbo->max_index = 1;
-                else
-                    vbo->max_index =
-                             (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride;
-            }
+            /* The stride of zero means we will be fetching only the first
+             * vertex, so don't care about max_index. */
+            if (!vbo->stride)
+                continue;
 
-            max_index = MIN2(vbo->max_index, max_index);
+            /* Update the maximum index. */
+            {
+                unsigned vbo_max_index =
+                      (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride;
+                max_index = MIN2(max_index, vbo_max_index);
+            }
         }
 
         r300->any_user_vbs = any_user_buffer;
         r300->vertex_buffer_max_index = max_index;
-
+        r300->vertex_arrays_dirty = TRUE;
+        if (any_nonuser_buffer)
+            r300->validate_buffers = TRUE;
+        if (!any_user_buffer)
+            r300->upload_vb_validated = FALSE;
     } else {
         /* SW TCL. */
         draw_set_vertex_buffers(r300->draw, count, buffers);
@@ -1515,16 +1542,25 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
 
     /* Common code. */
     for (i = 0; i < count; i++) {
+        vbo = &buffers[i];
+
         /* Reference our buffer. */
-        pipe_resource_reference(&r300->vertex_buffer[i].buffer, buffers[i].buffer);
+        pipe_resource_reference(&r300->vertex_buffer[i].buffer, vbo->buffer);
+        if (vbo->buffer && r300_is_user_buffer(vbo->buffer)) {
+            pipe_resource_reference(&r300->valid_vertex_buffer[i], NULL);
+        } else {
+            pipe_resource_reference(&r300->valid_vertex_buffer[i], vbo->buffer);
+        }
     }
     for (; i < r300->vertex_buffer_count; i++) {
         /* Dereference any old buffers. */
         pipe_resource_reference(&r300->vertex_buffer[i].buffer, NULL);
+        pipe_resource_reference(&r300->valid_vertex_buffer[i], NULL);
     }
 
     memcpy(r300->vertex_buffer, buffers,
-        sizeof(struct pipe_vertex_buffer) * count);
+           sizeof(struct pipe_vertex_buffer) * count);
+
     r300->vertex_buffer_count = count;
 }
 
@@ -1533,20 +1569,23 @@ static void r300_set_index_buffer(struct pipe_context* pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
 
-    if (ib) {
+    if (ib && ib->buffer) {
         pipe_resource_reference(&r300->index_buffer.buffer, ib->buffer);
         memcpy(&r300->index_buffer, ib, sizeof(r300->index_buffer));
+
+        if (r300->screen->caps.has_tcl &&
+            !r300_is_user_buffer(ib->buffer)) {
+            r300->validate_buffers = TRUE;
+            r300->upload_ib_validated = FALSE;
+        }
     }
     else {
         pipe_resource_reference(&r300->index_buffer.buffer, NULL);
         memset(&r300->index_buffer, 0, sizeof(r300->index_buffer));
     }
 
-    if (r300->screen->caps.has_tcl) {
-       /* TODO make this more like a state */
-    }
-    else {
-       draw_set_index_buffer(r300->draw, ib);
+    if (!r300->screen->caps.has_tcl) {
+        draw_set_index_buffer(r300->draw, ib);
     }
 }
 
@@ -1714,6 +1753,7 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
 
     UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);
     r300->vertex_stream_state.size = (1 + velems->vertex_stream.count) * 2;
+    r300->vertex_arrays_dirty = TRUE;
 }
 
 static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
@@ -1756,27 +1796,25 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
     r300->vs_state.state = vs;
 
     /* The majority of the RS block bits is dependent on the vertex shader. */
-    r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */
+    r300_mark_atom_dirty(r300, &r300->rs_block_state); /* Will be updated before the emission. */
 
     if (r300->screen->caps.has_tcl) {
         unsigned fc_op_dwords = r300->screen->caps.is_r500 ? 3 : 2;
-        r300->vs_state.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->vs_state);
         r300->vs_state.size =
                 vs->code.length + 9 +
-                (vs->immediates_count ? vs->immediates_count * 4 + 3 : 0) +
         (vs->code.num_fc_ops ? vs->code.num_fc_ops * fc_op_dwords + 4 : 0);
 
-        if (vs->externals_count) {
-            r300->vs_constants.dirty = TRUE;
-            r300->vs_constants.size = vs->externals_count * 4 + 3;
-        } else {
-            r300->vs_constants.size = 0;
-        }
+        r300_mark_atom_dirty(r300, &r300->vs_constants);
+        r300->vs_constants.size =
+                2 +
+                (vs->externals_count ? vs->externals_count * 4 + 3 : 0) +
+                (vs->immediates_count ? vs->immediates_count * 4 + 3 : 0);
 
         ((struct r300_constant_buffer*)r300->vs_constants.state)->remap_table =
                 vs->code.constants_remap_table;
 
-        r300->pvs_flush.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->pvs_flush);
     } else {
         draw_bind_vertex_shader(r300->draw,
                 (struct draw_vertex_shader*)vs->draw_vs);
@@ -1807,6 +1845,7 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
     struct r300_constant_buffer *cbuf;
+    struct r300_buffer *rbuf = r300_buffer(buf);
     uint32_t *mapped;
 
     switch (shader) {
@@ -1817,33 +1856,48 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
             cbuf = (struct r300_constant_buffer*)r300->fs_constants.state;
             break;
         default:
-            assert(0);
             return;
     }
 
-    if (buf == NULL || buf->width0 == 0 ||
-        (mapped = r300_buffer(buf)->constant_buffer) == NULL) {
+    if (buf == NULL || buf->width0 == 0)
+        return;
+
+    if (rbuf->user_buffer)
+        mapped = (uint32_t*)rbuf->user_buffer;
+    else if (rbuf->constant_buffer)
+        mapped = (uint32_t*)rbuf->constant_buffer;
+    else
         return;
-    }
 
     if (shader == PIPE_SHADER_FRAGMENT ||
         (shader == PIPE_SHADER_VERTEX && r300->screen->caps.has_tcl)) {
-        assert((buf->width0 % (4 * sizeof(float))) == 0);
-        cbuf->ptr = mapped + index*4;
+        cbuf->ptr = mapped;
     }
 
     if (shader == PIPE_SHADER_VERTEX) {
         if (r300->screen->caps.has_tcl) {
-            if (r300->vs_constants.size) {
-                r300->vs_constants.dirty = TRUE;
+            struct r300_vertex_shader *vs =
+                    (struct r300_vertex_shader*)r300->vs_state.state;
+
+            if (!vs) {
+                cbuf->buffer_base = 0;
+                return;
+            }
+
+            cbuf->buffer_base = r300->vs_const_base;
+            r300->vs_const_base += vs->code.constants.Count;
+            if (r300->vs_const_base > R500_MAX_PVS_CONST_VECS) {
+                r300->vs_const_base = vs->code.constants.Count;
+                cbuf->buffer_base = 0;
+                r300_mark_atom_dirty(r300, &r300->pvs_flush);
             }
-            r300->pvs_flush.dirty = TRUE;
+            r300_mark_atom_dirty(r300, &r300->vs_constants);
         } else if (r300->draw) {
             draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX,
                 0, mapped, buf->width0);
         }
     } else if (shader == PIPE_SHADER_FRAGMENT) {
-        r300->fs_constants.dirty = TRUE;
+        r300_mark_atom_dirty(r300, &r300->fs_constants);
     }
 }
 
index 1cff3483b50c6a1e0ad9f9c0708851dce259762b..95be7849f8f976380a366d5e105e5b99519a9288 100644 (file)
@@ -32,7 +32,6 @@
 #include "r300_hyperz.h"
 #include "r300_screen.h"
 #include "r300_shader_semantics.h"
-#include "r300_state_derived.h"
 #include "r300_state_inlines.h"
 #include "r300_texture.h"
 #include "r300_vs.h"
@@ -193,7 +192,7 @@ static void r300_swtcl_vertex_psc(struct r300_context *r300)
         (R300_LAST_VEC << (i & 1 ? 16 : 0));
 
     vstream->count = (i >> 1) + 1;
-    r300->vertex_stream_state.dirty = TRUE;
+    r300_mark_atom_dirty(r300, &r300->vertex_stream_state);
     r300->vertex_stream_state.size = (1 + vstream->count) * 2;
 }
 
@@ -592,7 +591,8 @@ static void r300_update_rs_block(struct r300_context *r300)
 }
 
 static uint32_t r300_get_border_color(enum pipe_format format,
-                                      const float border[4])
+                                      const float border[4],
+                                      boolean is_r500)
 {
     const struct util_format_description *desc;
     float border_swizzled[4] = {0};
@@ -601,6 +601,24 @@ static uint32_t r300_get_border_color(enum pipe_format format,
 
     desc = util_format_description(format);
 
+    /* Do depth formats first. */
+    if (util_format_is_depth_or_stencil(format)) {
+        switch (format) {
+        case PIPE_FORMAT_Z16_UNORM:
+            return util_pack_z(PIPE_FORMAT_Z16_UNORM, border[0]);
+        case PIPE_FORMAT_X8Z24_UNORM:
+        case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+            if (is_r500) {
+                return util_pack_z(PIPE_FORMAT_X8Z24_UNORM, border[0]);
+            } else {
+                return util_pack_z(PIPE_FORMAT_Z16_UNORM, border[0]) << 16;
+            }
+        default:
+            assert(0);
+            return 0;
+        }
+    }
+
     /* Apply inverse swizzle of the format. */
     for (i = 0; i < 4; i++) {
         switch (desc->swizzle[i]) {
@@ -619,7 +637,17 @@ static uint32_t r300_get_border_color(enum pipe_format format,
         }
     }
 
+    /* Compressed formats. */
+    if (util_format_is_compressed(format)) {
+        util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
+        return uc.ui;
+    }
+
     switch (desc->channel[0].size) {
+        case 2:
+            util_pack_color(border_swizzled, PIPE_FORMAT_B2G3R3_UNORM, &uc);
+            break;
+
         case 4:
             util_pack_color(border_swizzled, PIPE_FORMAT_B4G4R4A4_UNORM, &uc);
             break;
@@ -642,6 +670,15 @@ static uint32_t r300_get_border_color(enum pipe_format format,
         case 10:
             util_pack_color(border_swizzled, PIPE_FORMAT_B10G10R10A2_UNORM, &uc);
             break;
+
+        case 16:
+            if (desc->nr_channels <= 2) {
+                border_swizzled[0] = border_swizzled[2];
+                util_pack_color(border_swizzled, PIPE_FORMAT_R16G16_UNORM, &uc);
+            } else {
+                util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+            }
+            break;
     }
 
     return uc.ui;
@@ -683,12 +720,13 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
             /* Set the border color. */
             texstate->border_color =
                 r300_get_border_color(view->base.format,
-                                      sampler->state.border_color);
+                                      sampler->state.border_color,
+                                      r300->screen->caps.is_r500);
 
             /* determine min/max levels */
-            max_level = MIN3(sampler->max_lod + view->base.first_level,
-                             tex->desc.b.b.last_level, view->base.last_level);
-            min_level = MIN2(sampler->min_lod + view->base.first_level,
+            max_level = MIN3(sampler->max_lod + view->base.u.tex.first_level,
+                             tex->desc.b.b.last_level, view->base.u.tex.last_level);
+            min_level = MIN2(sampler->min_lod + view->base.u.tex.first_level,
                              max_level);
 
             if (tex->desc.is_npot && min_level > 0) {
@@ -729,13 +767,18 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
                 if (sampler->state.compare_mode == PIPE_TEX_COMPARE_NONE) {
                     texstate->format.format1 |=
                         r300_get_swizzle_combined(depth_swizzle,
-                                                  view->swizzle);
+                                                  view->swizzle, FALSE);
                 } else {
                     texstate->format.format1 |=
-                        r300_get_swizzle_combined(depth_swizzle, 0);
+                        r300_get_swizzle_combined(depth_swizzle, 0, FALSE);
                 }
             }
 
+            if (r300->screen->caps.dxtc_swizzle &&
+                util_format_is_compressed(tex->desc.b.b.format)) {
+                texstate->filter1 |= R400_DXTC_SWIZZLE_ENABLE;
+            }
+
             /* to emulate 1D textures through 2D ones correctly */
             if (tex->desc.b.b.target == PIPE_TEXTURE_1D) {
                 texstate->filter0 &= ~R300_TX_WRAP_T_MASK;
@@ -819,40 +862,6 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
     }
 }
 
-/* We can't use compressed zbuffers as samplers. */
-static void r300_flush_depth_textures(struct r300_context *r300)
-{
-    struct r300_textures_state *state =
-        (struct r300_textures_state*)r300->textures_state.state;
-    unsigned i, level;
-    unsigned count = MIN2(state->sampler_view_count,
-                          state->sampler_state_count);
-
-    if (r300->z_decomp_rd)
-        return;
-
-    for (i = 0; i < count; i++)
-        if (state->sampler_views[i] && state->sampler_states[i]) {
-            struct pipe_resource *tex = state->sampler_views[i]->base.texture;
-
-            if (tex->target == PIPE_TEXTURE_3D ||
-                tex->target == PIPE_TEXTURE_CUBE)
-                continue;
-
-            /* Ignore non-depth textures.
-             * Also ignore reinterpreted depth textures, e.g. resource_copy. */
-            if (!util_format_is_depth_or_stencil(tex->format))
-                continue;
-
-            for (level = 0; level <= tex->last_level; level++)
-                if (r300_texture(tex)->zmask_in_use[level]) {
-                    /* We don't handle 3D textures and cubemaps yet. */
-                    r300_flush_depth_stencil(&r300->context, tex,
-                                             u_subresource(0, level), 0);
-                }
-        }
-}
-
 void r300_update_derived_state(struct r300_context* r300)
 {
     r300_flush_depth_textures(r300);
diff --git a/src/gallium/drivers/r300/r300_state_derived.h b/src/gallium/drivers/r300/r300_state_derived.h
deleted file mode 100644 (file)
index 71a4a47..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#ifndef R300_STATE_DERIVED_H
-#define R300_STATE_DERIVED_H
-
-struct r300_context;
-
-void r300_update_derived_state(struct r300_context* r300);
-
-#endif /* R300_STATE_DERIVED_H */
index cee56bccdcd24de47230929cfc413e1b264c84e2..6fdc504ed5401b8f48176f962b6a95cb351f79c5 100644 (file)
@@ -40,7 +40,8 @@
 #include "pipe/p_screen.h"
 
 unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
-                                   const unsigned char *swizzle_view)
+                                   const unsigned char *swizzle_view,
+                                   boolean dxtc_swizzle)
 {
     unsigned i;
     unsigned char swizzle[4];
@@ -51,10 +52,10 @@ unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
         R300_TX_FORMAT_B_SHIFT,
         R300_TX_FORMAT_A_SHIFT
     };
-    const uint32_t swizzle_bit[4] = {
-        R300_TX_FORMAT_X,
+    uint32_t swizzle_bit[4] = {
+        dxtc_swizzle ? R300_TX_FORMAT_Z : R300_TX_FORMAT_X,
         R300_TX_FORMAT_Y,
-        R300_TX_FORMAT_Z,
+        dxtc_swizzle ? R300_TX_FORMAT_X : R300_TX_FORMAT_Z,
         R300_TX_FORMAT_W
     };
 
@@ -107,7 +108,8 @@ unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
  * makes available X, Y, Z, W, ZERO, and ONE for swizzling. */
 uint32_t r300_translate_texformat(enum pipe_format format,
                                   const unsigned char *swizzle_view,
-                                  boolean is_r500)
+                                  boolean is_r500,
+                                  boolean dxtc_swizzle)
 {
     uint32_t result = 0;
     const struct util_format_description *desc;
@@ -169,7 +171,8 @@ uint32_t r300_translate_texformat(enum pipe_format format,
             }
     }
 
-    result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view);
+    result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view,
+                    util_format_is_compressed(format) && dxtc_swizzle);
 
     /* S3TC formats. */
     if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
@@ -241,6 +244,11 @@ uint32_t r300_translate_texformat(enum pipe_format format,
                     desc->channel[2].size == 6) {
                     return R300_TX_FORMAT_Z6Y5X5 | result;
                 }
+                if (desc->channel[0].size == 2 &&
+                    desc->channel[1].size == 3 &&
+                    desc->channel[2].size == 3) {
+                    return R300_TX_FORMAT_Z3Y3X2 | result;
+                }
                 return ~0; /* Unsupported/unknown. */
 
             case 4:
@@ -478,6 +486,8 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
     } else {
         if (desc->channel[i].size == 16) {
             modifier |= R300_US_OUT_FMT_C4_16;
+        } else if (desc->channel[i].size == 10) {
+            modifier |= R300_US_OUT_FMT_C4_10;
         } else {
             /* C4_8 seems to be used for the formats whose pixel size
              * is <= 32 bits. */
@@ -571,7 +581,7 @@ boolean r300_is_zs_format_supported(enum pipe_format format)
 
 boolean r300_is_sampler_format_supported(enum pipe_format format)
 {
-    return r300_translate_texformat(format, 0, TRUE) != ~0;
+    return r300_translate_texformat(format, 0, TRUE, FALSE) != ~0;
 }
 
 void r300_texture_setup_format_state(struct r300_screen *screen,
@@ -665,21 +675,21 @@ void r300_texture_reinterpret_format(struct pipe_screen *screen,
 }
 
 static unsigned r300_texture_is_referenced(struct pipe_context *context,
-                                        struct pipe_resource *texture,
-                                        unsigned face, unsigned level)
+                                           struct pipe_resource *texture,
+                                           unsigned level, int layer)
 {
     struct r300_context *r300 = r300_context(context);
     struct r300_texture *rtex = (struct r300_texture *)texture;
 
     if (r300->rws->cs_is_buffer_referenced(r300->cs,
-                                           rtex->buffer, R300_REF_CS))
+                                           rtex->cs_buffer, R300_REF_CS))
         return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
 
     return PIPE_UNREFERENCED;
 }
 
 static void r300_texture_destroy(struct pipe_screen *screen,
-                                struct pipe_resource* texture)
+                                 struct pipe_resource* texture)
 {
     struct r300_texture* tex = (struct r300_texture*)texture;
     struct r300_winsys_screen *rws = (struct r300_winsys_screen *)texture->screen->winsys;
@@ -774,6 +784,8 @@ r300_texture_create_object(struct r300_screen *rscreen,
         }
     }
 
+    tex->cs_buffer = rws->buffer_get_cs_handle(rws, tex->buffer);
+
     rws->buffer_set_tiling(rws, tex->buffer,
             tex->desc.microtile, tex->desc.macrotile[0],
             tex->desc.stride_in_bytes[0]);
@@ -848,38 +860,40 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
 
 /* Not required to implement u_resource_vtbl, consider moving to another file:
  */
-struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
-                                          struct pipe_resource* texture,
-                                         unsigned face,
-                                         unsigned level,
-                                         unsigned zslice,
-                                         unsigned flags)
+struct pipe_surface* r300_create_surface(struct pipe_context * ctx,
+                                         struct pipe_resource* texture,
+                                         const struct pipe_surface *surf_tmpl)
 {
     struct r300_texture* tex = r300_texture(texture);
     struct r300_surface* surface = CALLOC_STRUCT(r300_surface);
+    unsigned level = surf_tmpl->u.tex.level;
+
+    assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
 
     if (surface) {
         uint32_t offset, tile_height;
 
         pipe_reference_init(&surface->base.reference, 1);
         pipe_resource_reference(&surface->base.texture, texture);
-        surface->base.format = texture->format;
+        surface->base.context = ctx;
+        surface->base.format = surf_tmpl->format;
         surface->base.width = u_minify(texture->width0, level);
         surface->base.height = u_minify(texture->height0, level);
-        surface->base.usage = flags;
-        surface->base.zslice = zslice;
-        surface->base.face = face;
-        surface->base.level = level;
+        surface->base.usage = surf_tmpl->usage;
+        surface->base.u.tex.level = level;
+        surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+        surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
 
         surface->buffer = tex->buffer;
+        surface->cs_buffer = tex->cs_buffer;
 
         /* Prefer VRAM if there are multiple domains to choose from. */
         surface->domain = tex->domain;
         if (surface->domain & R300_DOMAIN_VRAM)
             surface->domain &= ~R300_DOMAIN_GTT;
 
-        surface->offset = r300_texture_get_offset(&tex->desc,
-                                                  level, zslice, face);
+        surface->offset = r300_texture_get_offset(&tex->desc, level,
+                                                  surf_tmpl->u.tex.first_layer);
         surface->pitch = tex->fb_state.pitch[level];
         surface->format = tex->fb_state.format;
 
@@ -892,7 +906,7 @@ struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
                                                tex->desc.b.b.nr_samples,
                                                tex->desc.microtile,
                                                tex->desc.macrotile[level],
-                                               DIM_HEIGHT);
+                                               DIM_HEIGHT, 0);
 
         surface->cbzb_height = align((surface->base.height + 1) / 2,
                                      tile_height);
@@ -910,13 +924,13 @@ struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
         else
             surface->cbzb_format = R300_DEPTHFORMAT_16BIT_INT_Z;
 
-        SCREEN_DBG(r300_screen(screen), DBG_CBZB,
-                   "CBZB Allowed: %s, Dim: %ix%i, Misalignment: %i, Micro: %s, Macro: %s\n",
-                   surface->cbzb_allowed ? "YES" : " NO",
-                   surface->cbzb_width, surface->cbzb_height,
-                   offset & 2047,
-                   tex->desc.microtile ? "YES" : " NO",
-                   tex->desc.macrotile[level] ? "YES" : " NO");
+        DBG(r300_context(ctx), DBG_CBZB,
+            "CBZB Allowed: %s, Dim: %ix%i, Misalignment: %i, Micro: %s, Macro: %s\n",
+            surface->cbzb_allowed ? "YES" : " NO",
+            surface->cbzb_width, surface->cbzb_height,
+            offset & 2047,
+            tex->desc.microtile ? "YES" : " NO",
+            tex->desc.macrotile[level] ? "YES" : " NO");
     }
 
     return &surface->base;
@@ -924,7 +938,7 @@ struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
 
 /* Not required to implement u_resource_vtbl, consider moving to another file:
  */
-void r300_tex_surface_destroy(struct pipe_surface* s)
+void r300_surface_destroy(struct pipe_context *ctx, struct pipe_surface* s)
 {
     pipe_resource_reference(&s->texture, NULL);
     FREE(s);
index c4588a0c90b7852dd7bf07fea939a1ca6360e285..0ab22f747e4c8814ce3395ad4acfc4133844ccdf 100644 (file)
@@ -27,6 +27,7 @@
 #include "pipe/p_format.h"
 
 struct pipe_screen;
+struct pipe_context;
 struct pipe_resource;
 struct winsys_handle;
 struct r300_texture_format_state;
@@ -35,11 +36,13 @@ struct r300_texture;
 struct r300_screen;
 
 unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
-                                   const unsigned char *swizzle_view);
+                                   const unsigned char *swizzle_view,
+                                   boolean dxtc_swizzle);
 
 uint32_t r300_translate_texformat(enum pipe_format format,
                                   const unsigned char *swizzle_view,
-                                  boolean is_r500);
+                                  boolean is_r500,
+                                  boolean dxtc_swizzle);
 
 uint32_t r500_tx_format_msb_bit(enum pipe_format format);
 
@@ -68,13 +71,10 @@ r300_texture_create(struct pipe_screen* screen,
                    const struct pipe_resource* templ);
 
 
-struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
-                                         struct pipe_resource* texture,
-                                         unsigned face,
-                                         unsigned level,
-                                         unsigned zslice,
-                                         unsigned flags);
+struct pipe_surface* r300_create_surface(struct pipe_context *ctx,
+                                         struct pipe_resource* texture,
+                                         const struct pipe_surface *surf_tmpl);
 
-void r300_tex_surface_destroy(struct pipe_surface* s);
+void r300_surface_destroy(struct pipe_context *ctx, struct pipe_surface* s);
 
 #endif /* R300_TEXTURE_H */
index 543d0fdc15b91cbad74fde72c600f9d955f1263a..7b1739142d49083f97f88b7734fe70feb3c21317 100644 (file)
@@ -34,7 +34,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format,
                                   unsigned num_samples,
                                   enum r300_buffer_tiling microtile,
                                   enum r300_buffer_tiling macrotile,
-                                  enum r300_dim dim)
+                                  enum r300_dim dim, boolean is_rs690)
 {
     static const unsigned table[2][5][3][2] =
     {
@@ -57,6 +57,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format,
             {{ 16, 8}, { 0,  0}, { 0,  0}}  /* 128 bits per pixel */
         }
     };
+
     static const unsigned aa_block[2] = {4, 8};
     unsigned tile = 0;
     unsigned pixsize = util_format_get_blocksize(format);
@@ -74,6 +75,14 @@ unsigned r300_get_pixel_alignment(enum pipe_format format,
     } else {
         /* Standard alignment. */
         tile = table[macrotile][util_logbase2(pixsize)][microtile][dim];
+        if (macrotile == 0 && is_rs690 && dim == DIM_WIDTH) {
+            int align;
+            int h_tile;
+            h_tile = table[macrotile][util_logbase2(pixsize)][microtile][DIM_HEIGHT];
+            align = 64 / (pixsize * h_tile);
+            if (tile < align)
+                tile = align;
+        }
     }
 
     assert(tile);
@@ -89,7 +98,7 @@ static boolean r300_texture_macro_switch(struct r300_texture_desc *desc,
     unsigned tile, texdim;
 
     tile = r300_get_pixel_alignment(desc->b.b.format, desc->b.b.nr_samples,
-                                    desc->microtile, R300_BUFFER_TILED, dim);
+                                    desc->microtile, R300_BUFFER_TILED, dim, 0);
     if (dim == DIM_WIDTH) {
         texdim = u_minify(desc->width0, level);
     } else {
@@ -113,6 +122,9 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen,
                                         unsigned level)
 {
     unsigned tile_width, width, stride;
+    boolean is_rs690 = (screen->caps.family == CHIP_FAMILY_RS600 ||
+                        screen->caps.family == CHIP_FAMILY_RS690 ||
+                        screen->caps.family == CHIP_FAMILY_RS740);
 
     if (desc->stride_in_bytes_override)
         return desc->stride_in_bytes_override;
@@ -131,38 +143,14 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen,
                                               desc->b.b.nr_samples,
                                               desc->microtile,
                                               desc->macrotile[level],
-                                              DIM_WIDTH);
+                                              DIM_WIDTH, is_rs690);
         width = align(width, tile_width);
 
         stride = util_format_get_stride(desc->b.b.format, width);
-
-        /* Some IGPs need a minimum stride of 64 bytes, hmm... */
-        if (!desc->macrotile[level] &&
-            (screen->caps.family == CHIP_FAMILY_RS600 ||
-             screen->caps.family == CHIP_FAMILY_RS690 ||
-             screen->caps.family == CHIP_FAMILY_RS740)) {
-            unsigned min_stride;
-
-            if (desc->microtile) {
-                unsigned tile_height =
-                        r300_get_pixel_alignment(desc->b.b.format,
-                                                 desc->b.b.nr_samples,
-                                                 desc->microtile,
-                                                 desc->macrotile[level],
-                                                 DIM_HEIGHT);
-
-                min_stride = 64 / tile_height;
-            } else {
-                min_stride = 64;
-            }
-
-            return stride < min_stride ? min_stride : stride;
-        }
-
         /* The alignment to 32 bytes is sort of implied by the layout... */
         return stride;
     } else {
-        return align(util_format_get_stride(desc->b.b.format, width), 32);
+        return align(util_format_get_stride(desc->b.b.format, width), is_rs690 ? 64 : 32);
     }
 }
 
@@ -179,7 +167,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture_desc *desc,
                                                desc->b.b.nr_samples,
                                                desc->microtile,
                                                desc->macrotile[level],
-                                               DIM_HEIGHT);
+                                               DIM_HEIGHT, 0);
         height = align(height, tile_height);
 
         /* This is needed for the kernel checker, unfortunately. */
@@ -474,22 +462,17 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen,
 }
 
 unsigned r300_texture_get_offset(struct r300_texture_desc *desc,
-                                 unsigned level, unsigned zslice,
-                                 unsigned face)
+                                 unsigned level, unsigned layer)
 {
     unsigned offset = desc->offset_in_bytes[level];
 
     switch (desc->b.b.target) {
         case PIPE_TEXTURE_3D:
-            assert(face == 0);
-            return offset + zslice * desc->layer_size_in_bytes[level];
-
         case PIPE_TEXTURE_CUBE:
-            assert(zslice == 0);
-            return offset + face * desc->layer_size_in_bytes[level];
+            return offset + layer * desc->layer_size_in_bytes[level];
 
         default:
-            assert(zslice == 0 && face == 0);
+            assert(layer == 0);
             return offset;
     }
 }
index 3d7fe1fb4731cc352af6ec14fe88091b74673bdf..121d215b4cbab2ddcedd6a4dd81c85b6bc36460c 100644 (file)
@@ -41,7 +41,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format,
                                   unsigned num_samples,
                                   enum r300_buffer_tiling microtile,
                                   enum r300_buffer_tiling macrotile,
-                                  enum r300_dim dim);
+                                  enum r300_dim dim, boolean is_rs690);
 
 boolean r300_texture_desc_init(struct r300_screen *rscreen,
                                struct r300_texture_desc *desc,
@@ -52,7 +52,6 @@ boolean r300_texture_desc_init(struct r300_screen *rscreen,
                                unsigned max_buffer_size);
 
 unsigned r300_texture_get_offset(struct r300_texture_desc *desc,
-                                 unsigned level, unsigned zslice,
-                                 unsigned face);
+                                 unsigned level, unsigned layer);
 
 #endif
index 33448bf0def238225f7c7d44a1e07df6fc70b53b..15a323989b26965f43d6cd23dbfd70370c55d376 100644 (file)
@@ -57,7 +57,7 @@ static unsigned translate_opcode(unsigned opcode)
      /* case TGSI_OPCODE_DP2A: return RC_OPCODE_DP2A; */
                                         /* gap */
         case TGSI_OPCODE_FRC: return RC_OPCODE_FRC;
-     /* case TGSI_OPCODE_CLAMP: return RC_OPCODE_CLAMP; */
+        case TGSI_OPCODE_CLAMP: return RC_OPCODE_CLAMP;
         case TGSI_OPCODE_FLR: return RC_OPCODE_FLR;
      /* case TGSI_OPCODE_ROUND: return RC_OPCODE_ROUND; */
         case TGSI_OPCODE_EX2: return RC_OPCODE_EX2;
index e9333b35ef53be62420294be95fcc8859f0903b3..ae93fab554e4b508c4d53d9a68bde38ef9d0cd4f 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_format.h"
+#include "util/u_box.h"
 
 struct r300_transfer {
     /* Parent class */
@@ -52,16 +53,10 @@ static void r300_copy_from_tiled_texture(struct pipe_context *ctx,
 {
     struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
     struct pipe_resource *tex = transfer->resource;
-    struct pipe_subresource subdst;
 
-    subdst.face = 0;
-    subdst.level = 0;
-
-    ctx->resource_copy_region(ctx, &r300transfer->linear_texture->desc.b.b, subdst,
-                             0, 0, 0,
-                             tex, transfer->sr,
-                             transfer->box.x, transfer->box.y, transfer->box.z,
-                             transfer->box.width, transfer->box.height);
+    ctx->resource_copy_region(ctx, &r300transfer->linear_texture->desc.b.b, 0,
+                              0, 0, 0,
+                              tex, transfer->level, &transfer->box);
 }
 
 /* Copy a detiled texture to a tiled one. */
@@ -70,26 +65,22 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
 {
     struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
     struct pipe_resource *tex = transfer->resource;
-    struct pipe_subresource subsrc;
-
-    subsrc.face = 0;
-    subsrc.level = 0;
+    struct pipe_box src_box;
+    u_box_origin_2d(transfer->box.width, transfer->box.height, &src_box);
 
-    ctx->resource_copy_region(ctx, tex, transfer->sr,
-                             transfer->box.x, transfer->box.y, transfer->box.z,
-                              &r300transfer->linear_texture->desc.b.b, subsrc,
-                             0, 0, 0,
-                             transfer->box.width, transfer->box.height);
+    ctx->resource_copy_region(ctx, tex, transfer->level,
+                              transfer->box.x, transfer->box.y, transfer->box.z,
+                              &r300transfer->linear_texture->desc.b.b, 0, &src_box);
 
     ctx->flush(ctx, 0, NULL);
 }
 
 struct pipe_transfer*
 r300_texture_get_transfer(struct pipe_context *ctx,
-                         struct pipe_resource *texture,
-                         struct pipe_subresource sr,
-                         unsigned usage,
-                         const struct pipe_box *box)
+                          struct pipe_resource *texture,
+                          unsigned level,
+                          unsigned usage,
+                          const struct pipe_box *box)
 {
     struct r300_context *r300 = r300_context(ctx);
     struct r300_texture *tex = r300_texture(texture);
@@ -99,13 +90,13 @@ r300_texture_get_transfer(struct pipe_context *ctx,
 
     referenced_cs =
         r300->rws->cs_is_buffer_referenced(r300->cs,
-                                           tex->buffer, R300_REF_CS);
+                                           tex->cs_buffer, R300_REF_CS);
     if (referenced_cs) {
         referenced_hw = TRUE;
     } else {
         referenced_hw =
             r300->rws->cs_is_buffer_referenced(r300->cs,
-                                               tex->buffer, R300_REF_HW);
+                                               tex->cs_buffer, R300_REF_HW);
     }
 
     blittable = ctx->screen->is_format_supported(
@@ -116,25 +107,26 @@ r300_texture_get_transfer(struct pipe_context *ctx,
     if (trans) {
         /* Initialize the transfer object. */
         pipe_resource_reference(&trans->transfer.resource, texture);
-        trans->transfer.sr = sr;
+        trans->transfer.level = level;
         trans->transfer.usage = usage;
         trans->transfer.box = *box;
 
         /* If the texture is tiled, we must create a temporary detiled texture
          * for this transfer.
          * Also make write transfers pipelined. */
-        if (tex->desc.microtile || tex->desc.macrotile[sr.level] ||
+        if (tex->desc.microtile || tex->desc.macrotile[level] ||
             ((referenced_hw & !(usage & PIPE_TRANSFER_READ)) && blittable)) {
             base.target = PIPE_TEXTURE_2D;
             base.format = texture->format;
             base.width0 = box->width;
             base.height0 = box->height;
-            base.depth0 = 0;
+            base.depth0 = 1;
+            base.array_size = 1;
             base.last_level = 0;
             base.nr_samples = 0;
             base.usage = PIPE_USAGE_DYNAMIC;
             base.bind = 0;
-           base.flags = R300_RESOURCE_FLAG_TRANSFER;
+            base.flags = R300_RESOURCE_FLAG_TRANSFER;
 
             /* For texture reading, the temporary (detiled) texture is used as
              * a render target when blitting from a tiled texture. */
@@ -164,7 +156,7 @@ r300_texture_get_transfer(struct pipe_context *ctx,
                 if (!trans->linear_texture) {
                     /* For linear textures, it's safe to fallback to
                      * an unpipelined transfer. */
-                    if (!tex->desc.microtile && !tex->desc.macrotile[sr.level]) {
+                    if (!tex->desc.microtile && !tex->desc.macrotile[level]) {
                         goto unpipelined;
                     }
 
@@ -182,7 +174,7 @@ r300_texture_get_transfer(struct pipe_context *ctx,
             /* Set the stride.
             *
             * Even though we are using an internal texture for this,
-            * the transfer sr, box and usage parameters still reflect
+            * the transfer level, box and usage parameters still reflect
             * the arguments received to get_transfer.  We just do the
             * right thing internally.
             */
@@ -202,9 +194,8 @@ r300_texture_get_transfer(struct pipe_context *ctx,
 
     unpipelined:
         /* Unpipelined transfer. */
-        trans->transfer.stride = tex->desc.stride_in_bytes[sr.level];
-        trans->offset = r300_texture_get_offset(&tex->desc,
-                                                sr.level, box->z, sr.face);
+        trans->transfer.stride = tex->desc.stride_in_bytes[level];
+        trans->offset = r300_texture_get_offset(&tex->desc, level, box->z);
 
         if (referenced_cs)
             ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
index 0d32a68d1fa2bec851b147b0756bfe59ffdbb89b..7977ef516f2181b380ca9d938428ad0d787e340c 100644 (file)
@@ -30,22 +30,22 @@ struct r300_context;
 
 struct pipe_transfer*
 r300_texture_get_transfer(struct pipe_context *ctx,
-                         struct pipe_resource *texture,
-                         struct pipe_subresource sr,
-                         unsigned usage,
-                         const struct pipe_box *box);
+                          struct pipe_resource *texture,
+                          unsigned level,
+                          unsigned usage,
+                          const struct pipe_box *box);
 
 void
 r300_texture_transfer_destroy(struct pipe_context *ctx,
-                             struct pipe_transfer *trans);
+                              struct pipe_transfer *trans);
 
 void*
 r300_texture_transfer_map(struct pipe_context *ctx,
-                         struct pipe_transfer *transfer);
+                          struct pipe_transfer *transfer);
 
 void
 r300_texture_transfer_unmap(struct pipe_context *ctx,
-                           struct pipe_transfer *transfer);
+                            struct pipe_transfer *transfer);
 
 
 #endif
index 65696555ac3e9b8cec9404a7955eedeaf35256af..78021e2c5d4667ca544897847baba2fa6effbb13 100644 (file)
@@ -213,7 +213,6 @@ void r300_translate_vertex_shader(struct r300_context *r300,
     compiler.Base.max_temp_regs = 32;
     compiler.Base.max_constants = 256;
     compiler.Base.max_alu_insts = r300->screen->caps.is_r500 ? 1024 : 256;
-    compiler.Base.remove_unused_constants = TRUE;
 
     if (compiler.Base.Debug & RC_DBG_LOG) {
         DBG(r300, DBG_VP, "r300: Initial vertex program\n");
@@ -227,6 +226,10 @@ void r300_translate_vertex_shader(struct r300_context *r300,
 
     r300_tgsi_to_rc(&ttr, vs->state.tokens);
 
+    if (compiler.Base.Program.Constants.Count > 200) {
+        compiler.Base.remove_unused_constants = TRUE;
+    }
+
     compiler.RequiredOutputs = ~(~0 << (vs->info.num_outputs + 1));
     compiler.SetHwInputOutput = &set_vertex_inputs_outputs;
 
index 4597332399a2321313b8084a2bf0249b026b9009..460da77a4fb1f96963a4475a12d4b220e9fbdffe 100644 (file)
 
 #include "r300_defines.h"
 
+#define R300_MAX_CMDBUF_DWORDS (16 * 1024)
+
 struct winsys_handle;
 struct r300_winsys_screen;
 
-struct r300_winsys_buffer;
+struct r300_winsys_buffer;      /* for map/unmap etc. */
+struct r300_winsys_cs_buffer;   /* for write_reloc etc. */
 
 struct r300_winsys_cs {
-    uint32_t *ptr;      /* Pointer to the beginning of the CS. */
-    unsigned cdw;       /* Number of used dwords. */
-    unsigned ndw;       /* Size of the CS in dwords. */
+    unsigned cdw;                           /* Number of used dwords. */
+    uint32_t buf[R300_MAX_CMDBUF_DWORDS];   /* The command buffer. */
 };
 
 enum r300_value_id {
@@ -49,8 +51,9 @@ enum r300_value_id {
     R300_VID_GB_PIPES,
     R300_VID_Z_PIPES,
     R300_VID_SQUARE_TILING_SUPPORT,
-    R300_VID_DRM_2_3_0,
-    R300_VID_DRM_2_6_0,
+    R300_VID_DRM_2_3_0, /* R500 VAP regs, MSPOS regs, fixed tex3D size checking */
+    R300_VID_DRM_2_6_0, /* Hyper-Z, GB_Z_PEQ_CONFIG on rv350->r4xx, R500 FG_ALPHA_VALUE */
+    R300_VID_DRM_2_8_0, /* R500 US_FORMAT regs, R500 ARGB2101010 colorbuffer */
     R300_CAN_HYPERZ,
 };
 
@@ -102,6 +105,10 @@ struct r300_winsys_screen {
                                                 unsigned usage,
                                                 enum r300_buffer_domain domain);
 
+    struct r300_winsys_cs_buffer *(*buffer_get_cs_handle)(
+            struct r300_winsys_screen *ws,
+            struct r300_winsys_buffer *buf);
+
     /**
      * Reference a buffer object (assign with reference counting).
      *
@@ -232,23 +239,22 @@ struct r300_winsys_screen {
     void (*cs_destroy)(struct r300_winsys_cs *cs);
 
     /**
-     * Add a buffer object to the list of buffers to validate.
+     * Add a new buffer relocation. Every relocation must first be added
+     * before it can be written.
      *
-     * \param cs        A command stream to add buffer for validation against.
-     * \param buf       A winsys buffer to validate.
-     * \param rd        A read domain containing a bitmask
-     *                  of the R300_DOMAIN_* flags.
-     * \param wd        A write domain containing a bitmask
-     *                  of the R300_DOMAIN_* flags.
+     * \param cs  A command stream to add buffer for validation against.
+     * \param buf A winsys buffer to validate.
+     * \param rd  A read domain containing a bitmask of the R300_DOMAIN_* flags.
+     * \param wd  A write domain containing a bitmask of the R300_DOMAIN_* flags.
      */
-    void (*cs_add_buffer)(struct r300_winsys_cs *cs,
-                          struct r300_winsys_buffer *buf,
-                          enum r300_buffer_domain rd,
-                          enum r300_buffer_domain wd);
+    void (*cs_add_reloc)(struct r300_winsys_cs *cs,
+                         struct r300_winsys_cs_buffer *buf,
+                         enum r300_buffer_domain rd,
+                         enum r300_buffer_domain wd);
 
     /**
-     * Revalidate all currently set up winsys buffers.
-     * Returns TRUE if a flush is required.
+     * Return TRUE if there is enough memory in VRAM and GTT for the relocs
+     * added so far.
      *
      * \param cs        A command stream to validate.
      */
@@ -263,9 +269,7 @@ struct r300_winsys_screen {
      * \param wd        A write domain containing a bitmask of the R300_DOMAIN_* flags.
      */
     void (*cs_write_reloc)(struct r300_winsys_cs *cs,
-                           struct r300_winsys_buffer *buf,
-                           enum r300_buffer_domain rd,
-                           enum r300_buffer_domain wd);
+                           struct r300_winsys_cs_buffer *buf);
 
     /**
      * Flush a command stream.
@@ -286,14 +290,6 @@ struct r300_winsys_screen {
                          void (*flush)(void *),
                          void *user);
 
-    /**
-     * Reset the list of buffer objects to validate, usually called
-     * prior to adding buffer objects for validation.
-     *
-     * \param cs        A command stream to reset buffers for.
-     */
-    void (*cs_reset_buffers)(struct r300_winsys_cs *cs);
-
     /**
      * Return TRUE if a buffer is referenced by a command stream or by hardware
      * (i.e. is busy), based on the domain parameter.
@@ -303,7 +299,7 @@ struct r300_winsys_screen {
      * \param domain    A bitmask of the R300_REF_* enums.
      */
     boolean (*cs_is_buffer_referenced)(struct r300_winsys_cs *cs,
-                                       struct r300_winsys_buffer *buf,
+                                       struct r300_winsys_cs_buffer *buf,
                                        enum r300_reference_domain domain);
 };
 
index a484f38e9f12fcbf795e35cf8332d612bb699e4d..b476b9af3b834e717a88dea66a2395202715d0e3 100644 (file)
@@ -21,6 +21,7 @@ C_SOURCES = \
        evergreen_state.c \
        eg_asm.c \
        r600_translate.c \
-       r600_state_common.c
+       r600_state_common.c \
+       r600_upload.c
 
 include ../../Makefile.template
index 3fc1fa94c27a00730cf0736dd152990e50ef22b9..64980140963a65ad1ab2415b1cd80b633a92eaa2 100644 (file)
@@ -28,6 +28,7 @@ r600 = env.ConvenienceLibrary(
         'r600_state_common.c',
         'r600_texture.c',
         'r600_translate.c',
+        'r600_upload.c',
         'r700_asm.c',
         'evergreen_state.c',
         'eg_asm.c',
index 21d66fa9564e79097c43b6f45f45a802ef35d700..67d742b376098890b75c7a4a923fd77dba63197b 100644 (file)
@@ -27,6 +27,7 @@
 #include "r600_asm.h"
 #include "eg_sq.h"
 #include "r600_opcodes.h"
+#include "evergreend.h"
 
 int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
 {
@@ -34,15 +35,17 @@ int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
 
        switch (cf->inst) {
        case (EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3):
+       case (EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER << 3):
+       case (EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER << 3):
        case (EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3):
                bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1) |
-                       S_SQ_CF_ALU_WORD0_KCACHE_MODE0(cf->kcache0_mode) |
-                       S_SQ_CF_ALU_WORD0_KCACHE_BANK0(cf->kcache0_bank) |
-                       S_SQ_CF_ALU_WORD0_KCACHE_BANK1(cf->kcache1_bank);
+                       S_SQ_CF_ALU_WORD0_KCACHE_MODE0(cf->kcache[0].mode) |
+                       S_SQ_CF_ALU_WORD0_KCACHE_BANK0(cf->kcache[0].bank) |
+                       S_SQ_CF_ALU_WORD0_KCACHE_BANK1(cf->kcache[1].bank);
                bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(cf->inst >> 3) |
-                       S_SQ_CF_ALU_WORD1_KCACHE_MODE1(cf->kcache1_mode) |
-                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(cf->kcache0_addr) |
-                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(cf->kcache1_addr) |
+                       S_SQ_CF_ALU_WORD1_KCACHE_MODE1(cf->kcache[1].mode) |
+                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(cf->kcache[0].addr) |
+                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(cf->kcache[1].addr) |
                                        S_SQ_CF_ALU_WORD1_BARRIER(1) |
                                        S_SQ_CF_ALU_WORD1_COUNT((cf->ndw / 2) - 1);
                break;
@@ -89,3 +92,37 @@ int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
        }
        return 0;
 }
+
+void eg_cf_vtx(struct r600_vertex_element *ve, u32 *bytecode, unsigned count)
+{
+       struct r600_pipe_state *rstate;
+       unsigned i = 0;
+
+       if (count > 8) {
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(8 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(EG_V_SQ_CF_WORD1_SQ_CF_INST_VTX) |
+                               S_SQ_CF_WORD1_BARRIER(1) |
+                               S_SQ_CF_WORD1_COUNT(8 - 1);
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(40 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(EG_V_SQ_CF_WORD1_SQ_CF_INST_VTX) |
+                               S_SQ_CF_WORD1_BARRIER(1) |
+                               S_SQ_CF_WORD1_COUNT(count - 8 - 1);
+       } else {
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(8 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(EG_V_SQ_CF_WORD1_SQ_CF_INST_VTX) |
+                               S_SQ_CF_WORD1_BARRIER(1) |
+                               S_SQ_CF_WORD1_COUNT(count - 1);
+       }
+       bytecode[i++] = S_SQ_CF_WORD0_ADDR(0);
+       bytecode[i++] = S_SQ_CF_WORD1_CF_INST(EG_V_SQ_CF_WORD1_SQ_CF_INST_RETURN) |
+                       S_SQ_CF_WORD1_BARRIER(1);
+
+       rstate = &ve->rstate;
+       rstate->id = R600_PIPE_STATE_FETCH_SHADER;
+       rstate->nregs = 0;
+       r600_pipe_state_add_reg(rstate, R_0288A8_SQ_PGM_RESOURCES_FS,
+                               0x00000000, 0xFFFFFFFF, NULL);
+       r600_pipe_state_add_reg(rstate, R_0288A4_SQ_PGM_START_FS,
+                               (r600_bo_offset(ve->fetch_shader)) >> 8,
+                               0xFFFFFFFF, ve->fetch_shader);
+}
index 698299ec1343bd4f8e739609c2035eb6abb31ba3..ecea1db4f159c70e102cf6924ba2075a7d275410 100644 (file)
@@ -290,6 +290,7 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format)
        switch (format) {
                /* 8-bit buffers. */
        case PIPE_FORMAT_A8_UNORM:
+               return V_028C70_SWAP_ALT_REV;
        case PIPE_FORMAT_I8_UNORM:
        case PIPE_FORMAT_L8_UNORM:
        case PIPE_FORMAT_R8_UNORM:
@@ -312,6 +313,7 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format)
                return V_028C70_SWAP_STD;
 
        case PIPE_FORMAT_L8A8_UNORM:
+               return V_028C70_SWAP_ALT;
        case PIPE_FORMAT_R8G8_UNORM:
                return V_028C70_SWAP_STD;
 
index 0509522d8138a13abfa6d4202e9a4f6d071169e6..94eef77945b166c486027c1fb453f6849686e431 100644 (file)
@@ -410,9 +410,9 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
        r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4,
                                word4 | S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) |
                                S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) |
-                               S_030010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL);
+                               S_030010_BASE_LEVEL(state->u.tex.first_level), 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5,
-                               S_030014_LAST_LEVEL(state->last_level) |
+                               S_030014_LAST_LEVEL(state->u.tex.last_level) |
                                S_030014_BASE_ARRAY(0) |
                                S_030014_LAST_ARRAY(0), 0xffffffff, NULL);
        r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL);
@@ -633,10 +633,11 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state
        struct r600_resource_texture *rtex;
        struct r600_resource *rbuffer;
        struct r600_surface *surf;
-       unsigned level = state->cbufs[cb]->level;
+       unsigned level = state->cbufs[cb]->u.tex.level;
        unsigned pitch, slice;
        unsigned color_info;
        unsigned format, swap, ntype;
+       unsigned offset;
        const struct util_format_description *desc;
        struct r600_bo *bo[3];
 
@@ -647,6 +648,9 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state
        bo[1] = rbuffer->bo;
        bo[2] = rbuffer->bo;
 
+       /* XXX quite sure for dx10+ hw don't need any offset hacks */
+       offset = r600_texture_get_offset((struct r600_resource_texture *)state->cbufs[cb]->texture,
+                                        level, state->cbufs[cb]->u.tex.first_layer);
        pitch = rtex->pitch_in_pixels[level] / 8 - 1;
        slice = rtex->pitch_in_pixels[level] * surf->aligned_height / 64 - 1;
        ntype = 0;
@@ -666,7 +670,7 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state
        /* FIXME handle enabling of CB beyond BASE8 which has different offset */
        r600_pipe_state_add_reg(rstate,
                                R_028C60_CB_COLOR0_BASE + cb * 0x3C,
-                               (state->cbufs[cb]->offset +  r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
+                               (offset +  r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
        r600_pipe_state_add_reg(rstate,
                                R_028C78_CB_COLOR0_DIM + cb * 0x3C,
                                0x0, 0xFFFFFFFF, NULL);
@@ -698,11 +702,12 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state
        struct r600_surface *surf;
        unsigned level;
        unsigned pitch, slice, format, stencil_format;
+       unsigned offset;
 
        if (state->zsbuf == NULL)
                return;
 
-       level = state->zsbuf->level;
+       level = state->zsbuf->u.tex.level;
 
        surf = (struct r600_surface *)state->zsbuf;
        rtex = (struct r600_resource_texture*)state->zsbuf->texture;
@@ -712,24 +717,27 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state
        rtex->depth = 1;
        rbuffer = &rtex->resource;
 
+       /* XXX quite sure for dx10+ hw don't need any offset hacks */
+       offset = r600_texture_get_offset((struct r600_resource_texture *)state->zsbuf->texture,
+                                        level, state->zsbuf->u.tex.first_layer);
        pitch = rtex->pitch_in_pixels[level] / 8 - 1;
        slice = rtex->pitch_in_pixels[level] * surf->aligned_height / 64 - 1;
        format = r600_translate_dbformat(state->zsbuf->texture->format);
        stencil_format = r600_translate_stencilformat(state->zsbuf->texture->format);
 
        r600_pipe_state_add_reg(rstate, R_028048_DB_Z_READ_BASE,
-                               (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                               (offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
        r600_pipe_state_add_reg(rstate, R_028050_DB_Z_WRITE_BASE,
-                               (state->zsbuf->offset  + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                               (offset  + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
 
        if (stencil_format) {
                uint32_t stencil_offset;
 
                stencil_offset = ((surf->aligned_height * rtex->pitch_in_bytes[level]) + 255) & ~255;
                r600_pipe_state_add_reg(rstate, R_02804C_DB_STENCIL_READ_BASE,
-                                       (state->zsbuf->offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                                       (offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
                r600_pipe_state_add_reg(rstate, R_028054_DB_STENCIL_WRITE_BASE,
-                                       (state->zsbuf->offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                                       (offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
        }
 
        r600_pipe_state_add_reg(rstate, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL);
@@ -762,8 +770,6 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
 
        util_copy_framebuffer_state(&rctx->framebuffer, state);
 
-       rctx->pframebuffer = &rctx->framebuffer;
-
        /* build states */
        for (int i = 0; i < state->nr_cbufs; i++) {
                evergreen_cb(rctx, rstate, state, i);
@@ -825,6 +831,10 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
        free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]);
        rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate;
        r600_context_pipe_state_set(&rctx->ctx, rstate);
+
+       if (state->zsbuf) {
+               evergreen_polygon_offset_update(rctx);
+       }
 }
 
 static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
@@ -832,6 +842,7 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader,
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_resource *rbuffer = (struct r600_resource*)buffer;
+       uint32_t offset;
 
        /* Note that the state tracker can unbind constant buffers by
         * passing NULL here.
@@ -840,6 +851,8 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader,
                return;
        }
 
+       r600_upload_const_buffer(rctx, buffer, &offset);
+
        switch (shader) {
        case PIPE_SHADER_VERTEX:
                rctx->vs_const_buffer.nregs = 0;
@@ -849,7 +862,7 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader,
                                        0xFFFFFFFF, NULL);
                r600_pipe_state_add_reg(&rctx->vs_const_buffer,
                                        R_028980_ALU_CONST_CACHE_VS_0,
-                                       (r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                                       (r600_bo_offset(rbuffer->bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->bo);
                r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer);
                break;
        case PIPE_SHADER_FRAGMENT:
@@ -860,7 +873,7 @@ static void evergreen_set_constant_buffer(struct pipe_context *ctx, uint shader,
                                        0xFFFFFFFF, NULL);
                r600_pipe_state_add_reg(&rctx->ps_const_buffer,
                                        R_028940_ALU_CONST_CACHE_PS_0,
-                                       (r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                                       (r600_bo_offset(rbuffer->bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->bo);
                r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer);
                break;
        default:
@@ -1057,12 +1070,76 @@ void evergreen_init_config(struct r600_pipe_context *rctx)
                num_hs_stack_entries = 42;
                num_ls_stack_entries = 42;
                break;
+       case CHIP_BARTS:
+               num_ps_gprs = 93;
+               num_vs_gprs = 46;
+               num_temp_gprs = 4;
+               num_gs_gprs = 31;
+               num_es_gprs = 31;
+               num_hs_gprs = 23;
+               num_ls_gprs = 23;
+               num_ps_threads = 128;
+               num_vs_threads = 20;
+               num_gs_threads = 20;
+               num_es_threads = 20;
+               num_hs_threads = 20;
+               num_ls_threads = 20;
+               num_ps_stack_entries = 85;
+               num_vs_stack_entries = 85;
+               num_gs_stack_entries = 85;
+               num_es_stack_entries = 85;
+               num_hs_stack_entries = 85;
+               num_ls_stack_entries = 85;
+               break;
+       case CHIP_TURKS:
+               num_ps_gprs = 93;
+               num_vs_gprs = 46;
+               num_temp_gprs = 4;
+               num_gs_gprs = 31;
+               num_es_gprs = 31;
+               num_hs_gprs = 23;
+               num_ls_gprs = 23;
+               num_ps_threads = 128;
+               num_vs_threads = 20;
+               num_gs_threads = 20;
+               num_es_threads = 20;
+               num_hs_threads = 20;
+               num_ls_threads = 20;
+               num_ps_stack_entries = 42;
+               num_vs_stack_entries = 42;
+               num_gs_stack_entries = 42;
+               num_es_stack_entries = 42;
+               num_hs_stack_entries = 42;
+               num_ls_stack_entries = 42;
+               break;
+       case CHIP_CAICOS:
+               num_ps_gprs = 93;
+               num_vs_gprs = 46;
+               num_temp_gprs = 4;
+               num_gs_gprs = 31;
+               num_es_gprs = 31;
+               num_hs_gprs = 23;
+               num_ls_gprs = 23;
+               num_ps_threads = 128;
+               num_vs_threads = 10;
+               num_gs_threads = 10;
+               num_es_threads = 10;
+               num_hs_threads = 10;
+               num_ls_threads = 10;
+               num_ps_stack_entries = 42;
+               num_vs_stack_entries = 42;
+               num_gs_stack_entries = 42;
+               num_es_stack_entries = 42;
+               num_hs_stack_entries = 42;
+               num_ls_stack_entries = 42;
+               break;
        }
 
        tmp = 0x00000000;
        switch (family) {
        case CHIP_CEDAR:
        case CHIP_PALM:
+       case CHIP_CAICOS:
                break;
        default:
                tmp |= S_008C00_VC_ENABLE(1);
@@ -1194,29 +1271,101 @@ void evergreen_init_config(struct r600_pipe_context *rctx)
        r600_pipe_state_add_reg(rstate, R_0283F8_SQ_VTX_SEMANTIC_30, 0x0, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(rstate, R_0283FC_SQ_VTX_SEMANTIC_31, 0x0, 0xFFFFFFFF, NULL);
 
-r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL,
-                       0x0, 0xFFFFFFFF, NULL);
+       r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, 0x0, 0xFFFFFFFF, NULL);
 
        r600_context_pipe_state_set(&rctx->ctx, rstate);
 }
 
-int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
-void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
+void evergreen_polygon_offset_update(struct r600_pipe_context *rctx)
+{
+       struct r600_pipe_state state;
+
+       state.id = R600_PIPE_STATE_POLYGON_OFFSET;
+       state.nregs = 0;
+       if (rctx->rasterizer && rctx->framebuffer.zsbuf) {
+               float offset_units = rctx->rasterizer->offset_units;
+               unsigned offset_db_fmt_cntl = 0, depth;
+
+               switch (rctx->framebuffer.zsbuf->texture->format) {
+               case PIPE_FORMAT_Z24X8_UNORM:
+               case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+                       depth = -24;
+                       offset_units *= 2.0f;
+                       break;
+               case PIPE_FORMAT_Z32_FLOAT:
+                       depth = -23;
+                       offset_units *= 1.0f;
+                       offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
+                       break;
+               case PIPE_FORMAT_Z16_UNORM:
+                       depth = -16;
+                       offset_units *= 4.0f;
+                       break;
+               default:
+                       return;
+               }
+               /* FIXME some of those reg can be computed with cso */
+               offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
+               r600_pipe_state_add_reg(&state,
+                               R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE,
+                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET,
+                               fui(offset_units), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE,
+                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET,
+                               fui(offset_units), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL,
+                               offset_db_fmt_cntl, 0xFFFFFFFF, NULL);
+               r600_context_pipe_state_set(&rctx->ctx, &state);
+       }
+}
+
+static void evergreen_spi_update(struct r600_pipe_context *rctx)
+{
+       struct r600_pipe_shader *shader = rctx->ps_shader;
+       struct r600_pipe_state rstate;
+       struct r600_shader *rshader = &shader->shader;
+       unsigned i, tmp;
+
+       rstate.nregs = 0;
+       for (i = 0; i < rshader->ninput; i++) {
+               tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i));
+               if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
+                               rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
+                               rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
+                       tmp |= S_028644_FLAT_SHADE(rctx->flatshade);
+               }
+               if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
+                       rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
+                       tmp |= S_028644_PT_SPRITE_TEX(1);
+               }
+               r600_pipe_state_add_reg(&rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
+       }
+       r600_context_pipe_state_set(&rctx->ctx, &rstate);
+}
+
+void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx)
 {
-       struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_pipe_state *rstate;
        struct r600_resource *rbuffer;
-       unsigned i, j, offset, prim;
-       u32 vgt_dma_index_type, vgt_draw_initiator, mask;
        struct pipe_vertex_buffer *vertex_buffer;
-       struct r600_draw rdraw;
-       struct r600_pipe_state vgt;
-       struct r600_drawl draw;
-       boolean translate = FALSE;
+       unsigned i, offset;
+
+       /* we don't update until we know vertex elements */
+       if (rctx->vertex_elements == NULL || !rctx->nvertex_buffer)
+               return;
 
        if (rctx->vertex_elements->incompatible_layout) {
+               /* translate rebind new vertex elements so
+                * return once translated
+                */
                r600_begin_vertex_translate(rctx);
-               translate = TRUE;
+               return;
        }
 
        if (rctx->any_user_vbs) {
@@ -1224,6 +1373,72 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
                rctx->any_user_vbs = FALSE;
        }
 
+       if (rctx->vertex_elements->vbuffer_need_offset) {
+               /* one resource per vertex elements */
+               rctx->nvs_resource = rctx->vertex_elements->count;
+       } else {
+               /* bind vertex buffer once */
+               rctx->nvs_resource = rctx->nvertex_buffer;
+       }
+
+       for (i = 0 ; i < rctx->nvs_resource; i++) {
+               rstate = &rctx->vs_resource[i];
+               rstate->id = R600_PIPE_STATE_RESOURCE;
+               rstate->nregs = 0;
+
+               if (rctx->vertex_elements->vbuffer_need_offset) {
+                       /* one resource per vertex elements */
+                       unsigned vbuffer_index;
+                       vbuffer_index = rctx->vertex_elements->elements[i].vertex_buffer_index;
+                       vertex_buffer = &rctx->vertex_buffer[vbuffer_index];
+                       rbuffer = (struct r600_resource*)vertex_buffer->buffer;
+                       offset = rctx->vertex_elements->vbuffer_offset[i];
+               } else {
+                       /* bind vertex buffer once */
+                       vertex_buffer = &rctx->vertex_buffer[i];
+                       rbuffer = (struct r600_resource*)vertex_buffer->buffer;
+                       offset = 0;
+               }
+               if (vertex_buffer == NULL || rbuffer == NULL)
+                       continue;
+               offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo);
+
+               r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0,
+                                       offset, 0xFFFFFFFF, rbuffer->bo);
+               r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1,
+                                       rbuffer->bo_size - offset - 1, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2,
+                                       S_030008_STRIDE(vertex_buffer->stride),
+                                       0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3,
+                                       S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) |
+                                       S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) |
+                                       S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) |
+                                       S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W),
+                                       0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4,
+                                       0x00000000, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5,
+                                       0x00000000, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6,
+                                       0x00000000, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7,
+                                       0xC0000000, 0xFFFFFFFF, NULL);
+               evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i);
+       }
+}
+
+int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
+void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
+{
+       struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+       struct r600_resource *rbuffer;
+       u32 vgt_dma_index_type, vgt_draw_initiator, mask;
+       struct r600_draw rdraw;
+       struct r600_pipe_state vgt;
+       struct r600_drawl draw;
+       unsigned prim;
+
        memset(&draw, 0, sizeof(struct r600_drawl));
        draw.ctx = ctx;
        draw.mode = info->mode;
@@ -1272,48 +1487,23 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
        }
        if (r600_conv_pipe_prim(draw.mode, &prim))
                return;
-
-       /* rebuild vertex shader if input format changed */
-       if (r600_pipe_shader_update(&rctx->context, rctx->vs_shader))
+       if (unlikely(rctx->ps_shader == NULL)) {
+               R600_ERR("missing vertex shader\n");
                return;
-       if (r600_pipe_shader_update(&rctx->context, rctx->ps_shader))
+       }
+       if (unlikely(rctx->vs_shader == NULL)) {
+               R600_ERR("missing vertex shader\n");
+               return;
+       }
+       /* there should be enough input */
+       if (rctx->vertex_elements->count < rctx->vs_shader->shader.bc.nresource) {
+               R600_ERR("%d resources provided, expecting %d\n",
+                       rctx->vertex_elements->count, rctx->vs_shader->shader.bc.nresource);
                return;
-
-       for (i = 0 ; i < rctx->vertex_elements->count; i++) {
-               uint32_t word3, word2;
-               uint32_t format;
-               rstate = &rctx->vs_resource[i];
-
-               rstate->id = R600_PIPE_STATE_RESOURCE;
-               rstate->nregs = 0;
-
-               j = rctx->vertex_elements->elements[i].vertex_buffer_index;
-               vertex_buffer = &rctx->vertex_buffer[j];
-               rbuffer = (struct r600_resource*)vertex_buffer->buffer;
-               offset = rctx->vertex_elements->elements[i].src_offset +
-                       vertex_buffer->buffer_offset +
-                       r600_bo_offset(rbuffer->bo);
-
-               format = r600_translate_vertex_data_type(rctx->vertex_elements->hw_format[i]);
-
-               word2 = format | S_030008_STRIDE(vertex_buffer->stride);
-
-               word3 = S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) |
-                       S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) |
-                       S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) |
-                       S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W);
-
-               r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo);
-               r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2, word2, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3, word3, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7, 0xC0000000, 0xFFFFFFFF, NULL);
-               evergreen_fs_resource_set(&rctx->ctx, rstate, i);
        }
 
+       evergreen_spi_update(rctx);
+
        mask = 0;
        for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
                mask |= (0xF << (i * 4));
@@ -1328,46 +1518,6 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
        r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(&vgt, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(&vgt, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0xFFFFFFFF, NULL);
-
-       if (rctx->rasterizer && rctx->framebuffer.zsbuf) {
-               float offset_units = rctx->rasterizer->offset_units;
-               unsigned offset_db_fmt_cntl = 0, depth;
-
-               switch (rctx->framebuffer.zsbuf->texture->format) {
-               case PIPE_FORMAT_Z24X8_UNORM:
-               case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
-                       depth = -24;
-                       offset_units *= 2.0f;
-                       break;
-               case PIPE_FORMAT_Z32_FLOAT:
-                       depth = -23;
-                       offset_units *= 1.0f;
-                       offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
-                       break;
-               case PIPE_FORMAT_Z16_UNORM:
-                       depth = -16;
-                       offset_units *= 4.0f;
-                       break;
-               default:
-                       return;
-               }
-               offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE,
-                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET,
-                               fui(offset_units), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE,
-                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET,
-                               fui(offset_units), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL,
-                               offset_db_fmt_cntl, 0xFFFFFFFF, NULL);
-       }
        r600_context_pipe_state_set(&rctx->ctx, &vgt);
 
        rdraw.vgt_num_indices = draw.count;
@@ -1382,28 +1532,22 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
        }
        evergreen_context_draw(&rctx->ctx, &rdraw);
 
-       if (translate)
-               r600_end_vertex_translate(rctx);
-
        pipe_resource_reference(&draw.index_buffer, NULL);
 }
 
 void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader)
 {
-       struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_pipe_state *rstate = &shader->rstate;
        struct r600_shader *rshader = &shader->shader;
-       unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1;
+       unsigned i, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1;
        int pos_index = -1, face_index = -1;
        int ninterp = 0;
        boolean have_linear = FALSE, have_centroid = FALSE, have_perspective = FALSE;
        unsigned spi_baryc_cntl;
 
-       /* clear previous register */
        rstate->nregs = 0;
 
        for (i = 0; i < rshader->ninput; i++) {
-               tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i));
                /* evergreen NUM_INTERP only contains values interpolated into the LDS,
                   POSITION goes via GPRs from the SC so isn't counted */
                if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
@@ -1421,16 +1565,6 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader
                        if (rshader->input[i].centroid)
                                have_centroid = TRUE;
                }
-               if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
-                   rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
-                   rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
-                       tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
-               }
-               if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
-                       rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
-                       tmp |= S_028644_PT_SPRITE_TEX(1);
-               }
-               r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
        }
        for (i = 0; i < rshader->noutput; i++) {
                if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
@@ -1568,15 +1702,9 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader
        r600_pipe_state_add_reg(rstate,
                                R_028864_SQ_PGM_RESOURCES_2_VS,
                                0x0, 0xFFFFFFFF, NULL);
-       r600_pipe_state_add_reg(rstate,
-                       R_0288A8_SQ_PGM_RESOURCES_FS,
-                       0x00000000, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(rstate,
                        R_02885C_SQ_PGM_START_VS,
                        (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo);
-       r600_pipe_state_add_reg(rstate,
-                       R_0288A4_SQ_PGM_START_FS,
-                       (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo_fetch);
 
        r600_pipe_state_add_reg(rstate,
                                R_03A200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF,
index 2ab60f3086a99bca57bf6bf6993efac6ff17a88d..a852bef6156bfc4f215a37520f469843b6580d99 100644 (file)
@@ -35,7 +35,7 @@
 #define RADEON_CTX_MAX_PM4     (64 * 1024 / 4)
 
 #define R600_ERR(fmt, args...) \
-       fprintf(stderr, "EE %s/%s:%d - "fmt, __FILE__, __func__, __LINE__, ##args)
+       fprintf(stderr, "EE %s:%d %s - "fmt, __FILE__, __LINE__, __func__, ##args)
 
 typedef uint64_t               u64;
 typedef uint32_t               u32;
@@ -92,6 +92,9 @@ enum radeon_family {
        CHIP_CYPRESS,
        CHIP_HEMLOCK,
        CHIP_PALM,
+       CHIP_BARTS,
+       CHIP_TURKS,
+       CHIP_CAICOS,
        CHIP_LAST,
 };
 
@@ -245,10 +248,7 @@ struct r600_context {
        u32                     *pm4;
        struct list_head        query_list;
        unsigned                num_query_running;
-       unsigned                fence;
        struct list_head        fenced_bo;
-       unsigned                *cfence;
-       struct r600_bo          *fence_bo;
 };
 
 struct r600_draw {
@@ -284,14 +284,12 @@ void r600_context_queries_resume(struct r600_context *ctx);
 
 int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon);
 void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw);
-void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid);
-void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid);
-void evergreen_fs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid);
-
 void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid);
 void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid);
 void evergreen_context_pipe_state_set_fs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid);
 void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id);
 void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id);
 
+struct radeon *radeon_decref(struct radeon *radeon);
+
 #endif
index edadedff25f7bd96f9000c9bcd87a5784162b744..beefd17ae2feef01a046b9844890a9ca5cbb45dc 100644 (file)
  */
 #include <stdio.h>
 #include <errno.h>
+#include "util/u_format.h"
 #include "util/u_memory.h"
 #include "pipe/p_shader_tokens.h"
 #include "r600_pipe.h"
 #include "r600_sq.h"
 #include "r600_opcodes.h"
 #include "r600_asm.h"
+#include "r600_formats.h"
+#include "r600d.h"
 
-static inline unsigned int r600_bc_get_num_operands(struct r600_bc_alu *alu)
+#define NUM_OF_CYCLES 3
+#define NUM_OF_COMPONENTS 4
+
+static inline unsigned int r600_bc_get_num_operands(struct r600_bc *bc, struct r600_bc_alu *alu)
 {
        if(alu->is_op3)
                return 3;
 
-       switch (alu->inst) {
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP:
-               return 0;
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL: 
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE: 
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE:
-               return 2;
-
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV: 
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN:
-       case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS:
-               return 1;
-       default: R600_ERR(
-               "Need instruction operand number for 0x%x.\n", alu->inst); 
-       };
+       switch (bc->chiprev) {
+       case CHIPREV_R600:
+       case CHIPREV_R700:
+               switch (alu->inst) {
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP:
+                       return 0;
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE:
+                       return 2;
+
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS:
+                       return 1;
+               default: R600_ERR(
+                       "Need instruction operand number for 0x%x.\n", alu->inst);
+               }
+               break;
+       case CHIPREV_EVERGREEN:
+               switch (alu->inst) {
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP:
+                       return 0;
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW:
+                       return 2;
+
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS:
+                       return 1;
+               default: R600_ERR(
+                       "Need instruction operand number for 0x%x.\n", alu->inst);
+               }
+               break;
+       }
 
        return 3;
 }
@@ -101,7 +164,6 @@ static struct r600_bc_alu *r600_bc_alu(void)
        if (alu == NULL)
                return NULL;
        LIST_INITHEAD(&alu->list);
-       LIST_INITHEAD(&alu->bs_list);
        return alu;
 }
 
@@ -152,6 +214,9 @@ int r600_bc_init(struct r600_bc *bc, enum radeon_family family)
        case CHIP_CYPRESS:
        case CHIP_HEMLOCK:
        case CHIP_PALM:
+       case CHIP_BARTS:
+       case CHIP_TURKS:
+       case CHIP_CAICOS:
                bc->chiprev = CHIPREV_EVERGREEN;
                break;
        default:
@@ -189,221 +254,813 @@ int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output)
        return 0;
 }
 
-const unsigned bank_swizzle_vec[8] = {SQ_ALU_VEC_210,  //000
-                                     SQ_ALU_VEC_120,  //001
-                                     SQ_ALU_VEC_102,  //010
+/* alu instructions that can ony exits once per group */
+static int is_alu_once_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+       switch (bc->chiprev) {
+       case CHIPREV_R600:
+       case CHIPREV_R700:
+               return !alu->is_op3 && (
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_UINT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_UINT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_UINT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_UINT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_INV ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_POP ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_CLR ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_RESTORE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLT_PUSH_INT ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLE_PUSH_INT);
+       case CHIPREV_EVERGREEN:
+       default:
+               return !alu->is_op3 && (
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_UINT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_UINT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_UINT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_UINT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_INV ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_POP ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_CLR ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_RESTORE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLT_PUSH_INT ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLE_PUSH_INT);
+       }
+}
 
-                                     SQ_ALU_VEC_201,  //011
-                                     SQ_ALU_VEC_012,  //100
-                                     SQ_ALU_VEC_021,  //101
+static int is_alu_reduction_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+       switch (bc->chiprev) {
+       case CHIPREV_R600:
+       case CHIPREV_R700:
+               return !alu->is_op3 && (
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4 ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX4);
+       case CHIPREV_EVERGREEN:
+       default:
+               return !alu->is_op3 && (
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4 ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE ||
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX4);
+       }
+}
 
-                                     SQ_ALU_VEC_012,  //110
-                                     SQ_ALU_VEC_012}; //111
+static int is_alu_mova_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+       switch (bc->chiprev) {
+       case CHIPREV_R600:
+       case CHIPREV_R700:
+               return !alu->is_op3 && (
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR ||
+                       alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT);
+       case CHIPREV_EVERGREEN:
+       default:
+               return !alu->is_op3 && (
+                       alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT);
+       }
+}
 
-const unsigned bank_swizzle_scl[8] = {SQ_ALU_SCL_210,  //000
-                                     SQ_ALU_SCL_122,  //001
-                                     SQ_ALU_SCL_122,  //010
+/* alu instructions that can only execute on the vector unit */
+static int is_alu_vec_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+       return is_alu_reduction_inst(bc, alu) ||
+               is_alu_mova_inst(bc, alu);
+}
 
-                                     SQ_ALU_SCL_221,  //011
-                                     SQ_ALU_SCL_212,  //100
-                                     SQ_ALU_SCL_122,  //101
+/* alu instructions that can only execute on the trans unit */
+static int is_alu_trans_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+       switch (bc->chiprev) {
+       case CHIPREV_R600:
+       case CHIPREV_R700:
+               if (!alu->is_op3)
+                       return alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_INT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_INT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_INT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_UINT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_FF ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_FF ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN ||
+                               alu->inst == V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_IEEE;
+               else
+                       return alu->inst == V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT ||
+                               alu->inst == V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_D2 ||
+                               alu->inst == V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_M2 ||
+                               alu->inst == V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_M4;
+       case CHIPREV_EVERGREEN:
+       default:
+               if (!alu->is_op3)
+                       return alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_INT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_INT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_INT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_UINT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_FF ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_FF ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN ||
+                               alu->inst == EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_IEEE;
+               else
+                       return alu->inst == EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT;
+       }
+}
+
+/* alu instructions that can execute on any unit */
+static int is_alu_any_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+       return !is_alu_vec_unit_inst(bc, alu) &&
+               !is_alu_trans_unit_inst(bc, alu);
+}
+
+static int assign_alu_units(struct r600_bc *bc, struct r600_bc_alu *alu_first,
+                           struct r600_bc_alu *assignment[5])
+{
+       struct r600_bc_alu *alu;
+       unsigned i, chan, trans;
+
+       for (i = 0; i < 5; i++)
+               assignment[i] = NULL;
+
+       for (alu = alu_first; alu; alu = LIST_ENTRY(struct r600_bc_alu, alu->list.next, list)) {
+               chan = alu->dst.chan;
+               if (is_alu_trans_unit_inst(bc, alu))
+                       trans = 1;
+               else if (is_alu_vec_unit_inst(bc, alu))
+                       trans = 0;
+               else if (assignment[chan])
+                       trans = 1; // assume ALU_INST_PREFER_VECTOR
+               else
+                       trans = 0;
 
-                                     SQ_ALU_SCL_122,  //110
-                                     SQ_ALU_SCL_122}; //111
+               if (trans) {
+                       if (assignment[4]) {
+                               assert(0); //ALU.Trans has already been allocated
+                               return -1;
+                       }
+                       assignment[4] = alu;
+               } else {
+                       if (assignment[chan]) {
+                               assert(0); //ALU.chan has already been allocated
+                               return -1;
+                       }
+                       assignment[chan] = alu;
+               }
 
-static int init_gpr(struct r600_bc_alu *alu)
+               if (alu->last)
+                       break;
+       }
+       return 0;
+}
+
+struct alu_bank_swizzle {
+       int     hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
+       int     hw_cfile_addr[4];
+       int     hw_cfile_elem[4];
+};
+
+const unsigned cycle_for_bank_swizzle_vec[][3] = {
+       [SQ_ALU_VEC_012] = { 0, 1, 2 },
+       [SQ_ALU_VEC_021] = { 0, 2, 1 },
+       [SQ_ALU_VEC_120] = { 1, 2, 0 },
+       [SQ_ALU_VEC_102] = { 1, 0, 2 },
+       [SQ_ALU_VEC_201] = { 2, 0, 1 },
+       [SQ_ALU_VEC_210] = { 2, 1, 0 }
+};
+
+const unsigned cycle_for_bank_swizzle_scl[][3] = {
+       [SQ_ALU_SCL_210] = { 2, 1, 0 },
+       [SQ_ALU_SCL_122] = { 1, 2, 2 },
+       [SQ_ALU_SCL_212] = { 2, 1, 2 },
+       [SQ_ALU_SCL_221] = { 2, 2, 1 }
+};
+
+static void init_bank_swizzle(struct alu_bank_swizzle *bs)
 {
-       int cycle, component;
+       int i, cycle, component;
        /* set up gpr use */
        for (cycle = 0; cycle < NUM_OF_CYCLES; cycle++)
                for (component = 0; component < NUM_OF_COMPONENTS; component++)
-                        alu->hw_gpr[cycle][component] = -1;
-       return 0;
+                        bs->hw_gpr[cycle][component] = -1;
+       for (i = 0; i < 4; i++)
+               bs->hw_cfile_addr[i] = -1;
+       for (i = 0; i < 4; i++)
+               bs->hw_cfile_elem[i] = -1;
 }
-
-#if 0
-static int reserve_gpr(struct r600_bc_alu *alu, unsigned sel, unsigned chan, unsigned cycle)
+static int reserve_gpr(struct alu_bank_swizzle *bs, unsigned sel, unsigned chan, unsigned cycle)
 {
-       if (alu->hw_gpr[cycle][chan] < 0)
-               alu->hw_gpr[cycle][chan] = sel;
-       else if (alu->hw_gpr[cycle][chan] != (int)sel) {
-               R600_ERR("Another scalar operation has already used GPR read port for channel\n");
+       if (bs->hw_gpr[cycle][chan] == -1)
+               bs->hw_gpr[cycle][chan] = sel;
+       else if (bs->hw_gpr[cycle][chan] != (int)sel) {
+               // Another scalar operation has already used GPR read port for channel
                return -1;
        }
        return 0;
 }
-
-static int cycle_for_scalar_bank_swizzle(const int swiz, const int sel, unsigned *p_cycle)
-{
-       int table[3];
-       int ret = 0;
-       switch (swiz) {
-       case SQ_ALU_SCL_210:
-               table[0] = 2; table[1] = 1; table[2] = 0;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_SCL_122:
-               table[0] = 1; table[1] = 2; table[2] = 2;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_SCL_212:
-               table[0] = 2; table[1] = 1; table[2] = 2;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_SCL_221:
-               table[0] = 2; table[1] = 2; table[2] = 1;
-               *p_cycle = table[sel];
-                break;
-               break;
-       default:
-               R600_ERR("bad scalar bank swizzle value\n");
-               ret = -1;
-               break;
+static int reserve_cfile(struct alu_bank_swizzle *bs, unsigned sel, unsigned chan)
+{
+       int res, resmatch = -1, resempty = -1;
+       for (res = 3; res >= 0; --res) {
+               if (bs->hw_cfile_addr[res] == -1)
+                       resempty = res;
+               else if (bs->hw_cfile_addr[res] == sel &&
+                       bs->hw_cfile_elem[res] == chan)
+                       resmatch = res;
        }
-       return ret;
-}
-
-static int cycle_for_vector_bank_swizzle(const int swiz, const int sel, unsigned *p_cycle)
-{
-       int table[3];
-       int ret;
-
-       switch (swiz) {
-       case SQ_ALU_VEC_012:
-               table[0] = 0; table[1] = 1; table[2] = 2;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_VEC_021:
-               table[0] = 0; table[1] = 2; table[2] = 1;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_VEC_120:
-               table[0] = 1; table[1] = 2; table[2] = 0;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_VEC_102:
-               table[0] = 1; table[1] = 0; table[2] = 2;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_VEC_201:
-               table[0] = 2; table[1] = 0; table[2] = 1;
-                *p_cycle = table[sel];
-                break;
-       case SQ_ALU_VEC_210:
-               table[0] = 2; table[1] = 1; table[2] = 0;
-                *p_cycle = table[sel];
-                break;
-       default:
-               R600_ERR("bad vector bank swizzle value\n");
-               ret = -1;
-               break;
+       if (resmatch != -1)
+               return 0; // Read for this scalar element already reserved, nothing to do here.
+       else if (resempty != -1) {
+               bs->hw_cfile_addr[resempty] = sel;
+               bs->hw_cfile_elem[resempty] = chan;
+       } else {
+               // All cfile read ports are used, cannot reference vector element
+               return -1;
        }
-       return ret;
+       return 0;       
+}
+static int is_gpr(unsigned sel)
+{
+       return (sel >= 0 && sel <= 127);
 }
 
+/* CB constants start at 512, and get translated to a kcache index when ALU
+ * clauses are constructed. Note that we handle kcache constants the same way
+ * as (the now gone) cfile constants, is that really required? */
+static int is_cfile(unsigned sel)
+{
+       return (sel > 255 && sel < 512) ||
+               (sel > 511 && sel < 4607) || // Kcache before translate
+               (sel > 127 && sel < 192); // Kcache after translate
+}
+static int is_const(int sel)
+{
+       return is_cfile(sel) ||
+               (sel >= V_SQ_ALU_SRC_0 && 
+               sel <= V_SQ_ALU_SRC_LITERAL);
+}
+static int check_vector(struct r600_bc *bc, struct r600_bc_alu *alu,
+                       struct alu_bank_swizzle *bs, int bank_swizzle)
+{
+       int r, src, num_src, sel, elem, cycle;
+       num_src = r600_bc_get_num_operands(bc, alu);
+       for (src = 0; src < num_src; src++) {
+               sel = alu->src[src].sel;
+               elem = alu->src[src].chan;
+               if (is_gpr(sel)) {
+                       cycle = cycle_for_bank_swizzle_vec[bank_swizzle][src];
+                       if (src == 1 && sel == alu->src[0].sel && elem == alu->src[0].chan)
+                               // Nothing to do; special-case optimization, 
+                               // second source uses first source’s reservation
+                               continue;
+                       else {
+                               r = reserve_gpr(bs, sel, elem, cycle);
+                               if (r)
+                                       return r;
+                       }
+               } else if (is_cfile(sel)) {
+                       r = reserve_cfile(bs, sel, elem);
+                       if (r)
+                               return r;
+               }
+               // No restrictions on PV, PS, literal or special constants
+       }
+       return 0;
+}
+static int check_scalar(struct r600_bc *bc, struct r600_bc_alu *alu,
+                       struct alu_bank_swizzle *bs, int bank_swizzle)
+{
+       int r, src, num_src, const_count, sel, elem, cycle;
+       num_src = r600_bc_get_num_operands(bc, alu);
+       for (const_count = 0, src = 0; src < num_src; ++src) {
+               sel = alu->src[src].sel;
+               elem = alu->src[src].chan;
+               if (is_const(sel)) { // Any constant, including literal and inline constants
+                       if (const_count >= 2)
+                               // More than two references to a constant in
+                               // transcendental operation.
+                               return -1; 
+                       else
+                               const_count++;
+               }
+               if (is_cfile(sel)) {
+                       r = reserve_cfile(bs, sel, elem);
+                       if (r)
+                               return r;
+               }
+       }
+       for (src = 0; src < num_src; ++src) {
+               sel = alu->src[src].sel;
+               elem = alu->src[src].chan;
+               if (is_gpr(sel)) {
+                       cycle = cycle_for_bank_swizzle_scl[bank_swizzle][src];
+                       if (cycle < const_count)
+                               // Cycle for GPR load conflicts with
+                               // constant load in transcendental operation.
+                               return -1;
+                       r = reserve_gpr(bs, sel, elem, cycle);
+                       if (r)
+                               return r;
+               }
+               // Constants already processed
+               // No restrictions on PV, PS
+       }
+       return 0;
+}
 
-
-static void update_chan_counter(struct r600_bc_alu *alu, int *chan_counter)
+static int check_and_set_bank_swizzle(struct r600_bc *bc,
+                                     struct r600_bc_alu *slots[5])
 {
-       int num_src;
-       int i;
-       int channel_swizzle;
+       struct alu_bank_swizzle bs;
+       int bank_swizzle[5];
+       int i, r = 0, forced = 0;
+       for (i = 0; i < 5; i++)
+               if (slots[i] && slots[i]->bank_swizzle_force) {
+                       slots[i]->bank_swizzle = slots[i]->bank_swizzle_force;
+                       forced = 1;
+               }
 
-       num_src = r600_bc_get_num_operands(alu);
+       if (forced)
+               return 0;
 
-       for (i = 0; i < num_src; i++) {
-               channel_swizzle = alu->src[i].chan;
-               if ((alu->src[i].sel > 0 && alu->src[i].sel < 128) && channel_swizzle <= 3)
-                       chan_counter[channel_swizzle]++;
+       // just check every possible combination of bank swizzle
+       // not very efficent, but works on the first try in most of the cases
+       for (i = 0; i < 4; i++)
+               bank_swizzle[i] = SQ_ALU_VEC_012;
+       bank_swizzle[4] = SQ_ALU_SCL_210;
+       while(bank_swizzle[4] <= SQ_ALU_SCL_221) {
+               init_bank_swizzle(&bs);
+               for (i = 0; i < 4; i++) {
+                       if (slots[i]) {
+                               r = check_vector(bc, slots[i], &bs, bank_swizzle[i]);
+                               if (r)
+                                       break;
+                       }
+               }
+               if (!r && slots[4]) {
+                       r = check_scalar(bc, slots[4], &bs, bank_swizzle[4]);
+               }
+               if (!r) {
+                       for (i = 0; i < 5; i++) {
+                               if (slots[i])
+                                       slots[i]->bank_swizzle = bank_swizzle[i];
+                       }
+                       return 0;
+               }
+
+               for (i = 0; i < 5; i++) {
+                       bank_swizzle[i]++;
+                       if (bank_swizzle[i] <= SQ_ALU_VEC_210)
+                               break;
+                       else
+                               bank_swizzle[i] = SQ_ALU_VEC_012;
+               }
        }
+
+       // couldn't find a working swizzle
+       return -1;
 }
 
-/* we need something like this I think - but this is bogus */
-int check_read_slots(struct r600_bc *bc, struct r600_bc_alu *alu_first)
+static int replace_gpr_with_pv_ps(struct r600_bc *bc,
+                                 struct r600_bc_alu *slots[5], struct r600_bc_alu *alu_prev)
 {
-       struct r600_bc_alu *alu;
-       int chan_counter[4]  = { 0 };
+       struct r600_bc_alu *prev[5];
+       int gpr[5], chan[5];
+       int i, j, r, src, num_src;
 
-       update_chan_counter(alu_first, chan_counter);
+       r = assign_alu_units(bc, alu_prev, prev);
+       if (r)
+               return r;
 
-       LIST_FOR_EACH_ENTRY(alu, &alu_first->bs_list, bs_list) {
-               update_chan_counter(alu, chan_counter);
+       for (i = 0; i < 5; ++i) {
+               if(prev[i] && prev[i]->dst.write && !prev[i]->dst.rel) {
+                       gpr[i] = prev[i]->dst.sel;
+                       if (is_alu_reduction_inst(bc, prev[i]))
+                               chan[i] = 0;
+                       else
+                               chan[i] = prev[i]->dst.chan;
+               } else
+                       gpr[i] = -1;
        }
 
-       if (chan_counter[0] > 3 ||
-           chan_counter[1] > 3 ||
-           chan_counter[2] > 3 ||
-           chan_counter[3] > 3) {
-               R600_ERR("needed to split instruction for input ran out of banks %x %d %d %d %d\n",
-                        alu_first->inst, chan_counter[0], chan_counter[1], chan_counter[2], chan_counter[3]);
-               return -1;
+       for (i = 0; i < 5; ++i) {
+               struct r600_bc_alu *alu = slots[i];
+               if(!alu)
+                       continue;
+
+               num_src = r600_bc_get_num_operands(bc, alu);
+               for (src = 0; src < num_src; ++src) {
+                       if (!is_gpr(alu->src[src].sel) || alu->src[src].rel)
+                               continue;
+
+                       if (alu->src[src].sel == gpr[4] &&
+                               alu->src[src].chan == chan[4]) {
+                               alu->src[src].sel = V_SQ_ALU_SRC_PS;
+                               alu->src[src].chan = 0;
+                               continue;
+                       }
+
+                       for (j = 0; j < 4; ++j) {
+                               if (alu->src[src].sel == gpr[j] &&
+                                       alu->src[src].chan == j) {
+                                       alu->src[src].sel = V_SQ_ALU_SRC_PV;
+                                       alu->src[src].chan = chan[j];
+                                       break;
+                               }
+                       }
+               }
        }
+
        return 0;
 }
-#endif
 
-static int is_const(int sel)
+void r600_bc_special_constants(u32 value, unsigned *sel, unsigned *neg)
 {
-       if (sel > 255 && sel < 512)
-               return 1;
-       if (sel >= V_SQ_ALU_SRC_0 && sel <= V_SQ_ALU_SRC_LITERAL)
-               return 1;
-       return 0;
+       switch(value) {
+       case 0:
+               *sel = V_SQ_ALU_SRC_0;
+               break;
+       case 1:
+               *sel = V_SQ_ALU_SRC_1_INT;
+               break;
+       case -1:
+               *sel = V_SQ_ALU_SRC_M_1_INT;
+               break;
+       case 0x3F800000: // 1.0f
+               *sel = V_SQ_ALU_SRC_1;
+               break;
+       case 0x3F000000: // 0.5f
+               *sel = V_SQ_ALU_SRC_0_5;
+               break;
+       case 0xBF800000: // -1.0f
+               *sel = V_SQ_ALU_SRC_1;
+               *neg ^= 1;
+               break;
+       case 0xBF000000: // -0.5f
+               *sel = V_SQ_ALU_SRC_0_5;
+               *neg ^= 1;
+               break;
+       default:
+               *sel = V_SQ_ALU_SRC_LITERAL;
+               break;
+       }
 }
 
-static int check_scalar(struct r600_bc *bc, struct r600_bc_alu *alu)
+/* compute how many literal are needed */
+static int r600_bc_alu_nliterals(struct r600_bc *bc, struct r600_bc_alu *alu,
+                                uint32_t literal[4], unsigned *nliteral)
 {
-       unsigned swizzle_key;
-
-       if (alu->bank_swizzle_force) {
-               alu->bank_swizzle = alu->bank_swizzle_force;
-               return 0;
+       unsigned num_src = r600_bc_get_num_operands(bc, alu);
+       unsigned i, j;
+
+       for (i = 0; i < num_src; ++i) {
+               if (alu->src[i].sel == V_SQ_ALU_SRC_LITERAL) {
+                       uint32_t value = alu->src[i].value[alu->src[i].chan];
+                       unsigned found = 0;
+                       for (j = 0; j < *nliteral; ++j) {
+                               if (literal[j] == value) {
+                                       found = 1;
+                                       break;
+                               }
+                       }
+                       if (!found) {
+                               if (*nliteral >= 4)
+                                       return -EINVAL;
+                               literal[(*nliteral)++] = value;
+                       }
+               }
        }
-       swizzle_key = (is_const(alu->src[0].sel) ? 4 : 0 ) + 
-               (is_const(alu->src[1].sel) ? 2 : 0 ) + 
-               (is_const(alu->src[2].sel) ? 1 : 0 );
-
-       alu->bank_swizzle = bank_swizzle_scl[swizzle_key];
        return 0;
 }
 
-static int check_vector(struct r600_bc *bc, struct r600_bc_alu *alu)
+static void r600_bc_alu_adjust_literals(struct r600_bc *bc,
+                                       struct r600_bc_alu *alu,
+                                       uint32_t literal[4], unsigned nliteral)
+{
+       unsigned num_src = r600_bc_get_num_operands(bc, alu);
+       unsigned i, j;
+
+       for (i = 0; i < num_src; ++i) {
+               if (alu->src[i].sel == V_SQ_ALU_SRC_LITERAL) {
+                       uint32_t value = alu->src[i].value[alu->src[i].chan];
+                       for (j = 0; j < nliteral; ++j) {
+                               if (literal[j] == value) {
+                                       alu->src[i].chan = j;
+                                       break;
+                               }
+                       }
+               }
+       }
+}
+
+static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
+                            struct r600_bc_alu *alu_prev)
 {
-       unsigned swizzle_key;
+       struct r600_bc_alu *prev[5];
+       struct r600_bc_alu *result[5] = { NULL };
+
+       uint32_t literal[4];
+       unsigned nliteral = 0;
+
+       int i, j, r, src, num_src;
+       int num_once_inst = 0;
+
+       r = assign_alu_units(bc, alu_prev, prev);
+       if (r)
+               return r;
 
-       if (alu->bank_swizzle_force) {
-               alu->bank_swizzle = alu->bank_swizzle_force;
+       for (i = 0; i < 5; ++i) {
+               struct r600_bc_alu *alu;
+
+               /* check number of literals */
+               if (prev[i] && r600_bc_alu_nliterals(bc, prev[i], literal, &nliteral))
+                       return 0;
+               if (slots[i] && r600_bc_alu_nliterals(bc, slots[i], literal, &nliteral))
+                       return 0;
+
+               // let's check used slots
+               if (prev[i] && !slots[i]) {
+                       result[i] = prev[i];
+                       num_once_inst += is_alu_once_inst(bc, prev[i]);
+                       continue;
+               } else if (prev[i] && slots[i]) {
+                       if (result[4] == NULL && prev[4] == NULL && slots[4] == NULL) {
+                               // trans unit is still free try to use it
+                               if (is_alu_any_unit_inst(bc, slots[i])) {
+                                       result[i] = prev[i];
+                                       result[4] = slots[i];
+                               } else if (is_alu_any_unit_inst(bc, prev[i])) {
+                                       result[i] = slots[i];
+                                       result[4] = prev[i];
+                               } else
+                                       return 0;
+                       } else
+                               return 0;
+               } else if(!slots[i]) {
+                       continue;
+               } else 
+                       result[i] = slots[i];
+
+               // let's check source gprs
+               alu = slots[i];
+               num_once_inst += is_alu_once_inst(bc, alu);
+
+               num_src = r600_bc_get_num_operands(bc, alu);
+               for (src = 0; src < num_src; ++src) {
+                       // constants doesn't matter
+                       if (!is_gpr(alu->src[src].sel))
+                               continue;
+
+                       for (j = 0; j < 5; ++j) {
+                               if (!prev[j] || !prev[j]->dst.write)
+                                       continue;
+
+                               // if it's relative then we can't determin which gpr is really used
+                               if (prev[j]->dst.chan == alu->src[src].chan &&
+                                       (prev[j]->dst.sel == alu->src[src].sel ||
+                                       prev[j]->dst.rel || alu->src[src].rel))
+                                       return 0;
+                       }
+               }
+       }
+
+       /* more than one PRED_ or KILL_ ? */
+       if (num_once_inst > 1)
                return 0;
+
+       /* check if the result can still be swizzlet */
+       r = check_and_set_bank_swizzle(bc, result);
+       if (r)
+               return 0;
+
+       /* looks like everything worked out right, apply the changes */
+
+       /* sort instructions */
+       for (i = 0; i < 5; ++i) {
+               slots[i] = result[i];
+               if (result[i]) {
+                       LIST_DEL(&result[i]->list);
+                       result[i]->last = 0;
+                       LIST_ADDTAIL(&result[i]->list, &bc->cf_last->alu);
+               }
+       }
+
+       /* determine new last instruction */
+       LIST_ENTRY(struct r600_bc_alu, bc->cf_last->alu.prev, list)->last = 1;
+
+       /* determine new first instruction */
+       for (i = 0; i < 5; ++i) {
+               if (result[i]) {
+                       bc->cf_last->curr_bs_head = result[i];
+                       break;
+               }
        }
-       swizzle_key = (is_const(alu->src[0].sel) ? 4 : 0 ) + 
-               (is_const(alu->src[1].sel) ? 2 : 0 ) + 
-               (is_const(alu->src[2].sel) ? 1 : 0 );
 
-       alu->bank_swizzle = bank_swizzle_vec[swizzle_key];
+       bc->cf_last->prev_bs_head = bc->cf_last->prev2_bs_head;
+       bc->cf_last->prev2_bs_head = NULL;
+
        return 0;
 }
 
-static int check_and_set_bank_swizzle(struct r600_bc *bc, struct r600_bc_alu *alu_first)
+/* This code handles kcache lines as single blocks of 32 constants. We could
+ * probably do slightly better by recognizing that we actually have two
+ * consecutive lines of 16 constants, but the resulting code would also be
+ * somewhat more complicated. */
+static int r600_bc_alloc_kcache_lines(struct r600_bc *bc, struct r600_bc_alu *alu, int type)
 {
-       struct r600_bc_alu *alu = NULL;
-       int num_instr = 1;
+       struct r600_bc_kcache *kcache = bc->cf_last->kcache;
+       unsigned int required_lines;
+       unsigned int free_lines = 0;
+       unsigned int cache_line[3];
+       unsigned int count = 0;
+       unsigned int i, j;
+       int r;
+
+       /* Collect required cache lines. */
+       for (i = 0; i < 3; ++i) {
+               bool found = false;
+               unsigned int line;
+
+               if (alu->src[i].sel < 512)
+                       continue;
+
+               line = ((alu->src[i].sel - 512) / 32) * 2;
+
+               for (j = 0; j < count; ++j) {
+                       if (cache_line[j] == line) {
+                               found = true;
+                               break;
+                       }
+               }
+
+               if (!found)
+                       cache_line[count++] = line;
+       }
 
-       init_gpr(alu_first);
+       /* This should never actually happen. */
+       if (count >= 3) return -ENOMEM;
 
-       LIST_FOR_EACH_ENTRY(alu, &alu_first->bs_list, bs_list) {
-               num_instr++;
+       for (i = 0; i < 2; ++i) {
+               if (kcache[i].mode == V_SQ_CF_KCACHE_NOP) {
+                       ++free_lines;
+               }
        }
 
-       if (num_instr == 1) {
-               check_scalar(bc, alu_first);
-               
-       } else {
-/*             check_read_slots(bc, bc->cf_last->curr_bs_head);*/
-               check_vector(bc, alu_first);
-               LIST_FOR_EACH_ENTRY(alu, &alu_first->bs_list, bs_list) {
-                       check_vector(bc, alu);
+       /* Filter lines pulled in by previous intructions. Note that this is
+        * only for the required_lines count, we can't remove these from the
+        * cache_line array since we may have to start a new ALU clause. */
+       for (i = 0, required_lines = count; i < count; ++i) {
+               for (j = 0; j < 2; ++j) {
+                       if (kcache[j].mode == V_SQ_CF_KCACHE_LOCK_2 &&
+                           kcache[j].addr == cache_line[i]) {
+                               --required_lines;
+                               break;
+                       }
+               }
+       }
+
+       /* Start a new ALU clause if needed. */
+       if (required_lines > free_lines) {
+               if ((r = r600_bc_add_cf(bc))) {
+                       return r;
+               }
+               bc->cf_last->inst = (type << 3);
+               kcache = bc->cf_last->kcache;
+       }
+
+       /* Setup the kcache lines. */
+       for (i = 0; i < count; ++i) {
+               bool found = false;
+
+               for (j = 0; j < 2; ++j) {
+                       if (kcache[j].mode == V_SQ_CF_KCACHE_LOCK_2 &&
+                           kcache[j].addr == cache_line[i]) {
+                               found = true;
+                               break;
+                       }
+               }
+
+               if (found) continue;
+
+               for (j = 0; j < 2; ++j) {
+                       if (kcache[j].mode == V_SQ_CF_KCACHE_NOP) {
+                               kcache[j].bank = 0;
+                               kcache[j].addr = cache_line[i];
+                               kcache[j].mode = V_SQ_CF_KCACHE_LOCK_2;
+                               break;
+                       }
+               }
+       }
+
+       /* Alter the src operands to refer to the kcache. */
+       for (i = 0; i < 3; ++i) {
+               static const unsigned int base[] = {128, 160, 256, 288};
+               unsigned int line;
+
+               if (alu->src[i].sel < 512)
+                       continue;
+
+               alu->src[i].sel -= 512;
+               line = (alu->src[i].sel / 32) * 2;
+
+               for (j = 0; j < 2; ++j) {
+                       if (kcache[j].mode == V_SQ_CF_KCACHE_LOCK_2 &&
+                           kcache[j].addr == line) {
+                               alu->src[i].sel &= 0x1f;
+                               alu->src[i].sel += base[j];
+                               break;
+                       }
                }
        }
+
        return 0;
 }
 
@@ -416,62 +1073,89 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
        if (nalu == NULL)
                return -ENOMEM;
        memcpy(nalu, alu, sizeof(struct r600_bc_alu));
-       nalu->nliteral = 0;
+
+       if (bc->cf_last != NULL && bc->cf_last->inst != (type << 3)) {
+               /* check if we could add it anyway */
+               if (bc->cf_last->inst == (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3) &&
+                       type == V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE) {
+                       LIST_FOR_EACH_ENTRY(lalu, &bc->cf_last->alu, list) {
+                               if (lalu->predicate) {
+                                       bc->force_add_cf = 1;
+                                       break;
+                               }
+                       }
+               } else
+                       bc->force_add_cf = 1;
+       }
 
        /* cf can contains only alu or only vtx or only tex */
-       if (bc->cf_last == NULL || bc->cf_last->inst != (type << 3) ||
-               bc->force_add_cf) {
+       if (bc->cf_last == NULL || bc->force_add_cf) {
                r = r600_bc_add_cf(bc);
                if (r) {
                        free(nalu);
                        return r;
                }
-               bc->cf_last->inst = (type << 3);
        }
+       bc->cf_last->inst = (type << 3);
+
+       /* Setup the kcache for this ALU instruction. This will start a new
+        * ALU clause if needed. */
+       if ((r = r600_bc_alloc_kcache_lines(bc, nalu, type))) {
+               free(nalu);
+               return r;
+       }
+
        if (!bc->cf_last->curr_bs_head) {
                bc->cf_last->curr_bs_head = nalu;
-               LIST_INITHEAD(&nalu->bs_list);
-       } else {
-               LIST_ADDTAIL(&nalu->bs_list, &bc->cf_last->curr_bs_head->bs_list);
        }
-       /* at most 128 slots, one add alu can add 4 slots + 4 constants(2 slots)
+       /* at most 128 slots, one add alu can add 5 slots + 4 constants(2 slots)
         * worst case */
-       if (alu->last && (bc->cf_last->ndw >> 1) >= 120) {
+       if (nalu->last && (bc->cf_last->ndw >> 1) >= 120) {
                bc->force_add_cf = 1;
        }
        /* number of gpr == the last gpr used in any alu */
        for (i = 0; i < 3; i++) {
-               if (alu->src[i].sel >= bc->ngpr && alu->src[i].sel < 128) {
-                       bc->ngpr = alu->src[i].sel + 1;
-               }
-               /* compute how many literal are needed
-                * either 2 or 4 literals
-                */
-               if (alu->src[i].sel == 253) {
-                       if (((alu->src[i].chan + 2) & 0x6) > nalu->nliteral) {
-                               nalu->nliteral = (alu->src[i].chan + 2) & 0x6;
-                       }
-               }
-       }
-       if (!LIST_IS_EMPTY(&bc->cf_last->alu)) {
-               lalu = LIST_ENTRY(struct r600_bc_alu, bc->cf_last->alu.prev, list);
-               if (!lalu->last && lalu->nliteral > nalu->nliteral) {
-                       nalu->nliteral = lalu->nliteral;
+               if (nalu->src[i].sel >= bc->ngpr && nalu->src[i].sel < 128) {
+                       bc->ngpr = nalu->src[i].sel + 1;
                }
+               if (nalu->src[i].sel == V_SQ_ALU_SRC_LITERAL)
+                       r600_bc_special_constants(
+                               nalu->src[i].value[nalu->src[i].chan], 
+                               &nalu->src[i].sel, &nalu->src[i].neg);
        }
-       if (alu->dst.sel >= bc->ngpr) {
-               bc->ngpr = alu->dst.sel + 1;
+       if (nalu->dst.sel >= bc->ngpr) {
+               bc->ngpr = nalu->dst.sel + 1;
        }
        LIST_ADDTAIL(&nalu->list, &bc->cf_last->alu);
        /* each alu use 2 dwords */
        bc->cf_last->ndw += 2;
        bc->ndw += 2;
 
-       bc->cf_last->kcache0_mode = 2;
-
        /* process cur ALU instructions for bank swizzle */
-       if (alu->last) {
-               check_and_set_bank_swizzle(bc, bc->cf_last->curr_bs_head);
+       if (nalu->last) {
+               struct r600_bc_alu *slots[5];
+               r = assign_alu_units(bc, bc->cf_last->curr_bs_head, slots);
+               if (r)
+                       return r;
+
+               if (bc->cf_last->prev_bs_head) {
+                       r = merge_inst_groups(bc, slots, bc->cf_last->prev_bs_head);
+                       if (r)
+                               return r;
+               }
+
+               if (bc->cf_last->prev_bs_head) {
+                       r = replace_gpr_with_pv_ps(bc, slots, bc->cf_last->prev_bs_head);
+                       if (r)
+                               return r;
+               }
+
+               r = check_and_set_bank_swizzle(bc, slots);
+               if (r)
+                       return r;
+
+               bc->cf_last->prev2_bs_head = bc->cf_last->prev_bs_head;
+               bc->cf_last->prev_bs_head = bc->cf_last->curr_bs_head;
                bc->cf_last->curr_bs_head = NULL;
        }
        return 0;
@@ -482,44 +1166,6 @@ int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu)
        return r600_bc_add_alu_type(bc, alu, BC_INST(bc, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU));
 }
 
-int r600_bc_add_literal(struct r600_bc *bc, const u32 *value)
-{
-       struct r600_bc_alu *alu;
-
-       if (bc->cf_last == NULL) {
-               return 0;
-       }
-       if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_TEX) {
-               return 0;
-       }
-       /* all same on EG */
-       if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_JUMP ||
-           bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_ELSE ||
-           bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL ||
-           bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK ||
-           bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE ||
-           bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END ||
-           bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_POP) {
-               return 0;
-       }
-       /* same on EG */
-       if (((bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3)) &&
-            (bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3))) ||
-               LIST_IS_EMPTY(&bc->cf_last->alu)) {
-               R600_ERR("last CF is not ALU (%p)\n", bc->cf_last);
-               return -EINVAL;
-       }
-       alu = LIST_ENTRY(struct r600_bc_alu, bc->cf_last->alu.prev, list);
-       if (!alu->last || !alu->nliteral || alu->literal_added) {
-               return 0;
-       }
-       memcpy(alu->value, value, 4 * 4);
-       bc->cf_last->ndw += alu->nliteral;
-       bc->ndw += alu->nliteral;
-       alu->literal_added = 1;
-       return 0;
-}
-
 int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx)
 {
        struct r600_bc_vtx *nvtx = r600_bc_vtx();
@@ -545,7 +1191,7 @@ int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx)
        /* each fetch use 4 dwords */
        bc->cf_last->ndw += 4;
        bc->ndw += 4;
-       if ((bc->ndw / 4) > 7)
+       if ((bc->cf_last->ndw / 4) > 7)
                bc->force_add_cf = 1;
        return 0;
 }
@@ -570,11 +1216,17 @@ int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex)
                }
                bc->cf_last->inst = V_SQ_CF_WORD1_SQ_CF_INST_TEX;
        }
+       if (ntex->src_gpr >= bc->ngpr) {
+               bc->ngpr = ntex->src_gpr + 1;
+       }
+       if (ntex->dst_gpr >= bc->ngpr) {
+               bc->ngpr = ntex->dst_gpr + 1;
+       }
        LIST_ADDTAIL(&ntex->list, &bc->cf_last->tex);
        /* each texture fetch use 4 dwords */
        bc->cf_last->ndw += 4;
        bc->ndw += 4;
-       if ((bc->ndw / 4) > 7)
+       if ((bc->cf_last->ndw / 4) > 7)
                bc->force_add_cf = 1;
        return 0;
 }
@@ -670,8 +1322,6 @@ static int r600_bc_tex_build(struct r600_bc *bc, struct r600_bc_tex *tex, unsign
 /* r600 only, r700/eg bits in r700_asm.c */
 static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id)
 {
-       unsigned i;
-
        /* don't replace gpr by pv or ps for destination register */
        bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
                                S_SQ_ALU_WORD0_SRC0_REL(alu->src[0].rel) |
@@ -702,19 +1352,12 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign
                                        S_SQ_ALU_WORD1_OP2_SRC0_ABS(alu->src[0].abs) |
                                        S_SQ_ALU_WORD1_OP2_SRC1_ABS(alu->src[1].abs) |
                                        S_SQ_ALU_WORD1_OP2_WRITE_MASK(alu->dst.write) |
+                                       S_SQ_ALU_WORD1_OP2_OMOD(alu->omod) |
                                        S_SQ_ALU_WORD1_OP2_ALU_INST(alu->inst) |
                                        S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle) |
                                        S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->predicate) |
                                        S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate);
        }
-       if (alu->last) {
-               if (alu->nliteral && !alu->literal_added) {
-                       R600_ERR("Bug in ALU processing for instruction 0x%08x, literal not added correctly\n", alu->inst);
-               }
-               for (i = 0; i < alu->nliteral; i++) {
-                       bc->bytecode[id++] = alu->value[i];
-               }
-       }
        return 0;
 }
 
@@ -726,15 +1369,17 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
        switch (cf->inst) {
        case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3):
        case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3):
+       case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER << 3):
+       case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER << 3):
                bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1) |
-                       S_SQ_CF_ALU_WORD0_KCACHE_MODE0(cf->kcache0_mode) |
-                       S_SQ_CF_ALU_WORD0_KCACHE_BANK0(cf->kcache0_bank) |
-                       S_SQ_CF_ALU_WORD0_KCACHE_BANK1(cf->kcache1_bank);
+                       S_SQ_CF_ALU_WORD0_KCACHE_MODE0(cf->kcache[0].mode) |
+                       S_SQ_CF_ALU_WORD0_KCACHE_BANK0(cf->kcache[0].bank) |
+                       S_SQ_CF_ALU_WORD0_KCACHE_BANK1(cf->kcache[1].bank);
 
                bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(cf->inst >> 3) |
-                       S_SQ_CF_ALU_WORD1_KCACHE_MODE1(cf->kcache1_mode) |
-                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(cf->kcache0_addr) |
-                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(cf->kcache1_addr) |
+                       S_SQ_CF_ALU_WORD1_KCACHE_MODE1(cf->kcache[1].mode) |
+                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(cf->kcache[0].addr) |
+                       S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(cf->kcache[1].addr) |
                                        S_SQ_CF_ALU_WORD1_BARRIER(1) |
                                        S_SQ_CF_ALU_WORD1_USES_WATERFALL(bc->chiprev == CHIPREV_R600 ? cf->r6xx_uses_waterfall : 0) |
                                        S_SQ_CF_ALU_WORD1_COUNT((cf->ndw / 2) - 1);
@@ -790,8 +1435,10 @@ int r600_bc_build(struct r600_bc *bc)
        struct r600_bc_alu *alu;
        struct r600_bc_vtx *vtx;
        struct r600_bc_tex *tex;
+       uint32_t literal[4];
+       unsigned nliteral;
        unsigned addr;
-       int r;
+       int i, r;
 
        if (bc->callstack[0].max > 0)
                bc->nstack = ((bc->callstack[0].max + 3) >> 2) + 2;
@@ -805,7 +1452,19 @@ int r600_bc_build(struct r600_bc *bc)
        LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
                switch (cf->inst) {
                case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3):
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER << 3):
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER << 3):
                case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3):
+                       nliteral = 0;
+                       LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) {
+                               r = r600_bc_alu_nliterals(bc, alu, literal, &nliteral);
+                               if (r)
+                                       return r;
+                               if (alu->last) {
+                                       cf->ndw += align(nliteral, 2);
+                                       nliteral = 0;
+                               }
+                       }
                        break;
                case V_SQ_CF_WORD1_SQ_CF_INST_TEX:
                case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
@@ -851,8 +1510,15 @@ int r600_bc_build(struct r600_bc *bc)
                        return r;
                switch (cf->inst) {
                case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3):
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER << 3):
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER << 3):
                case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3):
+                       nliteral = 0;
                        LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) {
+                               r = r600_bc_alu_nliterals(bc, alu, literal, &nliteral);
+                               if (r)
+                                       return r;
+                               r600_bc_alu_adjust_literals(bc, alu, literal, nliteral);
                                switch(bc->chiprev) {
                                case CHIPREV_R600:
                                        r = r600_bc_alu_build(bc, alu, addr);
@@ -869,7 +1535,10 @@ int r600_bc_build(struct r600_bc *bc)
                                        return r;
                                addr += 2;
                                if (alu->last) {
-                                       addr += alu->nliteral;
+                                       for (i = 0; i < align(nliteral, 2); ++i) {
+                                               bc->bytecode[addr++] = literal[i];
+                                       }
+                                       nliteral = 0;
                                }
                        }
                        break;
@@ -947,3 +1616,447 @@ void r600_bc_clear(struct r600_bc *bc)
 
        LIST_INITHEAD(&cf->list);
 }
+
+void r600_bc_dump(struct r600_bc *bc)
+{
+       struct r600_bc_cf *cf = NULL;
+       struct r600_bc_alu *alu = NULL;
+       struct r600_bc_vtx *vtx = NULL;
+       struct r600_bc_tex *tex = NULL;
+
+       unsigned i, id;
+       uint32_t literal[4];
+       unsigned nliteral;
+       char chip = '6';
+
+       switch (bc->chiprev) {
+       case 1:
+               chip = '7';
+               break;
+       case 2:
+               chip = 'E';
+               break;
+       case 0:
+       default:
+               chip = '6';
+               break;
+       }
+       fprintf(stderr, "bytecode %d dw -- %d gprs ---------------------\n", bc->ndw, bc->ngpr);
+       fprintf(stderr, "     %c\n", chip);
+
+       LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
+               id = cf->id;
+
+               switch (cf->inst) {
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3):
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER << 3):
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER << 3):
+               case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3):
+                       fprintf(stderr, "%04d %08X ALU ", id, bc->bytecode[id]);
+                       fprintf(stderr, "ADDR:%d ", cf->addr);
+                       fprintf(stderr, "KCACHE_MODE0:%X ", cf->kcache[0].mode);
+                       fprintf(stderr, "KCACHE_BANK0:%X ", cf->kcache[0].bank);
+                       fprintf(stderr, "KCACHE_BANK1:%X\n", cf->kcache[1].bank);
+                       id++;
+                       fprintf(stderr, "%04d %08X ALU ", id, bc->bytecode[id]);
+                       fprintf(stderr, "INST:%d ", cf->inst);
+                       fprintf(stderr, "KCACHE_MODE1:%X ", cf->kcache[1].mode);
+                       fprintf(stderr, "KCACHE_ADDR0:%X ", cf->kcache[0].addr);
+                       fprintf(stderr, "KCACHE_ADDR1:%X ", cf->kcache[1].addr);
+                       fprintf(stderr, "COUNT:%d\n", cf->ndw / 2);
+                       break;
+               case V_SQ_CF_WORD1_SQ_CF_INST_TEX:
+               case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
+               case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC:
+                       fprintf(stderr, "%04d %08X TEX/VTX ", id, bc->bytecode[id]);
+                       fprintf(stderr, "ADDR:%d\n", cf->addr);
+                       id++;
+                       fprintf(stderr, "%04d %08X TEX/VTX ", id, bc->bytecode[id]);
+                       fprintf(stderr, "INST:%d ", cf->inst);
+                       fprintf(stderr, "COUNT:%d\n", cf->ndw / 4);
+                       break;
+               case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
+               case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
+                       fprintf(stderr, "%04d %08X EXPORT ", id, bc->bytecode[id]);
+                       fprintf(stderr, "GPR:%X ", cf->output.gpr);
+                       fprintf(stderr, "ELEM_SIZE:%X ", cf->output.elem_size);
+                       fprintf(stderr, "ARRAY_BASE:%X ", cf->output.array_base);
+                       fprintf(stderr, "TYPE:%X\n", cf->output.type);
+                       id++;
+                       fprintf(stderr, "%04d %08X EXPORT ", id, bc->bytecode[id]);
+                       fprintf(stderr, "SWIZ_X:%X ", cf->output.swizzle_x);
+                       fprintf(stderr, "SWIZ_Y:%X ", cf->output.swizzle_y);
+                       fprintf(stderr, "SWIZ_Z:%X ", cf->output.swizzle_z);
+                       fprintf(stderr, "SWIZ_W:%X ", cf->output.swizzle_w);
+                       fprintf(stderr, "SWIZ_W:%X ", cf->output.swizzle_w);
+                       fprintf(stderr, "BARRIER:%X ", cf->output.barrier);
+                       fprintf(stderr, "INST:%d ", cf->output.inst);
+                       fprintf(stderr, "EOP:%X\n", cf->output.end_of_program);
+                       break;
+               case V_SQ_CF_WORD1_SQ_CF_INST_JUMP:
+               case V_SQ_CF_WORD1_SQ_CF_INST_ELSE:
+               case V_SQ_CF_WORD1_SQ_CF_INST_POP:
+               case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL:
+               case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END:
+               case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE:
+               case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK:
+               case V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS:
+               case V_SQ_CF_WORD1_SQ_CF_INST_RETURN:
+                       fprintf(stderr, "%04d %08X CF ", id, bc->bytecode[id]);
+                       fprintf(stderr, "ADDR:%d\n", cf->cf_addr);
+                       id++;
+                       fprintf(stderr, "%04d %08X CF ", id, bc->bytecode[id]);
+                       fprintf(stderr, "INST:%d ", cf->inst);
+                       fprintf(stderr, "COND:%X ", cf->cond);
+                       fprintf(stderr, "POP_COUNT:%X\n", cf->pop_count);
+                       break;
+               }
+
+               id = cf->addr;
+               nliteral = 0;
+               LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) {
+                       r600_bc_alu_nliterals(bc, alu, literal, &nliteral);
+
+                       fprintf(stderr, "%04d %08X   ", id, bc->bytecode[id]);
+                       fprintf(stderr, "SRC0(SEL:%d ", alu->src[0].sel);
+                       fprintf(stderr, "REL:%d ", alu->src[0].rel);
+                       fprintf(stderr, "CHAN:%d ", alu->src[0].chan);
+                       fprintf(stderr, "NEG:%d) ", alu->src[0].neg);
+                       fprintf(stderr, "SRC1(SEL:%d ", alu->src[1].sel);
+                       fprintf(stderr, "REL:%d ", alu->src[1].rel);
+                       fprintf(stderr, "CHAN:%d ", alu->src[1].chan);
+                       fprintf(stderr, "NEG:%d) ", alu->src[1].neg);
+                       fprintf(stderr, "LAST:%d)\n", alu->last);
+                       id++;
+                       fprintf(stderr, "%04d %08X %c ", id, bc->bytecode[id], alu->last ? '*' : ' ');
+                       fprintf(stderr, "INST:%d ", alu->inst);
+                       fprintf(stderr, "DST(SEL:%d ", alu->dst.sel);
+                       fprintf(stderr, "CHAN:%d ", alu->dst.chan);
+                       fprintf(stderr, "REL:%d ", alu->dst.rel);
+                       fprintf(stderr, "CLAMP:%d) ", alu->dst.clamp);
+                       fprintf(stderr, "BANK_SWIZZLE:%d ", alu->bank_swizzle);
+                       if (alu->is_op3) {
+                               fprintf(stderr, "SRC2(SEL:%d ", alu->src[2].sel);
+                               fprintf(stderr, "REL:%d ", alu->src[2].rel);
+                               fprintf(stderr, "CHAN:%d ", alu->src[2].chan);
+                               fprintf(stderr, "NEG:%d)\n", alu->src[2].neg);
+                       } else {
+                               fprintf(stderr, "SRC0_ABS:%d ", alu->src[0].abs);
+                               fprintf(stderr, "SRC1_ABS:%d ", alu->src[1].abs);
+                               fprintf(stderr, "WRITE_MASK:%d ", alu->dst.write);
+                               fprintf(stderr, "OMOD:%d ", alu->omod);
+                               fprintf(stderr, "EXECUTE_MASK:%d ", alu->predicate);
+                               fprintf(stderr, "UPDATE_PRED:%d\n", alu->predicate);
+                       }
+
+                       id++;
+                       if (alu->last) {
+                               for (i = 0; i < nliteral; i++, id++) {
+                                       float *f = (float*)(bc->bytecode + id);
+                                       fprintf(stderr, "%04d %08X\t%f\n", id, bc->bytecode[id], *f);
+                               }
+                               id += nliteral & 1;
+                               nliteral = 0;
+                       }
+               }
+
+               LIST_FOR_EACH_ENTRY(tex, &cf->tex, list) {
+                       //TODO
+               }
+
+               LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) {
+                       //TODO
+               }
+       }
+
+       fprintf(stderr, "--------------------------------------\n");
+}
+
+void r600_cf_vtx(struct r600_vertex_element *ve, u32 *bytecode, unsigned count)
+{
+       struct r600_pipe_state *rstate;
+       unsigned i = 0;
+
+       if (count > 8) {
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(8 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_VTX) |
+                                               S_SQ_CF_WORD1_BARRIER(1) |
+                                               S_SQ_CF_WORD1_COUNT(8 - 1);
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(40 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_VTX) |
+                                               S_SQ_CF_WORD1_BARRIER(1) |
+                                               S_SQ_CF_WORD1_COUNT(count - 8 - 1);
+       } else {
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(8 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_VTX) |
+                                               S_SQ_CF_WORD1_BARRIER(1) |
+                                               S_SQ_CF_WORD1_COUNT(count - 1);
+       }
+       bytecode[i++] = S_SQ_CF_WORD0_ADDR(0);
+       bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_RETURN) |
+                       S_SQ_CF_WORD1_BARRIER(1);
+
+       rstate = &ve->rstate;
+       rstate->id = R600_PIPE_STATE_FETCH_SHADER;
+       rstate->nregs = 0;
+       r600_pipe_state_add_reg(rstate, R_0288A4_SQ_PGM_RESOURCES_FS,
+                               0x00000000, 0xFFFFFFFF, NULL);
+       r600_pipe_state_add_reg(rstate, R_0288DC_SQ_PGM_CF_OFFSET_FS,
+                               0x00000000, 0xFFFFFFFF, NULL);
+       r600_pipe_state_add_reg(rstate, R_028894_SQ_PGM_START_FS,
+                               r600_bo_offset(ve->fetch_shader) >> 8,
+                               0xFFFFFFFF, ve->fetch_shader);
+}
+
+void r600_cf_vtx_tc(struct r600_vertex_element *ve, u32 *bytecode, unsigned count)
+{
+       struct r600_pipe_state *rstate;
+       unsigned i = 0;
+
+       if (count > 8) {
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(8 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC) |
+                                               S_SQ_CF_WORD1_BARRIER(1) |
+                                               S_SQ_CF_WORD1_COUNT(8 - 1);
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(40 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC) |
+                                               S_SQ_CF_WORD1_BARRIER(1) |
+                                               S_SQ_CF_WORD1_COUNT((count - 8) - 1);
+       } else {
+               bytecode[i++] = S_SQ_CF_WORD0_ADDR(8 >> 1);
+               bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC) |
+                                               S_SQ_CF_WORD1_BARRIER(1) |
+                                               S_SQ_CF_WORD1_COUNT(count - 1);
+       }
+       bytecode[i++] = S_SQ_CF_WORD0_ADDR(0);
+       bytecode[i++] = S_SQ_CF_WORD1_CF_INST(V_SQ_CF_WORD1_SQ_CF_INST_RETURN) |
+                       S_SQ_CF_WORD1_BARRIER(1);
+
+       rstate = &ve->rstate;
+       rstate->id = R600_PIPE_STATE_FETCH_SHADER;
+       rstate->nregs = 0;
+       r600_pipe_state_add_reg(rstate, R_0288A4_SQ_PGM_RESOURCES_FS,
+                               0x00000000, 0xFFFFFFFF, NULL);
+       r600_pipe_state_add_reg(rstate, R_0288DC_SQ_PGM_CF_OFFSET_FS,
+                               0x00000000, 0xFFFFFFFF, NULL);
+       r600_pipe_state_add_reg(rstate, R_028894_SQ_PGM_START_FS,
+                               r600_bo_offset(ve->fetch_shader) >> 8,
+                               0xFFFFFFFF, ve->fetch_shader);
+}
+
+static void r600_vertex_data_type(enum pipe_format pformat, unsigned *format,
+                               unsigned *num_format, unsigned *format_comp)
+{
+       const struct util_format_description *desc;
+       unsigned i;
+
+       *format = 0;
+       *num_format = 0;
+       *format_comp = 0;
+
+       desc = util_format_description(pformat);
+       if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+               goto out_unknown;
+       }
+
+       /* Find the first non-VOID channel. */
+       for (i = 0; i < 4; i++) {
+               if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+                       break;
+               }
+       }
+
+       switch (desc->channel[i].type) {
+               /* Half-floats, floats, doubles */
+       case UTIL_FORMAT_TYPE_FLOAT:
+               switch (desc->channel[i].size) {
+               case 16:
+                       switch (desc->nr_channels) {
+                       case 1:
+                               *format = FMT_16_FLOAT;
+                               break;
+                       case 2:
+                               *format = FMT_16_16_FLOAT;
+                               break;
+                       case 3:
+                               *format = FMT_16_16_16_FLOAT;
+                               break;
+                       case 4:
+                               *format = FMT_16_16_16_16_FLOAT;
+                               break;
+                       }
+                       break;
+               case 32:
+                       switch (desc->nr_channels) {
+                       case 1:
+                               *format = FMT_32_FLOAT;
+                               break;
+                       case 2:
+                               *format = FMT_32_32_FLOAT;
+                               break;
+                       case 3:
+                               *format = FMT_32_32_32_FLOAT;
+                               break;
+                       case 4:
+                               *format = FMT_32_32_32_32_FLOAT;
+                               break;
+                       }
+                       break;
+               default:
+                       goto out_unknown;
+               }
+               break;
+               /* Unsigned ints */
+       case UTIL_FORMAT_TYPE_UNSIGNED:
+               /* Signed ints */
+       case UTIL_FORMAT_TYPE_SIGNED:
+               switch (desc->channel[i].size) {
+               case 8:
+                       switch (desc->nr_channels) {
+                       case 1:
+                               *format = FMT_8;
+                               break;
+                       case 2:
+                               *format = FMT_8_8;
+                               break;
+                       case 3:
+                       //      *format = FMT_8_8_8; /* fails piglit draw-vertices test */
+                       //      break;
+                       case 4:
+                               *format = FMT_8_8_8_8;
+                               break;
+                       }
+                       break;
+               case 16:
+                       switch (desc->nr_channels) {
+                       case 1:
+                               *format = FMT_16;
+                               break;
+                       case 2:
+                               *format = FMT_16_16;
+                               break;
+                       case 3:
+                       //      *format = FMT_16_16_16; /* fails piglit draw-vertices test */
+                       //      break;
+                       case 4:
+                               *format = FMT_16_16_16_16;
+                               break;
+                       }
+                       break;
+               case 32:
+                       switch (desc->nr_channels) {
+                       case 1:
+                               *format = FMT_32;
+                               break;
+                       case 2:
+                               *format = FMT_32_32;
+                               break;
+                       case 3:
+                               *format = FMT_32_32_32;
+                               break;
+                       case 4:
+                               *format = FMT_32_32_32_32;
+                               break;
+                       }
+                       break;
+               default:
+                       goto out_unknown;
+               }
+               break;
+       default:
+               goto out_unknown;
+       }
+
+       if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) {
+               *format_comp = 1;
+       }
+       if (desc->channel[i].normalized) {
+               *num_format = 0;
+       } else {
+               *num_format = 2;
+       }
+       return;
+out_unknown:
+       R600_ERR("unsupported vertex format %s\n", util_format_name(pformat));
+}
+
+int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, struct r600_vertex_element *ve)
+{
+       unsigned ndw, i;
+       u32 *bytecode;
+       unsigned fetch_resource_start = 0, format, num_format, format_comp;
+       struct pipe_vertex_element *elements = ve->elements;
+       const struct util_format_description *desc;
+
+       /* 2 dwords for cf aligned to 4 + 4 dwords per input */
+       ndw = 8 + ve->count * 4;
+       ve->fs_size = ndw * 4;
+
+       /* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
+       ve->fetch_shader = r600_bo(rctx->radeon, ndw*4, 256, PIPE_BIND_VERTEX_BUFFER, 0);
+       if (ve->fetch_shader == NULL) {
+               return -ENOMEM;
+       }
+
+       bytecode = r600_bo_map(rctx->radeon, ve->fetch_shader, 0, NULL);
+       if (bytecode == NULL) {
+               r600_bo_reference(rctx->radeon, &ve->fetch_shader, NULL);
+               return -ENOMEM;
+       }
+
+       if (rctx->family >= CHIP_CEDAR) {
+               eg_cf_vtx(ve, &bytecode[0], (ndw - 8) / 4);
+       } else {
+               r600_cf_vtx(ve, &bytecode[0], (ndw - 8) / 4);
+               fetch_resource_start = 160;
+       }
+
+       /* vertex elements offset need special handling, if offset is bigger
+        * than what we can put in fetch instruction then we need to alterate
+        * the vertex resource offset. In such case in order to simplify code
+        * we will bound one resource per elements. It's a worst case scenario.
+        */
+       for (i = 0; i < ve->count; i++) {
+               ve->vbuffer_offset[i] = C_SQ_VTX_WORD2_OFFSET & elements[i].src_offset;
+               if (ve->vbuffer_offset[i]) {
+                       ve->vbuffer_need_offset = 1;
+               }
+       }
+
+       for (i = 0; i < ve->count; i++) {
+               unsigned vbuffer_index;
+               r600_vertex_data_type(ve->hw_format[i], &format, &num_format, &format_comp);
+               desc = util_format_description(ve->hw_format[i]);
+               if (desc == NULL) {
+                       R600_ERR("unknown format %d\n", ve->hw_format[i]);
+                       r600_bo_reference(rctx->radeon, &ve->fetch_shader, NULL);
+                       return -EINVAL;
+               }
+
+               /* see above for vbuffer_need_offset explanation */
+               vbuffer_index = elements[i].vertex_buffer_index;
+               if (ve->vbuffer_need_offset) {
+                       bytecode[8 + i * 4 + 0] = S_SQ_VTX_WORD0_BUFFER_ID(i + fetch_resource_start);
+               } else {
+                       bytecode[8 + i * 4 + 0] = S_SQ_VTX_WORD0_BUFFER_ID(vbuffer_index + fetch_resource_start);
+               }
+               bytecode[8 + i * 4 + 0] |= S_SQ_VTX_WORD0_SRC_GPR(0) |
+                                       S_SQ_VTX_WORD0_SRC_SEL_X(0) |
+                                       S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(0x1F);
+               bytecode[8 + i * 4 + 1] = S_SQ_VTX_WORD1_DST_SEL_X(desc->swizzle[0]) |
+                                       S_SQ_VTX_WORD1_DST_SEL_Y(desc->swizzle[1]) |
+                                       S_SQ_VTX_WORD1_DST_SEL_Z(desc->swizzle[2]) |
+                                       S_SQ_VTX_WORD1_DST_SEL_W(desc->swizzle[3]) |
+                                       S_SQ_VTX_WORD1_USE_CONST_FIELDS(0) |
+                                       S_SQ_VTX_WORD1_DATA_FORMAT(format) |
+                                       S_SQ_VTX_WORD1_NUM_FORMAT_ALL(num_format) |
+                                       S_SQ_VTX_WORD1_FORMAT_COMP_ALL(format_comp) |
+                                       S_SQ_VTX_WORD1_SRF_MODE_ALL(1) |
+                                       S_SQ_VTX_WORD1_GPR_DST_GPR(i + 1);
+               bytecode[8 + i * 4 + 2] = S_SQ_VTX_WORD2_OFFSET(elements[i].src_offset) |
+                                       S_SQ_VTX_WORD2_MEGA_FETCH(1);
+               bytecode[8 + i * 4 + 3] = 0;
+       }
+       r600_bo_unmap(rctx->radeon, ve->fetch_shader);
+       return 0;
+}
index f2016af3e7264efa1eeceb4d7caa3012cbe0357b..278b4466cb03e0e76f68b97c3d43673168924f64 100644 (file)
@@ -25,8 +25,8 @@
 
 #include "util/u_double_list.h"
 
-#define NUM_OF_CYCLES 3
-#define NUM_OF_COMPONENTS 4
+struct r600_vertex_element;
+struct r600_pipe_context;
 
 struct r600_bc_alu_src {
        unsigned                        sel;
@@ -34,6 +34,7 @@ struct r600_bc_alu_src {
        unsigned                        neg;
        unsigned                        abs;
        unsigned                        rel;
+       u32                             *value;
 };
 
 struct r600_bc_alu_dst {
@@ -46,19 +47,15 @@ struct r600_bc_alu_dst {
 
 struct r600_bc_alu {
        struct list_head                list;
-       struct list_head                bs_list; /* bank swizzle list */
        struct r600_bc_alu_src          src[3];
        struct r600_bc_alu_dst          dst;
        unsigned                        inst;
        unsigned                        last;
        unsigned                        is_op3;
        unsigned                        predicate;
-       unsigned                        nliteral;
-       unsigned                        literal_added;
        unsigned                        bank_swizzle;
        unsigned                        bank_swizzle_force;
-       u32                             value[4];
-       int                             hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
+       unsigned                        omod;
 };
 
 struct r600_bc_tex {
@@ -122,6 +119,12 @@ struct r600_bc_output {
        unsigned                        barrier;
 };
 
+struct r600_bc_kcache {
+       unsigned                        bank;
+       unsigned                        mode;
+       unsigned                        addr;
+};
+
 struct r600_bc_cf {
        struct list_head                list;
        unsigned                        inst;
@@ -131,18 +134,15 @@ struct r600_bc_cf {
        unsigned                        cond;
        unsigned                        pop_count;
        unsigned                        cf_addr; /* control flow addr */
-       unsigned                        kcache0_mode;
-       unsigned                        kcache1_mode;
-       unsigned                        kcache0_addr;
-       unsigned                        kcache1_addr;
-       unsigned                        kcache0_bank;
-       unsigned                        kcache1_bank;
+       struct r600_bc_kcache           kcache[2];
        unsigned                        r6xx_uses_waterfall;
        struct list_head                alu;
        struct list_head                tex;
        struct list_head                vtx;
        struct r600_bc_output           output;
        struct r600_bc_alu              *curr_bs_head;
+       struct r600_bc_alu              *prev_bs_head;
+       struct r600_bc_alu              *prev2_bs_head;
 };
 
 #define FC_NONE                                0
@@ -188,18 +188,24 @@ struct r600_bc {
 
 /* eg_asm.c */
 int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf);
+void eg_cf_vtx(struct r600_vertex_element *ve, u32 *bytecode, unsigned count);
 
 /* r600_asm.c */
 int r600_bc_init(struct r600_bc *bc, enum radeon_family family);
 void r600_bc_clear(struct r600_bc *bc);
 int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu);
-int r600_bc_add_literal(struct r600_bc *bc, const u32 *value);
 int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx);
 int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex);
 int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output);
 int r600_bc_build(struct r600_bc *bc);
 int r600_bc_add_cfinst(struct r600_bc *bc, int inst);
 int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type);
+void r600_bc_special_constants(u32 value, unsigned *sel, unsigned *neg);
+void r600_bc_dump(struct r600_bc *bc);
+void r600_cf_vtx(struct r600_vertex_element *ve, u32 *bytecode, unsigned count);
+void r600_cf_vtx_tc(struct r600_vertex_element *ve, u32 *bytecode, unsigned count);
+
+int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, struct r600_vertex_element *ve);
 
 /* r700_asm.c */
 int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id);
index 74cf96879996a217a03c9e115dc937e6f75161b8..b9ec9592e357f9dac2ed5709bbb0003200ff6d37 100644 (file)
@@ -78,19 +78,24 @@ static void r600_blitter_end(struct pipe_context *ctx)
        r600_context_queries_resume(&rctx->ctx);
 }
 
-int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture)
+void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-       struct pipe_surface *zsurf, *cbsurf;
+       struct pipe_surface *zsurf, *cbsurf, surf_tmpl;
        int level = 0;
        float depth = 1.0f;
+       surf_tmpl.format = texture->resource.base.b.format;
+       surf_tmpl.u.tex.level = level;
+       surf_tmpl.u.tex.first_layer = 0;
+       surf_tmpl.u.tex.last_layer = 0;
+       surf_tmpl.usage = PIPE_BIND_DEPTH_STENCIL;
 
-       zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0,
-                                            PIPE_BIND_DEPTH_STENCIL);
+       zsurf = ctx->create_surface(ctx, &texture->resource.base.b, &surf_tmpl);
 
-       cbsurf = ctx->screen->get_tex_surface(ctx->screen,
-                       (struct pipe_resource*)texture->flushed_depth_texture,
-                       0, level, 0, PIPE_BIND_RENDER_TARGET);
+       surf_tmpl.format = ((struct pipe_resource*)texture->flushed_depth_texture)->format;
+       surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+       cbsurf = ctx->create_surface(ctx,
+                       (struct pipe_resource*)texture->flushed_depth_texture, &surf_tmpl);
 
        if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 ||
            rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
@@ -102,9 +107,6 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te
 
        pipe_surface_reference(&zsurf, NULL);
        pipe_surface_reference(&cbsurf, NULL);
-
-
-       return 0;
 }
 
 static void r600_clear(struct pipe_context *ctx, unsigned buffers,
@@ -154,41 +156,38 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx,
 
 /* Copy a block of pixels from one surface to another using HW. */
 static void r600_hw_copy_region(struct pipe_context *ctx,
-                                struct pipe_resource *dst,
-                                struct pipe_subresource subdst,
-                                unsigned dstx, unsigned dsty, unsigned dstz,
-                                struct pipe_resource *src,
-                                struct pipe_subresource subsrc,
-                                unsigned srcx, unsigned srcy, unsigned srcz,
-                                unsigned width, unsigned height)
+                               struct pipe_resource *dst,
+                               unsigned dst_level,
+                               unsigned dstx, unsigned dsty, unsigned dstz,
+                               struct pipe_resource *src,
+                               unsigned src_level,
+                               const struct pipe_box *src_box)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
 
        r600_blitter_begin(ctx, R600_COPY);
-       util_blitter_copy_region(rctx->blitter, dst, subdst, dstx, dsty, dstz,
-                                src, subsrc, srcx, srcy, srcz, width, height,
-                                TRUE);
+       util_blitter_copy_region(rctx->blitter, dst, dst_level, dstx, dsty, dstz,
+                                src, src_level, src_box, TRUE);
        r600_blitter_end(ctx);
 }
 
 static void r600_resource_copy_region(struct pipe_context *ctx,
                                      struct pipe_resource *dst,
-                                     struct pipe_subresource subdst,
+                                     unsigned dst_level,
                                      unsigned dstx, unsigned dsty, unsigned dstz,
                                      struct pipe_resource *src,
-                                     struct pipe_subresource subsrc,
-                                     unsigned srcx, unsigned srcy, unsigned srcz,
-                                     unsigned width, unsigned height)
+                                     unsigned src_level,
+                                     const struct pipe_box *src_box)
 {
        boolean is_depth;
        /* there is something wrong with depth resource copies at the moment so avoid them for now */
        is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
        if (is_depth)
-               util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz,
-                                         src, subsrc, srcx, srcy, srcz, width, height);
+               util_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
+                                         src, src_level, src_box);
        else
-               r600_hw_copy_region(ctx, dst, subdst, dstx, dsty, dstz,
-                                   src, subsrc, srcx, srcy, srcz, width, height);
+               r600_hw_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
+                                   src, src_level, src_box);
 }
 
 void r600_init_blit_functions(struct r600_pipe_context *rctx)
index a432271b82d923b5b580e7d77258d972e68ba717..469c8195fe9b7a8739fa1512dabd8239366b599e 100644 (file)
@@ -29,7 +29,6 @@
 #include <util/u_math.h>
 #include <util/u_inlines.h>
 #include <util/u_memory.h>
-#include <util/u_upload_mgr.h>
 #include "state_tracker/drm_driver.h"
 #include <xf86drm.h>
 #include "radeon_drm.h"
@@ -53,12 +52,13 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
 
        rbuffer->magic = R600_BUFFER_MAGIC;
        rbuffer->user_buffer = NULL;
-       rbuffer->num_ranges = 0;
        rbuffer->r.base.b = *templ;
        pipe_reference_init(&rbuffer->r.base.b.reference, 1);
        rbuffer->r.base.b.screen = screen;
        rbuffer->r.base.vtbl = &r600_buffer_vtbl;
        rbuffer->r.size = rbuffer->r.base.b.width0;
+       rbuffer->r.bo_size = rbuffer->r.size;
+       rbuffer->uploaded = FALSE;
        bo = r600_bo((struct radeon*)screen->winsys, rbuffer->r.base.b.width0, alignment, rbuffer->r.base.b.bind, rbuffer->r.base.b.usage);
        if (bo == NULL) {
                FREE(rbuffer);
@@ -89,10 +89,12 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
        rbuffer->r.base.b.width0 = bytes;
        rbuffer->r.base.b.height0 = 1;
        rbuffer->r.base.b.depth0 = 1;
+       rbuffer->r.base.b.array_size = 1;
        rbuffer->r.base.b.flags = 0;
-       rbuffer->num_ranges = 0;
        rbuffer->r.bo = NULL;
+       rbuffer->r.bo_size = 0;
        rbuffer->user_buffer = ptr;
+       rbuffer->uploaded = FALSE;
        return &rbuffer->r.base.b;
 }
 
@@ -104,6 +106,7 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
        if (rbuffer->r.bo) {
                r600_bo_reference((struct radeon*)screen->winsys, &rbuffer->r.bo, NULL);
        }
+       rbuffer->r.bo = NULL;
        FREE(rbuffer);
 }
 
@@ -113,29 +116,10 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
        struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource);
        int write = 0;
        uint8_t *data;
-       int i;
-       boolean flush = FALSE;
 
        if (rbuffer->user_buffer)
                return (uint8_t*)rbuffer->user_buffer + transfer->box.x;
 
-       if (transfer->usage & PIPE_TRANSFER_DISCARD) {
-               for (i = 0; i < rbuffer->num_ranges; i++) {
-                       if ((transfer->box.x >= rbuffer->ranges[i].start) &&
-                           (transfer->box.x < rbuffer->ranges[i].end))
-                               flush = TRUE;
-
-                       if (flush) {
-                               r600_bo_reference((struct radeon*)pipe->winsys, &rbuffer->r.bo, NULL);
-                               rbuffer->num_ranges = 0;
-                               rbuffer->r.bo = r600_bo((struct radeon*)pipe->winsys,
-                                                        rbuffer->r.base.b.width0, 0,
-                                                        rbuffer->r.base.b.bind,
-                                                        rbuffer->r.base.b.usage);
-                               break;
-                       }
-               }
-       }
        if (transfer->usage & PIPE_TRANSFER_DONTBLOCK) {
                /* FIXME */
        }
@@ -154,41 +138,22 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe,
 {
        struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource);
 
+       if (rbuffer->user_buffer)
+               return;
+
        if (rbuffer->r.bo)
                r600_bo_unmap((struct radeon*)pipe->winsys, rbuffer->r.bo);
 }
 
 static void r600_buffer_transfer_flush_region(struct pipe_context *pipe,
-                                             struct pipe_transfer *transfer,
-                                             const struct pipe_box *box)
+                                               struct pipe_transfer *transfer,
+                                               const struct pipe_box *box)
 {
-       struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource);
-       unsigned i;
-       unsigned offset = transfer->box.x + box->x;
-       unsigned length = box->width;
-
-       assert(box->x + box->width <= transfer->box.width);
-
-       if (rbuffer->user_buffer)
-               return;
-
-       /* mark the range as used */
-       for(i = 0; i < rbuffer->num_ranges; ++i) {
-               if(offset <= rbuffer->ranges[i].end && rbuffer->ranges[i].start <= (offset+box->width)) {
-                       rbuffer->ranges[i].start = MIN2(rbuffer->ranges[i].start, offset);
-                       rbuffer->ranges[i].end   = MAX2(rbuffer->ranges[i].end, (offset+length));
-                       return;
-               }
-       }
-
-       rbuffer->ranges[rbuffer->num_ranges].start = offset;
-       rbuffer->ranges[rbuffer->num_ranges].end = offset+length;
-       rbuffer->num_ranges++;
 }
 
 unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context,
                                         struct pipe_resource *buf,
-                                        unsigned face, unsigned level)
+                                        unsigned level, int layer)
 {
        /* FIXME */
        return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
@@ -235,29 +200,25 @@ struct u_resource_vtbl r600_buffer_vtbl =
 
 int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw)
 {
-       struct pipe_resource *upload_buffer = NULL;
-       unsigned index_offset = draw->index_buffer_offset;
-       int ret = 0;
-
        if (r600_buffer_is_user_buffer(draw->index_buffer)) {
-               ret = u_upload_buffer(rctx->upload_ib,
-                                     index_offset,
-                                     draw->count * draw->index_size,
-                                     draw->index_buffer,
-                                     &index_offset,
-                                     &upload_buffer);
-               if (ret) {
-                       goto done;
-               }
-               draw->index_buffer_offset = index_offset;
-
-               /* Transfer ownership. */
-               pipe_resource_reference(&draw->index_buffer, upload_buffer);
-               pipe_resource_reference(&upload_buffer, NULL);
+               struct r600_resource_buffer *rbuffer = r600_buffer(draw->index_buffer);
+               unsigned upload_offset;
+               int ret = 0;
+
+               ret = r600_upload_buffer(rctx->rupload_vb,
+                                       draw->index_buffer_offset,
+                                       draw->count * draw->index_size,
+                                       rbuffer,
+                                       &upload_offset,
+                                       &rbuffer->r.bo_size,
+                                       &rbuffer->r.bo);
+               if (ret)
+                       return ret;
+               rbuffer->uploaded = TRUE;
+               draw->index_buffer_offset = upload_offset;
        }
 
-done:
-       return ret;
+       return 0;
 }
 
 int r600_upload_user_buffers(struct r600_pipe_context *rctx)
@@ -266,27 +227,52 @@ int r600_upload_user_buffers(struct r600_pipe_context *rctx)
        int i, nr;
 
        nr = rctx->vertex_elements->count;
+       nr = rctx->nvertex_buffer;
 
        for (i = 0; i < nr; i++) {
-               struct pipe_vertex_buffer *vb =
-                       &rctx->vertex_buffer[rctx->vertex_elements->elements[i].vertex_buffer_index];
+               struct pipe_vertex_buffer *vb = &rctx->vertex_buffer[i];
 
                if (r600_buffer_is_user_buffer(vb->buffer)) {
-                       struct pipe_resource *upload_buffer = NULL;
-                       unsigned offset = 0; /*vb->buffer_offset * 4;*/
-                       unsigned size = vb->buffer->width0;
+                       struct r600_resource_buffer *rbuffer = r600_buffer(vb->buffer);
                        unsigned upload_offset;
-                       ret = u_upload_buffer(rctx->upload_vb,
-                                             offset, size,
-                                             vb->buffer,
-                                             &upload_offset, &upload_buffer);
+
+                       ret = r600_upload_buffer(rctx->rupload_vb,
+                                               0, vb->buffer->width0,
+                                               rbuffer,
+                                               &upload_offset,
+                                               &rbuffer->r.bo_size,
+                                               &rbuffer->r.bo);
                        if (ret)
                                return ret;
-
-                       pipe_resource_reference(&vb->buffer, NULL);
-                       vb->buffer = upload_buffer;
+                       rbuffer->uploaded = TRUE;
                        vb->buffer_offset = upload_offset;
                }
        }
        return ret;
 }
+
+
+int r600_upload_const_buffer(struct r600_pipe_context *rctx, struct pipe_resource *cbuffer,
+                            uint32_t *const_offset)
+{
+       if (r600_buffer_is_user_buffer(cbuffer)) {
+               struct r600_resource_buffer *rbuffer = r600_buffer(cbuffer);
+               unsigned upload_offset;
+               int ret = 0;
+
+               ret = r600_upload_buffer(rctx->rupload_const,
+                                        0, cbuffer->width0,
+                                        rbuffer,
+                                        &upload_offset,
+                                        &rbuffer->r.bo_size,
+                                        &rbuffer->r.bo);
+               if (ret)
+                       return ret;
+               rbuffer->uploaded = TRUE;
+               *const_offset = upload_offset;
+               return 0;
+       }
+
+       *const_offset = 0;
+       return 0;
+}
index 2ee0c83e5d3530946f50456b89f0640c31247bce..a85d0bbf1e1f048d15de70fb6d6c9552cb39346e 100644 (file)
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED_64      0x00000098
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_64                   0x00000099
 /* TODO Fill in more ALU */
+#define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT                0x0000009B
+#define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT               0x0000009C
+/* TODO Fill in more ALU */
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR          0x000000B1
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4                      0x000000BE
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE                 0x000000BF
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE                      0x000000C0
+#define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX4                      0x000000C1
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT                  0x000000CC
 
 #define     EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY                      0x000000D6
index 511e52fbce11dde2f31e846d2f38e0519527ff8a..20838e4d98ffbda18928e7dea2cfd7a22ae9543d 100644 (file)
@@ -35,7 +35,6 @@
 #include <util/u_pack_color.h>
 #include <util/u_memory.h>
 #include <util/u_inlines.h>
-#include <util/u_upload_mgr.h>
 #include <pipebuffer/pb_buffer.h>
 #include "r600.h"
 #include "r600d.h"
@@ -59,9 +58,6 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags,
        if (!rctx->ctx.pm4_cdwords)
                return;
 
-       u_upload_flush(rctx->upload_vb);
-       u_upload_flush(rctx->upload_ib);
-
 #if 0
        sprintf(dname, "gallium-%08d.bof", dc);
        if (dc < 20) {
@@ -71,6 +67,9 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags,
        dc++;
 #endif
        r600_context_flush(&rctx->ctx);
+
+       r600_upload_flush(rctx->rupload_vb);
+       r600_upload_flush(rctx->rupload_const);
 }
 
 static void r600_destroy_context(struct pipe_context *context)
@@ -79,6 +78,8 @@ static void r600_destroy_context(struct pipe_context *context)
 
        rctx->context.delete_depth_stencil_alpha_state(&rctx->context, rctx->custom_dsa_flush);
 
+       r600_end_vertex_translate(rctx);
+
        r600_context_fini(&rctx->ctx);
 
        util_blitter_destroy(rctx->blitter);
@@ -87,8 +88,8 @@ static void r600_destroy_context(struct pipe_context *context)
                free(rctx->states[i]);
        }
 
-       u_upload_destroy(rctx->upload_vb);
-       u_upload_destroy(rctx->upload_ib);
+       r600_upload_destroy(rctx->rupload_vb);
+       r600_upload_destroy(rctx->rupload_const);
 
        if (rctx->tran.translate_cache)
                translate_cache_destroy(rctx->tran.translate_cache);
@@ -120,6 +121,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        r600_init_blit_functions(rctx);
        r600_init_query_functions(rctx);
        r600_init_context_resource_functions(rctx);
+       r600_init_surface_functions(rctx);
 
        switch (r600_get_family(rctx->radeon)) {
        case CHIP_R600:
@@ -148,6 +150,9 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        case CHIP_CYPRESS:
        case CHIP_HEMLOCK:
        case CHIP_PALM:
+       case CHIP_BARTS:
+       case CHIP_TURKS:
+       case CHIP_CAICOS:
                rctx->context.draw_vbo = evergreen_draw;
                evergreen_init_state_functions(rctx);
                if (evergreen_context_init(&rctx->ctx, rctx->radeon)) {
@@ -162,16 +167,14 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
                return NULL;
        }
 
-       rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16,
-                                         PIPE_BIND_INDEX_BUFFER);
-       if (rctx->upload_ib == NULL) {
+       rctx->rupload_vb = r600_upload_create(rctx, 128 * 1024, 16);
+       if (rctx->rupload_vb == NULL) {
                r600_destroy_context(&rctx->context);
                return NULL;
        }
 
-       rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16,
-                                         PIPE_BIND_VERTEX_BUFFER);
-       if (rctx->upload_vb == NULL) {
+       rctx->rupload_const = r600_upload_create(rctx, 128 * 1024, 256);
+       if (rctx->rupload_const == NULL) {
                r600_destroy_context(&rctx->context);
                return NULL;
        }
@@ -206,8 +209,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
        else
                rctx->custom_dsa_flush = evergreen_create_db_flush_dsa(rctx);
 
-       r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth;
-
        return &rctx->context;
 }
 
@@ -240,6 +241,9 @@ static const char *r600_get_family_name(enum radeon_family family)
        case CHIP_CYPRESS: return "AMD CYPRESS";
        case CHIP_HEMLOCK: return "AMD HEMLOCK";
        case CHIP_PALM: return "AMD PALM";
+       case CHIP_BARTS: return "AMD BARTS";
+       case CHIP_TURKS: return "AMD TURKS";
+       case CHIP_CAICOS: return "AMD CAICOS";
        default: return "AMD unknown";
        }
 }
@@ -254,6 +258,9 @@ static const char* r600_get_name(struct pipe_screen* pscreen)
 
 static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 {
+       struct r600_screen *rscreen = (struct r600_screen *)pscreen;
+       enum radeon_family family = r600_get_family(rscreen->radeon);
+
        switch (param) {
        /* Supported features (boolean caps). */
        case PIPE_CAP_NPOT_TEXTURES:
@@ -286,7 +293,10 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
        case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
        case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
-               return 14;
+               if (family >= CHIP_CEDAR)
+                       return 15;
+               else
+                       return 14;
        case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
                /* FIXME allow this once infrastructure is there */
                return 16;
@@ -315,12 +325,18 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 
 static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
 {
+       struct r600_screen *rscreen = (struct r600_screen *)pscreen;
+       enum radeon_family family = r600_get_family(rscreen->radeon);
+
        switch (param) {
        case PIPE_CAP_MAX_LINE_WIDTH:
        case PIPE_CAP_MAX_LINE_WIDTH_AA:
        case PIPE_CAP_MAX_POINT_WIDTH:
        case PIPE_CAP_MAX_POINT_WIDTH_AA:
-               return 8192.0f;
+               if (family >= CHIP_CEDAR)
+                       return 16384.0f;
+               else
+                       return 8192.0f;
        case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
                return 16.0f;
        case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
@@ -407,9 +423,9 @@ static boolean r600_is_format_supported(struct pipe_screen* screen,
        }
 
        if ((usage & (PIPE_BIND_RENDER_TARGET |
-                  PIPE_BIND_DISPLAY_TARGET |
-                  PIPE_BIND_SCANOUT |
-                  PIPE_BIND_SHARED)) &&
+                       PIPE_BIND_DISPLAY_TARGET |
+                       PIPE_BIND_SCANOUT |
+                       PIPE_BIND_SHARED)) &&
                        r600_is_colorbuffer_format_supported(format)) {
                retval |= usage &
                        (PIPE_BIND_RENDER_TARGET |
@@ -467,7 +483,6 @@ struct pipe_screen *r600_screen_create(struct radeon *radeon)
        rscreen->screen.get_paramf = r600_get_paramf;
        rscreen->screen.is_format_supported = r600_is_format_supported;
        rscreen->screen.context_create = r600_create_context;
-       r600_init_screen_texture_functions(&rscreen->screen);
        r600_init_screen_resource_functions(&rscreen->screen);
 
        rscreen->tiling_info = r600_get_tiling_info(radeon);
index ba9fedf0b6cf55fea3ce3f5d4d8c777b1203aa7b..2112a40f6962b3761db3a765e3cbbd03bc73fd67 100644 (file)
@@ -53,6 +53,8 @@ enum r600_pipe_state_id {
        R600_PIPE_STATE_CONSTANT,
        R600_PIPE_STATE_SAMPLER,
        R600_PIPE_STATE_RESOURCE,
+       R600_PIPE_STATE_POLYGON_OFFSET,
+       R600_PIPE_STATE_FETCH_SHADER,
        R600_PIPE_NSTATES
 };
 
@@ -86,7 +88,15 @@ struct r600_vertex_element
        struct pipe_vertex_element      elements[PIPE_MAX_ATTRIBS];
        enum pipe_format                hw_format[PIPE_MAX_ATTRIBS];
        unsigned                        hw_format_size[PIPE_MAX_ATTRIBS];
-       boolean incompatible_layout;
+       boolean                         incompatible_layout;
+       struct r600_bo                  *fetch_shader;
+       unsigned                        fs_size;
+       struct r600_pipe_state          rstate;
+       /* if offset is to big for fetch instructio we need to alterate
+        * offset of vertex buffer, record here the offset need to add
+        */
+       unsigned                        vbuffer_need_offset;
+       unsigned                        vbuffer_offset[PIPE_MAX_ATTRIBS];
 };
 
 struct r600_pipe_shader {
@@ -101,29 +111,31 @@ struct r600_pipe_shader {
 #define NUM_TEX_UNITS 16
 
 struct r600_textures_info {
-       struct r600_pipe_sampler_view   *views[NUM_TEX_UNITS];
-       unsigned                        n_views;
+       struct r600_pipe_sampler_view   *views[NUM_TEX_UNITS];
+       unsigned                        n_views;
        void                            *samplers[NUM_TEX_UNITS];
-       unsigned                        n_samplers;
+       unsigned                        n_samplers;
 };
 
+/* vertex buffer translation context, used to translate vertex input that
+ * hw doesn't natively support, so far only FLOAT64 is unsupported.
+ */
 struct r600_translate_context {
        /* Translate cache for incompatible vertex offset/stride/format fallback. */
-       struct translate_cache *translate_cache;
-
+       struct translate_cache          *translate_cache;
        /* The vertex buffer slot containing the translated buffer. */
-       unsigned vb_slot;
-       /* Saved and new vertex element state. */
-       void *saved_velems, *new_velems;
+       unsigned                        vb_slot;
+       void                            *new_velems;
 };
 
 #define R600_CONSTANT_ARRAY_SIZE 256
 #define R600_RESOURCE_ARRAY_SIZE 160
 
+struct r600_upload;
+
 struct r600_pipe_context {
        struct pipe_context             context;
        struct blitter_context          *blitter;
-       struct pipe_framebuffer_state   *pframebuffer;
        unsigned                        family;
        void                            *custom_dsa_flush;
        struct r600_screen              *screen;
@@ -140,6 +152,7 @@ struct r600_pipe_context {
        struct pipe_stencil_ref         stencil_ref;
        struct pipe_viewport_state      viewport;
        struct pipe_clip_state          clip;
+       unsigned                        nvs_resource;
        struct r600_pipe_state          *vs_resource;
        struct r600_pipe_state          *ps_resource;
        struct r600_pipe_state          config;
@@ -151,14 +164,12 @@ struct r600_pipe_context {
        /* shader information */
        unsigned                        sprite_coord_enable;
        bool                            flatshade;
-       struct u_upload_mgr             *upload_vb;
-       struct u_upload_mgr             *upload_ib;
+       struct r600_upload              *rupload_vb;
        unsigned                        any_user_vbs;
-       struct r600_textures_info       ps_samplers;
-
-       unsigned vb_max_index;
-       struct r600_translate_context tran;
-
+       struct r600_textures_info       ps_samplers;
+       unsigned                        vb_max_index;
+       struct r600_translate_context   tran;
+       struct r600_upload              *rupload_const;
 };
 
 struct r600_drawl {
@@ -181,10 +192,12 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
 void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx);
+void evergreen_polygon_offset_update(struct r600_pipe_context *rctx);
+void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx);
 
 /* r600_blit.c */
 void r600_init_blit_functions(struct r600_pipe_context *rctx);
-int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture);
+void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture);
 
 /* r600_buffer.c */
 struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
@@ -194,7 +207,7 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
                                              unsigned bind);
 unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context,
                                         struct pipe_resource *buf,
-                                        unsigned face, unsigned level);
+                                        unsigned level, int layer);
 struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen,
                                              struct winsys_handle *whandle);
 int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw);
@@ -207,7 +220,7 @@ void r600_init_query_functions(struct r600_pipe_context *rctx);
 void r600_init_context_resource_functions(struct r600_pipe_context *r600);
 
 /* r600_shader.c */
-int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *shader);
+int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens);
 void r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 int r600_find_vs_semantic_index(struct r600_shader *vs,
@@ -218,14 +231,20 @@ void r600_init_state_functions(struct r600_pipe_context *rctx);
 void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info);
 void r600_init_config(struct r600_pipe_context *rctx);
 void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx);
+void r600_polygon_offset_update(struct r600_pipe_context *rctx);
+void r600_vertex_buffer_update(struct r600_pipe_context *rctx);
+
 /* r600_helper.h */
 int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
 
 /* r600_texture.c */
 void r600_init_screen_texture_functions(struct pipe_screen *screen);
+void r600_init_surface_functions(struct r600_pipe_context *r600);
 uint32_t r600_translate_texformat(enum pipe_format format,
                                  const unsigned char *swizzle_view, 
                                  uint32_t *word4_p, uint32_t *yuv_format_p);
+unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
+                                       unsigned level, unsigned layer);
 
 /* r600_translate.c */
 void r600_begin_vertex_translate(struct r600_pipe_context *rctx);
@@ -252,13 +271,13 @@ void r600_sampler_view_destroy(struct pipe_context *ctx,
 void r600_bind_state(struct pipe_context *ctx, void *state);
 void r600_delete_state(struct pipe_context *ctx, void *state);
 void r600_bind_vertex_elements(struct pipe_context *ctx, void *state);
-
 void *r600_create_shader_state(struct pipe_context *ctx,
                               const struct pipe_shader_state *state);
 void r600_bind_ps_shader(struct pipe_context *ctx, void *state);
 void r600_bind_vs_shader(struct pipe_context *ctx, void *state);
 void r600_delete_ps_shader(struct pipe_context *ctx, void *state);
 void r600_delete_vs_shader(struct pipe_context *ctx, void *state);
+
 /*
  * common helpers
  */
index 7a2d1f44122e85f0557c4956b0113ee36b77fc96..28b3e1e5e40b22e978a217c82b32d7f9babf9be2 100644 (file)
@@ -46,6 +46,7 @@ struct r600_resource {
        struct u_resource               base;
        struct r600_bo                  *bo;
        u32                             size;
+       unsigned                        bo_size;
 };
 
 struct r600_resource_texture {
@@ -61,7 +62,21 @@ struct r600_resource_texture {
        unsigned                        tile_type;
        unsigned                        depth;
        unsigned                        dirty;
-       struct r600_resource_texture    *flushed_depth_texture;
+       struct r600_resource_texture    *flushed_depth_texture;
+};
+
+#define R600_BUFFER_MAGIC 0xabcd1600
+
+struct r600_resource_buffer {
+       struct r600_resource            r;
+       uint32_t                        magic;
+       void                            *user_buffer;
+       bool                            uploaded;
+};
+
+struct r600_surface {
+       struct pipe_surface             base;
+       unsigned                        aligned_height;
 };
 
 void r600_init_screen_resource_functions(struct pipe_screen *screen);
@@ -73,46 +88,29 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
                                                const struct pipe_resource *base,
                                                struct winsys_handle *whandle);
 
-#define R600_BUFFER_MAGIC 0xabcd1600
-#define R600_BUFFER_MAX_RANGES 32
-
-struct r600_buffer_range {
-       uint32_t start;
-       uint32_t end;
-};
-
-struct r600_resource_buffer {
-       struct r600_resource r;
-       uint32_t magic;
-       void *user_buffer;
-       struct r600_buffer_range ranges[R600_BUFFER_MAX_RANGES];
-       unsigned num_ranges;
-};
-
 /* r600_buffer */
 static INLINE struct r600_resource_buffer *r600_buffer(struct pipe_resource *buffer)
 {
        if (buffer) {
                assert(((struct r600_resource_buffer *)buffer)->magic == R600_BUFFER_MAGIC);
                return (struct r600_resource_buffer *)buffer;
-    }
-    return NULL;
+       }
+       return NULL;
 }
 
 static INLINE boolean r600_buffer_is_user_buffer(struct pipe_resource *buffer)
 {
-    return r600_buffer(buffer)->user_buffer ? TRUE : FALSE;
+       if (r600_buffer(buffer)->uploaded)
+               return FALSE;
+       return r600_buffer(buffer)->user_buffer ? TRUE : FALSE;
 }
 
-int r600_texture_depth_flush(struct pipe_context *ctx,
-                            struct pipe_resource *texture);
-
-extern int (*r600_blit_uncompress_depth_ptr)(struct pipe_context *ctx, struct r600_resource_texture *texture);
+int r600_texture_depth_flush(struct pipe_context *ctx, struct pipe_resource *texture);
 
 /* r600_texture.c texture transfer functions. */
 struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
                                                struct pipe_resource *texture,
-                                               struct pipe_subresource sr,
+                                               unsigned level,
                                                unsigned usage,
                                                const struct pipe_box *box);
 void r600_texture_transfer_destroy(struct pipe_context *ctx,
@@ -122,9 +120,16 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
 void r600_texture_transfer_unmap(struct pipe_context *ctx,
                                 struct pipe_transfer* transfer);
 
-struct r600_surface {
-       struct pipe_surface base;
-       unsigned aligned_height;
-};
-
+struct r600_pipe_context;
+struct r600_upload *r600_upload_create(struct r600_pipe_context *rctx,
+                                       unsigned default_size,
+                                       unsigned alignment);
+void r600_upload_flush(struct r600_upload *upload);
+void r600_upload_destroy(struct r600_upload *upload);
+int r600_upload_buffer(struct r600_upload *upload, unsigned offset,
+                       unsigned size, struct r600_resource_buffer *in_buffer,
+                       unsigned *out_offset, unsigned *out_size,
+                       struct r600_bo **out_buffer);
+
+int r600_upload_const_buffer(struct r600_pipe_context *rctx, struct pipe_resource *cbuffer, uint32_t *offset);
 #endif
index 77b180984dd10b5d3140692312d9146618dac72a..e85e829badd9b55fae536e445d5a38a43574b393 100644 (file)
@@ -44,6 +44,9 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade
        rstate->nregs = 0;
 
        /* so far never got proper semantic id from tgsi */
+       /* FIXME better to move this in config things so they get emited
+        * only one time per cs
+        */
        for (i = 0; i < 10; i++) {
                spi_vs_out_id[i] = 0;
        }
@@ -66,21 +69,12 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade
                        S_028868_NUM_GPRS(rshader->bc.ngpr) |
                        S_028868_STACK_SIZE(rshader->bc.nstack),
                        0xFFFFFFFF, NULL);
-       r600_pipe_state_add_reg(rstate,
-                       R_0288A4_SQ_PGM_RESOURCES_FS,
-                       0x00000000, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(rstate,
                        R_0288D0_SQ_PGM_CF_OFFSET_VS,
                        0x00000000, 0xFFFFFFFF, NULL);
-       r600_pipe_state_add_reg(rstate,
-                       R_0288DC_SQ_PGM_CF_OFFSET_FS,
-                       0x00000000, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(rstate,
                        R_028858_SQ_PGM_START_VS,
                        r600_bo_offset(shader->bo) >> 8, 0xFFFFFFFF, shader->bo);
-       r600_pipe_state_add_reg(rstate,
-                       R_028894_SQ_PGM_START_FS,
-                       r600_bo_offset(shader->bo_fetch) >> 8, 0xFFFFFFFF, shader->bo_fetch);
 
        r600_pipe_state_add_reg(rstate,
                                R_03E200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF,
@@ -104,37 +98,20 @@ int r600_find_vs_semantic_index(struct r600_shader *vs,
 
 static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader)
 {
-       struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_pipe_state *rstate = &shader->rstate;
        struct r600_shader *rshader = &shader->shader;
-       unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1;
+       unsigned i, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1;
        int pos_index = -1, face_index = -1;
 
-       /* clear previous register */
        rstate->nregs = 0;
 
        for (i = 0; i < rshader->ninput; i++) {
-               tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i));
-               if (rshader->input[i].centroid)
-                       tmp |= S_028644_SEL_CENTROID(1);
-               if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR)
-                       tmp |= S_028644_SEL_LINEAR(1);
-
                if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
                        pos_index = i;
-               if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
-                   rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
-                   rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
-                       tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
-               }
                if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
                        face_index = i;
-               if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
-                       rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
-                       tmp |= S_028644_PT_SPRITE_TEX(1);
-               }
-               r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
        }
+
        for (i = 0; i < rshader->noutput; i++) {
                if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
                        r600_pipe_state_add_reg(rstate,
@@ -210,22 +187,13 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade
                                0xFFFFFFFF, NULL);
 }
 
-static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader)
+int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_shader *rshader = &shader->shader;
        void *ptr;
 
        /* copy new shader */
-       if (rshader->processor_type == TGSI_PROCESSOR_VERTEX && shader->bo_fetch == NULL) {
-               shader->bo_fetch = r600_bo(rctx->radeon, rshader->bc_fetch.ndw * 4, 4096, 0, 0);
-               if (shader->bo_fetch == NULL) {
-                       return -ENOMEM;
-               }
-               ptr = r600_bo_map(rctx->radeon, shader->bo_fetch, 0, NULL);
-               memcpy(ptr, rshader->bc_fetch.bytecode, rshader->bc_fetch.ndw * 4);
-               r600_bo_unmap(rctx->radeon, shader->bo_fetch);
-       }
        if (shader->bo == NULL) {
                shader->bo = r600_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0, 0);
                if (shader->bo == NULL) {
@@ -236,7 +204,6 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s
                r600_bo_unmap(rctx->radeon, shader->bo);
        }
        /* build state */
-       rshader->flat_shade = rctx->flatshade;
        switch (rshader->processor_type) {
        case TGSI_PROCESSOR_VERTEX:
                if (rshader->family >= CHIP_CEDAR) {
@@ -255,116 +222,51 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *s
        default:
                return -EINVAL;
        }
-       r600_context_pipe_state_set(&rctx->ctx, &shader->rstate);
        return 0;
 }
 
-static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *rshader)
-{
-       struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-       struct r600_shader *shader = &rshader->shader;
-       const struct util_format_description *desc;
-       enum pipe_format resource_format[160];
-       unsigned i, nresources = 0;
-       struct r600_bc *bc = &shader->bc_fetch;
-       struct r600_bc_cf *cf;
-       struct r600_bc_vtx *vtx;
-
-       if (shader->processor_type != TGSI_PROCESSOR_VERTEX)
-               return 0;
-       /* doing a full memcmp fell over the refcount */
-       if ((rshader->vertex_elements.count == rctx->vertex_elements->count) &&
-           (!memcmp(&rshader->vertex_elements.elements, &rctx->vertex_elements->elements,
-                     rctx->vertex_elements->count * sizeof(struct pipe_vertex_element)))) {
-               return 0;
-       }
-       rshader->vertex_elements = *rctx->vertex_elements;
-       for (i = 0; i < rctx->vertex_elements->count; i++) {
-               resource_format[nresources++] = rctx->vertex_elements->hw_format[i];
-       }
-       r600_bo_reference(rctx->radeon, &rshader->bo_fetch, NULL);
-       LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
-               switch (cf->inst) {
-               case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
-               case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC:
-                       LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) {
-                               desc = util_format_description(resource_format[vtx->buffer_id]);
-                               if (desc == NULL) {
-                                       R600_ERR("unknown format %d\n", resource_format[vtx->buffer_id]);
-                                       return -EINVAL;
-                               }
-                               vtx->dst_sel_x = desc->swizzle[0];
-                               vtx->dst_sel_y = desc->swizzle[1];
-                               vtx->dst_sel_z = desc->swizzle[2];
-                               vtx->dst_sel_w = desc->swizzle[3];
-                       }
-                       break;
-               default:
-                       break;
-               }
-       }
-       return r600_bc_build(&shader->bc_fetch);
-}
-
-int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *shader)
-{
-       struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-       int r;
-
-       if (shader == NULL)
-               return -EINVAL;
-       /* there should be enough input */
-       if (rctx->vertex_elements->count < shader->shader.bc.nresource) {
-               R600_ERR("%d resources provided, expecting %d\n",
-                       rctx->vertex_elements->count, shader->shader.bc.nresource);
-               return -EINVAL;
-       }
-       r = r600_shader_update(ctx, shader);
-       if (r)
-               return r;
-       return r600_pipe_shader(ctx, shader);
-}
-
-int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
+int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader, u32 **literals);
 int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens)
 {
+       static int dump_shaders = -1;
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+       u32 *literals;
        int r;
 
-//fprintf(stderr, "--------------------------------------------------------------\n");
-//tgsi_dump(tokens, 0);
+        /* Would like some magic "get_bool_option_once" routine.
+         */
+        if (dump_shaders == -1)
+                dump_shaders = debug_get_bool_option("R600_DUMP_SHADERS", FALSE);
+
+       if (dump_shaders) {
+               fprintf(stderr, "--------------------------------------------------------------\n");
+               tgsi_dump(tokens, 0);
+       }
        shader->shader.family = r600_get_family(rctx->radeon);
-       r = r600_shader_from_tgsi(tokens, &shader->shader);
+       r = r600_shader_from_tgsi(tokens, &shader->shader, &literals);
        if (r) {
                R600_ERR("translation from TGSI failed !\n");
                return r;
        }
        r = r600_bc_build(&shader->shader.bc);
+       free(literals);
        if (r) {
                R600_ERR("building bytecode failed !\n");
                return r;
        }
-       if (shader->shader.processor_type == TGSI_PROCESSOR_VERTEX) {
-               r = r600_bc_build(&shader->shader.bc_fetch);
-               if (r) {
-                       R600_ERR("building bytecode failed !\n");
-                       return r;
-               }
+       if (dump_shaders) {
+               r600_bc_dump(&shader->shader.bc);
+               fprintf(stderr, "______________________________________________________________\n");
        }
-//fprintf(stderr, "______________________________________________________________\n");
-       return 0;
+       return r600_pipe_shader(ctx, shader);
 }
 
-void
-r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader)
+void r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
 
        r600_bo_reference(rctx->radeon, &shader->bo, NULL);
-
        r600_bc_clear(&shader->shader.bc);
-
-       /* FIXME: is there more stuff to free? */
 }
 
 /*
@@ -381,9 +283,7 @@ struct r600_shader_ctx {
        unsigned                                temp_reg;
        struct r600_shader_tgsi_instruction     *inst_info;
        struct r600_bc                          *bc;
-       struct r600_bc                          *bc_fetch;
        struct r600_shader                      *shader;
-       u32                                     value[4];
        u32                                     *literals;
        u32                                     nliterals;
        u32                                     max_driver_temp_used;
@@ -501,9 +401,7 @@ static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int input)
 static int tgsi_declaration(struct r600_shader_ctx *ctx)
 {
        struct tgsi_full_declaration *d = &ctx->parse.FullToken.FullDeclaration;
-       struct r600_bc_vtx vtx;
        unsigned i;
-       int r;
 
        switch (d->Declaration.File) {
        case TGSI_FILE_INPUT:
@@ -513,26 +411,6 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
                ctx->shader->input[i].interpolate = d->Declaration.Interpolate;
                ctx->shader->input[i].centroid = d->Declaration.Centroid;
                ctx->shader->input[i].gpr = ctx->file_offset[TGSI_FILE_INPUT] + i;
-               if (ctx->type == TGSI_PROCESSOR_VERTEX) {
-                       /* turn input into fetch */
-                       memset(&vtx, 0, sizeof(struct r600_bc_vtx));
-                       vtx.inst = 0;
-                       vtx.fetch_type = 0;
-                       vtx.buffer_id = i;
-                       /* register containing the index into the buffer */
-                       vtx.src_gpr = 0;
-                       vtx.src_sel_x = 0;
-                       vtx.mega_fetch_count = 0x1F;
-                       vtx.dst_gpr = ctx->shader->input[i].gpr;
-                       vtx.dst_sel_x = 0;
-                       vtx.dst_sel_y = 1;
-                       vtx.dst_sel_z = 2;
-                       vtx.dst_sel_w = 3;
-                       vtx.use_const_fields = 1;
-                       r = r600_bc_add_vtx(ctx->bc_fetch, &vtx);
-                       if (r)
-                               return r;
-               }
                if (ctx->type == TGSI_PROCESSOR_FRAGMENT && ctx->bc->chiprev == CHIPREV_EVERGREEN) {
                        /* turn input into interpolate on EG */
                        if (ctx->shader->input[i].name != TGSI_SEMANTIC_POSITION) {
@@ -614,7 +492,7 @@ static int evergreen_gpr_count(struct r600_shader_ctx *ctx)
        return ctx->num_interp_gpr;
 }
 
-int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader)
+int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader, u32 **literals)
 {
        struct tgsi_full_immediate *immediate;
        struct r600_shader_ctx ctx;
@@ -624,7 +502,6 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
        int i, r = 0, pos0;
 
        ctx.bc = &shader->bc;
-       ctx.bc_fetch = &shader->bc_fetch;
        ctx.shader = shader;
        r = r600_bc_init(ctx.bc, shader->family);
        if (r)
@@ -634,19 +511,15 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
        tgsi_parse_init(&ctx.parse, tokens);
        ctx.type = ctx.parse.FullHeader.Processor.Processor;
        shader->processor_type = ctx.type;
-       if (shader->processor_type == TGSI_PROCESSOR_VERTEX) {
-               r = r600_bc_init(ctx.bc_fetch, shader->family);
-               if (r)
-                       return r;
-               ctx.bc_fetch->type = -1;
-       }
        ctx.bc->type = shader->processor_type;
 
        /* register allocations */
        /* Values [0,127] correspond to GPR[0..127].
         * Values [128,159] correspond to constant buffer bank 0
         * Values [160,191] correspond to constant buffer bank 1
-        * Values [256,511] correspond to cfile constants c[0..255].
+        * Values [256,511] correspond to cfile constants c[0..255]. (Gone on EG)
+        * Values [256,287] correspond to constant buffer bank 2 (EG)
+        * Values [288,319] correspond to constant buffer bank 3 (EG)
         * Other special values are shown in the list below.
         * 244  ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
         * 245  ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
@@ -680,9 +553,11 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
        ctx.file_offset[TGSI_FILE_TEMPORARY] = ctx.file_offset[TGSI_FILE_OUTPUT] +
                                                ctx.info.file_count[TGSI_FILE_OUTPUT];
 
-       ctx.file_offset[TGSI_FILE_CONSTANT] = 128;
+       /* Outside the GPR range. This will be translated to one of the
+        * kcache banks later. */
+       ctx.file_offset[TGSI_FILE_CONSTANT] = 512;
 
-       ctx.file_offset[TGSI_FILE_IMMEDIATE] = 253;
+       ctx.file_offset[TGSI_FILE_IMMEDIATE] = V_SQ_ALU_SRC_LITERAL;
        ctx.temp_reg = ctx.file_offset[TGSI_FILE_TEMPORARY] +
                        ctx.info.file_count[TGSI_FILE_TEMPORARY];
 
@@ -723,12 +598,11 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
                        else
                                ctx.inst_info = &r600_shader_tgsi_instruction[opcode];
                        r = ctx.inst_info->process(&ctx);
-                       if (r)
-                               goto out_err;
-                       r = r600_bc_add_literal(ctx.bc, ctx.value);
                        if (r)
                                goto out_err;
                        break;
+               case TGSI_TOKEN_TYPE_PROPERTY:
+                       break;
                default:
                        R600_ERR("unsupported token type %d\n", ctx.parse.FullToken.Token.Type);
                        r = -EINVAL;
@@ -840,21 +714,13 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
                        output[i].inst = BC_INST(ctx.bc, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE);
                }
        }
-       /* add return to fetch shader */
-       if (ctx.type == TGSI_PROCESSOR_VERTEX) {
-               if (ctx.bc->chiprev == CHIPREV_EVERGREEN) {
-                       r600_bc_add_cfinst(ctx.bc_fetch, EG_V_SQ_CF_WORD1_SQ_CF_INST_RETURN);
-               } else {
-                       r600_bc_add_cfinst(ctx.bc_fetch, V_SQ_CF_WORD1_SQ_CF_INST_RETURN);
-               }
-       }
        /* add output to bytecode */
        for (i = 0; i < noutput; i++) {
                r = r600_bc_add_output(ctx.bc, &output[i]);
                if (r)
                        goto out_err;
        }
-       free(ctx.literals);
+       *literals = ctx.literals;
        tgsi_parse_free(&ctx.parse);
        return 0;
 out_err:
@@ -878,22 +744,29 @@ static int tgsi_src(struct r600_shader_ctx *ctx,
                        const struct tgsi_full_src_register *tgsi_src,
                        struct r600_bc_alu_src *r600_src)
 {
-       int index;
        memset(r600_src, 0, sizeof(struct r600_bc_alu_src));
-       r600_src->sel = tgsi_src->Register.Index;
-       if (tgsi_src->Register.File == TGSI_FILE_IMMEDIATE) {
-               r600_src->sel = 0;
-               index = tgsi_src->Register.Index;
-               ctx->value[0] = ctx->literals[index * 4 + 0];
-               ctx->value[1] = ctx->literals[index * 4 + 1];
-               ctx->value[2] = ctx->literals[index * 4 + 2];
-               ctx->value[3] = ctx->literals[index * 4 + 3];
-       }
-       if (tgsi_src->Register.Indirect)
-               r600_src->rel = V_SQ_REL_RELATIVE;
        r600_src->neg = tgsi_src->Register.Negate;
        r600_src->abs = tgsi_src->Register.Absolute;
-       r600_src->sel += ctx->file_offset[tgsi_src->Register.File];
+       if (tgsi_src->Register.File == TGSI_FILE_IMMEDIATE) {           
+               int index;
+               if((tgsi_src->Register.SwizzleX == tgsi_src->Register.SwizzleY) &&
+                       (tgsi_src->Register.SwizzleX == tgsi_src->Register.SwizzleZ) &&
+                       (tgsi_src->Register.SwizzleX == tgsi_src->Register.SwizzleW)) {
+
+                       index = tgsi_src->Register.Index * 4 + tgsi_src->Register.SwizzleX;
+                       r600_bc_special_constants(ctx->literals[index], &r600_src->sel, &r600_src->neg);
+                       if (r600_src->sel != V_SQ_ALU_SRC_LITERAL)
+                               return 0;
+               }
+               index = tgsi_src->Register.Index;
+               r600_src->sel = V_SQ_ALU_SRC_LITERAL;
+               r600_src->value = ctx->literals + index * 4;
+       } else {
+               if (tgsi_src->Register.Indirect)
+                       r600_src->rel = V_SQ_REL_RELATIVE;
+               r600_src->sel = tgsi_src->Register.Index;
+               r600_src->sel += ctx->file_offset[tgsi_src->Register.File];
+       }
        return 0;
 }
 
@@ -981,18 +854,19 @@ static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_
        int i, j, k, nliteral, r;
 
        for (i = 0, nliteral = 0; i < inst->Instruction.NumSrcRegs; i++) {
-               if (inst->Src[i].Register.File == TGSI_FILE_IMMEDIATE) {
+               if (r600_src[i].sel == V_SQ_ALU_SRC_LITERAL) {
                        nliteral++;
                }
        }
        for (i = 0, j = nliteral - 1; i < inst->Instruction.NumSrcRegs; i++) {
-               if (j > 0 && inst->Src[i].Register.File == TGSI_FILE_IMMEDIATE) {
+               if (j > 0 && r600_src[i].sel == V_SQ_ALU_SRC_LITERAL) {
                        int treg = r600_get_temp(ctx);
                        for (k = 0; k < 4; k++) {
                                memset(&alu, 0, sizeof(struct r600_bc_alu));
                                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
                                alu.src[0].sel = r600_src[i].sel;
                                alu.src[0].chan = k;
+                               alu.src[0].value = r600_src[i].value;
                                alu.dst.sel = treg;
                                alu.dst.chan = k;
                                alu.dst.write = 1;
@@ -1002,9 +876,6 @@ static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_
                                if (r)
                                        return r;
                        }
-                       r = r600_bc_add_literal(ctx->bc, &ctx->literals[inst->Src[i].Register.Index * 4]);
-                       if (r)
-                               return r;
                        r600_src[i].sel = treg;
                        j--;
                }
@@ -1012,19 +883,25 @@ static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_
        return 0;
 }
 
-static int tgsi_op2_s(struct r600_shader_ctx *ctx, int swap)
+static int tgsi_last_instruction(unsigned writemask)
 {
-       struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
-       struct r600_bc_alu_src r600_src[3];
-       struct r600_bc_alu alu;
-       int i, j, r;
-       int lasti = 0;
+       int i, lasti = 0;
 
        for (i = 0; i < 4; i++) {
-               if (inst->Dst[0].Register.WriteMask & (1 << i)) {
+               if (writemask & (1 << i)) {
                        lasti = i;
                }
        }
+       return lasti;
+}
+
+static int tgsi_op2_s(struct r600_shader_ctx *ctx, int swap)
+{
+       struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
+       struct r600_bc_alu_src r600_src[3];
+       struct r600_bc_alu alu;
+       int i, j, r;
+       int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
 
        r = tgsi_split_constant(ctx, r600_src);
        if (r)
@@ -1093,12 +970,14 @@ static int tgsi_op2_swap(struct r600_shader_ctx *ctx)
 static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
                           struct r600_bc_alu_src r600_src[3])
 {
+       static float half_inv_pi = 1.0 /(3.1415926535 * 2);
+       static float double_pi = 3.1415926535 * 2;
+       static float neg_pi = -3.1415926535;
+
        struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
        int r;
-       uint32_t lit_vals[4];
        struct r600_bc_alu alu;
 
-       memset(lit_vals, 0, 4*4);
        r = tgsi_split_constant(ctx, r600_src);
        if (r)
                return r;
@@ -1106,9 +985,6 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
        if (r)
                return r;
 
-       lit_vals[0] = fui(1.0 /(3.1415926535 * 2));
-       lit_vals[1] = fui(0.5f);
-
        memset(&alu, 0, sizeof(struct r600_bc_alu));
        alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
        alu.is_op3 = 1;
@@ -1122,13 +998,11 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
 
        alu.src[1].sel = V_SQ_ALU_SRC_LITERAL;
        alu.src[1].chan = 0;
-       alu.src[2].sel = V_SQ_ALU_SRC_LITERAL;
+       alu.src[1].value = (uint32_t *)&half_inv_pi;
+       alu.src[2].sel = V_SQ_ALU_SRC_0_5;
        alu.src[2].chan = 1;
        alu.last = 1;
        r = r600_bc_add_alu(ctx->bc, &alu);
-       if (r)
-               return r;
-       r = r600_bc_add_literal(ctx->bc, lit_vals);
        if (r)
                return r;
 
@@ -1146,14 +1020,6 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
        if (r)
                return r;
 
-       if (ctx->bc->chiprev == CHIPREV_R600) {
-               lit_vals[0] = fui(3.1415926535897f * 2.0f);
-               lit_vals[1] = fui(-3.1415926535897f);
-       } else {
-               lit_vals[0] = fui(1.0f);
-               lit_vals[1] = fui(-0.5f);
-       }
-
        memset(&alu, 0, sizeof(struct r600_bc_alu));
        alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
        alu.is_op3 = 1;
@@ -1169,11 +1035,18 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
        alu.src[1].chan = 0;
        alu.src[2].sel = V_SQ_ALU_SRC_LITERAL;
        alu.src[2].chan = 1;
+
+       if (ctx->bc->chiprev == CHIPREV_R600) {
+               alu.src[1].value = (uint32_t *)&double_pi;
+               alu.src[2].value = (uint32_t *)&neg_pi;
+       } else {
+               alu.src[1].sel = V_SQ_ALU_SRC_1;
+               alu.src[2].sel = V_SQ_ALU_SRC_0_5;
+               alu.src[2].neg = 1;
+       }
+
        alu.last = 1;
        r = r600_bc_add_alu(ctx->bc, &alu);
-       if (r)
-               return r;
-       r = r600_bc_add_literal(ctx->bc, lit_vals);
        if (r)
                return r;
        return 0;
@@ -1185,7 +1058,7 @@ static int tgsi_trig(struct r600_shader_ctx *ctx)
        struct r600_bc_alu_src r600_src[3];
        struct r600_bc_alu alu;
        int i, r;
-       int lasti = 0;
+       int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
 
        r = tgsi_setup_trig(ctx, r600_src);
        if (r)
@@ -1205,10 +1078,6 @@ static int tgsi_trig(struct r600_shader_ctx *ctx)
                return r;
 
        /* replicate result */
-       for (i = 0; i < 4; i++) {
-               if (inst->Dst[0].Register.WriteMask & (1 << i))
-                       lasti = i;
-       }
        for (i = 0; i < lasti + 1; i++) {
                if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
                        continue;
@@ -1295,10 +1164,6 @@ static int tgsi_scs(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        /* dst.w = 1.0; */
@@ -1319,10 +1184,6 @@ static int tgsi_scs(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        return 0;
@@ -1358,9 +1219,6 @@ static int tgsi_kill(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
        }
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
-       if (r)
-               return r;
 
        /* kill must be last in ALU */
        ctx->bc->force_add_cf = 1;
@@ -1423,10 +1281,6 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
        if (r)
                return r;
 
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
-       if (r)
-               return r;
-
        if (inst->Dst[0].Register.WriteMask & (1 << 2))
        {
                int chan;
@@ -1445,10 +1299,6 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
-
                chan = alu.dst.chan;
                sel = alu.dst.sel;
 
@@ -1471,9 +1321,6 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
                /* dst.z = exp(tmp.x) */
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
@@ -1515,9 +1362,6 @@ static int tgsi_rsq(struct r600_shader_ctx *ctx)
        alu.dst.write = 1;
        alu.last = 1;
        r = r600_bc_add_alu(ctx->bc, &alu);
-       if (r)
-               return r;
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
        if (r)
                return r;
        /* replicate result */
@@ -1566,9 +1410,6 @@ static int tgsi_trans_srcx_replicate(struct r600_shader_ctx *ctx)
        alu.dst.write = 1;
        alu.last = 1;
        r = r600_bc_add_alu(ctx->bc, &alu);
-       if (r)
-               return r;
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
        if (r)
                return r;
        /* replicate result */
@@ -1592,14 +1433,11 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
        alu.dst.write = 1;
        alu.last = 1;
        r = r600_bc_add_alu(ctx->bc, &alu);
-       if (r)
-               return r;
-       r = r600_bc_add_literal(ctx->bc,ctx->value);
        if (r)
                return r;
        /* b * LOG2(a) */
        memset(&alu, 0, sizeof(struct r600_bc_alu));
-       alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE);
+       alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
        r = tgsi_src(ctx, &inst->Src[1], &alu.src[0]);
        if (r)
                return r;
@@ -1609,9 +1447,6 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
        alu.dst.write = 1;
        alu.last = 1;
        r = r600_bc_add_alu(ctx->bc, &alu);
-       if (r)
-               return r;
-       r = r600_bc_add_literal(ctx->bc,ctx->value);
        if (r)
                return r;
        /* POW(a,b) = EXP2(b * LOG2(a))*/
@@ -1622,9 +1457,6 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
        alu.dst.write = 1;
        alu.last = 1;
        r = r600_bc_add_alu(ctx->bc, &alu);
-       if (r)
-               return r;
-       r = r600_bc_add_literal(ctx->bc,ctx->value);
        if (r)
                return r;
        return tgsi_helper_tempx_replicate(ctx);
@@ -1666,9 +1498,6 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
        }
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
-       if (r)
-               return r;
 
        /* dst = (-tmp > 0 ? -1 : tmp) */
        for (i = 0; i < 4; i++) {
@@ -1703,9 +1532,6 @@ static int tgsi_helper_copy(struct r600_shader_ctx *ctx, struct tgsi_full_instru
        struct r600_bc_alu alu;
        int i, r;
 
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
-       if (r)
-               return r;
        for (i = 0; i < 4; i++) {
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                if (!(inst->Dst[0].Register.WriteMask & (1 << i))) {
@@ -1735,6 +1561,7 @@ static int tgsi_op3(struct r600_shader_ctx *ctx)
        struct r600_bc_alu_src r600_src[3];
        struct r600_bc_alu alu;
        int i, j, r;
+       int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
 
        r = tgsi_split_constant(ctx, r600_src);
        if (r)
@@ -1742,26 +1569,32 @@ static int tgsi_op3(struct r600_shader_ctx *ctx)
        r = tgsi_split_literal_constant(ctx, r600_src);
        if (r)
                return r;
-       /* do it in 2 step as op3 doesn't support writemask */
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < lasti + 1; i++) {
+               if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
+                       continue;
+
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                alu.inst = ctx->inst_info->r600_opcode;
                for (j = 0; j < inst->Instruction.NumSrcRegs; j++) {
                        alu.src[j] = r600_src[j];
                        alu.src[j].chan = tgsi_chan(&inst->Src[j], i);
                }
-               alu.dst.sel = ctx->temp_reg;
+
+               r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
+               if (r)
+                       return r;
+
                alu.dst.chan = i;
                alu.dst.write = 1;
                alu.is_op3 = 1;
-               if (i == 3) {
+               if (i == lasti) {
                        alu.last = 1;
                }
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
        }
-       return tgsi_helper_copy(ctx, inst);
+       return 0;
 }
 
 static int tgsi_dp(struct r600_shader_ctx *ctx)
@@ -1784,9 +1617,13 @@ static int tgsi_dp(struct r600_shader_ctx *ctx)
                        alu.src[j] = r600_src[j];
                        alu.src[j].chan = tgsi_chan(&inst->Src[j], i);
                }
-               alu.dst.sel = ctx->temp_reg;
+
+               r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
+               if (r)
+                       return r;
+
                alu.dst.chan = i;
-               alu.dst.write = 1;
+               alu.dst.write = (inst->Dst[0].Register.WriteMask >> i) & 1;
                /* handle some special cases */
                switch (ctx->inst_info->tgsi_opcode) {
                case TGSI_OPCODE_DP2:
@@ -1818,19 +1655,21 @@ static int tgsi_dp(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
        }
-       return tgsi_helper_copy(ctx, inst);
+       return 0;
 }
 
 static int tgsi_tex(struct r600_shader_ctx *ctx)
 {
+       static float one_point_five = 1.5f;
        struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
        struct r600_bc_tex tex;
        struct r600_bc_alu alu;
        unsigned src_gpr;
        int r, i;
        int opcode;
-       boolean src_not_temp = inst->Src[0].Register.File != TGSI_FILE_TEMPORARY;
-       uint32_t lit_vals[4];
+       boolean src_not_temp =
+               inst->Src[0].Register.File != TGSI_FILE_TEMPORARY &&
+               inst->Src[0].Register.File != TGSI_FILE_INPUT;
 
        src_gpr = ctx->file_offset[inst->Src[0].Register.File] + inst->Src[0].Register.Index;
 
@@ -1959,6 +1798,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 
                alu.src[2].sel = V_SQ_ALU_SRC_LITERAL;
                alu.src[2].chan = 0;
+               alu.src[2].value = (u32*)&one_point_five;
 
                alu.dst.sel = ctx->temp_reg;
                alu.dst.chan = 0;
@@ -1979,6 +1819,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 
                alu.src[2].sel = V_SQ_ALU_SRC_LITERAL;
                alu.src[2].chan = 0;
+               alu.src[2].value = (u32*)&one_point_five;
 
                alu.dst.sel = ctx->temp_reg;
                alu.dst.chan = 1;
@@ -1989,11 +1830,6 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               lit_vals[0] = fui(1.5f);
-
-               r = r600_bc_add_literal(ctx->bc, lit_vals);
-               if (r)
-                       return r;
                src_not_temp = FALSE;
                src_gpr = ctx->temp_reg;
        }
@@ -2066,6 +1902,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
        struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
        struct r600_bc_alu_src r600_src[3];
        struct r600_bc_alu alu;
+       int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
        unsigned i;
        int r;
 
@@ -2075,8 +1912,40 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
        r = tgsi_split_literal_constant(ctx, r600_src);
        if (r)
                return r;
+
+       /* optimize if it's just an equal balance */
+       if(r600_src[0].sel == V_SQ_ALU_SRC_0_5) {
+               for (i = 0; i < lasti + 1; i++) {
+                       if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
+                               continue;
+
+                       memset(&alu, 0, sizeof(struct r600_bc_alu));
+                       alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD);
+                       alu.src[0] = r600_src[1];
+                       alu.src[0].chan = tgsi_chan(&inst->Src[1], i);
+                       alu.src[1] = r600_src[2];
+                       alu.src[1].chan = tgsi_chan(&inst->Src[2], i);
+                       alu.omod = 3;
+                       r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
+                       if (r)
+                               return r;
+
+                       alu.dst.chan = i;
+                       if (i == lasti) {
+                               alu.last = 1;
+                       }
+                       r = r600_bc_add_alu(ctx->bc, &alu);
+                       if (r)
+                               return r;
+               }
+               return 0;
+       }
+
        /* 1 - src0 */
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < lasti + 1; i++) {
+               if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
+                       continue;
+
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD);
                alu.src[0].sel = V_SQ_ALU_SRC_1;
@@ -2086,7 +1955,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
                alu.src[1].neg = 1;
                alu.dst.sel = ctx->temp_reg;
                alu.dst.chan = i;
-               if (i == 3) {
+               if (i == lasti) {
                        alu.last = 1;
                }
                alu.dst.write = 1;
@@ -2094,12 +1963,12 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
        }
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
-       if (r)
-               return r;
 
        /* (1 - src0) * src2 */
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < lasti + 1; i++) {
+               if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
+                       continue;
+
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
                alu.src[0].sel = ctx->temp_reg;
@@ -2108,7 +1977,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
                alu.src[1].chan = tgsi_chan(&inst->Src[2], i);
                alu.dst.sel = ctx->temp_reg;
                alu.dst.chan = i;
-               if (i == 3) {
+               if (i == lasti) {
                        alu.last = 1;
                }
                alu.dst.write = 1;
@@ -2116,12 +1985,12 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
        }
-       r = r600_bc_add_literal(ctx->bc, ctx->value);
-       if (r)
-               return r;
 
        /* src0 * src1 + (1 - src0) * src2 */
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < lasti + 1; i++) {
+               if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
+                       continue;
+
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
                alu.is_op3 = 1;
@@ -2131,16 +2000,20 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
                alu.src[1].chan = tgsi_chan(&inst->Src[1], i);
                alu.src[2].sel = ctx->temp_reg;
                alu.src[2].chan = i;
-               alu.dst.sel = ctx->temp_reg;
+
+               r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
+               if (r)
+                       return r;
+
                alu.dst.chan = i;
-               if (i == 3) {
+               if (i == lasti) {
                        alu.last = 1;
                }
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
        }
-       return tgsi_helper_copy(ctx, inst);
+       return 0;
 }
 
 static int tgsi_cmp(struct r600_shader_ctx *ctx)
@@ -2148,8 +2021,8 @@ static int tgsi_cmp(struct r600_shader_ctx *ctx)
        struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
        struct r600_bc_alu_src r600_src[3];
        struct r600_bc_alu alu;
-       int use_temp = 0;
        int i, r;
+       int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
 
        r = tgsi_split_constant(ctx, r600_src);
        if (r)
@@ -2158,10 +2031,10 @@ static int tgsi_cmp(struct r600_shader_ctx *ctx)
        if (r)
                return r;
 
-       if (inst->Dst[0].Register.WriteMask != 0xf)
-               use_temp = 1;
+       for (i = 0; i < lasti + 1; i++) {
+               if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
+                       continue;
 
-       for (i = 0; i < 4; i++) {
                memset(&alu, 0, sizeof(struct r600_bc_alu));
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE);
                alu.src[0] = r600_src[0];
@@ -2173,24 +2046,19 @@ static int tgsi_cmp(struct r600_shader_ctx *ctx)
                alu.src[2] = r600_src[1];
                alu.src[2].chan = tgsi_chan(&inst->Src[1], i);
 
-               if (use_temp)
-                       alu.dst.sel = ctx->temp_reg;
-               else {
-                       r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
-                       if (r)
-                               return r;
-               }
+               r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
+               if (r)
+                       return r;
+
                alu.dst.chan = i;
                alu.dst.write = 1;
                alu.is_op3 = 1;
-               if (i == 3)
+               if (i == lasti)
                        alu.last = 1;
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
        }
-       if (use_temp)
-               return tgsi_helper_copy(ctx, inst);
        return 0;
 }
 
@@ -2257,10 +2125,6 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        for (i = 0; i < 4; i++) {
@@ -2318,10 +2182,6 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
        if (use_temp)
                return tgsi_helper_copy(ctx, inst);
@@ -2354,10 +2214,6 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
-
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
                alu.src[0].sel = ctx->temp_reg;
                alu.src[0].chan = 0;
@@ -2369,10 +2225,6 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        /* result.y = tmp - floor(tmp); */
@@ -2398,9 +2250,6 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        /* result.z = RoughApprox2ToX(tmp);*/
@@ -2421,9 +2270,6 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        /* result.w = 1.0;*/
@@ -2441,9 +2287,6 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
        return tgsi_helper_copy(ctx, inst);
 }
@@ -2473,10 +2316,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
-
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR);
                alu.src[0].sel = ctx->temp_reg;
                alu.src[0].chan = 0;
@@ -2489,10 +2328,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        /* result.y = src.x / (2 ^ floor(log2(src.x))); */
@@ -2515,10 +2350,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
-
                memset(&alu, 0, sizeof(struct r600_bc_alu));
 
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR);
@@ -2534,10 +2365,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
-
                memset(&alu, 0, sizeof(struct r600_bc_alu));
 
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
@@ -2553,10 +2380,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
-
                memset(&alu, 0, sizeof(struct r600_bc_alu));
 
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE);
@@ -2572,10 +2395,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                if (r)
                        return r;
 
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
-
                memset(&alu, 0, sizeof(struct r600_bc_alu));
 
                alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
@@ -2597,10 +2416,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        /* result.z = log2(src);*/
@@ -2622,10 +2437,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        /* result.w = 1.0; */
@@ -2644,10 +2455,6 @@ static int tgsi_log(struct r600_shader_ctx *ctx)
                r = r600_bc_add_alu(ctx->bc, &alu);
                if (r)
                        return r;
-
-               r = r600_bc_add_literal(ctx->bc, ctx->value);
-               if (r)
-                       return r;
        }
 
        return tgsi_helper_copy(ctx, inst);
@@ -2802,8 +2609,25 @@ static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode)
 
 static int pops(struct r600_shader_ctx *ctx, int pops)
 {
-       r600_bc_add_cfinst(ctx->bc, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP));
-       ctx->bc->cf_last->pop_count = pops;
+       int alu_pop = 3;
+       if (ctx->bc->cf_last) {
+               if (ctx->bc->cf_last->inst == CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU) << 3)
+                       alu_pop = 0;
+               else if (ctx->bc->cf_last->inst == CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER) << 3)
+                       alu_pop = 1;
+       }
+       alu_pop += pops;
+       if (alu_pop == 1) {
+               ctx->bc->cf_last->inst = CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER) << 3;
+               ctx->bc->force_add_cf = 1;
+       } else if (alu_pop == 2) {
+               ctx->bc->cf_last->inst = CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER) << 3;
+               ctx->bc->force_add_cf = 1;
+       } else {
+               r600_bc_add_cfinst(ctx->bc, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP));
+               ctx->bc->cf_last->pop_count = pops;
+               ctx->bc->cf_last->cf_addr = ctx->bc->cf_last->id + 2;
+       }
        return 0;
 }
 
index cd108da49153171a564cbce0061c448acbabe9bb..935dd6fe3abebf4d41071f55997138bed83007c8 100644 (file)
@@ -38,7 +38,6 @@ struct r600_shader_io {
 struct r600_shader {
        unsigned                processor_type;
        struct r600_bc          bc;
-       boolean                 flat_shade;
        unsigned                ninput;
        unsigned                noutput;
        unsigned                nlds;
@@ -46,9 +45,8 @@ struct r600_shader {
        struct r600_shader_io   output[32];
        enum radeon_family      family;
        boolean                 uses_kill;
-       struct r600_bc          bc_fetch;
 };
 
-int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
+int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader, u32 **literals);
 
 #endif
index 0573e63dc8236c613e5eeb904e2c1c20878ea89c..56ed35e8b3294d252d5addaba4b5f09b18a00b0f 100644 (file)
 #define   S_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((x) & 0x3) << 30)
 #define   G_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((x) >> 30) & 0x3)
 #define   C_SQ_CF_ALU_WORD0_KCACHE_MODE0                             0x3FFFFFFF
+#define     V_SQ_CF_KCACHE_NOP                                       0x00000000
+#define     V_SQ_CF_KCACHE_LOCK_1                                    0x00000001
+#define     V_SQ_CF_KCACHE_LOCK_2                                    0x00000002
+#define     V_SQ_CF_KCACHE_LOCK_LOOP_INDEX                           0x00000003
 #define P_SQ_CF_ALU_WORD1
 #define   S_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((x) & 0x3) << 0)
 #define   G_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((x) >> 0) & 0x3)
 #define     V_SQ_ALU_SRC_M_1_INT                                     0x000000FB
 #define     V_SQ_ALU_SRC_0_5                                         0x000000FC
 #define     V_SQ_ALU_SRC_LITERAL                                     0x000000FD
+#define     V_SQ_ALU_SRC_PV                                          0x000000FE
+#define     V_SQ_ALU_SRC_PS                                          0x000000FF
 #define     V_SQ_ALU_SRC_PARAM_BASE                                  0x000001C0
 #define   S_SQ_ALU_WORD0_SRC0_REL(x)                                 (((x) & 0x1) << 9)
 #define   G_SQ_ALU_WORD0_SRC0_REL(x)                                 (((x) >> 9) & 0x1)
index bf4ca057d287f5cd7ec32fea1491ca78e607fbb6..96b02d72b943806ef3939637957758b9cf496088 100644 (file)
@@ -36,7 +36,6 @@
 #include <util/u_pack_color.h>
 #include <util/u_memory.h>
 #include <util/u_inlines.h>
-#include <util/u_upload_mgr.h>
 #include <util/u_framebuffer.h>
 #include <pipebuffer/pb_buffer.h>
 #include "r600.h"
 #include "r600_pipe.h"
 #include "r600_state_inlines.h"
 
+void r600_polygon_offset_update(struct r600_pipe_context *rctx)
+{
+       struct r600_pipe_state state;
+
+       state.id = R600_PIPE_STATE_POLYGON_OFFSET;
+       state.nregs = 0;
+       if (rctx->rasterizer && rctx->framebuffer.zsbuf) {
+               float offset_units = rctx->rasterizer->offset_units;
+               unsigned offset_db_fmt_cntl = 0, depth;
+
+               switch (rctx->framebuffer.zsbuf->texture->format) {
+               case PIPE_FORMAT_Z24X8_UNORM:
+               case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+                       depth = -24;
+                       offset_units *= 2.0f;
+                       break;
+               case PIPE_FORMAT_Z32_FLOAT:
+                       depth = -23;
+                       offset_units *= 1.0f;
+                       offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
+                       break;
+               case PIPE_FORMAT_Z16_UNORM:
+                       depth = -16;
+                       offset_units *= 4.0f;
+                       break;
+               default:
+                       return;
+               }
+               /* FIXME some of those reg can be computed with cso */
+               offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
+               r600_pipe_state_add_reg(&state,
+                               R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE,
+                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET,
+                               fui(offset_units), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE,
+                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET,
+                               fui(offset_units), 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(&state,
+                               R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL,
+                               offset_db_fmt_cntl, 0xFFFFFFFF, NULL);
+               r600_context_pipe_state_set(&rctx->ctx, &state);
+       }
+}
+
+/* FIXME optimize away spi update when it's not needed */
+static void r600_spi_update(struct r600_pipe_context *rctx)
+{
+       struct r600_pipe_shader *shader = rctx->ps_shader;
+       struct r600_pipe_state rstate;
+       struct r600_shader *rshader = &shader->shader;
+       unsigned i, tmp;
+
+       rstate.nregs = 0;
+       for (i = 0; i < rshader->ninput; i++) {
+               tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i));
+               if (rshader->input[i].centroid)
+                       tmp |= S_028644_SEL_CENTROID(1);
+               if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR)
+                       tmp |= S_028644_SEL_LINEAR(1);
+
+               if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
+                   rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
+                   rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
+                       tmp |= S_028644_FLAT_SHADE(rctx->flatshade);
+               }
+               if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
+                       rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
+                       tmp |= S_028644_PT_SPRITE_TEX(1);
+               }
+               r600_pipe_state_add_reg(&rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
+       }
+       r600_context_pipe_state_set(&rctx->ctx, &rstate);
+}
+
+void r600_vertex_buffer_update(struct r600_pipe_context *rctx)
+{
+       struct r600_pipe_state *rstate;
+       struct r600_resource *rbuffer;
+       struct pipe_vertex_buffer *vertex_buffer;
+       unsigned i, offset;
+
+       /* we don't update until we know vertex elements */
+       if (rctx->vertex_elements == NULL || !rctx->nvertex_buffer)
+               return;
+
+       if (rctx->vertex_elements->incompatible_layout) {
+               /* translate rebind new vertex elements so
+                * return once translated
+                */
+               r600_begin_vertex_translate(rctx);
+               return;
+       }
+
+       if (rctx->any_user_vbs) {
+               r600_upload_user_buffers(rctx);
+               rctx->any_user_vbs = FALSE;
+       }
+
+       if (rctx->vertex_elements->vbuffer_need_offset) {
+               /* one resource per vertex elements */
+               rctx->nvs_resource = rctx->vertex_elements->count;
+       } else {
+               /* bind vertex buffer once */
+               rctx->nvs_resource = rctx->nvertex_buffer;
+       }
+
+       for (i = 0 ; i < rctx->nvs_resource; i++) {
+               rstate = &rctx->vs_resource[i];
+               rstate->id = R600_PIPE_STATE_RESOURCE;
+               rstate->nregs = 0;
+
+               if (rctx->vertex_elements->vbuffer_need_offset) {
+                       /* one resource per vertex elements */
+                       unsigned vbuffer_index;
+                       vbuffer_index = rctx->vertex_elements->elements[i].vertex_buffer_index;
+                       vertex_buffer = &rctx->vertex_buffer[vbuffer_index];
+                       rbuffer = (struct r600_resource*)vertex_buffer->buffer;
+                       offset = rctx->vertex_elements->vbuffer_offset[i];
+               } else {
+                       /* bind vertex buffer once */
+                       vertex_buffer = &rctx->vertex_buffer[i];
+                       rbuffer = (struct r600_resource*)vertex_buffer->buffer;
+                       offset = 0;
+               }
+               if (vertex_buffer == NULL || rbuffer == NULL)
+                       continue;
+               offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo);
+
+               r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0,
+                                       offset, 0xFFFFFFFF, rbuffer->bo);
+               r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1,
+                                       rbuffer->bo_size - offset - 1, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2,
+                                       S_038008_STRIDE(vertex_buffer->stride),
+                                       0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3,
+                                       0x00000000, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4,
+                                       0x00000000, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5,
+                                       0x00000000, 0xFFFFFFFF, NULL);
+               r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6,
+                                       0xC0000000, 0xFFFFFFFF, NULL);
+               r600_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i);
+       }
+}
+
 static void r600_draw_common(struct r600_drawl *draw)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)draw->ctx;
-       struct r600_pipe_state *rstate;
        struct r600_resource *rbuffer;
-       unsigned i, j, offset, prim;
+       unsigned prim;
        u32 vgt_dma_index_type, vgt_draw_initiator, mask;
-       struct pipe_vertex_buffer *vertex_buffer;
        struct r600_draw rdraw;
        struct r600_pipe_state vgt;
 
@@ -76,42 +225,23 @@ static void r600_draw_common(struct r600_drawl *draw)
        }
        if (r600_conv_pipe_prim(draw->mode, &prim))
                return;
-
-
-       /* rebuild vertex shader if input format changed */
-       if (r600_pipe_shader_update(&rctx->context, rctx->vs_shader))
+       if (unlikely(rctx->ps_shader == NULL)) {
+               R600_ERR("missing vertex shader\n");
                return;
-       if (r600_pipe_shader_update(&rctx->context, rctx->ps_shader))
+       }
+       if (unlikely(rctx->vs_shader == NULL)) {
+               R600_ERR("missing vertex shader\n");
+               return;
+       }
+       /* there should be enough input */
+       if (rctx->vertex_elements->count < rctx->vs_shader->shader.bc.nresource) {
+               R600_ERR("%d resources provided, expecting %d\n",
+                       rctx->vertex_elements->count, rctx->vs_shader->shader.bc.nresource);
                return;
-
-       for (i = 0 ; i < rctx->vertex_elements->count; i++) {
-               uint32_t word2, format;
-
-               rstate = &rctx->vs_resource[i];
-               rstate->id = R600_PIPE_STATE_RESOURCE;
-               rstate->nregs = 0;
-
-               j = rctx->vertex_elements->elements[i].vertex_buffer_index;
-               vertex_buffer = &rctx->vertex_buffer[j];
-               rbuffer = (struct r600_resource*)vertex_buffer->buffer;
-               offset = rctx->vertex_elements->elements[i].src_offset +
-                       vertex_buffer->buffer_offset +
-                       r600_bo_offset(rbuffer->bo);
-
-               format = r600_translate_vertex_data_type(rctx->vertex_elements->hw_format[i]);
-
-               word2 = format | S_038008_STRIDE(vertex_buffer->stride);
-
-               r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo);
-               r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, word2, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, 0xC0000000, 0xFFFFFFFF, NULL);
-               r600_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i);
        }
 
+       r600_spi_update(rctx);
+
        mask = 0;
        for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
                mask |= (0xF << (i * 4));
@@ -126,46 +256,6 @@ static void r600_draw_common(struct r600_drawl *draw)
        r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(&vgt, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(&vgt, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0xFFFFFFFF, NULL);
-       /* build late state */
-       if (rctx->rasterizer && rctx->framebuffer.zsbuf) {
-               float offset_units = rctx->rasterizer->offset_units;
-               unsigned offset_db_fmt_cntl = 0, depth;
-
-               switch (rctx->framebuffer.zsbuf->texture->format) {
-               case PIPE_FORMAT_Z24X8_UNORM:
-               case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
-                       depth = -24;
-                       offset_units *= 2.0f;
-                       break;
-               case PIPE_FORMAT_Z32_FLOAT:
-                       depth = -23;
-                       offset_units *= 1.0f;
-                       offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
-                       break;
-               case PIPE_FORMAT_Z16_UNORM:
-                       depth = -16;
-                       offset_units *= 4.0f;
-                       break;
-               default:
-                       return;
-               }
-               offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE,
-                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET,
-                               fui(offset_units), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE,
-                               fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET,
-                               fui(offset_units), 0xFFFFFFFF, NULL);
-               r600_pipe_state_add_reg(&vgt,
-                               R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL,
-                               offset_db_fmt_cntl, 0xFFFFFFFF, NULL);
-       }
        r600_context_pipe_state_set(&rctx->ctx, &vgt);
 
        rdraw.vgt_num_indices = draw->count;
@@ -185,17 +275,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_drawl draw;
-       boolean translate = FALSE;
 
-       if (rctx->vertex_elements->incompatible_layout) {
-               r600_begin_vertex_translate(rctx);
-               translate = TRUE;
-       }
-
-       if (rctx->any_user_vbs) {
-               r600_upload_user_buffers(rctx);
-               rctx->any_user_vbs = FALSE;
-       }
        memset(&draw, 0, sizeof(struct r600_drawl));
        draw.ctx = ctx;
        draw.mode = info->mode;
@@ -226,9 +306,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
        }
        r600_draw_common(&draw);
 
-       if (translate)
-               r600_end_vertex_translate(rctx);
-
        pipe_resource_reference(&draw.index_buffer, NULL);
 }
 
@@ -603,9 +680,9 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
                                word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) |
                                S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) |
                                S_038010_REQUEST_SIZE(1) |
-                               S_038010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL);
+                               S_038010_BASE_LEVEL(state->u.tex.first_level), 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5,
-                               S_038014_LAST_LEVEL(state->last_level) |
+                               S_038014_LAST_LEVEL(state->u.tex.last_level) |
                                S_038014_BASE_ARRAY(0) |
                                S_038014_LAST_ARRAY(0), 0xFFFFFFFF, NULL);
        r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6,
@@ -824,10 +901,11 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
        struct r600_resource_texture *rtex;
        struct r600_resource *rbuffer;
        struct r600_surface *surf;
-       unsigned level = state->cbufs[cb]->level;
+       unsigned level = state->cbufs[cb]->u.tex.level;
        unsigned pitch, slice;
        unsigned color_info;
        unsigned format, swap, ntype;
+       unsigned offset;
        const struct util_format_description *desc;
        struct r600_bo *bo[3];
 
@@ -838,6 +916,9 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
        bo[1] = rbuffer->bo;
        bo[2] = rbuffer->bo;
 
+       /* XXX quite sure for dx10+ hw don't need any offset hacks */
+       offset = r600_texture_get_offset((struct r600_resource_texture *)state->cbufs[cb]->texture,
+                                        level, state->cbufs[cb]->u.tex.first_layer);
        pitch = rtex->pitch_in_pixels[level] / 8 - 1;
        slice = rtex->pitch_in_pixels[level] * surf->aligned_height / 64 - 1;
        ntype = 0;
@@ -857,7 +938,7 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
 
        r600_pipe_state_add_reg(rstate,
                                R_028040_CB_COLOR0_BASE + cb * 4,
-                               (state->cbufs[cb]->offset + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
+                               (offset + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
        r600_pipe_state_add_reg(rstate,
                                R_0280A0_CB_COLOR0_INFO + cb * 4,
                                color_info, 0xFFFFFFFF, bo[0]);
@@ -888,11 +969,12 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
        struct r600_surface *surf;
        unsigned level;
        unsigned pitch, slice, format;
+       unsigned offset;
 
        if (state->zsbuf == NULL)
                return;
 
-       level = state->zsbuf->level;
+       level = state->zsbuf->u.tex.level;
 
        surf = (struct r600_surface *)state->zsbuf;
        rtex = (struct r600_resource_texture*)state->zsbuf->texture;
@@ -902,12 +984,15 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
        rtex->depth = 1;
        rbuffer = &rtex->resource;
 
+       /* XXX quite sure for dx10+ hw don't need any offset hacks */
+       offset = r600_texture_get_offset((struct r600_resource_texture *)state->zsbuf->texture,
+                                        level, state->zsbuf->u.tex.first_layer);
        pitch = rtex->pitch_in_pixels[level] / 8 - 1;
        slice = rtex->pitch_in_pixels[level] * surf->aligned_height / 64 - 1;
        format = r600_translate_dbformat(state->zsbuf->texture->format);
 
        r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE,
-                               (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                               (offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
        r600_pipe_state_add_reg(rstate, R_028000_DB_DEPTH_SIZE,
                                S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice),
                                0xFFFFFFFF, NULL);
@@ -934,8 +1019,6 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
 
        util_copy_framebuffer_state(&rctx->framebuffer, state);
 
-       rctx->pframebuffer = &rctx->framebuffer;
-
        /* build states */
        for (int i = 0; i < state->nr_cbufs; i++) {
                r600_cb(rctx, rstate, state, i);
@@ -1015,6 +1098,10 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
        free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]);
        rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate;
        r600_context_pipe_state_set(&rctx->ctx, rstate);
+
+       if (state->zsbuf) {
+               r600_polygon_offset_update(rctx);
+       }
 }
 
 static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
@@ -1022,6 +1109,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_resource *rbuffer = (struct r600_resource*)buffer;
+       uint32_t offset;
 
        /* Note that the state tracker can unbind constant buffers by
         * passing NULL here.
@@ -1030,6 +1118,8 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
                return;
        }
 
+       r600_upload_const_buffer(rctx, buffer, &offset);
+
        switch (shader) {
        case PIPE_SHADER_VERTEX:
                rctx->vs_const_buffer.nregs = 0;
@@ -1039,7 +1129,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
                                        0xFFFFFFFF, NULL);
                r600_pipe_state_add_reg(&rctx->vs_const_buffer,
                                        R_028980_ALU_CONST_CACHE_VS_0,
-                                       r600_bo_offset(rbuffer->bo) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                                       (r600_bo_offset(rbuffer->bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->bo);
                r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer);
                break;
        case PIPE_SHADER_FRAGMENT:
@@ -1050,7 +1140,7 @@ static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint
                                        0xFFFFFFFF, NULL);
                r600_pipe_state_add_reg(&rctx->ps_const_buffer,
                                        R_028940_ALU_CONST_CACHE_PS_0,
-                                       r600_bo_offset(rbuffer->bo) >> 8, 0xFFFFFFFF, rbuffer->bo);
+                                       (r600_bo_offset(rbuffer->bo) + offset) >> 8, 0xFFFFFFFF, rbuffer->bo);
                r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer);
                break;
        default:
index 55bc5d0d22b7cc41c87606dddcb82626e2bdafe7..3603376f738b9ffd1faa3537441fe72fbc5903ff 100644 (file)
@@ -58,6 +58,12 @@ void r600_bind_rs_state(struct pipe_context *ctx, void *state)
 
        rctx->states[rs->rstate.id] = &rs->rstate;
        r600_context_pipe_state_set(&rctx->ctx, &rs->rstate);
+
+       if (rctx->family >= CHIP_CEDAR) {
+               evergreen_polygon_offset_update(rctx);
+       } else {
+               r600_polygon_offset_update(rctx);
+       }
 }
 
 void r600_delete_rs_state(struct pipe_context *ctx, void *state)
@@ -113,7 +119,22 @@ void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_vertex_element *v = (struct r600_vertex_element*)state;
 
+       /* delete previous translated vertex elements */
+       if (rctx->tran.new_velems) {
+               r600_end_vertex_translate(rctx);
+       }
+
        rctx->vertex_elements = v;
+       if (v) {
+               rctx->states[v->rstate.id] = &v->rstate;
+               r600_context_pipe_state_set(&rctx->ctx, &v->rstate);
+               if (rctx->family >= CHIP_CEDAR) {
+                       evergreen_vertex_buffer_update(rctx);
+               } else {
+                       r600_vertex_buffer_update(rctx);
+               }
+       }
+
        if (v) {
 //             rctx->vs_rebuild = TRUE;
        }
@@ -122,11 +143,16 @@ void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
 void r600_delete_vertex_element(struct pipe_context *ctx, void *state)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+       struct r600_vertex_element *v = (struct r600_vertex_element*)state;
 
-       FREE(state);
-
+       if (rctx->states[v->rstate.id] == &v->rstate) {
+               rctx->states[v->rstate.id] = NULL;
+       }
        if (rctx->vertex_elements == state)
                rctx->vertex_elements = NULL;
+
+       r600_bo_reference(rctx->radeon, &v->fetch_shader, NULL);
+       FREE(state);
 }
 
 
@@ -153,8 +179,16 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
        struct pipe_vertex_buffer *vbo;
        unsigned max_index = (unsigned)-1;
 
-       for (int i = 0; i < rctx->nvertex_buffer; i++) {
-               pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL);
+       if (rctx->family >= CHIP_CEDAR) {
+               for (int i = 0; i < rctx->nvertex_buffer; i++) {
+                       pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL);
+                       evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i);
+               }
+       } else {
+               for (int i = 0; i < rctx->nvertex_buffer; i++) {
+                       pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL);
+                       r600_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i);
+               }
        }
        memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count);
 
@@ -162,20 +196,29 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
                vbo = (struct pipe_vertex_buffer*)&buffers[i];
 
                rctx->vertex_buffer[i].buffer = NULL;
+               if (buffers[i].buffer == NULL)
+                       continue;
                if (r600_buffer_is_user_buffer(buffers[i].buffer))
                        rctx->any_user_vbs = TRUE;
                pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer);
 
+               /* The stride of zero means we will be fetching only the first
+                * vertex, so don't care about max_index. */
+               if (!vbo->stride)
+                       continue;
+
                if (vbo->max_index == ~0) {
-                       if (!vbo->stride)
-                               vbo->max_index = 1;
-                       else
-                               vbo->max_index = (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride;
+                       vbo->max_index = (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride;
                }
                max_index = MIN2(vbo->max_index, max_index);
        }
        rctx->nvertex_buffer = count;
        rctx->vb_max_index = max_index;
+       if (rctx->family >= CHIP_CEDAR) {
+               evergreen_vertex_buffer_update(rctx);
+       } else {
+               r600_vertex_buffer_update(rctx);
+       }
 }
 
 
@@ -186,9 +229,10 @@ void *r600_create_vertex_elements(struct pipe_context *ctx,
                                  unsigned count,
                                  const struct pipe_vertex_element *elements)
 {
+       struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element);
-       int i;
        enum pipe_format *format;
+       int i;
 
        assert(count < 32);
        if (!v)
@@ -210,12 +254,16 @@ void *r600_create_vertex_elements(struct pipe_context *ctx,
                }
                v->incompatible_layout =
                        v->incompatible_layout ||
-                       v->elements[i].src_format != v->hw_format[i] ||
-                       v->elements[i].src_offset % 4 != 0;
+                       v->elements[i].src_format != v->hw_format[i];
 
                v->hw_format_size[i] = align(util_format_get_blocksize(v->hw_format[i]), 4);
        }
 
+       if (r600_vertex_elements_build_fetch_shader(rctx, v)) {
+               FREE(v);
+               return NULL;
+       }
+
        return v;
 }
 
@@ -238,6 +286,9 @@ void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
 
        /* TODO delete old shader */
        rctx->ps_shader = (struct r600_pipe_shader *)state;
+       if (state) {
+               r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_shader->rstate);
+       }
 }
 
 void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
@@ -246,6 +297,9 @@ void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
 
        /* TODO delete old shader */
        rctx->vs_shader = (struct r600_pipe_shader *)state;
+       if (state) {
+               r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_shader->rstate);
+       }
 }
 
 void r600_delete_ps_shader(struct pipe_context *ctx, void *state)
index 781612af570257e82521e5759b78becae1c7ce84..d994196e19d25e5f9e6ae7c0ae93a062bbee18a9 100644 (file)
@@ -305,6 +305,7 @@ static inline uint32_t r600_translate_colorswap(enum pipe_format format)
                return V_0280A0_SWAP_STD;
 
        case PIPE_FORMAT_L8A8_UNORM:
+               return V_0280A0_SWAP_ALT;
        case PIPE_FORMAT_R8G8_UNORM:
                return V_0280A0_SWAP_STD;
 
index 8ecd434a43ac87e8e9388a09de1450cded8f32b3..e2745624575c1860cf9423f49df52bec1457a4f6 100644 (file)
@@ -45,14 +45,10 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t
 {
        struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer;
        struct pipe_resource *texture = transfer->resource;
-       struct pipe_subresource subdst;
 
-       subdst.face = 0;
-       subdst.level = 0;
        ctx->resource_copy_region(ctx, rtransfer->staging_texture,
-                               subdst, 0, 0, 0, texture, transfer->sr,
-                               transfer->box.x, transfer->box.y, transfer->box.z,
-                               transfer->box.width, transfer->box.height);
+                               0, 0, 0, 0, texture, transfer->level,
+                               &transfer->box);
 }
 
 
@@ -61,34 +57,32 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600
 {
        struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer;
        struct pipe_resource *texture = transfer->resource;
-       struct pipe_subresource subsrc;
-
-       subsrc.face = 0;
-       subsrc.level = 0;
-       ctx->resource_copy_region(ctx, texture, transfer->sr,
+       struct pipe_box sbox;
+
+       sbox.x = sbox.y = sbox.z = 0;
+       sbox.width = transfer->box.width;
+       sbox.height = transfer->box.height;
+       /* XXX that might be wrong */
+       sbox.depth = 1;
+       ctx->resource_copy_region(ctx, texture, transfer->level,
                                  transfer->box.x, transfer->box.y, transfer->box.z,
-                                 rtransfer->staging_texture, subsrc,
-                                 0, 0, 0,
-                                 transfer->box.width, transfer->box.height);
+                                 rtransfer->staging_texture,
+                                 0, &sbox);
 
        ctx->flush(ctx, 0, NULL);
 }
 
-static unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
-                                       unsigned level, unsigned zslice,
-                                       unsigned face)
+unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
+                                       unsigned level, unsigned layer)
 {
        unsigned offset = rtex->offset[level];
 
        switch (rtex->resource.base.b.target) {
        case PIPE_TEXTURE_3D:
-               assert(face == 0);
-               return offset + zslice * rtex->layer_size[level];
        case PIPE_TEXTURE_CUBE:
-               assert(zslice == 0);
-               return offset + face * rtex->layer_size[level];
+               return offset + layer * rtex->layer_size[level];
        default:
-               assert(zslice == 0 && face == 0);
+               assert(layer == 0);
                return offset;
        }
 }
@@ -175,10 +169,7 @@ static unsigned r600_texture_get_stride(struct pipe_screen *screen,
                                        struct r600_resource_texture *rtex,
                                        unsigned level)
 {
-       struct r600_screen* rscreen = (struct r600_screen *)screen;
        struct pipe_resource *ptex = &rtex->resource.base.b;
-       struct radeon *radeon = (struct radeon *)screen->winsys;
-       enum chip_class chipc = r600_get_family_class(radeon);
        unsigned width, stride, tile_width;
 
        if (rtex->pitch_override)
@@ -212,11 +203,10 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen,
 }
 
 /* Get a width in pixels from a stride in bytes. */
-static unsigned pitch_to_width(enum pipe_format format,
-                                unsigned pitch_in_bytes)
+static unsigned pitch_to_width(enum pipe_format format, unsigned pitch_in_bytes)
 {
-    return (pitch_in_bytes / util_format_get_blocksize(format)) *
-            util_format_get_blockwidth(format);
+       return (pitch_in_bytes / util_format_get_blocksize(format)) *
+               util_format_get_blockwidth(format);
 }
 
 static void r600_texture_set_array_mode(struct pipe_screen *screen,
@@ -335,12 +325,12 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
                                                const struct pipe_resource *templ)
 {
        unsigned array_mode = 0;
-        static int force_tiling = -1;
+       static int force_tiling = -1;
 
-        /* Would like some magic "get_bool_option_once" routine.
+       /* Would like some magic "get_bool_option_once" routine.
         */
        if (force_tiling == -1)
-                force_tiling = debug_get_bool_option("R600_FORCE_TILING", FALSE);
+               force_tiling = debug_get_bool_option("R600_FORCE_TILING", FALSE);
 
        if (force_tiling) {
                if (!(templ->flags & R600_RESOURCE_FLAG_TRANSFER) &&
@@ -371,8 +361,8 @@ static void r600_texture_destroy(struct pipe_screen *screen,
 }
 
 static boolean r600_texture_get_handle(struct pipe_screen* screen,
-                                       struct pipe_resource *ptex,
-                                       struct winsys_handle *whandle)
+                                       struct pipe_resource *ptex,
+                                       struct winsys_handle *whandle)
 {
        struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex;
        struct r600_resource *resource = &rtex->resource;
@@ -382,36 +372,39 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
                        rtex->pitch_in_bytes[0], whandle);
 }
 
-static struct pipe_surface *r600_get_tex_surface(struct pipe_screen *screen,
+static struct pipe_surface *r600_create_surface(struct pipe_context *pipe,
                                                struct pipe_resource *texture,
-                                               unsigned face, unsigned level,
-                                               unsigned zslice, unsigned flags)
+                                               const struct pipe_surface *surf_tmpl)
 {
        struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
        struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
-       unsigned offset, tile_height;
+       unsigned tile_height;
+       unsigned level = surf_tmpl->u.tex.level;
 
+       assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
        if (surface == NULL)
                return NULL;
-       offset = r600_texture_get_offset(rtex, level, zslice, face);
+       /* XXX no offset */
+/*     offset = r600_texture_get_offset(rtex, level, surf_tmpl->u.tex.first_layer);*/
        pipe_reference_init(&surface->base.reference, 1);
        pipe_resource_reference(&surface->base.texture, texture);
-       surface->base.format = texture->format;
+       surface->base.context = pipe;
+       surface->base.format = surf_tmpl->format;
        surface->base.width = mip_minify(texture->width0, level);
        surface->base.height = mip_minify(texture->height0, level);
-       surface->base.offset = offset;
-       surface->base.usage = flags;
-       surface->base.zslice = zslice;
+       surface->base.usage = surf_tmpl->usage;
        surface->base.texture = texture;
-       surface->base.face = face;
-       surface->base.level = level;
+       surface->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+       surface->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
+       surface->base.u.tex.level = level;
 
-       tile_height = r600_get_height_alignment(screen, rtex->array_mode[level]);
+       tile_height = r600_get_height_alignment(pipe->screen, rtex->array_mode[level]);
        surface->aligned_height = align(surface->base.height, tile_height);
        return &surface->base;
 }
 
-static void r600_tex_surface_destroy(struct pipe_surface *surface)
+static void r600_surface_destroy(struct pipe_context *pipe,
+                                struct pipe_surface *surface)
 {
        pipe_resource_reference(&surface->texture, NULL);
        FREE(surface);
@@ -444,14 +437,12 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
 
 static unsigned int r600_texture_is_referenced(struct pipe_context *context,
                                                struct pipe_resource *texture,
-                                               unsigned face, unsigned level)
+                                               unsigned level, int layer)
 {
        /* FIXME */
        return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
 }
 
-int (*r600_blit_uncompress_depth_ptr)(struct pipe_context *ctx, struct r600_resource_texture *texture);
-
 int r600_texture_depth_flush(struct pipe_context *ctx,
                             struct pipe_resource *texture)
 {
@@ -483,7 +474,7 @@ int r600_texture_depth_flush(struct pipe_context *ctx,
 out:
        /* XXX: only do this if the depth texture has actually changed:
         */
-       r600_blit_uncompress_depth_ptr(ctx, rtex);
+       r600_blit_uncompress_depth(ctx, rtex);
        return 0;
 }
 
@@ -491,7 +482,7 @@ out:
  */
 static INLINE unsigned u_box_volume( const struct pipe_box *box )
 {
-        return box->width * box->depth * box->height;
+       return box->width * box->depth * box->height;
 };
 
 
@@ -499,44 +490,44 @@ static INLINE unsigned u_box_volume( const struct pipe_box *box )
  * If so, don't use a staging resource.
  */
 static boolean permit_hardware_blit(struct pipe_screen *screen,
-                                    struct pipe_resource *res)
+                                       struct pipe_resource *res)
 {
-        unsigned bind;
+       unsigned bind;
 
-        if (util_format_is_depth_or_stencil(res->format))
-                bind = PIPE_BIND_DEPTH_STENCIL;
-        else
-                bind = PIPE_BIND_RENDER_TARGET;
+       if (util_format_is_depth_or_stencil(res->format))
+               bind = PIPE_BIND_DEPTH_STENCIL;
+       else
+               bind = PIPE_BIND_RENDER_TARGET;
 
        /* See r600_resource_copy_region: there is something wrong
-         * with depth resource copies at the moment so avoid them for
-         * now.
-         */
+        * with depth resource copies at the moment so avoid them for
+        * now.
+        */
        if (util_format_get_component_bits(res->format,
-                                           UTIL_FORMAT_COLORSPACE_ZS,
-                                           0) != 0)
-                return FALSE;
-
-        if (!screen->is_format_supported(screen,
-                                         res->format,
-                                         res->target,
-                                         res->nr_samples,
-                                         bind, 0))
-                return FALSE;
-
-        if (!screen->is_format_supported(screen,
-                                         res->format,
-                                         res->target,
-                                         res->nr_samples,
-                                         PIPE_BIND_SAMPLER_VIEW, 0))
-                return FALSE;
-
-        return TRUE;
+                               UTIL_FORMAT_COLORSPACE_ZS,
+                               0) != 0)
+               return FALSE;
+
+       if (!screen->is_format_supported(screen,
+                               res->format,
+                               res->target,
+                               res->nr_samples,
+                               bind, 0))
+               return FALSE;
+
+       if (!screen->is_format_supported(screen,
+                               res->format,
+                               res->target,
+                               res->nr_samples,
+                               PIPE_BIND_SAMPLER_VIEW, 0))
+               return FALSE;
+
+       return TRUE;
 }
 
 struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
                                                struct pipe_resource *texture,
-                                               struct pipe_subresource sr,
+                                               unsigned level,
                                                unsigned usage,
                                                const struct pipe_box *box)
 {
@@ -556,37 +547,36 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
        if (rtex->tiled)
                use_staging_texture = TRUE;
 
-       if ((usage & PIPE_TRANSFER_READ) &&
-            u_box_volume(box) > 1024)
-                use_staging_texture = TRUE;
-
-        /* XXX: Use a staging texture for uploads if the underlying BO
-         * is busy.  No interface for checking that currently? so do
-         * it eagerly whenever the transfer doesn't require a readback
-         * and might block.
-         */
-        if ((usage & PIPE_TRANSFER_WRITE) &&
-            !(usage & (PIPE_TRANSFER_READ |
-                       PIPE_TRANSFER_DONTBLOCK |
-                       PIPE_TRANSFER_UNSYNCHRONIZED)))
-                use_staging_texture = TRUE;
-
-        if (!permit_hardware_blit(ctx->screen, texture) ||
-            (texture->flags & R600_RESOURCE_FLAG_TRANSFER))
-                use_staging_texture = FALSE;
+       if ((usage & PIPE_TRANSFER_READ) && u_box_volume(box) > 1024)
+               use_staging_texture = TRUE;
+
+       /* XXX: Use a staging texture for uploads if the underlying BO
+        * is busy.  No interface for checking that currently? so do
+        * it eagerly whenever the transfer doesn't require a readback
+        * and might block.
+        */
+       if ((usage & PIPE_TRANSFER_WRITE) &&
+                       !(usage & (PIPE_TRANSFER_READ |
+                                       PIPE_TRANSFER_DONTBLOCK |
+                                       PIPE_TRANSFER_UNSYNCHRONIZED)))
+               use_staging_texture = TRUE;
+
+       if (!permit_hardware_blit(ctx->screen, texture) ||
+               (texture->flags & R600_RESOURCE_FLAG_TRANSFER))
+               use_staging_texture = FALSE;
 
        trans = CALLOC_STRUCT(r600_transfer);
        if (trans == NULL)
                return NULL;
        pipe_resource_reference(&trans->transfer.resource, texture);
-       trans->transfer.sr = sr;
+       trans->transfer.level = level;
        trans->transfer.usage = usage;
        trans->transfer.box = *box;
        if (rtex->depth) {
-                /* XXX: only readback the rectangle which is being mapped?
-                 */
-                /* XXX: when discard is true, no need to read back from depth texture
-                 */
+               /* XXX: only readback the rectangle which is being mapped?
+               */
+               /* XXX: when discard is true, no need to read back from depth texture
+               */
                r = r600_texture_depth_flush(ctx, texture);
                if (r < 0) {
                        R600_ERR("failed to create temporary texture to hold untiled copy\n");
@@ -600,6 +590,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
                resource.width0 = box->width;
                resource.height0 = box->height;
                resource.depth0 = 1;
+               resource.array_size = 1;
                resource.last_level = 0;
                resource.nr_samples = 0;
                resource.usage = PIPE_USAGE_STAGING;
@@ -625,7 +616,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
                }
 
                trans->transfer.stride =
-                        ((struct r600_resource_texture *)trans->staging_texture)->pitch_in_bytes[0];
+                       ((struct r600_resource_texture *)trans->staging_texture)->pitch_in_bytes[0];
                if (usage & PIPE_TRANSFER_READ) {
                        r600_copy_to_staging_texture(ctx, trans);
                        /* Always referenced in the blit. */
@@ -633,8 +624,8 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
                }
                return &trans->transfer;
        }
-       trans->transfer.stride = rtex->pitch_in_bytes[sr.level];
-       trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face);
+       trans->transfer.stride = rtex->pitch_in_bytes[level];
+       trans->offset = r600_texture_get_offset(rtex, level, box->z);
        return &trans->transfer;
 }
 
@@ -747,10 +738,10 @@ struct u_resource_vtbl r600_texture_vtbl =
        u_default_transfer_inline_write /* transfer_inline_write */
 };
 
-void r600_init_screen_texture_functions(struct pipe_screen *screen)
+void r600_init_surface_functions(struct r600_pipe_context *r600)
 {
-       screen->get_tex_surface = r600_get_tex_surface;
-       screen->tex_surface_destroy = r600_tex_surface_destroy;
+       r600->context.create_surface = r600_create_surface;
+       r600->context.surface_destroy = r600_surface_destroy;
 }
 
 static unsigned r600_get_swizzle_combined(const unsigned char *swizzle_format,
@@ -851,8 +842,8 @@ uint32_t r600_translate_texformat(enum pipe_format format,
        case UTIL_FORMAT_COLORSPACE_YUV:
                yuv_format |= (1 << 30);
                switch (format) {
-                case PIPE_FORMAT_UYVY:
-                case PIPE_FORMAT_YUYV:
+               case PIPE_FORMAT_UYVY:
+               case PIPE_FORMAT_YUYV:
                default:
                        break;
                }
@@ -870,29 +861,29 @@ uint32_t r600_translate_texformat(enum pipe_format format,
 
        /* S3TC formats. TODO */
        if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-                static int r600_enable_s3tc = -1;
+               static int r600_enable_s3tc = -1;
 
-                if (r600_enable_s3tc == -1)
-                        r600_enable_s3tc = 
-                                debug_get_bool_option("R600_ENABLE_S3TC", FALSE);
+               if (r600_enable_s3tc == -1)
+                       r600_enable_s3tc = 
+                               debug_get_bool_option("R600_ENABLE_S3TC", FALSE);
 
-                if (!r600_enable_s3tc)
-                        goto out_unknown;
+               if (!r600_enable_s3tc)
+                       goto out_unknown;
 
                switch (format) {
                case PIPE_FORMAT_DXT1_RGB:
                case PIPE_FORMAT_DXT1_RGBA:
-                        result = FMT_BC1;
-                        goto out_word4;
+                       result = FMT_BC1;
+                       goto out_word4;
                case PIPE_FORMAT_DXT3_RGBA:
-                        result = FMT_BC2;
-                        goto out_word4;
+                       result = FMT_BC2;
+                       goto out_word4;
                case PIPE_FORMAT_DXT5_RGBA:
-                        result = FMT_BC3;
-                        goto out_word4;
-                default:
-                        goto out_unknown;
-                }
+                       result = FMT_BC3;
+                       goto out_word4;
+               default:
+                       goto out_unknown;
+               }
        }
 
 
index 9a07cf2073f4ba1f2491ba54b72906fe226d3d41..f80fa7af941a3da920785b8a7c0a94479671bdf2 100644 (file)
@@ -41,6 +41,8 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx)
        struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {0}, *out_transfer;
        struct pipe_resource *out_buffer;
        unsigned i, num_verts;
+       struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS];
+       void *tmp;
 
        /* Initialize the translate key, i.e. the recipe how vertices should be
         * translated. */
@@ -51,9 +53,7 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx)
                unsigned output_format_size = ve->hw_format_size[i];
 
                /* Check for support. */
-               if (ve->elements[i].src_format == ve->hw_format[i] &&
-                   (vb->buffer_offset + ve->elements[i].src_offset) % 4 == 0 &&
-                   vb->stride % 4 == 0) {
+               if (ve->elements[i].src_format == ve->hw_format[i]) {
                        continue;
                }
 
@@ -125,12 +125,11 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx)
        /* Unmap all buffers. */
        for (i = 0; i < rctx->nvertex_buffer; i++) {
                if (vb_translated[i]) {
-                       pipe_buffer_unmap(pipe, rctx->vertex_buffer[i].buffer,
-                                         vb_transfer[i]);
+                       pipe_buffer_unmap(pipe, vb_transfer[i]);
                }
        }
 
-       pipe_buffer_unmap(pipe, out_buffer, out_transfer);
+       pipe_buffer_unmap(pipe, out_transfer);
 
        /* Setup the new vertex buffer in the first free slot. */
        for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
@@ -147,29 +146,23 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx)
        }
 
        /* Save and replace vertex elements. */
-       {
-               struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS];
-
-               rctx->tran.saved_velems = rctx->vertex_elements;
-
-               for (i = 0; i < ve->count; i++) {
-                       if (vb_translated[ve->elements[i].vertex_buffer_index]) {
-                               te = &key.element[tr_elem_index[i]];
-                               new_velems[i].instance_divisor = ve->elements[i].instance_divisor;
-                               new_velems[i].src_format = te->output_format;
-                               new_velems[i].src_offset = te->output_offset;
-                               new_velems[i].vertex_buffer_index = rctx->tran.vb_slot;
-                       } else {
-                               memcpy(&new_velems[i], &ve->elements[i],
-                                      sizeof(struct pipe_vertex_element));
-                       }
+       for (i = 0; i < ve->count; i++) {
+               if (vb_translated[ve->elements[i].vertex_buffer_index]) {
+                       te = &key.element[tr_elem_index[i]];
+                       new_velems[i].instance_divisor = ve->elements[i].instance_divisor;
+                       new_velems[i].src_format = te->output_format;
+                       new_velems[i].src_offset = te->output_offset;
+                       new_velems[i].vertex_buffer_index = rctx->tran.vb_slot;
+               } else {
+                       memcpy(&new_velems[i], &ve->elements[i],
+                                       sizeof(struct pipe_vertex_element));
                }
-
-               rctx->tran.new_velems =
-                       pipe->create_vertex_elements_state(pipe, ve->count, new_velems);
-               pipe->bind_vertex_elements_state(pipe, rctx->tran.new_velems);
        }
 
+       tmp = pipe->create_vertex_elements_state(pipe, ve->count, new_velems);
+       pipe->bind_vertex_elements_state(pipe, tmp);
+       rctx->tran.new_velems = tmp;
+
        pipe_resource_reference(&out_buffer, NULL);
 }
 
@@ -177,13 +170,15 @@ void r600_end_vertex_translate(struct r600_pipe_context *rctx)
 {
        struct pipe_context *pipe = &rctx->context;
 
+       if (rctx->tran.new_velems == NULL) {
+               return;
+       }
        /* Restore vertex elements. */
-       pipe->bind_vertex_elements_state(pipe, rctx->tran.saved_velems);
        pipe->delete_vertex_elements_state(pipe, rctx->tran.new_velems);
+       rctx->tran.new_velems = NULL;
 
        /* Delete the now-unused VBO. */
-       pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer,
-                               NULL);
+       pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer, NULL);
 }
 
 void r600_translate_index_buffer(struct r600_pipe_context *r600,
@@ -197,14 +192,7 @@ void r600_translate_index_buffer(struct r600_pipe_context *r600,
                *index_size = 2;
                *start = 0;
                break;
-
        case 2:
-               if (*start % 2 != 0) {
-                       util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count);
-                       *start = 0;
-               }
-               break;
-
        case 4:
                break;
        }
diff --git a/src/gallium/drivers/r600/r600_upload.c b/src/gallium/drivers/r600/r600_upload.c
new file mode 100644 (file)
index 0000000..44102ff
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *      Jerome Glisse <jglisse@redhat.com>
+ */
+#include <errno.h>
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "r600.h"
+#include "r600_pipe.h"
+#include "r600_resource.h"
+
+struct r600_upload {
+       struct r600_pipe_context        *rctx;
+       struct r600_bo                  *buffer;
+       char                            *ptr;
+       unsigned                        size;
+       unsigned                        default_size;
+       unsigned                        total_alloc_size;
+       unsigned                        offset;
+       unsigned                        alignment;
+};
+
+struct r600_upload *r600_upload_create(struct r600_pipe_context *rctx,
+                                       unsigned default_size,
+                                       unsigned alignment)
+{
+       struct r600_upload *upload = CALLOC_STRUCT(r600_upload);
+
+       if (upload == NULL)
+               return NULL;
+
+       upload->rctx = rctx;
+       upload->size = 0;
+       upload->default_size = default_size;
+       upload->alignment = alignment;
+       upload->ptr = NULL;
+       upload->buffer = NULL;
+       upload->total_alloc_size = 0;
+
+       return upload;
+}
+
+void r600_upload_flush(struct r600_upload *upload)
+{
+       if (upload->buffer) {
+               r600_bo_reference(upload->rctx->radeon, &upload->buffer, NULL);
+       }
+       upload->default_size = MAX2(upload->total_alloc_size, upload->default_size);
+       upload->total_alloc_size = 0;
+       upload->size = 0;
+       upload->offset = 0;
+       upload->ptr = NULL;
+       upload->buffer = NULL;
+}
+
+void r600_upload_destroy(struct r600_upload *upload)
+{
+       r600_upload_flush(upload);
+       FREE(upload);
+}
+
+int r600_upload_buffer(struct r600_upload *upload, unsigned offset,
+                       unsigned size, struct r600_resource_buffer *in_buffer,
+                       unsigned *out_offset, unsigned *out_size,
+                       struct r600_bo **out_buffer)
+{
+       unsigned alloc_size = align(size, upload->alignment);
+       const void *in_ptr = NULL;
+
+       if (upload->offset + alloc_size > upload->size) {
+               if (upload->size) {
+                       r600_bo_reference(upload->rctx->radeon, &upload->buffer, NULL);
+               }
+               upload->size = align(MAX2(upload->default_size, alloc_size), 4096);
+               upload->total_alloc_size += upload->size;
+               upload->offset = 0;
+               upload->buffer = r600_bo(upload->rctx->radeon, upload->size, 4096, PIPE_BIND_VERTEX_BUFFER, 0);
+               if (upload->buffer == NULL) {
+                       return -ENOMEM;
+               }
+               upload->ptr = r600_bo_map(upload->rctx->radeon, upload->buffer, 0, NULL);
+       }
+
+       in_ptr = in_buffer->user_buffer;
+       memcpy(upload->ptr + upload->offset, (uint8_t *) in_ptr + offset, size);
+       *out_offset = upload->offset;
+       *out_size = upload->size;
+       *out_buffer = NULL;
+       r600_bo_reference(upload->rctx->radeon, out_buffer, upload->buffer);
+       upload->offset += alloc_size;
+
+       return 0;
+}
index 892dee86baf38c023c6a278971853c728938dc45..a7f2f54736e9f39d25cacfe5b86de421d2e39de5 100644 (file)
@@ -29,8 +29,6 @@
 
 int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id)
 {
-       unsigned i;
-
        bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
                S_SQ_ALU_WORD0_SRC0_REL(alu->src[0].rel) |
                S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) |
@@ -61,18 +59,11 @@ int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id)
                                        S_SQ_ALU_WORD1_OP2_SRC0_ABS(alu->src[0].abs) |
                                        S_SQ_ALU_WORD1_OP2_SRC1_ABS(alu->src[1].abs) |
                                        S_SQ_ALU_WORD1_OP2_WRITE_MASK(alu->dst.write) |
+                                       S_SQ_ALU_WORD1_OP2_OMOD(alu->omod) |
                                        S_SQ_ALU_WORD1_OP2_ALU_INST(alu->inst) |
                                        S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle) |
                                        S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->predicate) |
                                        S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate);
        }
-       if (alu->last) {
-               if (alu->nliteral && !alu->literal_added) {
-                       R600_ERR("Bug in ALU processing for instruction 0x%08x, literal not added correctly\n", alu->inst);
-               }
-               for (i = 0; i < alu->nliteral; i++) {
-                       bc->bytecode[id++] = alu->value[i];
-               }
-       }
        return 0;
 }
index 413da59e559965680febad428dec4dd66e39a859..94e57e40f86d78e7d4110dc5be00cf478897f7ea 100644 (file)
@@ -707,17 +707,13 @@ rbug_set_sample_mask(struct pipe_context *_pipe,
 static void
 rbug_resource_copy_region(struct pipe_context *_pipe,
                           struct pipe_resource *_dst,
-                          struct pipe_subresource subdst,
+                          unsigned dst_level,
                           unsigned dstx,
                           unsigned dsty,
                           unsigned dstz,
                           struct pipe_resource *_src,
-                          struct pipe_subresource subsrc,
-                          unsigned srcx,
-                          unsigned srcy,
-                          unsigned srcz,
-                          unsigned width,
-                          unsigned height)
+                          unsigned src_level,
+                          const struct pipe_box *src_box)
 {
    struct rbug_context *rb_pipe = rbug_context(_pipe);
    struct rbug_resource *rb_resource_dst = rbug_resource(_dst);
@@ -728,17 +724,13 @@ rbug_resource_copy_region(struct pipe_context *_pipe,
 
    pipe->resource_copy_region(pipe,
                               dst,
-                              subdst,
+                              dst_level,
                               dstx,
                               dsty,
                               dstz,
                               src,
-                              subsrc,
-                              srcx,
-                              srcy,
-                              srcz,
-                              width,
-                              height);
+                              src_level,
+                              src_box);
 }
 
 static void
@@ -820,8 +812,8 @@ rbug_flush(struct pipe_context *_pipe,
 static unsigned int
 rbug_is_resource_referenced(struct pipe_context *_pipe,
                             struct pipe_resource *_resource,
-                            unsigned face,
-                            unsigned level)
+                            unsigned level,
+                            int layer)
 {
    struct rbug_context *rb_pipe = rbug_context(_pipe);
    struct rbug_resource *rb_resource = rbug_resource(_resource);
@@ -830,8 +822,8 @@ rbug_is_resource_referenced(struct pipe_context *_pipe,
 
    return pipe->is_resource_referenced(pipe,
                                        resource,
-                                       face,
-                                       level);
+                                       level,
+                                       layer);
 }
 
 static struct pipe_sampler_view *
@@ -862,10 +854,40 @@ rbug_context_sampler_view_destroy(struct pipe_context *_pipe,
                              rbug_sampler_view(_view));
 }
 
+static struct pipe_surface *
+rbug_context_create_surface(struct pipe_context *_pipe,
+                            struct pipe_resource *_resource,
+                            const struct pipe_surface *surf_tmpl)
+{
+   struct rbug_context *rb_pipe = rbug_context(_pipe);
+   struct rbug_resource *rb_resource = rbug_resource(_resource);
+   struct pipe_context *pipe = rb_pipe->pipe;
+   struct pipe_resource *resource = rb_resource->resource;
+   struct pipe_surface *result;
+
+   result = pipe->create_surface(pipe,
+                                 resource,
+                                 surf_tmpl);
+
+   if (result)
+      return rbug_surface_create(rb_pipe, rb_resource, result);
+   return NULL;
+}
+
+static void
+rbug_context_surface_destroy(struct pipe_context *_pipe,
+                             struct pipe_surface *_surface)
+{
+   rbug_surface_destroy(rbug_context(_pipe),
+                        rbug_surface(_surface));
+}
+
+
+
 static struct pipe_transfer *
 rbug_context_get_transfer(struct pipe_context *_context,
                           struct pipe_resource *_resource,
-                          struct pipe_subresource sr,
+                          unsigned level,
                           unsigned usage,
                           const struct pipe_box *box)
 {
@@ -877,7 +899,7 @@ rbug_context_get_transfer(struct pipe_context *_context,
 
    result = context->get_transfer(context,
                                   resource,
-                                  sr,
+                                  level,
                                   usage,
                                   box);
 
@@ -942,12 +964,12 @@ rbug_context_transfer_unmap(struct pipe_context *_context,
 static void
 rbug_context_transfer_inline_write(struct pipe_context *_context,
                                    struct pipe_resource *_resource,
-                                   struct pipe_subresource sr,
+                                   unsigned level,
                                    unsigned usage,
                                    const struct pipe_box *box,
                                    const void *data,
                                    unsigned stride,
-                                   unsigned slice_stride)
+                                   unsigned layer_stride)
 {
    struct rbug_context *rb_pipe = rbug_context(_context);
    struct rbug_resource *rb_resource = rbug_resource(_resource);
@@ -956,12 +978,12 @@ rbug_context_transfer_inline_write(struct pipe_context *_context,
 
    context->transfer_inline_write(context,
                                   resource,
-                                  sr,
+                                  level,
                                   usage,
                                   box,
                                   data,
                                   stride,
-                                  slice_stride);
+                                  layer_stride);
 }
 
 
@@ -1042,6 +1064,8 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    rb_pipe->base.is_resource_referenced = rbug_is_resource_referenced;
    rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view;
    rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy;
+   rb_pipe->base.create_surface = rbug_context_create_surface;
+   rb_pipe->base.surface_destroy = rbug_context_surface_destroy;
    rb_pipe->base.get_transfer = rbug_context_get_transfer;
    rb_pipe->base.transfer_destroy = rbug_context_transfer_destroy;
    rb_pipe->base.transfer_map = rbug_context_transfer_map;
index 9dc663b079a0c6787b2739073aee4f11da354cd5..eb772d19d05ea5184572fbb5f7e76caded29b356 100644 (file)
@@ -266,9 +266,9 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_
 
    tex = tr_tex->resource;
    t = pipe_get_transfer(context, tex,
-                                gptr->face, gptr->level, gptr->zslice,
-                                PIPE_TRANSFER_READ,
-                                gptr->x, gptr->y, gptr->w, gptr->h);
+                         gptr->level, gptr->face + gptr->zslice,
+                         PIPE_TRANSFER_READ,
+                         gptr->x, gptr->y, gptr->w, gptr->h);
 
    map = context->transfer_map(context, t);
 
@@ -279,7 +279,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_
                                 util_format_get_blocksize(t->resource->format),
                                 (uint8_t*)map,
                                 t->stride * util_format_get_nblocksy(t->resource->format,
-                                                                    t->box.height),
+                                                                     t->box.height),
                                 t->stride,
                                 NULL);
 
index 0979fcff957590db2f35f405d56687db4452f31b..7d7cc482ae68b92020116bc10dc82e4e3ad6f038 100644 (file)
@@ -79,7 +79,8 @@ rbug_resource_destroy(struct rbug_resource *rb_resource)
 
 
 struct pipe_surface *
-rbug_surface_create(struct rbug_resource *rb_resource,
+rbug_surface_create(struct rbug_context *rb_context,
+                    struct rbug_resource *rb_resource,
                     struct pipe_surface *surface)
 {
    struct rbug_surface *rb_surface;
@@ -108,10 +109,12 @@ error:
 }
 
 void
-rbug_surface_destroy(struct rbug_surface *rb_surface)
+rbug_surface_destroy(struct rbug_context *rb_context,
+                     struct rbug_surface *rb_surface)
 {
    pipe_resource_reference(&rb_surface->base.texture, NULL);
-   pipe_surface_reference(&rb_surface->surface, NULL);
+   rb_context->pipe->surface_destroy(rb_context->pipe,
+                                     rb_surface->surface);
    FREE(rb_surface);
 }
 
index 49c128d3d1ace5cf416a00c57304d897b21d727a..3fba333422824e6c201e39096b08758ef0c8632f 100644 (file)
@@ -189,11 +189,13 @@ void
 rbug_resource_destroy(struct rbug_resource *rb_resource);
 
 struct pipe_surface *
-rbug_surface_create(struct rbug_resource *rb_resource,
+rbug_surface_create(struct rbug_context *rb_context,
+                    struct rbug_resource *rb_resource,
                     struct pipe_surface *surface);
 
 void
-rbug_surface_destroy(struct rbug_surface *rb_surface);
+rbug_surface_destroy(struct rbug_context *rb_context,
+                     struct rbug_surface *rb_surface);
 
 struct pipe_sampler_view *
 rbug_sampler_view_create(struct rbug_context *rb_context,
index 961df482c29ca4a60af2d3dd63c2fab06b594063..d635ce575c0c1bb43f40089d3e1486480d449a1c 100644 (file)
@@ -188,40 +188,6 @@ rbug_screen_resource_destroy(struct pipe_screen *screen,
    rbug_resource_destroy(rbug_resource(_resource));
 }
 
-static struct pipe_surface *
-rbug_screen_get_tex_surface(struct pipe_screen *_screen,
-                            struct pipe_resource *_resource,
-                            unsigned face,
-                            unsigned level,
-                            unsigned zslice,
-                            unsigned usage)
-{
-   struct rbug_screen *rb_screen = rbug_screen(_screen);
-   struct rbug_resource *rb_resource = rbug_resource(_resource);
-   struct pipe_screen *screen = rb_screen->screen;
-   struct pipe_resource *resource = rb_resource->resource;
-   struct pipe_surface *result;
-
-   result = screen->get_tex_surface(screen,
-                                    resource,
-                                    face,
-                                    level,
-                                    zslice,
-                                    usage);
-
-   if (result)
-      return rbug_surface_create(rb_resource, result);
-   return NULL;
-}
-
-static void
-rbug_screen_tex_surface_destroy(struct pipe_surface *_surface)
-{
-   rbug_surface_destroy(rbug_surface(_surface));
-}
-
-
-
 static struct pipe_resource *
 rbug_screen_user_buffer_create(struct pipe_screen *_screen,
                                void *ptr,
@@ -246,16 +212,18 @@ rbug_screen_user_buffer_create(struct pipe_screen *_screen,
 
 static void
 rbug_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                              struct pipe_surface *_surface,
+                              struct pipe_resource *_resource,
+                              unsigned level, unsigned layer,
                               void *context_private)
 {
    struct rbug_screen *rb_screen = rbug_screen(_screen);
-   struct rbug_surface *rb_surface = rbug_surface(_surface);
+   struct rbug_resource *rb_resource = rbug_resource(_resource);
    struct pipe_screen *screen = rb_screen->screen;
-   struct pipe_surface *surface = rb_surface->surface;
+   struct pipe_resource *resource = rb_resource->resource;
 
    screen->flush_frontbuffer(screen,
-                             surface,
+                             resource,
+                             level, layer,
                              context_private);
 }
 
@@ -336,8 +304,6 @@ rbug_screen_create(struct pipe_screen *screen)
    rb_screen->base.resource_from_handle = rbug_screen_resource_from_handle;
    rb_screen->base.resource_get_handle = rbug_screen_resource_get_handle;
    rb_screen->base.resource_destroy = rbug_screen_resource_destroy;
-   rb_screen->base.get_tex_surface = rbug_screen_get_tex_surface;
-   rb_screen->base.tex_surface_destroy = rbug_screen_tex_surface_destroy;
    rb_screen->base.user_buffer_create = rbug_screen_user_buffer_create;
    rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer;
    rb_screen->base.fence_reference = rbug_screen_fence_reference;
index b5d30bc6fc974b985e4b22ec142d00b4f88de730..f3489c1c793cc8a6410adacc13e2b38b3035ac6a 100644 (file)
@@ -129,6 +129,10 @@ softpipe_destroy( struct pipe_context *pipe )
       }
    }
 
+   for (i = 0; i < softpipe->num_vertex_buffers; i++) {
+      pipe_resource_reference(&softpipe->vertex_buffer[i].buffer, NULL);
+   }
+
    tgsi_exec_machine_destroy(softpipe->fs_machine);
 
    FREE( softpipe );
@@ -145,15 +149,15 @@ softpipe_destroy( struct pipe_context *pipe )
  */
 static unsigned int
 softpipe_is_resource_referenced( struct pipe_context *pipe,
-                               struct pipe_resource *texture,
-                               unsigned face, unsigned level)
+                                 struct pipe_resource *texture,
+                                 unsigned level, int layer)
 {
    struct softpipe_context *softpipe = softpipe_context( pipe );
    unsigned i;
 
    if (texture->target == PIPE_BUFFER)
       return PIPE_UNREFERENCED;
-   
+
    /* check if any of the bound drawing surfaces are this texture */
    if (softpipe->dirty_render_cache) {
       for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
index 9361a3df09e426c7ab7b9020d31321b82100636f..903574b7e19faf4953bed968927637c04081865c 100644 (file)
@@ -154,9 +154,9 @@ struct softpipe_context {
 
    /** TGSI exec things */
    struct {
-      struct sp_sampler_varient *geom_samplers_list[PIPE_MAX_GEOMETRY_SAMPLERS];
-      struct sp_sampler_varient *vert_samplers_list[PIPE_MAX_VERTEX_SAMPLERS];
-      struct sp_sampler_varient *frag_samplers_list[PIPE_MAX_SAMPLERS];
+      struct sp_sampler_variant *geom_samplers_list[PIPE_MAX_GEOMETRY_SAMPLERS];
+      struct sp_sampler_variant *vert_samplers_list[PIPE_MAX_VERTEX_SAMPLERS];
+      struct sp_sampler_variant *frag_samplers_list[PIPE_MAX_SAMPLERS];
    } tgsi;
 
    struct tgsi_exec_machine *fs_machine;
@@ -192,7 +192,7 @@ softpipe_context( struct pipe_context *pipe )
 }
 
 void
-softpipe_reset_sampler_varients(struct softpipe_context *softpipe);
+softpipe_reset_sampler_variants(struct softpipe_context *softpipe);
 
 struct pipe_context *
 softpipe_create_context( struct pipe_screen *, void *priv );
index 1071011db0ef1bff225eea5977a33f33cecef545..4258395063b672612ad8e831226e90a39e74bd77 100644 (file)
@@ -120,8 +120,8 @@ softpipe_flush( struct pipe_context *pipe,
 boolean
 softpipe_flush_resource(struct pipe_context *pipe,
                         struct pipe_resource *texture,
-                        unsigned face,
                         unsigned level,
+                        int layer,
                         unsigned flush_flags,
                         boolean read_only,
                         boolean cpu_access,
@@ -129,7 +129,7 @@ softpipe_flush_resource(struct pipe_context *pipe,
 {
    unsigned referenced;
 
-   referenced = pipe->is_resource_referenced(pipe, texture, face, level);
+   referenced = pipe->is_resource_referenced(pipe, texture, level, layer);
 
    if ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
        ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) {
index cb97482a71b33300c2117ba0efaf3a17f43ae50a..22a5ceeb9ecc4fd7bc6232434bf3348c0e28a77c 100644 (file)
@@ -40,8 +40,8 @@ softpipe_flush(struct pipe_context *pipe, unsigned flags,
 boolean
 softpipe_flush_resource(struct pipe_context *pipe,
                         struct pipe_resource *texture,
-                        unsigned face,
                         unsigned level,
+                        int layer,
                         unsigned flush_flags,
                         boolean read_only,
                         boolean cpu_access,
diff --git a/src/gallium/drivers/softpipe/sp_limits.h b/src/gallium/drivers/softpipe/sp_limits.h
new file mode 100644 (file)
index 0000000..a7a24c9
--- /dev/null
@@ -0,0 +1,42 @@
+/**************************************************************************
+ * 
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE 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.
+ * 
+ **************************************************************************/
+
+#ifndef SP_LIMITS_H
+#define SP_LIMITS_H
+
+
+
+#define SP_MAX_TEXTURE_2D_LEVELS 15  /* 16K x 16K */
+#define SP_MAX_TEXTURE_3D_LEVELS 9   /* 512 x 512 x 512 */
+
+
+/** Max surface size */
+#define MAX_WIDTH (1 << (SP_MAX_TEXTURE_2D_LEVELS - 1))
+#define MAX_HEIGHT (1 << (SP_MAX_TEXTURE_2D_LEVELS - 1))
+
+
+#endif /* SP_LIMITS_H */
index 6af1b2d0618b4882934621f945665b60cb686cfc..76cfc0bf51c904295e54369ce1f00fd303fcf570 100644 (file)
@@ -35,6 +35,7 @@
 #include "util/u_memory.h"
 #include "util/u_format.h"
 #include "sp_context.h"
+#include "sp_state.h"
 #include "sp_quad.h"
 #include "sp_tile_cache.h"
 #include "sp_quad_pipe.h"
@@ -794,6 +795,9 @@ blend_fallback(struct quad_stage *qs,
    struct softpipe_context *softpipe = qs->softpipe;
    const struct pipe_blend_state *blend = softpipe->blend;
    unsigned cbuf;
+   boolean write_all;
+
+   write_all = softpipe->fs->color0_writes_all_cbufs;
 
    for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) 
    {
@@ -806,15 +810,19 @@ blend_fallback(struct quad_stage *qs,
                               quads[0]->input.y0);
       boolean has_dst_alpha
          = util_format_has_alpha(softpipe->framebuffer.cbufs[cbuf]->format);
-      uint q, i, j;
+      uint q, i, j, qbuf;
+
+      qbuf = write_all ? 0 : cbuf;
 
       for (q = 0; q < nr; q++) {
          struct quad_header *quad = quads[q];
-         float (*quadColor)[4] = quad->output.color[cbuf];
+         float (*quadColor)[4];
          const int itx = (quad->input.x0 & (TILE_SIZE-1));
          const int ity = (quad->input.y0 & (TILE_SIZE-1));
 
-         /* get/swizzle dest colors 
+         quadColor = quad->output.color[qbuf];
+
+         /* get/swizzle dest colors
           */
          for (j = 0; j < QUAD_SIZE; j++) {
             int x = itx + (j & 1);
index 9b54babdfb776b2e92b9f6451229d624c3d5a6e5..e19f2e6fc7d0ef41dfd27cd2b20632e8f39d0168 100644 (file)
@@ -268,12 +268,13 @@ softpipe_destroy_screen( struct pipe_screen *screen )
  */
 static void
 softpipe_flush_frontbuffer(struct pipe_screen *_screen,
-                           struct pipe_surface *surface,
+                           struct pipe_resource *resource,
+                           unsigned level, unsigned layer,
                            void *context_private)
 {
    struct softpipe_screen *screen = softpipe_screen(_screen);
    struct sw_winsys *winsys = screen->winsys;
-   struct softpipe_resource *texture = softpipe_resource(surface->texture);
+   struct softpipe_resource *texture = softpipe_resource(resource);
 
    assert(texture->dt);
    if (texture->dt)
index 525bf23734a193e29377d35bc1f82bf80ebeff23..bb19f8cff209a2fbaa25fada4edbd88588f8b887 100644 (file)
@@ -74,7 +74,7 @@ struct sp_fragment_shader {
 
    boolean origin_lower_left; /**< fragment shader uses lower left position origin? */
    boolean pixel_center_integer; /**< fragment shader uses integer pixel center? */
-
+   boolean color0_writes_all_cbufs; /**< fragment shader writes color0 to all bound cbufs */
    void (*prepare)( const struct sp_fragment_shader *shader,
                    struct tgsi_exec_machine *machine,
                    struct tgsi_sampler **samplers);
index 3ba4d934fd243538eed4b4e3c329128c327ad60e..bf4c12701afc57240ade28065101bea2fe595736 100644 (file)
@@ -197,7 +197,7 @@ update_tgsi_samplers( struct softpipe_context *softpipe )
 {
    unsigned i;
 
-   softpipe_reset_sampler_varients( softpipe );
+   softpipe_reset_sampler_variants( softpipe );
 
    for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
       struct softpipe_tex_tile_cache *tc = softpipe->tex_cache[i];
index b59fbc33ed67134c21c13e381e182934d27102a3..cfa211b60a0739d070cf9ea1a46422acd929d351 100644 (file)
@@ -43,8 +43,8 @@
 
 struct sp_sampler {
    struct pipe_sampler_state base;
-   struct sp_sampler_varient *varients;
-   struct sp_sampler_varient *current;
+   struct sp_sampler_variant *variants;
+   struct sp_sampler_variant *current;
 };
 
 static struct sp_sampler *sp_sampler( struct pipe_sampler_state *sampler )
@@ -60,7 +60,7 @@ softpipe_create_sampler_state(struct pipe_context *pipe,
    struct sp_sampler *sp_sampler = CALLOC_STRUCT(sp_sampler);
 
    sp_sampler->base = *sampler;
-   sp_sampler->varients = NULL;
+   sp_sampler->variants = NULL;
 
    return (void *)sp_sampler;
 }
@@ -277,23 +277,24 @@ softpipe_set_geometry_sampler_views(struct pipe_context *pipe,
 
 
 /**
- * Find/create an sp_sampler_varient object for sampling the given texture,
+ * Find/create an sp_sampler_variant object for sampling the given texture,
  * sampler and tex unit.
  *
  * Note that the tex unit is significant.  We can't re-use a sampler
- * varient for multiple texture units because the sampler varient contains
+ * variant for multiple texture units because the sampler variant contains
  * the texture object pointer.  If the texture object pointer were stored
- * somewhere outside the sampler varient, we could re-use samplers for
+ * somewhere outside the sampler variant, we could re-use samplers for
  * multiple texture units.
  */
-static struct sp_sampler_varient *
-get_sampler_varient( unsigned unit,
+static struct sp_sampler_variant *
+get_sampler_variant( unsigned unit,
                      struct sp_sampler *sampler,
+                     struct pipe_sampler_view *view,
                      struct pipe_resource *resource,
                      unsigned processor )
 {
    struct softpipe_resource *sp_texture = softpipe_resource(resource);
-   struct sp_sampler_varient *v = NULL;
+   struct sp_sampler_variant *v = NULL;
    union sp_sampler_key key;
 
    /* if this fails, widen the key.unit field and update this assertion */
@@ -303,6 +304,10 @@ get_sampler_varient( unsigned unit,
    key.bits.is_pot = sp_texture->pot;
    key.bits.processor = processor;
    key.bits.unit = unit;
+   key.bits.swizzle_r = view->swizzle_r;
+   key.bits.swizzle_g = view->swizzle_g;
+   key.bits.swizzle_b = view->swizzle_b;
+   key.bits.swizzle_a = view->swizzle_a;
    key.bits.pad = 0;
 
    if (sampler->current && 
@@ -311,14 +316,14 @@ get_sampler_varient( unsigned unit,
    }
 
    if (v == NULL) {
-      for (v = sampler->varients; v; v = v->next)
+      for (v = sampler->variants; v; v = v->next)
          if (v->key.value == key.value)
             break;
 
       if (v == NULL) {
-         v = sp_create_sampler_varient( &sampler->base, key );
-         v->next = sampler->varients;
-         sampler->varients = v;
+         v = sp_create_sampler_variant( &sampler->base, key );
+         v->next = sampler->variants;
+         sampler->variants = v;
       }
    }
    
@@ -328,7 +333,7 @@ get_sampler_varient( unsigned unit,
 
 
 void
-softpipe_reset_sampler_varients(struct softpipe_context *softpipe)
+softpipe_reset_sampler_variants(struct softpipe_context *softpipe)
 {
    int i;
 
@@ -345,12 +350,13 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe)
          }
 
          softpipe->tgsi.vert_samplers_list[i] = 
-            get_sampler_varient( i,
+            get_sampler_variant( i,
                                  sp_sampler(softpipe->vertex_samplers[i]),
+                                 softpipe->vertex_sampler_views[i],
                                  texture,
                                  TGSI_PROCESSOR_VERTEX );
 
-         sp_sampler_varient_bind_texture( softpipe->tgsi.vert_samplers_list[i], 
+         sp_sampler_variant_bind_texture( softpipe->tgsi.vert_samplers_list[i], 
                                           softpipe->vertex_tex_cache[i],
                                           texture );
       }
@@ -366,13 +372,14 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe)
             }
 
             softpipe->tgsi.geom_samplers_list[i] =
-               get_sampler_varient(
+               get_sampler_variant(
                   i,
                   sp_sampler(softpipe->geometry_samplers[i]),
+                  softpipe->geometry_sampler_views[i],
                   texture,
                   TGSI_PROCESSOR_GEOMETRY );
 
-            sp_sampler_varient_bind_texture(
+            sp_sampler_variant_bind_texture(
                softpipe->tgsi.geom_samplers_list[i],
                softpipe->geometry_tex_cache[i],
                texture );
@@ -389,12 +396,13 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe)
          }
 
          softpipe->tgsi.frag_samplers_list[i] =
-            get_sampler_varient( i,
+            get_sampler_variant( i,
                                  sp_sampler(softpipe->sampler[i]),
+                                 softpipe->sampler_views[i],
                                  texture,
                                  TGSI_PROCESSOR_FRAGMENT );
 
-         sp_sampler_varient_bind_texture( softpipe->tgsi.frag_samplers_list[i], 
+         sp_sampler_variant_bind_texture( softpipe->tgsi.frag_samplers_list[i], 
                                           softpipe->tex_cache[i],
                                           texture );
       }
@@ -406,11 +414,11 @@ softpipe_delete_sampler_state(struct pipe_context *pipe,
                               void *sampler)
 {
    struct sp_sampler *sp_sampler = (struct sp_sampler *)sampler;
-   struct sp_sampler_varient *v, *tmp;
+   struct sp_sampler_variant *v, *tmp;
 
-   for (v = sp_sampler->varients; v; v = tmp) {
+   for (v = sp_sampler->variants; v; v = tmp) {
       tmp = v->next;
-      sp_sampler_varient_destroy(v);
+      sp_sampler_variant_destroy(v);
    }
 
    FREE( sampler );
index 7fff338cceada61e92e0368df88ab27713f43214..66ddc565722119dc12dc05d0ebe90fe708cf9e17 100644 (file)
@@ -78,6 +78,8 @@ softpipe_create_fs_state(struct pipe_context *pipe,
          state->origin_lower_left = state->info.properties[i].data[0];
       else if (state->info.properties[i].name == TGSI_PROPERTY_FS_COORD_PIXEL_CENTER)
         state->pixel_center_integer = state->info.properties[i].data[0];
+      else if (state->info.properties[i].name == TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS)
+        state->color0_writes_all_cbufs = state->info.properties[i].data[0];
    }
 
    return state;
index 7d8055f2bafd6ecc8984817be949fb3cb4eb8d1d..5f4d661abde74ed6cb0297ed69caacf4fe7bcda0 100644 (file)
@@ -33,6 +33,7 @@
 #include "sp_state.h"
 
 #include "util/u_memory.h"
+#include "util/u_inlines.h"
 #include "draw/draw_context.h"
 
 
@@ -84,8 +85,9 @@ softpipe_set_vertex_buffers(struct pipe_context *pipe,
 
    assert(count <= PIPE_MAX_ATTRIBS);
 
-   memcpy(softpipe->vertex_buffer, buffers, count * sizeof(buffers[0]));
-   softpipe->num_vertex_buffers = count;
+   util_copy_vertex_buffers(softpipe->vertex_buffer,
+                            &softpipe->num_vertex_buffers,
+                            buffers, count);
 
    softpipe->dirty |= SP_NEW_VERTEX;
 
index 2eac4c7a82b73643ca93fba6acaa16c342325bff..cbc40d4b44683ce5f6796426110429e2f7653143 100644 (file)
@@ -545,7 +545,7 @@ wrap_linear_unorm_clamp_to_edge(const float s[4], unsigned size,
  * derivatives w.r.t X and Y, then compute lambda (level of detail).
  */
 static float
-compute_lambda_1d(const struct sp_sampler_varient *samp,
+compute_lambda_1d(const struct sp_sampler_variant *samp,
                   const float s[QUAD_SIZE],
                   const float t[QUAD_SIZE],
                   const float p[QUAD_SIZE])
@@ -560,7 +560,7 @@ compute_lambda_1d(const struct sp_sampler_varient *samp,
 
 
 static float
-compute_lambda_2d(const struct sp_sampler_varient *samp,
+compute_lambda_2d(const struct sp_sampler_variant *samp,
                   const float s[QUAD_SIZE],
                   const float t[QUAD_SIZE],
                   const float p[QUAD_SIZE])
@@ -579,7 +579,7 @@ compute_lambda_2d(const struct sp_sampler_varient *samp,
 
 
 static float
-compute_lambda_3d(const struct sp_sampler_varient *samp,
+compute_lambda_3d(const struct sp_sampler_variant *samp,
                   const float s[QUAD_SIZE],
                   const float t[QUAD_SIZE],
                   const float p[QUAD_SIZE])
@@ -608,7 +608,7 @@ compute_lambda_3d(const struct sp_sampler_varient *samp,
  * Since there aren't derivatives to use, just return 0.
  */
 static float
-compute_lambda_vert(const struct sp_sampler_varient *samp,
+compute_lambda_vert(const struct sp_sampler_variant *samp,
                     const float s[QUAD_SIZE],
                     const float t[QUAD_SIZE],
                     const float p[QUAD_SIZE])
@@ -634,7 +634,7 @@ compute_lambda_vert(const struct sp_sampler_varient *samp,
 
 
 static INLINE const float *
-get_texel_2d_no_border(const struct sp_sampler_varient *samp,
+get_texel_2d_no_border(const struct sp_sampler_variant *samp,
                       union tex_tile_address addr, int x, int y)
 {
    const struct softpipe_tex_cached_tile *tile;
@@ -651,7 +651,7 @@ get_texel_2d_no_border(const struct sp_sampler_varient *samp,
 
 
 static INLINE const float *
-get_texel_2d(const struct sp_sampler_varient *samp,
+get_texel_2d(const struct sp_sampler_variant *samp,
             union tex_tile_address addr, int x, int y)
 {
    const struct pipe_resource *texture = samp->texture;
@@ -659,8 +659,7 @@ get_texel_2d(const struct sp_sampler_varient *samp,
 
    if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
        y < 0 || y >= (int) u_minify(texture->height0, level)) {
-      return sp_tex_tile_cache_border_color(samp->cache,
-                                            samp->sampler->border_color);
+      return samp->sampler->border_color;
    }
    else {
       return get_texel_2d_no_border( samp, addr, x, y );
@@ -671,7 +670,7 @@ get_texel_2d(const struct sp_sampler_varient *samp,
 /* Gather a quad of adjacent texels within a tile:
  */
 static INLINE void
-get_texel_quad_2d_no_border_single_tile(const struct sp_sampler_varient *samp,
+get_texel_quad_2d_no_border_single_tile(const struct sp_sampler_variant *samp,
                                        union tex_tile_address addr, 
                                        unsigned x, unsigned y, 
                                        const float *out[4])
@@ -695,7 +694,7 @@ get_texel_quad_2d_no_border_single_tile(const struct sp_sampler_varient *samp,
 /* Gather a quad of potentially non-adjacent texels:
  */
 static INLINE void
-get_texel_quad_2d_no_border(const struct sp_sampler_varient *samp,
+get_texel_quad_2d_no_border(const struct sp_sampler_variant *samp,
                            union tex_tile_address addr,
                            int x0, int y0, 
                            int x1, int y1,
@@ -710,7 +709,7 @@ get_texel_quad_2d_no_border(const struct sp_sampler_varient *samp,
 /* Can involve a lot of unnecessary checks for border color:
  */
 static INLINE void
-get_texel_quad_2d(const struct sp_sampler_varient *samp,
+get_texel_quad_2d(const struct sp_sampler_variant *samp,
                  union tex_tile_address addr,
                  int x0, int y0, 
                  int x1, int y1,
@@ -724,10 +723,10 @@ get_texel_quad_2d(const struct sp_sampler_varient *samp,
 
 
 
-/* 3d varients:
+/* 3d variants:
  */
 static INLINE const float *
-get_texel_3d_no_border(const struct sp_sampler_varient *samp,
+get_texel_3d_no_border(const struct sp_sampler_variant *samp,
                        union tex_tile_address addr, int x, int y, int z)
 {
    const struct softpipe_tex_cached_tile *tile;
@@ -745,7 +744,7 @@ get_texel_3d_no_border(const struct sp_sampler_varient *samp,
 
 
 static INLINE const float *
-get_texel_3d(const struct sp_sampler_varient *samp,
+get_texel_3d(const struct sp_sampler_variant *samp,
             union tex_tile_address addr, int x, int y, int z)
 {
    const struct pipe_resource *texture = samp->texture;
@@ -754,8 +753,7 @@ get_texel_3d(const struct sp_sampler_varient *samp,
    if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
        y < 0 || y >= (int) u_minify(texture->height0, level) ||
        z < 0 || z >= (int) u_minify(texture->depth0, level)) {
-      return sp_tex_tile_cache_border_color(samp->cache,
-                                            samp->sampler->border_color);
+      return samp->sampler->border_color;
    }
    else {
       return get_texel_3d_no_border( samp, addr, x, y, z );
@@ -800,7 +798,7 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler,
                                 enum tgsi_sampler_control control,
                                 float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned  j;
    unsigned level = samp->level;
    unsigned xpot = pot_level_size(samp->xpot, level);
@@ -863,7 +861,7 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler,
                                  enum tgsi_sampler_control control,
                                  float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned  j;
    unsigned level = samp->level;
    unsigned xpot = pot_level_size(samp->xpot, level);
@@ -907,7 +905,7 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler,
                                 enum tgsi_sampler_control control,
                                 float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned  j;
    unsigned level = samp->level;
    unsigned xpot = pot_level_size(samp->xpot, level);
@@ -960,7 +958,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
                         enum tgsi_sampler_control control,
                         float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    unsigned level0, j;
    int width;
@@ -1000,7 +998,7 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler,
                       enum tgsi_sampler_control control,
                       float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    unsigned level0, j;
    int width, height;
@@ -1052,7 +1050,7 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
                         enum tgsi_sampler_control control,
                         float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    const unsigned *faces = samp->faces; /* zero when not cube-mapping */
    unsigned level0, j;
@@ -1096,7 +1094,7 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler,
                       enum tgsi_sampler_control control,
                       float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    unsigned level0, j;
    int width, height, depth;
@@ -1138,7 +1136,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler,
                      enum tgsi_sampler_control control,
                      float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    unsigned level0, j;
    int width;
@@ -1178,7 +1176,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler,
                      enum tgsi_sampler_control control,
                      float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    unsigned level0, j;
    int width, height;
@@ -1225,7 +1223,7 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
                        enum tgsi_sampler_control control,
                        float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    const unsigned *faces = samp->faces; /* zero when not cube-mapping */
    unsigned level0, j;
@@ -1274,7 +1272,7 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler,
                      enum tgsi_sampler_control control,
                      float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    unsigned level0, j;
    int width, height, depth;
@@ -1350,7 +1348,7 @@ mip_filter_linear(struct tgsi_sampler *tgsi_sampler,
                   enum tgsi_sampler_control control,
                   float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    int level0;
    float lambda;
@@ -1417,7 +1415,7 @@ mip_filter_nearest(struct tgsi_sampler *tgsi_sampler,
                    enum tgsi_sampler_control control,
                    float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    float lambda;
    float lod[QUAD_SIZE];
@@ -1460,7 +1458,7 @@ mip_filter_none(struct tgsi_sampler *tgsi_sampler,
                 enum tgsi_sampler_control control,
                 float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    float lambda;
    float lod[QUAD_SIZE];
 
@@ -1501,7 +1499,7 @@ mip_filter_linear_2d_linear_repeat_POT(
    enum tgsi_sampler_control control,
    float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_resource *texture = samp->texture;
    int level0;
    float lambda;
@@ -1569,7 +1567,7 @@ sample_compare(struct tgsi_sampler *tgsi_sampler,
                enum tgsi_sampler_control control,
                float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    const struct pipe_sampler_state *sampler = samp->sampler;
    int j, k0, k1, k2, k3;
    float val;
@@ -1656,7 +1654,7 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
             enum tgsi_sampler_control control,
             float rgba[NUM_CHANNELS][QUAD_SIZE])
 {
-   struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
+   struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
    unsigned j;
    float ssss[4], tttt[4];
 
@@ -1731,6 +1729,86 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
 }
 
 
+static void
+sample_swizzle(struct tgsi_sampler *tgsi_sampler,
+               const float s[QUAD_SIZE],
+               const float t[QUAD_SIZE],
+               const float p[QUAD_SIZE],
+               const float c0[QUAD_SIZE],
+               enum tgsi_sampler_control control,
+               float rgba[NUM_CHANNELS][QUAD_SIZE])
+{
+   struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
+   float rgba_temp[NUM_CHANNELS][QUAD_SIZE];
+   const unsigned swizzle_r = samp->key.bits.swizzle_r;
+   const unsigned swizzle_g = samp->key.bits.swizzle_g;
+   const unsigned swizzle_b = samp->key.bits.swizzle_b;
+   const unsigned swizzle_a = samp->key.bits.swizzle_a;
+   unsigned j;
+
+   samp->sample_target(tgsi_sampler, s, t, p, c0, control, rgba_temp);
+
+   switch (swizzle_r) {
+   case PIPE_SWIZZLE_ZERO:
+      for (j = 0; j < 4; j++)
+         rgba[0][j] = 0.0f;
+      break;
+   case PIPE_SWIZZLE_ONE:
+      for (j = 0; j < 4; j++)
+         rgba[0][j] = 1.0f;
+      break;
+   default:
+      assert(swizzle_r < 4);
+      for (j = 0; j < 4; j++)
+         rgba[0][j] = rgba_temp[swizzle_r][j];
+   }
+
+   switch (swizzle_g) {
+   case PIPE_SWIZZLE_ZERO:
+      for (j = 0; j < 4; j++)
+         rgba[1][j] = 0.0f;
+      break;
+   case PIPE_SWIZZLE_ONE:
+      for (j = 0; j < 4; j++)
+         rgba[1][j] = 1.0f;
+      break;
+   default:
+      assert(swizzle_g < 4);
+      for (j = 0; j < 4; j++)
+         rgba[1][j] = rgba_temp[swizzle_g][j];
+   }
+
+   switch (swizzle_b) {
+   case PIPE_SWIZZLE_ZERO:
+      for (j = 0; j < 4; j++)
+         rgba[2][j] = 0.0f;
+      break;
+   case PIPE_SWIZZLE_ONE:
+      for (j = 0; j < 4; j++)
+         rgba[2][j] = 1.0f;
+      break;
+   default:
+      assert(swizzle_b < 4);
+      for (j = 0; j < 4; j++)
+         rgba[2][j] = rgba_temp[swizzle_b][j];
+   }
+
+   switch (swizzle_a) {
+   case PIPE_SWIZZLE_ZERO:
+      for (j = 0; j < 4; j++)
+         rgba[3][j] = 0.0f;
+      break;
+   case PIPE_SWIZZLE_ONE:
+      for (j = 0; j < 4; j++)
+         rgba[3][j] = 1.0f;
+      break;
+   default:
+      assert(swizzle_a < 4);
+      for (j = 0; j < 4; j++)
+         rgba[3][j] = rgba_temp[swizzle_a][j];
+   }
+}
+
 
 static wrap_nearest_func
 get_nearest_unorm_wrap(unsigned mode)
@@ -1909,10 +1987,10 @@ get_img_filter(const union sp_sampler_key key,
 
 
 /**
- * Bind the given texture object and texture cache to the sampler varient.
+ * Bind the given texture object and texture cache to the sampler variant.
  */
 void
-sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp,
+sp_sampler_variant_bind_texture( struct sp_sampler_variant *samp,
                                  struct softpipe_tex_tile_cache *tex_cache,
                                  const struct pipe_resource *texture )
 {
@@ -1927,20 +2005,20 @@ sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp,
 
 
 void
-sp_sampler_varient_destroy( struct sp_sampler_varient *samp )
+sp_sampler_variant_destroy( struct sp_sampler_variant *samp )
 {
    FREE(samp);
 }
 
 
 /**
- * Create a sampler varient for a given set of non-orthogonal state.
+ * Create a sampler variant for a given set of non-orthogonal state.
  */
-struct sp_sampler_varient *
-sp_create_sampler_varient( const struct pipe_sampler_state *sampler,
+struct sp_sampler_variant *
+sp_create_sampler_variant( const struct pipe_sampler_state *sampler,
                            const union sp_sampler_key key )
 {
-   struct sp_sampler_varient *samp = CALLOC_STRUCT(sp_sampler_varient);
+   struct sp_sampler_variant *samp = CALLOC_STRUCT(sp_sampler_variant);
    if (!samp)
       return NULL;
 
@@ -2015,7 +2093,7 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler,
    }
    
    if (key.bits.target == PIPE_TEXTURE_CUBE) {
-      samp->base.get_samples = sample_cube;
+      samp->sample_target = sample_cube;
    }
    else {
       samp->faces[0] = 0;
@@ -2026,7 +2104,17 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler,
       /* Skip cube face determination by promoting the compare
        * function pointer:
        */
-      samp->base.get_samples = samp->compare;
+      samp->sample_target = samp->compare;
+   }
+
+   if (key.bits.swizzle_r != PIPE_SWIZZLE_RED ||
+       key.bits.swizzle_g != PIPE_SWIZZLE_GREEN ||
+       key.bits.swizzle_b != PIPE_SWIZZLE_BLUE ||
+       key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA) {
+      samp->base.get_samples = sample_swizzle;
+   }
+   else {
+      samp->base.get_samples = samp->sample_target;
    }
 
    return samp;
index 6114acf73717d0d35a1122aead3f706a47645ee9..ed99006ab02ea17bd5429be5e72d23c8229f77b9 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "tgsi/tgsi_exec.h"
 
-struct sp_sampler_varient;
+struct sp_sampler_variant;
 
 typedef void (*wrap_nearest_func)(const float s[4],
                                   unsigned size,
@@ -44,7 +44,7 @@ typedef void (*wrap_linear_func)(const float s[4],
                                  int icoord1[4],
                                  float w[4]);
 
-typedef float (*compute_lambda_func)(const struct sp_sampler_varient *sampler,
+typedef float (*compute_lambda_func)(const struct sp_sampler_variant *sampler,
                                      const float s[QUAD_SIZE],
                                      const float t[QUAD_SIZE],
                                      const float p[QUAD_SIZE]);
@@ -64,7 +64,11 @@ union sp_sampler_key {
       unsigned is_pot:1;
       unsigned processor:2;
       unsigned unit:4;
-      unsigned pad:22;
+      unsigned swizzle_r:3;
+      unsigned swizzle_g:3;
+      unsigned swizzle_b:3;
+      unsigned swizzle_a:3;
+      unsigned pad:10;
    } bits;
    unsigned value;
 };
@@ -72,7 +76,7 @@ union sp_sampler_key {
 /**
  * Subclass of tgsi_sampler
  */
-struct sp_sampler_varient
+struct sp_sampler_variant
 {
    struct tgsi_sampler base;  /**< base class */
 
@@ -113,32 +117,33 @@ struct sp_sampler_varient
 
    filter_func mip_filter;
    filter_func compare;
+   filter_func sample_target;
    
    /* Linked list:
     */
-   struct sp_sampler_varient *next;
+   struct sp_sampler_variant *next;
 };
 
 struct sp_sampler;
 
-/* Create a sampler varient for a given set of non-orthogonal state.  Currently the 
+/* Create a sampler variant for a given set of non-orthogonal state.  Currently the 
  */
-struct sp_sampler_varient *
-sp_create_sampler_varient( const struct pipe_sampler_state *sampler,
+struct sp_sampler_variant *
+sp_create_sampler_variant( const struct pipe_sampler_state *sampler,
                            const union sp_sampler_key key );
 
-void sp_sampler_varient_bind_texture( struct sp_sampler_varient *varient,
+void sp_sampler_variant_bind_texture( struct sp_sampler_variant *variant,
                                       struct softpipe_tex_tile_cache *tex_cache,
                                       const struct pipe_resource *tex );
 
-void sp_sampler_varient_destroy( struct sp_sampler_varient * );
+void sp_sampler_variant_destroy( struct sp_sampler_variant * );
 
 
 
-static INLINE struct sp_sampler_varient *
-sp_sampler_varient(const struct tgsi_sampler *sampler)
+static INLINE struct sp_sampler_variant *
+sp_sampler_variant(const struct tgsi_sampler *sampler)
 {
-   return (struct sp_sampler_varient *) sampler;
+   return (struct sp_sampler_variant *) sampler;
 }
 
 extern void
index e817c0c8cf5c97deeef47023cbde87f10e786836..e42015ad498099e0a5674081d368da7c28d28231 100644 (file)
@@ -48,6 +48,9 @@ sp_create_tex_tile_cache( struct pipe_context *pipe )
    struct softpipe_tex_tile_cache *tc;
    uint pos;
 
+   /* make sure max texture size works */
+   assert((TILE_SIZE << TEX_ADDR_BITS) >= (1 << (SP_MAX_TEXTURE_2D_LEVELS-1)));
+
    tc = CALLOC_STRUCT( softpipe_tex_tile_cache );
    if (tc) {
       tc->pipe = pipe;
@@ -260,15 +263,14 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
          }
 
          tc->tex_trans = 
-            pipe_get_transfer(tc->pipe, tc->texture, 
-                             addr.bits.face, 
-                             addr.bits.level, 
-                             addr.bits.z, 
-                             PIPE_TRANSFER_READ | PIPE_TRANSFER_UNSYNCHRONIZED,
-                             0, 0,
-                             u_minify(tc->texture->width0, addr.bits.level),
-                             u_minify(tc->texture->height0, addr.bits.level));
-         
+            pipe_get_transfer(tc->pipe, tc->texture,
+                              addr.bits.level,
+                              addr.bits.face + addr.bits.z,
+                              PIPE_TRANSFER_READ | PIPE_TRANSFER_UNSYNCHRONIZED,
+                              0, 0,
+                              u_minify(tc->texture->width0, addr.bits.level),
+                              u_minify(tc->texture->height0, addr.bits.level));
+
          tc->tex_trans_map = tc->pipe->transfer_map(tc->pipe, tc->tex_trans);
 
          tc->tex_face = addr.bits.face;
@@ -276,45 +278,26 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
          tc->tex_z = addr.bits.z;
       }
 
-      /* get tile from the transfer (view into texture) */
+      /* get tile from the transfer (view into texture)
+       * Note we're using the swizzle version of this fuction only because
+       * we need to pass the texture cache's format explicitly.
+       */
       pipe_get_tile_swizzle(tc->pipe,
                            tc->tex_trans,
                             addr.bits.x * TILE_SIZE, 
                             addr.bits.y * TILE_SIZE,
                             TILE_SIZE,
                             TILE_SIZE,
-                            tc->swizzle_r,
-                            tc->swizzle_g,
-                            tc->swizzle_b,
-                            tc->swizzle_a,
+                            PIPE_SWIZZLE_RED,
+                            PIPE_SWIZZLE_GREEN,
+                            PIPE_SWIZZLE_BLUE,
+                            PIPE_SWIZZLE_ALPHA,
                             tc->format,
                             (float *) tile->data.color);
+
       tile->addr = addr;
    }
 
    tc->last_tile = tile;
    return tile;
 }
-
-
-
-/**
- * Return the swizzled border color.
- */
-const float *
-sp_tex_tile_cache_border_color(struct softpipe_tex_tile_cache *tc,
-                               const float border_color[4])
-{
-   float rgba01[6];
-
-   COPY_4V(rgba01, border_color);
-   rgba01[PIPE_SWIZZLE_ZERO] = 0.0f;
-   rgba01[PIPE_SWIZZLE_ONE] = 1.0f;
-
-   tc->swz_border_color[0] = rgba01[tc->swizzle_r];
-   tc->swz_border_color[1] = rgba01[tc->swizzle_g];
-   tc->swz_border_color[2] = rgba01[tc->swizzle_b];
-   tc->swz_border_color[3] = rgba01[tc->swizzle_a];
-
-   return tc->swz_border_color;
-}
index 05f25133daaaae5e282acddb3dc0409100b0c9f7..2220955b715cb12a39151ac00ef8aa708f3e84a3 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #include "pipe/p_compiler.h"
+#include "sp_limits.h"
 
 
 struct softpipe_context;
@@ -39,22 +40,26 @@ struct softpipe_tex_tile_cache;
 /**
  * Cache tile size (width and height). This needs to be a power of two.
  */
-#define TILE_SIZE 64
+#define TILE_SIZE_LOG2 6
+#define TILE_SIZE (1 << TILE_SIZE_LOG2)
 
 
-/* If we need to support > 4096, just expand this to be a 64 bit
- * union, or consider tiling in Z as well.
+#define TEX_ADDR_BITS (SP_MAX_TEXTURE_2D_LEVELS - 1 - TILE_SIZE_LOG2)
+#define TEX_Z_BITS (SP_MAX_TEXTURE_2D_LEVELS - 1)
+
+/**
+ * Texture tile address as a union for fast compares.
  */
 union tex_tile_address {
    struct {
-      unsigned x:6;             /* 4096 / TILE_SIZE */
-      unsigned y:6;             /* 4096 / TILE_SIZE */
-      unsigned z:12;            /* 4096 -- z not tiled */
+      unsigned x:TEX_ADDR_BITS;  /* 16K / TILE_SIZE */
+      unsigned y:TEX_ADDR_BITS;  /* 16K / TILE_SIZE */
+      unsigned z:TEX_Z_BITS;     /* 16K -- z not tiled */
       unsigned face:3;
       unsigned level:4;
       unsigned invalid:1;
    } bits;
-   unsigned value;
+   uint64_t value;
 };
 
 
@@ -90,8 +95,6 @@ struct softpipe_tex_tile_cache
    unsigned format;
 
    struct softpipe_tex_cached_tile *last_tile;  /**< most recently retrieved tile */
-
-   float swz_border_color[4]; /**< swizzled border color */
 };
 
 
@@ -126,10 +129,10 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
 
 static INLINE union tex_tile_address
 tex_tile_address( unsigned x,
-                 unsigned y,
-                 unsigned z,
-                 unsigned face,
-                 unsigned level )
+                  unsigned y,
+                  unsigned z,
+                  unsigned face,
+                  unsigned level )
 {
    union tex_tile_address addr;
 
@@ -139,7 +142,7 @@ tex_tile_address( unsigned x,
    addr.bits.z = z;
    addr.bits.face = face;
    addr.bits.level = level;
-      
+
    return addr;
 }
 
@@ -156,10 +159,5 @@ sp_get_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
 }
 
 
-const float *
-sp_tex_tile_cache_border_color(struct softpipe_tex_tile_cache *tc,
-                               const float border_color[4]);
-
-
 #endif /* SP_TEX_TILE_CACHE_H */
 
index 4e6123fbd07834303e2cc9ed07265f0c45c2b37f..509d9982b17b9504a413f5c9553e5f155181dca4 100644 (file)
@@ -220,23 +220,18 @@ softpipe_resource_get_handle(struct pipe_screen *screen,
  */
 static unsigned
 sp_get_tex_image_offset(const struct softpipe_resource *spr,
-                        unsigned level, unsigned face, unsigned zslice)
+                        unsigned level, unsigned layer)
 {
    const unsigned hgt = u_minify(spr->base.height0, level);
    const unsigned nblocksy = util_format_get_nblocksy(spr->base.format, hgt);
    unsigned offset = spr->level_offset[level];
 
-   if (spr->base.target == PIPE_TEXTURE_CUBE) {
-      assert(zslice == 0);
-      offset += face * nblocksy * spr->stride[level];
-   }
-   else if (spr->base.target == PIPE_TEXTURE_3D) {
-      assert(face == 0);
-      offset += zslice * nblocksy * spr->stride[level];
+   if (spr->base.target == PIPE_TEXTURE_CUBE ||
+       spr->base.target == PIPE_TEXTURE_3D) {
+      offset += layer * nblocksy * spr->stride[level];
    }
    else {
-      assert(face == 0);
-      assert(zslice == 0);
+      assert(layer == 0);
    }
 
    return offset;
@@ -247,39 +242,40 @@ sp_get_tex_image_offset(const struct softpipe_resource *spr,
  * Get a pipe_surface "view" into a texture resource.
  */
 static struct pipe_surface *
-softpipe_get_tex_surface(struct pipe_screen *screen,
-                         struct pipe_resource *pt,
-                         unsigned face, unsigned level, unsigned zslice,
-                         unsigned usage)
+softpipe_create_surface(struct pipe_context *pipe,
+                        struct pipe_resource *pt,
+                        const struct pipe_surface *surf_tmpl)
 {
-   struct softpipe_resource *spr = softpipe_resource(pt);
    struct pipe_surface *ps;
+   unsigned level = surf_tmpl->u.tex.level;
 
    assert(level <= pt->last_level);
+   assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
 
    ps = CALLOC_STRUCT(pipe_surface);
    if (ps) {
       pipe_reference_init(&ps->reference, 1);
       pipe_resource_reference(&ps->texture, pt);
-      ps->format = pt->format;
+      ps->context = pipe;
+      ps->format = surf_tmpl->format;
       ps->width = u_minify(pt->width0, level);
       ps->height = u_minify(pt->height0, level);
-      ps->offset = sp_get_tex_image_offset(spr, level, face, zslice);
-      ps->usage = usage;
+      ps->usage = surf_tmpl->usage;
 
-      ps->face = face;
-      ps->level = level;
-      ps->zslice = zslice;
+      ps->u.tex.level = level;
+      ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+      ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
    }
    return ps;
 }
 
 
 /**
- * Free a pipe_surface which was created with softpipe_get_tex_surface().
+ * Free a pipe_surface which was created with softpipe_create_surface().
  */
 static void 
-softpipe_tex_surface_destroy(struct pipe_surface *surf)
+softpipe_surface_destroy(struct pipe_context *pipe,
+                         struct pipe_surface *surf)
 {
    /* Effectively do the texture_update work here - if texture images
     * needed post-processing to put them into hardware layout, this is
@@ -302,21 +298,21 @@ softpipe_tex_surface_destroy(struct pipe_surface *surf)
  */
 static struct pipe_transfer *
 softpipe_get_transfer(struct pipe_context *pipe,
-                     struct pipe_resource *resource,
-                     struct pipe_subresource sr,
-                     unsigned usage,
-                     const struct pipe_box *box)
+                      struct pipe_resource *resource,
+                      unsigned level,
+                      unsigned usage,
+                      const struct pipe_box *box)
 {
    struct softpipe_resource *spr = softpipe_resource(resource);
    struct softpipe_transfer *spt;
 
    assert(resource);
-   assert(sr.level <= resource->last_level);
+   assert(level <= resource->last_level);
 
    /* make sure the requested region is in the image bounds */
-   assert(box->x + box->width <= u_minify(resource->width0, sr.level));
-   assert(box->y + box->height <= u_minify(resource->height0, sr.level));
-   assert(box->z + box->depth <= u_minify(resource->depth0, sr.level));
+   assert(box->x + box->width <= u_minify(resource->width0, level));
+   assert(box->y + box->height <= u_minify(resource->height0, level));
+   assert(box->z + box->depth <= (u_minify(resource->depth0, level) + resource->array_size - 1));
 
    /*
     * Transfers, like other pipe operations, must happen in order, so flush the
@@ -326,7 +322,7 @@ softpipe_get_transfer(struct pipe_context *pipe,
       boolean read_only = !(usage & PIPE_TRANSFER_WRITE);
       boolean do_not_block = !!(usage & PIPE_TRANSFER_DONTBLOCK);
       if (!softpipe_flush_resource(pipe, resource,
-                                   sr.face, sr.level,
+                                   level, box->depth > 1 ? -1 : box->z,
                                    0, /* flush_flags */
                                    read_only,
                                    TRUE, /* cpu_access */
@@ -343,21 +339,21 @@ softpipe_get_transfer(struct pipe_context *pipe,
    if (spt) {
       struct pipe_transfer *pt = &spt->base;
       enum pipe_format format = resource->format;
-      const unsigned hgt = u_minify(spr->base.height0, sr.level);
+      const unsigned hgt = u_minify(spr->base.height0, level);
       const unsigned nblocksy = util_format_get_nblocksy(format, hgt);
 
       pipe_resource_reference(&pt->resource, resource);
-      pt->sr = sr;
+      pt->level = level;
       pt->usage = usage;
       pt->box = *box;
-      pt->stride = spr->stride[sr.level];
-      pt->slice_stride = pt->stride * nblocksy;
+      pt->stride = spr->stride[level];
+      pt->layer_stride = pt->stride * nblocksy;
 
-      spt->offset = sp_get_tex_image_offset(spr, sr.level, sr.face, box->z);
+      spt->offset = sp_get_tex_image_offset(spr, level, box->z);
  
       spt->offset += 
-        box->y / util_format_get_blockheight(format) * spt->base.stride +
-        box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
+         box->y / util_format_get_blockheight(format) * spt->base.stride +
+         box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
 
       return pt;
    }
@@ -454,6 +450,7 @@ softpipe_user_buffer_create(struct pipe_screen *screen,
    spr->base.width0 = bytes;
    spr->base.height0 = 1;
    spr->base.depth0 = 1;
+   spr->base.array_size = 1;
    spr->userBuffer = TRUE;
    spr->data = ptr;
 
@@ -471,6 +468,9 @@ softpipe_init_texture_funcs(struct pipe_context *pipe)
 
    pipe->transfer_flush_region = u_default_transfer_flush_region;
    pipe->transfer_inline_write = u_default_transfer_inline_write;
+
+   pipe->create_surface = softpipe_create_surface;
+   pipe->surface_destroy = softpipe_surface_destroy;
 }
 
 
@@ -483,6 +483,4 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
    screen->resource_get_handle = softpipe_resource_get_handle;
    screen->user_buffer_create = softpipe_user_buffer_create;
 
-   screen->get_tex_surface = softpipe_get_tex_surface;
-   screen->tex_surface_destroy = softpipe_tex_surface_destroy;
 }
index 6b205dc53290cca4b6747aa1d5fbd6ad21cf985f..5603110eeb339b59816a9245b142c1a7d67c1c59 100644 (file)
 
 
 #include "pipe/p_state.h"
-
-
-#define SP_MAX_TEXTURE_2D_LEVELS 13  /* 4K x 4K */
-#define SP_MAX_TEXTURE_3D_LEVELS 9   /* 512 x 512 x 512 */
+#include "sp_limits.h"
 
 
 struct pipe_context;
index aa76b8aa1ec5bfcae04ab4898e6895772f0d09c9..480860af63b3cf4a543d1ba90353b3c81542bc70 100644 (file)
@@ -92,6 +92,10 @@ sp_create_tile_cache( struct pipe_context *pipe )
    maxTexSize = 1 << (maxLevels - 1);
    assert(MAX_WIDTH >= maxTexSize);
 
+   assert(sizeof(union tile_address) == 4);
+
+   assert((TILE_SIZE << TILE_ADDR_BITS) >= MAX_WIDTH);
+
    tc = CALLOC_STRUCT( softpipe_tile_cache );
    if (tc) {
       tc->pipe = pipe;
@@ -170,11 +174,11 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
    tc->surface = ps;
 
    if (ps) {
-      tc->transfer = pipe_get_transfer(pipe, ps->texture, ps->face,
-                                          ps->level, ps->zslice,
-                                          PIPE_TRANSFER_READ_WRITE |
-                                          PIPE_TRANSFER_UNSYNCHRONIZED,
-                                          0, 0, ps->width, ps->height);
+      tc->transfer = pipe_get_transfer(pipe, ps->texture,
+                                       ps->u.tex.level, ps->u.tex.first_layer,
+                                       PIPE_TRANSFER_READ_WRITE |
+                                       PIPE_TRANSFER_UNSYNCHRONIZED,
+                                       0, 0, ps->width, ps->height);
 
       tc->depth_stencil = (ps->format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
                            ps->format == PIPE_FORMAT_Z24X8_UNORM ||
index 4151a47c3235eb526debe8de4b3305b8ddf24cf5..68140b1d2f9f0965304feec0d90825c7ee6200af 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #include "pipe/p_compiler.h"
+#include "sp_texture.h"
 
 
 struct softpipe_tile_cache;
@@ -38,18 +39,22 @@ struct softpipe_tile_cache;
 /**
  * Cache tile size (width and height). This needs to be a power of two.
  */
-#define TILE_SIZE 64
+#define TILE_SIZE_LOG2 6
+#define TILE_SIZE (1 << TILE_SIZE_LOG2)
 
 
-/* If we need to support > 4096, just expand this to be a 64 bit
- * union, or consider tiling in Z as well.
+#define TILE_ADDR_BITS (SP_MAX_TEXTURE_2D_LEVELS - 1 - TILE_SIZE_LOG2)
+
+
+/**
+ * Surface tile address as a union for fast compares.
  */
 union tile_address {
    struct {
-      unsigned x:6;             /* 4096 / TILE_SIZE */
-      unsigned y:6;             /* 4096 / TILE_SIZE */
+      unsigned x:TILE_ADDR_BITS;     /* 16K / TILE_SIZE */
+      unsigned y:TILE_ADDR_BITS;     /* 16K / TILE_SIZE */
       unsigned invalid:1;
-      unsigned pad:19;
+      unsigned pad:15;
    } bits;
    unsigned value;
 };
@@ -70,11 +75,6 @@ struct softpipe_cached_tile
 #define NUM_ENTRIES 50
 
 
-/** XXX move these */
-#define MAX_WIDTH 4096
-#define MAX_HEIGHT 4096
-
-
 struct softpipe_tile_cache
 {
    struct pipe_context *pipe;
index 12ce4732d1508ebaa927ac8138c8f838d223a8cf..5455ed07573ff298d059d89abd203235065d4636 100644 (file)
@@ -73,4 +73,6 @@ svga = env.ConvenienceLibrary(
        source = sources,
 )
 
+env.Alias('svga', svga)
+
 Export('svga')
index e975f3b02fa3fcaff2e4fa23ac35236d750dca22..05eab8a517d2e752b52ba196391f821c5559148e 100644 (file)
@@ -455,8 +455,8 @@ SVGA3D_SurfaceDMA(struct svga_winsys_context *swc,
    cmd->guest.pitch = st->base.stride;
 
    swc->surface_relocation(swc, &cmd->host.sid, texture->handle, surface_flags);
-   cmd->host.face = st->base.sr.face; /* PIPE_TEX_FACE_* and SVGA3D_CUBEFACE_* match */
-   cmd->host.mipmap = st->base.sr.level;
+   cmd->host.face = st->face; /* PIPE_TEX_FACE_* and SVGA3D_CUBEFACE_* match */
+   cmd->host.mipmap = st->base.level;
 
    cmd->transfer = transfer;
 
index cd3f6b89825e846e0900234844ec5ad9e029dd7c..1e513f1039f48908854ddf3b4daa595afb0054ba 100644 (file)
@@ -109,6 +109,7 @@ struct pipe_context *svga_context_create( struct pipe_screen *screen,
    svga_init_vertex_functions(svga);
    svga_init_constbuffer_functions(svga);
    svga_init_query_functions(svga);
+   svga_init_surface_functions(svga);
 
 
    /* debug */
index 1fb5a04887f70e6b52e26ee3963812f0f2c4217d..d4970908b1e97e0a070f8e366a05d0191c199762 100644 (file)
@@ -288,6 +288,11 @@ struct svga_sw_state
    boolean need_swvfetch;
    boolean need_pipeline;
    boolean need_swtnl;
+
+   /* Flag to make sure that need sw is on while
+    * updating state within a swtnl call.
+    */
+   boolean in_swtnl_draw;
 };
 
 
@@ -422,6 +427,7 @@ void svga_init_vertex_functions( struct svga_context *svga );
 void svga_init_constbuffer_functions( struct svga_context *svga );
 void svga_init_draw_functions( struct svga_context *svga );
 void svga_init_query_functions( struct svga_context *svga );
+void svga_init_surface_functions(struct svga_context *svga);
 
 void svga_cleanup_vertex_state( struct svga_context *svga );
 void svga_cleanup_tss_binding( struct svga_context *svga );
index 81dd4778d0a7c5b0aaac4aee82419ad58a8cc740..97cbac447d6ba506667de84c1f950fb8374d0d8f 100644 (file)
@@ -315,7 +315,6 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl,
             break;
          }
 
-         assert(!stride || width <= stride);
          if (max_index != ~0) {
             assert(offset + (index_bias + max_index) * stride + width <= size);
          }
index da33fae62f179269588c7faac228a06662dd858f..be0e7abe21b4187f5a94499cfcb6b3ecbc8f7ce5 100644 (file)
@@ -65,14 +65,14 @@ static enum pipe_error generate_indices( struct svga_hwtnl *hwtnl,
    generate( nr,
              dst_map );
 
-   pipe_buffer_unmap( pipe, dst, transfer );
+   pipe_buffer_unmap( pipe, transfer );
 
    *out_buf = dst;
    return PIPE_OK;
 
 fail:
    if (dst_map)
-      pipe_buffer_unmap( pipe, dst, transfer );
+      pipe_buffer_unmap( pipe, transfer );
 
    if (dst)
       pipe->screen->resource_destroy( pipe->screen, dst );
index c4579177b77864350b078935bccdb1c178254382..83527c6ef496ce4d04084adf8ce7f50152251a3a 100644 (file)
@@ -72,18 +72,18 @@ translate_indices( struct svga_hwtnl *hwtnl,
               nr,
               dst_map );
 
-   pipe_buffer_unmap( pipe, src, src_transfer );
-   pipe_buffer_unmap( pipe, dst, dst_transfer );
+   pipe_buffer_unmap( pipe, src_transfer );
+   pipe_buffer_unmap( pipe, dst_transfer );
 
    *out_buf = dst;
    return PIPE_OK;
 
 fail:
    if (src_map)
-      pipe_buffer_unmap( pipe, src, src_transfer );
+      pipe_buffer_unmap( pipe, src_transfer );
 
    if (dst_map)
-      pipe_buffer_unmap( pipe, dst, dst_transfer );
+      pipe_buffer_unmap( pipe, dst_transfer );
 
    if (dst)
       pipe->screen->resource_destroy( pipe->screen, dst );
@@ -120,14 +120,17 @@ svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl,
    if (index_buffer && 
        svga_buffer_is_user_buffer(index_buffer)) 
    {
+      boolean flushed;
       assert( index_buffer->width0 >= index_offset + count * index_size );
 
       ret = u_upload_buffer( hwtnl->upload_ib,
+                             0,
                              index_offset,
                              count * index_size,
                              index_buffer,
                              &index_offset,
-                             &upload_buffer );
+                             &upload_buffer,
+                             &flushed );
       if (ret)
          goto done;
 
index ca036a6463b52e8d2cea01563cc53bf4eded8825..426698806c8b181ef73d000d91f1e7288ebd6f06 100644 (file)
 #define FILE_DEBUG_FLAG DEBUG_BLIT
 
 
-/* XXX I got my doubts about this, should maybe use svga_texture_copy_handle directly? */
+/* XXX still have doubts about this... */
 static void svga_surface_copy(struct pipe_context *pipe,
                               struct pipe_resource* dst_tex,
-                              struct pipe_subresource subdst,
+                              unsigned dst_level,
                               unsigned dstx, unsigned dsty, unsigned dstz,
                               struct pipe_resource* src_tex,
-                              struct pipe_subresource subsrc,
-                              unsigned srcx, unsigned srcy, unsigned srcz,
-                              unsigned width, unsigned height)
-{
+                              unsigned src_level,
+                              const struct pipe_box *src_box)
+ {
    struct svga_context *svga = svga_context(pipe);
-   struct pipe_screen *screen = pipe->screen;
+   struct svga_texture *stex = svga_texture(src_tex);
+   struct svga_texture *dtex = svga_texture(dst_tex);
+/*   struct pipe_screen *screen = pipe->screen;
    SVGA3dCopyBox *box;
    enum pipe_error ret;
-   struct pipe_surface *srcsurf, *dstsurf;
+   struct pipe_surface *srcsurf, *dstsurf;*/
+   unsigned dst_face, dst_z, src_face, src_z;
 
    svga_hwtnl_flush_retry( svga );
 
+#if 0
    srcsurf = screen->get_tex_surface(screen, src_tex,
-                                     subsrc.face, subsrc.level, srcz,
+                                     src_level, src_box->z, src_box->z,
                                      PIPE_BIND_SAMPLER_VIEW);
 
    dstsurf = screen->get_tex_surface(screen, dst_tex,
-                                     subdst.face, subdst.level, dstz,
+                                     dst_level, dst_box->z, dst_box->z,
                                      PIPE_BIND_RENDER_TARGET);
 
    SVGA_DBG(DEBUG_DMA, "blit to sid %p (%d,%d), from sid %p (%d,%d) sz %dx%d\n",
             svga_surface(dstsurf)->handle,
             dstx, dsty,
             svga_surface(srcsurf)->handle,
-            srcx, srcy,
+            src_box->x, src_box->y,
             width, height);
 
    ret = SVGA3D_BeginSurfaceCopy(svga->swc,
@@ -88,8 +91,8 @@ static void svga_surface_copy(struct pipe_context *pipe,
    box->w = width;
    box->h = height;
    box->d = 1;
-   box->srcx = srcx;
-   box->srcy = srcy;
+   box->srcx = src_box->x;
+   box->srcy = src_box->y;
    box->srcz = 0;
 
    SVGA_FIFOCommitAll(svga->swc);
@@ -100,6 +103,37 @@ static void svga_surface_copy(struct pipe_context *pipe,
    pipe_surface_reference(&srcsurf, NULL);
    pipe_surface_reference(&dstsurf, NULL);
 
+#else
+   if (src_tex->target == PIPE_TEXTURE_CUBE) {
+      src_face = src_box->z;
+      src_z = 0;
+      assert(src_box->depth == 1);
+   }
+   else {
+      src_face = 0;
+      src_z = src_box->z;
+   }
+   /* different src/dst type???*/
+   if (dst_tex->target == PIPE_TEXTURE_CUBE) {
+      dst_face = dstz;
+      dst_z = 0;
+      assert(src_box->depth == 1);
+   }
+   else {
+      dst_face = 0;
+      dst_z = dstz;
+   }
+   svga_texture_copy_handle(svga,
+                            stex->handle,
+                            src_box->x, src_box->y, src_z,
+                            src_level, src_face,
+                            dtex->handle,
+                            dstx, dsty, dst_z,
+                            dst_level, dst_face,
+                            src_box->width, src_box->height, src_box->depth);
+
+#endif
+
 }
 
 
index 660eb0757a6778bfc0c2fdf434a30d20da2039ab..e97b4e57415b9ceec803ef1c6c277fcbf080da9a 100644 (file)
@@ -68,7 +68,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
    /* need this for draw module. */
    rast->templ = *templ;
 
-   /* light_twoside          - XXX: need fragment shader varient */
+   /* light_twoside          - XXX: need fragment shader variant */
    /* poly_smooth            - XXX: no fallback available */
    /* poly_stipple_enable    - draw module */
    /* sprite_coord_enable    - ? */
index 198d40133284158c18465621467e45e1bbdc16ec..f12e2b686270230b600dba255a9f04d096b869ae 100644 (file)
@@ -53,8 +53,8 @@ svga_buffer_needs_hw_storage(unsigned usage)
 
 static unsigned int
 svga_buffer_is_referenced( struct pipe_context *pipe,
-                            struct pipe_resource *buf,
-                            unsigned face, unsigned level)
+                           struct pipe_resource *buf,
+                           unsigned level, int layer)
 {
    struct svga_screen *ss = svga_screen(pipe->screen);
    struct svga_buffer *sbuf = svga_buffer(buf);
@@ -337,6 +337,7 @@ svga_user_buffer_create(struct pipe_screen *screen,
    sbuf->b.b.width0 = bytes;
    sbuf->b.b.height0 = 1;
    sbuf->b.b.depth0 = 1;
+   sbuf->b.b.array_size = 1;
 
    sbuf->swbuf = ptr;
    sbuf->user = TRUE;
index 26eb03a895a81ae4ad4ebb28c85c838f500c08a3..7c9e600b9f441664c8776360daaaa3c89bab61e5 100644 (file)
@@ -50,8 +50,8 @@
 
 static unsigned int
 svga_texture_is_referenced( struct pipe_context *pipe,
-                           struct pipe_resource *texture,
-                           unsigned face, unsigned level)
+                            struct pipe_resource *texture,
+                            unsigned level, int layer)
 {
    struct svga_texture *tex = svga_texture(texture);
    struct svga_screen *ss = svga_screen(pipe->screen);
@@ -171,20 +171,7 @@ svga_transfer_dma_band(struct svga_context *svga,
    struct svga_texture *texture = svga_texture(st->base.resource); 
    SVGA3dCopyBox box;
    enum pipe_error ret;
-   
-   SVGA_DBG(DEBUG_DMA, "dma %s sid %p, face %u, (%u, %u, %u) - (%u, %u, %u), %ubpp\n",
-                transfer == SVGA3D_WRITE_HOST_VRAM ? "to" : "from", 
-                texture->handle,
-                st->base.sr.face,
-                st->base.box.x,
-                y,
-                st->base.box.z,
-                st->base.box.x + st->base.box.width,
-                y + h,
-                st->base.box.z + 1,
-                util_format_get_blocksize(texture->b.b.format) * 8 /
-                (util_format_get_blockwidth(texture->b.b.format)*util_format_get_blockheight(texture->b.b.format)));
-   
    box.x = st->base.box.x;
    box.y = y;
    box.z = st->base.box.z;
@@ -195,6 +182,26 @@ svga_transfer_dma_band(struct svga_context *svga,
    box.srcy = srcy;
    box.srcz = 0;
 
+   if (st->base.resource->target == PIPE_TEXTURE_CUBE) {
+      st->face = st->base.box.z;
+      box.z = 0;
+   }
+   else
+      st->face = 0;
+
+   SVGA_DBG(DEBUG_DMA, "dma %s sid %p, face %u, (%u, %u, %u) - (%u, %u, %u), %ubpp\n",
+                transfer == SVGA3D_WRITE_HOST_VRAM ? "to" : "from", 
+                texture->handle,
+                st->face,
+                st->base.box.x,
+                y,
+                box.z,
+                st->base.box.x + st->base.box.width,
+                y + h,
+                box.z + 1,
+                util_format_get_blocksize(texture->b.b.format) * 8 /
+                (util_format_get_blockwidth(texture->b.b.format)*util_format_get_blockheight(texture->b.b.format)));
+
    ret = SVGA3D_SurfaceDMA(svga->swc, st, transfer, &box, 1);
    if(ret != PIPE_OK) {
       svga->swc->flush(svga->swc, NULL);
@@ -213,7 +220,7 @@ svga_transfer_dma(struct svga_context *svga,
    struct svga_screen *screen = svga_screen(texture->b.b.screen);
    struct svga_winsys_screen *sws = screen->sws;
    struct pipe_fence_handle *fence = NULL;
-   
+
    if (transfer == SVGA3D_READ_HOST_VRAM) {
       SVGA_DBG(DEBUG_PERF, "%s: readback transfer\n", __FUNCTION__);
    }
@@ -221,7 +228,7 @@ svga_transfer_dma(struct svga_context *svga,
 
    if(!st->swbuf) {
       /* Do the DMA transfer in a single go */
-      
+
       svga_transfer_dma_band(svga, st, transfer, st->base.box.y, st->base.box.height, 0);
 
       if(transfer == SVGA3D_READ_HOST_VRAM) {
@@ -245,12 +252,12 @@ svga_transfer_dma(struct svga_context *svga,
          /* Transfer band must be aligned to pixel block boundaries */
          assert(y % blockheight == 0);
          assert(h % blockheight == 0);
-         
+
          offset = y * st->base.stride / blockheight;
          length = h * st->base.stride / blockheight;
 
          sw = (uint8_t *)st->swbuf + offset;
-         
+
          if(transfer == SVGA3D_WRITE_HOST_VRAM) {
             /* Wait for the previous DMAs to complete */
             /* TODO: keep one DMA (at half the size) in the background */
@@ -267,9 +274,9 @@ svga_transfer_dma(struct svga_context *svga,
                sws->buffer_unmap(sws, st->hwbuf);
             }
          }
-         
+
          svga_transfer_dma_band(svga, st, transfer, y, h, srcy);
-         
+
          if(transfer == SVGA3D_READ_HOST_VRAM) {
             svga_context_flush(svga, &fence);
             sws->fence_finish(sws, fence, 0);
@@ -336,10 +343,10 @@ svga_texture_destroy(struct pipe_screen *screen,
  */
 static struct pipe_transfer *
 svga_texture_get_transfer(struct pipe_context *pipe,
-                         struct pipe_resource *texture,
-                         struct pipe_subresource sr,
-                         unsigned usage,
-                         const struct pipe_box *box)
+                          struct pipe_resource *texture,
+                          unsigned level,
+                          unsigned usage,
+                          const struct pipe_box *box)
 {
    struct svga_context *svga = svga_context(pipe);
    struct svga_screen *ss = svga_screen(pipe->screen);
@@ -352,19 +359,20 @@ svga_texture_get_transfer(struct pipe_context *pipe,
    if (usage & PIPE_TRANSFER_MAP_DIRECTLY)
       return NULL;
 
+   assert(box->depth == 1);
    st = CALLOC_STRUCT(svga_transfer);
    if (!st)
       return NULL;
-   
+
    pipe_resource_reference(&st->base.resource, texture);
-   st->base.sr = sr;
+   st->base.level = level;
    st->base.usage = usage;
    st->base.box = *box;
    st->base.stride = nblocksx*util_format_get_blocksize(texture->format);
-   st->base.slice_stride = 0;
+   st->base.layer_stride = 0;
 
    st->hw_nblocksy = nblocksy;
-   
+
    st->hwbuf = svga_winsys_buffer_create(svga,
                                          1, 
                                          0,
@@ -391,7 +399,7 @@ svga_texture_get_transfer(struct pipe_context *pipe,
       if(!st->swbuf)
          goto no_swbuf;
    }
-   
+
    if (usage & PIPE_TRANSFER_READ)
       svga_transfer_dma(svga, st, SVGA3D_READ_HOST_VRAM);
 
@@ -454,8 +462,11 @@ svga_texture_transfer_destroy(struct pipe_context *pipe,
    if (st->base.usage & PIPE_TRANSFER_WRITE) {
       svga_transfer_dma(svga, st, SVGA3D_WRITE_HOST_VRAM);
       ss->texture_timestamp++;
-      tex->view_age[transfer->sr.level] = ++(tex->age);
-      tex->defined[transfer->sr.face][transfer->sr.level] = TRUE;
+      tex->view_age[transfer->level] = ++(tex->age);
+      if (transfer->resource->target == PIPE_TEXTURE_CUBE)
+         tex->defined[transfer->box.z][transfer->level] = TRUE;
+      else
+         tex->defined[0][transfer->level] = TRUE;
    }
 
    pipe_resource_reference(&st->base.resource, NULL);
@@ -490,7 +501,7 @@ svga_texture_create(struct pipe_screen *screen,
 {
    struct svga_screen *svgascreen = svga_screen(screen);
    struct svga_texture *tex = CALLOC_STRUCT(svga_texture);
-   
+
    if (!tex)
       goto error1;
 
@@ -507,7 +518,7 @@ svga_texture_create(struct pipe_screen *screen,
    tex->key.size.width = template->width0;
    tex->key.size.height = template->height0;
    tex->key.size.depth = template->depth0;
-   
+
    if(template->target == PIPE_TEXTURE_CUBE) {
       tex->key.flags |= SVGA3D_SURFACE_CUBEMAP;
       tex->key.numFaces = 6;
index 631937f2eb099d961797ef565f9a44886df4f10c..9a2911c2a95d9d7f5347efc926878de6aeeb26ba 100644 (file)
@@ -85,6 +85,8 @@ struct svga_transfer
 {
    struct pipe_transfer base;
 
+   unsigned face;
+
    struct svga_winsys_buffer *hwbuf;
 
    /* Height of the hardware buffer in pixel blocks */
index 666b498d1450e8c9c668e56802a596c64cc89570..d0f42c614c9e677728b8660b8010a4f8302dbd50 100644 (file)
@@ -35,7 +35,6 @@
 #include "svga_resource_texture.h"
 #include "svga_resource.h"
 #include "svga_debug.h"
-#include "svga_surface.h"
 
 #include "svga3d_shaderdefs.h"
 
@@ -499,7 +498,6 @@ svga_screen_create(struct svga_winsys_screen *sws)
    screen->fence_finish = svga_fence_finish;
    svgascreen->sws = sws;
 
-   svga_screen_init_surface_functions(screen);
    svga_init_screen_resource_functions(svgascreen);
 
    svgascreen->use_ps30 =
index 97c818cd379dcb1dfa69e8e47b097c42b3f3bf2d..daf1024fd020214a2da52fec34b3ca994a3ec820 100644 (file)
@@ -110,7 +110,7 @@ static int emit_consts( struct svga_context *svga,
 
 done:
    if (data)
-      pipe_buffer_unmap(&svga->pipe, svga->curr.cb[unit], transfer);
+      pipe_buffer_unmap(&svga->pipe, transfer);
 
    return ret;
 }
index ad6f2947137633bb21672c130ffe1addfcda6db2..9c04adec8ee852c17a0acd7d3e8fa34659ffefe3 100644 (file)
@@ -136,7 +136,7 @@ static int make_fs_key( const struct svga_context *svga,
 
    /* The blend workaround for simulating logicop xor behaviour
     * requires that the incoming fragment color be white.  This change
-    * achieves that by creating a varient of the current fragment
+    * achieves that by creating a variant of the current fragment
     * shader that overrides all output colors with 1,1,1,1
     *   
     * This will work for most shaders, including those containing
index d34d68f5350f44642d8127cde9ed25bf07dc42b3..8ba5ac8cdb4ac1b61c0430ba5c107b3d9ff59776 100644 (file)
@@ -114,7 +114,7 @@ static int update_need_pipeline( struct svga_context *svga,
    /* SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
     */
    if (svga->curr.rast->need_pipeline & (1 << svga->curr.reduced_prim)) {
-      SVGA_DBG(DEBUG_SWTNL, "%s: rast need_pipeline (%d) & prim (%x)\n", 
+      SVGA_DBG(DEBUG_SWTNL, "%s: rast need_pipeline (0x%x) & prim (0x%x)\n",
                  __FUNCTION__,
                  svga->curr.rast->need_pipeline,
                  (1 << svga->curr.reduced_prim) );
@@ -175,9 +175,17 @@ static int update_need_swtnl( struct svga_context *svga,
       need_swtnl = 1;
    }
 
+   /*
+    * Some state changes the draw module does makes us belive we
+    * we don't need swtnl. This causes the vdecl code to pickup
+    * the wrong buffers and vertex formats. Try trivial/line-wide.
+    */
+   if (svga->state.sw.in_swtnl_draw)
+      need_swtnl = 1;
+
    if (need_swtnl != svga->state.sw.need_swtnl) {
       SVGA_DBG(DEBUG_SWTNL|DEBUG_PERF,
-               "%s need_swvfetch: %s, need_pipeline %s\n",
+               "%s: need_swvfetch %s, need_pipeline %s\n",
                __FUNCTION__,
                svga->state.sw.need_swvfetch ? "true" : "false",
                svga->state.sw.need_pipeline ? "true" : "false");
index 4a50b19474c10214e4ae3b7fc853d76c4988df94..f8b269a101efd2df77ca47eb93ea2282cd4d81f4 100644 (file)
@@ -238,7 +238,6 @@ update_tss(struct svga_context *svga,
          // TEXCOORDINDEX -- hopefully not needed
 
          if (svga->curr.tex_flags.flag_1d & (1 << i)) {
-            debug_printf("wrap 1d tex %d\n", i);
             EMIT_TS(svga, i, SVGA3D_TEX_ADDRESS_WRAP, ADDRESSV, fail);
          }
          else
index 3af7bf2b35872d3c6e8d683b0c9d09145c541fc5..958d00393f2f28b90ddbd58fd80eb8cafd203d2d 100644 (file)
@@ -57,12 +57,14 @@ upload_user_buffers( struct svga_context *svga )
          struct svga_buffer *buffer = svga_buffer(svga->curr.vb[i].buffer);
 
          if (!buffer->uploaded.buffer) {
+            boolean flushed;
             ret = u_upload_buffer( svga->upload_vb,
-                                   0,
+                                   0, 0,
                                    buffer->b.b.width0,
                                    &buffer->b.b,
                                    &buffer->uploaded.offset,
-                                   &buffer->uploaded.buffer );
+                                   &buffer->uploaded.buffer,
+                                   &flushed);
             if (ret)
                return ret;
 
index 5133c70593c1e131c55da8c766399bf0e94540d2..6682a1efe66ae1aea88136b3777c1835dca5a6eb 100644 (file)
@@ -233,9 +233,7 @@ static int update_zero_stride( struct svga_context *svga,
          translate->run(translate, 0, 1, 0,
                         svga->curr.zero_stride_constants);
 
-         pipe_buffer_unmap(&svga->pipe,
-                           vbuffer->buffer,
-                          transfer);
+         pipe_buffer_unmap(&svga->pipe, transfer);
 
          translate->release(translate);
       }
index b21dc5fd9afcaf64338aacd9f7a3df009a4af1ec..3e4bed76c052295dd00d20d25e23f4015c2cf67b 100644 (file)
@@ -179,36 +179,50 @@ svga_texture_view_surface(struct pipe_context *pipe,
 
 
 static struct pipe_surface *
-svga_get_tex_surface(struct pipe_screen *screen,
-                     struct pipe_resource *pt,
-                     unsigned face, unsigned level, unsigned zslice,
-                     unsigned flags)
+svga_create_surface(struct pipe_context *pipe,
+                    struct pipe_resource *pt,
+                    const struct pipe_surface *surf_tmpl)
 {
    struct svga_texture *tex = svga_texture(pt);
+   struct pipe_screen *screen = pipe->screen;
    struct svga_surface *s;
-   boolean render = (flags & (PIPE_BIND_RENDER_TARGET |
-                             PIPE_BIND_DEPTH_STENCIL)) ? TRUE : FALSE;
+   unsigned face, zslice;
+   /* XXX surfaces should only be used for rendering purposes nowadays */
+   boolean render = (surf_tmpl->usage & (PIPE_BIND_RENDER_TARGET |
+                                         PIPE_BIND_DEPTH_STENCIL)) ? TRUE : FALSE;
    boolean view = FALSE;
    SVGA3dSurfaceFormat format;
 
+   assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
+
    s = CALLOC_STRUCT(svga_surface);
    if (!s)
       return NULL;
 
+   if (pt->target == PIPE_TEXTURE_CUBE) {
+         face = surf_tmpl->u.tex.first_layer;
+         zslice = 0;
+   }
+   else {
+      face = 0;
+      zslice = surf_tmpl->u.tex.first_layer;
+   }
+
    pipe_reference_init(&s->base.reference, 1);
    pipe_resource_reference(&s->base.texture, pt);
-   s->base.format = pt->format;
-   s->base.width = u_minify(pt->width0, level);
-   s->base.height = u_minify(pt->height0, level);
-   s->base.usage = flags;
-   s->base.level = level;
-   s->base.face = face;
-   s->base.zslice = zslice;
+   s->base.context = pipe;
+   s->base.format = surf_tmpl->format;
+   s->base.width = u_minify(pt->width0, surf_tmpl->u.tex.level);
+   s->base.height = u_minify(pt->height0, surf_tmpl->u.tex.level);
+   s->base.usage = surf_tmpl->usage;
+   s->base.u.tex.level = surf_tmpl->u.tex.level;
+   s->base.u.tex.first_layer = surf_tmpl->u.tex.first_layer;
+   s->base.u.tex.last_layer = surf_tmpl->u.tex.last_layer;
 
    if (!render)
-      format = svga_translate_format(pt->format);
+      format = svga_translate_format(surf_tmpl->format);
    else
-      format = svga_translate_format_render(pt->format);
+      format = svga_translate_format_render(surf_tmpl->format);
 
    assert(format != SVGA3D_FORMAT_INVALID);
 
@@ -217,11 +231,11 @@ svga_get_tex_surface(struct pipe_screen *screen,
 
    /* Currently only used for compressed textures */
    if (render && 
-       format != svga_translate_format(pt->format)) {
+       format != svga_translate_format(surf_tmpl->format)) {
       view = TRUE;
    }
 
-   if (level != 0 && 
+   if (surf_tmpl->u.tex.level != 0 &&
        svga_screen(screen)->debug.force_level_surface_view)
       view = TRUE;
 
@@ -233,22 +247,22 @@ svga_get_tex_surface(struct pipe_screen *screen,
 
    if (view) {
       SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: yes %p, level %u face %u z %u, %p\n",
-               pt, level, face, zslice, s);
+               pt, surf_tmpl->u.tex.level, face, zslice, s);
 
-      s->handle = svga_texture_view_surface(NULL, tex, format, level, 1, face, zslice,
-                                            &s->key);
+      s->handle = svga_texture_view_surface(NULL, tex, format, surf_tmpl->u.tex.level,
+                                           1, face, zslice, &s->key);
       s->real_face = 0;
       s->real_level = 0;
       s->real_zslice = 0;
    } else {
       SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n",
-               pt, level, face, zslice, s);
+               pt, surf_tmpl->u.tex.level, face, zslice, s);
 
       memset(&s->key, 0, sizeof s->key);
       s->handle = tex->handle;
       s->real_face = face;
-      s->real_level = level;
       s->real_zslice = zslice;
+      s->real_level = surf_tmpl->u.tex.level;
    }
 
    return &s->base;
@@ -256,7 +270,8 @@ svga_get_tex_surface(struct pipe_screen *screen,
 
 
 static void
-svga_tex_surface_destroy(struct pipe_surface *surf)
+svga_surface_destroy(struct pipe_context *pipe,
+                     struct pipe_surface *surf)
 {
    struct svga_surface *s = svga_surface(surf);
    struct svga_texture *t = svga_texture(surf->texture);
@@ -282,8 +297,13 @@ svga_mark_surface_dirty(struct pipe_surface *surf)
 
       s->dirty = TRUE;
 
-      if (s->handle == tex->handle)
-         tex->defined[surf->face][surf->level] = TRUE;
+      if (s->handle == tex->handle) {
+         /* hmm so 3d textures always have all their slices marked ? */
+         if (surf->texture->target == PIPE_TEXTURE_CUBE)
+            tex->defined[surf->u.tex.first_layer][surf->u.tex.level] = TRUE;
+         else
+            tex->defined[0][surf->u.tex.level] = TRUE;
+      }
       else {
          /* this will happen later in svga_propagate_surface */
       }
@@ -314,22 +334,32 @@ svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf)
    struct svga_surface *s = svga_surface(surf);
    struct svga_texture *tex = svga_texture(surf->texture);
    struct svga_screen *ss = svga_screen(surf->texture->screen);
+   unsigned zslice, face;
 
    if (!s->dirty)
       return;
 
+   if (surf->texture->target == PIPE_TEXTURE_CUBE) {
+      zslice = 0;
+      face = surf->u.tex.first_layer;
+   }
+   else {
+      zslice = surf->u.tex.first_layer;
+      face = 0;
+   }
+
    s->dirty = FALSE;
    ss->texture_timestamp++;
-   tex->view_age[surf->level] = ++(tex->age);
+   tex->view_age[surf->u.tex.level] = ++(tex->age);
 
    if (s->handle != tex->handle) {
-      SVGA_DBG(DEBUG_VIEWS, "svga: Surface propagate: tex %p, level %u, from %p\n", tex, surf->level, surf);
+      SVGA_DBG(DEBUG_VIEWS, "svga: Surface propagate: tex %p, level %u, from %p\n", tex, surf->u.tex.level, surf);
       svga_texture_copy_handle(svga_context(pipe),
                                s->handle, 0, 0, 0, s->real_level, s->real_face,
-                               tex->handle, 0, 0, surf->zslice, surf->level, surf->face,
-                               u_minify(tex->b.b.width0, surf->level),
-                               u_minify(tex->b.b.height0, surf->level), 1);
-      tex->defined[surf->face][surf->level] = TRUE;
+                               tex->handle, 0, 0, zslice, surf->u.tex.level, face,
+                               u_minify(tex->b.b.width0, surf->u.tex.level),
+                               u_minify(tex->b.b.height0, surf->u.tex.level), 1);
+      tex->defined[face][surf->u.tex.level] = TRUE;
    }
 }
 
@@ -351,9 +381,9 @@ svga_surface_needs_propagation(struct pipe_surface *surf)
 
 
 void
-svga_screen_init_surface_functions(struct pipe_screen *screen)
+svga_init_surface_functions(struct svga_context *svga)
 {
-   screen->get_tex_surface = svga_get_tex_surface;
-   screen->tex_surface_destroy = svga_tex_surface_destroy;
+   svga->pipe.create_surface = svga_create_surface;
+   svga->pipe.surface_destroy = svga_surface_destroy;
 }
 
index 13bd5b19b61f248aebb16a2983d237f80fa8cc23..afb8326e1f38703de365dc9c32d951daf2b7d332 100644 (file)
@@ -90,7 +90,4 @@ svga_surface(struct pipe_surface *surface)
    return (struct svga_surface *)surface;
 }
 
-void
-svga_screen_init_surface_functions(struct pipe_screen *screen);
-
 #endif
index ff3da842729e183e6cd072b7bfd933a8f29f8834..d5db6bf641a2fbbb254336d2be147fea9afa4059 100644 (file)
@@ -141,7 +141,7 @@ svga_vbuf_render_unmap_vertices( struct vbuf_render *render,
    pipe_buffer_flush_mapped_range(&svga->pipe,
                                  svga_render->vbuf_transfer,
                                  offset, length);
-   pipe_buffer_unmap(&svga->pipe, svga_render->vbuf, svga_render->vbuf_transfer);
+   pipe_buffer_unmap(&svga->pipe, svga_render->vbuf_transfer);
    svga_render->min_index = min_index;
    svga_render->max_index = max_index;
    svga_render->vbuf_used = MAX2(svga_render->vbuf_used, used);
@@ -158,7 +158,7 @@ svga_vbuf_render_set_primitive( struct vbuf_render *render,
 }
 
 static void
-svga_vbuf_sumbit_state( struct svga_vbuf_render *svga_render )
+svga_vbuf_submit_state( struct svga_vbuf_render *svga_render )
 {
    struct svga_context *svga = svga_render->svga;
    SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS];
@@ -221,7 +221,8 @@ svga_vbuf_render_draw_arrays( struct vbuf_render *render,
    unsigned bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size;
    enum pipe_error ret = 0;
 
-   svga_vbuf_sumbit_state(svga_render);
+   /* off to hardware */
+   svga_vbuf_submit_state(svga_render);
 
    /* Need to call update_state() again as the draw module may have
     * altered some of our state behind our backs.  Testcase:
@@ -267,9 +268,8 @@ svga_vbuf_render_draw_elements( struct vbuf_render *render,
    pipe_buffer_write_nooverlap(&svga->pipe, svga_render->ibuf,
                               svga_render->ibuf_offset, 2 * nr_indices, indices);
 
-
    /* off to hardware */
-   svga_vbuf_sumbit_state(svga_render);
+   svga_vbuf_submit_state(svga_render);
 
    /* Need to call update_state() again as the draw module may have
     * altered some of our state behind our backs.  Testcase:
index 814e8edd70fb6fafec62c78fcdeeb6f5a872354b..05d86e1fb16ca85a351e46283b1f1b8e857d09d1 100644 (file)
@@ -51,6 +51,9 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
    assert(svga->state.sw.need_swtnl);
    assert(draw);
 
+   /* Make sure that the need_swtnl flag does not go away */
+   svga->state.sw.in_swtnl_draw = TRUE;
+
    ret = svga_update_state(svga, SVGA_STATE_SWTNL_DRAW);
    if (ret) {
       svga_context_flush(svga, NULL);
@@ -106,22 +109,22 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
     * unmap vertex/index buffers
     */
    for (i = 0; i < svga->curr.num_vertex_buffers; i++) {
-      pipe_buffer_unmap(&svga->pipe, svga->curr.vb[i].buffer, 
-                       vb_transfer[i]);
+      pipe_buffer_unmap(&svga->pipe, vb_transfer[i]);
       draw_set_mapped_vertex_buffer(draw, i, NULL);
    }
 
    if (ib_transfer) {
-      pipe_buffer_unmap(&svga->pipe, svga->curr.ib.buffer, ib_transfer);
+      pipe_buffer_unmap(&svga->pipe, ib_transfer);
       draw_set_mapped_index_buffer(draw, NULL);
    }
 
    if (svga->curr.cb[PIPE_SHADER_VERTEX]) {
-      pipe_buffer_unmap(&svga->pipe,
-                        svga->curr.cb[PIPE_SHADER_VERTEX],
-                       cb_transfer);
+      pipe_buffer_unmap(&svga->pipe, cb_transfer);
    }
 
+   /* Now safe to remove the need_swtnl flag in any update_state call */
+   svga->state.sw.in_swtnl_draw = FALSE;
+
    return ret;
 }
 
index 04f30f82c3d92fe38eaca47696740957f98b6ee4..eaabae8ce422137eb4564fc9d6a1035cd9ad3557 100644 (file)
@@ -314,6 +314,9 @@ trace_context_bind_vertex_sampler_states(struct pipe_context *_pipe,
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
 
+   if (!pipe->bind_vertex_sampler_states)
+      return;
+
    trace_dump_call_begin("pipe_context", "bind_vertex_sampler_states");
 
    trace_dump_arg(ptr, pipe);
@@ -885,6 +888,60 @@ trace_sampler_view_destroy(struct pipe_context *_pipe,
    FREE(_view);
 }
 
+/********************************************************************
+ * surface
+ */
+
+
+static struct pipe_surface *
+trace_create_surface(struct pipe_context *_pipe,
+                     struct pipe_resource *_texture,
+                     const struct pipe_surface *surf_tmpl)
+{
+   struct trace_context *tr_ctx = trace_context(_pipe);
+   struct trace_resource *tr_tex = trace_resource(_texture);
+   struct pipe_context *pipe = tr_ctx->pipe;
+   struct pipe_resource *texture = tr_tex->resource;
+   struct pipe_surface *result = NULL;
+
+   trace_dump_call_begin("pipe_context", "create_surface");
+
+   trace_dump_arg(ptr, pipe);
+   trace_dump_arg(ptr, texture);
+   /* hmm some values unitialized there */
+   trace_dump_arg(surface, surf_tmpl);
+
+   result = pipe->create_surface(pipe, texture, surf_tmpl);
+
+   trace_dump_ret(ptr, result);
+
+   trace_dump_call_end();
+
+   result = trace_surf_create(tr_tex, result);
+
+   return result;
+}
+
+
+static void
+trace_surface_destroy(struct pipe_context *_pipe,
+                      struct pipe_surface *_surface)
+{
+   struct trace_context *tr_ctx = trace_context(_pipe);
+   struct pipe_context *pipe = tr_ctx->pipe;
+   struct trace_surface *tr_surf = trace_surface(_surface);
+   struct pipe_surface *surface = tr_surf->surface;
+
+   trace_dump_call_begin("pipe_context", "surface_destroy");
+
+   trace_dump_arg(ptr, pipe);
+   trace_dump_arg(ptr, surface);
+
+   trace_dump_call_end();
+
+   trace_surf_destroy(tr_surf);
+}
+
 
 static INLINE void
 trace_context_set_fragment_sampler_views(struct pipe_context *_pipe,
@@ -926,6 +983,9 @@ trace_context_set_vertex_sampler_views(struct pipe_context *_pipe,
    struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS];
    unsigned i;
 
+   if (!pipe->set_vertex_sampler_views)
+      return;
+
    for(i = 0; i < num; ++i) {
       tr_view = trace_sampler_view(views[i]);
       unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
@@ -1004,12 +1064,11 @@ trace_context_set_index_buffer(struct pipe_context *_pipe,
 static INLINE void
 trace_context_resource_copy_region(struct pipe_context *_pipe,
                                    struct pipe_resource *dst,
-                                   struct pipe_subresource subdst,
+                                   unsigned dst_level,
                                    unsigned dstx, unsigned dsty, unsigned dstz,
                                    struct pipe_resource *src,
-                                   struct pipe_subresource subsrc,
-                                   unsigned srcx, unsigned srcy, unsigned srcz,
-                                   unsigned width, unsigned height)
+                                   unsigned src_level,
+                                   const struct pipe_box *src_box)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
@@ -1021,21 +1080,17 @@ trace_context_resource_copy_region(struct pipe_context *_pipe,
 
    trace_dump_arg(ptr, pipe);
    trace_dump_arg(ptr, dst);
-   trace_dump_arg_struct(subresource, subdst);
+   trace_dump_arg(uint, dst_level);
    trace_dump_arg(uint, dstx);
    trace_dump_arg(uint, dsty);
    trace_dump_arg(uint, dstz);
    trace_dump_arg(ptr, src);
-   trace_dump_arg_struct(subresource, subsrc);
-   trace_dump_arg(uint, srcx);
-   trace_dump_arg(uint, srcy);
-   trace_dump_arg(uint, srcz);
-   trace_dump_arg(uint, width);
-   trace_dump_arg(uint, height);
+   trace_dump_arg(uint, src_level);
+   trace_dump_arg(box, src_box);
 
    pipe->resource_copy_region(pipe,
-                              dst, subdst, dstx, dsty, dstz,
-                              src, subsrc, srcx, srcy, srcz, width, height);
+                              dst, dst_level, dstx, dsty, dstz,
+                              src, src_level, src_box);
 
    trace_dump_call_end();
 }
@@ -1166,8 +1221,8 @@ trace_context_destroy(struct pipe_context *_pipe)
 
 static unsigned int
 trace_is_resource_referenced( struct pipe_context *_pipe,
-                             struct pipe_resource *_resource,
-                             unsigned face, unsigned level)
+                              struct pipe_resource *_resource,
+                              unsigned level, int layer)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct trace_resource *tr_tex = trace_resource(_resource);
@@ -1178,10 +1233,10 @@ trace_is_resource_referenced( struct pipe_context *_pipe,
    trace_dump_call_begin("pipe_context", "is_resource_referenced");
    trace_dump_arg(ptr, pipe);
    trace_dump_arg(ptr, texture);
-   trace_dump_arg(uint, face);
    trace_dump_arg(uint, level);
+   trace_dump_arg(int, layer);
 
-   referenced = pipe->is_resource_referenced(pipe, texture, face, level);
+   referenced = pipe->is_resource_referenced(pipe, texture, level, layer);
 
    trace_dump_ret(uint, referenced);
    trace_dump_call_end();
@@ -1197,10 +1252,10 @@ trace_is_resource_referenced( struct pipe_context *_pipe,
 
 static struct pipe_transfer *
 trace_context_get_transfer(struct pipe_context *_context,
-                          struct pipe_resource *_resource,
-                          struct pipe_subresource sr,
-                          unsigned usage,
-                          const struct pipe_box *box)
+                           struct pipe_resource *_resource,
+                           unsigned level,
+                           unsigned usage,
+                           const struct pipe_box *box)
 {
    struct trace_context *tr_context = trace_context(_context);
    struct trace_resource *tr_tex = trace_resource(_resource);
@@ -1215,7 +1270,7 @@ trace_context_get_transfer(struct pipe_context *_context,
     * to transfer_inline_write and ignore read transfers.
     */
 
-   result = context->get_transfer(context, texture, sr, usage, box);
+   result = context->get_transfer(context, texture, level, usage, box);
 
    if (result)
       result = trace_transfer_create(tr_context, tr_tex, result);
@@ -1226,7 +1281,7 @@ trace_context_get_transfer(struct pipe_context *_context,
 
 static void
 trace_context_transfer_destroy(struct pipe_context *_context,
-                                   struct pipe_transfer *_transfer)
+                               struct pipe_transfer *_transfer)
 {
    struct trace_context *tr_context = trace_context(_context);
    struct trace_transfer *tr_trans = trace_transfer(_transfer);
@@ -1274,7 +1329,7 @@ trace_context_transfer_flush_region( struct pipe_context *_context,
 
 static void
 trace_context_transfer_unmap(struct pipe_context *_context,
-                            struct pipe_transfer *_transfer)
+                             struct pipe_transfer *_transfer)
 {
    struct trace_context *tr_ctx = trace_context(_context);
    struct trace_transfer *tr_trans = trace_transfer(_transfer);
@@ -1287,17 +1342,17 @@ trace_context_transfer_unmap(struct pipe_context *_context,
        */
 
       struct pipe_resource *resource = transfer->resource;
-      struct pipe_subresource sr = transfer->sr;
+      unsigned level = transfer->level;
       unsigned usage = transfer->usage;
       const struct pipe_box *box = &transfer->box;
       unsigned stride = transfer->stride;
-      unsigned slice_stride = transfer->slice_stride;
+      unsigned layer_stride = transfer->layer_stride;
 
       trace_dump_call_begin("pipe_context", "transfer_inline_write");
 
       trace_dump_arg(ptr, context);
       trace_dump_arg(ptr, resource);
-      trace_dump_arg_struct(subresource, sr);
+      trace_dump_arg(uint, level);
       trace_dump_arg(uint, usage);
       trace_dump_arg(box, box);
 
@@ -1306,11 +1361,11 @@ trace_context_transfer_unmap(struct pipe_context *_context,
                            resource->format,
                            box,
                            stride,
-                           slice_stride);
+                           layer_stride);
       trace_dump_arg_end();
 
       trace_dump_arg(uint, stride);
-      trace_dump_arg(uint, slice_stride);
+      trace_dump_arg(uint, layer_stride);
 
       trace_dump_call_end();
 
@@ -1323,13 +1378,13 @@ trace_context_transfer_unmap(struct pipe_context *_context,
 
 static void
 trace_context_transfer_inline_write(struct pipe_context *_context,
-                                   struct pipe_resource *_resource,
-                                   struct pipe_subresource sr,
-                                   unsigned usage,
-                                   const struct pipe_box *box,
-                                   const void *data,
-                                   unsigned stride,
-                                   unsigned slice_stride)
+                                    struct pipe_resource *_resource,
+                                    unsigned level,
+                                    unsigned usage,
+                                    const struct pipe_box *box,
+                                    const void *data,
+                                    unsigned stride,
+                                    unsigned layer_stride)
 {
    struct trace_context *tr_context = trace_context(_context);
    struct trace_resource *tr_tex = trace_resource(_resource);
@@ -1342,7 +1397,7 @@ trace_context_transfer_inline_write(struct pipe_context *_context,
 
    trace_dump_arg(ptr, context);
    trace_dump_arg(ptr, resource);
-   trace_dump_arg_struct(subresource, sr);
+   trace_dump_arg(uint, level);
    trace_dump_arg(uint, usage);
    trace_dump_arg(box, box);
 
@@ -1351,16 +1406,16 @@ trace_context_transfer_inline_write(struct pipe_context *_context,
                         resource->format,
                         box,
                         stride,
-                        slice_stride);
+                        layer_stride);
    trace_dump_arg_end();
 
    trace_dump_arg(uint, stride);
-   trace_dump_arg(uint, slice_stride);
+   trace_dump_arg(uint, layer_stride);
 
    trace_dump_call_end();
 
    context->transfer_inline_write(context, resource,
-                                 sr, usage, box, data, stride, slice_stride);
+                                  level, usage, box, data, stride, layer_stride);
 }
 
 
@@ -1434,6 +1489,8 @@ trace_context_create(struct trace_screen *tr_scr,
    tr_ctx->base.set_vertex_sampler_views = trace_context_set_vertex_sampler_views;
    tr_ctx->base.create_sampler_view = trace_create_sampler_view;
    tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy;
+   tr_ctx->base.create_surface = trace_create_surface;
+   tr_ctx->base.surface_destroy = trace_surface_destroy;
    tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers;
    tr_ctx->base.set_index_buffer = trace_context_set_index_buffer;
    tr_ctx->base.resource_copy_region = trace_context_resource_copy_region;
index 8f816060324d50558940d1ccc5165cc97d29c5b2..155c869fbd95652725ec7e5868025b3bf9e4649d 100644 (file)
@@ -71,6 +71,10 @@ void trace_dump_resource_template(const struct pipe_resource *templat)
    trace_dump_uint(templat->depth0);
    trace_dump_member_end();
 
+   trace_dump_member_begin("array_size");
+   trace_dump_uint(templat->array_size);
+   trace_dump_member_end();
+
    trace_dump_member(uint, templat, last_level);
    trace_dump_member(uint, templat, usage);
    trace_dump_member(uint, templat, bind);
@@ -80,25 +84,6 @@ void trace_dump_resource_template(const struct pipe_resource *templat)
 }
 
 
-void trace_dump_subresource(const struct pipe_subresource *subresource)
-{
-   if (!trace_dumping_enabled_locked())
-      return;
-
-   if(!subresource) {
-      trace_dump_null();
-      return;
-   }
-
-   trace_dump_struct_begin("pipe_subresource");
-
-   trace_dump_member(uint, subresource, face);
-   trace_dump_member(uint, subresource, level);
-
-   trace_dump_struct_end();
-}
-
-
 void trace_dump_box(const struct pipe_box *box)
 {
    if (!trace_dumping_enabled_locked())
@@ -445,8 +430,13 @@ void trace_dump_sampler_view_template(const struct pipe_sampler_view *state)
    trace_dump_struct_begin("pipe_sampler_view");
 
    trace_dump_member(format, state, format);
-   trace_dump_member(uint, state, first_level);
-   trace_dump_member(uint, state, last_level);
+   /* XXX */
+   trace_dump_member(uint, state, u.tex.first_level);
+   trace_dump_member(uint, state, u.tex.last_level);
+   trace_dump_member(uint, state, u.tex.first_layer);
+   trace_dump_member(uint, state, u.tex.last_layer);
+   trace_dump_member(uint, state, u.buf.first_element);
+   trace_dump_member(uint, state, u.buf.last_element);
    trace_dump_member(uint, state, swizzle_r);
    trace_dump_member(uint, state, swizzle_g);
    trace_dump_member(uint, state, swizzle_b);
@@ -472,14 +462,14 @@ void trace_dump_surface(const struct pipe_surface *state)
    trace_dump_member(uint, state, width);
    trace_dump_member(uint, state, height);
 
-   trace_dump_member(uint, state, layout);
-   trace_dump_member(uint, state, offset);
    trace_dump_member(uint, state, usage);
 
    trace_dump_member(ptr, state, texture);
-   trace_dump_member(uint, state, face);
-   trace_dump_member(uint, state, level);
-   trace_dump_member(uint, state, zslice);
+   trace_dump_member(uint, state, u.tex.level);
+   trace_dump_member(uint, state, u.tex.first_layer);
+   trace_dump_member(uint, state, u.tex.last_layer);
+   trace_dump_member(uint, state, u.buf.first_element);
+   trace_dump_member(uint, state, u.buf.last_element);
 
    trace_dump_struct_end();
 }
@@ -497,16 +487,18 @@ void trace_dump_transfer(const struct pipe_transfer *state)
 
    trace_dump_struct_begin("pipe_transfer");
 
+   trace_dump_member(uint, state, box.x);
+   trace_dump_member(uint, state, box.y);
+   trace_dump_member(uint, state, box.z);
    trace_dump_member(uint, state, box.width);
    trace_dump_member(uint, state, box.height);
+   trace_dump_member(uint, state, box.depth);
 
    trace_dump_member(uint, state, stride);
+   trace_dump_member(uint, state, layer_stride);
    trace_dump_member(uint, state, usage);
 
    trace_dump_member(ptr, state, resource);
-   trace_dump_member(uint, state, sr.face);
-   trace_dump_member(uint, state, sr.level);
-   trace_dump_member(uint, state, box.z);
 
    trace_dump_struct_end();
 }
index 078d20861096fc0fba8930da497f8bf8c336cde3..fe8ece78d437e00bbd9535fb31ca6bb139491e2d 100644 (file)
@@ -37,8 +37,6 @@ void trace_dump_format(enum pipe_format format);
 
 void trace_dump_resource_template(const struct pipe_resource *templat);
 
-void trace_dump_subresource(const struct pipe_subresource *subresource);
-
 void trace_dump_box(const struct pipe_box *box);
 
 void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
index 935831071e62dd34a07e93874cc6b95b98ccb91d..c2de2daa883bba8d35e40f5f59dbf9bc5c782d3e 100644 (file)
@@ -210,23 +210,26 @@ trace_screen_context_create(struct pipe_screen *_screen, void *priv)
 
 static void
 trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                               struct pipe_surface *_surface,
+                               struct pipe_resource *_resource,
+                               unsigned level, unsigned layer,
                                void *context_private)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_surface *tr_surf = trace_surface(_surface);
+   struct trace_resource *tr_res = trace_resource(_resource);
    struct pipe_screen *screen = tr_scr->screen;
-   struct pipe_surface *surface = tr_surf->surface;
+   struct pipe_resource *resource = tr_res->resource;
 
    trace_dump_call_begin("pipe_screen", "flush_frontbuffer");
 
    trace_dump_arg(ptr, screen);
-   trace_dump_arg(ptr, surface);
+   trace_dump_arg(ptr, resource);
+   trace_dump_arg(uint, level);
+   trace_dump_arg(uint, layer);
    /* XXX: hide, as there is nothing we can do with this
    trace_dump_arg(ptr, context_private);
    */
 
-   screen->flush_frontbuffer(screen, surface, context_private);
+   screen->flush_frontbuffer(screen, resource, level, layer, context_private);
 
    trace_dump_call_end();
 }
@@ -318,68 +321,6 @@ trace_screen_resource_destroy(struct pipe_screen *_screen,
 }
 
 
-/********************************************************************
- * surface
- */
-
-
-static struct pipe_surface *
-trace_screen_get_tex_surface(struct pipe_screen *_screen,
-                             struct pipe_resource *_texture,
-                             unsigned face, unsigned level,
-                             unsigned zslice,
-                             unsigned usage)
-{
-   struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_resource *tr_tex = trace_resource(_texture);
-   struct pipe_screen *screen = tr_scr->screen;
-   struct pipe_resource *texture = tr_tex->resource;
-   struct pipe_surface *result = NULL;
-
-   assert(texture->screen == screen);
-
-   trace_dump_call_begin("pipe_screen", "get_tex_surface");
-
-   trace_dump_arg(ptr, screen);
-   trace_dump_arg(ptr, texture);
-   trace_dump_arg(uint, face);
-   trace_dump_arg(uint, level);
-   trace_dump_arg(uint, zslice);
-   trace_dump_arg(uint, usage);
-
-   result = screen->get_tex_surface(screen, texture, face, level, zslice, usage);
-
-   trace_dump_ret(ptr, result);
-
-   trace_dump_call_end();
-
-   result = trace_surface_create(tr_tex, result);
-
-   return result;
-}
-
-
-static void
-trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
-{
-   struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
-   struct trace_surface *tr_surf = trace_surface(_surface);
-   struct pipe_screen *screen = tr_scr->screen;
-   struct pipe_surface *surface = tr_surf->surface;
-
-   trace_dump_call_begin("pipe_screen", "tex_surface_destroy");
-
-   trace_dump_arg(ptr, screen);
-   trace_dump_arg(ptr, surface);
-
-   trace_dump_call_end();
-
-   trace_surface_destroy(tr_surf);
-}
-
-
-
-
 
 /********************************************************************
  * buffer
@@ -580,8 +521,6 @@ trace_screen_create(struct pipe_screen *screen)
    tr_scr->base.resource_from_handle = trace_screen_resource_from_handle;
    tr_scr->base.resource_get_handle = trace_screen_resource_get_handle;
    tr_scr->base.resource_destroy = trace_screen_resource_destroy;
-   tr_scr->base.get_tex_surface = trace_screen_get_tex_surface;
-   tr_scr->base.tex_surface_destroy = trace_screen_tex_surface_destroy;
    tr_scr->base.user_buffer_create = trace_screen_user_buffer_create;
    tr_scr->base.fence_reference = trace_screen_fence_reference;
    tr_scr->base.fence_signalled = trace_screen_fence_signalled;
index 9914b98b39cd17e75cff76e133b180438b895f9d..2799734647104c7470ec434fe06982065c2e786b 100644 (file)
@@ -74,8 +74,8 @@ trace_resource_destroy(struct trace_screen *tr_scr,
 
 
 struct pipe_surface *
-trace_surface_create(struct trace_resource *tr_tex,
-                     struct pipe_surface *surface)
+trace_surf_create(struct trace_resource *tr_tex,
+                  struct pipe_surface *surface)
 {
    struct trace_surface *tr_surf;
 
@@ -104,7 +104,7 @@ error:
 
 
 void
-trace_surface_destroy(struct trace_surface *tr_surf)
+trace_surf_destroy(struct trace_surface *tr_surf)
 {
    pipe_resource_reference(&tr_surf->base.texture, NULL);
    pipe_surface_reference(&tr_surf->surface, NULL);
index 6513995d505213a8ae879cedb44874f5790f4e2b..3352c96e59ab021293e427ca2cf3108a1342ecdb 100644 (file)
@@ -125,11 +125,11 @@ trace_resource_destroy(struct trace_screen *tr_scr,
                       struct trace_resource *tr_tex);
 
 struct pipe_surface *
-trace_surface_create(struct trace_resource *tr_tex,
+trace_surf_create(struct trace_resource *tr_tex,
                      struct pipe_surface *surface);
 
 void
-trace_surface_destroy(struct trace_surface *tr_surf);
+trace_surf_destroy(struct trace_surface *tr_surf);
 
 struct pipe_transfer *
 trace_transfer_create(struct trace_context *tr_ctx,
index 0e53aef6d2e277f318f1e81907920f557b5d737b..589cac2ddd3b85da1621fed21168a49ded05f01f 100644 (file)
@@ -54,7 +54,6 @@ struct pipe_scissor_state;
 struct pipe_shader_state;
 struct pipe_stencil_ref;
 struct pipe_stream_output_state;
-struct pipe_subresource;
 struct pipe_surface;
 struct pipe_vertex_buffer;
 struct pipe_vertex_element;
@@ -256,12 +255,11 @@ struct pipe_context {
     */
    void (*resource_copy_region)(struct pipe_context *pipe,
                                 struct pipe_resource *dst,
-                                struct pipe_subresource subdst,
+                                unsigned dst_level,
                                 unsigned dstx, unsigned dsty, unsigned dstz,
                                 struct pipe_resource *src,
-                                struct pipe_subresource subsrc,
-                                unsigned srcx, unsigned srcy, unsigned srcz,
-                                unsigned width, unsigned height);
+                                unsigned src_level,
+                                const struct pipe_box *src_box);
 
    /**
     * Resolve a multisampled resource into a non-multisampled one.
@@ -269,9 +267,9 @@ struct pipe_context {
     */
    void (*resource_resolve)(struct pipe_context *pipe,
                             struct pipe_resource *dst,
-                            struct pipe_subresource subdst,
+                            unsigned dst_layer,
                             struct pipe_resource *src,
-                            struct pipe_subresource subsrc);
+                            unsigned src_layer);
 
    /*@}*/
 
@@ -328,13 +326,13 @@ struct pipe_context {
     * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
     * \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.
+    * \param layer  cubemap face, 2d array or 3d slice, 0 otherwise. Use -1 for any layer.
     * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
     */
    unsigned int (*is_resource_referenced)(struct pipe_context *pipe,
-                                         struct pipe_resource *texture,
-                                         unsigned face, unsigned level);
+                                          struct pipe_resource *texture,
+                                          unsigned level, int layer);
 
    /**
     * Create a view on a texture to be used by a shader stage.
@@ -347,6 +345,18 @@ struct pipe_context {
                                 struct pipe_sampler_view *view);
 
 
+   /**
+    * Get a surface which is a "view" into a resource, used by
+    * render target / depth stencil stages.
+    * \param usage  bitmaks of PIPE_BIND_* flags
+    */
+   struct pipe_surface *(*create_surface)(struct pipe_context *ctx,
+                                          struct pipe_resource *resource,
+                                          const struct pipe_surface *templat);
+
+   void (*surface_destroy)(struct pipe_context *ctx,
+                           struct pipe_surface *);
+
    /**
     * Get a transfer object for transferring data to/from a texture.
     *
@@ -354,14 +364,14 @@ struct pipe_context {
     * interleaved with
     */
    struct pipe_transfer *(*get_transfer)(struct pipe_context *,
-                                        struct pipe_resource *resource,
-                                        struct pipe_subresource,
-                                        unsigned usage,  /* a combination of PIPE_TRANSFER_x */
-                                        const struct pipe_box *);
+                                         struct pipe_resource *resource,
+                                         unsigned level,
+                                         unsigned usage,  /* a combination of PIPE_TRANSFER_x */
+                                         const struct pipe_box *);
 
    void (*transfer_destroy)(struct pipe_context *,
-                                struct pipe_transfer *);
-   
+                            struct pipe_transfer *);
+
    void *(*transfer_map)( struct pipe_context *,
                           struct pipe_transfer *transfer );
 
@@ -381,13 +391,13 @@ struct pipe_context {
     * pointer.  XXX: strides??
     */
    void (*transfer_inline_write)( struct pipe_context *,
-                                 struct pipe_resource *,
-                                 struct pipe_subresource,
-                                 unsigned usage, /* a combination of PIPE_TRANSFER_x */
-                                 const struct pipe_box *,
-                                 const void *data,
-                                 unsigned stride,
-                                 unsigned slice_stride);
+                                  struct pipe_resource *,
+                                  unsigned level,
+                                  unsigned usage, /* a combination of PIPE_TRANSFER_x */
+                                  const struct pipe_box *,
+                                  const void *data,
+                                  unsigned stride,
+                                  unsigned layer_stride);
 
 };
 
index 9f2b081e33a4a961e84af37714f0a9c1da1f7892..2135c19dcfcec67525accbaa97066a15ccef07c0 100644 (file)
@@ -138,12 +138,14 @@ enum pipe_error {
 /** Texture types.
  * See the documentation for info on PIPE_TEXTURE_RECT vs PIPE_TEXTURE_2D */
 enum pipe_texture_target {
-   PIPE_BUFFER       = 0,
-   PIPE_TEXTURE_1D   = 1,
-   PIPE_TEXTURE_2D   = 2,
-   PIPE_TEXTURE_3D   = 3,
-   PIPE_TEXTURE_CUBE = 4,
-   PIPE_TEXTURE_RECT = 5,
+   PIPE_BUFFER           = 0,
+   PIPE_TEXTURE_1D       = 1,
+   PIPE_TEXTURE_2D       = 2,
+   PIPE_TEXTURE_3D       = 3,
+   PIPE_TEXTURE_CUBE     = 4,
+   PIPE_TEXTURE_RECT     = 5,
+   PIPE_TEXTURE_1D_ARRAY = 6,
+   PIPE_TEXTURE_2D_ARRAY = 7,
    PIPE_MAX_TEXTURE_TYPES
 };
 
@@ -178,14 +180,6 @@ enum pipe_texture_target {
 #define PIPE_TEX_COMPARE_NONE          0
 #define PIPE_TEX_COMPARE_R_TO_TEXTURE  1
 
-
-/**
- * Surface layout -- a hint?  Or some driver-internal poking out into
- * the interface?
- */
-#define PIPE_SURFACE_LAYOUT_LINEAR  0
-
-
 /**
  * Clear buffer bits
  */
@@ -281,9 +275,9 @@ enum pipe_transfer_usage {
  * Resource binding flags -- state tracker must specify in advance all
  * the ways a resource might be used.
  */
-#define PIPE_BIND_DEPTH_STENCIL        (1 << 0) /* get_tex_surface */
-#define PIPE_BIND_RENDER_TARGET        (1 << 1) /* get_tex_surface */
-#define PIPE_BIND_SAMPLER_VIEW         (1 << 2) /* get_sampler_view */
+#define PIPE_BIND_DEPTH_STENCIL        (1 << 0) /* create_surface */
+#define PIPE_BIND_RENDER_TARGET        (1 << 1) /* create_surface */
+#define PIPE_BIND_SAMPLER_VIEW         (1 << 2) /* create_sampler_view */
 #define PIPE_BIND_VERTEX_BUFFER        (1 << 3) /* set_vertex_buffers */
 #define PIPE_BIND_INDEX_BUFFER         (1 << 4) /* draw_elements */
 #define PIPE_BIND_CONSTANT_BUFFER      (1 << 5) /* set_constant_buffer */
@@ -461,6 +455,7 @@ enum pipe_cap {
    /** different blend funcs per rendertarget */
    PIPE_CAP_INDEP_BLEND_FUNC,
    PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE,
+   PIPE_CAP_ARRAY_TEXTURES,
    PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT,
    PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
    PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
index 22cc7aa18a25fc2f5cb65c646c9b5af0cb6d57ff..74a9939df7315a82abdd8a4192dde4c11fd0a8f9 100644 (file)
@@ -190,6 +190,12 @@ enum pipe_format {
    PIPE_FORMAT_X24S8_USCALED           = 136,
    PIPE_FORMAT_S8X24_USCALED           = 137,
    PIPE_FORMAT_X32_S8X24_USCALED       = 138,
+
+   PIPE_FORMAT_B2G3R3_UNORM            = 139,
+   PIPE_FORMAT_L16A16_UNORM            = 140,
+   PIPE_FORMAT_A16_UNORM               = 141,
+   PIPE_FORMAT_I16_UNORM               = 142,
+
    PIPE_FORMAT_COUNT
 };
 
index 912631242f51ba52734ee5e06b8d646838374b76..850eb84a3c8f59728908ad076bc7fc7d988fe9e6 100644 (file)
@@ -117,7 +117,7 @@ struct pipe_screen {
    /**
     * Create a texture from a winsys_handle. The handle is often created in
     * another process by first creating a pipe texture and then calling
-    * texture_get_handle.
+    * resource_get_handle.
     */
    struct pipe_resource * (*resource_from_handle)(struct pipe_screen *,
                                                  const struct pipe_resource *templat,
@@ -136,18 +136,6 @@ struct pipe_screen {
    void (*resource_destroy)(struct pipe_screen *,
                            struct pipe_resource *pt);
 
-   /** Get a 2D surface which is a "view" into a texture
-    * \param usage  bitmaks of PIPE_BIND_* flags
-    */
-   struct pipe_surface *(*get_tex_surface)(struct pipe_screen *,
-                                           struct pipe_resource *resource,
-                                           unsigned face, unsigned level,
-                                           unsigned zslice,
-                                           unsigned usage );
-
-   void (*tex_surface_destroy)(struct pipe_surface *);
-   
-
 
    /**
     * Create a buffer that wraps user-space data.
@@ -182,7 +170,8 @@ struct pipe_screen {
     *                                gets out-of-band
     */
    void (*flush_frontbuffer)( struct pipe_screen *screen,
-                              struct pipe_surface *surf,
+                              struct pipe_resource *resource,
+                              unsigned level, unsigned layer,
                               void *winsys_drawable_handle );
 
 
index ba433b2bd2aa7928a8565e618f0398aa43e897bb..0a9e14154d732a942ef3bac40f46def92aa0b25e 100644 (file)
@@ -177,7 +177,8 @@ union tgsi_immediate_data
 #define TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES 2
 #define TGSI_PROPERTY_FS_COORD_ORIGIN        3
 #define TGSI_PROPERTY_FS_COORD_PIXEL_CENTER  4
-#define TGSI_PROPERTY_COUNT                  5
+#define TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS 5
+#define TGSI_PROPERTY_COUNT                  6
 
 struct tgsi_property {
    unsigned Type         : 4;  /**< TGSI_TOKEN_TYPE_PROPERTY */
index fc6dba346daef50e81359cd06e50f2ff0a4ff797..226ae8667b703d17f12cbb920f9fd2914a1ab1c9 100644 (file)
@@ -271,25 +271,33 @@ struct pipe_sampler_state
 
 
 /**
- * 2D surface.  This is basically a view into a memory buffer.
- * May be a renderbuffer, texture mipmap level, etc.
+ * A view into a texture that can be bound to a color render target /
+ * depth stencil attachment point.
  */
 struct pipe_surface
 {
    struct pipe_reference reference;
    struct pipe_resource *texture; /**< resource into which this is a view  */
+   struct pipe_context *context; /**< context this view belongs to */
    enum pipe_format format;
 
+   /* XXX width/height should be removed */
    unsigned width;               /**< logical width in pixels */
    unsigned height;              /**< logical height in pixels */
 
-   unsigned layout;              /**< PIPE_SURFACE_LAYOUT_x */
-   unsigned offset;              /**< offset from start of buffer, in bytes */
    unsigned usage;               /**< bitmask of PIPE_BIND_x */
 
-   unsigned zslice;
-   unsigned face;
-   unsigned level;
+   union {
+      struct {
+         unsigned level;
+         unsigned first_layer:16;
+         unsigned last_layer:16;
+      } tex;
+      struct {
+         unsigned first_element;
+         unsigned last_element;
+      } buf;
+   } u;
 };
 
 
@@ -302,8 +310,18 @@ struct pipe_sampler_view
    enum pipe_format format;      /**< typed PIPE_FORMAT_x */
    struct pipe_resource *texture; /**< texture into which this is a view  */
    struct pipe_context *context; /**< context this view belongs to */
-   unsigned first_level:8;       /**< first mipmap level */
-   unsigned last_level:8;        /**< last mipmap level */
+   union {
+      struct {
+         unsigned first_layer:16;     /**< first layer to use for array textures */
+         unsigned last_layer:16;      /**< last layer to use for array textures */
+         unsigned first_level:8;      /**< first mipmap level to use */
+         unsigned last_level:8;       /**< last mipmap level to use */
+      } tex;
+      struct {
+         unsigned first_element;
+         unsigned last_element;
+      } buf;
+   } u;
    unsigned swizzle_r:3;         /**< PIPE_SWIZZLE_x for red component */
    unsigned swizzle_g:3;         /**< PIPE_SWIZZLE_x for green component */
    unsigned swizzle_b:3;         /**< PIPE_SWIZZLE_x for blue component */
@@ -338,13 +356,14 @@ struct pipe_resource
    unsigned width0;
    unsigned height0;
    unsigned depth0;
+   unsigned array_size;
 
    unsigned last_level:8;    /**< Index of last mipmap level present/defined */
    unsigned nr_samples:8;    /**< for multisampled surfaces, nr of samples */
    unsigned usage:8;         /**< PIPE_USAGE_x (not a bitmask) */
 
-   unsigned bind;           /**< bitmask of PIPE_BIND_x */
-   unsigned flags;          /**< bitmask of PIPE_RESOURCE_FLAG_x */
+   unsigned bind;            /**< bitmask of PIPE_BIND_x */
+   unsigned flags;           /**< bitmask of PIPE_RESOURCE_FLAG_x */
 };
 
 struct pipe_stream_output_state
@@ -363,15 +382,6 @@ struct pipe_stream_output_state
    unsigned stride;
 };
 
-/**
- * Extra indexing info for (cube) texture resources.
- */
-struct pipe_subresource
-{
-   unsigned face:16;
-   unsigned level:16;
-};
-
 
 /**
  * Transfer object.  For data transfer to/from a resource.
@@ -379,11 +389,11 @@ struct pipe_subresource
 struct pipe_transfer
 {
    struct pipe_resource *resource; /**< resource to transfer to/from  */
-   struct pipe_subresource sr;
+   unsigned level;
    enum pipe_transfer_usage usage;
    struct pipe_box box;
    unsigned stride;
-   unsigned slice_stride;
+   unsigned layer_stride;
    void *data;
 };
 
index 565a09614a4479ec5cd4734c1deaac0cb48ebf7d..1c2148b78f23d459960a63e829c5114f70bb6f35 100644 (file)
@@ -164,9 +164,8 @@ struct st_egl_image
    /* this is owned by the caller */
    struct pipe_resource *texture;
 
-   unsigned face;
    unsigned level;
-   unsigned zslice;
+   unsigned layer;
 };
 
 /**
index f22c22bb620216ab15bf11027f719de24231b915..4e7ccc13ac885c7f0196ece41c79538edc72e01f 100644 (file)
@@ -6,7 +6,7 @@
 
 
 struct pipe_screen;
-struct pipe_surface;
+struct pipe_resource;
 
 /* This is what the xlib software winsys expects to find in the
  * "private" field of flush_frontbuffers().
index c246fc5ef7616b0d6d5ed32cb35bf4d4ed79d68e..a54324a04f2eb1e4074fe7b1b91faee461bf2ec0 100644 (file)
@@ -1159,8 +1159,15 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
                        unsigned blit_x, blit_y, blit_w, blit_h;
                        float black[4] = {0, 0, 0, 0};
 
-                       if(!formats_compatible || src->width0 != dst_w || src->height0 != dst_h)
-                               dst_surface = pipe->screen->get_tex_surface(pipe->screen, dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+                       if(!formats_compatible || src->width0 != dst_w || src->height0 != dst_h) {
+                               struct pipe_surface templat;
+                               templat.usage = PIPE_BIND_RENDER_TARGET;
+                               templat.format = dst->format;
+                               templat.u.tex.level = 0;
+                               templat.u.tex.first_layer = 0;
+                               templat.u.tex.last_layer = 0;
+                               dst_surface = pipe->create_surface(pipe, dst, &templat);
+                       }
 
                        if(preserve_aspect_ratio)
                        {
@@ -1199,10 +1206,12 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
 
                        if(formats_compatible && blit_w == src->width0 && blit_h == src->height0)
                        {
-                               pipe_subresource sr;
-                               sr.face = 0;
-                               sr.level = 0;
-                               pipe->resource_copy_region(pipe, dst, sr, rect.left, rect.top, 0, src, sr, 0, 0, 0, blit_w, blit_h);
+                               pipe_box box;
+                               box.x = box.y = box.z;
+                               box.width = blit_w;
+                               box.height = blit_h;
+                               box.z = 1;
+                               pipe->resource_copy_region(pipe, dst, 0, rect.left, rect.top, 0, src, 0, &box);
                        }
                        else
                        {
@@ -1218,7 +1227,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
                }
 
                if(dst_surface)
-                       pipe->screen->tex_surface_destroy(dst_surface);
+                       pipe->surface_destroy(pipe, dst_surface);
 
                pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, 0);
 
index 36110595c206fb4288741cb6a180c79def4780d7..e1ba6c184fdc9a939afa19e41f9f00efcf6ef8d9 100644 (file)
@@ -1416,23 +1416,33 @@ changed:
                        *out_predicate_value = render_predicate_value;
        }
 
-       static pipe_subresource d3d11_to_pipe_subresource(struct pipe_resource* resource, unsigned subresource)
+       static unsigned d3d11_subresource_to_level(struct pipe_resource* resource, unsigned subresource)
        {
-               pipe_subresource sr;
                if(subresource <= resource->last_level)
                {
-                       sr.level = subresource;
-                       sr.face = 0;
+                       return subresource;
                }
                else
                {
                        unsigned levels = resource->last_level + 1;
-                       sr.level = subresource % levels;
-                       sr.face = subresource / levels;
+                       return subresource % levels;
                }
-               return sr;
        }
 
+       static unsigned d3d11_subresource_to_face(struct pipe_resource* resource, unsigned subresource)
+       {
+               if(subresource <= resource->last_level)
+               {
+                       return 0;
+               }
+               else
+               {
+                       unsigned levels = resource->last_level + 1;
+                       return subresource / levels;
+               }
+       }
+               
+       
        /* TODO: deferred contexts will need a different implementation of this,
         * because we can't put the transfer info into the resource itself.
         * Also, there are very different restrictions, for obvious reasons.
@@ -1448,8 +1458,10 @@ changed:
                GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)iresource;
                if(resource->transfers.count(subresource))
                        return E_FAIL;
-               pipe_subresource sr = d3d11_to_pipe_subresource(resource->resource, subresource);
-               pipe_box box = d3d11_to_pipe_box(resource->resource, sr.level, 0);
+               unsigned level = d3d11_subresource_to_level(resource->resource, subresource);
+               unsigned face = d3d11_subresource_to_face(resource->resource, subresource);
+               pipe_box box = d3d11_to_pipe_box(resource->resource, level, 0);
+               /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
                unsigned usage = 0;
                if(map_type == D3D11_MAP_READ)
                        usage = PIPE_TRANSFER_READ;
@@ -1465,7 +1477,7 @@ changed:
                        return E_INVALIDARG;
                if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT)
                        usage |= PIPE_TRANSFER_DONTBLOCK;
-               struct pipe_transfer* transfer = pipe->get_transfer(pipe, resource->resource, sr, usage, &box);
+               struct pipe_transfer* transfer = pipe->get_transfer(pipe, resource->resource, level, usage, &box);
                if(!transfer) {
                        if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT)
                                return DXGI_ERROR_WAS_STILL_DRAWING;
@@ -1475,7 +1487,7 @@ changed:
                resource->transfers[subresource] = transfer;
                mapped_resource->pData = pipe->transfer_map(pipe, transfer);
                mapped_resource->RowPitch = transfer->stride;
-               mapped_resource->DepthPitch = transfer->slice_stride;
+               mapped_resource->DepthPitch = transfer->layer_stride;
                return S_OK;
        }
 
@@ -1507,15 +1519,16 @@ changed:
                SYNCHRONIZED;
                GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
                GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource;
-               pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource);
-               pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, src_subresource);
-               pipe_box box = d3d11_to_pipe_box(src->resource, subsrc.level, src_box);
-               for(unsigned i = 0; i < box.depth; ++i)
+               unsigned dst_level = d3d11_subresource_to_level(dst->resource, dst_subresource);
+               unsigned dst_face = d3d11_subresource_to_face(dst->resource, dst_subresource);
+               unsigned src_level = d3d11_subresource_to_level(src->resource, src_subresource);
+               unsigned src_face = d3d11_subresource_to_face(src->resource, src_subresource);
+               /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
+               pipe_box box = d3d11_to_pipe_box(src->resource, src_level, src_box);
                {
                        pipe->resource_copy_region(pipe,
-                               dst->resource, subdst, dst_x, dst_y, dst_z + i,
-                               src->resource, subsrc, box.x, box.y, box.z + i,
-                               box.width, box.height);
+                               dst->resource, dst_level, dst_x, dst_y, dst_z,
+                               src->resource, src_level, &box);
                }
        }
 
@@ -1526,24 +1539,23 @@ changed:
                SYNCHRONIZED;
                GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
                GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource;
-               pipe_subresource sr;
-               unsigned faces = dst->resource->target == PIPE_TEXTURE_CUBE ? 6 : 1;
-
-               for(sr.face = 0; sr.face < faces; ++sr.face)
+               unsigned level;
+               for(level = 0; level <= dst->resource->last_level; ++level)
                {
-                       for(sr.level = 0; sr.level <= dst->resource->last_level; ++sr.level)
-                       {
-                               unsigned w = u_minify(dst->resource->width0, sr.level);
-                               unsigned h = u_minify(dst->resource->height0, sr.level);
-                               unsigned d = u_minify(dst->resource->depth0, sr.level);
-                               for(unsigned i = 0; i < d; ++i)
-                               {
-                                       pipe->resource_copy_region(pipe,
-                                                       dst->resource, sr, 0, 0, i,
-                                                       src->resource, sr, 0, 0, i,
-                                                       w, h);
-                               }
-                       }
+                       unsigned layers = 1;
+                       pipe_box box;
+                       if (dst->resource->target == PIPE_TEXTURE_CUBE)
+                               layers = 6;
+                       else if (dst->resource->target == PIPE_TEXTURE_3D)
+                               layers = u_minify(dst->resource->depth0, level);
+                       /* else layers = dst->resource->array_size; */
+                       box.x = box.y = box.z = 0;
+                       box.width = u_minify(dst->resource->width0, level);
+                       box.height = u_minify(dst->resource->height0, level);
+                       box.depth = layers;
+                       pipe->resource_copy_region(pipe,
+                                                  dst->resource, level, 0, 0, 0,
+                                                  src->resource, level, &box);
                }
        }
 
@@ -1557,9 +1569,10 @@ changed:
        {
                SYNCHRONIZED;
                GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
-               pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource);
-               pipe_box box = d3d11_to_pipe_box(dst->resource, subdst.level, pDstBox);
-               pipe->transfer_inline_write(pipe, dst->resource, subdst, PIPE_TRANSFER_WRITE, &box, pSrcData, src_row_pitch, src_depth_pitch);
+               unsigned dst_level = d3d11_subresource_to_level(dst->resource, dst_subresource);
+               /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
+               pipe_box box = d3d11_to_pipe_box(dst->resource, dst_level, pDstBox);
+               pipe->transfer_inline_write(pipe, dst->resource, dst_level, PIPE_TRANSFER_WRITE, &box, pSrcData, src_row_pitch, src_depth_pitch);
        }
 
 #if API >= 11
@@ -1714,9 +1727,9 @@ changed:
                SYNCHRONIZED;
                GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
                GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource;
-               pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource);
-               pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, src_subresource);
-               pipe->resource_resolve(pipe, dst->resource, subdst, src->resource, subsrc);
+               unsigned dst_layer = d3d11_subresource_to_face(dst->resource, dst_subresource);
+               unsigned src_layer = d3d11_subresource_to_face(src->resource, src_subresource);
+               pipe->resource_resolve(pipe, dst->resource, dst_layer, src->resource, src_layer);
        }
 
 #if API >= 11
index 95ea4e00fc18e5816a5b52ee312edce40d275d6b..9cfdc837d8e361cc12e50db5c4bd8469d0505e5b 100644 (file)
@@ -718,15 +718,13 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                        {
                                for(unsigned level = 0; level <= templat.last_level; ++level)
                                {
-                                       struct pipe_subresource sr;
-                                       sr.level = level;
-                                       sr.face = slice;
                                        struct pipe_box box;
-                                       box.x = box.y = box.z = 0;
+                                       box.x = box.y = 0;
+                                       box.z = slice;
                                        box.width = u_minify(width, level);
                                        box.height = u_minify(height, level);
-                                       box.depth = u_minify(depth, level);
-                                       immediate_pipe->transfer_inline_write(immediate_pipe, resource, sr, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | PIPE_TRANSFER_UNSYNCHRONIZED, &box, initial_data->pSysMem, initial_data->SysMemPitch, initial_data->SysMemSlicePitch);
+                                       box.depth = 1;
+                                       immediate_pipe->transfer_inline_write(immediate_pipe, resource, level, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | PIPE_TRANSFER_UNSYNCHRONIZED, &box, initial_data->pSysMem, initial_data->SysMemPitch, initial_data->SysMemSlicePitch);
                                        ++initial_data;
                                }
                        }
@@ -978,8 +976,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                case D3D11_SRV_DIMENSION_TEXTURE1DARRAY:
                case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
                        /* yes, this works for all of these types (but TODO: texture arrays) */
-                       templat.first_level = desc->Texture1D.MostDetailedMip;
-                       templat.last_level = templat.first_level + desc->Texture1D.MipLevels - 1;
+                       templat.u.tex.first_level = desc->Texture1D.MostDetailedMip;
+                       templat.u.tex.last_level = templat.u.tex.first_level + desc->Texture1D.MipLevels - 1;
                        break;
                case D3D11_SRV_DIMENSION_BUFFER:
                case D3D11_SRV_DIMENSION_TEXTURE2DMS:
@@ -1054,30 +1052,34 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                        desc = &def_desc;
                }
 
-               unsigned zslice = 0;
-               unsigned face = 0;
-               unsigned level;
-               enum pipe_format format;
+               struct pipe_surface templat;
+               memset(&templat, 0, sizeof(templat));
                if(invalid(desc->format >= DXGI_FORMAT_COUNT))
                        return E_INVALIDARG;
-               format = dxgi_to_pipe_format[desc->Format];
-               if(!format)
+               templat.format = dxgi_to_pipe_format[desc->Format];
+               if(!templat.format)
                        return E_NOTIMPL;
+               templat.usage = PIPE_BIND_RENDER_TARGET;
+               templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource;
 
                switch(desc->ViewDimension)
                {
                case D3D11_RTV_DIMENSION_TEXTURE1D:
                case D3D11_RTV_DIMENSION_TEXTURE2D:
-                       level = desc->Texture1D.MipSlice;
+                       templat.u.tex.level = desc->Texture1D.MipSlice;
                        break;
                case D3D11_RTV_DIMENSION_TEXTURE3D:
-                       level = desc->Texture3D.MipSlice;
-                       zslice = desc->Texture3D.FirstWSlice;
+                       templat.u.tex.level = desc->Texture3D.MipSlice;
+                       templat.u.tex.first_layer = desc->Texture3D.FirstWSlice;
+                       /* XXX FIXME */
+                       templat.u.tex.last_layer = desc->Texture3D.FirstWSlice;
                        break;
                case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
                case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
-                       level = desc->Texture1DArray.MipSlice;
-                       face = desc->Texture1DArray.FirstArraySlice;
+                       templat.u.tex.level = desc->Texture1DArray.MipSlice;
+                       templat.u.tex.first_layer = desc->Texture1DArray.FirstArraySlice;
+                       /* XXX FIXME */
+                       templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice;
                        break;
                case D3D11_RTV_DIMENSION_BUFFER:
                case D3D11_RTV_DIMENSION_TEXTURE2DMS:
@@ -1090,13 +1092,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                if(!out_rtv)
                        return S_FALSE;
 
-               struct pipe_surface* surface = screen->get_tex_surface(screen,
-                               ((GalliumD3D11Resource<>*)iresource)->resource,
-                               face, level, zslice, PIPE_BIND_RENDER_TARGET);
+               struct pipe_surface* surface = immediate_pipe->create_surface(immediate_pipe, templat.texture, &templat);
                if(!surface)
                        return E_FAIL;
-               /* muhahahahaha, let's hope this actually works */
-               surface->format = format;
                *out_rtv = new GalliumD3D11RenderTargetView(this, (GalliumD3D11Resource<>*)iresource, surface, *desc);
                return S_OK;
        }
@@ -1134,26 +1132,28 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                        desc = &def_desc;
                }
 
-               unsigned zslice = 0;
-               unsigned face = 0;
-               unsigned level;
-               enum pipe_format format;
+               struct pipe_surface templat;
+               memset(&templat, 0, sizeof(templat));
                if(invalid(desc->format >= DXGI_FORMAT_COUNT))
                        return E_INVALIDARG;
-               format = dxgi_to_pipe_format[desc->Format];
-               if(!format)
+               templat.format = dxgi_to_pipe_format[desc->Format];
+               if(!templat.format)
                        return E_NOTIMPL;
+               templat.usage = PIPE_BIND_DEPTH_STENCIL;
+               templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource;
 
                switch(desc->ViewDimension)
                {
                case D3D11_DSV_DIMENSION_TEXTURE1D:
                case D3D11_DSV_DIMENSION_TEXTURE2D:
-                       level = desc->Texture1D.MipSlice;
+                       templat.u.tex.level = desc->Texture1D.MipSlice;
                        break;
                case D3D11_DSV_DIMENSION_TEXTURE1DARRAY:
                case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
-                       level = desc->Texture1DArray.MipSlice;
-                       face = desc->Texture1DArray.FirstArraySlice;
+                       templat.u.tex.level = desc->Texture1DArray.MipSlice;
+                       templat.u.tex.first_layer = desc->Texture1DArray.FirstArraySlice;
+                       /* XXX FIXME */
+                       templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice;
                        break;
                case D3D11_DSV_DIMENSION_TEXTURE2DMS:
                case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
@@ -1165,13 +1165,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                if(!out_depth_stencil_view)
                        return S_FALSE;
 
-               struct pipe_surface* surface = screen->get_tex_surface(screen,
-                               ((GalliumD3D11Resource<>*)iresource)->resource,
-                               face, level, zslice, PIPE_BIND_DEPTH_STENCIL);
+               struct pipe_surface* surface = immediate_pipe->create_surface(immediate_pipe, templat.texture, &templat);
                if(!surface)
                        return E_FAIL;
-               /* muhahahahaha, let's hope this actually works */
-               surface->format = format;
                *out_depth_stencil_view = new GalliumD3D11DepthStencilView(this, (GalliumD3D11Resource<>*)iresource, surface, *desc);
                return S_OK;
        }
index 1302e9bc0134799dfc1b4174b799d5ff8904bdb5..f6e22c74b4e68fac3a7174c74c8f93d22241cd79 100644 (file)
@@ -304,9 +304,8 @@ dri_get_egl_image(struct st_manager *smapi,
 
    stimg->texture = NULL;
    pipe_resource_reference(&stimg->texture, img->texture);
-   stimg->face = img->face;
    stimg->level = img->level;
-   stimg->zslice = img->zslice;
+   stimg->layer = img->layer;
 
    return TRUE;
 }
index 0da9b5510fc55ed3568169a4cd13bcd090acfa58..8cb0a102c8d5e09cc3ece5a2ff83d58310fa68f3 100644 (file)
@@ -83,9 +83,8 @@ dri_screen(__DRIscreen * sPriv)
 
 struct __DRIimageRec {
    struct pipe_resource *texture;
-   unsigned face;
    unsigned level;
-   unsigned zslice;
+   unsigned layer;
 
    void *loader_private;
 };
index 3c5b0756174ab431878799fb4c0ce2a103b1ce87..a9d05a80fbd395c24c4b5c9115fe013ba378a299 100644 (file)
@@ -200,6 +200,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable,
    templ.width0 = dri_drawable->w;
    templ.height0 = dri_drawable->h;
    templ.depth0 = 1;
+   templ.array_size = 1;
 
    memset(&whandle, 0, sizeof(whandle));
 
@@ -348,6 +349,7 @@ dri2_create_image_from_name(__DRIscreen *_screen,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
 
    memset(&whandle, 0, sizeof(whandle));
    whandle.handle = name;
@@ -360,9 +362,8 @@ dri2_create_image_from_name(__DRIscreen *_screen,
       return NULL;
    }
 
-   img->face = 0;
    img->level = 0;
-   img->zslice = 0;
+   img->layer = 0;
    img->loader_private = loaderPrivate;
 
    return img;
@@ -430,9 +431,8 @@ dri2_create_image(__DRIscreen *_screen,
       return NULL;
    }
 
-   img->face = 0;
    img->level = 0;
-   img->zslice = 0;
+   img->layer = 0;
 
    img->loader_private = loaderPrivate;
    return img;
index c48cc4403674873b1eb68f3847391dc4a71348fc..30088b09685c940b9332029b377be596dd3897eb 100644 (file)
@@ -87,40 +87,17 @@ drisw_put_image(struct dri_drawable *drawable,
    put_image(dPriv, data, width, height);
 }
 
-static struct pipe_surface *
-drisw_get_pipe_surface(struct dri_drawable *drawable, struct pipe_resource *ptex)
-{
-   struct pipe_screen *pipe_screen = dri_screen(drawable->sPriv)->base.screen;
-   struct pipe_surface *psurf = drawable->drisw_surface;
-
-   if (!psurf || psurf->texture != ptex) {
-      pipe_surface_reference(&drawable->drisw_surface, NULL);
-
-      drawable->drisw_surface = pipe_screen->get_tex_surface(pipe_screen,
-            ptex, 0, 0, 0, 0/* no bind flag???*/);
-
-      psurf = drawable->drisw_surface;
-   }
-
-   return psurf;
-}
-
 static INLINE void
 drisw_present_texture(__DRIdrawable *dPriv,
                       struct pipe_resource *ptex)
 {
    struct dri_drawable *drawable = dri_drawable(dPriv);
    struct dri_screen *screen = dri_screen(drawable->sPriv);
-   struct pipe_surface *psurf;
 
    if (swrast_no_present)
       return;
 
-   psurf = drisw_get_pipe_surface(drawable, ptex);
-   if (!psurf)
-      return;
-
-   screen->base.screen->flush_frontbuffer(screen->base.screen, psurf, drawable);
+   screen->base.screen->flush_frontbuffer(screen->base.screen, ptex, 0, 0, drawable);
 }
 
 static INLINE void
@@ -220,6 +197,7 @@ drisw_allocate_textures(struct dri_drawable *drawable,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
 
    for (i = 0; i < count; i++) {
index 50c76819954c31b66140e3ff98ebc0e3d7b5909b..9ade76ecbb20fa6e3f2288d32997a02163652fb9 100644 (file)
@@ -10,11 +10,8 @@ env.Append(CPPPATH = [
     '#/src/gallium/winsys/sw',
     '.',
 ])
-env.Append(CPPDEFINES = [
-    'HAVE_GDI_BACKEND',
-])
 
-common_sources = [
+sources = [
     'common/egl_g3d.c',
     'common/egl_g3d_api.c',
     'common/egl_g3d_image.c',
@@ -23,12 +20,31 @@ common_sources = [
     'common/native_helper.c',
 ]
 
-gdi_sources = common_sources + [
-    'gdi/native_gdi.c',
-]
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = ['HAVE_GDI_BACKEND'])
+    sources.append('gdi/native_gdi.c')
+else:
+    if env['x11']:
+        env.Append(CPPDEFINES = ['HAVE_X11_BACKEND'])
+        env.Prepend(CPPPATH = [
+            '#/src/glx',
+            '#/src/mapi',
+        ])
+        sources.append([
+            'x11/native_x11.c',
+            'x11/native_dri2.c',
+            'x11/native_ximage.c',
+            'x11/x11_screen.c',
+            'x11/glxinit.c'])
+        if env['dri']:
+            env.Append(CPPDEFINES = ['GLX_DIRECT_RENDERING'])
+            sources.append(['#/src/glx/dri2.c'])
+    if env['drm']:
+        env.Append(CPPDEFINES = ['HAVE_DRM_BACKEND'])
+        sources.append(['drm/native_drm.c', 'drm/modeset.c'])
 
-st_egl_gdi = env.ConvenienceLibrary(
-    target = 'st_egl_gdi',
-    source = gdi_sources,
+st_egl = env.ConvenienceLibrary(
+    target = 'st_egl',
+    source = sources,
 )
-Export('st_egl_gdi')
+Export('st_egl')
index a3750ac56fb88035cc9512094a96c2c110b04a8b..9024f945b8cd774e12f3202a3fd4b8b9202bffe5 100644 (file)
 #include "egl_g3d_loader.h"
 #include "native.h"
 
+static void
+egl_g3d_invalid_surface(struct native_display *ndpy,
+                        struct native_surface *nsurf,
+                        unsigned int seq_num)
+{
+   /* XXX not thread safe? */
+   struct egl_g3d_surface *gsurf = egl_g3d_surface(nsurf->user_data);
+   struct egl_g3d_context *gctx;
+   
+   /*
+    * Some functions such as egl_g3d_copy_buffers create a temporary native
+    * surface.  There is no gsurf associated with it.
+    */
+   gctx = (gsurf) ? egl_g3d_context(gsurf->base.CurrentContext) : NULL;
+   if (gctx)
+      gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gsurf->stfbi);
+}
+
+static struct pipe_screen *
+egl_g3d_new_drm_screen(struct native_display *ndpy, const char *name, int fd)
+{
+   _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
+   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+   return gdpy->loader->create_drm_screen(name, fd);
+}
+
+static struct pipe_screen *
+egl_g3d_new_sw_screen(struct native_display *ndpy, struct sw_winsys *ws)
+{
+   _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
+   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+   return gdpy->loader->create_sw_screen(ws);
+}
+
+static struct native_event_handler egl_g3d_native_event_handler = {
+   egl_g3d_invalid_surface,
+   egl_g3d_new_drm_screen,
+   egl_g3d_new_sw_screen
+};
+
 /**
  * Get the native platform.
  */
@@ -79,7 +119,9 @@ egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
          break;
       }
 
-      if (!nplat)
+      if (nplat)
+         nplat->set_event_handler(&egl_g3d_native_event_handler);
+      else
          _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);
 
       gdrv->platforms[plat] = nplat;
@@ -183,17 +225,21 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
    }
 
    surface_type = 0x0;
-   if (nconf->window_bit)
-      surface_type |= EGL_WINDOW_BIT;
-   if (nconf->pixmap_bit)
-      surface_type |= EGL_PIXMAP_BIT;
+   /* pixmap surfaces should be EGL_SINGLE_BUFFER */
+   if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) {
+      if (nconf->pixmap_bit)
+         surface_type |= EGL_PIXMAP_BIT;
+   }
+   /* the others surfaces should be EGL_BACK_BUFFER (or settable) */
+   if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) {
+      if (nconf->window_bit)
+         surface_type |= EGL_WINDOW_BIT;
 #ifdef EGL_MESA_screen_surface
-   if (nconf->scanout_bit)
-      surface_type |= EGL_SCREEN_BIT_MESA;
+      if (nconf->scanout_bit)
+         surface_type |= EGL_SCREEN_BIT_MESA;
 #endif
-
-   if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT))
       surface_type |= EGL_PBUFFER_BIT;
+   }
 
    conf->Conformant = api_mask;
    conf->RenderableType = api_mask;
@@ -226,11 +272,6 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
    }
 
    conf->Level = nconf->level;
-   conf->Samples = nconf->samples;
-   conf->SampleBuffers = 0;
-
-   if (nconf->slow_config)
-      conf->ConfigCaveat = EGL_SLOW_CONFIG;
 
    if (nconf->transparent_rgb) {
       conf->TransparentType = EGL_TRANSPARENT_RGB;
@@ -257,13 +298,9 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
                     int preserve_buffer, int max_swap_interval)
 {
    struct egl_g3d_config *gconf = egl_g3d_config(conf);
-   EGLint buffer_mask, api_mask;
+   EGLint buffer_mask;
    EGLBoolean valid;
 
-   /* skip single-buffered configs */
-   if (!(nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)))
-      return EGL_FALSE;
-
    buffer_mask = 0x0;
    if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT))
       buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
@@ -278,24 +315,14 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
    gconf->stvis.color_format = nconf->color_format;
    gconf->stvis.depth_stencil_format = depth_stencil_format;
    gconf->stvis.accum_format = PIPE_FORMAT_NONE;
-   gconf->stvis.samples = nconf->samples;
+   gconf->stvis.samples = 0;
 
+   /* will be overridden per surface */
    gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ?
       ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT;
 
-   api_mask = dpy->ClientAPIsMask;
-   /* this is required by EGL, not by OpenGL ES */
-   if (nconf->window_bit &&
-       gconf->stvis.render_buffer != ST_ATTACHMENT_BACK_LEFT)
-      api_mask &= ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT);
-
-   if (!api_mask) {
-      _eglLog(_EGL_DEBUG, "no state tracker supports config 0x%x",
-            nconf->native_visual_id);
-   }
-
    valid = init_config_attributes(&gconf->base,
-         nconf, api_mask, depth_stencil_format,
+         nconf, dpy->ClientAPIs, depth_stencil_format,
          preserve_buffer, max_swap_interval);
    if (!valid) {
       _eglLog(_EGL_DEBUG, "skip invalid config 0x%x", nconf->native_visual_id);
@@ -398,46 +425,6 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
    return id;
 }
 
-static void
-egl_g3d_invalid_surface(struct native_display *ndpy,
-                        struct native_surface *nsurf,
-                        unsigned int seq_num)
-{
-   /* XXX not thread safe? */
-   struct egl_g3d_surface *gsurf = egl_g3d_surface(nsurf->user_data);
-   struct egl_g3d_context *gctx;
-   
-   /*
-    * Some functions such as egl_g3d_copy_buffers create a temporary native
-    * surface.  There is no gsurf associated with it.
-    */
-   gctx = (gsurf) ? egl_g3d_context(gsurf->base.CurrentContext) : NULL;
-   if (gctx)
-      gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gsurf->stfbi);
-}
-
-static struct pipe_screen *
-egl_g3d_new_drm_screen(struct native_display *ndpy, const char *name, int fd)
-{
-   _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
-   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
-   return gdpy->loader->create_drm_screen(name, fd);
-}
-
-static struct pipe_screen *
-egl_g3d_new_sw_screen(struct native_display *ndpy, struct sw_winsys *ws)
-{
-   _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
-   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
-   return gdpy->loader->create_sw_screen(ws);
-}
-
-static struct native_event_handler egl_g3d_native_event_handler = {
-   egl_g3d_invalid_surface,
-   egl_g3d_new_drm_screen,
-   egl_g3d_new_sw_screen
-};
-
 static void
 egl_g3d_free_config(void *conf)
 {
@@ -489,8 +476,7 @@ egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
 }
 
 static EGLBoolean
-egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
-                   EGLint *major, EGLint *minor)
+egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
 {
    struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
    struct egl_g3d_display *gdpy;
@@ -500,6 +486,9 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
    if (!nplat)
       return EGL_FALSE;
 
+   if (dpy->Options.TestOnly)
+      return EGL_TRUE;
+
    gdpy = CALLOC_STRUCT(egl_g3d_display);
    if (!gdpy) {
       _eglError(EGL_BAD_ALLOC, "eglInitialize");
@@ -510,20 +499,20 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
 
    _eglLog(_EGL_INFO, "use %s for display %p", nplat->name, dpy->PlatformDisplay);
    gdpy->native = nplat->create_display(dpy->PlatformDisplay,
-         &egl_g3d_native_event_handler, (void *) dpy);
+         dpy->Options.UseFallback, (void *) dpy);
    if (!gdpy->native) {
       _eglError(EGL_NOT_INITIALIZED, "eglInitialize(no usable display)");
       goto fail;
    }
 
    if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_DEFAULT_MASK)
-      dpy->ClientAPIsMask |= EGL_OPENGL_BIT;
+      dpy->ClientAPIs |= EGL_OPENGL_BIT;
    if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES1_MASK)
-      dpy->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
+      dpy->ClientAPIs |= EGL_OPENGL_ES_BIT;
    if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES2_MASK)
-      dpy->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
+      dpy->ClientAPIs |= EGL_OPENGL_ES2_BIT;
    if (gdpy->loader->profile_masks[ST_API_OPENVG] & ST_PROFILE_DEFAULT_MASK)
-      dpy->ClientAPIsMask |= EGL_OPENVG_BIT;
+      dpy->ClientAPIs |= EGL_OPENVG_BIT;
 
    gdpy->smapi = egl_g3d_create_st_manager(dpy);
    if (!gdpy->smapi) {
@@ -562,8 +551,8 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
       goto fail;
    }
 
-   *major = 1;
-   *minor = 4;
+   dpy->VersionMajor = 1;
+   dpy->VersionMinor = 4;
 
    return EGL_TRUE;
 
@@ -588,12 +577,6 @@ egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
          stapi->get_proc_address(stapi, procname) : NULL);
 }
 
-static EGLint
-egl_g3d_probe(_EGLDriver *drv, _EGLDisplay *dpy)
-{
-   return (egl_g3d_get_platform(drv, dpy->Platform)) ? 90 : 0;
-}
-
 _EGLDriver *
 egl_g3d_create_driver(const struct egl_g3d_loader *loader)
 {
@@ -610,8 +593,6 @@ egl_g3d_create_driver(const struct egl_g3d_loader *loader)
    gdrv->base.API.Terminate = egl_g3d_terminate;
    gdrv->base.API.GetProcAddress = egl_g3d_get_proc_address;
 
-   gdrv->base.Probe = egl_g3d_probe;
-
    /* to be filled by the caller */
    gdrv->base.Name = NULL;
    gdrv->base.Unload = NULL;
index 72c14f0ac497d596e6f48384df26138ddd2a5c84..9873fee6ec28a573eae2aac02659365bc8b54c3b 100644 (file)
@@ -92,9 +92,8 @@ struct egl_g3d_config {
 struct egl_g3d_image {
    _EGLImage base;
    struct pipe_resource *texture;
-   unsigned face;
    unsigned level;
-   unsigned zslice;
+   unsigned layer;
 };
 
 /* standard typecasts */
index fd7dc8f81497f7f91d03d814967b7d0f19603d74..c9f94a3c498a83fe6db188ee36f79f848fe144f3 100644 (file)
@@ -30,6 +30,7 @@
 #include "pipe/p_screen.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
+#include "util/u_box.h"
 
 #include "egl_g3d.h"
 #include "egl_g3d_api.h"
@@ -140,23 +141,34 @@ egl_g3d_choose_config(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attribs,
    if (!_eglParseConfigAttribList(&criteria, dpy, attribs))
       return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
 
-   tmp_configs = (_EGLConfig **) _eglFilterArray(dpy->Configs, &tmp_size,
+   /* get the number of matched configs */
+   tmp_size = _eglFilterArray(dpy->Configs, NULL, 0,
          (_EGLArrayForEach) egl_g3d_match_config, (void *) &criteria);
+   if (!tmp_size) {
+      *num_configs = tmp_size;
+      return EGL_TRUE;
+   }
+
+   tmp_configs = MALLOC(sizeof(tmp_configs[0]) * tmp_size);
    if (!tmp_configs)
       return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)");
 
+   /* get the matched configs */
+   _eglFilterArray(dpy->Configs, (void **) tmp_configs, tmp_size,
+         (_EGLArrayForEach) egl_g3d_match_config, (void *) &criteria);
+
    /* perform sorting of configs */
-   if (tmp_configs && tmp_size) {
+   if (configs && tmp_size) {
       _eglSortConfigs((const _EGLConfig **) tmp_configs, tmp_size,
             egl_g3d_compare_config, (void *) &criteria);
-      size = MIN2(tmp_size, size);
-      for (i = 0; i < size; i++)
+      tmp_size = MIN2(tmp_size, size);
+      for (i = 0; i < tmp_size; i++)
          configs[i] = _eglGetConfigHandle(tmp_configs[i]);
    }
 
-   free(tmp_configs);
+   FREE(tmp_configs);
 
-   *num_configs = size;
+   *num_configs = tmp_size;
 
    return EGL_TRUE;
 }
@@ -312,7 +324,8 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
    }
 
    gsurf->stvis = gconf->stvis;
-   if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER)
+   if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER &&
+       gconf->stvis.buffer_mask & ST_ATTACHMENT_FRONT_LEFT_MASK)
       gsurf->stvis.render_buffer = ST_ATTACHMENT_FRONT_LEFT;
 
    gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base);
@@ -390,7 +403,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
                                _EGLConfig *conf, const EGLint *attribs)
 {
    struct egl_g3d_surface *gsurf;
-   struct pipe_resource *ptex = NULL;
 
    gsurf = create_pbuffer_surface(dpy, conf, attribs,
          "eglCreatePbufferSurface");
@@ -399,13 +411,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
 
    gsurf->client_buffer_type = EGL_NONE;
 
-   if (!gsurf->stfbi->validate(gsurf->stfbi,
-            &gsurf->stvis.render_buffer, 1, &ptex)) {
-      egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
-      FREE(gsurf);
-      return NULL;
-   }
-
    return &gsurf->base;
 }
 
@@ -465,12 +470,14 @@ egl_g3d_create_pbuffer_from_client_buffer(_EGLDriver *drv, _EGLDisplay *dpy,
    gsurf->client_buffer_type = buftype;
    gsurf->client_buffer = buffer;
 
+   /* validate now so that it fails if the client buffer is invalid */
    if (!gsurf->stfbi->validate(gsurf->stfbi,
             &gsurf->stvis.render_buffer, 1, &ptex)) {
       egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
       FREE(gsurf);
       return NULL;
    }
+   pipe_resource_reference(&ptex, NULL);
 
    return &gsurf->base;
 }
@@ -631,19 +638,13 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
    struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
    struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
    _EGLContext *ctx = _eglGetCurrentContext();
-   struct egl_g3d_config *gconf;
    struct native_surface *nsurf;
    struct pipe_resource *ptex;
 
    if (!gsurf->render_texture)
       return EGL_TRUE;
 
-   gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, target));
-   if (!gconf)
-      return _eglError(EGL_BAD_NATIVE_PIXMAP, "eglCopyBuffers");
-
-   nsurf = gdpy->native->create_pixmap_surface(gdpy->native,
-         target, gconf->native);
+   nsurf = gdpy->native->create_pixmap_surface(gdpy->native, target, NULL);
    if (!nsurf)
       return _eglError(EGL_BAD_NATIVE_PIXMAP, "eglCopyBuffers");
 
@@ -664,18 +665,13 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
 
    ptex = get_pipe_resource(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
    if (ptex) {
-      struct pipe_resource *psrc = gsurf->render_texture;
-      struct pipe_subresource subsrc, subdst;
-      subsrc.face = 0;
-      subsrc.level = 0;
-      subdst.face = 0;
-      subdst.level = 0;
-
-      if (psrc) {
-         gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, subdst, 0, 0, 0,
-               gsurf->render_texture, subsrc, 0, 0, 0, ptex->width0, ptex->height0);
-         nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
-      }
+      struct pipe_box src_box;
+
+      u_box_origin_2d(ptex->width0, ptex->height0, &src_box);
+      gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, 0, 0, 0, 0,
+            gsurf->render_texture, 0, &src_box);
+      gdpy->pipe->flush(gdpy->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+      nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
 
       pipe_resource_reference(&ptex, NULL);
    }
@@ -880,25 +876,6 @@ egl_g3d_show_screen_surface(_EGLDriver *drv, _EGLDisplay *dpy,
 
 #endif /* EGL_MESA_screen_surface */
 
-/**
- * Find a config that supports the pixmap.
- */
-_EGLConfig *
-egl_g3d_find_pixmap_config(_EGLDisplay *dpy, EGLNativePixmapType pix)
-{
-   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
-   struct egl_g3d_config *gconf;
-   EGLint i;
-
-   for (i = 0; i < dpy->Configs->Size; i++) {
-      gconf = egl_g3d_config((_EGLConfig *) dpy->Configs->Elements[i]);
-      if (gdpy->native->is_pixmap_supported(gdpy->native, pix, gconf->native))
-         break;
-   }
-
-   return (i < dpy->Configs->Size) ? &gconf->base : NULL;
-}
-
 void
 egl_g3d_init_driver_api(_EGLDriver *drv)
 {
index d5196c12fe942970c9c2b245ebaed55138622fcd..17fd7958aa6a752d9a39c569fcb2190b26c26a43 100644 (file)
@@ -31,7 +31,4 @@
 void
 egl_g3d_init_driver_api(_EGLDriver *drv);
 
-_EGLConfig *
-egl_g3d_find_pixmap_config(_EGLDisplay *dpy, EGLNativePixmapType pix);
-
 #endif /* _EGL_G3D_API_H_ */
index 6a1f8cc697b5144bbe39138672639f73fbb30972..78c035a2af059f9c0fb385e6c208435089b7ff7a 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "native.h"
 #include "egl_g3d.h"
-#include "egl_g3d_api.h"
 #include "egl_g3d_image.h"
 
 /* for struct winsys_handle */
@@ -48,17 +47,11 @@ static struct pipe_resource *
 egl_g3d_reference_native_pixmap(_EGLDisplay *dpy, EGLNativePixmapType pix)
 {
    struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
-   struct egl_g3d_config *gconf;
    struct native_surface *nsurf;
    struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
    enum native_attachment natt;
 
-   gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, pix));
-   if (!gconf)
-      return NULL;
-
-   nsurf = gdpy->native->create_pixmap_surface(gdpy->native,
-         pix, gconf->native);
+   nsurf = gdpy->native->create_pixmap_surface(gdpy->native, pix, NULL);
    if (!nsurf)
       return NULL;
 
@@ -173,6 +166,7 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name,
    templ.width0 = attrs.Width;
    templ.height0 = attrs.Height;
    templ.depth0 = 1;
+   templ.array_size = 1;
 
    memset(&wsh, 0, sizeof(wsh));
    wsh.handle = (unsigned) name;
@@ -191,7 +185,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
 {
    struct pipe_resource *ptex;
    struct egl_g3d_image *gimg;
-   unsigned face = 0, level = 0, zslice = 0;
+   unsigned level = 0, layer = 0;
 
    gimg = CALLOC_STRUCT(egl_g3d_image);
    if (!gimg) {
@@ -231,7 +225,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
       FREE(gimg);
       return NULL;
    }
-   if (zslice > ptex->depth0) {
+   if (layer >= (u_minify(ptex->depth0, level) + ptex->array_size - 1)) {
       _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
       pipe_resource_reference(&gimg->texture, NULL);
       FREE(gimg);
@@ -240,9 +234,8 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
 
    /* transfer the ownership to the image */
    gimg->texture = ptex;
-   gimg->face = face;
    gimg->level = level;
-   gimg->zslice = zslice;
+   gimg->layer = layer;
 
    return &gimg->base;
 }
@@ -288,9 +281,8 @@ egl_g3d_create_drm_image(_EGLDriver *drv, _EGLDisplay *dpy,
 
    /* transfer the ownership to the image */
    gimg->texture = ptex;
-   gimg->face = 0;
    gimg->level = 0;
-   gimg->zslice = 0;
+   gimg->layer = 0;
 
    return &gimg->base;
 }
index 25e2999590c21f1643d762826a2169729b67fd10..2b944b521a495cd12e8efadc1091436036c01463 100644 (file)
@@ -72,9 +72,8 @@ egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
 
    out->texture = NULL;
    pipe_resource_reference(&out->texture, gimg->texture);
-   out->face = gimg->face;
    out->level = gimg->level;
-   out->zslice = gimg->zslice;
+   out->layer = gimg->layer;
 
    _eglUnlockMutex(&gsmapi->display->Mutex);
 
@@ -140,6 +139,7 @@ pbuffer_allocate_render_texture(struct egl_g3d_surface *gsurf)
    templ.width0 = gsurf->base.Width;
    templ.height0 = gsurf->base.Height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.format = gsurf->stvis.color_format;
    templ.bind = PIPE_BIND_RENDER_TARGET;
 
index 3886ca20562b0ae25a3a33a8294821d55a843fc6..6461b5edbdf000ada763f5d0c95119f54f1fd09c 100644 (file)
@@ -126,8 +126,6 @@ struct native_config {
    int native_visual_id;
    int native_visual_type;
    int level;
-   int samples;
-   boolean slow_config;
    boolean transparent_rgb;
    int transparent_rgb_values[3];
 };
@@ -185,7 +183,9 @@ struct native_display {
                                                    const struct native_config *nconf);
 
    /**
-    * Create a pixmap surface.  Required unless no config has pixmap_bit set.
+    * Create a pixmap surface.  The native config may be NULL.  In that case, a
+    * "best config" will be picked.  Required unless no config has pixmap_bit
+    * set.
     */
    struct native_surface *(*create_pixmap_surface)(struct native_display *ndpy,
                                                    EGLNativePixmapType pix,
@@ -226,8 +226,9 @@ native_attachment_mask_test(uint mask, enum native_attachment att)
 struct native_platform {
    const char *name;
 
+   void (*set_event_handler)(struct native_event_handler *handler);
    struct native_display *(*create_display)(void *dpy,
-                                            struct native_event_handler *handler,
+                                            boolean use_sw,
                                             void *user_data);
 };
 
index 7832b2b693f572d904183a8cbe2d2e8ca12be663..0f2d02032b575707d08ce7f587c503fa44030640 100644 (file)
@@ -40,7 +40,6 @@ struct resource_surface {
    uint bind;
 
    struct pipe_resource *resources[NUM_NATIVE_ATTACHMENTS];
-   struct pipe_surface *present_surfaces[NUM_NATIVE_ATTACHMENTS];
    uint resource_mask;
    uint width, height;
 };
@@ -67,8 +66,6 @@ resource_surface_free_resources(struct resource_surface *rsurf)
       int i;
 
       for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
-         if (rsurf->present_surfaces[i])
-            pipe_surface_reference(&rsurf->present_surfaces[i], NULL);
          if (rsurf->resources[i])
             pipe_resource_reference(&rsurf->resources[i], NULL);
       }
@@ -130,6 +127,7 @@ resource_surface_add_resources(struct resource_surface *rsurf,
    templ.width0 = rsurf->width;
    templ.height0 = rsurf->height;
    templ.depth0 = 1;
+   templ.array_size = 1;
 
    for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
       if (resource_mask & (1 <<i)) {
@@ -193,8 +191,6 @@ resource_surface_swap_buffers(struct resource_surface *rsurf,
 
    pointer_swap((const void **) &rsurf->resources[buf1],
                 (const void **) &rsurf->resources[buf2]);
-   pointer_swap((const void **) &rsurf->present_surfaces[buf1],
-                (const void **) &rsurf->present_surfaces[buf2]);
 
    /* swap mask bits */
    mask = rsurf->resource_mask & ~(buf1_bit | buf2_bit);
@@ -212,24 +208,12 @@ resource_surface_present(struct resource_surface *rsurf,
                          void *winsys_drawable_handle)
 {
    struct pipe_resource *pres = rsurf->resources[which];
-   struct pipe_surface *psurf = rsurf->present_surfaces[which];
 
    if (!pres)
       return TRUE;
 
-   if (!psurf) {
-      psurf = rsurf->screen->get_tex_surface(rsurf->screen,
-            pres, 0, 0, 0, PIPE_BIND_DISPLAY_TARGET);
-      if (!psurf)
-         return FALSE;
-
-      rsurf->present_surfaces[which] = psurf;
-   }
-
-   assert(psurf->texture == pres);
-
    rsurf->screen->flush_frontbuffer(rsurf->screen,
-         psurf, winsys_drawable_handle);
+         pres, 0, 0, winsys_drawable_handle);
 
    return TRUE;
 }
index 3759c2a26dd113cf501113be2e2acc0b676c05b0..14c134ea1ada10346e8d904c58f853b0ca7166e6 100644 (file)
@@ -34,7 +34,7 @@
 
 /* see get_drm_screen_name */
 #include <radeon_drm.h>
-#include "radeon/drm/radeon_drm.h"
+#include "radeon/drm/radeon_drm_public.h"
 
 static boolean
 drm_display_is_format_supported(struct native_display *ndpy,
@@ -237,9 +237,16 @@ drm_create_display(int fd, struct native_event_handler *event_handler,
    return &drmdpy->base;
 }
 
+static struct native_event_handler *drm_event_handler;
+
+static void
+native_set_event_handler(struct native_event_handler *event_handler)
+{
+   drm_event_handler = event_handler;
+}
+
 static struct native_display *
-native_create_display(void *dpy, struct native_event_handler *event_handler,
-                      void *user_data)
+native_create_display(void *dpy, boolean use_sw, void *user_data)
 {
    int fd;
 
@@ -252,11 +259,12 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
    if (fd < 0)
       return NULL;
 
-   return drm_create_display(fd, event_handler, user_data);
+   return drm_create_display(fd, drm_event_handler, user_data);
 }
 
 static const struct native_platform drm_platform = {
    "DRM", /* name */
+   native_set_event_handler,
    native_create_display
 };
 
index 1b5ea8bf9d51a49fe0294c3594b2ba48ce34823d..a1e91ba701cdb9fd522ea393e5f5ec42b39af930 100644 (file)
@@ -459,9 +459,16 @@ fbdev_display_create(int fd, struct native_event_handler *event_handler,
    return &fbdpy->base;
 }
 
+static struct native_event_handler *fbdev_event_handler;
+
+static void
+native_set_event_handler(struct native_event_handler *event_handler)
+{
+   fbdev_event_handler = event_handler;
+}
+
 static struct native_display *
-native_create_display(void *dpy, struct native_event_handler *event_handler,
-                      void *user_data)
+native_create_display(void *dpy, boolean use_sw, void *user_data)
 {
    struct native_display *ndpy;
    int fd;
@@ -476,7 +483,7 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
    if (fd < 0)
       return NULL;
 
-   ndpy = fbdev_display_create(fd, event_handler, user_data);
+   ndpy = fbdev_display_create(fd, fbdev_event_handler, user_data);
    if (!ndpy)
       close(fd);
 
@@ -485,6 +492,7 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
 
 static const struct native_platform fbdev_platform = {
    "FBDEV", /* name */
+   native_set_event_handler,
    native_create_display
 };
 
index d259e6edc8914f04944d98f841985a3f4dac3c72..3cc4aefa937af1b04df90e796bff847fb6d255f1 100644 (file)
@@ -319,7 +319,6 @@ gdi_display_get_configs(struct native_display *ndpy, int *num_configs)
          nconf->color_format = formats[i];
 
          nconf->window_bit = TRUE;
-         nconf->slow_config = TRUE;
       }
 
       gdpy->num_configs = count;
@@ -407,15 +406,23 @@ gdi_create_display(HDC hDC, struct native_event_handler *event_handler,
    return &gdpy->base;
 }
 
+static struct native_event_handler *gdi_event_handler;
+
+static void
+native_set_event_handler(struct native_event_handler *event_handler)
+{
+   gdi_event_handler = event_handler;
+}
+
 static struct native_display *
-native_create_display(void *dpy, struct native_event_handler *event_handler,
-                      void *user_data)
+native_create_display(void *dpy, boolean use_sw, void *user_data)
 {
-   return gdi_create_display((HDC) dpy, event_handler, user_data);
+   return gdi_create_display((HDC) dpy, gdi_event_handler, user_data);
 }
 
 static const struct native_platform gdi_platform = {
    "GDI", /* name */
+   native_set_event_handler,
    native_create_display
 };
 
index 331a7de432a9714cf36c046672fb359849e53f76..c82e2da863b7c47df681e28a6a89545bc639a607 100644 (file)
 
 #ifdef GLX_DIRECT_RENDERING
 
-enum dri2_surface_type {
-   DRI2_SURFACE_TYPE_WINDOW,
-   DRI2_SURFACE_TYPE_PIXMAP,
-};
-
 struct dri2_display {
    struct native_display base;
    Display *dpy;
@@ -66,7 +61,6 @@ struct dri2_display {
 struct dri2_surface {
    struct native_surface base;
    Drawable drawable;
-   enum dri2_surface_type type;
    enum pipe_format color_format;
    struct dri2_display *dri2dpy;
 
@@ -136,6 +130,7 @@ dri2_surface_process_drawable_buffers(struct native_surface *nsurf,
    templ.width0 = dri2surf->width;
    templ.height0 = dri2surf->height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.format = dri2surf->color_format;
    templ.bind = PIPE_BIND_RENDER_TARGET;
 
@@ -438,12 +433,10 @@ dri2_surface_destroy(struct native_surface *nsurf)
 
 static struct dri2_surface *
 dri2_display_create_surface(struct native_display *ndpy,
-                            enum dri2_surface_type type,
                             Drawable drawable,
-                            const struct native_config *nconf)
+                            enum pipe_format color_format)
 {
    struct dri2_display *dri2dpy = dri2_display(ndpy);
-   struct dri2_config *dri2conf = dri2_config(nconf);
    struct dri2_surface *dri2surf;
 
    dri2surf = CALLOC_STRUCT(dri2_surface);
@@ -451,9 +444,8 @@ dri2_display_create_surface(struct native_display *ndpy,
       return NULL;
 
    dri2surf->dri2dpy = dri2dpy;
-   dri2surf->type = type;
    dri2surf->drawable = drawable;
-   dri2surf->color_format = dri2conf->base.color_format;
+   dri2surf->color_format = color_format;
 
    dri2surf->base.destroy = dri2_surface_destroy;
    dri2surf->base.present = dri2_surface_present;
@@ -479,8 +471,8 @@ dri2_display_create_window_surface(struct native_display *ndpy,
 {
    struct dri2_surface *dri2surf;
 
-   dri2surf = dri2_display_create_surface(ndpy, DRI2_SURFACE_TYPE_WINDOW,
-         (Drawable) win, nconf);
+   dri2surf = dri2_display_create_surface(ndpy,
+         (Drawable) win, nconf->color_format);
    return (dri2surf) ? &dri2surf->base : NULL;
 }
 
@@ -491,8 +483,29 @@ dri2_display_create_pixmap_surface(struct native_display *ndpy,
 {
    struct dri2_surface *dri2surf;
 
-   dri2surf = dri2_display_create_surface(ndpy, DRI2_SURFACE_TYPE_PIXMAP,
-         (Drawable) pix, nconf);
+   if (!nconf) {
+      struct dri2_display *dri2dpy = dri2_display(ndpy);
+      uint depth, nconf_depth;
+      int i;
+
+      depth = x11_drawable_get_depth(dri2dpy->xscr, (Drawable) pix);
+      for (i = 0; i < dri2dpy->num_configs; i++) {
+         nconf_depth = util_format_get_blocksizebits(
+               dri2dpy->configs[i].base.color_format);
+         /* simple depth match for now */
+         if (depth == nconf_depth ||
+             (depth == 24 && depth + 8 == nconf_depth)) {
+            nconf = &dri2dpy->configs[i].base;
+            break;
+         }
+      }
+
+      if (!nconf)
+         return NULL;
+   }
+
+   dri2surf = dri2_display_create_surface(ndpy,
+         (Drawable) pix, nconf->color_format);
    return (dri2surf) ? &dri2surf->base : NULL;
 }
 
@@ -547,6 +560,10 @@ dri2_display_convert_config(struct native_display *ndpy,
    if (!mode->xRenderable || !mode->drawableType)
       return FALSE;
 
+   /* fast/slow configs are probably not relevant */
+   if (mode->visualRating == GLX_SLOW_CONFIG)
+      return FALSE;
+
    nconf->buffer_mask = 1 << NATIVE_ATTACHMENT_FRONT_LEFT;
    if (mode->doubleBufferMode)
       nconf->buffer_mask |= 1 << NATIVE_ATTACHMENT_BACK_LEFT;
@@ -567,17 +584,33 @@ dri2_display_convert_config(struct native_display *ndpy,
    if (nconf->color_format == PIPE_FORMAT_NONE)
       return FALSE;
 
-   if (mode->drawableType & GLX_WINDOW_BIT)
+   if ((mode->drawableType & GLX_WINDOW_BIT) && mode->visualID)
       nconf->window_bit = TRUE;
    if (mode->drawableType & GLX_PIXMAP_BIT)
       nconf->pixmap_bit = TRUE;
 
    nconf->native_visual_id = mode->visualID;
-   nconf->native_visual_type = mode->visualType;
+   switch (mode->visualType) {
+   case GLX_TRUE_COLOR:
+      nconf->native_visual_type = TrueColor;
+      break;
+   case GLX_DIRECT_COLOR:
+      nconf->native_visual_type = DirectColor;
+      break;
+   case GLX_PSEUDO_COLOR:
+      nconf->native_visual_type = PseudoColor;
+      break;
+   case GLX_STATIC_COLOR:
+      nconf->native_visual_type = StaticColor;
+      break;
+   case GLX_GRAY_SCALE:
+      nconf->native_visual_type = GrayScale;
+      break;
+   case GLX_STATIC_GRAY:
+      nconf->native_visual_type = StaticGray;
+      break;
+   }
    nconf->level = mode->level;
-   nconf->samples = mode->samples;
-
-   nconf->slow_config = (mode->visualRating == GLX_SLOW_CONFIG);
 
    if (mode->transparentPixel == GLX_TRANSPARENT_RGB) {
       nconf->transparent_rgb = TRUE;
@@ -613,8 +646,17 @@ dri2_display_get_configs(struct native_display *ndpy, int *num_configs)
       count = 0;
       for (i = 0; i < num_modes; i++) {
          struct native_config *nconf = &dri2dpy->configs[count].base;
-         if (dri2_display_convert_config(&dri2dpy->base, modes, nconf))
-            count++;
+
+         if (dri2_display_convert_config(&dri2dpy->base, modes, nconf)) {
+            int j;
+            /* look for duplicates */
+            for (j = 0; j < count; j++) {
+               if (memcmp(&dri2dpy->configs[j], nconf, sizeof(*nconf)) == 0)
+                  break;
+            }
+            if (j == count)
+               count++;
+         }
          modes = modes->next;
       }
 
@@ -757,7 +799,7 @@ dri2_display_hash_table_hash(void *key)
 static int
 dri2_display_hash_table_compare(void *key1, void *key2)
 {
-   return (key1 - key2);
+   return ((char *) key1 - (char *) key2);
 }
 
 struct native_display *
index 37c8b01541f65160be70d8189ec6f5b7b71013f1..a0bcad4c7344a759e0e842b5fbb8b75de6c8a422 100644 (file)
 
 #include "native_x11.h"
 
+static struct native_event_handler *x11_event_handler;
+
+static void
+native_set_event_handler(struct native_event_handler *event_handler)
+{
+   x11_event_handler = event_handler;
+}
+
 static struct native_display *
-native_create_display(void *dpy, struct native_event_handler *event_handler,
-                      void *user_data)
+native_create_display(void *dpy, boolean use_sw, void *user_data)
 {
    struct native_display *ndpy = NULL;
    boolean force_sw;
 
    force_sw = debug_get_bool_option("EGL_SOFTWARE", FALSE);
-   if (!force_sw) {
-      ndpy = x11_create_dri2_display((Display *) dpy,
-            event_handler, user_data);
-   }
-
-   if (!ndpy) {
-      EGLint level = (force_sw) ? _EGL_INFO : _EGL_WARNING;
 
-      _eglLog(level, "use software fallback");
+   if (force_sw || use_sw) {
+      _eglLog(_EGL_INFO, "use software fallback");
       ndpy = x11_create_ximage_display((Display *) dpy,
-            event_handler, user_data);
+            x11_event_handler, user_data);
+   }
+   else {
+      ndpy = x11_create_dri2_display((Display *) dpy,
+            x11_event_handler, user_data);
    }
 
    return ndpy;
@@ -56,6 +61,7 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
 
 static const struct native_platform x11_platform = {
    "X11", /* name */
+   native_set_event_handler,
    native_create_display
 };
 
index 84811fb6e147b4e5cc908ac3192a313461ffdeda..d4f4dd04df4ef6f600405d7cf8f074f35fb968e1 100644 (file)
 #include "native_x11.h"
 #include "x11_screen.h"
 
-enum ximage_surface_type {
-   XIMAGE_SURFACE_TYPE_WINDOW,
-   XIMAGE_SURFACE_TYPE_PIXMAP,
-};
-
 struct ximage_display {
    struct native_display base;
    Display *dpy;
@@ -60,7 +55,6 @@ struct ximage_display {
 struct ximage_surface {
    struct native_surface base;
    Drawable drawable;
-   enum ximage_surface_type type;
    enum pipe_format color_format;
    XVisualInfo visual;
    struct ximage_display *xdpy;
@@ -245,7 +239,6 @@ ximage_surface_destroy(struct native_surface *nsurf)
 
 static struct ximage_surface *
 ximage_display_create_surface(struct native_display *ndpy,
-                              enum ximage_surface_type type,
                               Drawable drawable,
                               const struct native_config *nconf)
 {
@@ -258,7 +251,6 @@ ximage_display_create_surface(struct native_display *ndpy,
       return NULL;
 
    xsurf->xdpy = xdpy;
-   xsurf->type = type;
    xsurf->color_format = xconf->base.color_format;
    xsurf->drawable = drawable;
 
@@ -297,11 +289,37 @@ ximage_display_create_window_surface(struct native_display *ndpy,
 {
    struct ximage_surface *xsurf;
 
-   xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_WINDOW,
-         (Drawable) win, nconf);
+   xsurf = ximage_display_create_surface(ndpy, (Drawable) win, nconf);
    return (xsurf) ? &xsurf->base : NULL;
 }
 
+static enum pipe_format
+get_pixmap_format(struct native_display *ndpy, EGLNativePixmapType pix)
+{
+   struct ximage_display *xdpy = ximage_display(ndpy);
+   enum pipe_format fmt;
+   uint depth;
+
+   depth = x11_drawable_get_depth(xdpy->xscr, (Drawable) pix);
+
+   switch (depth) {
+   case 32:
+      fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
+      break;
+   case 24:
+      fmt = PIPE_FORMAT_B8G8R8X8_UNORM;
+      break;
+   case 16:
+      fmt = PIPE_FORMAT_B5G6R5_UNORM;
+      break;
+   default:
+      fmt = PIPE_FORMAT_NONE;
+      break;
+   }
+
+   return fmt;
+}
+
 static struct native_surface *
 ximage_display_create_pixmap_surface(struct native_display *ndpy,
                                      EGLNativePixmapType pix,
@@ -309,8 +327,26 @@ ximage_display_create_pixmap_surface(struct native_display *ndpy,
 {
    struct ximage_surface *xsurf;
 
-   xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_PIXMAP,
-         (Drawable) pix, nconf);
+   /* find the config */
+   if (!nconf) {
+      struct ximage_display *xdpy = ximage_display(ndpy);
+      enum pipe_format fmt = get_pixmap_format(&xdpy->base, pix);
+      int i;
+
+      if (fmt != PIPE_FORMAT_NONE) {
+         for (i = 0; i < xdpy->num_configs; i++) {
+            if (xdpy->configs[i].base.color_format == fmt) {
+               nconf = &xdpy->configs[i].base;
+               break;
+            }
+         }
+      }
+
+      if (!nconf)
+         return NULL;
+   }
+
+   xsurf = ximage_display_create_surface(ndpy, (Drawable) pix, nconf);
    return (xsurf) ? &xsurf->base : NULL;
 }
 
@@ -384,8 +420,6 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
          xconf->base.native_visual_type = xconf->visual->class;
 #endif
 
-         xconf->base.slow_config = TRUE;
-
          count++;
       }
 
@@ -408,24 +442,7 @@ ximage_display_is_pixmap_supported(struct native_display *ndpy,
                                    const struct native_config *nconf)
 {
    struct ximage_display *xdpy = ximage_display(ndpy);
-   enum pipe_format fmt;
-   uint depth;
-
-   depth = x11_drawable_get_depth(xdpy->xscr, (Drawable) pix);
-   switch (depth) {
-   case 32:
-      fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
-      break;
-   case 24:
-      fmt = PIPE_FORMAT_B8G8R8X8_UNORM;
-      break;
-   case 16:
-      fmt = PIPE_FORMAT_B5G6R5_UNORM;
-      break;
-   default:
-      fmt = PIPE_FORMAT_NONE;
-      break;
-   }
+   enum pipe_format fmt = get_pixmap_format(&xdpy->base, pix);
 
    return (fmt == nconf->color_format);
 }
index e7466bdbee53376faa8582e36107d4dbe10bab0c..6bfe8b0788c5012713d239fce2a3c7c6a83c6445 100644 (file)
@@ -42,7 +42,7 @@ struct xmesa_st_framebuffer {
    unsigned texture_width, texture_height, texture_mask;
    struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
 
-   struct pipe_surface *display_surface;
+   struct pipe_resource *display_resource;
 };
 
 static INLINE struct xmesa_st_framebuffer *
@@ -60,25 +60,19 @@ xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi,
 {
    struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
    struct pipe_resource *ptex = xstfb->textures[statt];
-   struct pipe_surface *psurf;
+   struct pipe_resource *pres;
 
    if (!ptex)
       return TRUE;
 
-   psurf = xstfb->display_surface;
+   pres = xstfb->display_resource;
    /* (re)allocate the surface for the texture to be displayed */
-   if (!psurf || psurf->texture != ptex) {
-      pipe_surface_reference(&xstfb->display_surface, NULL);
-
-      psurf = xstfb->screen->get_tex_surface(xstfb->screen,
-            ptex, 0, 0, 0, PIPE_BIND_DISPLAY_TARGET);
-      if (!psurf)
-         return FALSE;
-
-      xstfb->display_surface = psurf;
+   if (!pres || pres != ptex) {
+      pipe_resource_reference(&xstfb->display_resource, ptex);
+      pres = xstfb->display_resource;
    }
 
-   xstfb->screen->flush_frontbuffer(xstfb->screen, psurf, &xstfb->buffer->ws);
+   xstfb->screen->flush_frontbuffer(xstfb->screen, pres, 0, 0, &xstfb->buffer->ws);
 
    return TRUE;
 }
@@ -96,7 +90,7 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
    struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
    struct pipe_resource *src_ptex = xstfb->textures[src_statt];
    struct pipe_resource *dst_ptex = xstfb->textures[dst_statt];
-   struct pipe_subresource subsrc, subdst;
+   struct pipe_box src_box;
    struct pipe_context *pipe;
 
    if (!src_ptex || !dst_ptex)
@@ -110,14 +104,11 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
       xstfb->display->pipe = pipe;
    }
 
-   subsrc.face = 0;
-   subsrc.level = 0;
-   subdst.face = 0;
-   subdst.level = 0;
+   u_box_2d(x, y, width, height, &src_box);
 
    if (src_ptex && dst_ptex)
-      pipe->resource_copy_region(pipe, dst_ptex, subdst, x, y, 0,
-                                 src_ptex, subsrc, x, y, 0, width, height);
+      pipe->resource_copy_region(pipe, dst_ptex, 0, x, y, 0,
+                                 src_ptex, 0, &src_box);
 }
 
 /**
@@ -144,6 +135,7 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
 
    for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
@@ -321,7 +313,7 @@ xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
    struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
    int i;
 
-   pipe_surface_reference(&xstfb->display_surface, NULL);
+   pipe_resource_reference(&xstfb->display_resource, NULL);
 
    for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
       pipe_resource_reference(&xstfb->textures[i], NULL);
index 40c4603fb9d90bbe41d56c99e151667ce21abced..d694651eef77b9777c0357cca776c57cb7189fff 100644 (file)
@@ -132,6 +132,8 @@ struct st_context {
                        enum pipe_format format = PIPE_FORMAT_NONE,
                        unsigned first_level = 0,
                        unsigned last_level = ~0,
+                       unsigned first_layer = 0,
+                       unsigned last_layer = ~0,
                        unsigned swizzle_r = 0,
                        unsigned swizzle_g = 1,
                        unsigned swizzle_b = 2,
@@ -146,9 +148,10 @@ struct st_context {
       } else {
          templat.format = format;
       }
-      templat.last_level = MIN2(last_level, texture->last_level);
-      templat.first_level = first_level;
-      templat.last_level = last_level;
+      templat.u.tex.last_level = MIN2(last_level, texture->last_level);
+      templat.u.tex.first_level = first_level;
+      templat.u.tex.first_layer = first_layer;
+      templat.u.tex.last_layer = last_layer;
       templat.swizzle_r = swizzle_r;
       templat.swizzle_g = swizzle_g;
       templat.swizzle_b = swizzle_b;
@@ -357,7 +360,7 @@ struct st_context {
       if (!map)
          goto error2;
       memcpy(map, vertices, size);
-      pipe_buffer_unmap(pipe, vbuf, transfer);
+      pipe_buffer_unmap(pipe, transfer);
 
       cso_save_vertex_elements($self->cso);
 
@@ -412,17 +415,15 @@ error1:
     */
 
    void resource_copy_region(struct pipe_resource *dst,
-                             struct pipe_subresource subdst,
+                             unsigned dst_level,
                              unsigned dstx, unsigned dsty, unsigned dstz,
                              struct pipe_resource *src,
-                             struct pipe_subresource subsrc,
-                             unsigned srcx, unsigned srcy, unsigned srcz,
-                             unsigned width, unsigned height)
+                             unsigned src_level,
+                             const struct pipe_box *src_box)
    {
       $self->pipe->resource_copy_region($self->pipe,
-                                        dst, subdst, dstx, dsty, dstz,
-                                        src, subsrc, srcx, srcy, srcz,
-                                        width, height);
+                                        dst, dst_level, dstx, dsty, dstz,
+                                        src, src_level, src_box);
    }
 
 
@@ -433,7 +434,7 @@ error1:
    {
       struct pipe_surface *_dst = NULL;
 
-     _dst = st_pipe_surface(dst, PIPE_BIND_RENDER_TARGET);
+     _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_RENDER_TARGET);
       if(!_dst)
          SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
 
@@ -452,7 +453,7 @@ error1:
    {
       struct pipe_surface *_dst = NULL;
 
-     _dst = st_pipe_surface(dst, PIPE_BIND_DEPTH_STENCIL);
+     _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_DEPTH_STENCIL);
       if(!_dst)
          SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
 
@@ -482,9 +483,8 @@ error1:
 
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_READ,
                                    x, y, w, h);
       if(transfer) {
@@ -511,9 +511,8 @@ error1:
 
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_WRITE,
                                    x, y, w, h);
       if(!transfer)
@@ -535,9 +534,8 @@ error1:
       struct pipe_transfer *transfer;
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_READ,
                                    x, y, w, h);
       if(transfer) {
@@ -555,9 +553,8 @@ error1:
       struct pipe_transfer *transfer;
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_WRITE,
                                    x, y, w, h);
       if(transfer) {
@@ -597,9 +594,8 @@ error1:
 
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_READ,
                                    x, y, w, h);
       if(transfer) {
@@ -624,9 +620,8 @@ error1:
       struct pipe_transfer *transfer;
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_READ,
                                    x, y, w, h);
       if(transfer) {
@@ -644,9 +639,8 @@ error1:
       struct pipe_transfer *transfer;
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_WRITE,
                                    x, y, w, h);
       if(transfer) {
@@ -681,9 +675,8 @@ error1:
 
       transfer = pipe_get_transfer(pipe,
                                    surface->texture,
-                                   surface->face,
                                    surface->level,
-                                   surface->zslice,
+                                   surface->layer,
                                    PIPE_TRANSFER_READ,
                                    x, y, w, h);
       if(!transfer) {
@@ -715,16 +708,16 @@ error1:
    %cstring_input_binary(const char *STRING, unsigned LENGTH);
    void
    transfer_inline_write(struct pipe_resource *resource,
-                         struct pipe_subresource *sr,
+                         unsigned level,
                          unsigned usage,
                          const struct pipe_box *box,
                          const char *STRING, unsigned LENGTH,
                          unsigned stride,
-                         unsigned slice_stride)
+                         unsigned layer_stride)
    {
       struct pipe_context *pipe = $self->pipe;
 
-      pipe->transfer_inline_write(pipe, resource, *sr, usage, box, STRING, stride, slice_stride);
+      pipe->transfer_inline_write(pipe, resource, level, usage, box, STRING, stride, layer_stride);
    }
 
    %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
index c1e6ea1b43c9d990fa13479bbcce03885ca2858a..0537557661ddc2b94ca51064774bc00678c60d98 100644 (file)
          SWIG_exception(SWIG_ValueError, "index out of bounds");
       
       if(surface) {
-         _surface = st_pipe_surface(surface, PIPE_BIND_RENDER_TARGET);
+         /* XXX need a context here */
+         _surface = st_pipe_surface(NULL, surface, PIPE_BIND_RENDER_TARGET);
          if(!_surface)
             SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
       }
       struct pipe_surface *_surface = NULL;
 
       if(surface) {
-         _surface = st_pipe_surface(surface, PIPE_BIND_DEPTH_STENCIL);
+         /* XXX need a context here */
+         _surface = st_pipe_surface(NULL, surface, PIPE_BIND_DEPTH_STENCIL);
          if(!_surface)
             SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
       }
index ae506944c4513010e297b61c1581671952db5dcf..1f4b4fd596bf1ca4e6228d1037f0d77885939185 100644 (file)
@@ -42,9 +42,8 @@
 %ignore pipe_resource::screen;
 
 %immutable st_surface::texture;
-%immutable st_surface::face;
 %immutable st_surface::level;
-%immutable st_surface::zslice;
+%immutable st_surface::layer;
 
 %newobject pipe_resource::get_surface;
 
 
    /** Get a surface which is a "view" into a texture */
    struct st_surface *
-   get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0)
+   get_surface(unsigned level=0, unsigned layer=0)
    {
       struct st_surface *surface;
 
-      if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6U : 1U))
-         SWIG_exception(SWIG_ValueError, "face out of bounds");
       if(level > $self->last_level)
          SWIG_exception(SWIG_ValueError, "level out of bounds");
-      if(zslice >= u_minify($self->depth0, level))
-         SWIG_exception(SWIG_ValueError, "zslice out of bounds");
+      if(layer >= ($self->target == PIPE_TEXTURE_3D ?
+                         u_minify($self->depth0, level) : $self->depth0))
+         SWIG_exception(SWIG_ValueError, "layer out of bounds");
 
       surface = CALLOC_STRUCT(st_surface);
       if(!surface)
          return NULL;
 
       pipe_resource_reference(&surface->texture, $self);
-      surface->face = face;
       surface->level = level;
-      surface->zslice = zslice;
+      surface->layer = layer;
 
       return surface;
 
@@ -113,9 +110,8 @@ struct st_surface
    %immutable;
 
    struct pipe_resource *texture;
-   unsigned face;
    unsigned level;
-   unsigned zslice;
+   unsigned layer;
 
 };
 
index 29813456b5f4bbf9ba44833fc8a0b4d14737fcc8..d0a4295c7a250c97533c51bbfd94374d88dea045 100644 (file)
@@ -240,6 +240,7 @@ st_context_create(struct st_device *st_dev)
       templat.width0 = 1;
       templat.height0 = 1;
       templat.depth0 = 1;
+      templat.array_size = 1;
       templat.last_level = 0;
       templat.bind = PIPE_BIND_SAMPLER_VIEW;
    
@@ -252,7 +253,7 @@ st_context_create(struct st_device *st_dev)
 
         pipe->transfer_inline_write(pipe,
                                     st_ctx->default_texture,
-                                    u_subresource(0,0),
+                                    0,
                                     PIPE_TRANSFER_WRITE,
                                     &box,
                                     &zero,
index 2dca7a1974e38270061413059edffee389c9e098..53e2556cb0dd2edd5d9e6930b9e067ba7c7b91b2 100644 (file)
@@ -41,9 +41,8 @@ struct st_winsys;
 struct st_surface
 {
    struct pipe_resource *texture;
-   unsigned face;
    unsigned level;
-   unsigned zslice;
+   unsigned layer;
 };
 
 
@@ -83,11 +82,17 @@ struct st_device
 
 
 static INLINE struct pipe_surface *
-st_pipe_surface(struct st_surface *surface, unsigned usage) 
+st_pipe_surface(struct pipe_context *pipe, struct st_surface *surface, unsigned usage) 
 {
    struct pipe_resource *texture = surface->texture;
-   struct pipe_screen *screen = texture->screen;
-   return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage);
+   struct pipe_surface surf_tmpl;
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   surf_tmpl.format = texture->format;
+   surf_tmpl.usage = usage;
+   surf_tmpl.u.tex.level = surface->level;
+   surf_tmpl.u.tex.first_layer = surface->layer;
+   surf_tmpl.u.tex.last_layer = surface->layer;
+   return pipe->create_surface(pipe, texture, &surf_tmpl);
 }
 
 struct st_context *
index 25bfbf1ab73d5991ede74566fa9394ae6025ebcb..cac9a1a6204732f161673f058c34cb9a3cdf187b 100644 (file)
@@ -555,9 +555,8 @@ st_sample_surface(struct pipe_context *pipe,
 
    transfer = pipe_get_transfer(pipe,
                                 surface->texture,
-                                surface->face,
                                 surface->level,
-                                surface->zslice,
+                                surface->layer,
                                 PIPE_TRANSFER_WRITE,
                                 0, 0,
                                 width,
diff --git a/src/gallium/state_trackers/vega/.gitignore b/src/gallium/state_trackers/vega/.gitignore
new file mode 100644 (file)
index 0000000..c452229
--- /dev/null
@@ -0,0 +1 @@
+api_tmp.h
index 0543fac09469a9f64cee27fdc72eaacf8fd29616..7342c124c287469a47de5b7cf2b19b7928373f1a 100644 (file)
@@ -38,7 +38,14 @@ C_SOURCES = \
            renderer.c \
            stroker.c \
            mask.c \
+           text.c \
            shader.c \
            shaders_cache.c
 
+GENERATED_SOURCES := api_tmp.h
+
 include ../../Makefile.template
+
+MAPI := $(TOP)/src/mapi
+api_tmp.h: $(MAPI)/mapi/mapi_abi.py $(MAPI)/vgapi/vgapi.csv
+       $(PYTHON2) $< --printer vgapi --mode app $(MAPI)/vgapi/vgapi.csv > $@
index a62783ab18e53152539019e5dd893bcc0f704803..4900135a1c53d5fdaa9b3ddb07bfd90bd16c6737 100644 (file)
@@ -3,6 +3,8 @@
 
 Import('*')
 
+from sys import executable as python_cmd
+
 env = env.Clone()
 
 env.Append(CPPPATH = [
@@ -40,10 +42,16 @@ vega_sources = [
     'mask.c',
     'shader.c',
     'shaders_cache.c',
+    'text.c',
 ]
 
-# vgapi_header must be generated first
-env.Depends(vega_sources, vgapi_header)
+api_tmp = env.CodeGenerate(
+        target = '#/src/gallium/state_trackers/vega/api_tmp.h',
+        script = '#src/mapi/mapi/mapi_abi.py',
+        source = '#src/mapi/vgapi/vgapi.csv',
+        command = python_cmd + ' $SCRIPT --printer vgapi --mode app $SOURCE > $TARGET'
+)
+env.Depends(vega_sources, api_tmp)
 
 st_vega = env.ConvenienceLibrary(
     target = 'st_vega',
index bf1d37493af7296cd235011e0e889e14afb4ba13..4bf7c71d45346c186fa83b4916b2fd91be5d9241 100644 (file)
 
 #include "mapi/mapi.h"
 
+/* define vega_spec and vega_procs for use with mapi */
+#define API_TMP_DEFINE_SPEC
 #include "api.h"
 
-static const char vega_spec[] =
-   "1"
-#define MAPI_ABI_ENTRY(ret, name, params) \
-   "\0" #name "\0"
-#define MAPI_ALIAS_ENTRY(alias, ret, name, params) \
-   #name "\0"
-#include "vgapi/vgapi_tmp.h"
-   "\0";
-
-static const mapi_proc vega_procs[] = {
-#define MAPI_ABI_ENTRY(ret, name, params) \
-   (mapi_proc) vega ## name,
-#include "vgapi/vgapi_tmp.h"
-};
-
 static void api_init(void)
 {
    static boolean initialized = FALSE;
index 955508dae9a0418eae1183eb917b1c55ae816fe3..459dafb4bb01f76d943a9db77abd4647faa3b228 100644 (file)
 #include "VG/vgext.h"
 #include "vg_manager.h"
 
-/* declare the prototypes */
-#define MAPI_ABI_ENTRY(ret, name, params) \
-   ret VG_API_ENTRY vega ## name params;
-#include "vgapi/vgapi_tmp.h"
+#include "api_tmp.h"
 
 struct mapi_table;
 
index fa1e00d1f88523bd6cdfed0b48a7747d65d44247..724e38241b52232a49459d92dd5268683a3eeaa4 100644 (file)
@@ -31,7 +31,6 @@
 #include "api.h"
 #include "renderer.h"
 #include "shaders_cache.h"
-#include "st_inlines.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
@@ -42,7 +41,6 @@
 #include "util/u_sampler.h"
 #include "util/u_string.h"
 
-
 #include "asm_filters.h"
 
 
@@ -73,6 +71,7 @@ static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx,
    templ.width0 = color_data_len;
    templ.height0 = 1;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &templ);
@@ -80,9 +79,9 @@ static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx,
    { /* upload color_data */
       struct pipe_transfer *transfer =
          pipe_get_transfer(pipe, tex,
-                               0, 0, 0,
-                               PIPE_TRANSFER_READ_WRITE ,
-                               0, 0, tex->width0, tex->height0);
+                           0, 0,
+                           PIPE_TRANSFER_READ_WRITE ,
+                           0, 0, tex->width0, tex->height0);
       void *map = pipe->transfer_map(pipe, transfer);
       memcpy(map, color_data, sizeof(VGint)*color_data_len);
       pipe->transfer_unmap(pipe, transfer);
@@ -114,153 +113,11 @@ static INLINE struct pipe_sampler_view *create_texture_1d_view(struct vg_context
    return view;
 }
 
-static INLINE struct pipe_surface * setup_framebuffer(struct vg_image *dst)
-{
-   struct vg_context *ctx = vg_current_context();
-   struct pipe_context *pipe = ctx->pipe;
-   struct pipe_framebuffer_state fb;
-   struct pipe_surface *dst_surf = pipe->screen->get_tex_surface(
-      pipe->screen, dst->sampler_view->texture, 0, 0, 0,
-      PIPE_BIND_RENDER_TARGET);
-
-   /* drawing dest */
-   memset(&fb, 0, sizeof(fb));
-   fb.width  = dst->x + dst_surf->width;
-   fb.height = dst->y + dst_surf->height;
-   fb.nr_cbufs = 1;
-   fb.cbufs[0] = dst_surf;
-   {
-      VGint i;
-      for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i)
-         fb.cbufs[i] = 0;
-   }
-   cso_set_framebuffer(ctx->cso_context, &fb);
-
-   return dst_surf;
-}
-
-static void setup_viewport(struct vg_image *dst)
-{
-   struct vg_context *ctx = vg_current_context();
-   vg_set_viewport(ctx, VEGA_Y0_TOP);
-}
-
-static void setup_blend()
-{
-   struct vg_context *ctx = vg_current_context();
-   struct pipe_blend_state blend;
-   memset(&blend, 0, sizeof(blend));
-   blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
-   blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-   blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
-   blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-   if (ctx->state.vg.filter_channel_mask & VG_RED)
-      blend.rt[0].colormask |= PIPE_MASK_R;
-   if (ctx->state.vg.filter_channel_mask & VG_GREEN)
-      blend.rt[0].colormask |= PIPE_MASK_G;
-   if (ctx->state.vg.filter_channel_mask & VG_BLUE)
-      blend.rt[0].colormask |= PIPE_MASK_B;
-   if (ctx->state.vg.filter_channel_mask & VG_ALPHA)
-      blend.rt[0].colormask |= PIPE_MASK_A;
-   blend.rt[0].blend_enable = 0;
-   cso_set_blend(ctx->cso_context, &blend);
-}
-
-static void setup_constant_buffer(struct vg_context *ctx, const void *buffer,
-                                  VGint param_bytes)
-{
-   struct pipe_context *pipe = ctx->pipe;
-   struct pipe_resource **cbuf = &ctx->filter.buffer;
-
-   /* We always need to get a new buffer, to keep the drivers simple and
-    * avoid gratuitous rendering synchronization. */
-   pipe_resource_reference(cbuf, NULL);
-
-   *cbuf = pipe_buffer_create(pipe->screen, 
-                              PIPE_BIND_CONSTANT_BUFFER,
-                              param_bytes);
-
-   if (*cbuf) {
-      st_no_flush_pipe_buffer_write(ctx, *cbuf,
-                                    0, param_bytes, buffer);
-   }
-
-   ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, *cbuf);
-}
-
-static void setup_samplers(struct vg_context *ctx, struct filter_info *info)
-{
-   struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
-   struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
-   struct pipe_sampler_state sampler[3];
-   int num_samplers = 0;
-   int num_textures = 0;
-
-   samplers[0] = NULL;
-   samplers[1] = NULL;
-   samplers[2] = NULL;
-   samplers[3] = NULL;
-   sampler_views[0] = NULL;
-   sampler_views[1] = NULL;
-   sampler_views[2] = NULL;
-   sampler_views[3] = NULL;
-
-   memset(&sampler[0], 0, sizeof(struct pipe_sampler_state));
-   sampler[0].wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-   sampler[0].wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-   sampler[0].wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-   sampler[0].min_img_filter = PIPE_TEX_MIPFILTER_LINEAR;
-   sampler[0].mag_img_filter = PIPE_TEX_MIPFILTER_LINEAR;
-   sampler[0].normalized_coords = 1;
-
-   switch(info->tiling_mode) {
-   case VG_TILE_FILL:
-      sampler[0].wrap_s = PIPE_TEX_WRAP_CLAMP_TO_BORDER;
-      sampler[0].wrap_t = PIPE_TEX_WRAP_CLAMP_TO_BORDER;
-      memcpy(sampler[0].border_color,
-             ctx->state.vg.tile_fill_color,
-             sizeof(VGfloat) * 4);
-      break;
-   case VG_TILE_PAD:
-      sampler[0].wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      sampler[0].wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      break;
-   case VG_TILE_REPEAT:
-      sampler[0].wrap_s = PIPE_TEX_WRAP_REPEAT;
-      sampler[0].wrap_t = PIPE_TEX_WRAP_REPEAT;
-      break;
-   case VG_TILE_REFLECT:
-      sampler[0].wrap_s = PIPE_TEX_WRAP_MIRROR_REPEAT;
-      sampler[0].wrap_t = PIPE_TEX_WRAP_MIRROR_REPEAT;
-      break;
-   default:
-      debug_assert(!"Unknown tiling mode");
-   }
-
-   samplers[0] = &sampler[0];
-   sampler_views[0] = info->src->sampler_view;
-   ++num_samplers;
-   ++num_textures;
-
-   if (info->extra_texture_view) {
-      memcpy(&sampler[1], &sampler[0], sizeof(struct pipe_sampler_state));
-      samplers[1] = &sampler[1];
-      sampler_views[1] = info->extra_texture_view;
-      ++num_samplers;
-      ++num_textures;
-   }
-
-
-   cso_set_samplers(ctx->cso_context, num_samplers, (const struct pipe_sampler_state **)samplers);
-   cso_set_fragment_sampler_views(ctx->cso_context, num_textures, sampler_views);
-}
-
 static struct vg_shader * setup_color_matrix(struct vg_context *ctx, void *user_data)
 {
    struct vg_shader *shader =
       shader_create_from_text(ctx->pipe, color_matrix_asm, 200,
          PIPE_SHADER_FRAGMENT);
-   cso_set_fragment_shader_handle(ctx->cso_context, shader->driver);
    return shader;
 }
 
@@ -275,7 +132,6 @@ static struct vg_shader * setup_convolution(struct vg_context *ctx, void *user_d
    shader = shader_create_from_text(ctx->pipe, buffer, 200,
                                     PIPE_SHADER_FRAGMENT);
 
-   cso_set_fragment_shader_handle(ctx->cso_context, shader->driver);
    return shader;
 }
 
@@ -285,7 +141,6 @@ static struct vg_shader * setup_lookup(struct vg_context *ctx, void *user_data)
       shader_create_from_text(ctx->pipe, lookup_asm,
                               200, PIPE_SHADER_FRAGMENT);
 
-   cso_set_fragment_shader_handle(ctx->cso_context, shader->driver);
    return shader;
 }
 
@@ -316,49 +171,68 @@ static struct vg_shader * setup_lookup_single(struct vg_context *ctx, void *user
    shader = shader_create_from_text(ctx->pipe, buffer, 200,
                                     PIPE_SHADER_FRAGMENT);
 
-   cso_set_fragment_shader_handle(ctx->cso_context, shader->driver);
    return shader;
 }
 
 static void execute_filter(struct vg_context *ctx,
                            struct filter_info *info)
 {
-   struct pipe_surface *dst_surf;
    struct vg_shader *shader;
+   const struct pipe_sampler_state *samplers[2];
+   struct pipe_sampler_view *views[2];
+   struct pipe_sampler_state sampler;
+   uint tex_wrap;
+
+   memset(&sampler, 0, sizeof(sampler));
+   sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR;
+   sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
+   sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
+   sampler.normalized_coords = 1;
+
+   switch (info->tiling_mode) {
+   case VG_TILE_FILL:
+      tex_wrap = PIPE_TEX_WRAP_CLAMP_TO_BORDER;
+      /* copy border color */
+      memcpy(sampler.border_color, ctx->state.vg.tile_fill_color,
+            sizeof(sampler.border_color));
+      break;
+   case VG_TILE_PAD:
+      tex_wrap = PIPE_TEX_WRAP_CLAMP_TO_EDGE;;
+      break;
+   case VG_TILE_REPEAT:
+      tex_wrap = PIPE_TEX_WRAP_REPEAT;;
+      break;
+   case VG_TILE_REFLECT:
+      tex_wrap = PIPE_TEX_WRAP_MIRROR_REPEAT;
+      break;
+   default:
+      debug_assert(!"Unknown tiling mode");
+      tex_wrap = 0;
+      break;
+   }
+
+   sampler.wrap_s = tex_wrap;
+   sampler.wrap_t = tex_wrap;
+   sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+
+   samplers[0] = samplers[1] = &sampler;
+   views[0] = info->src->sampler_view;
+   views[1] = info->extra_texture_view;
 
-   cso_save_framebuffer(ctx->cso_context);
-   cso_save_fragment_shader(ctx->cso_context);
-   cso_save_viewport(ctx->cso_context);
-   cso_save_blend(ctx->cso_context);
-   cso_save_samplers(ctx->cso_context);
-   cso_save_fragment_sampler_views(ctx->cso_context);
-
-   dst_surf = setup_framebuffer(info->dst);
-   setup_viewport(info->dst);
-   setup_blend();
-   setup_constant_buffer(ctx, info->const_buffer, info->const_buffer_len);
    shader = info->setup_shader(ctx, info->user_data);
-   setup_samplers(ctx, info);
-
-   renderer_draw_texture(ctx->renderer,
-                         info->src->sampler_view->texture,
-                         info->dst->x, info->dst->y,
-                         info->dst->x + info->dst->width,
-                         info->dst->y + info->dst->height,
-                         info->dst->x, info->dst->y,
-                         info->dst->x + info->dst->width,
-                         info->dst->y + info->dst->height);
-
-   cso_restore_framebuffer(ctx->cso_context);
-   cso_restore_fragment_shader(ctx->cso_context);
-   cso_restore_viewport(ctx->cso_context);
-   cso_restore_blend(ctx->cso_context);
-   cso_restore_samplers(ctx->cso_context);
-   cso_restore_fragment_sampler_views(ctx->cso_context);
 
-   vg_shader_destroy(ctx, shader);
+   if (renderer_filter_begin(ctx->renderer,
+            info->dst->sampler_view->texture, VG_TRUE,
+            ctx->state.vg.filter_channel_mask,
+            samplers, views, (info->extra_texture_view) ? 2 : 1,
+            shader->driver, info->const_buffer, info->const_buffer_len)) {
+      renderer_filter(ctx->renderer,
+            info->dst->x, info->dst->y, info->dst->width, info->dst->height,
+            info->src->x, info->src->y, info->src->width, info->src->height);
+      renderer_filter_end(ctx->renderer);
+   }
 
-   pipe_surface_reference(&dst_surf, NULL);
+   vg_shader_destroy(ctx, shader);
 }
 
 void vegaColorMatrix(VGImage dst, VGImage src,
index e9f038c5f9278558f7e1202cbb702d6064994309..ad95409cd00411334554f802511a6dfcc4be1e27 100644 (file)
@@ -303,7 +303,8 @@ void vegaDrawImage(VGImage image)
    }
 
    vg_validate_state(ctx);
-   image_draw((struct vg_image*)image);
+   image_draw((struct vg_image*)image,
+         &ctx->state.vg.image_user_to_surface_matrix);
 }
 
 void vegaSetPixels(VGint dx, VGint dy,
@@ -399,7 +400,6 @@ void vegaReadPixels(void * data, VGint dataStride,
 
    struct st_framebuffer *stfb = ctx->draw_buffer;
    struct st_renderbuffer *strb = stfb->strb;
-   struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
 
    VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4];
    VGfloat *df = (VGfloat*)temp;
@@ -435,21 +435,21 @@ void vegaReadPixels(void * data, VGint dataStride,
       sy = 0;
    }
 
-   if (sx + width > fb->width || sy + height > fb->height) {
-      width = fb->width - sx;
-      height = fb->height - sy;
+   if (sx + width > stfb->width || sy + height > stfb->height) {
+      width = stfb->width - sx;
+      height = stfb->height - sy;
       /* nothing to read */
       if (width <= 0 || height <= 0)
          return;
    }
 
    {
-      VGint y = (fb->height - sy) - 1, yStep = -1;
+      VGint y = (stfb->height - sy) - 1, yStep = -1;
       struct pipe_transfer *transfer;
 
-      transfer = pipe_get_transfer(pipe, strb->texture,  0, 0, 0,
-                                  PIPE_TRANSFER_READ,
-                                  0, 0, sx + width, fb->height - sy);
+      transfer = pipe_get_transfer(pipe, strb->texture,  0, 0,
+                                   PIPE_TRANSFER_READ,
+                                   0, 0, sx + width, stfb->height - sy);
 
       /* Do a row at a time to flip image data vertically */
       for (i = 0; i < height; i++) {
@@ -472,8 +472,8 @@ void vegaCopyPixels(VGint dx, VGint dy,
                     VGint width, VGint height)
 {
    struct vg_context *ctx = vg_current_context();
-   struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
-   struct st_renderbuffer *strb = ctx->draw_buffer->strb;
+   struct st_framebuffer *stfb = ctx->draw_buffer;
+   struct st_renderbuffer *strb = stfb->strb;
 
    if (width <= 0 || height <= 0) {
       vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
@@ -481,8 +481,8 @@ void vegaCopyPixels(VGint dx, VGint dy,
    }
 
    /* do nothing if we copy from outside the fb */
-   if (dx >= (VGint)fb->width || dy >= (VGint)fb->height ||
-       sx >= (VGint)fb->width || sy >= (VGint)fb->height)
+   if (dx >= (VGint)stfb->width || dy >= (VGint)stfb->height ||
+       sx >= (VGint)stfb->width || sy >= (VGint)stfb->height)
       return;
 
    vg_validate_state(ctx);
index 189390ec2d38d582813bca4774f1dc36b06cae46..d96afe663874f1f0b29b07ebe9a20d5105197691 100644 (file)
 
 #include "mask.h"
 #include "api.h"
+#include "renderer.h"
 
 #include "vg_context.h"
 #include "pipe/p_context.h"
-#include "util/u_inlines.h"
-
-#include "util/u_pack_color.h"
-#include "util/u_draw_quad.h"
-
-#define DISABLE_1_1_MASKING 1
-
-/**
- * Draw a screen-aligned quadrilateral.
- * Coords are window coords with y=0=bottom.  These coords will be transformed
- * by the vertex shader and viewport transform.
- */
-static void
-draw_clear_quad(struct vg_context *st,
-                float x0, float y0, float x1, float y1, float z,
-                const VGfloat color[4])
-{
-   struct pipe_context *pipe = st->pipe;
-   struct pipe_resource *buf;
-   VGuint i;
-
-   /* positions */
-   st->clear.vertices[0][0][0] = x0;
-   st->clear.vertices[0][0][1] = y0;
-
-   st->clear.vertices[1][0][0] = x1;
-   st->clear.vertices[1][0][1] = y0;
-
-   st->clear.vertices[2][0][0] = x1;
-   st->clear.vertices[2][0][1] = y1;
-
-   st->clear.vertices[3][0][0] = x0;
-   st->clear.vertices[3][0][1] = y1;
-
-   /* same for all verts: */
-   for (i = 0; i < 4; i++) {
-      st->clear.vertices[i][0][2] = z;
-      st->clear.vertices[i][0][3] = 1.0;
-      st->clear.vertices[i][1][0] = color[0];
-      st->clear.vertices[i][1][1] = color[1];
-      st->clear.vertices[i][1][2] = color[2];
-      st->clear.vertices[i][1][3] = color[3];
-   }
-
-
-   /* put vertex data into vbuf */
-   buf =  pipe_user_buffer_create(pipe->screen,
-                                  st->clear.vertices,
-                                  sizeof(st->clear.vertices),
-                                 PIPE_BIND_VERTEX_BUFFER);
-
-
-   /* draw */
-   if (buf) {
-      cso_set_vertex_elements(st->cso_context, 2, st->velems);
-
-      util_draw_vertex_buffer(pipe, buf, 0,
-                              PIPE_PRIM_TRIANGLE_FAN,
-                              4,  /* verts */
-                              2); /* attribs/vert */
-
-      pipe_resource_reference(&buf, NULL);
-   }
-}
-
-/**
- * Do vgClear by drawing a quadrilateral.
- */
-static void
-clear_with_quad(struct vg_context *st, float x0, float y0,
-                float width, float height, const VGfloat clear_color[4])
-{
-   VGfloat x1, y1;
-
-   vg_validate_state(st);
-
-   x1 = x0 + width;
-   y1 = y0 + height;
-
-   /*
-     printf("%s %f,%f %f,%f\n", __FUNCTION__,
-     x0, y0,
-     x1, y1);
-   */
-
-   cso_save_blend(st->cso_context);
-   cso_save_rasterizer(st->cso_context);
-   cso_save_fragment_shader(st->cso_context);
-   cso_save_vertex_shader(st->cso_context);
-
-   /* blend state: RGBA masking */
-   {
-      struct pipe_blend_state blend;
-      memset(&blend, 0, sizeof(blend));
-      blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.rt[0].colormask = PIPE_MASK_RGBA;
-      cso_set_blend(st->cso_context, &blend);
-   }
-
-   cso_set_rasterizer(st->cso_context, &st->clear.raster);
-
-   cso_set_fragment_shader_handle(st->cso_context, st->clear.fs);
-   cso_set_vertex_shader_handle(st->cso_context, vg_clear_vs(st));
-
-   /* draw quad matching scissor rect (XXX verify coord round-off) */
-   draw_clear_quad(st, x0, y0, x1, y1, 0, clear_color);
-
-   /* Restore pipe state */
-   cso_restore_blend(st->cso_context);
-   cso_restore_rasterizer(st->cso_context);
-   cso_restore_fragment_shader(st->cso_context);
-   cso_restore_vertex_shader(st->cso_context);
-}
-
 
 void vegaMask(VGHandle mask, VGMaskOperation operation,
               VGint x, VGint y,
@@ -176,12 +60,8 @@ void vegaMask(VGHandle mask, VGMaskOperation operation,
       struct vg_image *image = (struct vg_image *)mask;
       mask_using_image(image, operation, x, y, width, height);
    } else if (vg_object_is_valid((void*)mask, VG_OBJECT_MASK)) {
-#if DISABLE_1_1_MASKING
-      return;
-#else
       struct vg_mask_layer *layer = (struct vg_mask_layer *)mask;
       mask_using_layer(layer, operation, x, y, width, height);
-#endif
    } else {
       vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
    }
@@ -191,7 +71,7 @@ void vegaClear(VGint x, VGint y,
                VGint width, VGint height)
 {
    struct vg_context *ctx = vg_current_context();
-   struct pipe_framebuffer_state *fb;
+   struct st_framebuffer *stfb = ctx->draw_buffer;
 
    if (width <= 0 || height <= 0) {
       vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
@@ -208,14 +88,15 @@ void vegaClear(VGint x, VGint y,
                 ctx->state.vg.clear_color[3]);
 #endif
 
-   fb = &ctx->state.g3d.fb;
    /* check for a whole surface clear */
    if (!ctx->state.vg.scissoring &&
-       (x == 0 && y == 0 && width == fb->width && height == fb->height)) {
+       (x == 0 && y == 0 && width == stfb->width && height == stfb->height)) {
       ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
                        ctx->state.vg.clear_color, 1., 0);
-   } else {
-      clear_with_quad(ctx, x, y, width, height, ctx->state.vg.clear_color);
+   } else if (renderer_clear_begin(ctx->renderer)) {
+      /* XXX verify coord round-off */
+      renderer_clear(ctx->renderer, x, y, width, height, ctx->state.vg.clear_color);
+      renderer_clear_end(ctx->renderer);
    }
 }
 
@@ -247,10 +128,6 @@ void vegaRenderToMask(VGPath path,
       return;
    }
 
-#if DISABLE_1_1_MASKING
-   return;
-#endif
-
    vg_validate_state(ctx);
 
    mask_render_to((struct path *)path, paintModes, operation);
@@ -328,9 +205,8 @@ void vegaFillMaskLayer(VGMaskLayer maskLayer,
       return;
    }
 
-#if DISABLE_1_1_MASKING
-   return;
-#endif
+   vg_validate_state(ctx);
+
    mask_layer_fill(mask, x, y, width, height, value);
 }
 
@@ -355,9 +231,7 @@ void vegaCopyMask(VGMaskLayer maskLayer,
       return;
    }
 
-#if DISABLE_1_1_MASKING
-   return;
-#endif
+   vg_validate_state(ctx);
 
    mask = (struct vg_mask_layer*)maskLayer;
    mask_copy(mask, sx, sy, dx, dy, width, height);
index e648549745b941b2813f17dd0473386a218fd481..9e2ab03e01a4ef05d658a0be6837fe319629d304 100644 (file)
@@ -63,8 +63,8 @@ const VGubyte *vegaGetString(VGStringID name)
 {
    struct vg_context *ctx = vg_current_context();
    static const VGubyte *vendor = (VGubyte *)"Tungsten Graphics, Inc";
-   static const VGubyte *renderer = (VGubyte *)"Vega OpenVG 1.0";
-   static const VGubyte *version = (VGubyte *)"1.0";
+   static const VGubyte *renderer = (VGubyte *)"Vega OpenVG 1.1";
+   static const VGubyte *version = (VGubyte *)"1.1";
 
    if (!ctx)
       return NULL;
index a10b009e6314440728ddbdf0b6e6075ffd982db9..a73b6c3effead5f3ea5aea4711f40155379ef7dc 100644 (file)
@@ -30,6 +30,7 @@
 #include "paint.h"
 #include "path.h"
 #include "image.h"
+#include "text.h"
 #include "matrix.h"
 #include "api_consts.h"
 #include "api.h"
@@ -174,6 +175,7 @@ void vegaSeti (VGParamType type, VGint value)
          error = VG_ILLEGAL_ARGUMENT_ERROR;
       else
          state->image_mode = value;
+      break;
 #ifdef OPENVG_VERSION_1_1
    case VG_COLOR_TRANSFORM:
       state->color_transform = value;
@@ -1500,7 +1502,8 @@ VGint vegaGetParameteri(VGHandle object,
 
 #ifdef OPENVG_VERSION_1_1
    case VG_FONT_NUM_GLYPHS: {
-      return 1;
+      struct vg_font *font = (struct vg_font*)object;
+      return font_num_glyphs(font);
    }
       break;
 #endif
index f76adddb5840dd41072610d7ef5add372c61be4e..fe57b7671d95513b8a664ff24eb535abcefed068 100644 (file)
@@ -479,6 +479,7 @@ void vegaDrawPath(VGPath path, VGbitfield paintModes)
 
    if (path_is_empty((struct path*)path))
       return;
-   path_render((struct path*)path, paintModes);
+   path_render((struct path*)path, paintModes,
+         &ctx->state.vg.path_user_to_surface_matrix);
 }
 
index 2a62da0a1de5821991c62bfa871768e009e8a4ef..7c6b479409921154c0e022f5317fa6ea97c86e35 100644 (file)
 #include "VG/openvg.h"
 
 #include "vg_context.h"
+#include "text.h"
+#include "api.h"
 
 #include "util/u_memory.h"
 
 #ifdef OPENVG_VERSION_1_1
 
-struct vg_font {
-   struct vg_object base;
-
-   VGint glyph_indices[200];
-   VGint num_glyphs;
-};
-
 VGFont vegaCreateFont(VGint glyphCapacityHint)
 {
-   struct vg_font *font = 0;
    struct vg_context *ctx = vg_current_context();
 
    if (glyphCapacityHint < 0) {
@@ -49,10 +43,7 @@ VGFont vegaCreateFont(VGint glyphCapacityHint)
       return VG_INVALID_HANDLE;
    }
 
-   font = CALLOC_STRUCT(vg_font);
-   vg_init_object(&font->base, ctx, VG_OBJECT_FONT);
-   vg_context_add_object(ctx, VG_OBJECT_FONT, font);
-   return (VGFont)font;
+   return (VGFont) font_create(glyphCapacityHint);
 }
 
 void vegaDestroyFont(VGFont f)
@@ -64,20 +55,23 @@ void vegaDestroyFont(VGFont f)
       vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
       return;
    }
+   if (!vg_object_is_valid((void *) font, VG_OBJECT_FONT)) {
+      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
+      return;
+   }
 
-   vg_context_remove_object(ctx, VG_OBJECT_FONT, font);
-   /*free(font);*/
+   font_destroy(font);
 }
 
 void vegaSetGlyphToPath(VGFont font,
                         VGuint glyphIndex,
                         VGPath path,
                         VGboolean isHinted,
-                        VGfloat glyphOrigin [2],
-                        VGfloat escapement[2])
+                        const VGfloat glyphOrigin[2],
+                        const VGfloat escapement[2])
 {
    struct vg_context *ctx = vg_current_context();
-   struct vg_object *pathObj;
+   struct path *pathObj;
    struct vg_font *f;
 
    if (font == VG_INVALID_HANDLE ||
@@ -95,25 +89,22 @@ void vegaSetGlyphToPath(VGFont font,
       vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
       return;
    }
-   pathObj = (struct vg_object*)path;
-   if (pathObj && pathObj->type != VG_OBJECT_PATH) {
-      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
-      return;
-   }
 
-   f = (struct vg_font*)font;
-   f->glyph_indices[f->num_glyphs] = glyphIndex;
-   ++f->num_glyphs;
+   pathObj = (struct path*) path;
+   f = (struct vg_font*) font;
+
+   font_set_glyph_to_path(f, glyphIndex, pathObj,
+         isHinted, glyphOrigin, escapement);
 }
 
 void vegaSetGlyphToImage(VGFont font,
                          VGuint glyphIndex,
                          VGImage image,
-                         VGfloat glyphOrigin [2],
-                         VGfloat escapement[2])
+                         const VGfloat glyphOrigin[2],
+                         const VGfloat escapement[2])
 {
    struct vg_context *ctx = vg_current_context();
-   struct vg_object *img_obj;
+   struct vg_image *img_obj;
    struct vg_font *f;
 
    if (font == VG_INVALID_HANDLE ||
@@ -131,26 +122,11 @@ void vegaSetGlyphToImage(VGFont font,
       vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
       return;
    }
-   img_obj = (struct vg_object*)image;
-   if (img_obj && img_obj->type != VG_OBJECT_IMAGE) {
-      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
-      return;
-   }
+
+   img_obj = (struct vg_image*)image;
    f = (struct vg_font*)font;
-   f->glyph_indices[f->num_glyphs] = glyphIndex;
-   ++f->num_glyphs;
-}
 
-static INLINE VGboolean font_contains_glyph(struct vg_font *font,
-                                            VGuint glyph_index)
-{
-   VGint i;
-   for (i = 0; i < font->num_glyphs; ++i) {
-      if (font->glyph_indices[i] == glyph_index) {
-         return VG_TRUE;
-      }
-   }
-   return VG_FALSE;
+   font_set_glyph_to_image(f, glyphIndex, img_obj, glyphOrigin, escapement);
 }
 
 void vegaClearGlyph(VGFont font,
@@ -158,30 +134,15 @@ void vegaClearGlyph(VGFont font,
 {
    struct vg_context *ctx = vg_current_context();
    struct vg_font *f;
-   VGint i;
 
    if (font == VG_INVALID_HANDLE) {
       vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
       return;
    }
-   if (glyphIndex <= 0) {
-      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
-      return;
-   }
-   f = (struct vg_font*)font;
-   if (!font_contains_glyph(f, glyphIndex)) {
-      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
-      return;
-   }
 
-   for (i = 0; i < f->num_glyphs; ++i) {
-      if (f->glyph_indices[i] == glyphIndex) {
-         /*FIXME*/
-         f->glyph_indices[f->num_glyphs] = 0;
-         --f->num_glyphs;
-         return;
-      }
-   }
+   f = (struct vg_font*) font;
+
+   font_clear_glyph(f, glyphIndex);
 }
 
 void vegaDrawGlyph(VGFont font,
@@ -196,31 +157,24 @@ void vegaDrawGlyph(VGFont font,
       vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
       return;
    }
-   if (glyphIndex <= 0) {
-      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
-      return;
-   }
    if (paintModes & (~(VG_STROKE_PATH|VG_FILL_PATH))) {
       vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
       return;
    }
    f = (struct vg_font*)font;
-   if (!font_contains_glyph(f, glyphIndex)) {
-      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
-      return;
-   }
+
+   font_draw_glyph(f, glyphIndex, paintModes, allowAutoHinting);
 }
 
 void vegaDrawGlyphs(VGFont font,
                     VGint glyphCount,
-                    VGuint *glyphIndices,
-                    VGfloat *adjustments_x,
-                    VGfloat *adjustments_y,
+                    const VGuint *glyphIndices,
+                    const VGfloat *adjustments_x,
+                    const VGfloat *adjustments_y,
                     VGbitfield paintModes,
                     VGboolean allowAutoHinting)
 {
    struct vg_context *ctx = vg_current_context();
-   VGint i;
    struct vg_font *f;
 
    if (font == VG_INVALID_HANDLE) {
@@ -235,8 +189,8 @@ void vegaDrawGlyphs(VGFont font,
       vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
       return;
    }
-   if (!adjustments_x || !is_aligned(adjustments_x) ||
-       !adjustments_y || !is_aligned(adjustments_y)) {
+   if ((adjustments_x && !is_aligned(adjustments_x)) ||
+       (adjustments_y && !is_aligned(adjustments_y))) {
       vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
       return;
    }
@@ -246,13 +200,9 @@ void vegaDrawGlyphs(VGFont font,
    }
 
    f = (struct vg_font*)font;
-   for (i = 0; i < glyphCount; ++i) {
-      VGuint glyph_index = glyphIndices[i];
-      if (!font_contains_glyph(f, glyph_index)) {
-         vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
-         return;
-      }
-   }
+
+   font_draw_glyphs(f, glyphCount, glyphIndices,
+         adjustments_x, adjustments_y, paintModes, allowAutoHinting);
 }
 
-#endif
+#endif /* OPENVG_VERSION_1_1 */
index 27773467fa8090ac18ca49b15e7446d00a02198d..77e6a14fe9973d4cbb357c72366e35839058a3d3 100644 (file)
@@ -44,9 +44,31 @@ solid_fill( struct ureg_program *ureg,
             struct ureg_dst *temp,
             struct ureg_src *constant)
 {
-   ureg_MOV(ureg, *out, constant[0]);
+   ureg_MOV(ureg, *out, constant[2]);
 }
 
+/**
+ * Perform frag-coord-to-paint-coord transform.  The transformation is in
+ * CONST[4..6].
+ */
+#define PAINT_TRANSFORM                                                 \
+   ureg_MOV(ureg, ureg_writemask(temp[0], TGSI_WRITEMASK_XY), in[0]);   \
+   ureg_MOV(ureg,                                                       \
+            ureg_writemask(temp[0], TGSI_WRITEMASK_Z),                  \
+            ureg_scalar(constant[3], TGSI_SWIZZLE_Y));                  \
+   ureg_DP3(ureg, temp[1], constant[4], ureg_src(temp[0]));             \
+   ureg_DP3(ureg, temp[2], constant[5], ureg_src(temp[0]));             \
+   ureg_DP3(ureg, temp[3], constant[6], ureg_src(temp[0]));             \
+   ureg_RCP(ureg, temp[3], ureg_src(temp[3]));                          \
+   ureg_MUL(ureg, temp[1], ureg_src(temp[1]), ureg_src(temp[3]));       \
+   ureg_MUL(ureg, temp[2], ureg_src(temp[2]), ureg_src(temp[3]));       \
+   ureg_MOV(ureg,                                                       \
+            ureg_writemask(temp[4], TGSI_WRITEMASK_X),                  \
+            ureg_src(temp[1]));                                         \
+   ureg_MOV(ureg,                                                       \
+            ureg_writemask(temp[4], TGSI_WRITEMASK_Y),                  \
+            ureg_src(temp[2]));
+
 static INLINE void
 linear_grad( struct ureg_program *ureg,
              struct ureg_dst *out,
@@ -55,30 +77,19 @@ linear_grad( struct ureg_program *ureg,
              struct ureg_dst *temp,
              struct ureg_src *constant)
 {
+   PAINT_TRANSFORM
 
-   ureg_MOV(ureg,
-            ureg_writemask(temp[0], TGSI_WRITEMASK_XY),
-            in[0]);
-   ureg_MOV(ureg,
-            ureg_writemask(temp[0], TGSI_WRITEMASK_Z),
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y));
-   ureg_DP3(ureg, temp[1], constant[2], ureg_src(temp[0]));
-   ureg_DP3(ureg, temp[2], constant[3], ureg_src(temp[0]));
-   ureg_DP3(ureg, temp[3], constant[4], ureg_src(temp[0]));
-   ureg_RCP(ureg, temp[3], ureg_src(temp[3]));
-   ureg_MUL(ureg, temp[1], ureg_src(temp[1]), ureg_src(temp[3]));
-   ureg_MUL(ureg, temp[2], ureg_src(temp[2]), ureg_src(temp[3]));
-   ureg_MOV(ureg, ureg_writemask(temp[4], TGSI_WRITEMASK_X), ureg_src(temp[1]));
-   ureg_MOV(ureg, ureg_writemask(temp[4], TGSI_WRITEMASK_Y), ureg_src(temp[2]));
+   /* grad = DP2((x, y), CONST[2].xy) * CONST[2].z */
    ureg_MUL(ureg, temp[0],
-            ureg_scalar(constant[0], TGSI_SWIZZLE_Y),
+            ureg_scalar(constant[2], TGSI_SWIZZLE_Y),
             ureg_scalar(ureg_src(temp[4]), TGSI_SWIZZLE_Y));
    ureg_MAD(ureg, temp[1],
-            ureg_scalar(constant[0], TGSI_SWIZZLE_X),
+            ureg_scalar(constant[2], TGSI_SWIZZLE_X),
             ureg_scalar(ureg_src(temp[4]), TGSI_SWIZZLE_X),
             ureg_src(temp[0]));
    ureg_MUL(ureg, temp[2], ureg_src(temp[1]),
-            ureg_scalar(constant[0], TGSI_SWIZZLE_Z));
+            ureg_scalar(constant[2], TGSI_SWIZZLE_Z));
+
    ureg_TEX(ureg, *out, TGSI_TEXTURE_1D, ureg_src(temp[2]), sampler[0]);
 }
 
@@ -90,52 +101,32 @@ radial_grad( struct ureg_program *ureg,
              struct ureg_dst *temp,
              struct ureg_src *constant)
 {
-
-   ureg_MOV(ureg, ureg_writemask(temp[0], TGSI_WRITEMASK_XY), in[0]);
-   ureg_MOV(ureg,
-            ureg_writemask(temp[0], TGSI_WRITEMASK_Z),
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y));
-   ureg_DP3(ureg, temp[1], constant[2], ureg_src(temp[0]));
-   ureg_DP3(ureg, temp[2], constant[3], ureg_src(temp[0]));
-   ureg_DP3(ureg, temp[3], constant[4], ureg_src(temp[0]));
+   PAINT_TRANSFORM
+
+   /*
+    * Calculate (sqrt(B^2 + AC) - B) / A, where
+    *
+    *   A is CONST[2].z,
+    *   B is DP2((x, y), CONST[2].xy), and
+    *   C is DP2((x, y), (x, y)).
+    */
+
+   /* B and C */
+   ureg_DP2(ureg, temp[0], ureg_src(temp[4]), constant[2]);
+   ureg_DP2(ureg, temp[1], ureg_src(temp[4]), ureg_src(temp[4]));
+
+   /* the square root */
+   ureg_MUL(ureg, temp[2], ureg_src(temp[0]), ureg_src(temp[0]));
+   ureg_MAD(ureg, temp[3], ureg_src(temp[1]),
+         ureg_scalar(constant[2], TGSI_SWIZZLE_Z), ureg_src(temp[2]));
+   ureg_RSQ(ureg, temp[3], ureg_src(temp[3]));
    ureg_RCP(ureg, temp[3], ureg_src(temp[3]));
-   ureg_MUL(ureg, temp[1], ureg_src(temp[1]), ureg_src(temp[3]));
-   ureg_MUL(ureg, temp[2], ureg_src(temp[2]), ureg_src(temp[3]));
-   ureg_MOV(ureg, ureg_writemask(temp[5], TGSI_WRITEMASK_X), ureg_src(temp[1]));
-   ureg_MOV(ureg, ureg_writemask(temp[5], TGSI_WRITEMASK_Y), ureg_src(temp[2]));
-   ureg_MUL(ureg, temp[0], ureg_scalar(constant[0], TGSI_SWIZZLE_Y),
-            ureg_scalar(ureg_src(temp[5]), TGSI_SWIZZLE_Y));
-   ureg_MAD(ureg, temp[1],
-            ureg_scalar(constant[0], TGSI_SWIZZLE_X),
-            ureg_scalar(ureg_src(temp[5]), TGSI_SWIZZLE_X), ureg_src(temp[0]));
-   ureg_ADD(ureg, temp[1], ureg_src(temp[1]), ureg_src(temp[1]));
-   ureg_MUL(ureg, temp[3],
-            ureg_scalar(ureg_src(temp[5]), TGSI_SWIZZLE_Y),
-            ureg_scalar(ureg_src(temp[5]), TGSI_SWIZZLE_Y));
-   ureg_MAD(ureg, temp[4],
-            ureg_scalar(ureg_src(temp[5]), TGSI_SWIZZLE_X),
-            ureg_scalar(ureg_src(temp[5]), TGSI_SWIZZLE_X),
-            ureg_src(temp[3]));
-   ureg_MOV(ureg, temp[4], ureg_negate(ureg_src(temp[4])));
-   ureg_MUL(ureg, temp[2],
-            ureg_scalar(constant[0], TGSI_SWIZZLE_Z),
-            ureg_src(temp[4]));
-   ureg_MUL(ureg, temp[0],
-            ureg_scalar(constant[1], TGSI_SWIZZLE_W),
-            ureg_src(temp[2]));
-   ureg_MUL(ureg, temp[3], ureg_src(temp[1]), ureg_src(temp[1]));
-
-   ureg_SUB(ureg, temp[2], ureg_src(temp[3]), ureg_src(temp[0]));
-   ureg_RSQ(ureg, temp[2], ureg_abs(ureg_src(temp[2])));
-   ureg_RCP(ureg, temp[2], ureg_src(temp[2]));
-   ureg_SUB(ureg, temp[1], ureg_src(temp[2]), ureg_src(temp[1]));
-   ureg_ADD(ureg, temp[0],
-            ureg_scalar(constant[0], TGSI_SWIZZLE_Z),
-            ureg_scalar(constant[0], TGSI_SWIZZLE_Z));
-   ureg_RCP(ureg, temp[0], ureg_src(temp[0]));
-   ureg_MUL(ureg, temp[2], ureg_src(temp[1]), ureg_src(temp[0]));
-   ureg_TEX(ureg, *out, TGSI_TEXTURE_1D, ureg_src(temp[2]), sampler[0]);
 
+   ureg_SUB(ureg, temp[3], ureg_src(temp[3]), ureg_src(temp[0]));
+   ureg_RCP(ureg, temp[0], ureg_scalar(constant[2], TGSI_SWIZZLE_Z));
+   ureg_MUL(ureg, temp[0], ureg_src(temp[0]), ureg_src(temp[3]));
+
+   ureg_TEX(ureg, *out, TGSI_TEXTURE_1D, ureg_src(temp[0]), sampler[0]);
 }
 
 
@@ -147,22 +138,11 @@ pattern( struct ureg_program *ureg,
          struct ureg_dst     *temp,
          struct ureg_src     *constant)
 {
-   ureg_MOV(ureg,
-            ureg_writemask(temp[0], TGSI_WRITEMASK_XY),
-            in[0]);
-   ureg_MOV(ureg,
-            ureg_writemask(temp[0], TGSI_WRITEMASK_Z),
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y));
-   ureg_DP3(ureg, temp[1], constant[2], ureg_src(temp[0]));
-   ureg_DP3(ureg, temp[2], constant[3], ureg_src(temp[0]));
-   ureg_DP3(ureg, temp[3], constant[4], ureg_src(temp[0]));
-   ureg_RCP(ureg, temp[3], ureg_src(temp[3]));
-   ureg_MUL(ureg, temp[1], ureg_src(temp[1]), ureg_src(temp[3]));
-   ureg_MUL(ureg, temp[2], ureg_src(temp[2]), ureg_src(temp[3]));
-   ureg_MOV(ureg, ureg_writemask(temp[4], TGSI_WRITEMASK_X), ureg_src(temp[1]));
-   ureg_MOV(ureg, ureg_writemask(temp[4], TGSI_WRITEMASK_Y), ureg_src(temp[2]));
+   PAINT_TRANSFORM
+
+   /* (s, t) = (x / tex_width, y / tex_height) */
    ureg_RCP(ureg, temp[0],
-            ureg_swizzle(constant[1],
+            ureg_swizzle(constant[3],
                          TGSI_SWIZZLE_Z,
                          TGSI_SWIZZLE_W,
                          TGSI_SWIZZLE_Z,
@@ -176,22 +156,21 @@ pattern( struct ureg_program *ureg,
             ureg_writemask(temp[1], TGSI_WRITEMASK_Y),
             ureg_src(temp[1]),
             ureg_src(temp[0]));
+
    ureg_TEX(ureg, *out, TGSI_TEXTURE_2D, ureg_src(temp[1]), sampler[0]);
 }
 
 static INLINE void
-mask( struct ureg_program *ureg,
-      struct ureg_dst *out,
-      struct ureg_src *in,
-      struct ureg_src *sampler,
-      struct ureg_dst *temp,
-      struct ureg_src *constant)
+paint_degenerate( struct ureg_program *ureg,
+                  struct ureg_dst *out,
+                  struct ureg_src *in,
+                  struct ureg_src *sampler,
+                  struct ureg_dst *temp,
+                  struct ureg_src *constant)
 {
-   ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[1]);
-   ureg_MUL(ureg, ureg_writemask(temp[0], TGSI_WRITEMASK_W),
-            ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_MOV(ureg, *out, ureg_src(temp[0]));
+   /* CONST[3].y is 1.0f */
+   ureg_MOV(ureg, temp[1], ureg_scalar(constant[3], TGSI_SWIZZLE_Y));
+   ureg_TEX(ureg, *out, TGSI_TEXTURE_1D, ureg_src(temp[1]), sampler[0]);
 }
 
 static INLINE void
@@ -202,7 +181,9 @@ image_normal( struct ureg_program *ureg,
               struct ureg_dst *temp,
               struct ureg_src *constant)
 {
-   ureg_TEX(ureg, *out, TGSI_TEXTURE_2D, in[1], sampler[3]);
+   /* store and pass image color in TEMP[1] */
+   ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[1], sampler[3]);
+   ureg_MOV(ureg, *out, ureg_src(temp[1]));
 }
 
 
@@ -214,6 +195,7 @@ image_multiply( struct ureg_program *ureg,
                 struct ureg_dst *temp,
                 struct ureg_src *constant)
 {
+   /* store and pass image color in TEMP[1] */
    ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[1], sampler[3]);
    ureg_MUL(ureg, *out, ureg_src(temp[0]), ureg_src(temp[1]));
 }
@@ -227,43 +209,279 @@ image_stencil( struct ureg_program *ureg,
                struct ureg_dst *temp,
                struct ureg_src *constant)
 {
+   /* store and pass image color in TEMP[1] */
    ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[1], sampler[3]);
-   ureg_MUL(ureg, *out, ureg_src(temp[0]), ureg_src(temp[1]));
+   ureg_MOV(ureg, *out, ureg_src(temp[0]));
+}
+
+static INLINE void
+color_transform( struct ureg_program *ureg,
+                 struct ureg_dst *out,
+                 struct ureg_src *in,
+                 struct ureg_src *sampler,
+                 struct ureg_dst *temp,
+                 struct ureg_src *constant)
+{
+   /* note that TEMP[1] may already be used for image color */
+
+   ureg_MAD(ureg, temp[2], ureg_src(temp[0]), constant[0], constant[1]);
+   /* clamp to [0.0f, 1.0f] */
+   ureg_CLAMP(ureg, temp[2],
+              ureg_src(temp[2]),
+              ureg_scalar(constant[3], TGSI_SWIZZLE_X),
+              ureg_scalar(constant[3], TGSI_SWIZZLE_Y));
+   ureg_MOV(ureg, *out, ureg_src(temp[2]));
+}
+
+static INLINE void
+alpha_normal( struct ureg_program *ureg,
+              struct ureg_dst *out,
+              struct ureg_src *in,
+              struct ureg_src *sampler,
+              struct ureg_dst *temp,
+              struct ureg_src *constant)
+{
+   /* save per-channel alpha in TEMP[1] */
+   ureg_MOV(ureg, temp[1], ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W));
+
+   ureg_MOV(ureg, *out, ureg_src(temp[0]));
 }
 
-#define EXTENDED_BLENDER_OVER_FUNC                                      \
-   ureg_SUB(ureg, temp[3],                                              \
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y),                   \
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));            \
-   ureg_SUB(ureg, temp[3],                                              \
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y),                   \
-            ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W));            \
-   ureg_MUL(ureg, temp[3], ureg_src(temp[0]), ureg_src(temp[3]));       \
-   ureg_MUL(ureg, temp[4], ureg_src(temp[1]), ureg_src(temp[4]));       \
-   ureg_ADD(ureg, temp[3], ureg_src(temp[3]), ureg_src(temp[4]));
+static INLINE void
+alpha_per_channel( struct ureg_program *ureg,
+                   struct ureg_dst *out,
+                   struct ureg_src *in,
+                   struct ureg_src *sampler,
+                   struct ureg_dst *temp,
+                   struct ureg_src *constant)
+{
+   /* save per-channel alpha in TEMP[1] */
+   ureg_MUL(ureg,
+            ureg_writemask(temp[1], TGSI_WRITEMASK_W),
+            ureg_src(temp[0]),
+            ureg_src(temp[1]));
+   ureg_MUL(ureg,
+            ureg_writemask(temp[1], TGSI_WRITEMASK_XYZ),
+            ureg_src(temp[1]),
+            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
 
+   /* update alpha */
+   ureg_MOV(ureg,
+            ureg_writemask(temp[0], TGSI_WRITEMASK_W),
+            ureg_src(temp[1]));
+   ureg_MOV(ureg, *out, ureg_src(temp[0]));
+}
 
+/**
+ * Premultiply src and dst.
+ */
 static INLINE void
-blend_multiply( struct ureg_program *ureg,
+blend_premultiply( struct ureg_program *ureg,
+                   struct ureg_src src,
+                   struct ureg_src src_channel_alpha,
+                   struct ureg_src dst)
+{
+   /* premultiply src */
+   ureg_MUL(ureg,
+            ureg_writemask(ureg_dst(src), TGSI_WRITEMASK_XYZ),
+            src,
+            src_channel_alpha);
+   /* premultiply dst */
+   ureg_MUL(ureg,
+            ureg_writemask(ureg_dst(dst), TGSI_WRITEMASK_XYZ),
+            dst,
+            ureg_scalar(dst, TGSI_SWIZZLE_W));
+}
+
+/**
+ * Unpremultiply src.
+ */
+static INLINE void
+blend_unpremultiply( struct ureg_program *ureg,
+                     struct ureg_src src,
+                     struct ureg_src one,
+                     struct ureg_dst temp[1])
+{
+   /* replace 0.0f by 1.0f before calculating reciprocal */
+   ureg_CMP(ureg,
+            temp[0],
+            ureg_negate(ureg_scalar(src, TGSI_SWIZZLE_W)),
+            ureg_scalar(src, TGSI_SWIZZLE_W),
+            one);
+   ureg_RCP(ureg, temp[0], ureg_src(temp[0]));
+
+   ureg_MUL(ureg,
+            ureg_writemask(ureg_dst(src), TGSI_WRITEMASK_XYZ),
+            src,
+            ureg_src(temp[0]));
+}
+
+/**
+ * Emit instructions for the specified blend mode.  Colors will be
+ * unpremultiplied.  Two temporary registers are required.
+ *
+ * The output is written back to src.
+ */
+static INLINE void
+blend_generic(struct ureg_program *ureg,
+              VGBlendMode mode,
+              struct ureg_src src,
+              struct ureg_src src_channel_alpha,
+              struct ureg_src dst,
+              struct ureg_src one,
+              struct ureg_dst temp[2])
+{
+   struct ureg_dst out;
+
+   blend_premultiply(ureg, src, src_channel_alpha, dst);
+
+   /* blend in-place */
+   out = ureg_dst(src);
+
+   switch (mode) {
+   case VG_BLEND_SRC:
+      ureg_MOV(ureg, out, src);
+      break;
+   case VG_BLEND_SRC_OVER:
+      /* RGBA_out = RGBA_src + (1 - A_src) * RGBA_dst */
+      ureg_SUB(ureg, temp[0], one, src_channel_alpha);
+      ureg_MAD(ureg, out, ureg_src(temp[0]), dst, src);
+      break;
+   case VG_BLEND_DST_OVER:
+      /* RGBA_out = RGBA_dst + (1 - A_dst) * RGBA_src */
+      ureg_SUB(ureg, temp[0], one, ureg_scalar(dst, TGSI_SWIZZLE_W));
+      ureg_MAD(ureg, out, ureg_src(temp[0]), src, dst);
+      break;
+   case VG_BLEND_SRC_IN:
+      ureg_MUL(ureg, out, src, ureg_scalar(dst, TGSI_SWIZZLE_W));
+      break;
+   case VG_BLEND_DST_IN:
+      ureg_MUL(ureg, out, dst, src_channel_alpha);
+      break;
+   case VG_BLEND_MULTIPLY:
+      /*
+       * RGB_out = (1 - A_dst) * RGB_src + (1 - A_src) * RGB_dst +
+       *           RGB_src * RGB_dst
+       */
+      ureg_MAD(ureg, temp[0],
+            ureg_scalar(dst, TGSI_SWIZZLE_W), ureg_negate(src), src);
+      ureg_MAD(ureg, temp[1],
+            src_channel_alpha, ureg_negate(dst), dst);
+      ureg_MAD(ureg, temp[0], src, dst, ureg_src(temp[0]));
+      ureg_ADD(ureg, out, ureg_src(temp[0]), ureg_src(temp[1]));
+      /* alpha is src over */
+      ureg_ADD(ureg, ureg_writemask(out, TGSI_WRITEMASK_W),
+            src, ureg_src(temp[1]));
+      break;
+   case VG_BLEND_SCREEN:
+      /* RGBA_out = RGBA_src + (1 - RGBA_src) * RGBA_dst */
+      ureg_SUB(ureg, temp[0], one, src);
+      ureg_MAD(ureg, out, ureg_src(temp[0]), dst, src);
+      break;
+   case VG_BLEND_DARKEN:
+   case VG_BLEND_LIGHTEN:
+      /* src over */
+      ureg_SUB(ureg, temp[0], one, src_channel_alpha);
+      ureg_MAD(ureg, temp[0], ureg_src(temp[0]), dst, src);
+      /* dst over */
+      ureg_SUB(ureg, temp[1], one, ureg_scalar(dst, TGSI_SWIZZLE_W));
+      ureg_MAD(ureg, temp[1], ureg_src(temp[1]), src, dst);
+      /* take min/max for colors */
+      if (mode == VG_BLEND_DARKEN) {
+         ureg_MIN(ureg, ureg_writemask(out, TGSI_WRITEMASK_XYZ),
+               ureg_src(temp[0]), ureg_src(temp[1]));
+      }
+      else {
+         ureg_MAX(ureg, ureg_writemask(out, TGSI_WRITEMASK_XYZ),
+               ureg_src(temp[0]), ureg_src(temp[1]));
+      }
+      break;
+   case VG_BLEND_ADDITIVE:
+      /* RGBA_out = RGBA_src + RGBA_dst */
+      ureg_ADD(ureg, temp[0], src, dst);
+      ureg_MIN(ureg, out, ureg_src(temp[0]), one);
+      break;
+   default:
+      assert(0);
+      break;
+   }
+
+   blend_unpremultiply(ureg, src, one, temp);
+}
+
+#define BLEND_GENERIC(mode) \
+   do { \
+      ureg_TEX(ureg, temp[2], TGSI_TEXTURE_2D, in[0], sampler[2]);         \
+      blend_generic(ureg, (mode), ureg_src(temp[0]), ureg_src(temp[1]),    \
+                    ureg_src(temp[2]),                                     \
+                    ureg_scalar(constant[3], TGSI_SWIZZLE_Y), temp + 3);   \
+      ureg_MOV(ureg, *out, ureg_src(temp[0]));                             \
+   } while (0)
+
+static INLINE void
+blend_src( struct ureg_program *ureg,
+           struct ureg_dst *out,
+           struct ureg_src *in,
+           struct ureg_src *sampler,
+           struct ureg_dst *temp,
+           struct ureg_src *constant)
+{
+   BLEND_GENERIC(VG_BLEND_SRC);
+}
+
+static INLINE void
+blend_src_over( struct ureg_program *ureg,
                 struct ureg_dst *out,
                 struct ureg_src *in,
                 struct ureg_src *sampler,
                 struct ureg_dst *temp,
                 struct ureg_src *constant)
 {
-   ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[2]);
-   EXTENDED_BLENDER_OVER_FUNC
-   ureg_MUL(ureg, temp[4], ureg_src(temp[0]), ureg_src(temp[1]));
-   ureg_ADD(ureg, temp[1], ureg_src(temp[4]), ureg_src(temp[3]));
+   BLEND_GENERIC(VG_BLEND_SRC_OVER);
+}
 
-   ureg_MUL(ureg, temp[2], ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_ADD(ureg, temp[3], ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_SUB(ureg, ureg_writemask(temp[1], TGSI_WRITEMASK_W),
-            ureg_src(temp[3]), ureg_src(temp[2]));
+static INLINE void
+blend_dst_over( struct ureg_program *ureg,
+                struct ureg_dst *out,
+                struct ureg_src *in,
+                struct ureg_src *sampler,
+                struct ureg_dst *temp,
+                struct ureg_src *constant)
+{
+   BLEND_GENERIC(VG_BLEND_DST_OVER);
+}
 
-   ureg_MOV(ureg, *out, ureg_src(temp[1]));
+static INLINE void
+blend_src_in( struct ureg_program *ureg,
+              struct ureg_dst *out,
+              struct ureg_src *in,
+              struct ureg_src *sampler,
+              struct ureg_dst *temp,
+              struct ureg_src *constant)
+{
+   BLEND_GENERIC(VG_BLEND_SRC_IN);
+}
+
+static INLINE void
+blend_dst_in( struct ureg_program *ureg,
+              struct ureg_dst *out,
+              struct ureg_src *in,
+              struct ureg_src *sampler,
+              struct ureg_dst *temp,
+              struct ureg_src *constant)
+{
+   BLEND_GENERIC(VG_BLEND_DST_IN);
+}
+
+static INLINE void
+blend_multiply( struct ureg_program *ureg,
+                struct ureg_dst *out,
+                struct ureg_src *in,
+                struct ureg_src *sampler,
+                struct ureg_dst *temp,
+                struct ureg_src *constant)
+{
+   BLEND_GENERIC(VG_BLEND_MULTIPLY);
 }
 
 static INLINE void
@@ -274,10 +492,7 @@ blend_screen( struct ureg_program *ureg,
               struct ureg_dst     *temp,
               struct ureg_src     *constant)
 {
-   ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[2]);
-   ureg_ADD(ureg, temp[3], ureg_src(temp[0]), ureg_src(temp[1]));
-   ureg_MUL(ureg, temp[2], ureg_src(temp[0]), ureg_src(temp[1]));
-   ureg_SUB(ureg, *out, ureg_src(temp[3]), ureg_src(temp[2]));
+   BLEND_GENERIC(VG_BLEND_SCREEN);
 }
 
 static INLINE void
@@ -288,23 +503,7 @@ blend_darken( struct ureg_program *ureg,
               struct ureg_dst     *temp,
               struct ureg_src     *constant)
 {
-   ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[2]);
-   EXTENDED_BLENDER_OVER_FUNC
-   ureg_MUL(ureg, temp[4], ureg_src(temp[0]),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_MUL(ureg, temp[5], ureg_src(temp[1]),
-            ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W));
-   ureg_MIN(ureg, temp[4], ureg_src(temp[4]), ureg_src(temp[5]));
-   ureg_ADD(ureg, temp[1], ureg_src(temp[3]), ureg_src(temp[4]));
-
-   ureg_MUL(ureg, temp[2], ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_ADD(ureg, temp[3], ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_SUB(ureg, ureg_writemask(temp[1], TGSI_WRITEMASK_W),
-            ureg_src(temp[3]), ureg_src(temp[2]));
-
-   ureg_MOV(ureg, *out, ureg_src(temp[1]));
+   BLEND_GENERIC(VG_BLEND_DARKEN);
 }
 
 static INLINE void
@@ -315,23 +514,33 @@ blend_lighten( struct ureg_program *ureg,
                struct ureg_dst *temp,
                struct ureg_src     *constant)
 {
-   ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[2]);
-   EXTENDED_BLENDER_OVER_FUNC
-   ureg_MUL(ureg, temp[4], ureg_src(temp[0]),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_MUL(ureg, temp[5], ureg_src(temp[1]),
-            ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W));
-   ureg_MAX(ureg, temp[4], ureg_src(temp[4]), ureg_src(temp[5]));
-   ureg_ADD(ureg, temp[1], ureg_src(temp[3]), ureg_src(temp[4]));
+   BLEND_GENERIC(VG_BLEND_LIGHTEN);
+}
 
-   ureg_MUL(ureg, temp[2], ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_ADD(ureg, temp[3], ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
-            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
-   ureg_SUB(ureg, ureg_writemask(temp[1], TGSI_WRITEMASK_W),
-            ureg_src(temp[3]), ureg_src(temp[2]));
+static INLINE void
+blend_additive( struct ureg_program *ureg,
+                struct ureg_dst *out,
+                struct ureg_src *in,
+                struct ureg_src *sampler,
+                struct ureg_dst *temp,
+                struct ureg_src *constant)
+{
+   BLEND_GENERIC(VG_BLEND_ADDITIVE);
+}
 
-   ureg_MOV(ureg, *out, ureg_src(temp[1]));
+static INLINE void
+mask( struct ureg_program *ureg,
+      struct ureg_dst *out,
+      struct ureg_src *in,
+      struct ureg_src *sampler,
+      struct ureg_dst *temp,
+      struct ureg_src *constant)
+{
+   ureg_TEX(ureg, temp[1], TGSI_TEXTURE_2D, in[0], sampler[1]);
+   ureg_MUL(ureg, ureg_writemask(temp[0], TGSI_WRITEMASK_W),
+            ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_W),
+            ureg_scalar(ureg_src(temp[1]), TGSI_SWIZZLE_W));
+   ureg_MOV(ureg, *out, ureg_src(temp[0]));
 }
 
 static INLINE void
@@ -369,11 +578,11 @@ color_bw( struct ureg_program *ureg,
                 struct ureg_src *constant)
 {
    ureg_ADD(ureg, temp[1],
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y),
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y));
+            ureg_scalar(constant[3], TGSI_SWIZZLE_Y),
+            ureg_scalar(constant[3], TGSI_SWIZZLE_Y));
    ureg_RCP(ureg, temp[2], ureg_src(temp[1]));
    ureg_ADD(ureg, temp[1],
-            ureg_scalar(constant[1], TGSI_SWIZZLE_Y),
+            ureg_scalar(constant[3], TGSI_SWIZZLE_Y),
             ureg_src(temp[2]));
    ureg_ADD(ureg, ureg_writemask(temp[2], TGSI_WRITEMASK_X),
             ureg_scalar(ureg_src(temp[0]), TGSI_SWIZZLE_X),
@@ -410,46 +619,75 @@ struct shader_asm_info {
 };
 
 
-static const struct shader_asm_info shaders_asm[] = {
-   /* fills */
+/* paint types */
+static const struct shader_asm_info shaders_paint_asm[] = {
    {VEGA_SOLID_FILL_SHADER, solid_fill,
-    VG_FALSE, 0, 1, 0, 0, 0, 0},
+    VG_FALSE, 2, 1, 0, 0, 0, 0},
    {VEGA_LINEAR_GRADIENT_SHADER, linear_grad,
-    VG_TRUE,  0, 5, 0, 1, 0, 5},
+    VG_TRUE,  2, 5, 0, 1, 0, 5},
    {VEGA_RADIAL_GRADIENT_SHADER, radial_grad,
-    VG_TRUE,  0, 5, 0, 1, 0, 6},
+    VG_TRUE,  2, 5, 0, 1, 0, 5},
    {VEGA_PATTERN_SHADER, pattern,
-    VG_TRUE,  1, 4, 0, 1, 0, 5},
+    VG_TRUE,  3, 4, 0, 1, 0, 5},
+   {VEGA_PAINT_DEGENERATE_SHADER, paint_degenerate,
+    VG_FALSE,  3, 1, 0, 1, 0, 2}
+};
 
-   /* image draw modes */
+/* image draw modes */
+static const struct shader_asm_info shaders_image_asm[] = {
    {VEGA_IMAGE_NORMAL_SHADER, image_normal,
-    VG_TRUE,  0, 0, 3, 1, 0, 0},
+    VG_TRUE,  0, 0, 3, 1, 0, 2},
    {VEGA_IMAGE_MULTIPLY_SHADER, image_multiply,
     VG_TRUE,  0, 0, 3, 1, 0, 2},
    {VEGA_IMAGE_STENCIL_SHADER, image_stencil,
-    VG_TRUE,  0, 0, 3, 1, 0, 2},
+    VG_TRUE,  0, 0, 3, 1, 0, 2}
+};
 
+static const struct shader_asm_info shaders_color_transform_asm[] = {
+   {VEGA_COLOR_TRANSFORM_SHADER, color_transform,
+    VG_FALSE, 0, 4, 0, 0, 0, 3}
+};
+
+static const struct shader_asm_info shaders_alpha_asm[] = {
+   {VEGA_ALPHA_NORMAL_SHADER, alpha_normal,
+    VG_FALSE, 0, 0, 0, 0, 0, 2},
+   {VEGA_ALPHA_PER_CHANNEL_SHADER, alpha_per_channel,
+    VG_FALSE, 0, 0, 0, 0, 0, 2}
+};
+
+/* extra blend modes */
+static const struct shader_asm_info shaders_blend_asm[] = {
+#define BLEND_ASM_INFO(id, func) { (id), (func), VG_TRUE, 3, 1, 2, 1, 0, 5 }
+   BLEND_ASM_INFO(VEGA_BLEND_SRC_SHADER, blend_src),
+   BLEND_ASM_INFO(VEGA_BLEND_SRC_OVER_SHADER, blend_src_over),
+   BLEND_ASM_INFO(VEGA_BLEND_DST_OVER_SHADER, blend_dst_over),
+   BLEND_ASM_INFO(VEGA_BLEND_SRC_IN_SHADER, blend_src_in),
+   BLEND_ASM_INFO(VEGA_BLEND_DST_IN_SHADER, blend_dst_in),
+   BLEND_ASM_INFO(VEGA_BLEND_MULTIPLY_SHADER, blend_multiply),
+   BLEND_ASM_INFO(VEGA_BLEND_SCREEN_SHADER, blend_screen),
+   BLEND_ASM_INFO(VEGA_BLEND_DARKEN_SHADER, blend_darken),
+   BLEND_ASM_INFO(VEGA_BLEND_LIGHTEN_SHADER, blend_lighten),
+   BLEND_ASM_INFO(VEGA_BLEND_ADDITIVE_SHADER, blend_additive)
+#undef BLEND_ASM_INFO
+};
+
+static const struct shader_asm_info shaders_mask_asm[] = {
    {VEGA_MASK_SHADER, mask,
-    VG_TRUE,  0, 0, 1, 1, 0, 2},
-
-   /* extra blend modes */
-   {VEGA_BLEND_MULTIPLY_SHADER, blend_multiply,
-    VG_TRUE,  1, 1, 2, 1, 0, 5},
-   {VEGA_BLEND_SCREEN_SHADER, blend_screen,
-    VG_TRUE,  0, 0, 2, 1, 0, 4},
-   {VEGA_BLEND_DARKEN_SHADER, blend_darken,
-    VG_TRUE,  1, 1, 2, 1, 0, 6},
-   {VEGA_BLEND_LIGHTEN_SHADER, blend_lighten,
-    VG_TRUE,  1, 1, 2, 1, 0, 6},
-
-   /* premultiply */
+    VG_TRUE,  0, 0, 1, 1, 0, 2}
+};
+
+/* premultiply */
+static const struct shader_asm_info shaders_premultiply_asm[] = {
    {VEGA_PREMULTIPLY_SHADER, premultiply,
     VG_FALSE,  0, 0, 0, 0, 0, 1},
    {VEGA_UNPREMULTIPLY_SHADER, unpremultiply,
     VG_FALSE,  0, 0, 0, 0, 0, 1},
+};
 
-   /* color transform to black and white */
+/* color transform to black and white */
+static const struct shader_asm_info shaders_bw_asm[] = {
    {VEGA_BW_SHADER, color_bw,
-    VG_FALSE,  1, 1, 0, 0, 0, 3},
+    VG_FALSE,  3, 1, 0, 0, 0, 3},
 };
+
 #endif
index 903bfc88a4d2fdd39757bc01c3be8ad9fb5c249b..ae1842a62cd74aa991044416e5fd94a44d2ec440 100644 (file)
 #ifndef ASM_UTIL_H
 #define ASM_UTIL_H
 
-
-static const char pass_through_depth_asm[] =
-   "FRAG\n"
-   "DCL IN[0], POSITION, LINEAR\n"
-   "DCL OUT[0].z, POSITION, CONSTANT\n"
-   "0: MOV OUT[0].z, IN[0].zzzz\n"
-   "1: END\n";
-
-
-
 /* Î¼new = Î¼mask */
 static const char set_mask_asm[] =
    "FRAG\n"
@@ -92,45 +82,4 @@ static const char subtract_mask_asm[] =
    "3: MUL OUT[0], TEMP[2].wwww, TEMP[0].wwww\n"
    "4: END\n";
 
-
-static const char vs_plain_asm[] =
-   "VERT\n"
-   "DCL IN[0]\n"
-   "DCL OUT[0], POSITION\n"
-   "DCL TEMP[0]\n"
-   "DCL CONST[0..1]\n"
-   "0: MUL TEMP[0], IN[0], CONST[0]\n"
-   "1: ADD TEMP[0], TEMP[0], CONST[1]\n"
-   "2: MOV OUT[0], TEMP[0]\n"
-   "3: END\n";
-
-static const char vs_clear_asm[] =
-   "VERT\n"
-   "DCL IN[0]\n"
-   "DCL IN[1]\n"
-   "DCL OUT[0], POSITION\n"
-   "DCL OUT[1], COLOR\n"
-   "DCL TEMP[0]\n"
-   "DCL CONST[0..1]\n"
-   "0: MUL TEMP[0], IN[0], CONST[0]\n"
-   "1: ADD TEMP[0], TEMP[0], CONST[1]\n"
-   "2: MOV OUT[0], TEMP[0]\n"
-   "3: MOV OUT[1], IN[1]\n"
-   "4: END\n";
-
-
-static const char vs_texture_asm[] =
-   "VERT\n"
-   "DCL IN[0]\n"
-   "DCL IN[1]\n"
-   "DCL OUT[0], POSITION\n"
-   "DCL OUT[1], GENERIC\n"
-   "DCL TEMP[0]\n"
-   "DCL CONST[0..1]\n"
-   "0: MUL TEMP[0], IN[0], CONST[0]\n"
-   "1: ADD TEMP[0], TEMP[0], CONST[1]\n"
-   "2: MOV OUT[0], TEMP[0]\n"
-   "3: MOV OUT[1], IN[1]\n"
-   "4: END\n";
-
 #endif
index 28bbe420a21af79c2dbe1d3c6d01e3fd93a15164..318ea94bdfba1b853755433e6ce9f1146e21e2af 100644 (file)
@@ -42,6 +42,7 @@
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "util/u_sampler.h"
+#include "util/u_surface.h"
 
 static enum pipe_format vg_format_to_pipe(VGImageFormat format)
 {
@@ -77,33 +78,23 @@ static INLINE void vg_sync_size(VGfloat *src_loc, VGfloat *dst_loc)
    dst_loc[3] = src_loc[3];
 }
 
-
-static void vg_copy_texture(struct vg_context *ctx,
-                            struct pipe_resource *dst, VGint dx, VGint dy,
-                            struct pipe_sampler_view *src, VGint sx, VGint sy,
-                            VGint width, VGint height)
+static void vg_get_copy_coords(VGfloat *src_loc,
+                               VGfloat src_width, VGfloat src_height,
+                               VGfloat *dst_loc,
+                               VGfloat dst_width, VGfloat dst_height)
 {
-   VGfloat dst_loc[4], src_loc[4];
    VGfloat dst_bounds[4], src_bounds[4];
    VGfloat src_shift[4], dst_shift[4], shift[4];
 
-   dst_loc[0] = dx;
-   dst_loc[1] = dy;
-   dst_loc[2] = width;
-   dst_loc[3] = height;
    dst_bounds[0] = 0.f;
    dst_bounds[1] = 0.f;
-   dst_bounds[2] = dst->width0;
-   dst_bounds[3] = dst->height0;
+   dst_bounds[2] = dst_width;
+   dst_bounds[3] = dst_height;
 
-   src_loc[0] = sx;
-   src_loc[1] = sy;
-   src_loc[2] = width;
-   src_loc[3] = height;
    src_bounds[0] = 0.f;
    src_bounds[1] = 0.f;
-   src_bounds[2] = src->texture->width0;
-   src_bounds[3] = src->texture->height0;
+   src_bounds[2] = src_width;
+   src_bounds[3] = src_height;
 
    vg_bound_rect(src_loc, src_bounds, src_shift);
    vg_bound_rect(dst_loc, dst_bounds, dst_shift);
@@ -121,22 +112,44 @@ static void vg_copy_texture(struct vg_context *ctx,
       vg_shift_recty(dst_loc, dst_bounds, shift[1]);
 
    vg_sync_size(src_loc, dst_loc);
+}
+
+static void vg_copy_texture(struct vg_context *ctx,
+                            struct pipe_resource *dst, VGint dx, VGint dy,
+                            struct pipe_sampler_view *src, VGint sx, VGint sy,
+                            VGint width, VGint height)
+{
+   VGfloat dst_loc[4], src_loc[4];
+
+   dst_loc[0] = dx;
+   dst_loc[1] = dy;
+   dst_loc[2] = width;
+   dst_loc[3] = height;
+
+   src_loc[0] = sx;
+   src_loc[1] = sy;
+   src_loc[2] = width;
+   src_loc[3] = height;
+
+   vg_get_copy_coords(src_loc, src->texture->width0, src->texture->height0,
+                      dst_loc, dst->width0, dst->height0);
 
    if (src_loc[2] >= 0 && src_loc[3] >= 0 &&
        dst_loc[2] >= 0 && dst_loc[3] >= 0) {
-      renderer_copy_texture(ctx->renderer,
-                            src,
-                            src_loc[0],
-                            src_loc[1] + src_loc[3],
-                            src_loc[0] + src_loc[2],
-                            src_loc[1],
-                            dst,
-                            dst_loc[0],
-                            dst_loc[1] + dst_loc[3],
-                            dst_loc[0] + dst_loc[2],
-                            dst_loc[1]);
-   }
+      struct pipe_surface *surf, surf_tmpl;
+
+      /* get the destination surface */
+      u_surface_default_template(&surf_tmpl, dst, PIPE_BIND_RENDER_TARGET);
+      surf = ctx->pipe->create_surface(ctx->pipe, dst, &surf_tmpl);
+      if (surf && renderer_copy_begin(ctx->renderer, surf, VG_TRUE, src)) {
+         renderer_copy(ctx->renderer,
+               dst_loc[0], dst_loc[1], dst_loc[2], dst_loc[3],
+               src_loc[0], src_loc[1], src_loc[2], src_loc[3]);
+         renderer_copy_end(ctx->renderer);
+      }
 
+      pipe_surface_reference(&surf, NULL);
+   }
 }
 
 void vg_copy_surface(struct vg_context *ctx,
@@ -145,43 +158,19 @@ void vg_copy_surface(struct vg_context *ctx,
                      VGint width, VGint height)
 {
    VGfloat dst_loc[4], src_loc[4];
-   VGfloat dst_bounds[4], src_bounds[4];
-   VGfloat src_shift[4], dst_shift[4], shift[4];
 
    dst_loc[0] = dx;
    dst_loc[1] = dy;
    dst_loc[2] = width;
    dst_loc[3] = height;
-   dst_bounds[0] = 0.f;
-   dst_bounds[1] = 0.f;
-   dst_bounds[2] = dst->width;
-   dst_bounds[3] = dst->height;
 
    src_loc[0] = sx;
    src_loc[1] = sy;
    src_loc[2] = width;
    src_loc[3] = height;
-   src_bounds[0] = 0.f;
-   src_bounds[1] = 0.f;
-   src_bounds[2] = src->width;
-   src_bounds[3] = src->height;
-
-   vg_bound_rect(src_loc, src_bounds, src_shift);
-   vg_bound_rect(dst_loc, dst_bounds, dst_shift);
-   shift[0] = src_shift[0] - dst_shift[0];
-   shift[1] = src_shift[1] - dst_shift[1];
-
-   if (shift[0] < 0)
-      vg_shift_rectx(src_loc, src_bounds, -shift[0]);
-   else
-      vg_shift_rectx(dst_loc, dst_bounds, shift[0]);
-
-   if (shift[1] < 0)
-      vg_shift_recty(src_loc, src_bounds, -shift[1]);
-   else
-      vg_shift_recty(dst_loc, dst_bounds, shift[1]);
 
-   vg_sync_size(src_loc, dst_loc);
+   vg_get_copy_coords(src_loc, src->width, src->height,
+                      dst_loc, dst->width, dst->height);
 
    if (src_loc[2] > 0 && src_loc[3] > 0 &&
        dst_loc[2] > 0 && dst_loc[3] > 0) {
@@ -277,6 +266,7 @@ struct vg_image * image_create(VGImageFormat format,
    pt.width0 = width;
    pt.height0 = height;
    pt.depth0 = 1;
+   pt.array_size = 1;
    pt.bind = PIPE_BIND_SAMPLER_VIEW;
 
    newtex = screen->resource_create(screen, &pt);
@@ -284,6 +274,13 @@ struct vg_image * image_create(VGImageFormat format,
    debug_assert(newtex);
 
    u_sampler_view_default_template(&view_templ, newtex, newtex->format);
+   /* R, G, and B are treated as 1.0 for alpha-only formats in OpenVG */
+   if (newtex->format == PIPE_FORMAT_A8_UNORM) {
+      view_templ.swizzle_r = PIPE_SWIZZLE_ONE;
+      view_templ.swizzle_g = PIPE_SWIZZLE_ONE;
+      view_templ.swizzle_b = PIPE_SWIZZLE_ONE;
+   }
+
    view = pipe->create_sampler_view(pipe, newtex, &view_templ);
    /* want the texture to go away if the view is freed */
    pipe_resource_reference(&newtex, NULL);
@@ -420,7 +417,7 @@ void image_sub_data(struct vg_image *image,
 
    { /* upload color_data */
       struct pipe_transfer *transfer = pipe_get_transfer(
-         pipe, texture, 0, 0, 0,
+         pipe, texture, 0, 0,
          PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
       src += (dataStride * yoffset);
       for (i = 0; i < height; i++) {
@@ -451,11 +448,11 @@ void image_get_sub_data(struct vg_image * image,
    {
       struct pipe_transfer *transfer =
          pipe_get_transfer(pipe,
-                                  image->sampler_view->texture,  0, 0, 0,
-                                  PIPE_TRANSFER_READ,
-                                  0, 0,
-                                  image->x + image->width,
-                                  image->y + image->height);
+                           image->sampler_view->texture,  0, 0,
+                           PIPE_TRANSFER_READ,
+                           0, 0,
+                           image->x + image->width,
+                           image->y + image->height);
       /* Do a row at a time to flip image data vertically */
       for (i = 0; i < height; i++) {
 #if 0
@@ -525,14 +522,20 @@ void image_copy(struct vg_image *dst, VGint dx, VGint dy,
                    src->sampler_view, src->x + sx, src->y + sy, width, height);
 }
 
-void image_draw(struct vg_image *img)
+void image_draw(struct vg_image *img, struct matrix *matrix)
 {
    struct vg_context *ctx = vg_current_context();
+   struct matrix paint_matrix;
    VGfloat x1, y1;
    VGfloat x2, y2;
    VGfloat x3, y3;
    VGfloat x4, y4;
-   struct matrix *matrix;
+
+   if (!vg_get_paint_matrix(ctx,
+                            &ctx->state.vg.fill_paint_to_user_matrix,
+                            matrix,
+                            &paint_matrix))
+      return;
 
    x1 = 0;
    y1 = 0;
@@ -543,15 +546,10 @@ void image_draw(struct vg_image *img)
    x4 = 0;
    y4 = img->height;
 
-   matrix = &ctx->state.vg.image_user_to_surface_matrix;
-
-   matrix_map_point(matrix, x1, y1, &x1, &y1);
-   matrix_map_point(matrix, x2, y2, &x2, &y2);
-   matrix_map_point(matrix, x3, y3, &x3, &y3);
-   matrix_map_point(matrix, x4, y4, &x4, &y4);
-
+   shader_set_surface_matrix(ctx->shader, matrix);
    shader_set_drawing_image(ctx->shader, VG_TRUE);
    shader_set_paint(ctx->shader, ctx->state.vg.fill_paint);
+   shader_set_paint_matrix(ctx->shader, &paint_matrix);
    shader_set_image(ctx->shader, img);
    shader_bind(ctx->shader);
 
@@ -566,20 +564,21 @@ void image_set_pixels(VGint dx, VGint dy,
 {
    struct vg_context *ctx = vg_current_context();
    struct pipe_context *pipe = ctx->pipe;
-   struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *surf;
+   struct pipe_surface *surf, surf_tmpl;
    struct st_renderbuffer *strb = ctx->draw_buffer->strb;
 
    /* make sure rendering has completed */
    pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
-   surf = screen->get_tex_surface(screen, image_texture(src),  0, 0, 0,
-                                  0 /* no bind flags as surf isn't actually used??? */);
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   u_surface_default_template(&surf_tmpl, image_texture(src),
+                              0 /* no bind flag - not a surface*/);
+   surf = pipe->create_surface(pipe, image_texture(src), &surf_tmpl);
 
    vg_copy_surface(ctx, strb->surface, dx, dy,
                    surf, sx+src->x, sy+src->y, width, height);
 
-   screen->tex_surface_destroy(surf);
+   pipe->surface_destroy(pipe, surf);
 }
 
 void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
@@ -588,8 +587,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
 {
    struct vg_context *ctx = vg_current_context();
    struct pipe_context *pipe = ctx->pipe;
-   struct pipe_screen *screen = pipe->screen;
-   struct pipe_surface *surf;
+   struct pipe_surface *surf, surf_tmpl;
    struct st_renderbuffer *strb = ctx->draw_buffer->strb;
 
    /* flip the y coordinates */
@@ -598,8 +596,10 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
    /* make sure rendering has completed */
    pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
-   surf = screen->get_tex_surface(screen, image_texture(dst),  0, 0, 0,
-                                  0 /* no bind flags as surf isn't actually used??? */);
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   u_surface_default_template(&surf_tmpl, image_texture(dst),
+                              PIPE_BIND_RENDER_TARGET);
+   surf = pipe->create_surface(pipe, image_texture(dst), &surf_tmpl);
 
    vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
                    strb->surface, sx, sy, width, height);
index a990c9c58735eb90078bce8452742acc8318c7c7..391c048594843941e82f78fb52e157f1b9a1e339 100644 (file)
@@ -79,7 +79,7 @@ void image_copy(struct vg_image *dst, VGint dx, VGint dy,
                 VGint width, VGint height,
                 VGboolean dither);
 
-void image_draw(struct vg_image *img);
+void image_draw(struct vg_image *img, struct matrix *matrix);
 
 void image_set_pixels(VGint dx, VGint dy,
                       struct vg_image *src, VGint sx, VGint sy,
index ef28ebd740c7919aecf4657e955313b8208e056a..dfd0600e444c2c5d7fdb2eb34f76c86ad777397e 100644 (file)
 #include "shaders_cache.h"
 #include "renderer.h"
 #include "asm_util.h"
-#include "st_inlines.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_screen.h"
 #include "util/u_inlines.h"
 #include "util/u_format.h"
 #include "util/u_memory.h"
+#include "util/u_surface.h"
+#include "util/u_sampler.h"
 
 struct vg_mask_layer {
    struct vg_object base;
@@ -48,17 +49,6 @@ struct vg_mask_layer {
    struct pipe_sampler_view *sampler_view;
 };
 
-static INLINE struct pipe_surface *
-alpha_mask_surface(struct vg_context *ctx, int usage)
-{
-   struct pipe_screen *screen = ctx->pipe->screen;
-   struct st_framebuffer *stfb = ctx->draw_buffer;
-   return screen->get_tex_surface(screen,
-                                  stfb->alpha_mask_view->texture,
-                                  0, 0, 0,
-                                  usage);
-}
-
 static INLINE VGboolean
 intersect_rectangles(VGint dwidth, VGint dheight,
                      VGint swidth, VGint sheight,
@@ -110,15 +100,13 @@ static void read_alpha_mask(void * data, VGint dataStride,
 {
    struct vg_context *ctx = vg_current_context();
    struct pipe_context *pipe = ctx->pipe;
-   struct pipe_screen *screen = pipe->screen;
 
    struct st_framebuffer *stfb = ctx->draw_buffer;
    struct st_renderbuffer *strb = stfb->alpha_mask;
-   struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
 
    VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4];
    VGfloat *df = (VGfloat*)temp;
-   VGint y = (fb->height - sy) - 1, yStep = -1;
+   VGint y = (stfb->height - sy) - 1, yStep = -1;
    VGint i;
    VGubyte *dst = (VGubyte *)data;
    VGint xoffset = 0, yoffset = 0;
@@ -135,15 +123,15 @@ static void read_alpha_mask(void * data, VGint dataStride,
       yoffset = -sy;
       height += sy;
       sy = 0;
-      y = (fb->height - sy) - 1;
+      y = (stfb->height - sy) - 1;
       yoffset *= dataStride;
    }
 
    {
       struct pipe_surface *surf;
 
-      surf = screen->get_tex_surface(screen, strb->texture,  0, 0, 0,
-                                     PIPE_BIND_TRANSFER_READ);
+      surf = pipe->create_surface(pipe, strb->texture,  0, 0, 0,
+                                  PIPE_BIND_TRANSFER_READ);
 
       /* Do a row at a time to flip image data vertically */
       for (i = 0; i < height; i++) {
@@ -164,23 +152,23 @@ static void read_alpha_mask(void * data, VGint dataStride,
 void save_alpha_to_file(const char *filename)
 {
    struct vg_context *ctx = vg_current_context();
-   struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
+   struct st_framebuffer *stfb = ctx->draw_buffer;
    VGint *data;
    int i, j;
 
-   data = malloc(sizeof(int) * fb->width * fb->height);
-   read_alpha_mask(data, fb->width * sizeof(int),
+   data = malloc(sizeof(int) * stfb->width * stfb->height);
+   read_alpha_mask(data, stfb->width * sizeof(int),
                    VG_sRGBA_8888,
-                   0, 0, fb->width, fb->height);
+                   0, 0, stfb->width, stfb->height);
    fprintf(stderr, "/*---------- start */\n");
    fprintf(stderr, "const int image_width = %d;\n",
-           fb->width);
+           stfb->width);
    fprintf(stderr, "const int image_height = %d;\n",
-           fb->height);
+           stfb->height);
    fprintf(stderr, "const int image_data = {\n");
-   for (i = 0; i < fb->height; ++i) {
-      for (j = 0; j < fb->width; ++j) {
-         int rgba = data[i * fb->height + j];
+   for (i = 0; i < stfb->height; ++i) {
+      for (j = 0; j < stfb->width; ++j) {
+         int rgba = data[i * stfb->height + j];
          int argb = 0;
          argb = (rgba >> 8);
          argb |= ((rgba & 0xff) << 24);
@@ -193,49 +181,12 @@ void save_alpha_to_file(const char *filename)
 }
 #endif
 
-static void setup_mask_framebuffer(struct pipe_surface *surf,
-                                   VGint surf_width, VGint surf_height)
-{
-   struct vg_context *ctx = vg_current_context();
-   struct pipe_framebuffer_state fb;
-
-   memset(&fb, 0, sizeof(fb));
-   fb.width = surf_width;
-   fb.height = surf_height;
-   fb.nr_cbufs = 1;
-   fb.cbufs[0] = surf;
-   {
-      VGint i;
-      for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i)
-         fb.cbufs[i] = 0;
-   }
-   cso_set_framebuffer(ctx->cso_context, &fb);
-}
-
-
-/* setup shader constants */
-static void setup_mask_operation(VGMaskOperation operation)
+/* setup mask shader */
+static void *setup_mask_operation(VGMaskOperation operation)
 {
    struct vg_context *ctx = vg_current_context();
-   struct pipe_resource **cbuf = &ctx->mask.cbuf;
-   const VGint param_bytes = 4 * sizeof(VGfloat);
-   const VGfloat ones[4] = {1.f, 1.f, 1.f, 1.f};
    void *shader = 0;
 
-   /* We always need to get a new buffer, to keep the drivers simple and
-    * avoid gratuitous rendering synchronization.
-    */
-   pipe_resource_reference(cbuf, NULL);
-
-   *cbuf = pipe_buffer_create(ctx->pipe->screen, 
-                              PIPE_BIND_CONSTANT_BUFFER,
-                              param_bytes);
-   if (*cbuf) {
-      st_no_flush_pipe_buffer_write(ctx, *cbuf,
-                                    0, param_bytes, ones);
-   }
-
-   ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, *cbuf);
    switch (operation) {
    case VG_UNION_MASK: {
       if (!ctx->mask.union_fs) {
@@ -281,94 +232,21 @@ static void setup_mask_operation(VGMaskOperation operation)
          assert(0);
       break;
    }
-   cso_set_fragment_shader_handle(ctx->cso_context, shader);
-}
-
-static void setup_mask_samplers(struct pipe_sampler_view *umask)
-{
-   struct vg_context *ctx = vg_current_context();
-   struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
-   struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
-   struct st_framebuffer *fb_buffers = ctx->draw_buffer;
-   struct pipe_sampler_view *uprev = NULL;
-   struct pipe_sampler_state sampler;
-
-   uprev = fb_buffers->blend_texture_view;
-   sampler = ctx->mask.sampler;
-   sampler.normalized_coords = 1;
-
-   samplers[0] = NULL;
-   samplers[1] = NULL;
-   sampler_views[0] = NULL;
-   sampler_views[1] = NULL;
-
-   samplers[0] = &sampler;
-   samplers[1] = &ctx->mask.sampler;
-
-   sampler_views[0] = umask;
-   sampler_views[1] = uprev;
-
-   cso_set_samplers(ctx->cso_context, 2,
-                    (const struct pipe_sampler_state **)samplers);
-   cso_set_fragment_sampler_views(ctx->cso_context, 2, sampler_views);
-}
-
-
-/* setup shader constants */
-static void setup_mask_fill(const VGfloat color[4])
-{
-   struct vg_context *ctx = vg_current_context();
-   struct pipe_resource **cbuf = &ctx->mask.cbuf;
-   const VGint param_bytes = 4 * sizeof(VGfloat);
-
-   /* We always need to get a new buffer, to keep the drivers simple and
-    * avoid gratuitous rendering synchronization.
-    */
-   pipe_resource_reference(cbuf, NULL);
-
-   *cbuf = pipe_buffer_create(ctx->pipe->screen,
-                              PIPE_BIND_CONSTANT_BUFFER,
-                              param_bytes);
-   if (*cbuf) {
-      st_no_flush_pipe_buffer_write(ctx, *cbuf, 0, param_bytes, color);
-   }
-
-   ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, *cbuf);
-   cso_set_fragment_shader_handle(ctx->cso_context,
-                                  shaders_cache_fill(ctx->sc,
-                                                     VEGA_SOLID_FILL_SHADER));
-}
-
-static void setup_mask_viewport()
-{
-   struct vg_context *ctx = vg_current_context();
-   vg_set_viewport(ctx, VEGA_Y0_TOP);
-}
-
-static void setup_mask_blend()
-{
-   struct vg_context *ctx = vg_current_context();
-
-   struct pipe_blend_state blend;
 
-   memset(&blend, 0, sizeof(struct pipe_blend_state));
-   blend.rt[0].blend_enable = 0;
-   blend.rt[0].colormask = PIPE_MASK_RGBA;
-   blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
-   blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-   blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
-   blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-
-   cso_set_blend(ctx->cso_context, &blend);
+   return shader;
 }
 
-
-static void surface_fill(struct pipe_surface *surf,
-                         int surf_width, int surf_height,
-                         int x, int y, int width, int height,
-                         const VGfloat color[4])
+static void mask_resource_fill(struct pipe_resource *dst,
+                               int x, int y, int width, int height,
+                               VGfloat coverage)
 {
    struct vg_context *ctx = vg_current_context();
+   VGfloat fs_consts[12] = {
+      0.0f, 0.0f, 0.0f, 0.0f, /* not used */
+      0.0f, 0.0f, 0.0f, 0.0f, /* not used */
+      0.0f, 0.0f, 0.0f, coverage /* color */
+   };
+   void *fs;
 
    if (x < 0) {
       width += x;
@@ -379,50 +257,38 @@ static void surface_fill(struct pipe_surface *surf,
       y = 0;
    }
 
-   cso_save_framebuffer(ctx->cso_context);
-   cso_save_blend(ctx->cso_context);
-   cso_save_fragment_shader(ctx->cso_context);
-   cso_save_viewport(ctx->cso_context);
-
-   setup_mask_blend();
-   setup_mask_fill(color);
-   setup_mask_framebuffer(surf, surf_width, surf_height);
-   setup_mask_viewport();
+   fs = shaders_cache_fill(ctx->sc, VEGA_SOLID_FILL_SHADER);
 
-   renderer_draw_quad(ctx->renderer, x, y,
-                      x + width, y + height, 0.0f/*depth should be disabled*/);
-
-
-   /* make sure rendering has completed */
-   ctx->pipe->flush(ctx->pipe,
-                    PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME,
-                    NULL);
+   if (renderer_filter_begin(ctx->renderer, dst, VG_FALSE, ~0,
+            NULL, NULL, 0, fs, (const void *) fs_consts, sizeof(fs_consts))) {
+      renderer_filter(ctx->renderer, x, y, width, height, 0, 0, 0, 0);
+      renderer_filter_end(ctx->renderer);
+   }
 
 #if DEBUG_MASKS
    save_alpha_to_file(0);
 #endif
-
-   cso_restore_blend(ctx->cso_context);
-   cso_restore_framebuffer(ctx->cso_context);
-   cso_restore_fragment_shader(ctx->cso_context);
-   cso_restore_viewport(ctx->cso_context);
 }
 
 
 static void mask_using_texture(struct pipe_sampler_view *sampler_view,
+                               VGboolean is_layer,
                                VGMaskOperation operation,
                                VGint x, VGint y,
                                VGint width, VGint height)
 {
    struct vg_context *ctx = vg_current_context();
+   struct pipe_sampler_view *dst_view = vg_get_surface_mask(ctx);
+   struct pipe_resource *dst = dst_view->texture;
    struct pipe_resource *texture = sampler_view->texture;
-   struct pipe_surface *surface =
-      alpha_mask_surface(ctx, PIPE_BIND_RENDER_TARGET);
+   const struct pipe_sampler_state *samplers[2];
+   struct pipe_sampler_view *views[2];
+   struct pipe_sampler_state sampler;
    VGint offsets[4], loc[4];
+   const VGfloat ones[4] = {1.f, 1.f, 1.f, 1.f};
+   void *fs;
 
-   if (!surface)
-      return;
-   if (!intersect_rectangles(surface->width, surface->height,
+   if (!intersect_rectangles(dst->width0, dst->height0,
                              texture->width0, texture->height0,
                              x, y, width, height,
                              offsets, loc))
@@ -434,38 +300,30 @@ static void mask_using_texture(struct pipe_sampler_view *sampler_view,
                 loc[1], loc[2], loc[3]);
 #endif
 
+
+   sampler = ctx->mask.sampler;
+   sampler.normalized_coords = 1;
+   samplers[0] = &sampler;
+   views[0] = sampler_view;
+
    /* prepare our blend surface */
-   vg_prepare_blend_surface_from_mask(ctx);
-
-   cso_save_samplers(ctx->cso_context);
-   cso_save_fragment_sampler_views(ctx->cso_context);
-   cso_save_framebuffer(ctx->cso_context);
-   cso_save_blend(ctx->cso_context);
-   cso_save_fragment_shader(ctx->cso_context);
-   cso_save_viewport(ctx->cso_context);
-
-   setup_mask_samplers(sampler_view);
-   setup_mask_blend();
-   setup_mask_operation(operation);
-   setup_mask_framebuffer(surface, surface->width, surface->height);
-   setup_mask_viewport();
-
-   /* render the quad to propagate the rendering from stencil */
-   renderer_draw_texture(ctx->renderer, texture,
-                         offsets[0], offsets[1],
-                         offsets[0] + offsets[2], offsets[1] + offsets[3],
-                         loc[0], loc[1], loc[0] + loc[2], loc[1] + loc[3]);
+   samplers[1] = &ctx->mask.sampler;
+   views[1] = vg_prepare_blend_surface_from_mask(ctx);
 
-   /* make sure rendering has completed */
-   ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-   cso_restore_blend(ctx->cso_context);
-   cso_restore_framebuffer(ctx->cso_context);
-   cso_restore_fragment_shader(ctx->cso_context);
-   cso_restore_samplers(ctx->cso_context);
-   cso_restore_fragment_sampler_views(ctx->cso_context);
-   cso_restore_viewport(ctx->cso_context);
-
-   pipe_surface_reference(&surface, NULL);
+   fs = setup_mask_operation(operation);
+
+   if (renderer_filter_begin(ctx->renderer, dst, VG_FALSE,
+            ~0, samplers, views, 2, fs, (const void *) ones, sizeof(ones))) {
+      /* layer should be flipped when used as a texture */
+      if (is_layer) {
+         offsets[1] += offsets[3];
+         offsets[3] = -offsets[3];
+      }
+      renderer_filter(ctx->renderer,
+            loc[0], loc[1], loc[2], loc[3],
+            offsets[0], offsets[1], offsets[2], offsets[3]);
+      renderer_filter_end(ctx->renderer);
+   }
 }
 
 
@@ -496,8 +354,8 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
       pt.width0 = width;
       pt.height0 = height;
       pt.depth0 = 1;
+      pt.array_size = 1;
       pt.bind = PIPE_BIND_SAMPLER_VIEW;
-      pt.compressed = 0;
 
       texture = screen->resource_create(screen, &pt);
 
@@ -519,7 +377,7 @@ void mask_layer_destroy(struct vg_mask_layer *layer)
    struct vg_context *ctx = vg_current_context();
 
    vg_context_remove_object(ctx, VG_OBJECT_MASK, layer);
-   pipe_resource_release(&layer->texture);
+   pipe_sampler_view_reference(&layer->sampler_view, NULL);
    FREE(layer);
 }
 
@@ -528,22 +386,12 @@ void mask_layer_fill(struct vg_mask_layer *layer,
                      VGint width, VGint height,
                      VGfloat value)
 {
-   struct vg_context *ctx = vg_current_context();
    VGfloat alpha_color[4] = {0, 0, 0, 0};
-   struct pipe_surface *surface;
 
    alpha_color[3] = value;
 
-   surface = ctx->pipe->screen->get_tex_surface(
-      ctx->pipe->screen, layer->sampler_view->texture,
-      0, 0, 0,
-      PIPE_BIND_RENDER_TARGET);
-
-   surface_fill(surface,
-                layer->width, layer->height,
-                x, y, width, height, alpha_color);
-
-   ctx->pipe->screen->tex_surface_release(ctx->pipe->screen, &surface);
+   mask_resource_fill(layer->sampler_view->texture,
+                      x, y, width, height, value);
 }
 
 void mask_copy(struct vg_mask_layer *layer,
@@ -551,16 +399,27 @@ void mask_copy(struct vg_mask_layer *layer,
                VGint dx, VGint dy,
                VGint width, VGint height)
 {
-    struct vg_context *ctx = vg_current_context();
-    struct st_framebuffer *fb_buffers = ctx->draw_buffer;
-
-    renderer_copy_texture(ctx->renderer,
-                          layer->sampler_view,
-                          sx, sy,
-                          sx + width, sy + height,
-                          fb_buffers->alpha_mask_view->texture,
-                          dx, dy,
-                          dx + width, dy + height);
+   struct vg_context *ctx = vg_current_context();
+   struct pipe_sampler_view *src = vg_get_surface_mask(ctx);
+   struct pipe_surface *surf, surf_tmpl;
+
+   /* get the destination surface */
+   u_surface_default_template(&surf_tmpl, layer->sampler_view->texture,
+                              PIPE_BIND_RENDER_TARGET);
+   surf = ctx->pipe->create_surface(ctx->pipe, layer->sampler_view->texture,
+                                    &surf_tmpl);
+   if (surf && renderer_copy_begin(ctx->renderer, surf, VG_FALSE, src)) {
+      /* layer should be flipped when used as a texture */
+      sy += height;
+      height = -height;
+
+      renderer_copy(ctx->renderer,
+            dx, dy, width, height,
+            sx, sy, width, height);
+      renderer_copy_end(ctx->renderer);
+   }
+
+   pipe_surface_reference(&surf, NULL);
 }
 
 static void mask_layer_render_to(struct vg_mask_layer *layer,
@@ -568,41 +427,25 @@ static void mask_layer_render_to(struct vg_mask_layer *layer,
                                  VGbitfield paint_modes)
 {
    struct vg_context *ctx = vg_current_context();
-   const VGfloat fill_color[4] = {1.f, 1.f, 1.f, 1.f};
-   struct pipe_screen *screen = ctx->pipe->screen;
-   struct pipe_surface *surface;
-
-   surface = screen->get_tex_surface(screen, layer->sampler_view->texture,  0, 0, 0,
-                                     PIPE_BIND_RENDER_TARGET);
-
-   cso_save_framebuffer(ctx->cso_context);
-   cso_save_fragment_shader(ctx->cso_context);
-   cso_save_viewport(ctx->cso_context);
+   struct pipe_context *pipe = ctx->pipe;
+   struct pipe_sampler_view *view = vg_get_surface_mask(ctx);
+   struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix;
+   struct pipe_surface *surf, surf_tmpl;
+   u_surface_default_template(&surf_tmpl, view->texture,
+                              PIPE_BIND_RENDER_TARGET);
+   surf = pipe->create_surface(pipe, view->texture, &surf_tmpl);
 
-   setup_mask_blend();
-   setup_mask_fill(fill_color);
-   setup_mask_framebuffer(surface, layer->width, layer->height);
-   setup_mask_viewport();
+   renderer_validate_for_mask_rendering(ctx->renderer, surf, mat);
 
    if (paint_modes & VG_FILL_PATH) {
-      struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix;
-      path_fill(path, mat);
+      path_fill(path);
    }
 
    if (paint_modes & VG_STROKE_PATH){
       path_stroke(path);
    }
 
-
-   /* make sure rendering has completed */
-   ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-
-   cso_restore_framebuffer(ctx->cso_context);
-   cso_restore_fragment_shader(ctx->cso_context);
-   cso_restore_viewport(ctx->cso_context);
-   ctx->state.dirty |= BLEND_DIRTY;
-
-   screen->tex_surface_release(ctx->pipe->screen, &surface);
+   pipe_surface_reference(&surf, NULL);
 }
 
 void mask_render_to(struct path *path,
@@ -610,19 +453,19 @@ void mask_render_to(struct path *path,
                     VGMaskOperation operation)
 {
    struct vg_context *ctx = vg_current_context();
-   struct st_framebuffer *fb_buffers = ctx->draw_buffer;
+   struct st_framebuffer *stfb = ctx->draw_buffer;
    struct vg_mask_layer *temp_layer;
    VGint width, height;
 
-   width = fb_buffers->alpha_mask_view->texture->width0;
-   height = fb_buffers->alpha_mask_view->texture->width0;
+   width = stfb->width;
+   height = stfb->height;
 
    temp_layer = mask_layer_create(width, height);
+   mask_layer_fill(temp_layer, 0, 0, width, height, 0.0f);
 
    mask_layer_render_to(temp_layer, path, paint_modes);
 
-   mask_using_layer(temp_layer, 0, 0, width, height,
-                    operation);
+   mask_using_layer(temp_layer, operation, 0, 0, width, height);
 
    mask_layer_destroy(temp_layer);
 }
@@ -632,7 +475,7 @@ void mask_using_layer(struct vg_mask_layer *layer,
                       VGint x, VGint y,
                       VGint width, VGint height)
 {
-   mask_using_texture(layer->sampler_view, operation,
+   mask_using_texture(layer->sampler_view, VG_TRUE, operation,
                       x, y, width, height);
 }
 
@@ -654,7 +497,7 @@ void mask_using_image(struct vg_image *image,
                       VGint x, VGint y,
                       VGint width, VGint height)
 {
-   mask_using_texture(image->sampler_view, operation,
+   mask_using_texture(image->sampler_view, VG_FALSE, operation,
                       x, y, width, height);
 }
 
@@ -662,23 +505,15 @@ void mask_fill(VGint x, VGint y, VGint width, VGint height,
                VGfloat value)
 {
    struct vg_context *ctx = vg_current_context();
-   VGfloat alpha_color[4] = {.0f, .0f, .0f, value};
-   struct pipe_surface *surf = alpha_mask_surface(
-      ctx, PIPE_BIND_RENDER_TARGET);
+   struct pipe_sampler_view *view = vg_get_surface_mask(ctx);
 
 #if DEBUG_MASKS
    debug_printf("mask_fill(%d, %d, %d, %d) with  rgba(%f, %f, %f, %f)\n",
                 x, y, width, height,
-                alpha_color[0], alpha_color[1],
-                alpha_color[2], alpha_color[3]);
-   debug_printf("XXX %f  === %f \n",
-                alpha_color[3], value);
+                0.0f, 0.0f, 0.0f, value);
 #endif
 
-   surface_fill(surf, surf->width, surf->height,
-                x, y, width, height, alpha_color);
-
-   pipe_surface_reference(&surf, NULL);
+   mask_resource_fill(view->texture, x, y, width, height, value);
 }
 
 VGint mask_bind_samplers(struct pipe_sampler_state **samplers,
@@ -687,10 +522,8 @@ VGint mask_bind_samplers(struct pipe_sampler_state **samplers,
    struct vg_context *ctx = vg_current_context();
 
    if (ctx->state.vg.masking) {
-      struct st_framebuffer *fb_buffers = ctx->draw_buffer;
-
       samplers[1] = &ctx->mask.sampler;
-      sampler_views[1] = fb_buffers->alpha_mask_view;
+      sampler_views[1] = vg_get_surface_mask(ctx);
       return 1;
    } else
       return 0;
index 4c207f912a8558bad7113ed439ce183e1e2f534c..bed2b3193d02b149e6456258330bb687fb7104c1 100644 (file)
@@ -129,7 +129,7 @@ static INLINE void matrix_make_affine(struct matrix *matrix)
 }
 
 static INLINE void matrix_mult(struct matrix *dst,
-                               struct matrix *src)
+                               const struct matrix *src)
 {
    VGfloat m11 = dst->m[0]*src->m[0] + dst->m[3]*src->m[1] + dst->m[6]*src->m[2];
    VGfloat m12 = dst->m[0]*src->m[3] + dst->m[3]*src->m[4] + dst->m[6]*src->m[5];
index c0c8cddabe94d2edd506a2f7bc93665d3a71143c..2db8cbcf7c89f01305e5527122cd3f89b8578cd1 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "matrix.h"
 #include "image.h"
-#include "st_inlines.h"
 
 #include "pipe/p_compiler.h"
 #include "util/u_inlines.h"
@@ -155,14 +154,15 @@ static INLINE struct pipe_resource *create_gradient_texture(struct vg_paint *p)
    templ.width0 = 1024;
    templ.height0 = 1;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &templ);
 
    { /* upload color_data */
       struct pipe_transfer *transfer =
-         st_no_flush_get_transfer(p->base.ctx, tex, 0, 0, 0,
-                                      PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
+         pipe_get_transfer(p->base.ctx->pipe, tex, 0, 0,
+                           PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
       void *map = pipe->transfer_map(pipe, transfer);
       memcpy(map, p->gradient.color_data, sizeof(VGint)*1024);
       pipe->transfer_unmap(pipe, transfer);
@@ -261,14 +261,18 @@ static INLINE void paint_color_buffer(struct vg_paint *paint, void *buffer)
    map[7] = 4.f;
 }
 
-static INLINE void paint_linear_gradient_buffer(struct vg_paint *paint, void *buffer)
+static INLINE void paint_linear_gradient_buffer(struct vg_paint *paint,
+                                                const struct matrix *inv,
+                                                void *buffer)
 {
-   struct vg_context *ctx = paint->base.ctx;
    VGfloat *map = (VGfloat*)buffer;
+   VGfloat dd;
 
    map[0] = paint->gradient.linear.coords[2] - paint->gradient.linear.coords[0];
    map[1] = paint->gradient.linear.coords[3] - paint->gradient.linear.coords[1];
-   map[2] = 1.f / (map[0] * map[0] + map[1] * map[1]);
+   dd = (map[0] * map[0] + map[1] * map[1]);
+
+   map[2] = (dd > 0.0f) ? 1.f / dd : 0.f;
    map[3] = 1.f;
 
    map[4] = 0.f;
@@ -277,15 +281,10 @@ static INLINE void paint_linear_gradient_buffer(struct vg_paint *paint, void *bu
    map[7] = 4.f;
    {
       struct matrix mat;
-      struct matrix inv;
       matrix_load_identity(&mat);
+      /* VEGA_LINEAR_GRADIENT_SHADER expects the first point to be at (0, 0) */
       matrix_translate(&mat, -paint->gradient.linear.coords[0], -paint->gradient.linear.coords[1]);
-      memcpy(&inv, &ctx->state.vg.fill_paint_to_user_matrix,
-             sizeof(struct matrix));
-      matrix_invert(&inv);
-      matrix_mult(&inv, &mat);
-      memcpy(&mat, &inv,
-             sizeof(struct matrix));
+      matrix_mult(&mat, inv);
 
       map[8]  = mat.m[0]; map[9]  = mat.m[3]; map[10] = mat.m[6]; map[11] = 0.f;
       map[12] = mat.m[1]; map[13] = mat.m[4]; map[14] = mat.m[7]; map[15] = 0.f;
@@ -298,17 +297,37 @@ static INLINE void paint_linear_gradient_buffer(struct vg_paint *paint, void *bu
 }
 
 
-static INLINE void paint_radial_gradient_buffer(struct vg_paint *paint, void *buffer)
+static INLINE void paint_radial_gradient_buffer(struct vg_paint *paint,
+                                                const struct matrix *inv,
+                                                void *buffer)
 {
-   VGfloat *radialCoords = paint->gradient.radial.vals;
-   struct vg_context *ctx = paint->base.ctx;
-
+   const VGfloat *center = &paint->gradient.radial.vals[0];
+   const VGfloat *focal = &paint->gradient.radial.vals[2];
+   VGfloat rr = paint->gradient.radial.vals[4];
    VGfloat *map = (VGfloat*)buffer;
+   VGfloat dd, new_focal[2];
+
+   rr *= rr;
+
+   map[0] = center[0] - focal[0];
+   map[1] = center[1] - focal[1];
+   dd = map[0] * map[0] + map[1] * map[1];
+
+   /* focal point must lie inside the circle */
+   if (0.998f * rr < dd) {
+      VGfloat scale;
+
+      scale = (dd > 0.0f) ? sqrt(0.998f * rr / dd) : 0.0f;
+      map[0] *= scale;
+      map[1] *= scale;
 
-   map[0] = radialCoords[0] - radialCoords[2];
-   map[1] = radialCoords[1] - radialCoords[3];
-   map[2] = -map[0] * map[0] - map[1] * map[1] +
-            radialCoords[4] * radialCoords[4];
+      new_focal[0] = center[0] - map[0];
+      new_focal[1] = center[1] - map[1];
+      dd = map[0] * map[0] + map[1] * map[1];
+      focal = new_focal;
+   }
+
+   map[2] = (rr > dd) ? rr - dd : 1.0f;
    map[3] = 1.f;
 
    map[4] = 0.f;
@@ -318,15 +337,9 @@ static INLINE void paint_radial_gradient_buffer(struct vg_paint *paint, void *bu
 
    {
       struct matrix mat;
-      struct matrix inv;
       matrix_load_identity(&mat);
-      matrix_translate(&mat, -radialCoords[2], -radialCoords[3]);
-      memcpy(&inv, &ctx->state.vg.fill_paint_to_user_matrix,
-             sizeof(struct matrix));
-      matrix_invert(&inv);
-      matrix_mult(&inv, &mat);
-      memcpy(&mat, &inv,
-             sizeof(struct matrix));
+      matrix_translate(&mat, -focal[0], -focal[1]);
+      matrix_mult(&mat, inv);
 
       map[8]  = mat.m[0]; map[9]  = mat.m[3]; map[10] = mat.m[6]; map[11] = 0.f;
       map[12] = mat.m[1]; map[13] = mat.m[4]; map[14] = mat.m[7]; map[15] = 0.f;
@@ -340,10 +353,10 @@ static INLINE void paint_radial_gradient_buffer(struct vg_paint *paint, void *bu
 }
 
 
-static INLINE void  paint_pattern_buffer(struct vg_paint *paint, void *buffer)
+static INLINE void  paint_pattern_buffer(struct vg_paint *paint,
+                                         const struct matrix *inv,
+                                         void *buffer)
 {
-   struct vg_context *ctx = paint->base.ctx;
-
    VGfloat *map = (VGfloat *)buffer;
    memcpy(map, paint->solid.color, 4 * sizeof(VGfloat));
 
@@ -353,17 +366,8 @@ static INLINE void  paint_pattern_buffer(struct vg_paint *paint, void *buffer)
    map[7] = paint->pattern.sampler_view->texture->height0;
    {
       struct matrix mat;
-      memcpy(&mat, &ctx->state.vg.fill_paint_to_user_matrix,
-             sizeof(struct matrix));
-      matrix_invert(&mat);
-      {
-         struct matrix pm;
-         memcpy(&pm, &ctx->state.vg.path_user_to_surface_matrix,
-                sizeof(struct matrix));
-         matrix_invert(&pm);
-         matrix_mult(&pm, &mat);
-         memcpy(&mat, &pm, sizeof(struct matrix));
-      }
+
+      memcpy(&mat, inv, sizeof(*inv));
 
       map[8]  = mat.m[0]; map[9]  = mat.m[3]; map[10] = mat.m[6]; map[11] = 0.f;
       map[12] = mat.m[1]; map[13] = mat.m[4]; map[14] = mat.m[7]; map[15] = 0.f;
@@ -672,6 +676,34 @@ void paint_resolve_type(struct vg_paint *paint)
    }
 }
 
+VGboolean paint_is_degenerate(struct vg_paint *paint)
+{
+   VGboolean degen;
+   VGfloat *vals;
+
+
+   switch (paint->type) {
+   case VG_PAINT_TYPE_LINEAR_GRADIENT:
+      vals = paint->gradient.linear.coords;
+      /* two points are coincident */
+      degen = (floatsEqual(vals[0], vals[2]) &&
+               floatsEqual(vals[1], vals[3]));
+      break;
+   case VG_PAINT_TYPE_RADIAL_GRADIENT:
+      vals = paint->gradient.radial.vals;
+      /* radius <= 0 */
+      degen = (vals[4] <= 0.0f);
+      break;
+   case VG_PAINT_TYPE_COLOR:
+   case VG_PAINT_TYPE_PATTERN:
+   default:
+      degen = VG_FALSE;
+      break;
+   }
+
+   return degen;
+}
+
 VGint paint_constant_buffer_size(struct vg_paint *paint)
 {
    switch(paint->type) {
@@ -695,6 +727,7 @@ VGint paint_constant_buffer_size(struct vg_paint *paint)
 }
 
 void paint_fill_constant_buffer(struct vg_paint *paint,
+                                const struct matrix *mat,
                                 void *buffer)
 {
    switch(paint->type) {
@@ -702,13 +735,13 @@ void paint_fill_constant_buffer(struct vg_paint *paint,
       paint_color_buffer(paint, buffer);
       break;
    case VG_PAINT_TYPE_LINEAR_GRADIENT:
-      paint_linear_gradient_buffer(paint, buffer);
+      paint_linear_gradient_buffer(paint, mat, buffer);
       break;
    case VG_PAINT_TYPE_RADIAL_GRADIENT:
-      paint_radial_gradient_buffer(paint, buffer);
+      paint_radial_gradient_buffer(paint, mat, buffer);
       break;
    case VG_PAINT_TYPE_PATTERN:
-      paint_pattern_buffer(paint, buffer);
+      paint_pattern_buffer(paint, mat, buffer);
       break;
 
    default:
index 012cd3e561896f67a0df4be761468c5ab19be84e..3de3bbe12eda91fc9c00fd03df54ecdab09a5359 100644 (file)
@@ -110,8 +110,12 @@ VGboolean paint_color_ramp_premultiplied(struct vg_paint *paint);
 VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **samplers,
                           struct pipe_sampler_view **sampler_views);
 
+VGboolean paint_is_degenerate(struct vg_paint *paint);
+
 VGint paint_constant_buffer_size(struct vg_paint *paint);
+
 void paint_fill_constant_buffer(struct vg_paint *paint,
+                                const struct matrix *mat,
                                 void *buffer);
 
 
index 05f8b0d9979ed181c9319c8369592f1e068eb318..d7253befd035049d0ea1a107876f3091fed79413 100644 (file)
@@ -207,13 +207,29 @@ struct path * path_create(VGPathDatatype dt, VGfloat scale, VGfloat bias,
    return path;
 }
 
+static void polygon_array_cleanup(struct polygon_array *polyarray)
+{
+   if (polyarray->array) {
+      VGint i;
+
+      for (i = 0; i < polyarray->array->num_elements; i++) {
+         struct polygon *p = ((struct polygon **) polyarray->array->data)[i];
+         polygon_destroy(p);
+      }
+
+      array_destroy(polyarray->array);
+      polyarray->array = NULL;
+   }
+}
+
 void path_destroy(struct path *p)
 {
    vg_context_remove_object(vg_current_context(), VG_OBJECT_PATH, p);
 
    array_destroy(p->segments);
    array_destroy(p->control_points);
-   array_destroy(p->fill_polys.polygon_array.array);
+
+   polygon_array_cleanup(&p->fill_polys.polygon_array);
 
    if (p->stroked.path)
       path_destroy(p->stroked.path);
@@ -302,7 +318,6 @@ static void convert_path(struct path *p,
    }
 }
 
-
 static void polygon_array_calculate_bounds( struct polygon_array *polyarray )
 {
    struct array *polys = polyarray->array;
@@ -312,7 +327,15 @@ static void polygon_array_calculate_bounds( struct polygon_array *polyarray )
    unsigned i;
 
    assert(polys);
-   assert(polys->num_elements);
+
+   if (!polys->num_elements) {
+      polyarray->min_x = 0.0f;
+      polyarray->min_y = 0.0f;
+      polyarray->max_x = 0.0f;
+      polyarray->max_y = 0.0f;
+      return;
+   }
+
    polygon_bounding_rect((((struct polygon**)polys->data)[0]), bounds);
    min_x = bounds[0];
    min_y = bounds[1];
@@ -353,16 +376,17 @@ static struct polygon_array * path_get_fill_polygons(struct path *p, struct matr
          return &p->fill_polys.polygon_array;
       }
       else {
-         array_destroy( p->fill_polys.polygon_array.array );
-         p->fill_polys.polygon_array.array = NULL;
+         polygon_array_cleanup(&p->fill_polys.polygon_array);
       }
    }
 
-   array = array_create(sizeof(struct array*));
+   /* an array of pointers to polygons */
+   array = array_create(sizeof(struct polygon *));
 
    sx = sy = px = py = ox = oy = 0.f;
 
-   current = polygon_create(32);
+   if (p->num_segments)
+      current = polygon_create(32);
 
    for (i = 0; i < p->num_segments; ++i) {
       VGubyte segment = ((VGubyte*)(p->segments->data))[i];
@@ -1519,10 +1543,11 @@ struct path * path_create_stroke(struct path *p,
    return stroker.base.path;
 }
 
-void path_render(struct path *p, VGbitfield paintModes)
+void path_render(struct path *p, VGbitfield paintModes,
+                 struct matrix *mat)
 {
    struct vg_context *ctx = vg_current_context();
-   struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix;
+   struct matrix paint_matrix;
 
    vg_validate_state(ctx);
 
@@ -1534,29 +1559,45 @@ void path_render(struct path *p, VGbitfield paintModes)
            mat->m[3], mat->m[4], mat->m[5],
            mat->m[6], mat->m[7], mat->m[8]);
 #endif
-   if (paintModes & VG_FILL_PATH) {
+   if ((paintModes & VG_FILL_PATH) &&
+       vg_get_paint_matrix(ctx,
+                           &ctx->state.vg.fill_paint_to_user_matrix,
+                           mat,
+                           &paint_matrix)) {
       /* First the fill */
+      shader_set_surface_matrix(ctx->shader, mat);
       shader_set_paint(ctx->shader, ctx->state.vg.fill_paint);
+      shader_set_paint_matrix(ctx->shader, &paint_matrix);
       shader_bind(ctx->shader);
-      path_fill(p, mat);
+      path_fill(p);
    }
 
-   if (paintModes & VG_STROKE_PATH){
+   if ((paintModes & VG_STROKE_PATH) &&
+       vg_get_paint_matrix(ctx,
+                           &ctx->state.vg.stroke_paint_to_user_matrix,
+                           mat,
+                           &paint_matrix)) {
       /* 8.7.5: "line width less than or equal to 0 prevents stroking from
        *  taking place."*/
       if (ctx->state.vg.stroke.line_width.f <= 0)
          return;
+      shader_set_surface_matrix(ctx->shader, mat);
       shader_set_paint(ctx->shader, ctx->state.vg.stroke_paint);
+      shader_set_paint_matrix(ctx->shader, &paint_matrix);
       shader_bind(ctx->shader);
       path_stroke(p);
    }
 }
 
-void path_fill(struct path *p, struct matrix *mat)
+void path_fill(struct path *p)
 {
    struct vg_context *ctx = vg_current_context();
+   struct matrix identity;
+
+   matrix_load_identity(&identity);
+
    {
-      struct polygon_array *polygon_array = path_get_fill_polygons(p, mat);
+      struct polygon_array *polygon_array = path_get_fill_polygons(p, &identity);
       struct array *polys = polygon_array->array;
 
       if (!polygon_array || !polys || !polys->num_elements) {
@@ -1569,7 +1610,6 @@ void path_fill(struct path *p, struct matrix *mat)
 void path_stroke(struct path *p)
 {
    struct vg_context *ctx = vg_current_context();
-   struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix;
    VGFillRule old_fill = ctx->state.vg.fill_rule;
    struct matrix identity;
    struct path *stroke;
@@ -1579,7 +1619,7 @@ void path_stroke(struct path *p)
    if (stroke && !path_is_empty(stroke)) {
       ctx->state.vg.fill_rule = VG_NON_ZERO;
 
-      path_fill(stroke, mat);
+      path_fill(stroke);
 
       ctx->state.vg.fill_rule = old_fill;
    }
index e34538b73681de2835e83ae7ef784dd8935a7653..d84b1f083cee32d7d4c3cd8b591037e6cb46a993 100644 (file)
@@ -104,8 +104,8 @@ VGboolean path_interpolate(struct path *dst,
                            VGfloat amount);
 
 void path_clear(struct path *p, VGbitfield capabilities);
-void path_render(struct path *p, VGbitfield paintModes);
-void path_fill(struct path *p, struct matrix *mat);
+void path_render(struct path *p, VGbitfield paintModes, struct matrix *mat);
+void path_fill(struct path *p);
 void path_stroke(struct path *p);
 
 void path_move_to(struct path *p, float x, float y);
index ca8831064c919ed6db9554754ed667e8455aaaac..a491de27fa675613c9197f6263a3ab389eece1cc 100644 (file)
@@ -244,24 +244,11 @@ VGboolean polygon_is_closed(struct polygon *p)
    return floatsEqual(start[0], end[0]) && floatsEqual(start[1], end[1]);
 }
 
-static void set_blend_for_fill(struct pipe_blend_state *blend)
-{
-   memset(blend, 0, sizeof(struct pipe_blend_state));
-   blend->rt[0].colormask = 0; /*disable colorwrites*/
-
-   blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
-   blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-   blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
-   blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
-}
-
-static void draw_polygon(struct vg_context *ctx,
-                         struct polygon *poly)
+static void polygon_prepare_buffer(struct vg_context *ctx,
+                                   struct polygon *poly)
 {
    int vert_size;
    struct pipe_context *pipe;
-   struct pipe_vertex_buffer vbuffer;
-   struct pipe_vertex_element velement;
 
    vert_size = poly->num_verts * COMPONENTS * sizeof(float);
 
@@ -281,35 +268,15 @@ static void draw_polygon(struct vg_context *ctx,
                                          PIPE_BIND_VERTEX_BUFFER);
       poly->dirty = VG_FALSE;
    }
-
-
-   /* tell pipe about the vertex buffer */
-   memset(&vbuffer, 0, sizeof(vbuffer));
-   vbuffer.buffer = poly->vbuf;
-   vbuffer.stride = COMPONENTS * sizeof(float);  /* vertex size */
-   vbuffer.buffer_offset = 0;
-   vbuffer.max_index = poly->num_verts - 1;
-   pipe->set_vertex_buffers(pipe, 1, &vbuffer);
-
-   /* tell pipe about the vertex attributes */
-   memset(&velement, 0, sizeof(velement));
-   velement.src_offset = 0;
-   velement.instance_divisor = 0;
-   velement.vertex_buffer_index = 0;
-   velement.src_format = PIPE_FORMAT_R32G32_FLOAT;
-   cso_set_vertex_elements(ctx->cso_context, 1, &velement);
-
-   /* draw */
-   util_draw_arrays(pipe, PIPE_PRIM_TRIANGLE_FAN, 0, (uint) poly->num_verts);
 }
 
 void polygon_fill(struct polygon *poly, struct vg_context *ctx)
 {
-   struct pipe_depth_stencil_alpha_state dsa;
-   struct pipe_stencil_ref sr;
-   struct pipe_blend_state blend;
+   struct pipe_vertex_element velement;
+   struct pipe_vertex_buffer vbuffer;
    VGfloat bounds[4];
    VGfloat min_x, min_y, max_x, max_y;
+
    assert(poly);
    polygon_bounding_rect(poly, bounds);
    min_x = bounds[0];
@@ -322,113 +289,42 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
                 min_x, min_y, max_x, max_y);
 #endif
 
-   set_blend_for_fill(&blend);
-
-   memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state));
-   memset(&sr, 0, sizeof(struct pipe_stencil_ref));
-   /* only need a fixed 0. Rely on default or move it out at least? */
-   cso_set_stencil_ref(ctx->cso_context, &sr);
-
-   cso_save_blend(ctx->cso_context);
-   cso_save_depth_stencil_alpha(ctx->cso_context);
-
-   dsa.stencil[0].enabled = 1;
-   if (ctx->state.vg.fill_rule == VG_EVEN_ODD) {
-      dsa.stencil[0].writemask = 1;
-      dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-      dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-      dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INVERT;
-      dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-      dsa.stencil[0].valuemask = ~0;
-
-      cso_set_blend(ctx->cso_context, &blend);
-      cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-      draw_polygon(ctx, poly);
-   } else if (ctx->state.vg.fill_rule == VG_NON_ZERO) {
-      struct pipe_screen *screen = ctx->pipe->screen;
-
-      if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) {
-         /* front */
-         dsa.stencil[0].writemask = ~0;
-         dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
-         dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].valuemask = ~0;
-
-         /* back */
-         dsa.stencil[1].enabled = 1;
-         dsa.stencil[1].writemask = ~0;
-         dsa.stencil[1].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[1].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[1].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
-         dsa.stencil[1].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[1].valuemask = ~0;
-
-         cso_set_blend(ctx->cso_context, &blend);
-         cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-         draw_polygon(ctx, poly);
-      } else {
-         struct pipe_rasterizer_state raster;
-
-         memcpy(&raster, &ctx->state.g3d.rasterizer, sizeof(struct pipe_rasterizer_state));
-
-         cso_save_rasterizer(ctx->cso_context);
-         dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].valuemask = ~0;
-
-         raster.cull_face = PIPE_FACE_BACK;
-         dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
-
-         cso_set_blend(ctx->cso_context, &blend);
-         cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-         cso_set_rasterizer(ctx->cso_context, &raster);
-         draw_polygon(ctx, poly);
-
-         raster.cull_face = PIPE_FACE_FRONT;
-         dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
-         cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-         cso_set_rasterizer(ctx->cso_context, &raster);
-         draw_polygon(ctx, poly);
-
-         cso_restore_rasterizer(ctx->cso_context);
-      }
-   }
+   polygon_prepare_buffer(ctx, poly);
+
+   /* tell renderer about the vertex attributes */
+   memset(&velement, 0, sizeof(velement));
+   velement.src_offset = 0;
+   velement.instance_divisor = 0;
+   velement.vertex_buffer_index = 0;
+   velement.src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+   /* tell renderer about the vertex buffer */
+   memset(&vbuffer, 0, sizeof(vbuffer));
+   vbuffer.buffer = poly->vbuf;
+   vbuffer.stride = COMPONENTS * sizeof(float);  /* vertex size */
+   vbuffer.buffer_offset = 0;
+   vbuffer.max_index = poly->num_verts - 1;
+
+   renderer_polygon_stencil_begin(ctx->renderer,
+         &velement, ctx->state.vg.fill_rule, VG_FALSE);
+   renderer_polygon_stencil(ctx->renderer, &vbuffer,
+         PIPE_PRIM_TRIANGLE_FAN, 0, (VGuint) poly->num_verts);
+   renderer_polygon_stencil_end(ctx->renderer);
 
-   /* restore color writes */
-   cso_restore_blend(ctx->cso_context);
-   /* setup stencil ops */
-   dsa.stencil[0].func = PIPE_FUNC_NOTEQUAL;
-   dsa.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].valuemask = dsa.stencil[0].writemask;
-   dsa.stencil[1].enabled = 0;
-   memcpy(&dsa.depth, &ctx->state.g3d.dsa.depth,
-          sizeof(struct pipe_depth_state));
-   cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-
-   /* render the quad to propagate the rendering from stencil */
-   renderer_draw_quad(ctx->renderer, min_x, min_y,
-                      max_x, max_y, 0.0f/*depth should be disabled*/);
-
-   cso_restore_depth_stencil_alpha(ctx->cso_context);
+   renderer_polygon_fill_begin(ctx->renderer, VG_FALSE);
+   renderer_polygon_fill(ctx->renderer, min_x, min_y, max_x, max_y);
+   renderer_polygon_fill_end(ctx->renderer);
 }
 
 void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
 {
    struct array *polys = polyarray->array;
-   struct pipe_depth_stencil_alpha_state dsa;
-   struct pipe_stencil_ref sr;
-   struct pipe_blend_state blend;
    VGfloat min_x = polyarray->min_x;
    VGfloat min_y = polyarray->min_y;
    VGfloat max_x = polyarray->max_x;
    VGfloat max_y = polyarray->max_y;
+   struct pipe_vertex_element velement;
+   struct pipe_vertex_buffer vbuffer;
    VGint i;
 
 
@@ -438,111 +334,35 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
                 min_x, min_y, max_x, max_y);
 #endif
 
-   set_blend_for_fill(&blend);
-
-   memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state));
-   memset(&sr, 0, sizeof(struct pipe_stencil_ref));
-   /* only need a fixed 0. Rely on default or move it out at least? */
-   cso_set_stencil_ref(ctx->cso_context, &sr);
-
-   cso_save_blend(ctx->cso_context);
-   cso_save_depth_stencil_alpha(ctx->cso_context);
-
-   dsa.stencil[0].enabled = 1;
-   if (ctx->state.vg.fill_rule == VG_EVEN_ODD) {
-      dsa.stencil[0].writemask = 1;
-      dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-      dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-      dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INVERT;
-      dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-      dsa.stencil[0].valuemask = ~0;
-
-      cso_set_blend(ctx->cso_context, &blend);
-      cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-      for (i = 0; i < polys->num_elements; ++i) {
-         struct polygon *poly = (((struct polygon**)polys->data)[i]);
-         draw_polygon(ctx, poly);
-      }
-   } else if (ctx->state.vg.fill_rule == VG_NON_ZERO) {
-      struct pipe_screen *screen = ctx->pipe->screen;
-
-      if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) {
-         /* front */
-         dsa.stencil[0].writemask = ~0;
-         dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
-         dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].valuemask = ~0;
-
-         /* back */
-         dsa.stencil[1].enabled = 1;
-         dsa.stencil[1].writemask = ~0;
-         dsa.stencil[1].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[1].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[1].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
-         dsa.stencil[1].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[1].valuemask = ~0;
-
-         cso_set_blend(ctx->cso_context, &blend);
-         cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-         for (i = 0; i < polys->num_elements; ++i) {
-            struct polygon *poly = (((struct polygon**)polys->data)[i]);
-            draw_polygon(ctx, poly);
-         }
-      } else {
-         struct pipe_rasterizer_state raster;
-
-         memcpy(&raster, &ctx->state.g3d.rasterizer, sizeof(struct pipe_rasterizer_state));
-
-         cso_save_rasterizer(ctx->cso_context);
-         dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
-         dsa.stencil[0].valuemask = ~0;
-
-         raster.cull_face = PIPE_FACE_BACK;
-         dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
-
-         cso_set_blend(ctx->cso_context, &blend);
-         cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-         cso_set_rasterizer(ctx->cso_context, &raster);
-         for (i = 0; i < polys->num_elements; ++i) {
-            struct polygon *poly = (((struct polygon**)polys->data)[i]);
-            draw_polygon(ctx, poly);
-         }
-
-         raster.cull_face = PIPE_FACE_FRONT;
-         dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
-         dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
-         cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-         cso_set_rasterizer(ctx->cso_context, &raster);
-         for (i = 0; i < polys->num_elements; ++i) {
-            struct polygon *poly = (((struct polygon**)polys->data)[i]);
-            draw_polygon(ctx, poly);
-         }
-
-         cso_restore_rasterizer(ctx->cso_context);
-      }
+   /* tell renderer about the vertex attributes */
+   memset(&velement, 0, sizeof(velement));
+   velement.src_offset = 0;
+   velement.instance_divisor = 0;
+   velement.vertex_buffer_index = 0;
+   velement.src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+   /* tell renderer about the vertex buffer */
+   memset(&vbuffer, 0, sizeof(vbuffer));
+   vbuffer.stride = COMPONENTS * sizeof(float);  /* vertex size */
+   vbuffer.buffer_offset = 0;
+
+   /* prepare the stencil buffer */
+   renderer_polygon_stencil_begin(ctx->renderer,
+         &velement, ctx->state.vg.fill_rule, VG_FALSE);
+   for (i = 0; i < polys->num_elements; ++i) {
+      struct polygon *poly = (((struct polygon**)polys->data)[i]);
+
+      polygon_prepare_buffer(ctx, poly);
+      vbuffer.buffer = poly->vbuf;
+      vbuffer.max_index = poly->num_verts - 1;
+
+      renderer_polygon_stencil(ctx->renderer, &vbuffer,
+            PIPE_PRIM_TRIANGLE_FAN, 0, (VGuint) poly->num_verts);
    }
+   renderer_polygon_stencil_end(ctx->renderer);
 
-   /* restore color writes */
-   cso_restore_blend(ctx->cso_context);
-   /* setup stencil ops */
-   dsa.stencil[0].func = PIPE_FUNC_NOTEQUAL;
-   dsa.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
-   dsa.stencil[0].valuemask = dsa.stencil[0].writemask;
-   dsa.stencil[1].enabled = 0;
-   memcpy(&dsa.depth, &ctx->state.g3d.dsa.depth,
-          sizeof(struct pipe_depth_state));
-   cso_set_depth_stencil_alpha(ctx->cso_context, &dsa);
-
-   /* render the quad to propagate the rendering from stencil */
-   renderer_draw_quad(ctx->renderer, min_x, min_y,
-                      max_x, max_y, 0.0f/*depth should be disabled*/);
-
-   cso_restore_depth_stencil_alpha(ctx->cso_context);
+   /* fill it */
+   renderer_polygon_fill_begin(ctx->renderer, VG_FALSE);
+   renderer_polygon_fill(ctx->renderer, min_x, min_y, max_x, max_y);
+   renderer_polygon_fill_end(ctx->renderer);
 }
index c6f5f7a05b8c5cf7275754a60ec2b2cfa5fa8cb5..e42bad764922494d4478f617d2168ebc23e1b3fc 100644 (file)
@@ -1,6 +1,7 @@
 /**************************************************************************
  *
  * Copyright 2009 VMware, Inc.  All Rights Reserved.
+ * Copyright 2010 LunarG, 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
 #include "util/u_simple_shaders.h"
 #include "util/u_memory.h"
 #include "util/u_sampler.h"
+#include "util/u_surface.h"
+#include "util/u_math.h"
+#include "util/u_format.h"
 
 #include "cso_cache/cso_context.h"
+#include "tgsi/tgsi_ureg.h"
+
+typedef enum {
+   RENDERER_STATE_INIT,
+   RENDERER_STATE_COPY,
+   RENDERER_STATE_DRAWTEX,
+   RENDERER_STATE_SCISSOR,
+   RENDERER_STATE_CLEAR,
+   RENDERER_STATE_FILTER,
+   RENDERER_STATE_POLYGON_STENCIL,
+   RENDERER_STATE_POLYGON_FILL,
+   NUM_RENDERER_STATES
+} RendererState;
+
+typedef enum {
+   RENDERER_VS_PLAIN,
+   RENDERER_VS_COLOR,
+   RENDERER_VS_TEXTURE,
+   NUM_RENDERER_VS
+} RendererVs;
+
+typedef enum {
+   RENDERER_FS_COLOR,
+   RENDERER_FS_TEXTURE,
+   RENDERER_FS_SCISSOR,
+   RENDERER_FS_WHITE,
+   NUM_RENDERER_FS
+} RendererFs;
 
 struct renderer {
    struct pipe_context *pipe;
-   struct vg_context *owner;
-
    struct cso_context *cso;
 
-   void *fs;
+   VGbitfield dirty;
+   struct {
+      struct pipe_rasterizer_state rasterizer;
+      struct pipe_depth_stencil_alpha_state dsa;
+      struct pipe_framebuffer_state fb;
+   } g3d;
+   struct matrix projection;
+
+   struct matrix mvp;
+   struct pipe_resource *vs_cbuf;
+
+   struct pipe_resource *fs_cbuf;
+   VGfloat fs_cbuf_data[32];
+   VGint fs_cbuf_len;
 
+   struct pipe_vertex_element velems[2];
    VGfloat vertices[4][2][4];
+
+   void *cached_vs[NUM_RENDERER_VS];
+   void *cached_fs[NUM_RENDERER_FS];
+
+   RendererState state;
+
+   /* state data */
+   union {
+      struct {
+         VGint tex_width;
+         VGint tex_height;
+      } copy;
+
+      struct {
+         VGint tex_width;
+         VGint tex_height;
+      } drawtex;
+
+      struct {
+         VGboolean restore_dsa;
+      } scissor;
+
+      struct {
+         VGboolean use_sampler;
+         VGint tex_width, tex_height;
+      } filter;
+
+      struct {
+         struct pipe_depth_stencil_alpha_state dsa;
+         VGboolean manual_two_sides;
+         VGboolean restore_dsa;
+      } polygon_stencil;
+   } u;
 };
 
-static void setup_shaders(struct renderer *ctx)
+/**
+ * Return VG_TRUE if the renderer can use the resource as the asked bindings.
+ */
+static VGboolean renderer_can_support(struct renderer *renderer,
+                                      struct pipe_resource *res,
+                                      unsigned bindings)
 {
-   struct pipe_context *pipe = ctx->pipe;
-   /* fragment shader */
-   ctx->fs = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D,
-                                           TGSI_INTERPOLATE_LINEAR);
-}
-
-static struct pipe_resource *
-setup_vertex_data(struct renderer *ctx,
-                  float x0, float y0, float x1, float y1, float z)
-{
-   ctx->vertices[0][0][0] = x0;
-   ctx->vertices[0][0][1] = y0;
-   ctx->vertices[0][0][2] = z;
-   ctx->vertices[0][1][0] = 0.0f; /*s*/
-   ctx->vertices[0][1][1] = 0.0f; /*t*/
-
-   ctx->vertices[1][0][0] = x1;
-   ctx->vertices[1][0][1] = y0;
-   ctx->vertices[1][0][2] = z;
-   ctx->vertices[1][1][0] = 1.0f; /*s*/
-   ctx->vertices[1][1][1] = 0.0f; /*t*/
-
-   ctx->vertices[2][0][0] = x1;
-   ctx->vertices[2][0][1] = y1;
-   ctx->vertices[2][0][2] = z;
-   ctx->vertices[2][1][0] = 1.0f;
-   ctx->vertices[2][1][1] = 1.0f;
-
-   ctx->vertices[3][0][0] = x0;
-   ctx->vertices[3][0][1] = y1;
-   ctx->vertices[3][0][2] = z;
-   ctx->vertices[3][1][0] = 0.0f;
-   ctx->vertices[3][1][1] = 1.0f;
-
-   return pipe_user_buffer_create( ctx->pipe->screen,
-                                   ctx->vertices,
-                                   sizeof(ctx->vertices),
-                                  PIPE_BIND_VERTEX_BUFFER);
-}
-
-static struct pipe_resource *
-setup_vertex_data_tex(struct renderer *ctx,
-                      float x0, float y0, float x1, float y1,
-                      float s0, float t0, float s1, float t1,
-                      float z)
-{
-   ctx->vertices[0][0][0] = x0;
-   ctx->vertices[0][0][1] = y0;
-   ctx->vertices[0][0][2] = z;
-   ctx->vertices[0][1][0] = s0; /*s*/
-   ctx->vertices[0][1][1] = t0; /*t*/
-
-   ctx->vertices[1][0][0] = x1;
-   ctx->vertices[1][0][1] = y0;
-   ctx->vertices[1][0][2] = z;
-   ctx->vertices[1][1][0] = s1; /*s*/
-   ctx->vertices[1][1][1] = t0; /*t*/
-
-   ctx->vertices[2][0][0] = x1;
-   ctx->vertices[2][0][1] = y1;
-   ctx->vertices[2][0][2] = z;
-   ctx->vertices[2][1][0] = s1;
-   ctx->vertices[2][1][1] = t1;
-
-   ctx->vertices[3][0][0] = x0;
-   ctx->vertices[3][0][1] = y1;
-   ctx->vertices[3][0][2] = z;
-   ctx->vertices[3][1][0] = s0;
-   ctx->vertices[3][1][1] = t1;
-
-   return pipe_user_buffer_create( ctx->pipe->screen,
-                                   ctx->vertices,
-                                   sizeof(ctx->vertices),
-                                  PIPE_BIND_VERTEX_BUFFER);
-}
-
-
-static struct pipe_resource *
-setup_vertex_data_qtex(struct renderer *ctx,
-                       float x0, float y0, float x1, float y1,
-                       float x2, float y2, float x3, float y3,
-                       float s0, float t0, float s1, float t1,
-                       float z)
-{
-   ctx->vertices[0][0][0] = x0;
-   ctx->vertices[0][0][1] = y0;
-   ctx->vertices[0][0][2] = z;
-   ctx->vertices[0][1][0] = s0; /*s*/
-   ctx->vertices[0][1][1] = t0; /*t*/
-
-   ctx->vertices[1][0][0] = x1;
-   ctx->vertices[1][0][1] = y1;
-   ctx->vertices[1][0][2] = z;
-   ctx->vertices[1][1][0] = s1; /*s*/
-   ctx->vertices[1][1][1] = t0; /*t*/
-
-   ctx->vertices[2][0][0] = x2;
-   ctx->vertices[2][0][1] = y2;
-   ctx->vertices[2][0][2] = z;
-   ctx->vertices[2][1][0] = s1;
-   ctx->vertices[2][1][1] = t1;
-
-   ctx->vertices[3][0][0] = x3;
-   ctx->vertices[3][0][1] = y3;
-   ctx->vertices[3][0][2] = z;
-   ctx->vertices[3][1][0] = s0;
-   ctx->vertices[3][1][1] = t1;
-
-   return pipe_user_buffer_create( ctx->pipe->screen,
-                                   ctx->vertices,
-                                   sizeof(ctx->vertices),
-                                  PIPE_BIND_VERTEX_BUFFER);
+   struct pipe_screen *screen = renderer->pipe->screen;
+
+   return screen->is_format_supported(screen,
+         res->format, res->target, 0, bindings, 0);
 }
 
-struct renderer * renderer_create(struct vg_context *owner)
+/**
+ * Set the model-view-projection matrix used by vertex shaders.
+ */
+static void renderer_set_mvp(struct renderer *renderer,
+                             const struct matrix *mvp)
 {
+   struct matrix *cur = &renderer->mvp;
+   struct pipe_resource *cbuf;
+   VGfloat consts[3][4];
    VGint i;
-   struct renderer *renderer = CALLOC_STRUCT(renderer);
 
-   if (!renderer)
+   /* projection only */
+   if (!mvp)
+      mvp = &renderer->projection;
+
+   /* re-upload only if necessary */
+   if (memcmp(cur, mvp, sizeof(*mvp)) == 0)
+      return;
+
+   /* 3x3 matrix to 3 constant vectors (no Z) */
+   for (i = 0; i < 3; i++) {
+      consts[i][0] = mvp->m[i + 0];
+      consts[i][1] = mvp->m[i + 3];
+      consts[i][2] = 0.0f;
+      consts[i][3] = mvp->m[i + 6];
+   }
+
+   cbuf = renderer->vs_cbuf;
+   pipe_resource_reference(&cbuf, NULL);
+   cbuf = pipe_buffer_create(renderer->pipe->screen,
+                             PIPE_BIND_CONSTANT_BUFFER,
+                             sizeof(consts));
+   if (cbuf) {
+      pipe_buffer_write(renderer->pipe, cbuf,
+            0, sizeof(consts), consts);
+   }
+   renderer->pipe->set_constant_buffer(renderer->pipe,
+         PIPE_SHADER_VERTEX, 0, cbuf);
+
+   memcpy(cur, mvp, sizeof(*mvp));
+   renderer->vs_cbuf = cbuf;
+}
+
+/**
+ * Create a simple vertex shader that passes through position and the given
+ * attribute.
+ */
+static void *create_passthrough_vs(struct pipe_context *pipe, int semantic_name)
+{
+   struct ureg_program *ureg;
+   struct ureg_src src[2], constants[3];
+   struct ureg_dst dst[2], tmp;
+   int i;
+
+   ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
+   if (!ureg)
       return NULL;
 
-   renderer->owner = owner;
-   renderer->pipe = owner->pipe;
-   renderer->cso = owner->cso_context;
+   /* position is in user coordinates */
+   src[0] = ureg_DECL_vs_input(ureg, 0);
+   dst[0] = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0);
+   tmp = ureg_DECL_temporary(ureg);
+   for (i = 0; i < Elements(constants); i++)
+      constants[i] = ureg_DECL_constant(ureg, i);
+
+   /* transform to clipped coordinates */
+   ureg_DP4(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), src[0], constants[0]);
+   ureg_DP4(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), src[0], constants[1]);
+   ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Z), src[0]);
+   ureg_DP4(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), src[0], constants[2]);
+   ureg_MOV(ureg, dst[0], ureg_src(tmp));
+
+   if (semantic_name >= 0) {
+      src[1] = ureg_DECL_vs_input(ureg, 1);
+      dst[1] = ureg_DECL_output(ureg, semantic_name, 0);
+      ureg_MOV(ureg, dst[1], src[1]);
+   }
 
-   setup_shaders(renderer);
+   ureg_END(ureg);
 
-   /* init vertex data that doesn't change */
-   for (i = 0; i < 4; i++) {
-      renderer->vertices[i][0][3] = 1.0f; /* w */
-      renderer->vertices[i][1][2] = 0.0f; /* r */
-      renderer->vertices[i][1][3] = 1.0f; /* q */
+   return ureg_create_shader_and_destroy(ureg, pipe);
+}
+
+/**
+ * Set renderer vertex shader.
+ *
+ * This function modifies vertex_shader state.
+ */
+static void renderer_set_vs(struct renderer *r, RendererVs id)
+{
+   /* create as needed */
+   if (!r->cached_vs[id]) {
+      int semantic_name = -1;
+
+      switch (id) {
+      case RENDERER_VS_PLAIN:
+         break;
+      case RENDERER_VS_COLOR:
+         semantic_name = TGSI_SEMANTIC_COLOR;
+         break;
+      case RENDERER_VS_TEXTURE:
+         semantic_name = TGSI_SEMANTIC_GENERIC;
+         break;
+      default:
+         assert(!"Unknown renderer vs id");
+         break;
+      }
+
+      r->cached_vs[id] = create_passthrough_vs(r->pipe, semantic_name);
    }
 
-   return renderer;
+   cso_set_vertex_shader_handle(r->cso, r->cached_vs[id]);
 }
 
-void renderer_destroy(struct renderer *ctx)
+/**
+ * Create a simple fragment shader that sets the depth to 0.0f.
+ */
+static void *create_scissor_fs(struct pipe_context *pipe)
+{
+   struct ureg_program *ureg;
+   struct ureg_dst out;
+   struct ureg_src imm;
+
+   ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
+   out = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0);
+   imm = ureg_imm4f(ureg, 0.0f, 0.0f, 0.0f, 0.0f);
+
+   ureg_MOV(ureg, ureg_writemask(out, TGSI_WRITEMASK_Z), imm);
+   ureg_END(ureg);
+
+   return ureg_create_shader_and_destroy(ureg, pipe);
+}
+
+/**
+ * Create a simple fragment shader that sets the color to white.
+ */
+static void *create_white_fs(struct pipe_context *pipe)
+{
+   struct ureg_program *ureg;
+   struct ureg_dst out;
+   struct ureg_src imm;
+
+   ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
+   out = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0);
+   imm = ureg_imm4f(ureg, 1.0f, 1.0f, 1.0f, 1.0f);
+
+   ureg_MOV(ureg, out, imm);
+   ureg_END(ureg);
+
+   return ureg_create_shader_and_destroy(ureg, pipe);
+}
+
+/**
+ * Set renderer fragment shader.
+ *
+ * This function modifies fragment_shader state.
+ */
+static void renderer_set_fs(struct renderer *r, RendererFs id)
 {
-#if 0
-   if (ctx->fs) {
-      cso_delete_fragment_shader(ctx->cso, ctx->fs);
-      ctx->fs = NULL;
+   /* create as needed */
+   if (!r->cached_fs[id]) {
+      void *fs = NULL;
+
+      switch (id) {
+      case RENDERER_FS_COLOR:
+         fs = util_make_fragment_passthrough_shader(r->pipe);
+         break;
+      case RENDERER_FS_TEXTURE:
+         fs = util_make_fragment_tex_shader(r->pipe,
+               TGSI_TEXTURE_2D, TGSI_INTERPOLATE_LINEAR);
+         break;
+      case RENDERER_FS_SCISSOR:
+         fs = create_scissor_fs(r->pipe);
+         break;
+      case RENDERER_FS_WHITE:
+         fs = create_white_fs(r->pipe);
+         break;
+      default:
+         assert(!"Unknown renderer fs id");
+         break;
+      }
+
+      r->cached_fs[id] = fs;
    }
-#endif
-   FREE(ctx);
+
+   cso_set_fragment_shader_handle(r->cso, r->cached_fs[id]);
 }
 
-void renderer_draw_quad(struct renderer *r,
-                        VGfloat x1, VGfloat y1,
-                        VGfloat x2, VGfloat y2,
-                        VGfloat depth)
+typedef enum {
+   VEGA_Y0_TOP,
+   VEGA_Y0_BOTTOM
+} VegaOrientation;
+
+static void vg_set_viewport(struct renderer *r,
+                            VegaOrientation orientation)
 {
-   struct pipe_resource *buf;
+   const struct pipe_framebuffer_state *fb = &r->g3d.fb;
+   struct pipe_viewport_state viewport;
+   VGfloat y_scale = (orientation == VEGA_Y0_BOTTOM) ? -2.f : 2.f;
+
+   viewport.scale[0] =  fb->width / 2.f;
+   viewport.scale[1] =  fb->height / y_scale;
+   viewport.scale[2] =  1.0;
+   viewport.scale[3] =  1.0;
+   viewport.translate[0] = fb->width / 2.f;
+   viewport.translate[1] = fb->height / 2.f;
+   viewport.translate[2] = 0.0;
+   viewport.translate[3] = 0.0;
+
+   cso_set_viewport(r->cso, &viewport);
+}
+
+/**
+ * Set renderer target.
+ *
+ * This function modifies framebuffer and viewport states.
+ */
+static void renderer_set_target(struct renderer *r,
+                                struct pipe_surface *cbuf,
+                                struct pipe_surface *zsbuf,
+                                VGboolean y0_top)
+{
+   struct pipe_framebuffer_state fb;
+
+   memset(&fb, 0, sizeof(fb));
+   fb.width = cbuf->width;
+   fb.height = cbuf->height;
+   fb.cbufs[0] = cbuf;
+   fb.nr_cbufs = 1;
+   fb.zsbuf = zsbuf;
+   cso_set_framebuffer(r->cso, &fb);
+
+   vg_set_viewport(r, (y0_top) ? VEGA_Y0_TOP : VEGA_Y0_BOTTOM);
+}
+
+/**
+ * Set renderer blend state.  Blending is disabled.
+ *
+ * This function modifies blend state.
+ */
+static void renderer_set_blend(struct renderer *r,
+                               VGbitfield channel_mask)
+{
+   struct pipe_blend_state blend;
+
+   memset(&blend, 0, sizeof(blend));
+
+   blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
+   blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+   blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
+   blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
+
+   if (channel_mask & VG_RED)
+      blend.rt[0].colormask |= PIPE_MASK_R;
+   if (channel_mask & VG_GREEN)
+      blend.rt[0].colormask |= PIPE_MASK_G;
+   if (channel_mask & VG_BLUE)
+      blend.rt[0].colormask |= PIPE_MASK_B;
+   if (channel_mask & VG_ALPHA)
+      blend.rt[0].colormask |= PIPE_MASK_A;
+
+   cso_set_blend(r->cso, &blend);
+}
+
+/**
+ * Set renderer sampler and view states.
+ *
+ * This function modifies samplers and fragment_sampler_views states.
+ */
+static void renderer_set_samplers(struct renderer *r,
+                                  uint num_views,
+                                  struct pipe_sampler_view **views)
+{
+   struct pipe_sampler_state sampler;
+   unsigned tex_filter = PIPE_TEX_FILTER_NEAREST;
+   unsigned tex_wrap = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+   uint i;
+
+   memset(&sampler, 0, sizeof(sampler));
+
+   sampler.min_img_filter = tex_filter;
+   sampler.mag_img_filter = tex_filter;
+   sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
+
+   sampler.wrap_s = tex_wrap;
+   sampler.wrap_t = tex_wrap;
+   sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+
+   sampler.normalized_coords = 1;
+
+   /* set samplers */
+   for (i = 0; i < num_views; i++)
+      cso_single_sampler(r->cso, i, &sampler);
+   cso_single_sampler_done(r->cso);
+
+   /* set views */
+   cso_set_fragment_sampler_views(r->cso, num_views, views);
+}
+
+/**
+ * Set custom renderer fragment shader, and optionally set samplers and views
+ * and upload the fragment constant buffer.
+ *
+ * This function modifies fragment_shader, samplers and fragment_sampler_views
+ * states.
+ */
+static void renderer_set_custom_fs(struct renderer *renderer,
+                                   void *fs,
+                                   const struct pipe_sampler_state **samplers,
+                                   struct pipe_sampler_view **views,
+                                   VGint num_samplers,
+                                   const void *const_buffer,
+                                   VGint const_buffer_len)
+{
+   cso_set_fragment_shader_handle(renderer->cso, fs);
+
+   /* set samplers and views */
+   if (num_samplers) {
+      cso_set_samplers(renderer->cso, num_samplers, samplers);
+      cso_set_fragment_sampler_views(renderer->cso, num_samplers, views);
+   }
+
+   /* upload fs constant buffer */
+   if (const_buffer_len) {
+      struct pipe_resource *cbuf = renderer->fs_cbuf;
+
+      if (!cbuf || renderer->fs_cbuf_len != const_buffer_len ||
+          memcmp(renderer->fs_cbuf_data, const_buffer, const_buffer_len)) {
+         pipe_resource_reference(&cbuf, NULL);
+
+         cbuf = pipe_buffer_create(renderer->pipe->screen,
+               PIPE_BIND_CONSTANT_BUFFER, const_buffer_len);
+         pipe_buffer_write(renderer->pipe, cbuf, 0,
+               const_buffer_len, const_buffer);
+         renderer->pipe->set_constant_buffer(renderer->pipe,
+               PIPE_SHADER_FRAGMENT, 0, cbuf);
+
+         renderer->fs_cbuf = cbuf;
+         if (const_buffer_len <= sizeof(renderer->fs_cbuf_data)) {
+            memcpy(renderer->fs_cbuf_data, const_buffer, const_buffer_len);
+            renderer->fs_cbuf_len = const_buffer_len;
+         }
+         else {
+            renderer->fs_cbuf_len = 0;
+         }
+      }
+   }
+}
+
+/**
+ * Setup renderer quad position.
+ */
+static void renderer_quad_pos(struct renderer *r,
+                              VGfloat x0, VGfloat y0,
+                              VGfloat x1, VGfloat y1,
+                              VGboolean scissor)
+{
+   VGfloat z;
+
+   /* the depth test is used for scissoring */
+   z = (scissor) ? 0.0f : 1.0f;
+
+   /* positions */
+   r->vertices[0][0][0] = x0;
+   r->vertices[0][0][1] = y0;
+   r->vertices[0][0][2] = z;
 
-   buf = setup_vertex_data(r, x1, y1, x2, y2, depth);
+   r->vertices[1][0][0] = x1;
+   r->vertices[1][0][1] = y0;
+   r->vertices[1][0][2] = z;
 
+   r->vertices[2][0][0] = x1;
+   r->vertices[2][0][1] = y1;
+   r->vertices[2][0][2] = z;
+
+   r->vertices[3][0][0] = x0;
+   r->vertices[3][0][1] = y1;
+   r->vertices[3][0][2] = z;
+}
+
+/**
+ * Setup renderer quad texture coordinates.
+ */
+static void renderer_quad_texcoord(struct renderer *r,
+                                   VGfloat x0, VGfloat y0,
+                                   VGfloat x1, VGfloat y1,
+                                   VGint tex_width, VGint tex_height)
+{
+   VGfloat s0, t0, s1, t1, r0, q0;
+   VGint i;
+
+   s0 = x0 / tex_width;
+   s1 = x1 / tex_width;
+   t0 = y0 / tex_height;
+   t1 = y1 / tex_height;
+   r0 = 0.0f;
+   q0 = 1.0f;
+
+   /* texcoords */
+   r->vertices[0][1][0] = s0;
+   r->vertices[0][1][1] = t0;
+
+   r->vertices[1][1][0] = s1;
+   r->vertices[1][1][1] = t0;
+
+   r->vertices[2][1][0] = s1;
+   r->vertices[2][1][1] = t1;
+
+   r->vertices[3][1][0] = s0;
+   r->vertices[3][1][1] = t1;
+
+   for (i = 0; i < 4; i++) {
+      r->vertices[i][1][2] = r0;
+      r->vertices[i][1][3] = q0;
+   }
+}
+
+/**
+ * Draw renderer quad.
+ */
+static void renderer_quad_draw(struct renderer *r)
+{
+   struct pipe_resource *buf;
+
+   buf = pipe_user_buffer_create(r->pipe->screen,
+                                 r->vertices,
+                                 sizeof(r->vertices),
+                                 PIPE_BIND_VERTEX_BUFFER);
    if (buf) {
-      cso_set_vertex_elements(r->cso, 2, r->owner->velems);
       util_draw_vertex_buffer(r->pipe, buf, 0,
                               PIPE_PRIM_TRIANGLE_FAN,
-                              4,  /* verts */
-                              2); /* attribs/vert */
+                              Elements(r->vertices),     /* verts */
+                              Elements(r->vertices[0])); /* attribs/vert */
 
-      pipe_resource_reference( &buf,
-                             NULL );
+      pipe_resource_reference(&buf, NULL);
    }
 }
 
-void renderer_draw_texture(struct renderer *r,
-                           struct pipe_resource *tex,
-                           VGfloat x1offset, VGfloat y1offset,
-                           VGfloat x2offset, VGfloat y2offset,
-                           VGfloat x1, VGfloat y1,
-                           VGfloat x2, VGfloat y2)
+/**
+ * Prepare the renderer for copying.
+ */
+VGboolean renderer_copy_begin(struct renderer *renderer,
+                              struct pipe_surface *dst,
+                              VGboolean y0_top,
+                              struct pipe_sampler_view *src)
 {
-   struct pipe_context *pipe = r->pipe;
-   struct pipe_resource *buf;
-   VGfloat s0, t0, s1, t1;
+   assert(renderer->state == RENDERER_STATE_INIT);
 
-   assert(tex->width0 != 0);
-   assert(tex->height0 != 0);
+   /* sanity check */
+   if (!renderer_can_support(renderer,
+            dst->texture, PIPE_BIND_RENDER_TARGET) ||
+       !renderer_can_support(renderer,
+          src->texture, PIPE_BIND_SAMPLER_VIEW))
+      return VG_FALSE;
 
-   s0 = x1offset / tex->width0;
-   s1 = x2offset / tex->width0;
-   t0 = y1offset / tex->height0;
-   t1 = y2offset / tex->height0;
+   cso_save_framebuffer(renderer->cso);
+   cso_save_viewport(renderer->cso);
+   cso_save_blend(renderer->cso);
+   cso_save_samplers(renderer->cso);
+   cso_save_fragment_sampler_views(renderer->cso);
+   cso_save_fragment_shader(renderer->cso);
+   cso_save_vertex_shader(renderer->cso);
 
-   cso_save_vertex_shader(r->cso);
-   /* shaders */
-   cso_set_vertex_shader_handle(r->cso, vg_texture_vs(r->owner));
+   renderer_set_target(renderer, dst, NULL, y0_top);
 
-   /* draw quad */
-   buf = setup_vertex_data_tex(r, x1, y1, x2, y2,
-                               s0, t0, s1, t1, 0.0f);
+   renderer_set_blend(renderer, ~0);
+   renderer_set_samplers(renderer, 1, &src);
 
-   if (buf) {
-      cso_set_vertex_elements(r->cso, 2, r->owner->velems);
-      util_draw_vertex_buffer(pipe, buf, 0,
-                           PIPE_PRIM_TRIANGLE_FAN,
-                           4,  /* verts */
-                           2); /* attribs/vert */
-
-      pipe_resource_reference( &buf,
-                             NULL );
+   renderer_set_fs(renderer, RENDERER_FS_TEXTURE);
+   renderer_set_vs(renderer, RENDERER_VS_TEXTURE);
+
+   renderer_set_mvp(renderer, NULL);
+
+   /* remember the texture size */
+   renderer->u.copy.tex_width = src->texture->width0;
+   renderer->u.copy.tex_height = src->texture->height0;
+   renderer->state = RENDERER_STATE_COPY;
+
+   return VG_TRUE;
+}
+
+/**
+ * Draw into the destination rectangle given by (x, y, w, h).  The texture is
+ * sampled from within the rectangle given by (sx, sy, sw, sh).
+ *
+ * The coordinates are in surface coordinates.
+ */
+void renderer_copy(struct renderer *renderer,
+                   VGint x, VGint y, VGint w, VGint h,
+                   VGint sx, VGint sy, VGint sw, VGint sh)
+{
+   assert(renderer->state == RENDERER_STATE_COPY);
+
+   /* there is no depth buffer for scissoring anyway */
+   renderer_quad_pos(renderer, x, y, x + w, y + h, VG_FALSE);
+   renderer_quad_texcoord(renderer, sx, sy, sx + sw, sy + sh,
+         renderer->u.copy.tex_width,
+         renderer->u.copy.tex_height);
+
+   renderer_quad_draw(renderer);
+}
+
+/**
+ * End copying and restore the states.
+ */
+void renderer_copy_end(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_COPY);
+
+   cso_restore_framebuffer(renderer->cso);
+   cso_restore_viewport(renderer->cso);
+   cso_restore_blend(renderer->cso);
+   cso_restore_samplers(renderer->cso);
+   cso_restore_fragment_sampler_views(renderer->cso);
+   cso_restore_fragment_shader(renderer->cso);
+   cso_restore_vertex_shader(renderer->cso);
+
+   renderer->state = RENDERER_STATE_INIT;
+}
+
+/**
+ * Prepare the renderer for textured drawing.
+ */
+VGboolean renderer_drawtex_begin(struct renderer *renderer,
+                                 struct pipe_sampler_view *src)
+{
+   assert(renderer->state == RENDERER_STATE_INIT);
+
+   if (!renderer_can_support(renderer, src->texture, PIPE_BIND_SAMPLER_VIEW))
+      return VG_FALSE;
+
+   cso_save_blend(renderer->cso);
+   cso_save_samplers(renderer->cso);
+   cso_save_fragment_sampler_views(renderer->cso);
+   cso_save_fragment_shader(renderer->cso);
+   cso_save_vertex_shader(renderer->cso);
+
+   renderer_set_blend(renderer, ~0);
+
+   renderer_set_samplers(renderer, 1, &src);
+
+   renderer_set_fs(renderer, RENDERER_FS_TEXTURE);
+   renderer_set_vs(renderer, RENDERER_VS_TEXTURE);
+
+   renderer_set_mvp(renderer, NULL);
+
+   /* remember the texture size */
+   renderer->u.drawtex.tex_width = src->texture->width0;
+   renderer->u.drawtex.tex_height = src->texture->height0;
+   renderer->state = RENDERER_STATE_DRAWTEX;
+
+   return VG_TRUE;
+}
+
+/**
+ * Draw into the destination rectangle given by (x, y, w, h).  The texture is
+ * sampled from within the rectangle given by (sx, sy, sw, sh).
+ *
+ * The coordinates are in surface coordinates.
+ */
+void renderer_drawtex(struct renderer *renderer,
+                      VGint x, VGint y, VGint w, VGint h,
+                      VGint sx, VGint sy, VGint sw, VGint sh)
+{
+   assert(renderer->state == RENDERER_STATE_DRAWTEX);
+
+   /* with scissoring */
+   renderer_quad_pos(renderer, x, y, x + w, y + h, VG_TRUE);
+   renderer_quad_texcoord(renderer, sx, sy, sx + sw, sy + sh,
+         renderer->u.drawtex.tex_width,
+         renderer->u.drawtex.tex_height);
+
+   renderer_quad_draw(renderer);
+}
+
+/**
+ * End textured drawing and restore the states.
+ */
+void renderer_drawtex_end(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_DRAWTEX);
+
+   cso_restore_blend(renderer->cso);
+   cso_restore_samplers(renderer->cso);
+   cso_restore_fragment_sampler_views(renderer->cso);
+   cso_restore_fragment_shader(renderer->cso);
+   cso_restore_vertex_shader(renderer->cso);
+
+   renderer->state = RENDERER_STATE_INIT;
+}
+
+/**
+ * Prepare the renderer for scissor update.  This will reset the depth buffer
+ * to 1.0f.
+ */
+VGboolean renderer_scissor_begin(struct renderer *renderer,
+                                 VGboolean restore_dsa)
+{
+   struct pipe_depth_stencil_alpha_state dsa;
+
+   assert(renderer->state == RENDERER_STATE_INIT);
+
+   if (restore_dsa)
+      cso_save_depth_stencil_alpha(renderer->cso);
+   cso_save_blend(renderer->cso);
+   cso_save_fragment_shader(renderer->cso);
+
+   /* enable depth writes */
+   memset(&dsa, 0, sizeof(dsa));
+   dsa.depth.enabled = 1;
+   dsa.depth.writemask = 1;
+   dsa.depth.func = PIPE_FUNC_ALWAYS;
+   cso_set_depth_stencil_alpha(renderer->cso, &dsa);
+
+   /* disable color writes */
+   renderer_set_blend(renderer, 0);
+   renderer_set_fs(renderer, RENDERER_FS_SCISSOR);
+
+   renderer_set_mvp(renderer, NULL);
+
+   renderer->u.scissor.restore_dsa = restore_dsa;
+   renderer->state = RENDERER_STATE_SCISSOR;
+
+   /* clear the depth buffer to 1.0f */
+   renderer->pipe->clear(renderer->pipe,
+         PIPE_CLEAR_DEPTHSTENCIL, NULL, 1.0f, 0);
+
+   return VG_TRUE;
+}
+
+/**
+ * Add a scissor rectangle.  Depth values inside the rectangle will be set to
+ * 0.0f.
+ */
+void renderer_scissor(struct renderer *renderer,
+                      VGint x, VGint y, VGint width, VGint height)
+{
+   assert(renderer->state == RENDERER_STATE_SCISSOR);
+
+   renderer_quad_pos(renderer, x, y, x + width, y + height, VG_FALSE);
+   renderer_quad_draw(renderer);
+}
+
+/**
+ * End scissor update and restore the states.
+ */
+void renderer_scissor_end(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_SCISSOR);
+
+   if (renderer->u.scissor.restore_dsa)
+      cso_restore_depth_stencil_alpha(renderer->cso);
+   cso_restore_blend(renderer->cso);
+   cso_restore_fragment_shader(renderer->cso);
+
+   renderer->state = RENDERER_STATE_INIT;
+}
+
+/**
+ * Prepare the renderer for clearing.
+ */
+VGboolean renderer_clear_begin(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_INIT);
+
+   cso_save_blend(renderer->cso);
+   cso_save_fragment_shader(renderer->cso);
+   cso_save_vertex_shader(renderer->cso);
+
+   renderer_set_blend(renderer, ~0);
+   renderer_set_fs(renderer, RENDERER_FS_COLOR);
+   renderer_set_vs(renderer, RENDERER_VS_COLOR);
+
+   renderer_set_mvp(renderer, NULL);
+
+   renderer->state = RENDERER_STATE_CLEAR;
+
+   return VG_TRUE;
+}
+
+/**
+ * Clear the framebuffer with the specified region and color.
+ *
+ * The coordinates are in surface coordinates.
+ */
+void renderer_clear(struct renderer *renderer,
+                    VGint x, VGint y, VGint width, VGint height,
+                    const VGfloat color[4])
+{
+   VGuint i;
+
+   assert(renderer->state == RENDERER_STATE_CLEAR);
+
+   renderer_quad_pos(renderer, x, y, x + width, y + height, VG_TRUE);
+   for (i = 0; i < 4; i++)
+      memcpy(renderer->vertices[i][1], color, sizeof(VGfloat) * 4);
+
+   renderer_quad_draw(renderer);
+}
+
+/**
+ * End clearing and retore the states.
+ */
+void renderer_clear_end(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_CLEAR);
+
+   cso_restore_blend(renderer->cso);
+   cso_restore_fragment_shader(renderer->cso);
+   cso_restore_vertex_shader(renderer->cso);
+
+   renderer->state = RENDERER_STATE_INIT;
+}
+
+/**
+ * Prepare the renderer for image filtering.
+ */
+VGboolean renderer_filter_begin(struct renderer *renderer,
+                                struct pipe_resource *dst,
+                                VGboolean y0_top,
+                                VGbitfield channel_mask,
+                                const struct pipe_sampler_state **samplers,
+                                struct pipe_sampler_view **views,
+                                VGint num_samplers,
+                                void *fs,
+                                const void *const_buffer,
+                                VGint const_buffer_len)
+{
+   struct pipe_surface *surf, surf_tmpl;
+
+   assert(renderer->state == RENDERER_STATE_INIT);
+
+   if (!fs)
+      return VG_FALSE;
+   if (!renderer_can_support(renderer, dst, PIPE_BIND_RENDER_TARGET))
+      return VG_FALSE;
+
+   u_surface_default_template(&surf_tmpl, dst,
+                              PIPE_BIND_RENDER_TARGET);
+   surf = renderer->pipe->create_surface(renderer->pipe, dst, &surf_tmpl);
+   if (!surf)
+      return VG_FALSE;
+
+   cso_save_framebuffer(renderer->cso);
+   cso_save_viewport(renderer->cso);
+   cso_save_blend(renderer->cso);
+
+   /* set the image as the target */
+   renderer_set_target(renderer, surf, NULL, y0_top);
+   pipe_surface_reference(&surf, NULL);
+
+   renderer_set_blend(renderer, channel_mask);
+
+   if (num_samplers) {
+      struct pipe_resource *tex;
+
+      cso_save_samplers(renderer->cso);
+      cso_save_fragment_sampler_views(renderer->cso);
+      cso_save_fragment_shader(renderer->cso);
+      cso_save_vertex_shader(renderer->cso);
+
+      renderer_set_custom_fs(renderer, fs,
+                             samplers, views, num_samplers,
+                             const_buffer, const_buffer_len);
+      renderer_set_vs(renderer, RENDERER_VS_TEXTURE);
+
+      tex = views[0]->texture;
+      renderer->u.filter.tex_width = tex->width0;
+      renderer->u.filter.tex_height = tex->height0;
+      renderer->u.filter.use_sampler = VG_TRUE;
    }
+   else {
+      cso_save_fragment_shader(renderer->cso);
 
-   cso_restore_vertex_shader(r->cso);
+      renderer_set_custom_fs(renderer, fs, NULL, NULL, 0,
+                             const_buffer, const_buffer_len);
+
+      renderer->u.filter.use_sampler = VG_FALSE;
+   }
+
+   renderer_set_mvp(renderer, NULL);
+
+   renderer->state = RENDERER_STATE_FILTER;
+
+   return VG_TRUE;
 }
 
-void renderer_copy_texture(struct renderer *ctx,
-                           struct pipe_sampler_view *src,
-                           VGfloat sx1, VGfloat sy1,
-                           VGfloat sx2, VGfloat sy2,
-                           struct pipe_resource *dst,
-                           VGfloat dx1, VGfloat dy1,
-                           VGfloat dx2, VGfloat dy2)
+/**
+ * Draw into a rectangle of the destination with the specified region of the
+ * texture(s).
+ *
+ * The coordinates are in surface coordinates.
+ */
+void renderer_filter(struct renderer *renderer,
+                    VGint x, VGint y, VGint w, VGint h,
+                    VGint sx, VGint sy, VGint sw, VGint sh)
 {
-   struct pipe_context *pipe = ctx->pipe;
-   struct pipe_screen *screen = pipe->screen;
-   struct pipe_resource *tex = src->texture;
-   struct pipe_resource *buf;
-   struct pipe_surface *dst_surf = screen->get_tex_surface(
-      screen, dst, 0, 0, 0,
-      PIPE_BIND_RENDER_TARGET);
-   struct pipe_framebuffer_state fb;
-   float s0, t0, s1, t1;
+   assert(renderer->state == RENDERER_STATE_FILTER);
 
-   assert(tex->width0 != 0);
-   assert(tex->height0 != 0);
-   assert(dst->width0 != 0);
-   assert(dst->height0 != 0);
-
-#if 0
-   debug_printf("copy texture [%f, %f, %f, %f], [%f, %f, %f, %f]\n",
-                sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
-#endif
-
-#if 1
-   s0 = sx1 / tex->width0;
-   s1 = sx2 / tex->width0;
-   t0 = sy1 / tex->height0;
-   t1 = sy2 / tex->height0;
-#else
-   s0 = 0;
-   s1 = 1;
-   t0 = 0;
-   t1 = 1;
-#endif
-
-   assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D,
-                                      0, PIPE_BIND_RENDER_TARGET, 0));
+   renderer_quad_pos(renderer, x, y, x + w, y + h, VG_FALSE);
+   if (renderer->u.filter.use_sampler) {
+      renderer_quad_texcoord(renderer, sx, sy, sx + sw, sy + sh,
+            renderer->u.filter.tex_width,
+            renderer->u.filter.tex_height);
+   }
 
-   /* save state (restored below) */
-   cso_save_blend(ctx->cso);
-   cso_save_samplers(ctx->cso);
-   cso_save_fragment_sampler_views(ctx->cso);
-   cso_save_framebuffer(ctx->cso);
-   cso_save_fragment_shader(ctx->cso);
-   cso_save_vertex_shader(ctx->cso);
+   renderer_quad_draw(renderer);
+}
+
+/**
+ * End image filtering and restore the states.
+ */
+void renderer_filter_end(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_FILTER);
 
-   cso_save_viewport(ctx->cso);
+   if (renderer->u.filter.use_sampler) {
+      cso_restore_samplers(renderer->cso);
+      cso_restore_fragment_sampler_views(renderer->cso);
+      cso_restore_vertex_shader(renderer->cso);
+   }
 
+   cso_restore_framebuffer(renderer->cso);
+   cso_restore_viewport(renderer->cso);
+   cso_restore_blend(renderer->cso);
+   cso_restore_fragment_shader(renderer->cso);
 
-   /* set misc state we care about */
-   {
-      struct pipe_blend_state blend;
-      memset(&blend, 0, sizeof(blend));
-      blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.rt[0].colormask = PIPE_MASK_RGBA;
-      cso_set_blend(ctx->cso, &blend);
+   renderer->state = RENDERER_STATE_INIT;
+}
+
+/**
+ * Prepare the renderer for polygon silhouette rendering.
+ */
+VGboolean renderer_polygon_stencil_begin(struct renderer *renderer,
+                                         struct pipe_vertex_element *velem,
+                                         VGFillRule rule,
+                                         VGboolean restore_dsa)
+{
+   struct pipe_depth_stencil_alpha_state *dsa;
+   VGboolean manual_two_sides;
+
+   assert(renderer->state == RENDERER_STATE_INIT);
+
+   cso_save_vertex_elements(renderer->cso);
+   cso_save_blend(renderer->cso);
+   cso_save_depth_stencil_alpha(renderer->cso);
+
+   cso_set_vertex_elements(renderer->cso, 1, velem);
+
+   /* disable color writes */
+   renderer_set_blend(renderer, 0);
+
+   manual_two_sides = VG_FALSE;
+   dsa = &renderer->u.polygon_stencil.dsa;
+   memset(dsa, 0, sizeof(*dsa));
+   if (rule == VG_EVEN_ODD) {
+      dsa->stencil[0].enabled = 1;
+      dsa->stencil[0].writemask = 1;
+      dsa->stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
+      dsa->stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
+      dsa->stencil[0].zpass_op = PIPE_STENCIL_OP_INVERT;
+      dsa->stencil[0].func = PIPE_FUNC_ALWAYS;
+      dsa->stencil[0].valuemask = ~0;
    }
+   else {
+      assert(rule == VG_NON_ZERO);
+
+      /* front face */
+      dsa->stencil[0].enabled = 1;
+      dsa->stencil[0].writemask = ~0;
+      dsa->stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
+      dsa->stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
+      dsa->stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
+      dsa->stencil[0].func = PIPE_FUNC_ALWAYS;
+      dsa->stencil[0].valuemask = ~0;
+
+      if (renderer->pipe->screen->get_param(renderer->pipe->screen,
+                                            PIPE_CAP_TWO_SIDED_STENCIL)) {
+         /* back face */
+         dsa->stencil[1] = dsa->stencil[0];
+         dsa->stencil[1].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
+      }
+      else {
+         manual_two_sides = VG_TRUE;
+      }
+   }
+   cso_set_depth_stencil_alpha(renderer->cso, dsa);
+
+   if (manual_two_sides)
+      cso_save_rasterizer(renderer->cso);
 
-   /* sampler */
-   {
-      struct pipe_sampler_state sampler;
-      memset(&sampler, 0, sizeof(sampler));
-      sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
-      sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
-      sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
-      sampler.normalized_coords = 1;
-      cso_single_sampler(ctx->cso, 0, &sampler);
-      cso_single_sampler_done(ctx->cso);
+   renderer->u.polygon_stencil.manual_two_sides = manual_two_sides;
+   renderer->u.polygon_stencil.restore_dsa = restore_dsa;
+   renderer->state = RENDERER_STATE_POLYGON_STENCIL;
+
+   return VG_TRUE;
+}
+
+/**
+ * Render a polygon silhouette to stencil buffer.
+ */
+void renderer_polygon_stencil(struct renderer *renderer,
+                              struct pipe_vertex_buffer *vbuf,
+                              VGuint mode, VGuint start, VGuint count)
+{
+   assert(renderer->state == RENDERER_STATE_POLYGON_STENCIL);
+
+   renderer->pipe->set_vertex_buffers(renderer->pipe, 1, vbuf);
+
+   if (!renderer->u.polygon_stencil.manual_two_sides) {
+      util_draw_arrays(renderer->pipe, mode, start, count);
    }
+   else {
+      struct pipe_rasterizer_state raster;
+      struct pipe_depth_stencil_alpha_state dsa;
 
-   vg_set_viewport(ctx->owner, VEGA_Y0_TOP);
+      raster = renderer->g3d.rasterizer;
+      dsa = renderer->u.polygon_stencil.dsa;
 
-   /* texture */
-   cso_set_fragment_sampler_views(ctx->cso, 1, &src);
+      /* front */
+      raster.cull_face = PIPE_FACE_BACK;
+      dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
 
-   /* shaders */
-   cso_set_vertex_shader_handle(ctx->cso, vg_texture_vs(ctx->owner));
-   cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
+      cso_set_rasterizer(renderer->cso, &raster);
+      cso_set_depth_stencil_alpha(renderer->cso, &dsa);
+      util_draw_arrays(renderer->pipe, mode, start, count);
 
-   /* drawing dest */
-   memset(&fb, 0, sizeof(fb));
-   fb.width = dst_surf->width;
-   fb.height = dst_surf->height;
-   fb.nr_cbufs = 1;
-   fb.cbufs[0] = dst_surf;
-   {
-      VGint i;
-      for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i)
-         fb.cbufs[i] = 0;
+      /* back */
+      raster.cull_face = PIPE_FACE_FRONT;
+      dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
+
+      cso_set_rasterizer(renderer->cso, &raster);
+      cso_set_depth_stencil_alpha(renderer->cso, &dsa);
+      util_draw_arrays(renderer->pipe, mode, start, count);
    }
-   cso_set_framebuffer(ctx->cso, &fb);
+}
+
+/**
+ * End polygon silhouette rendering.
+ */
+void renderer_polygon_stencil_end(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_POLYGON_STENCIL);
 
-   /* draw quad */
-   buf = setup_vertex_data_tex(ctx,
-                         dx1, dy1,
-                         dx2, dy2,
-                         s0, t0, s1, t1,
-                         0.0f);
+   if (renderer->u.polygon_stencil.manual_two_sides)
+      cso_restore_rasterizer(renderer->cso);
 
-   if (buf) {
-      cso_set_vertex_elements(ctx->cso, 2, ctx->owner->velems);
-      util_draw_vertex_buffer(ctx->pipe, buf, 0,
-                              PIPE_PRIM_TRIANGLE_FAN,
-                              4,  /* verts */
-                              2); /* attribs/vert */
+   cso_restore_vertex_elements(renderer->cso);
+
+   /* restore color writes */
+   cso_restore_blend(renderer->cso);
+
+   if (renderer->u.polygon_stencil.restore_dsa)
+      cso_restore_depth_stencil_alpha(renderer->cso);
+
+   renderer->state = RENDERER_STATE_INIT;
+}
+
+/**
+ * Prepare the renderer for polygon filling.
+ */
+VGboolean renderer_polygon_fill_begin(struct renderer *renderer,
+                                      VGboolean save_dsa)
+{
+   struct pipe_depth_stencil_alpha_state dsa;
+
+   assert(renderer->state == RENDERER_STATE_INIT);
+
+   if (save_dsa)
+      cso_save_depth_stencil_alpha(renderer->cso);
+
+   /* setup stencil ops */
+   memset(&dsa, 0, sizeof(dsa));
+   dsa.stencil[0].enabled = 1;
+   dsa.stencil[0].func = PIPE_FUNC_NOTEQUAL;
+   dsa.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
+   dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
+   dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
+   dsa.stencil[0].valuemask = ~0;
+   dsa.stencil[0].writemask = ~0;
+   dsa.depth = renderer->g3d.dsa.depth;
+   cso_set_depth_stencil_alpha(renderer->cso, &dsa);
+
+   renderer->state = RENDERER_STATE_POLYGON_FILL;
+
+   return VG_TRUE;
+}
+
+/**
+ * Fill a polygon.
+ */
+void renderer_polygon_fill(struct renderer *renderer,
+                           VGfloat min_x, VGfloat min_y,
+                           VGfloat max_x, VGfloat max_y)
+{
+   assert(renderer->state == RENDERER_STATE_POLYGON_FILL);
+
+   renderer_quad_pos(renderer, min_x, min_y, max_x, max_y, VG_TRUE);
+   renderer_quad_draw(renderer);
+}
+
+/**
+ * End polygon filling.
+ */
+void renderer_polygon_fill_end(struct renderer *renderer)
+{
+   assert(renderer->state == RENDERER_STATE_POLYGON_FILL);
+
+   cso_restore_depth_stencil_alpha(renderer->cso);
 
-      pipe_resource_reference( &buf,
-                             NULL );
+   renderer->state = RENDERER_STATE_INIT;
+}
+
+struct renderer * renderer_create(struct vg_context *owner)
+{
+   struct renderer *renderer;
+   struct pipe_rasterizer_state *raster;
+   struct pipe_stencil_ref sr;
+   VGint i;
+
+   renderer = CALLOC_STRUCT(renderer);
+   if (!renderer)
+      return NULL;
+
+   renderer->pipe = owner->pipe;
+   renderer->cso = owner->cso_context;
+
+   /* init vertex data that doesn't change */
+   for (i = 0; i < 4; i++)
+      renderer->vertices[i][0][3] = 1.0f; /* w */
+
+   for (i = 0; i < 2; i++) {
+      renderer->velems[i].src_offset = i * 4 * sizeof(float);
+      renderer->velems[i].instance_divisor = 0;
+      renderer->velems[i].vertex_buffer_index = 0;
+      renderer->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+   }
+   cso_set_vertex_elements(renderer->cso, 2, renderer->velems);
+
+   /* GL rasterization rules */
+   raster = &renderer->g3d.rasterizer;
+   memset(raster, 0, sizeof(*raster));
+   raster->gl_rasterization_rules = 1;
+   cso_set_rasterizer(renderer->cso, raster);
+
+   /* fixed at 0 */
+   memset(&sr, 0, sizeof(sr));
+   cso_set_stencil_ref(renderer->cso, &sr);
+
+   renderer_set_vs(renderer, RENDERER_VS_PLAIN);
+
+   renderer->state = RENDERER_STATE_INIT;
+
+   return renderer;
+}
+
+void renderer_destroy(struct renderer *ctx)
+{
+   int i;
+
+   for (i = 0; i < NUM_RENDERER_VS; i++) {
+      if (ctx->cached_vs[i])
+         cso_delete_vertex_shader(ctx->cso, ctx->cached_vs[i]);
+   }
+   for (i = 0; i < NUM_RENDERER_FS; i++) {
+      if (ctx->cached_fs[i])
+         cso_delete_fragment_shader(ctx->cso, ctx->cached_fs[i]);
+   }
+
+   pipe_resource_reference(&ctx->vs_cbuf, NULL);
+   pipe_resource_reference(&ctx->fs_cbuf, NULL);
+
+   FREE(ctx);
+}
+
+static void update_clip_state(struct renderer *renderer,
+                              const struct vg_state *state)
+{
+   struct pipe_depth_stencil_alpha_state *dsa = &renderer->g3d.dsa;
+
+   memset(dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state));
+
+   if (state->scissoring) {
+      struct pipe_framebuffer_state *fb = &renderer->g3d.fb;
+      int i;
+
+      renderer_scissor_begin(renderer, VG_FALSE);
+
+      for (i = 0; i < state->scissor_rects_num; ++i) {
+         const float x      = state->scissor_rects[i * 4 + 0].f;
+         const float y      = state->scissor_rects[i * 4 + 1].f;
+         const float width  = state->scissor_rects[i * 4 + 2].f;
+         const float height = state->scissor_rects[i * 4 + 3].f;
+         VGint x0, y0, x1, y1, iw, ih;
+
+         x0 = (VGint) x;
+         y0 = (VGint) y;
+         if (x0 < 0)
+            x0 = 0;
+         if (y0 < 0)
+            y0 = 0;
+
+         /* note that x1 and y1 are exclusive */
+         x1 = (VGint) ceilf(x + width);
+         y1 = (VGint) ceilf(y + height);
+         if (x1 > fb->width)
+            x1 = fb->width;
+         if (y1 > fb->height)
+            y1 = fb->height;
+
+         iw = x1 - x0;
+         ih = y1 - y0;
+         if (iw > 0 && ih> 0 )
+            renderer_scissor(renderer, x0, y0, iw, ih);
+      }
+
+      renderer_scissor_end(renderer);
+
+      dsa->depth.enabled = 1; /* glEnable(GL_DEPTH_TEST); */
+      dsa->depth.writemask = 0;/*glDepthMask(FALSE);*/
+      dsa->depth.func = PIPE_FUNC_GEQUAL;
    }
+}
+
+static void renderer_validate_blend(struct renderer *renderer,
+                                     const struct vg_state *state,
+                                     enum pipe_format fb_format)
+{
+   struct pipe_blend_state blend;
+
+   memset(&blend, 0, sizeof(blend));
+   blend.rt[0].colormask = PIPE_MASK_RGBA;
+   blend.rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ONE;
+   blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+   blend.rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ZERO;
+   blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
 
-   /* restore state we changed */
-   cso_restore_blend(ctx->cso);
-   cso_restore_samplers(ctx->cso);
-   cso_restore_fragment_sampler_views(ctx->cso);
-   cso_restore_framebuffer(ctx->cso);
-   cso_restore_vertex_shader(ctx->cso);
-   cso_restore_fragment_shader(ctx->cso);
-   cso_restore_viewport(ctx->cso);
+   /* TODO alpha masking happens after blending? */
+
+   switch (state->blend_mode) {
+   case VG_BLEND_SRC:
+      blend.rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ONE;
+      blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+      blend.rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ZERO;
+      blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
+      break;
+   case VG_BLEND_SRC_OVER:
+      if (!util_format_has_alpha(fb_format)) {
+         blend.rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_SRC_ALPHA;
+         blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+         blend.rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
+         blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
+         blend.rt[0].blend_enable = 1;
+      }
+      break;
+   case VG_BLEND_SRC_IN:
+      blend.rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ONE;
+      blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_DST_ALPHA;
+      blend.rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ZERO;
+      blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
+      blend.rt[0].blend_enable = 1;
+      break;
+   case VG_BLEND_DST_IN:
+      blend.rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ZERO;
+      blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ZERO;
+      blend.rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ONE;
+      blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
+      blend.rt[0].blend_enable = 1;
+      break;
+   case VG_BLEND_DST_OVER:
+   case VG_BLEND_MULTIPLY:
+   case VG_BLEND_SCREEN:
+   case VG_BLEND_DARKEN:
+   case VG_BLEND_LIGHTEN:
+   case VG_BLEND_ADDITIVE:
+      /* need a shader */
+      break;
+   default:
+      assert(!"not implemented blend mode");
+      break;
+   }
 
-   pipe_surface_reference(&dst_surf, NULL);
+   cso_set_blend(renderer->cso, &blend);
+}
+
+/**
+ * Propogate OpenVG state changes to the renderer.  Only framebuffer, blending
+ * and scissoring states are relevant here.
+ */
+void renderer_validate(struct renderer *renderer,
+                       VGbitfield dirty,
+                       const struct st_framebuffer *stfb,
+                       const struct vg_state *state)
+{
+   assert(renderer->state == RENDERER_STATE_INIT);
+
+   dirty |= renderer->dirty;
+   renderer->dirty = 0;
+
+   if (dirty & FRAMEBUFFER_DIRTY) {
+      struct pipe_framebuffer_state *fb = &renderer->g3d.fb;
+      struct matrix *proj = &renderer->projection;
+
+      memset(fb, 0, sizeof(struct pipe_framebuffer_state));
+      fb->width  = stfb->width;
+      fb->height = stfb->height;
+      fb->nr_cbufs = 1;
+      fb->cbufs[0] = stfb->strb->surface;
+      fb->zsbuf = stfb->dsrb->surface;
+
+      cso_set_framebuffer(renderer->cso, fb);
+      vg_set_viewport(renderer, VEGA_Y0_BOTTOM);
+
+      matrix_load_identity(proj);
+      matrix_translate(proj, -1.0f, -1.0f);
+      matrix_scale(proj, 2.0f / fb->width, 2.0f / fb->height);
+
+      /* we also got a new depth buffer */
+      if (dirty & DEPTH_STENCIL_DIRTY) {
+         renderer->pipe->clear(renderer->pipe,
+               PIPE_CLEAR_DEPTHSTENCIL, NULL, 0.0, 0);
+      }
+   }
+
+   /* must be last because it renders to the depth buffer*/
+   if (dirty & DEPTH_STENCIL_DIRTY) {
+      update_clip_state(renderer, state);
+      cso_set_depth_stencil_alpha(renderer->cso, &renderer->g3d.dsa);
+   }
+
+   if (dirty & BLEND_DIRTY)
+      renderer_validate_blend(renderer, state, stfb->strb->format);
+}
+
+/**
+ * Prepare the renderer for OpenVG pipeline.
+ */
+void renderer_validate_for_shader(struct renderer *renderer,
+                                  const struct pipe_sampler_state **samplers,
+                                  struct pipe_sampler_view **views,
+                                  VGint num_samplers,
+                                  const struct matrix *modelview,
+                                  void *fs,
+                                  const void *const_buffer,
+                                  VGint const_buffer_len)
+{
+   struct matrix mvp = renderer->projection;
+
+   /* will be used in POLYGON_STENCIL and POLYGON_FILL */
+   matrix_mult(&mvp, modelview);
+   renderer_set_mvp(renderer, &mvp);
+
+   renderer_set_custom_fs(renderer, fs,
+                          samplers, views, num_samplers,
+                          const_buffer, const_buffer_len);
+}
+
+void renderer_validate_for_mask_rendering(struct renderer *renderer,
+                                          struct pipe_surface *dst,
+                                          const struct matrix *modelview)
+{
+   struct matrix mvp = renderer->projection;
+
+   /* will be used in POLYGON_STENCIL and POLYGON_FILL */
+   matrix_mult(&mvp, modelview);
+   renderer_set_mvp(renderer, &mvp);
+
+   renderer_set_target(renderer, dst, renderer->g3d.fb.zsbuf, VG_FALSE);
+   renderer_set_blend(renderer, ~0);
+   renderer_set_fs(renderer, RENDERER_FS_WHITE);
+
+   /* set internal dirty flags (hacky!) */
+   renderer->dirty = FRAMEBUFFER_DIRTY | BLEND_DIRTY;
 }
 
 void renderer_copy_surface(struct renderer *ctx,
@@ -409,13 +1428,11 @@ void renderer_copy_surface(struct renderer *ctx,
 {
    struct pipe_context *pipe = ctx->pipe;
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_resource *buf;
    struct pipe_sampler_view view_templ;
    struct pipe_sampler_view *view;
+   struct pipe_box src_box;
    struct pipe_resource texTemp, *tex;
-   struct pipe_subresource subsrc, subdst;
-   struct pipe_framebuffer_state fb;
-   struct st_framebuffer *stfb = ctx->owner->draw_buffer;
+   const struct pipe_framebuffer_state *fb = &ctx->g3d.fb;
    const int srcW = abs(srcX1 - srcX0);
    const int srcH = abs(srcY1 - srcY0);
    const int srcLeft = MIN2(srcX0, srcX1);
@@ -458,6 +1475,7 @@ void renderer_copy_surface(struct renderer *ctx,
    texTemp.width0 = srcW;
    texTemp.height0 = srcH;
    texTemp.depth0 = 1;
+   texTemp.array_size = 1;
    texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &texTemp);
@@ -470,100 +1488,35 @@ void renderer_copy_surface(struct renderer *ctx,
    if (!view)
       return;
 
-   subdst.face = 0;
-   subdst.level = 0;
-   subsrc.face = src->face;
-   subsrc.level = src->level;
+   u_box_2d_zslice(srcLeft, srcTop, src->u.tex.first_layer, srcW, srcH, &src_box);
 
    pipe->resource_copy_region(pipe,
-                              tex, subdst, 0, 0, 0,  /* dest */
-                              src->texture, subsrc, srcLeft, srcTop, src->zslice, /* src */
-                              srcW, srcH);     /* size */
-
-   /* save state (restored below) */
-   cso_save_blend(ctx->cso);
-   cso_save_samplers(ctx->cso);
-   cso_save_fragment_sampler_views(ctx->cso);
-   cso_save_framebuffer(ctx->cso);
-   cso_save_fragment_shader(ctx->cso);
-   cso_save_vertex_shader(ctx->cso);
-   cso_save_viewport(ctx->cso);
-
-   /* set misc state we care about */
-   {
-      struct pipe_blend_state blend;
-      memset(&blend, 0, sizeof(blend));
-      blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.rt[0].colormask = PIPE_MASK_RGBA;
-      cso_set_blend(ctx->cso, &blend);
+                              tex, 0, 0, 0, 0,  /* dest */
+                              src->texture, 0, &src_box);
+
+   assert(floatsEqual(z, 0.0f));
+
+   /* draw */
+   if (fb->cbufs[0] == dst) {
+      /* transform back to surface coordinates */
+      dstY0 = dst->height - dstY0;
+      dstY1 = dst->height - dstY1;
+
+      if (renderer_drawtex_begin(ctx, view)) {
+         renderer_drawtex(ctx,
+               dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0,
+               0, 0, view->texture->width0, view->texture->height0);
+         renderer_drawtex_end(ctx);
+      }
    }
-
-   vg_set_viewport(ctx->owner, VEGA_Y0_TOP);
-
-   /* sampler */
-   {
-      struct pipe_sampler_state sampler;
-      memset(&sampler, 0, sizeof(sampler));
-      sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-      sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
-      sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
-      sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
-      sampler.normalized_coords = 1;
-      cso_single_sampler(ctx->cso, 0, &sampler);
-      cso_single_sampler_done(ctx->cso);
-   }
-
-   /* texture */
-   cso_set_fragment_sampler_views(ctx->cso, 1, &view);
-
-   /* shaders */
-   cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
-   cso_set_vertex_shader_handle(ctx->cso, vg_texture_vs(ctx->owner));
-
-   /* drawing dest */
-   if (stfb->strb->surface != dst) {
-      memset(&fb, 0, sizeof(fb));
-      fb.width = dst->width;
-      fb.height = dst->height;
-      fb.nr_cbufs = 1;
-      fb.cbufs[0] = dst;
-      fb.zsbuf = stfb->dsrb->surface;
-      cso_set_framebuffer(ctx->cso, &fb);
+   else {
+      if (renderer_copy_begin(ctx, dst, VG_TRUE, view)) {
+         renderer_copy(ctx,
+               dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0,
+               0, 0, view->texture->width0, view->texture->height0);
+         renderer_copy_end(ctx);
+      }
    }
-
-   /* draw quad */
-   buf = setup_vertex_data(ctx,
-                           (float) dstX0, (float) dstY0,
-                           (float) dstX1, (float) dstY1, z);
-
-   if (buf) {
-      cso_set_vertex_elements(ctx->cso, 2, ctx->owner->velems);
-      util_draw_vertex_buffer(ctx->pipe, buf, 0,
-                              PIPE_PRIM_TRIANGLE_FAN,
-                              4,  /* verts */
-                              2); /* attribs/vert */
-
-      pipe_resource_reference( &buf,
-                             NULL );
-   }
-
-
-   /* restore state we changed */
-   cso_restore_blend(ctx->cso);
-   cso_restore_samplers(ctx->cso);
-   cso_restore_fragment_sampler_views(ctx->cso);
-   cso_restore_framebuffer(ctx->cso);
-   cso_restore_fragment_shader(ctx->cso);
-   cso_restore_vertex_shader(ctx->cso);
-   cso_restore_viewport(ctx->cso);
-
-   pipe_resource_reference(&tex, NULL);
-   pipe_sampler_view_reference(&view, NULL);
 }
 
 void renderer_texture_quad(struct renderer *r,
@@ -575,36 +1528,38 @@ void renderer_texture_quad(struct renderer *r,
                            VGfloat x3, VGfloat y3,
                            VGfloat x4, VGfloat y4)
 {
-   struct pipe_context *pipe = r->pipe;
-   struct pipe_resource *buf;
-   VGfloat s0, t0, s1, t1;
+   const VGfloat z = 0.0f;
 
+   assert(r->state == RENDERER_STATE_INIT);
    assert(tex->width0 != 0);
    assert(tex->height0 != 0);
 
-   s0 = x1offset / tex->width0;
-   s1 = x2offset / tex->width0;
-   t0 = y1offset / tex->height0;
-   t1 = y2offset / tex->height0;
-
    cso_save_vertex_shader(r->cso);
-   /* shaders */
-   cso_set_vertex_shader_handle(r->cso, vg_texture_vs(r->owner));
 
-   /* draw quad */
-   buf = setup_vertex_data_qtex(r, x1, y1, x2, y2, x3, y3, x4, y4,
-                          s0, t0, s1, t1, 0.0f);
+   renderer_set_vs(r, RENDERER_VS_TEXTURE);
 
-   if (buf) {
-      cso_set_vertex_elements(r->cso, 2, r->owner->velems);
-      util_draw_vertex_buffer(pipe, buf, 0,
-                              PIPE_PRIM_TRIANGLE_FAN,
-                              4,  /* verts */
-                              2); /* attribs/vert */
+   /* manually set up positions */
+   r->vertices[0][0][0] = x1;
+   r->vertices[0][0][1] = y1;
+   r->vertices[0][0][2] = z;
 
-      pipe_resource_reference(&buf,
-                            NULL);
-   }
+   r->vertices[1][0][0] = x2;
+   r->vertices[1][0][1] = y2;
+   r->vertices[1][0][2] = z;
+
+   r->vertices[2][0][0] = x3;
+   r->vertices[2][0][1] = y3;
+   r->vertices[2][0][2] = z;
+
+   r->vertices[3][0][0] = x4;
+   r->vertices[3][0][1] = y4;
+   r->vertices[3][0][2] = z;
+
+   /* texcoords */
+   renderer_quad_texcoord(r, x1offset, y1offset,
+         x2offset, y2offset, tex->width0, tex->height0);
+
+   renderer_quad_draw(r);
 
    cso_restore_vertex_shader(r->cso);
 }
index b1a9fb58be6564f39842c90f6de9cb18540883ac..fe7199365804f9a3e04477f6f9dee3064f46a34c 100644 (file)
@@ -1,6 +1,7 @@
 /**************************************************************************
  *
  * Copyright 2009 VMware, Inc.  All Rights Reserved.
+ * Copyright 2010 LunarG, 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
 struct renderer;
 
 struct vg_context;
+struct vg_state;
+struct st_framebuffer;
 struct pipe_resource;
+struct pipe_sampler_state;
 struct pipe_sampler_view;
 struct pipe_surface;
+struct pipe_vertex_element;
+struct pipe_vertex_buffer;
+struct matrix;
 
 struct renderer *renderer_create(struct vg_context *owner);
 void renderer_destroy(struct renderer *);
 
-void renderer_draw_quad(struct renderer *,
-                        VGfloat x1, VGfloat y1,
-                        VGfloat x2, VGfloat y2,
-                        VGfloat depth);
-void renderer_draw_texture(struct renderer *,
-                           struct pipe_resource *texture,
-                           VGfloat x1offset, VGfloat y1offset,
-                           VGfloat x2offset, VGfloat y2offset,
-                           VGfloat x1, VGfloat y1,
-                           VGfloat x2, VGfloat y2);
+void renderer_validate(struct renderer *renderer,
+                       VGbitfield dirty,
+                       const struct st_framebuffer *stfb,
+                       const struct vg_state *state);
+
+void renderer_validate_for_shader(struct renderer *renderer,
+                                  const struct pipe_sampler_state **samplers,
+                                  struct pipe_sampler_view **views,
+                                  VGint num_samplers,
+                                  const struct matrix *modelview,
+                                  void *fs,
+                                  const void *const_buffer,
+                                  VGint const_buffer_len);
+
+void renderer_validate_for_mask_rendering(struct renderer *renderer,
+                                          struct pipe_surface *dst,
+                                          const struct matrix *modelview);
+
+VGboolean renderer_copy_begin(struct renderer *renderer,
+                              struct pipe_surface *dst,
+                              VGboolean y0_top,
+                              struct pipe_sampler_view *src);
+
+void renderer_copy(struct renderer *renderer,
+                   VGint x, VGint y, VGint w, VGint h,
+                   VGint sx, VGint sy, VGint sw, VGint sh);
+
+void renderer_copy_end(struct renderer *renderer);
+
+VGboolean renderer_drawtex_begin(struct renderer *renderer,
+                                 struct pipe_sampler_view *src);
+
+void renderer_drawtex(struct renderer *renderer,
+                      VGint x, VGint y, VGint w, VGint h,
+                      VGint sx, VGint sy, VGint sw, VGint sh);
+
+void renderer_drawtex_end(struct renderer *renderer);
+
+VGboolean renderer_scissor_begin(struct renderer *renderer,
+                                 VGboolean restore_dsa);
+
+void renderer_scissor(struct renderer *renderer,
+                      VGint x, VGint y, VGint width, VGint height);
+
+void renderer_scissor_end(struct renderer *renderer);
+
+VGboolean renderer_clear_begin(struct renderer *renderer);
+
+void renderer_clear(struct renderer *renderer,
+                    VGint x, VGint y, VGint width, VGint height,
+                    const VGfloat color[4]);
+
+void renderer_clear_end(struct renderer *renderer);
+
+VGboolean renderer_filter_begin(struct renderer *renderer,
+                                struct pipe_resource *dst,
+                                VGboolean y0_top,
+                                VGbitfield channel_mask,
+                                const struct pipe_sampler_state **samplers,
+                                struct pipe_sampler_view **views,
+                                VGint num_samplers,
+                                void *fs,
+                                const void *const_buffer,
+                                VGint const_buffer_len);
+
+void renderer_filter(struct renderer *renderer,
+                     VGint x, VGint y, VGint w, VGint h,
+                     VGint sx, VGint sy, VGint sw, VGint sh);
+
+void renderer_filter_end(struct renderer *renderer);
+
+VGboolean renderer_polygon_stencil_begin(struct renderer *renderer,
+                                         struct pipe_vertex_element *velem,
+                                         VGFillRule rule,
+                                         VGboolean restore_dsa);
+
+void renderer_polygon_stencil(struct renderer *renderer,
+                              struct pipe_vertex_buffer *vbuf,
+                              VGuint mode, VGuint start, VGuint count);
+
+void renderer_polygon_stencil_end(struct renderer *renderer);
+
+VGboolean renderer_polygon_fill_begin(struct renderer *renderer,
+                                      VGboolean save_dsa);
+
+void renderer_polygon_fill(struct renderer *renderer,
+                           VGfloat min_x, VGfloat min_y,
+                           VGfloat max_x, VGfloat max_y);
+
+void renderer_polygon_fill_end(struct renderer *renderer);
+
 void renderer_texture_quad(struct renderer *,
                            struct pipe_resource *texture,
                            VGfloat x1offset, VGfloat y1offset,
@@ -57,13 +145,7 @@ void renderer_texture_quad(struct renderer *,
                            VGfloat x2, VGfloat y2,
                            VGfloat x3, VGfloat y3,
                            VGfloat x4, VGfloat y4);
-void renderer_copy_texture(struct renderer *r,
-                           struct pipe_sampler_view *src,
-                           VGfloat sx1, VGfloat sy1,
-                           VGfloat sx2, VGfloat sy2,
-                           struct pipe_resource *dst,
-                           VGfloat dx1, VGfloat dy1,
-                           VGfloat dx2, VGfloat dy2);
+
 void renderer_copy_surface(struct renderer *r,
                            struct pipe_surface *src,
                            int sx1, int sy1,
index eab1349639c2881f41c651864ffd5b81c2b0736e..2a6bae8a6305071579864645e398bf41a0640b8d 100644 (file)
 #include "paint.h"
 #include "mask.h"
 #include "image.h"
+#include "renderer.h"
 
 #include "pipe/p_context.h"
-#include "pipe/p_screen.h"
 #include "pipe/p_state.h"
-#include "util/u_inlines.h"
 #include "util/u_memory.h"
+#include "util/u_math.h"
+#include "util/u_format.h"
 
-#define MAX_CONSTANTS 20
+#define MAX_CONSTANTS 28
 
 struct shader {
    struct vg_context *context;
 
+   VGboolean color_transform;
    VGboolean masking;
    struct vg_paint *paint;
    struct vg_image *image;
 
+   struct matrix modelview;
+   struct matrix paint_matrix;
+
    VGboolean drawing_image;
    VGImageMode image_mode;
 
@@ -71,6 +76,11 @@ void shader_destroy(struct shader *shader)
    FREE(shader);
 }
 
+void shader_set_color_transform(struct shader *shader, VGboolean set)
+{
+   shader->color_transform = set;
+}
+
 void shader_set_masking(struct shader *shader, VGboolean set)
 {
    shader->masking = set;
@@ -91,49 +101,64 @@ struct vg_paint * shader_paint(struct shader *shader)
    return shader->paint;
 }
 
-
-static void setup_constant_buffer(struct shader *shader)
+static VGint setup_constant_buffer(struct shader *shader)
 {
-   struct vg_context *ctx = shader->context;
-   struct pipe_context *pipe = shader->context->pipe;
-   struct pipe_resource **cbuf = &shader->cbuf;
+   const struct vg_state *state = &shader->context->state.vg;
    VGint param_bytes = paint_constant_buffer_size(shader->paint);
-   float temp_buf[MAX_CONSTANTS];
+   VGint i;
+
+   param_bytes += sizeof(VGfloat) * 8;
+   assert(param_bytes <= sizeof(shader->constants));
+
+   if (state->color_transform) {
+      for (i = 0; i < 8; i++) {
+         VGfloat val = (i < 4) ? 127.0f : 1.0f;
+         shader->constants[i] =
+            CLAMP(state->color_transform_values[i], -val, val);
+      }
+   }
+   else {
+      memset(shader->constants, 0, sizeof(VGfloat) * 8);
+   }
 
-   assert(param_bytes <= sizeof(temp_buf));
-   paint_fill_constant_buffer(shader->paint, temp_buf);
+   paint_fill_constant_buffer(shader->paint,
+         &shader->paint_matrix, shader->constants + 8);
 
-   if (*cbuf == NULL ||
-       memcmp(temp_buf, shader->constants, param_bytes) != 0)
-   {
-      pipe_resource_reference(cbuf, NULL);
+   return param_bytes;
+}
+
+static VGboolean blend_use_shader(struct vg_context *ctx)
+{
+   VGboolean advanced_blending;
 
-      memcpy(shader->constants, temp_buf, param_bytes);
-      *cbuf = pipe_user_buffer_create(pipe->screen,
-                                      &shader->constants,
-                                      sizeof(shader->constants),
-                                     PIPE_BIND_VERTEX_BUFFER);
+   switch (ctx->state.vg.blend_mode) {
+   case VG_BLEND_SRC_OVER:
+      advanced_blending =
+         util_format_has_alpha(ctx->draw_buffer->strb->format);
+      break;
+   case VG_BLEND_DST_OVER:
+   case VG_BLEND_MULTIPLY:
+   case VG_BLEND_SCREEN:
+   case VG_BLEND_DARKEN:
+   case VG_BLEND_LIGHTEN:
+   case VG_BLEND_ADDITIVE:
+      advanced_blending = VG_TRUE;
+      break;
+   default:
+      advanced_blending = VG_FALSE;
+      break;
    }
 
-   ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, *cbuf);
+   return advanced_blending;
 }
 
 static VGint blend_bind_samplers(struct vg_context *ctx,
                                  struct pipe_sampler_state **samplers,
                                  struct pipe_sampler_view **sampler_views)
 {
-   VGBlendMode bmode = ctx->state.vg.blend_mode;
-
-   if (bmode == VG_BLEND_MULTIPLY ||
-       bmode == VG_BLEND_SCREEN ||
-       bmode == VG_BLEND_DARKEN ||
-       bmode == VG_BLEND_LIGHTEN) {
-      struct st_framebuffer *stfb = ctx->draw_buffer;
-
-      vg_prepare_blend_surface(ctx);
-
+   if (blend_use_shader(ctx)) {
       samplers[2] = &ctx->blend_sampler;
-      sampler_views[2] = stfb->blend_texture_view;
+      sampler_views[2] = vg_prepare_blend_surface(ctx);
 
       if (!samplers[0] || !sampler_views[0]) {
          samplers[0] = samplers[2];
@@ -149,10 +174,10 @@ static VGint blend_bind_samplers(struct vg_context *ctx,
    return 0;
 }
 
-static void setup_samplers(struct shader *shader)
+static VGint setup_samplers(struct shader *shader,
+                            struct pipe_sampler_state **samplers,
+                            struct pipe_sampler_view **sampler_views)
 {
-   struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
-   struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
    struct vg_context *ctx = shader->context;
    /* a little wonky: we use the num as a boolean that just says
     * whether any sampler/textures have been set. the actual numbering
@@ -179,10 +204,7 @@ static void setup_samplers(struct shader *shader)
    if (shader->drawing_image && shader->image)
       num += image_bind_samplers(shader->image, samplers, sampler_views);
 
-   if (num) {
-      cso_set_samplers(ctx->cso_context, 4, (const struct pipe_sampler_state **)samplers);
-      cso_set_fragment_sampler_views(ctx->cso_context, 4, sampler_views);
-   }
+   return (num) ? 4 : 0;
 }
 
 static INLINE VGboolean is_format_bw(struct shader *shader)
@@ -227,6 +249,9 @@ static void setup_shader_program(struct shader *shader)
       default:
          abort();
       }
+
+      if (paint_is_degenerate(shader->paint))
+         shader_id = VEGA_PAINT_DEGENERATE_SHADER;
    }
 
    /* second stage image */
@@ -246,43 +271,86 @@ static void setup_shader_program(struct shader *shader)
       }
    }
 
-   if (shader->masking)
-      shader_id |= VEGA_MASK_SHADER;
+   if (shader->color_transform)
+      shader_id |= VEGA_COLOR_TRANSFORM_SHADER;
 
-   switch(blend_mode) {
-   case VG_BLEND_MULTIPLY:
-      shader_id |= VEGA_BLEND_MULTIPLY_SHADER;
-      break;
-   case VG_BLEND_SCREEN:
-      shader_id |= VEGA_BLEND_SCREEN_SHADER;
-      break;
-   case VG_BLEND_DARKEN:
-      shader_id |= VEGA_BLEND_DARKEN_SHADER;
-      break;
-   case VG_BLEND_LIGHTEN:
-      shader_id |= VEGA_BLEND_LIGHTEN_SHADER;
-      break;
-   default:
-      /* handled by pipe_blend_state */
-      break;
+   if (blend_use_shader(ctx)) {
+      if (shader->drawing_image && shader->image_mode == VG_DRAW_IMAGE_STENCIL)
+         shader_id |= VEGA_ALPHA_PER_CHANNEL_SHADER;
+      else
+         shader_id |= VEGA_ALPHA_NORMAL_SHADER;
+
+      switch(blend_mode) {
+      case VG_BLEND_SRC:
+         shader_id |= VEGA_BLEND_SRC_SHADER;
+         break;
+      case VG_BLEND_SRC_OVER:
+         shader_id |= VEGA_BLEND_SRC_OVER_SHADER;
+         break;
+      case VG_BLEND_DST_OVER:
+         shader_id |= VEGA_BLEND_DST_OVER_SHADER;
+         break;
+      case VG_BLEND_SRC_IN:
+         shader_id |= VEGA_BLEND_SRC_IN_SHADER;
+         break;
+      case VG_BLEND_DST_IN:
+         shader_id |= VEGA_BLEND_DST_IN_SHADER;
+         break;
+      case VG_BLEND_MULTIPLY:
+         shader_id |= VEGA_BLEND_MULTIPLY_SHADER;
+         break;
+      case VG_BLEND_SCREEN:
+         shader_id |= VEGA_BLEND_SCREEN_SHADER;
+         break;
+      case VG_BLEND_DARKEN:
+         shader_id |= VEGA_BLEND_DARKEN_SHADER;
+         break;
+      case VG_BLEND_LIGHTEN:
+         shader_id |= VEGA_BLEND_LIGHTEN_SHADER;
+         break;
+      case VG_BLEND_ADDITIVE:
+         shader_id |= VEGA_BLEND_ADDITIVE_SHADER;
+         break;
+      default:
+         assert(0);
+         break;
+      }
+   }
+   else {
+      /* update alpha of the source */
+      if (shader->drawing_image && shader->image_mode == VG_DRAW_IMAGE_STENCIL)
+         shader_id |= VEGA_ALPHA_PER_CHANNEL_SHADER;
    }
 
+   if (shader->masking)
+      shader_id |= VEGA_MASK_SHADER;
+
    if (black_white)
       shader_id |= VEGA_BW_SHADER;
 
    shader->fs = shaders_cache_fill(ctx->sc, shader_id);
-   cso_set_fragment_shader_handle(ctx->cso_context, shader->fs);
 }
 
 
 void shader_bind(struct shader *shader)
 {
+   struct vg_context *ctx = shader->context;
+   struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
+   struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
+   VGint num_samplers, param_bytes;
+
    /* first resolve the real paint type */
    paint_resolve_type(shader->paint);
 
-   setup_constant_buffer(shader);
-   setup_samplers(shader);
+   num_samplers = setup_samplers(shader, samplers, sampler_views);
+   param_bytes = setup_constant_buffer(shader);
    setup_shader_program(shader);
+
+   renderer_validate_for_shader(ctx->renderer,
+         (const struct pipe_sampler_state **) samplers,
+         sampler_views, num_samplers,
+         &shader->modelview,
+         shader->fs, (const void *) shader->constants, param_bytes);
 }
 
 void shader_set_image_mode(struct shader *shader, VGImageMode image_mode)
@@ -309,3 +377,28 @@ void shader_set_image(struct shader *shader, struct vg_image *img)
 {
    shader->image = img;
 }
+
+/**
+ * Set the transformation to map a vertex to the surface coordinates.
+ */
+void shader_set_surface_matrix(struct shader *shader,
+                               const struct matrix *mat)
+{
+   shader->modelview = *mat;
+}
+
+/**
+ * Set the transformation to map a pixel to the paint coordinates.
+ */
+void shader_set_paint_matrix(struct shader *shader, const struct matrix *mat)
+{
+   const struct st_framebuffer *stfb = shader->context->draw_buffer;
+   const VGfloat px_center_offset = 0.5f;
+
+   memcpy(&shader->paint_matrix, mat, sizeof(*mat));
+
+   /* make it window-to-paint for the shaders */
+   matrix_translate(&shader->paint_matrix, px_center_offset,
+         stfb->height - 1.0f + px_center_offset);
+   matrix_scale(&shader->paint_matrix, 1.0f, -1.0f);
+}
index 847eee6a31039e401479d447ea0b80845341d49e..8b97e537efed09398e5a2b73a3c4647cb87ab32f 100644 (file)
@@ -33,10 +33,13 @@ struct shader;
 struct vg_paint;
 struct vg_context;
 struct vg_image;
+struct matrix;
 
 struct shader *shader_create(struct vg_context *context);
 void shader_destroy(struct shader *shader);
 
+void shader_set_color_transform(struct shader *shader, VGboolean set);
+
 void shader_set_masking(struct shader *shader, VGboolean set);
 VGboolean shader_is_masking(struct shader *shader);
 
@@ -51,6 +54,10 @@ VGboolean shader_drawing_image(struct shader *shader);
 
 void shader_set_image(struct shader *shader, struct vg_image *img);
 
+void shader_set_surface_matrix(struct shader *shader,
+                               const struct matrix *mat);
+void shader_set_paint_matrix(struct shader *shader, const struct matrix *mat);
+
 void shader_bind(struct shader *shader);
 
 #endif
index e002a7ed42899dbf5c8667d37b49168ca43e1467..023996ce2d8c848ea84dc265b6e5ec5826ec2776 100644 (file)
 
 /* Essentially we construct an ubber-shader based on the state
  * of the pipeline. The stages are:
- * 1) Fill (mandatory, solid color/gradient/pattern/image draw)
- * 2) Image composition (image mode multiply and stencil)
- * 3) Mask
- * 4) Extended blend (multiply/screen/darken/lighten)
- * 5) Premultiply/Unpremultiply
- * 6) Color transform (to black and white)
+ * 1) Paint generation (color/gradient/pattern)
+ * 2) Image composition (normal/multiply/stencil)
+ * 3) Color transform
+ * 4) Per-channel alpha generation
+ * 5) Extended blend (multiply/screen/darken/lighten)
+ * 6) Mask
+ * 7) Premultiply/Unpremultiply
+ * 8) Color transform (to black and white)
  */
-#define SHADER_STAGES 6
+#define SHADER_STAGES 8
 
 struct cached_shader {
    void *driver_shader;
@@ -86,13 +88,6 @@ static INLINE struct tgsi_token *tokens_from_assembly(const char *txt, int num_t
    return tokens;
 }
 
-#define ALL_FILLS (VEGA_SOLID_FILL_SHADER | \
-   VEGA_LINEAR_GRADIENT_SHADER | \
-   VEGA_RADIAL_GRADIENT_SHADER | \
-   VEGA_PATTERN_SHADER         | \
-   VEGA_IMAGE_NORMAL_SHADER)
-
-
 /*
 static const char max_shader_preamble[] =
    "FRAG\n"
@@ -257,98 +252,126 @@ create_shader(struct pipe_context *pipe,
               int id,
               struct pipe_shader_state *shader)
 {
-   int idx = 0;
+   int idx = 0, sh;
    const struct shader_asm_info * shaders[SHADER_STAGES];
 
-   /* the shader has to have a fill */
-   debug_assert(id & ALL_FILLS);
-
    /* first stage */
-   if (id & VEGA_SOLID_FILL_SHADER) {
-      debug_assert(idx == 0);
-      shaders[idx] = &shaders_asm[0];
-      debug_assert(shaders_asm[0].id == VEGA_SOLID_FILL_SHADER);
-      ++idx;
-   }
-   if ((id & VEGA_LINEAR_GRADIENT_SHADER)) {
-      debug_assert(idx == 0);
-      shaders[idx] = &shaders_asm[1];
-      debug_assert(shaders_asm[1].id == VEGA_LINEAR_GRADIENT_SHADER);
-      ++idx;
-   }
-   if ((id & VEGA_RADIAL_GRADIENT_SHADER)) {
-      debug_assert(idx == 0);
-      shaders[idx] = &shaders_asm[2];
-      debug_assert(shaders_asm[2].id == VEGA_RADIAL_GRADIENT_SHADER);
-      ++idx;
-   }
-   if ((id & VEGA_PATTERN_SHADER)) {
-      debug_assert(idx == 0);
-      debug_assert(shaders_asm[3].id == VEGA_PATTERN_SHADER);
-      shaders[idx] = &shaders_asm[3];
-      ++idx;
-   }
-   if ((id & VEGA_IMAGE_NORMAL_SHADER)) {
-      debug_assert(idx == 0);
-      debug_assert(shaders_asm[4].id == VEGA_IMAGE_NORMAL_SHADER);
-      shaders[idx] = &shaders_asm[4];
-      ++idx;
+   sh = SHADERS_GET_PAINT_SHADER(id);
+   switch (sh << SHADERS_PAINT_SHIFT) {
+   case VEGA_SOLID_FILL_SHADER:
+   case VEGA_LINEAR_GRADIENT_SHADER:
+   case VEGA_RADIAL_GRADIENT_SHADER:
+   case VEGA_PATTERN_SHADER:
+   case VEGA_PAINT_DEGENERATE_SHADER:
+      shaders[idx] = &shaders_paint_asm[(sh >> SHADERS_PAINT_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
    }
 
    /* second stage */
-   if ((id & VEGA_IMAGE_MULTIPLY_SHADER)) {
-      debug_assert(shaders_asm[5].id == VEGA_IMAGE_MULTIPLY_SHADER);
-      shaders[idx] = &shaders_asm[5];
-      ++idx;
-   } else if ((id & VEGA_IMAGE_STENCIL_SHADER)) {
-      debug_assert(shaders_asm[6].id == VEGA_IMAGE_STENCIL_SHADER);
-      shaders[idx] = &shaders_asm[6];
-      ++idx;
+   sh = SHADERS_GET_IMAGE_SHADER(id);
+   switch (sh) {
+   case VEGA_IMAGE_NORMAL_SHADER:
+   case VEGA_IMAGE_MULTIPLY_SHADER:
+   case VEGA_IMAGE_STENCIL_SHADER:
+      shaders[idx] = &shaders_image_asm[(sh >> SHADERS_IMAGE_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
    }
 
+   /* sanity check */
+   assert(idx == ((!sh || sh == VEGA_IMAGE_NORMAL_SHADER) ? 1 : 2));
+
    /* third stage */
-   if ((id & VEGA_MASK_SHADER)) {
-      debug_assert(idx == 1);
-      debug_assert(shaders_asm[7].id == VEGA_MASK_SHADER);
-      shaders[idx] = &shaders_asm[7];
-      ++idx;
+   sh = SHADERS_GET_COLOR_TRANSFORM_SHADER(id);
+   switch (sh) {
+   case VEGA_COLOR_TRANSFORM_SHADER:
+      shaders[idx] = &shaders_color_transform_asm[
+         (sh >> SHADERS_COLOR_TRANSFORM_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
    }
 
    /* fourth stage */
-   if ((id & VEGA_BLEND_MULTIPLY_SHADER)) {
-      debug_assert(shaders_asm[8].id == VEGA_BLEND_MULTIPLY_SHADER);
-      shaders[idx] = &shaders_asm[8];
-      ++idx;
-   } else if ((id & VEGA_BLEND_SCREEN_SHADER)) {
-      debug_assert(shaders_asm[9].id == VEGA_BLEND_SCREEN_SHADER);
-      shaders[idx] = &shaders_asm[9];
-      ++idx;
-   } else if ((id & VEGA_BLEND_DARKEN_SHADER)) {
-      debug_assert(shaders_asm[10].id == VEGA_BLEND_DARKEN_SHADER);
-      shaders[idx] = &shaders_asm[10];
-      ++idx;
-   } else if ((id & VEGA_BLEND_LIGHTEN_SHADER)) {
-      debug_assert(shaders_asm[11].id == VEGA_BLEND_LIGHTEN_SHADER);
-      shaders[idx] = &shaders_asm[11];
-      ++idx;
+   sh = SHADERS_GET_ALPHA_SHADER(id);
+   switch (sh) {
+   case VEGA_ALPHA_NORMAL_SHADER:
+   case VEGA_ALPHA_PER_CHANNEL_SHADER:
+      shaders[idx] = &shaders_alpha_asm[
+         (sh >> SHADERS_ALPHA_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
    }
 
    /* fifth stage */
-   if ((id & VEGA_PREMULTIPLY_SHADER)) {
-      debug_assert(shaders_asm[12].id == VEGA_PREMULTIPLY_SHADER);
-      shaders[idx] = &shaders_asm[12];
-      ++idx;
-   } else if ((id & VEGA_UNPREMULTIPLY_SHADER)) {
-      debug_assert(shaders_asm[13].id == VEGA_UNPREMULTIPLY_SHADER);
-      shaders[idx] = &shaders_asm[13];
-      ++idx;
+   sh = SHADERS_GET_BLEND_SHADER(id);
+   switch (sh) {
+   case VEGA_BLEND_SRC_SHADER:
+   case VEGA_BLEND_SRC_OVER_SHADER:
+   case VEGA_BLEND_DST_OVER_SHADER:
+   case VEGA_BLEND_SRC_IN_SHADER:
+   case VEGA_BLEND_DST_IN_SHADER:
+   case VEGA_BLEND_MULTIPLY_SHADER:
+   case VEGA_BLEND_SCREEN_SHADER:
+   case VEGA_BLEND_DARKEN_SHADER:
+   case VEGA_BLEND_LIGHTEN_SHADER:
+   case VEGA_BLEND_ADDITIVE_SHADER:
+      shaders[idx] = &shaders_blend_asm[(sh >> SHADERS_BLEND_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
    }
 
    /* sixth stage */
-   if ((id & VEGA_BW_SHADER)) {
-      debug_assert(shaders_asm[14].id == VEGA_BW_SHADER);
-      shaders[idx] = &shaders_asm[14];
-      ++idx;
+   sh = SHADERS_GET_MASK_SHADER(id);
+   switch (sh) {
+   case VEGA_MASK_SHADER:
+      shaders[idx] = &shaders_mask_asm[(sh >> SHADERS_MASK_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
+   }
+
+   /* seventh stage */
+   sh = SHADERS_GET_PREMULTIPLY_SHADER(id);
+   switch (sh) {
+   case VEGA_PREMULTIPLY_SHADER:
+   case VEGA_UNPREMULTIPLY_SHADER:
+      shaders[idx] = &shaders_premultiply_asm[
+         (sh >> SHADERS_PREMULTIPLY_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
+   }
+
+   /* eighth stage */
+   sh = SHADERS_GET_BW_SHADER(id);
+   switch (sh) {
+   case VEGA_BW_SHADER:
+      shaders[idx] = &shaders_bw_asm[(sh >> SHADERS_BW_SHIFT) - 1];
+      assert(shaders[idx]->id == sh);
+      idx++;
+      break;
+   default:
+      break;
    }
 
    return combine_shaders(shaders, idx, pipe, shader);
index feca58b61a9dd412ac3493a15ad586647132941c..05014f25dccedb4669f319ab9df48d991fdfb943 100644 (file)
@@ -33,26 +33,69 @@ struct pipe_context;
 struct tgsi_token;
 struct shaders_cache;
 
+#define _SHADERS_PAINT_BITS            3
+#define _SHADERS_IMAGE_BITS            2
+#define _SHADERS_COLOR_TRANSFORM_BITS  1
+#define _SHADERS_ALPHA_BITS            2
+#define _SHADERS_BLEND_BITS            4
+#define _SHADERS_MASK_BITS             1
+#define _SHADERS_PREMULTIPLY_BITS      2
+#define _SHADERS_BW_BITS               1
+
+#define SHADERS_PAINT_SHIFT           (0)
+#define SHADERS_IMAGE_SHIFT           (SHADERS_PAINT_SHIFT + _SHADERS_PAINT_BITS)
+#define SHADERS_COLOR_TRANSFORM_SHIFT (SHADERS_IMAGE_SHIFT + _SHADERS_IMAGE_BITS)
+#define SHADERS_ALPHA_SHIFT           (SHADERS_COLOR_TRANSFORM_SHIFT + _SHADERS_COLOR_TRANSFORM_BITS)
+#define SHADERS_BLEND_SHIFT           (SHADERS_ALPHA_SHIFT + _SHADERS_ALPHA_BITS)
+#define SHADERS_MASK_SHIFT            (SHADERS_BLEND_SHIFT + _SHADERS_BLEND_BITS)
+#define SHADERS_PREMULTIPLY_SHIFT     (SHADERS_MASK_SHIFT + _SHADERS_MASK_BITS)
+#define SHADERS_BW_SHIFT              (SHADERS_PREMULTIPLY_SHIFT + _SHADERS_PREMULTIPLY_BITS)
+
+#define _SHADERS_GET_STAGE(stage, id) \
+   ((id) & (((1 << _SHADERS_ ## stage ## _BITS) - 1) << SHADERS_ ## stage ## _SHIFT))
+
+#define SHADERS_GET_PAINT_SHADER(id)           _SHADERS_GET_STAGE(PAINT, id)
+#define SHADERS_GET_IMAGE_SHADER(id)           _SHADERS_GET_STAGE(IMAGE, id)
+#define SHADERS_GET_COLOR_TRANSFORM_SHADER(id) _SHADERS_GET_STAGE(COLOR_TRANSFORM, id)
+#define SHADERS_GET_ALPHA_SHADER(id)           _SHADERS_GET_STAGE(ALPHA, id)
+#define SHADERS_GET_BLEND_SHADER(id)           _SHADERS_GET_STAGE(BLEND, id)
+#define SHADERS_GET_MASK_SHADER(id)            _SHADERS_GET_STAGE(MASK, id)
+#define SHADERS_GET_PREMULTIPLY_SHADER(id)     _SHADERS_GET_STAGE(PREMULTIPLY, id)
+#define SHADERS_GET_BW_SHADER(id)              _SHADERS_GET_STAGE(BW, id)
+
 enum VegaShaderType {
-   VEGA_SOLID_FILL_SHADER         = 1 <<  0,
-   VEGA_LINEAR_GRADIENT_SHADER    = 1 <<  1,
-   VEGA_RADIAL_GRADIENT_SHADER    = 1 <<  2,
-   VEGA_PATTERN_SHADER            = 1 <<  3,
-   VEGA_IMAGE_NORMAL_SHADER       = 1 <<  4,
-   VEGA_IMAGE_MULTIPLY_SHADER     = 1 <<  5,
-   VEGA_IMAGE_STENCIL_SHADER      = 1 <<  6,
+   VEGA_SOLID_FILL_SHADER         = 1 << SHADERS_PAINT_SHIFT,
+   VEGA_LINEAR_GRADIENT_SHADER    = 2 << SHADERS_PAINT_SHIFT,
+   VEGA_RADIAL_GRADIENT_SHADER    = 3 << SHADERS_PAINT_SHIFT,
+   VEGA_PATTERN_SHADER            = 4 << SHADERS_PAINT_SHIFT,
+   VEGA_PAINT_DEGENERATE_SHADER   = 5 << SHADERS_PAINT_SHIFT,
+
+   VEGA_IMAGE_NORMAL_SHADER       = 1 << SHADERS_IMAGE_SHIFT,
+   VEGA_IMAGE_MULTIPLY_SHADER     = 2 << SHADERS_IMAGE_SHIFT,
+   VEGA_IMAGE_STENCIL_SHADER      = 3 << SHADERS_IMAGE_SHIFT,
+
+   VEGA_COLOR_TRANSFORM_SHADER    = 1 <<  SHADERS_COLOR_TRANSFORM_SHIFT,
+
+   VEGA_ALPHA_NORMAL_SHADER       = 1 <<  SHADERS_ALPHA_SHIFT,
+   VEGA_ALPHA_PER_CHANNEL_SHADER  = 2 <<  SHADERS_ALPHA_SHIFT,
 
-   VEGA_MASK_SHADER               = 1 <<  7,
+   VEGA_BLEND_SRC_SHADER          = 1 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_SRC_OVER_SHADER     = 2 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_DST_OVER_SHADER     = 3 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_SRC_IN_SHADER       = 4 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_DST_IN_SHADER       = 5 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_MULTIPLY_SHADER     = 6 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_SCREEN_SHADER       = 7 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_DARKEN_SHADER       = 8 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_LIGHTEN_SHADER      = 9 << SHADERS_BLEND_SHIFT,
+   VEGA_BLEND_ADDITIVE_SHADER     = 10<< SHADERS_BLEND_SHIFT,
 
-   VEGA_BLEND_MULTIPLY_SHADER     = 1 <<  8,
-   VEGA_BLEND_SCREEN_SHADER       = 1 <<  9,
-   VEGA_BLEND_DARKEN_SHADER       = 1 << 10,
-   VEGA_BLEND_LIGHTEN_SHADER      = 1 << 11,
+   VEGA_MASK_SHADER               = 1 << SHADERS_MASK_SHIFT,
 
-   VEGA_PREMULTIPLY_SHADER        = 1 << 12,
-   VEGA_UNPREMULTIPLY_SHADER      = 1 << 13,
+   VEGA_PREMULTIPLY_SHADER        = 1 << SHADERS_PREMULTIPLY_SHIFT,
+   VEGA_UNPREMULTIPLY_SHADER      = 2 << SHADERS_PREMULTIPLY_SHIFT,
 
-   VEGA_BW_SHADER                 = 1 << 14
+   VEGA_BW_SHADER                 = 1 << SHADERS_BW_SHIFT
 };
 
 struct vg_shader {
diff --git a/src/gallium/state_trackers/vega/st_inlines.h b/src/gallium/state_trackers/vega/st_inlines.h
deleted file mode 100644 (file)
index 7eaa67c..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-/**
- * Functions for checking if buffers/textures are referenced when we need
- * to read/write from/to them.  Flush when needed.
- */
-
-#ifndef ST_INLINES_H
-#define ST_INLINES_H
-
-#include "vg_context.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-#include "pipe/p_state.h"
-
-static INLINE struct pipe_transfer *
-st_cond_flush_get_transfer(struct vg_context *st,
-                              struct pipe_resource *pt,
-                              unsigned int face,
-                              unsigned int level,
-                              unsigned int zslice,
-                              enum pipe_transfer_usage usage,
-                              unsigned int x, unsigned int y,
-                              unsigned int w, unsigned int h)
-{
-   struct pipe_context *pipe = st->pipe;
-
-   return pipe_get_transfer(pipe, pt, face, level, zslice, usage,
-                           x, y, w, h);
-}
-
-static INLINE struct pipe_transfer *
-st_no_flush_get_transfer(struct vg_context *st,
-                            struct pipe_resource *pt,
-                            unsigned int face,
-                            unsigned int level,
-                            unsigned int zslice,
-                            enum pipe_transfer_usage usage,
-                            unsigned int x, unsigned int y,
-                            unsigned int w, unsigned int h)
-{
-   struct pipe_context *pipe = st->pipe;
-
-   return pipe_get_transfer(pipe, pt, face, level,
-                           zslice, usage, x, y, w, h);
-}
-
-
-static INLINE void
-st_cond_flush_pipe_buffer_write(struct vg_context *st,
-                               struct pipe_resource *buf,
-                               unsigned int offset,
-                               unsigned int size,
-                               const void * data)
-{
-   struct pipe_context *pipe = st->pipe;
-
-   pipe_buffer_write(pipe, buf, offset, size, data);
-}
-
-static INLINE void
-st_no_flush_pipe_buffer_write(struct vg_context *st,
-                             struct pipe_resource *buf,
-                             unsigned int offset,
-                             unsigned int size,
-                             const void * data)
-{
-   pipe_buffer_write(st->pipe, buf, offset, size, data);
-}
-
-static INLINE void
-st_cond_flush_pipe_buffer_read(struct vg_context *st,
-                              struct pipe_resource *buf,
-                              unsigned int offset,
-                              unsigned int size,
-                              void * data)
-{
-   struct pipe_context *pipe = st->pipe;
-
-   pipe_buffer_read(pipe, buf, offset, size, data);
-}
-
-static INLINE void
-st_no_flush_pipe_buffer_read(struct vg_context *st,
-                            struct pipe_resource *buf,
-                            unsigned int offset,
-                            unsigned int size,
-                            void * data)
-{
-   pipe_buffer_read(st->pipe, buf, offset, size, data);
-}
-
-#endif
-
diff --git a/src/gallium/state_trackers/vega/text.c b/src/gallium/state_trackers/vega/text.c
new file mode 100644 (file)
index 0000000..6714ee9
--- /dev/null
@@ -0,0 +1,249 @@
+/**************************************************************************
+ *
+ * Copyright 2010 LunarG, Inc.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "util/u_memory.h"
+#include "cso_cache/cso_hash.h"
+
+#include "text.h"
+#include "image.h"
+#include "path.h"
+
+#ifdef OPENVG_VERSION_1_1
+
+struct vg_font {
+   struct vg_object base;
+   struct cso_hash *glyphs;
+};
+
+struct vg_glyph {
+   struct vg_object *object; /* it could be NULL */
+   VGboolean is_hinted;
+   VGfloat glyph_origin[2];
+   VGfloat escapement[2];
+};
+
+static VGboolean del_glyph(struct vg_font *font,
+                           VGuint glyphIndex)
+{
+   struct vg_glyph *glyph;
+
+   glyph = (struct vg_glyph *)
+      cso_hash_take(font->glyphs, (unsigned) glyphIndex);
+   if (glyph)
+      FREE(glyph);
+
+   return (glyph != NULL);
+}
+
+static void add_glyph(struct vg_font *font,
+                      VGuint glyphIndex,
+                      struct vg_object *obj,
+                      VGboolean isHinted,
+                      const VGfloat glyphOrigin[2],
+                      const VGfloat escapement[2])
+{
+   struct vg_glyph *glyph;
+
+   /* remove the existing one */
+   del_glyph(font, glyphIndex);
+
+   glyph = CALLOC_STRUCT(vg_glyph);
+   glyph->object = obj;
+   glyph->is_hinted = isHinted;
+   memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyphOrigin));
+   memcpy(glyph->escapement, escapement, sizeof(escapement));
+
+   cso_hash_insert(font->glyphs, (unsigned) glyphIndex, glyph);
+}
+
+static struct vg_glyph *get_glyph(struct vg_font *font,
+                                  VGuint glyphIndex)
+{
+   struct cso_hash_iter iter;
+
+   iter = cso_hash_find(font->glyphs, (unsigned) glyphIndex);
+   return (struct vg_glyph *) cso_hash_iter_data(iter);
+}
+
+static void vg_render_glyph(struct vg_context *ctx,
+                            struct vg_glyph *glyph,
+                            VGbitfield paintModes,
+                            VGboolean allowAutoHinting)
+{
+   if (glyph->object && paintModes) {
+      struct vg_state *state = &ctx->state.vg;
+      struct matrix m;
+
+      m = state->glyph_user_to_surface_matrix;
+      matrix_translate(&m,
+            state->glyph_origin[0].f - glyph->glyph_origin[0],
+            state->glyph_origin[1].f - glyph->glyph_origin[1]);
+
+      if (glyph->object->type == VG_OBJECT_PATH) {
+         path_render((struct path *) glyph->object, paintModes, &m);
+      }
+      else {
+         assert(glyph->object->type == VG_OBJECT_IMAGE);
+         image_draw((struct vg_image *) glyph->object, &m);
+      }
+   }
+}
+
+static void vg_advance_glyph(struct vg_context *ctx,
+                             struct vg_glyph *glyph,
+                             VGfloat adjustment_x,
+                             VGfloat adjustment_y,
+                             VGboolean last)
+{
+   struct vg_value *glyph_origin = ctx->state.vg.glyph_origin;
+
+   glyph_origin[0].f += glyph->escapement[0] + adjustment_x;
+   glyph_origin[1].f += glyph->escapement[1] + adjustment_y;
+
+   if (last) {
+      glyph_origin[0].i = float_to_int_floor(glyph_origin[0].f);
+      glyph_origin[1].i = float_to_int_floor(glyph_origin[1].f);
+   }
+}
+
+struct vg_font *font_create(VGint glyphCapacityHint)
+{
+   struct vg_context *ctx = vg_current_context();
+   struct vg_font *font;
+
+   font = CALLOC_STRUCT(vg_font);
+   vg_init_object(&font->base, ctx, VG_OBJECT_FONT);
+   font->glyphs = cso_hash_create();
+
+   vg_context_add_object(ctx, VG_OBJECT_FONT, font);
+
+   return font;
+}
+
+void font_destroy(struct vg_font *font)
+{
+   struct vg_context *ctx = vg_current_context();
+   struct cso_hash_iter iter;
+
+   vg_context_remove_object(ctx, VG_OBJECT_FONT, font);
+
+   iter = cso_hash_first_node(font->glyphs);
+   while (!cso_hash_iter_is_null(iter)) {
+      struct vg_glyph *glyph = (struct vg_glyph *) cso_hash_iter_data(iter);
+      FREE(glyph);
+      iter = cso_hash_iter_next(iter);
+   }
+   cso_hash_delete(font->glyphs);
+
+   FREE(font);
+}
+
+void font_set_glyph_to_path(struct vg_font *font,
+                            VGuint glyphIndex,
+                            struct path *path,
+                            VGboolean isHinted,
+                            const VGfloat glyphOrigin[2],
+                            const VGfloat escapement[2])
+{
+   add_glyph(font, glyphIndex, (struct vg_object *) path,
+         isHinted, glyphOrigin, escapement);
+}
+
+void font_set_glyph_to_image(struct vg_font *font,
+                             VGuint glyphIndex,
+                             struct vg_image *image,
+                             const VGfloat glyphOrigin[2],
+                             const VGfloat escapement[2])
+{
+   add_glyph(font, glyphIndex, (struct vg_object *) image,
+         VG_TRUE, glyphOrigin, escapement);
+}
+
+void font_clear_glyph(struct vg_font *font,
+                      VGuint glyphIndex)
+{
+   if (!del_glyph(font, glyphIndex)) {
+      struct vg_context *ctx = vg_current_context();
+      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
+   }
+}
+
+void font_draw_glyph(struct vg_font *font,
+                     VGuint glyphIndex,
+                     VGbitfield paintModes,
+                     VGboolean allowAutoHinting)
+{
+   struct vg_context *ctx = vg_current_context();
+   struct vg_glyph *glyph;
+
+   glyph = get_glyph(font, glyphIndex);
+   if (!glyph) {
+      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
+      return;
+   }
+
+   vg_render_glyph(ctx, glyph, paintModes, allowAutoHinting);
+   vg_advance_glyph(ctx, glyph, 0.0f, 0.0f, VG_TRUE);
+}
+
+void font_draw_glyphs(struct vg_font *font,
+                      VGint glyphCount,
+                      const VGuint *glyphIndices,
+                      const VGfloat *adjustments_x,
+                      const VGfloat *adjustments_y,
+                      VGbitfield paintModes,
+                      VGboolean allowAutoHinting)
+{
+   struct vg_context *ctx = vg_current_context();
+   VGint i;
+
+   for (i = 0; i < glyphCount; ++i) {
+      if (!get_glyph(font, glyphIndices[i])) {
+         vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
+         return;
+      }
+   }
+
+   for (i = 0; i < glyphCount; ++i) {
+      struct vg_glyph *glyph;
+      VGfloat adj_x, adj_y;
+
+      glyph = get_glyph(font, glyphIndices[i]);
+
+      vg_render_glyph(ctx, glyph, paintModes, allowAutoHinting);
+
+      adj_x = (adjustments_x) ? adjustments_x[i] : 0.0f;
+      adj_y = (adjustments_y) ? adjustments_y[i] : 0.0f;
+      vg_advance_glyph(ctx, glyph, adj_x, adj_y, (i == glyphCount - 1));
+   }
+}
+
+VGint font_num_glyphs(struct vg_font *font)
+{
+   return cso_hash_size(font->glyphs);
+}
+
+#endif /* OPENVG_VERSION_1_1 */
diff --git a/src/gallium/state_trackers/vega/text.h b/src/gallium/state_trackers/vega/text.h
new file mode 100644 (file)
index 0000000..6b3fa73
--- /dev/null
@@ -0,0 +1,71 @@
+/**************************************************************************
+ *
+ * Copyright 2010 LunarG, Inc.  All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef _TEXT_H
+#define _TEXT_H
+
+#include "vg_context.h"
+#include "cso_cache/cso_hash.h"
+
+struct vg_font;
+struct vg_image;
+struct path;
+
+struct vg_font *font_create(VGint glyphCapacityHint);
+void font_destroy(struct vg_font *font);
+
+void font_set_glyph_to_path(struct vg_font *font,
+                            VGuint glyphIndex,
+                            struct path *path,
+                            VGboolean isHinted,
+                            const VGfloat glyphOrigin[2],
+                            const VGfloat escapement[2]);
+
+void font_set_glyph_to_image(struct vg_font *font,
+                             VGuint glyphIndex,
+                             struct vg_image *image,
+                             const VGfloat glyphOrigin[2],
+                             const VGfloat escapement[2]);
+
+void font_clear_glyph(struct vg_font *font,
+                      VGuint glyphIndex);
+
+void font_draw_glyph(struct vg_font *font,
+                     VGuint glyphIndex,
+                     VGbitfield paintModes,
+                     VGboolean allowAutoHinting);
+
+void font_draw_glyphs(struct vg_font *font,
+                      VGint glyphCount,
+                      const VGuint *glyphIndices,
+                      const VGfloat *adjustments_x,
+                      const VGfloat *adjustments_y,
+                      VGbitfield paintModes,
+                      VGboolean allowAutoHinting);
+
+VGint font_num_glyphs(struct vg_font *font);
+
+#endif /* _TEXT_H */
index 99e444affdffe955faec64216143b6359a2ddcd0..f36f55d6c89fbcf0b840cbd802a1d63d81c9e870 100644 (file)
 #include "renderer.h"
 #include "shaders_cache.h"
 #include "shader.h"
-#include "asm_util.h"
-#include "st_inlines.h"
 #include "vg_manager.h"
 #include "api.h"
+#include "mask.h"
 
 #include "pipe/p_context.h"
 #include "util/u_inlines.h"
 
 #include "cso_cache/cso_context.h"
 
-#include "util/u_simple_shaders.h"
 #include "util/u_memory.h"
 #include "util/u_blit.h"
 #include "util/u_sampler.h"
+#include "util/u_surface.h"
+#include "util/u_format.h"
 
 struct vg_context *_vg_context = 0;
 
@@ -52,19 +52,6 @@ struct vg_context * vg_current_context(void)
    return _vg_context;
 }
 
-static void init_clear(struct vg_context *st)
-{
-   struct pipe_context *pipe = st->pipe;
-
-   /* rasterizer state: bypass clipping */
-   memset(&st->clear.raster, 0, sizeof(st->clear.raster));
-   st->clear.raster.gl_rasterization_rules = 1;
-
-   /* fragment shader state: color pass-through program */
-   st->clear.fs =
-      util_make_fragment_passthrough_shader(pipe);
-}
-
 /**
  * A depth/stencil rb will be needed regardless of what the visual says.
  */
@@ -101,7 +88,6 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
                                       struct vg_context *share)
 {
    struct vg_context *ctx;
-   unsigned i;
 
    ctx = CALLOC_STRUCT(vg_context);
 
@@ -118,8 +104,6 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
 
    ctx->cso_context = cso_create_context(pipe);
 
-   init_clear(ctx);
-
    ctx->default_paint = paint_create(ctx);
    ctx->state.vg.stroke_paint = ctx->default_paint;
    ctx->state.vg.fill_paint = ctx->default_paint;
@@ -141,13 +125,6 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
    ctx->blend_sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
    ctx->blend_sampler.normalized_coords = 0;
 
-   for (i = 0; i < 2; i++) {
-      ctx->velems[i].src_offset = i * 4 * sizeof(float);
-      ctx->velems[i].instance_divisor = 0;
-      ctx->velems[i].vertex_buffer_index = 0;
-      ctx->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
-   }
-
    vg_set_error(ctx, VG_NO_ERROR);
 
    ctx->owned_objects[VG_OBJECT_PAINT] = cso_hash_create();
@@ -168,7 +145,6 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
 void vg_destroy_context(struct vg_context *ctx)
 {
    struct pipe_resource **cbuf = &ctx->mask.cbuf;
-   struct pipe_resource **vsbuf = &ctx->vs_const_buffer;
 
    util_destroy_blit(ctx->blit);
    renderer_destroy(ctx->renderer);
@@ -179,29 +155,6 @@ void vg_destroy_context(struct vg_context *ctx)
    if (*cbuf)
       pipe_resource_reference(cbuf, NULL);
 
-   if (*vsbuf)
-      pipe_resource_reference(vsbuf, NULL);
-
-   if (ctx->clear.fs) {
-      cso_delete_fragment_shader(ctx->cso_context, ctx->clear.fs);
-      ctx->clear.fs = NULL;
-   }
-
-   if (ctx->plain_vs) {
-      vg_shader_destroy(ctx, ctx->plain_vs);
-      ctx->plain_vs = NULL;
-   }
-   if (ctx->clear_vs) {
-      vg_shader_destroy(ctx, ctx->clear_vs);
-      ctx->clear_vs = NULL;
-   }
-   if (ctx->texture_vs) {
-      vg_shader_destroy(ctx, ctx->texture_vs);
-      ctx->texture_vs = NULL;
-   }
-
-   if (ctx->pass_through_depth_fs)
-      vg_shader_destroy(ctx, ctx->pass_through_depth_fs);
    if (ctx->mask.union_fs)
       vg_shader_destroy(ctx, ctx->mask.union_fs);
    if (ctx->mask.intersect_fs)
@@ -268,186 +221,195 @@ void vg_context_remove_object(struct vg_context *ctx,
    }
 }
 
-static void update_clip_state(struct vg_context *ctx)
+static struct pipe_resource *
+create_texture(struct pipe_context *pipe, enum pipe_format format,
+                    VGint width, VGint height)
 {
-   struct pipe_depth_stencil_alpha_state *dsa = &ctx->state.g3d.dsa;
-   struct vg_state *state =  &ctx->state.vg;
-
-   memset(dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state));
-
-   if (state->scissoring) {
-      struct pipe_blend_state *blend = &ctx->state.g3d.blend;
-      struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
-      int i;
-
-      dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/
-      dsa->depth.func = PIPE_FUNC_ALWAYS;
-      dsa->depth.enabled = 1;
-
-      cso_save_blend(ctx->cso_context);
-      cso_save_fragment_shader(ctx->cso_context);
-      /* set a passthrough shader */
-      if (!ctx->pass_through_depth_fs)
-         ctx->pass_through_depth_fs = shader_create_from_text(ctx->pipe,
-                                                              pass_through_depth_asm,
-                                                              40,
-                                                              PIPE_SHADER_FRAGMENT);
-      cso_set_fragment_shader_handle(ctx->cso_context,
-                                     ctx->pass_through_depth_fs->driver);
-      cso_set_depth_stencil_alpha(ctx->cso_context, dsa);
-
-      ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_DEPTHSTENCIL, NULL, 1.0, 0);
-
-      /* disable color writes */
-      blend->rt[0].colormask = 0; /*disable colorwrites*/
-      cso_set_blend(ctx->cso_context, blend);
-
-      /* enable scissoring */
-      for (i = 0; i < state->scissor_rects_num; ++i) {
-         const float x      = state->scissor_rects[i * 4 + 0].f;
-         const float y      = state->scissor_rects[i * 4 + 1].f;
-         const float width  = state->scissor_rects[i * 4 + 2].f;
-         const float height = state->scissor_rects[i * 4 + 3].f;
-         VGfloat minx, miny, maxx, maxy;
-
-         minx = 0;
-         miny = 0;
-         maxx = fb->width;
-         maxy = fb->height;
-
-         if (x > minx)
-            minx = x;
-         if (y > miny)
-            miny = y;
-
-         if (x + width < maxx)
-            maxx = x + width;
-         if (y + height < maxy)
-            maxy = y + height;
-
-         /* check for null space */
-         if (minx >= maxx || miny >= maxy)
-            minx = miny = maxx = maxy = 0;
-
-         /*glClear(GL_DEPTH_BUFFER_BIT);*/
-         renderer_draw_quad(ctx->renderer, minx, miny, maxx, maxy, 0.0f);
-      }
-
-      cso_restore_blend(ctx->cso_context);
-      cso_restore_fragment_shader(ctx->cso_context);
-
-      dsa->depth.enabled = 1; /* glEnable(GL_DEPTH_TEST); */
-      dsa->depth.writemask = 0;/*glDepthMask(FALSE);*/
-      dsa->depth.func = PIPE_FUNC_GEQUAL;
+   struct pipe_resource templ;
+
+   memset(&templ, 0, sizeof(templ));
+
+   if (format != PIPE_FORMAT_NONE) {
+      templ.format = format;
+   }
+   else {
+      templ.format = PIPE_FORMAT_B8G8R8A8_UNORM;
+   }
+
+   templ.target = PIPE_TEXTURE_2D;
+   templ.width0 = width;
+   templ.height0 = height;
+   templ.depth0 = 1;
+   templ.array_size = 1;
+   templ.last_level = 0;
+
+   if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
+      templ.bind = PIPE_BIND_DEPTH_STENCIL;
+   } else {
+      templ.bind = (PIPE_BIND_DISPLAY_TARGET |
+                    PIPE_BIND_RENDER_TARGET |
+                    PIPE_BIND_SAMPLER_VIEW);
    }
+
+   return pipe->screen->resource_create(pipe->screen, &templ);
 }
 
-void vg_validate_state(struct vg_context *ctx)
+static struct pipe_sampler_view *
+create_tex_and_view(struct pipe_context *pipe, enum pipe_format format,
+                    VGint width, VGint height)
 {
-   vg_manager_validate_framebuffer(ctx);
+   struct pipe_resource *texture;
+   struct pipe_sampler_view view_templ;
+   struct pipe_sampler_view *view;
 
-   if ((ctx->state.dirty & BLEND_DIRTY)) {
-      struct pipe_blend_state *blend = &ctx->state.g3d.blend;
-      memset(blend, 0, sizeof(struct pipe_blend_state));
-      blend->rt[0].blend_enable = 1;
-      blend->rt[0].colormask = PIPE_MASK_RGBA;
-
-      switch (ctx->state.vg.blend_mode) {
-      case VG_BLEND_SRC:
-         blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ZERO;
-         blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-         blend->rt[0].blend_enable = 0;
-         break;
-      case VG_BLEND_SRC_OVER:
-         blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_SRC_ALPHA;
-         blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
-         blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
-         break;
-      case VG_BLEND_DST_OVER:
-         blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_INV_DST_ALPHA;
-         blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_INV_DST_ALPHA;
-         blend->rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_DST_ALPHA;
-         blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_DST_ALPHA;
-         break;
-      case VG_BLEND_SRC_IN:
-         blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_DST_ALPHA;
-         blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_DST_ALPHA;
-         blend->rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ZERO;
-         blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-         break;
-      case VG_BLEND_DST_IN:
-         blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ZERO;
-         blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ZERO;
-         blend->rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_SRC_ALPHA;
-         blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
-         break;
-      case VG_BLEND_MULTIPLY:
-      case VG_BLEND_SCREEN:
-      case VG_BLEND_DARKEN:
-      case VG_BLEND_LIGHTEN:
-         blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ZERO;
-         blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-         blend->rt[0].blend_enable = 0;
-         break;
-      case VG_BLEND_ADDITIVE:
-         blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].rgb_dst_factor   = PIPE_BLENDFACTOR_ONE;
-         blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
-         break;
-      default:
-         assert(!"not implemented blend mode");
-      }
-      cso_set_blend(ctx->cso_context, &ctx->state.g3d.blend);
-   }
-   if ((ctx->state.dirty & RASTERIZER_DIRTY)) {
-      struct pipe_rasterizer_state *raster = &ctx->state.g3d.rasterizer;
-      memset(raster, 0, sizeof(struct pipe_rasterizer_state));
-      raster->gl_rasterization_rules = 1;
-      cso_set_rasterizer(ctx->cso_context, &ctx->state.g3d.rasterizer);
-   }
-   if ((ctx->state.dirty & VIEWPORT_DIRTY)) {
-      struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
-      const VGint param_bytes = 8 * sizeof(VGfloat);
-      VGfloat vs_consts[8] = {
-         2.f/fb->width, 2.f/fb->height, 1, 1,
-         -1, -1, 0, 0
-      };
-      struct pipe_resource **cbuf = &ctx->vs_const_buffer;
+   texture = create_texture(pipe, format, width, height);
 
-      vg_set_viewport(ctx, VEGA_Y0_BOTTOM);
+   if (!texture)
+      return NULL;
 
-      pipe_resource_reference(cbuf, NULL);
-      *cbuf = pipe_buffer_create(ctx->pipe->screen, 
-                                PIPE_BIND_CONSTANT_BUFFER,
-                                param_bytes);
-
-      if (*cbuf) {
-         st_no_flush_pipe_buffer_write(ctx, *cbuf,
-                                       0, param_bytes, vs_consts);
-      }
-      ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_VERTEX, 0, *cbuf);
+   u_sampler_view_default_template(&view_templ, texture, texture->format);
+   view = pipe->create_sampler_view(pipe, texture, &view_templ);
+   /* want the texture to go away if the view is freed */
+   pipe_resource_reference(&texture, NULL);
+
+   return view;
+}
+
+static void
+vg_context_update_surface_mask_view(struct vg_context *ctx,
+                                    uint width, uint height)
+{
+   struct st_framebuffer *stfb = ctx->draw_buffer;
+   struct pipe_sampler_view *old_sampler_view = stfb->surface_mask_view;
+   struct pipe_context *pipe = ctx->pipe;
+
+   if (old_sampler_view &&
+       old_sampler_view->texture->width0 == width &&
+       old_sampler_view->texture->height0 == height)
+      return;
+
+   /*
+     we use PIPE_FORMAT_B8G8R8A8_UNORM because we want to render to
+     this texture and use it as a sampler, so while this wastes some
+     space it makes both of those a lot simpler
+   */
+   stfb->surface_mask_view = create_tex_and_view(pipe,
+         PIPE_FORMAT_B8G8R8A8_UNORM, width, height);
+
+   if (!stfb->surface_mask_view) {
+      if (old_sampler_view)
+         pipe_sampler_view_reference(&old_sampler_view, NULL);
+      return;
    }
-   if ((ctx->state.dirty & VS_DIRTY)) {
-      cso_set_vertex_shader_handle(ctx->cso_context,
-                                   vg_plain_vs(ctx));
+
+   /* XXX could this call be avoided? */
+   vg_validate_state(ctx);
+
+   /* alpha mask starts with 1.f alpha */
+   mask_fill(0, 0, width, height, 1.f);
+
+   /* if we had an old surface copy it over */
+   if (old_sampler_view) {
+      struct pipe_box src_box;
+      u_box_origin_2d(MIN2(old_sampler_view->texture->width0,
+                           stfb->surface_mask_view->texture->width0),
+                      MIN2(old_sampler_view->texture->height0,
+                           stfb->surface_mask_view->texture->height0),
+                      &src_box);
+
+      pipe->resource_copy_region(pipe,
+                                 stfb->surface_mask_view->texture,
+                                 0, 0, 0, 0,
+                                 old_sampler_view->texture,
+                                 0, &src_box);
    }
 
-   /* must be last because it renders to the depth buffer*/
-   if ((ctx->state.dirty & DEPTH_STENCIL_DIRTY)) {
-      update_clip_state(ctx);
-      cso_set_depth_stencil_alpha(ctx->cso_context, &ctx->state.g3d.dsa);
+   /* Free the old texture
+    */
+   if (old_sampler_view)
+      pipe_sampler_view_reference(&old_sampler_view, NULL);
+}
+
+static void
+vg_context_update_blend_texture_view(struct vg_context *ctx,
+                                     uint width, uint height)
+{
+   struct pipe_context *pipe = ctx->pipe;
+   struct st_framebuffer *stfb = ctx->draw_buffer;
+   struct pipe_sampler_view *old = stfb->blend_texture_view;
+
+   if (old &&
+       old->texture->width0 == width &&
+       old->texture->height0 == height)
+      return;
+
+   stfb->blend_texture_view = create_tex_and_view(pipe,
+         PIPE_FORMAT_B8G8R8A8_UNORM, width, height);
+
+   pipe_sampler_view_reference(&old, NULL);
+}
+
+static boolean
+vg_context_update_depth_stencil_rb(struct vg_context * ctx,
+                                   uint width, uint height)
+{
+   struct st_renderbuffer *dsrb = ctx->draw_buffer->dsrb;
+   struct pipe_context *pipe = ctx->pipe;
+   struct pipe_surface surf_tmpl;
+
+   if ((dsrb->width == width && dsrb->height == height) && dsrb->texture)
+      return FALSE;
+
+   /* unreference existing ones */
+   pipe_surface_reference(&dsrb->surface, NULL);
+   pipe_resource_reference(&dsrb->texture, NULL);
+   dsrb->width = dsrb->height = 0;
+
+   dsrb->texture = create_texture(pipe, dsrb->format, width, height);
+   if (!dsrb->texture)
+      return TRUE;
+
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   u_surface_default_template(&surf_tmpl, dsrb->texture,
+                              PIPE_BIND_DEPTH_STENCIL);
+   dsrb->surface = pipe->create_surface(pipe,
+                                        dsrb->texture,
+                                        &surf_tmpl);
+   if (!dsrb->surface) {
+      pipe_resource_reference(&dsrb->texture, NULL);
+      return TRUE;
    }
 
+   dsrb->width = width;
+   dsrb->height = height;
+
+   assert(dsrb->surface->width == width);
+   assert(dsrb->surface->height == height);
+
+   return TRUE;
+}
+
+void vg_validate_state(struct vg_context *ctx)
+{
+   struct st_framebuffer *stfb = ctx->draw_buffer;
+
+   vg_manager_validate_framebuffer(ctx);
+
+   if (vg_context_update_depth_stencil_rb(ctx, stfb->width, stfb->height))
+      ctx->state.dirty |= DEPTH_STENCIL_DIRTY;
+
+   /* blend state depends on fb format */
+   if (ctx->state.dirty & FRAMEBUFFER_DIRTY)
+      ctx->state.dirty |= BLEND_DIRTY;
+
+   renderer_validate(ctx->renderer, ctx->state.dirty,
+         ctx->draw_buffer, &ctx->state.vg);
+
+   ctx->state.dirty = 0;
+
    shader_set_masking(ctx->shader, ctx->state.vg.masking);
    shader_set_image_mode(ctx->shader, ctx->state.vg.image_mode);
-
-   ctx->state.dirty = NONE_DIRTY;
+   shader_set_color_transform(ctx->shader, ctx->state.vg.color_transform);
 }
 
 VGboolean vg_object_is_valid(void *ptr, enum vg_object_type type)
@@ -470,130 +432,94 @@ void vg_set_error(struct vg_context *ctx,
       ctx->_error = code;
 }
 
-void vg_prepare_blend_surface(struct vg_context *ctx)
+static void vg_prepare_blend_texture(struct vg_context *ctx,
+                                     struct pipe_sampler_view *src)
+{
+   struct st_framebuffer *stfb = ctx->draw_buffer;
+   struct pipe_surface *surf;
+   struct pipe_surface surf_tmpl;
+
+   vg_context_update_blend_texture_view(ctx, stfb->width, stfb->height);
+
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture,
+                              PIPE_BIND_RENDER_TARGET);
+   surf = ctx->pipe->create_surface(ctx->pipe,
+                                    stfb->blend_texture_view->texture,
+                                    &surf_tmpl);
+   if (surf) {
+      util_blit_pixels_tex(ctx->blit,
+                           src, 0, 0, stfb->width, stfb->height,
+                           surf, 0, 0, stfb->width, stfb->height,
+                           0.0, PIPE_TEX_MIPFILTER_NEAREST);
+
+      pipe_surface_reference(&surf, NULL);
+   }
+}
+
+struct pipe_sampler_view *vg_prepare_blend_surface(struct vg_context *ctx)
 {
-   struct pipe_surface *dest_surface = NULL;
    struct pipe_context *pipe = ctx->pipe;
    struct pipe_sampler_view *view;
    struct pipe_sampler_view view_templ;
    struct st_framebuffer *stfb = ctx->draw_buffer;
    struct st_renderbuffer *strb = stfb->strb;
 
-   /* first finish all pending rendering */
-   vgFinish();
+   vg_validate_state(ctx);
 
    u_sampler_view_default_template(&view_templ, strb->texture, strb->texture->format);
    view = pipe->create_sampler_view(pipe, strb->texture, &view_templ);
 
-   dest_surface = pipe->screen->get_tex_surface(pipe->screen,
-                                                stfb->blend_texture_view->texture,
-                                                0, 0, 0,
-                                                PIPE_BIND_RENDER_TARGET);
-   /* flip it, because we want to use it as a sampler */
-   util_blit_pixels_tex(ctx->blit,
-                        view,
-                        0, strb->height,
-                        strb->width, 0,
-                        dest_surface,
-                        0, 0,
-                        strb->width, strb->height,
-                        0.0, PIPE_TEX_MIPFILTER_NEAREST);
-
-   if (dest_surface)
-      pipe_surface_reference(&dest_surface, NULL);
-
-   /* make sure it's complete */
-   vgFinish();
+   vg_prepare_blend_texture(ctx, view);
 
    pipe_sampler_view_reference(&view, NULL);
+
+   return stfb->blend_texture_view;
 }
 
 
-void vg_prepare_blend_surface_from_mask(struct vg_context *ctx)
+struct pipe_sampler_view *vg_prepare_blend_surface_from_mask(struct vg_context *ctx)
 {
-   struct pipe_surface *dest_surface = NULL;
-   struct pipe_context *pipe = ctx->pipe;
    struct st_framebuffer *stfb = ctx->draw_buffer;
-   struct st_renderbuffer *strb = stfb->strb;
 
    vg_validate_state(ctx);
 
-   /* first finish all pending rendering */
-   vgFinish();
-
-   dest_surface = pipe->screen->get_tex_surface(pipe->screen,
-                                                stfb->blend_texture_view->texture,
-                                                0, 0, 0,
-                                                PIPE_BIND_RENDER_TARGET);
-
-   /* flip it, because we want to use it as a sampler */
-   util_blit_pixels_tex(ctx->blit,
-                        stfb->alpha_mask_view,
-                        0, strb->height,
-                        strb->width, 0,
-                        dest_surface,
-                        0, 0,
-                        strb->width, strb->height,
-                        0.0, PIPE_TEX_MIPFILTER_NEAREST);
-
-   /* make sure it's complete */
-   vgFinish();
-
-   if (dest_surface)
-      pipe_surface_reference(&dest_surface, NULL);
+   vg_context_update_surface_mask_view(ctx, stfb->width, stfb->height);
+   vg_prepare_blend_texture(ctx, stfb->surface_mask_view);
+
+   return stfb->blend_texture_view;
 }
 
-void * vg_plain_vs(struct vg_context *ctx)
+struct pipe_sampler_view *vg_get_surface_mask(struct vg_context *ctx)
 {
-   if (!ctx->plain_vs) {
-      ctx->plain_vs = shader_create_from_text(ctx->pipe,
-                                              vs_plain_asm,
-                                              200,
-                                              PIPE_SHADER_VERTEX);
-   }
+   struct st_framebuffer *stfb = ctx->draw_buffer;
 
-   return ctx->plain_vs->driver;
-}
+   vg_context_update_surface_mask_view(ctx, stfb->width, stfb->height);
 
+   return stfb->surface_mask_view;
+}
 
-void * vg_clear_vs(struct vg_context *ctx)
+/**
+ * A transformation from window coordinates to paint coordinates.
+ */
+VGboolean vg_get_paint_matrix(struct vg_context *ctx,
+                              const struct matrix *paint_to_user,
+                              const struct matrix *user_to_surface,
+                              struct matrix *mat)
 {
-   if (!ctx->clear_vs) {
-      ctx->clear_vs = shader_create_from_text(ctx->pipe,
-                                              vs_clear_asm,
-                                              200,
-                                              PIPE_SHADER_VERTEX);
-   }
+   struct matrix tmp;
 
-   return ctx->clear_vs->driver;
-}
+   /* get user-to-paint matrix */
+   memcpy(mat, paint_to_user, sizeof(*paint_to_user));
+   if (!matrix_invert(mat))
+      return VG_FALSE;
 
-void * vg_texture_vs(struct vg_context *ctx)
-{
-   if (!ctx->texture_vs) {
-      ctx->texture_vs = shader_create_from_text(ctx->pipe,
-                                                vs_texture_asm,
-                                                200,
-                                                PIPE_SHADER_VERTEX);
-   }
+   /* get surface-to-user matrix */
+   memcpy(&tmp, user_to_surface, sizeof(*user_to_surface));
+   if (!matrix_invert(&tmp))
+      return VG_FALSE;
 
-   return ctx->texture_vs->driver;
-}
+   matrix_mult(mat, &tmp);
 
-void vg_set_viewport(struct vg_context *ctx, VegaOrientation orientation)
-{
-   struct pipe_viewport_state viewport;
-   struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
-   VGfloat y_scale = (orientation == VEGA_Y0_BOTTOM) ? -2.f : 2.f;
-
-   viewport.scale[0] =  fb->width / 2.f;
-   viewport.scale[1] =  fb->height / y_scale;
-   viewport.scale[2] =  1.0;
-   viewport.scale[3] =  1.0;
-   viewport.translate[0] = fb->width / 2.f;
-   viewport.translate[1] = fb->height / 2.f;
-   viewport.translate[2] = 0.0;
-   viewport.translate[3] = 0.0;
-
-   cso_set_viewport(ctx->cso_context, &viewport);
+   return VG_TRUE;
 }
index 80a6c07c693eb28c5667f4071325bcfd367c5f4d..d616a20a3d9aa532c9108e3161e130132bb6749e 100644 (file)
@@ -56,7 +56,7 @@ struct st_framebuffer {
    struct st_renderbuffer *strb;
    struct st_renderbuffer *dsrb;
 
-   struct pipe_sampler_view *alpha_mask_view;
+   struct pipe_sampler_view *surface_mask_view;
 
    struct pipe_sampler_view *blend_texture_view;
 
@@ -78,14 +78,13 @@ enum vg_object_type {
    VG_OBJECT_LAST
 };
 enum dirty_state {
-   NONE_DIRTY          = 0<<0,
-   BLEND_DIRTY         = 1<<1,
-   RASTERIZER_DIRTY    = 1<<2,
-   VIEWPORT_DIRTY      = 1<<3,
-   VS_DIRTY            = 1<<4,
-   DEPTH_STENCIL_DIRTY = 1<<5,
-   ALL_DIRTY           = BLEND_DIRTY | RASTERIZER_DIRTY |
-   VIEWPORT_DIRTY | VS_DIRTY | DEPTH_STENCIL_DIRTY
+   BLEND_DIRTY         = 1 << 0,
+   FRAMEBUFFER_DIRTY   = 1 << 1,
+   DEPTH_STENCIL_DIRTY = 1 << 2,
+
+   ALL_DIRTY           = BLEND_DIRTY |
+                         FRAMEBUFFER_DIRTY |
+                         DEPTH_STENCIL_DIRTY
 };
 
 struct vg_context
@@ -98,13 +97,6 @@ struct vg_context
 
    struct {
       struct vg_state vg;
-      struct {
-         struct pipe_blend_state blend;
-         struct pipe_rasterizer_state rasterizer;
-         struct pipe_shader_state vs_state;
-         struct pipe_depth_stencil_alpha_state dsa;
-         struct pipe_framebuffer_state fb;
-      } g3d;
       VGbitfield dirty;
    } state;
 
@@ -115,14 +107,6 @@ struct vg_context
 
    struct cso_hash *owned_objects[VG_OBJECT_LAST];
 
-   struct {
-      struct pipe_shader_state vert_shader;
-      struct pipe_shader_state frag_shader;
-      struct pipe_rasterizer_state raster;
-      void *fs;
-      float vertices[4][2][4];  /**< vertex pos + color */
-   } clear;
-
    struct {
       struct pipe_resource *cbuf;
       struct pipe_sampler_state sampler;
@@ -133,31 +117,16 @@ struct vg_context
       struct vg_shader *set_fs;
    } mask;
 
-   struct vg_shader *pass_through_depth_fs;
-
    struct cso_context *cso_context;
 
-   struct pipe_resource *stencil_quad;
-   VGfloat stencil_vertices[4][2][4];
-
    struct renderer *renderer;
    struct shaders_cache *sc;
    struct shader *shader;
 
    struct pipe_sampler_state blend_sampler;
-   struct {
-      struct pipe_resource *buffer;
-      void *color_matrix_fs;
-   } filter;
    struct vg_paint *default_paint;
 
    struct blit_state *blit;
-
-   struct vg_shader *plain_vs;
-   struct vg_shader *clear_vs;
-   struct vg_shader *texture_vs;
-   struct pipe_resource *vs_const_buffer;
-   struct pipe_vertex_element velems[2];
 };
 
 struct vg_object {
@@ -189,9 +158,15 @@ void vg_validate_state(struct vg_context *ctx);
 void vg_set_error(struct vg_context *ctx,
                   VGErrorCode code);
 
-void vg_prepare_blend_surface(struct vg_context *ctx);
-void vg_prepare_blend_surface_from_mask(struct vg_context *ctx);
+struct pipe_sampler_view *vg_prepare_blend_surface(struct vg_context *ctx);
+struct pipe_sampler_view *vg_prepare_blend_surface_from_mask(struct vg_context *ctx);
 
+struct pipe_sampler_view *vg_get_surface_mask(struct vg_context *ctx);
+
+VGboolean vg_get_paint_matrix(struct vg_context *ctx,
+                              const struct matrix *paint_to_user,
+                              const struct matrix *user_to_surface,
+                              struct matrix *mat);
 
 static INLINE VGboolean is_aligned_to(const void *ptr, VGbyte alignment)
 {
@@ -292,13 +267,4 @@ static INLINE void vg_bound_rect(VGfloat coords[4],
    }
 }
 
-void *vg_plain_vs(struct vg_context *ctx);
-void *vg_clear_vs(struct vg_context *ctx);
-void *vg_texture_vs(struct vg_context *ctx);
-typedef enum {
-   VEGA_Y0_TOP,
-   VEGA_Y0_BOTTOM
-} VegaOrientation;
-void vg_set_viewport(struct vg_context *ctx, VegaOrientation orientation);
-
 #endif
index bb15ec024f2e495de77636f14e3e064d105e36ba..ec713b7fb1d5dc649ab59c9616b2e19b8d53e802 100644 (file)
 #include "pipe/p_screen.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_sampler.h"
+#include "util/u_box.h"
+#include "util/u_surface.h"
 
 #include "vg_api.h"
 #include "vg_manager.h"
 #include "vg_context.h"
-#include "image.h"
-#include "mask.h"
 #include "api.h"
 
-static struct pipe_resource *
-create_texture(struct pipe_context *pipe, enum pipe_format format,
-                    VGint width, VGint height)
-{
-   struct pipe_resource templ;
-
-   memset(&templ, 0, sizeof(templ));
-
-   if (format != PIPE_FORMAT_NONE) {
-      templ.format = format;
-   }
-   else {
-      templ.format = PIPE_FORMAT_B8G8R8A8_UNORM;
-   }
-
-   templ.target = PIPE_TEXTURE_2D;
-   templ.width0 = width;
-   templ.height0 = height;
-   templ.depth0 = 1;
-   templ.last_level = 0;
-
-   if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
-      templ.bind = PIPE_BIND_DEPTH_STENCIL;
-   } else {
-      templ.bind = (PIPE_BIND_DISPLAY_TARGET |
-                    PIPE_BIND_RENDER_TARGET |
-                    PIPE_BIND_SAMPLER_VIEW);
-   }
-
-   return pipe->screen->resource_create(pipe->screen, &templ);
-}
-
-static struct pipe_sampler_view *
-create_tex_and_view(struct pipe_context *pipe, enum pipe_format format,
-                    VGint width, VGint height)
-{
-   struct pipe_resource *texture;
-   struct pipe_sampler_view view_templ;
-   struct pipe_sampler_view *view;
-
-   texture = create_texture(pipe, format, width, height);
-
-   if (!texture)
-      return NULL;
-
-   u_sampler_view_default_template(&view_templ, texture, texture->format);
-   view = pipe->create_sampler_view(pipe, texture, &view_templ);
-   /* want the texture to go away if the view is freed */
-   pipe_resource_reference(&texture, NULL);
-
-   return view;
-}
-
-static void
-setup_new_alpha_mask(struct vg_context *ctx, struct st_framebuffer *stfb)
-{
-   struct pipe_context *pipe = ctx->pipe;
-   struct pipe_sampler_view *old_sampler_view = stfb->alpha_mask_view;
-
-   /*
-     we use PIPE_FORMAT_B8G8R8A8_UNORM because we want to render to
-     this texture and use it as a sampler, so while this wastes some
-     space it makes both of those a lot simpler
-   */
-   stfb->alpha_mask_view = create_tex_and_view(pipe,
-         PIPE_FORMAT_B8G8R8A8_UNORM, stfb->width, stfb->height);
-
-   if (!stfb->alpha_mask_view) {
-      if (old_sampler_view)
-         pipe_sampler_view_reference(&old_sampler_view, NULL);
-      return;
-   }
-
-   /* XXX could this call be avoided? */
-   vg_validate_state(ctx);
-
-   /* alpha mask starts with 1.f alpha */
-   mask_fill(0, 0, stfb->width, stfb->height, 1.f);
-
-   /* if we had an old surface copy it over */
-   if (old_sampler_view) {
-      struct pipe_subresource subsurf, subold_surf;
-      subsurf.face = 0;
-      subsurf.level = 0;
-      subold_surf.face = 0;
-      subold_surf.level = 0;
-      pipe->resource_copy_region(pipe,
-                                 stfb->alpha_mask_view->texture,
-                                 subsurf,
-                                 0, 0, 0,
-                                 old_sampler_view->texture,
-                                 subold_surf,
-                                 0, 0, 0,
-                                 MIN2(old_sampler_view->texture->width0,
-                                      stfb->alpha_mask_view->texture->width0),
-                                 MIN2(old_sampler_view->texture->height0,
-                                      stfb->alpha_mask_view->texture->height0));
-   }
-
-   /* Free the old texture
-    */
-   if (old_sampler_view)
-      pipe_sampler_view_reference(&old_sampler_view, NULL);
-}
-
-static boolean
-vg_context_update_depth_stencil_rb(struct vg_context * ctx,
-                                   uint width, uint height)
-{
-   struct st_renderbuffer *dsrb = ctx->draw_buffer->dsrb;
-   struct pipe_context *pipe = ctx->pipe;
-   unsigned surface_usage;
-
-   if ((dsrb->width == width && dsrb->height == height) && dsrb->texture)
-      return FALSE;
-
-   /* unreference existing ones */
-   pipe_surface_reference(&dsrb->surface, NULL);
-   pipe_resource_reference(&dsrb->texture, NULL);
-   dsrb->width = dsrb->height = 0;
-
-   /* Probably need dedicated flags for surface usage too:
-    */
-   surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */
-
-   dsrb->texture = create_texture(pipe, dsrb->format, width, height);
-   if (!dsrb->texture)
-      return TRUE;
-
-   dsrb->surface = pipe->screen->get_tex_surface(pipe->screen,
-                                                 dsrb->texture,
-                                                 0, 0, 0,
-                                                 surface_usage);
-   if (!dsrb->surface) {
-      pipe_resource_reference(&dsrb->texture, NULL);
-      return TRUE;
-   }
-
-   dsrb->width = width;
-   dsrb->height = height;
-
-   assert(dsrb->surface->width == width);
-   assert(dsrb->surface->height == height);
-
-   return TRUE;
-}
-
 static boolean
 vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
 {
    struct st_renderbuffer *strb = ctx->draw_buffer->strb;
-   struct pipe_screen *screen = ctx->pipe->screen;
+   struct pipe_context *pipe = ctx->pipe;
+   struct pipe_surface surf_tmpl;
 
    if (strb->texture == pt) {
       pipe_resource_reference(&pt, NULL);
@@ -207,8 +59,12 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
    strb->width = strb->height = 0;
 
    strb->texture = pt;
-   strb->surface = screen->get_tex_surface(screen, strb->texture, 0, 0, 0,
-                                           PIPE_BIND_RENDER_TARGET);
+
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   u_surface_default_template(&surf_tmpl, strb->texture,
+                              PIPE_BIND_RENDER_TARGET);
+   strb->surface = pipe->create_surface(pipe, strb->texture, &surf_tmpl);
+
    if (!strb->surface) {
       pipe_resource_reference(&strb->texture, NULL);
       return TRUE;
@@ -220,49 +76,6 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
    return TRUE;
 }
 
-static void
-vg_context_update_draw_buffer(struct vg_context *ctx, struct pipe_resource *pt)
-{
-   struct st_framebuffer *stfb = ctx->draw_buffer;
-   boolean new_cbuf, new_zsbuf, new_size;
-
-   new_cbuf = vg_context_update_color_rb(ctx, pt);
-   new_zsbuf =
-      vg_context_update_depth_stencil_rb(ctx, pt->width0, pt->height0);
-
-   new_size = (stfb->width != pt->width0 || stfb->height != pt->height0);
-   stfb->width = pt->width0;
-   stfb->height = pt->height0;
-
-   if (new_cbuf || new_zsbuf || new_size) {
-      struct pipe_framebuffer_state *state = &ctx->state.g3d.fb;
-
-      memset(state, 0, sizeof(struct pipe_framebuffer_state));
-      state->width  = stfb->width;
-      state->height = stfb->height;
-      state->nr_cbufs = 1;
-      state->cbufs[0] = stfb->strb->surface;
-      state->zsbuf = stfb->dsrb->surface;
-
-      cso_set_framebuffer(ctx->cso_context, state);
-   }
-
-   if (new_zsbuf || new_size) {
-      ctx->state.dirty |= VIEWPORT_DIRTY;
-      ctx->state.dirty |= DEPTH_STENCIL_DIRTY;/*to reset the scissors*/
-
-      ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_DEPTHSTENCIL, NULL, 0.0, 0);
-
-      /* we need all the other state already set */
-
-      setup_new_alpha_mask(ctx, stfb);
-
-      pipe_sampler_view_reference( &stfb->blend_texture_view, NULL);
-      stfb->blend_texture_view = create_tex_and_view(ctx->pipe,
-            PIPE_FORMAT_B8G8R8A8_UNORM, stfb->width, stfb->height);
-   }
-}
-
 /**
  * Flush the front buffer if the current context renders to the front buffer.
  */
@@ -304,15 +117,16 @@ vg_manager_validate_framebuffer(struct vg_context *ctx)
    if (!stfb->iface->validate(stfb->iface, &stfb->strb_att, 1, &pt) || !pt)
       return;
 
-   /*
-    * unset draw_buffer_invalid first because vg_context_update_draw_buffer
-    * will cause the framebuffer to be validated again because of a call to
-    * vg_validate_state
-    */
    p_atomic_set(&ctx->draw_buffer_invalid, FALSE);
-   vg_context_update_draw_buffer(ctx, pt);
-}
 
+   if (vg_context_update_color_rb(ctx, pt) ||
+       stfb->width != pt->width0 ||
+       stfb->height != pt->height0)
+      ctx->state.dirty |= FRAMEBUFFER_DIRTY;
+
+   stfb->width = pt->width0;
+   stfb->height = pt->height0;
+}
 
 static void
 vg_context_notify_invalid_framebuffer(struct st_context_iface *stctxi,
@@ -336,7 +150,10 @@ static void
 vg_context_destroy(struct st_context_iface *stctxi)
 {
    struct vg_context *ctx = (struct vg_context *) stctxi;
+   struct pipe_context *pipe = ctx->pipe;
+
    vg_destroy_context(ctx);
+   pipe->destroy(pipe);
 }
 
 static struct st_context_iface *
index ec55f042f909f5a02a55bc0e02b60af27906e23e..1b7597de44056d3ae8b4253468ccafe457e24506 100644 (file)
@@ -13,7 +13,6 @@ env.Append(CPPPATH = [
 env.AppendUnique(CPPDEFINES = [
     '_GDI32_', # prevent wgl* being declared __declspec(dllimport)
     'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 
-    'WIN32_THREADS', # use Win32 thread API
     'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
 ])
 
@@ -22,6 +21,7 @@ sources = [
     'stw_device.c',
     'stw_ext_extensionsstring.c',
     'stw_ext_gallium.c',
+    'stw_ext_pbuffer.c',
     'stw_ext_pixelformat.c',
     'stw_ext_swapinterval.c',
     'stw_framebuffer.c',
index 86c0a28e8da75122cfa59aa62d279872e8f02ce6..cd4f3c8b3e28a8ba4a701b65c770aadd32a7e6e1 100644 (file)
@@ -264,75 +264,82 @@ stw_make_current(
    struct stw_context *curctx = NULL;
    struct stw_context *ctx = NULL;
    struct stw_framebuffer *fb = NULL;
+   BOOL ret = FALSE;
 
    if (!stw_dev)
-      goto fail;
+      return FALSE;
 
    curctx = stw_current_context();
    if (curctx != NULL) {
-      if (curctx->dhglrc != dhglrc)
+      if (curctx->dhglrc == dhglrc) {
+         if (curctx->hdc == hdc) {
+            /* Return if already current. */
+            return TRUE;
+         }
+      } else {
          curctx->st->flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-      
-      /* Return if already current. */
-      if (curctx->dhglrc == dhglrc && curctx->hdc == hdc) {
-         ctx = curctx;
-         fb = stw_framebuffer_from_hdc( hdc );
-         goto success;
       }
-
-      stw_framebuffer_reference(&curctx->current_framebuffer, NULL);
    }
 
-   if (hdc == NULL || dhglrc == 0) {
-      return stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
-   }
-
-   pipe_mutex_lock( stw_dev->ctx_mutex ); 
-   ctx = stw_lookup_context_locked( dhglrc );
-   pipe_mutex_unlock( stw_dev->ctx_mutex ); 
-   if(!ctx)
-      goto fail;
-
-   fb = stw_framebuffer_from_hdc( hdc );
-   if (fb) {
-      stw_framebuffer_update(fb);
-   }
-   else {
-      /* Applications should call SetPixelFormat before creating a context,
-       * but not all do, and the opengl32 runtime seems to use a default pixel
-       * format in some cases, so we must create a framebuffer for those here
-       */
-      int iPixelFormat = GetPixelFormat(hdc);
-      if(iPixelFormat)
-         fb = stw_framebuffer_create( hdc, iPixelFormat );
-      if(!fb) 
+   if (dhglrc) {
+      pipe_mutex_lock( stw_dev->ctx_mutex );
+      ctx = stw_lookup_context_locked( dhglrc );
+      pipe_mutex_unlock( stw_dev->ctx_mutex );
+      if (!ctx) {
          goto fail;
-   }
-   
-   if(fb->iPixelFormat != ctx->iPixelFormat)
-      goto fail;
+      }
 
-   /* Bind the new framebuffer */
-   ctx->hdc = hdc;
+      fb = stw_framebuffer_from_hdc( hdc );
+      if (fb) {
+         stw_framebuffer_update(fb);
+      }
+      else {
+         /* Applications should call SetPixelFormat before creating a context,
+          * but not all do, and the opengl32 runtime seems to use a default pixel
+          * format in some cases, so we must create a framebuffer for those here
+          */
+         int iPixelFormat = GetPixelFormat(hdc);
+         if (iPixelFormat)
+            fb = stw_framebuffer_create( hdc, iPixelFormat );
+         if (!fb)
+            goto fail;
+      }
    
-   if (!stw_dev->stapi->make_current(stw_dev->stapi, ctx->st, fb->stfb, fb->stfb))
-      goto fail;
+      if (fb->iPixelFormat != ctx->iPixelFormat) {
+         SetLastError(ERROR_INVALID_PIXEL_FORMAT);
+         goto fail;
+      }
 
-   stw_framebuffer_reference(&ctx->current_framebuffer, fb);
+      /* Bind the new framebuffer */
+      ctx->hdc = hdc;
 
-success:
-   assert(fb);
-   if(fb) {
-      stw_framebuffer_release(fb);
+      ret = stw_dev->stapi->make_current(stw_dev->stapi, ctx->st, fb->stfb, fb->stfb);
+      stw_framebuffer_reference(&ctx->current_framebuffer, fb);
+   } else {
+      ret = stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
    }
    
-   return TRUE;
-
 fail:
-   if(fb)
+
+   if (fb) {
       stw_framebuffer_release(fb);
-   stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
-   return FALSE;
+   }
+
+   /* On failure, make the thread's current rendering context not current
+    * before returning */
+   if (!ret) {
+      stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
+      ctx = NULL;
+   }
+
+   /* Unreference the previous framebuffer if any. It must be done after
+    * make_current, as it can be referenced inside.
+    */
+   if (curctx && curctx != ctx) {
+      stw_framebuffer_reference(&curctx->current_framebuffer, NULL);
+   }
+
+   return ret;
 }
 
 /**
index 37809d084ce4c4ee4c826416c26b1aecdde58b0c..c4822d4d8aa9943919abebc277cd79c27d9b5880 100644 (file)
@@ -41,9 +41,7 @@
 #include "stw_framebuffer.h"
 #include "stw_st.h"
 
-#ifdef WIN32_THREADS
 extern _glthread_Mutex OneTimeLock;
-#endif
 
 
 struct stw_device *stw_dev = NULL;
@@ -76,9 +74,7 @@ stw_init(const struct stw_winsys *stw_winsys)
    
    stw_dev->stw_winsys = stw_winsys;
 
-#ifdef WIN32_THREADS
    _glthread_INIT_MUTEX(OneTimeLock);
-#endif
 
    stw_dev->stapi = stw_st_create_api();
    stw_dev->smapi = CALLOC_STRUCT(st_manager);
@@ -96,6 +92,10 @@ stw_init(const struct stw_winsys *stw_winsys)
    stw_dev->smapi->get_param = stw_get_param;
    stw_dev->screen = screen;
 
+   stw_dev->max_2d_levels =
+         screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+   stw_dev->max_2d_length = 1 << (stw_dev->max_2d_levels - 1);
+
    pipe_mutex_init( stw_dev->ctx_mutex );
    pipe_mutex_init( stw_dev->fb_mutex );
 
@@ -168,11 +168,9 @@ stw_cleanup(void)
 
    stw_dev->screen->destroy(stw_dev->screen);
 
-#ifdef WIN32_THREADS
    _glthread_DESTROY_MUTEX(OneTimeLock);
 
    _glapi_destroy_multithread();
-#endif
 
 #ifdef DEBUG
    debug_memory_end(stw_dev->memdbg_no);
index 1b836960d0d48c0e997eba775faa608147f8f9e1..3c2b6d9c076d3ff8cdefe81613ef4c400a2d7ee0 100644 (file)
@@ -50,6 +50,10 @@ struct stw_device
    
    struct pipe_screen *screen;
    
+   /* Cache some PIPE_CAP_* */
+   unsigned max_2d_levels;
+   unsigned max_2d_length;
+
    struct st_api *stapi;
    struct st_manager *smapi;
 
index 62c859e1f92cc0601d707e66b0d6086686ec8788..ecb326f1cf6c9dcb6ef6660ba0a909cebb1184bf 100644 (file)
@@ -37,6 +37,7 @@
 static const char *stw_extension_string = 
    "WGL_ARB_extensions_string "
    "WGL_ARB_multisample "
+   "WGL_ARB_pbuffer "
    "WGL_ARB_pixel_format "
 /*   "WGL_EXT_swap_interval " */
    "WGL_EXT_extensions_string";
diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
new file mode 100644 (file)
index 0000000..32636c6
--- /dev/null
@@ -0,0 +1,212 @@
+/**************************************************************************
+ * 
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include <windows.h>
+
+#define WGL_WGLEXT_PROTOTYPES
+
+#include <GL/gl.h>
+#include <GL/wglext.h>
+
+#include "pipe/p_defines.h"
+#include "pipe/p_screen.h"
+
+#include "stw_device.h"
+#include "stw_pixelformat.h"
+#include "stw_framebuffer.h"
+
+
+HPBUFFERARB WINAPI
+wglCreatePbufferARB(HDC _hDC,
+                    int iPixelFormat,
+                    int iWidth,
+                    int iHeight,
+                    const int *piAttribList)
+{
+   static boolean first = TRUE;
+   const int *piAttrib;
+   int useLargest = 0;
+   const struct stw_pixelformat_info *info;
+   struct stw_framebuffer *fb;
+   HWND hWnd;
+   HDC hDC;
+
+   info = stw_pixelformat_get_info(iPixelFormat);
+   if (!info) {
+      SetLastError(ERROR_INVALID_PIXEL_FORMAT);
+      return 0;
+   }
+
+   if (iWidth <= 0 || iHeight <= 0) {
+      SetLastError(ERROR_INVALID_DATA);
+      return 0;
+   }
+
+   for (piAttrib = piAttribList; *piAttrib; piAttrib++) {
+      switch (*piAttrib) {
+      case WGL_PBUFFER_LARGEST_ARB:
+         piAttrib++;
+         useLargest = *piAttrib;
+         break;
+      default:
+         SetLastError(ERROR_INVALID_DATA);
+         return 0;
+      }
+   }
+
+   if (iWidth > stw_dev->max_2d_length) {
+      if (useLargest) {
+         iWidth = stw_dev->max_2d_length;
+      } else {
+         SetLastError(ERROR_NO_SYSTEM_RESOURCES);
+         return 0;
+      }
+   }
+
+   if (iHeight > stw_dev->max_2d_length) {
+      if (useLargest) {
+         iHeight = stw_dev->max_2d_length;
+      } else {
+         SetLastError(ERROR_NO_SYSTEM_RESOURCES);
+         return 0;
+      }
+   }
+
+   /*
+    * Implement pbuffers through invisible windows
+    */
+
+   if (first) {
+      WNDCLASS wc;
+      memset(&wc, 0, sizeof wc);
+      wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
+      wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+      wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+      wc.lpfnWndProc = DefWindowProc;
+      wc.lpszClassName = "wglpbuffer";
+      wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
+      RegisterClass(&wc);
+      first = FALSE;
+   }
+
+   hWnd = CreateWindowEx(0,
+                         "wglpbuffer", /* wc.lpszClassName */
+                         "wglpbuffer",
+#if 0 /* Useful for debugging what the application is drawing */
+                         WS_VISIBLE |
+#endif
+                         WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+                         CW_USEDEFAULT, CW_USEDEFAULT, /* x, y */
+                         iWidth, iHeight,
+                         NULL,
+                         NULL,
+                         NULL,
+                         NULL);
+   if (!hWnd) {
+      return 0;
+   }
+
+   hDC = GetDC(hWnd);
+   if (!hDC) {
+      return 0;
+   }
+
+   SetPixelFormat(hDC, iPixelFormat, &info->pfd);
+
+   fb = stw_framebuffer_create(hDC, iPixelFormat);
+   if (!fb) {
+      SetLastError(ERROR_NO_SYSTEM_RESOURCES);
+   }
+
+   return (HPBUFFERARB)fb;
+}
+
+
+HDC WINAPI
+wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
+{
+   struct stw_framebuffer *fb;
+   HDC hDC;
+
+   fb = (struct stw_framebuffer *)hPbuffer;
+
+   hDC = GetDC(fb->hWnd);
+   SetPixelFormat(hDC, fb->iPixelFormat, &fb->pfi->pfd);
+
+   return hDC;
+}
+
+
+int WINAPI
+wglReleasePbufferDCARB(HPBUFFERARB hPbuffer,
+                       HDC hDC)
+{
+   struct stw_framebuffer *fb;
+
+   fb = (struct stw_framebuffer *)hPbuffer;
+
+   return ReleaseDC(fb->hWnd, hDC);
+}
+
+
+BOOL WINAPI
+wglDestroyPbufferARB(HPBUFFERARB hPbuffer)
+{
+   struct stw_framebuffer *fb;
+
+   fb = (struct stw_framebuffer *)hPbuffer;
+
+   /* This will destroy all our data */
+   return DestroyWindow(fb->hWnd);
+}
+
+
+BOOL WINAPI
+wglQueryPbufferARB(HPBUFFERARB hPbuffer,
+                   int iAttribute,
+                   int *piValue)
+{
+   struct stw_framebuffer *fb;
+
+   fb = (struct stw_framebuffer *)hPbuffer;
+
+   switch (iAttribute) {
+   case WGL_PBUFFER_WIDTH_ARB:
+      *piValue = fb->width;
+      return TRUE;
+   case WGL_PBUFFER_HEIGHT_ARB:
+      *piValue = fb->width;
+      return TRUE;
+   case WGL_PBUFFER_LOST_ARB:
+      /* We assume that no content is ever lost due to display mode change */
+      *piValue = FALSE;
+      return TRUE;
+   default:
+      SetLastError(ERROR_INVALID_DATA);
+      return FALSE;
+   }
+}
index ab56800e28ddb3243e70ae580d1d3185ca2ac6ea..d0a95863bb412969cf5b8249f21509f9ad82f0c9 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "pipe/p_compiler.h"
 #include "util/u_memory.h"
+#include "stw_device.h"
 #include "stw_pixelformat.h"
 
 
@@ -234,6 +235,23 @@ stw_query_attrib(
       *pvalue = pfi->stvis.samples;
       break;
 
+
+   /* WGL_ARB_pbuffer */
+
+   case WGL_MAX_PBUFFER_WIDTH_ARB:
+   case WGL_MAX_PBUFFER_HEIGHT_ARB:
+      *pvalue = stw_dev->max_2d_length;
+      break;
+
+   case WGL_MAX_PBUFFER_PIXELS_ARB:
+      *pvalue = stw_dev->max_2d_length * stw_dev->max_2d_length;
+      break;
+
+   case WGL_DRAW_TO_PBUFFER_ARB:
+      *pvalue = 1;
+      break;
+
+
    default:
       return FALSE;
    }
index 259b22f22c73a1a13ab435fd31cd45428ede5f12..733222aa21c828662b7b2058119f08bd578de241 100644 (file)
@@ -469,7 +469,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
 {
    struct stw_framebuffer *fb;
    struct pipe_screen *screen;
-   struct pipe_surface *surface;
+   struct pipe_resource *res;
 
    if (!stw_dev)
       return FALSE;
@@ -480,7 +480,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
 
    screen = stw_dev->screen;
 
-   surface = (struct pipe_surface *)data->pPrivateData;
+   res = (struct pipe_resource *)data->pPrivateData;
 
    if(data->hSharedSurface != fb->hSharedSurface) {
       if(fb->shared_surface) {
@@ -498,13 +498,13 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
 
    if(fb->shared_surface) {
       stw_dev->stw_winsys->compose(screen,
-                                   surface,
+                                   res,
                                    fb->shared_surface,
                                    &fb->client_rect,
                                    data->PresentHistoryToken);
    }
    else {
-      stw_dev->stw_winsys->present( screen, surface, hdc );
+      stw_dev->stw_winsys->present( screen, res, hdc );
    }
 
    stw_framebuffer_update(fb);
@@ -524,7 +524,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
 BOOL
 stw_framebuffer_present_locked(HDC hdc,
                                struct stw_framebuffer *fb,
-                               struct pipe_surface *surface)
+                               struct pipe_resource *res)
 {
    if(stw_dev->callbacks.wglCbPresentBuffers &&
       stw_dev->stw_winsys->compose) {
@@ -535,7 +535,7 @@ stw_framebuffer_present_locked(HDC hdc,
       data.magic2 = 0;
       data.AdapterLuid = stw_dev->AdapterLuid;
       data.rect = fb->client_rect;
-      data.pPrivateData = (void *)surface;
+      data.pPrivateData = (void *)res;
 
       stw_notify_current_locked(fb);
       stw_framebuffer_release(fb);
@@ -545,7 +545,7 @@ stw_framebuffer_present_locked(HDC hdc,
    else {
       struct pipe_screen *screen = stw_dev->screen;
 
-      stw_dev->stw_winsys->present( screen, surface, hdc );
+      stw_dev->stw_winsys->present( screen, res, hdc );
 
       stw_framebuffer_update(fb);
       stw_notify_current_locked(fb);
index 89d12300e67c2386410072ae292274244bc95577..6604e545cbc67a34865606b2d0b80846e236a574 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "os/os_thread.h"
 
-struct pipe_surface;
+struct pipe_resource;
 struct st_framebuffer_iface;
 struct stw_pixelformat_info;
 
@@ -143,7 +143,7 @@ stw_framebuffer_from_hdc(
 BOOL
 stw_framebuffer_present_locked(HDC hdc,
                                struct stw_framebuffer *fb,
-                               struct pipe_surface *surface);
+                               struct pipe_resource *res);
 
 void
 stw_framebuffer_update(
index d43a55fa9e603ed45859eab9dc5943a0bb88a05c..b0aef943d30b03e5fd39d6facd57ed58ea8f60e4 100644 (file)
@@ -50,6 +50,13 @@ static const struct stw_extension_entry stw_extension_entries[] = {
    /* WGL_ARB_extensions_string */
    STW_EXTENSION_ENTRY( wglGetExtensionsStringARB ),
 
+   /* WGL_ARB_pbuffer */
+   STW_EXTENSION_ENTRY( wglCreatePbufferARB ),
+   STW_EXTENSION_ENTRY( wglGetPbufferDCARB ),
+   STW_EXTENSION_ENTRY( wglReleasePbufferDCARB ),
+   STW_EXTENSION_ENTRY( wglDestroyPbufferARB ),
+   STW_EXTENSION_ENTRY( wglQueryPbufferARB ),
+
    /* WGL_ARB_pixel_format */
    STW_EXTENSION_ENTRY( wglChoosePixelFormatARB ),
    STW_EXTENSION_ENTRY( wglGetPixelFormatAttribfvARB ),
index 18ac48236965ad00de6f5cb7f3aea9dda44d2070..5ede1d43220f9a4287f0812c3677686c46bfe2c0 100644 (file)
@@ -185,7 +185,7 @@ stw_pixelformat_add(
     */
    pfi->stvis.buffer_mask = ST_ATTACHMENT_FRONT_LEFT_MASK;
    if (doublebuffer)
-      pfi->stvis.buffer_mask = ST_ATTACHMENT_BACK_LEFT_MASK;
+      pfi->stvis.buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
 
    pfi->stvis.color_format = color->format;
    pfi->stvis.depth_stencil_format = depth->format;
index bcdd82e4f66e3f2934175deb214cfbfad995325b..b58d91673b7867dfe483e961cd2a1508122c8494 100644 (file)
@@ -43,8 +43,6 @@ struct stw_st_framebuffer {
    struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
    unsigned texture_width, texture_height;
    unsigned texture_mask;
-
-   struct pipe_surface *front_surface, *back_surface;
 };
 
 static INLINE struct stw_st_framebuffer *
@@ -65,10 +63,6 @@ stw_st_framebuffer_validate_locked(struct st_framebuffer_iface *stfb,
    struct pipe_resource templ;
    unsigned i;
 
-   /* remove outdated surface */
-   pipe_surface_reference(&stwfb->front_surface, NULL);
-   pipe_surface_reference(&stwfb->back_surface, NULL);
-
    /* remove outdated textures */
    if (stwfb->texture_width != width || stwfb->texture_height != height) {
       for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
@@ -80,6 +74,7 @@ stw_st_framebuffer_validate_locked(struct st_framebuffer_iface *stfb,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
 
    for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
@@ -155,45 +150,6 @@ stw_st_framebuffer_validate(struct st_framebuffer_iface *stfb,
    return TRUE;
 }
 
-static struct pipe_surface *
-get_present_surface_locked(struct st_framebuffer_iface *stfb,
-                           enum st_attachment_type statt)
-{
-   struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
-   struct pipe_resource *ptex;
-   struct pipe_surface *psurf, **cache;
-   
-   ptex = stwfb->textures[statt];
-   if (!ptex)
-      return NULL;
-
-   psurf = NULL;
-
-   switch (statt) {
-   case ST_ATTACHMENT_FRONT_LEFT:
-      cache = &stwfb->front_surface;
-      break;
-   case ST_ATTACHMENT_BACK_LEFT:
-      cache = &stwfb->back_surface;
-      break;
-   default:
-      cache = &psurf;
-      break;
-   }
-
-   if (!*cache) {
-      *cache = stw_dev->screen->get_tex_surface(stw_dev->screen,
-            ptex, 0, 0, 0,
-            PIPE_BIND_DISPLAY_TARGET |
-            PIPE_BIND_RENDER_TARGET);
-   }
-
-   if (psurf != *cache)
-      pipe_surface_reference(&psurf, *cache);
-
-   return psurf;
-}
-
 /**
  * Present an attachment of the framebuffer.
  */
@@ -202,12 +158,11 @@ stw_st_framebuffer_present_locked(struct st_framebuffer_iface *stfb,
                                   enum st_attachment_type statt)
 {
    struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
-   struct pipe_surface *psurf;
-   
-   psurf = get_present_surface_locked(&stwfb->base, statt);
-   if (psurf) {
-      stw_framebuffer_present_locked(stwfb->fb->hDC, stwfb->fb, psurf);
-      pipe_surface_reference(&psurf, NULL);
+   struct pipe_resource *resource;
+
+   resource = stwfb->textures[statt];
+   if (resource) {
+      stw_framebuffer_present_locked(stwfb->fb->hDC, stwfb->fb, resource);
    }
 
    return TRUE;
@@ -255,9 +210,6 @@ stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb)
    struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
    int i;
 
-   pipe_surface_reference(&stwfb->front_surface, NULL);
-   pipe_surface_reference(&stwfb->back_surface, NULL);
-
    for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
       pipe_resource_reference(&stwfb->textures[i], NULL);
 
@@ -273,7 +225,6 @@ stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
    struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
    unsigned front = ST_ATTACHMENT_FRONT_LEFT, back = ST_ATTACHMENT_BACK_LEFT;
    struct pipe_resource *ptex;
-   struct pipe_surface *psurf;
    unsigned mask;
 
    /* swap the textures */
@@ -281,11 +232,6 @@ stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
    stwfb->textures[front] = stwfb->textures[back];
    stwfb->textures[back] = ptex;
 
-   /* swap the surfaces */
-   psurf = stwfb->front_surface;
-   stwfb->front_surface = stwfb->back_surface;
-   stwfb->back_surface = psurf;
-
    /* convert to mask */
    front = 1 << front;
    back = 1 << back;
index 270fad56a19dd28fd5f87853815a630b60f35f5a..397065fc15905c447e8db84ebb063ea9fa69e2ae 100644 (file)
@@ -34,7 +34,7 @@
 
 struct pipe_screen;
 struct pipe_context;
-struct pipe_surface;
+struct pipe_resource;
 
 struct stw_shared_surface;
 
@@ -43,12 +43,13 @@ struct stw_winsys
    struct pipe_screen *
    (*create_screen)( void );
 
+   /* XXX is it actually possible to have non-zero level/layer ??? */
    /**
     * Present the color buffer to the window associated with the device context.
     */
    void
    (*present)( struct pipe_screen *screen,
-               struct pipe_surface *surf,
+               struct pipe_resource *res,
                HDC hDC );
 
    /**
@@ -85,7 +86,7 @@ struct stw_winsys
     */
    void
    (*compose)( struct pipe_screen *screen,
-               struct pipe_surface *src,
+               struct pipe_resource *res,
                struct stw_shared_surface *dest,
                LPCRECT pRect,
                ULONGLONG PresentHistoryToken );
index 4ff48026e50a73a79ada4b3492ea8262a6741772..d4dc84a122b1a6bfa16bef5cb2b2f45127addde9 100644 (file)
@@ -473,7 +473,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa,
                                   struct exa_pixmap_priv *pMask,
                                   struct exa_pixmap_priv *pDst)
 {
-   struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pDst);
+   struct pipe_surface *dst_surf = xorg_gpu_surface(exa->pipe, pDst);
 
    renderer_bind_destination(exa->renderer, dst_surf,
                              pDst->width,
@@ -529,7 +529,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
                               struct exa_pixmap_priv *pixmap,
                               Pixel fg)
 {
-   struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pixmap);
+   struct pipe_surface *dst_surf = xorg_gpu_surface(exa->pipe, pixmap);
    unsigned vs_traits, fs_traits;
    struct xorg_shader shader;
 
index 80af82d97b23eaf62ed24db23e9096492d774f6f..71f7b8c21d0379222d2e3c44299f8eea2f1b41a1 100644 (file)
@@ -133,6 +133,16 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
     if (ret)
        return FALSE;
 
+    /* Only set gamma when needed, to avoid unneeded delays. */
+#if defined(XF86_CRTC_VERSION) && XF86_CRTC_VERSION >= 3
+    if (!crtc->active)
+#endif
+       crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+                              crtc->gamma_blue, crtc->gamma_size);
+
+#if defined(XF86_CRTC_VERSION) && XF86_CRTC_VERSION >= 3
+    crtc->active = TRUE;
+#endif
     crtc->x = x;
     crtc->y = y;
     crtc->mode = *mode;
@@ -145,7 +155,10 @@ static void
 crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
               int size)
 {
-    /* XXX: hockup */
+    modesettingPtr ms = modesettingPTR(crtc->scrn);
+    struct crtc_private *crtcp = crtc->driver_private;
+
+    drmModeCrtcSetGamma(ms->fd, crtcp->drm_crtc->crtc_id, size, red, green, blue);
 }
 
 #if 0 /* Implement and enable to enable rotation and reflection. */
@@ -210,6 +223,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
        templat.target = PIPE_TEXTURE_2D;
        templat.last_level = 0;
        templat.depth0 = 1;
+       templat.array_size = 1;
        templat.format = PIPE_FORMAT_B8G8R8A8_UNORM;
        templat.width0 = 64;
        templat.height0 = 64;
@@ -225,9 +239,9 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
     }
 
     transfer = pipe_get_transfer(ms->ctx, crtcp->cursor_tex,
-                                         0, 0, 0,
-                                         PIPE_TRANSFER_WRITE,
-                                         0, 0, 64, 64);
+                                 0, 0,
+                                 PIPE_TRANSFER_WRITE,
+                                 0, 0, 64, 64);
     ptr = ms->ctx->transfer_map(ms->ctx, transfer);
     util_copy_rect(ptr, crtcp->cursor_tex->format,
                   transfer->stride, 0, 0,
index b723a8e9cb0cdcc5d917b121f6e7ac89031dedea..17c34b7eac851c55af0a4ca37051b20b4d7f7d96 100644 (file)
@@ -129,6 +129,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
            template.width0 = pDraw->width;
            template.height0 = pDraw->height;
            template.depth0 = 1;
+           template.array_size = 1;
            template.last_level = 0;
            template.bind = PIPE_BIND_DEPTH_STENCIL |
                PIPE_BIND_SHARED;
index 1ee79ae177e72bd9e73f6075ad63c3ebdad1039f..33bcacdcc2e5e480d52fcbd0956a2d00e1787f7c 100644 (file)
@@ -44,6 +44,7 @@
 #include "xf86Crtc.h"
 #include "miscstruct.h"
 #include "dixstruct.h"
+#include "xf86cmap.h"
 #include "xf86xv.h"
 #include "xorgVersion.h"
 #ifndef XSERVER_LIBPCIACCESS
@@ -414,6 +415,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
        return FALSE;
 
     switch (pScrn->depth) {
+    case 8:
     case 15:
     case 16:
     case 24:
@@ -538,44 +540,37 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
     return TRUE;
 }
 
-static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
-                              pointer pReadmask)
+void xorg_flush(ScreenPtr pScreen)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
     modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]);
 
-    pScreen->BlockHandler = ms->blockHandler;
-    pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
-    pScreen->BlockHandler = drv_block_handler;
-
     if (ms->ctx) {
-       int j;
+       int j;
 
-       ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE,
-                     ms->dirtyThrottling ?
-                     &ms->fence[XORG_NR_FENCES-1] :
-                     NULL);
+       ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE,
+                      ms->dirtyThrottling ?
+                      &ms->fence[XORG_NR_FENCES-1] :
+                      NULL);
        
-       if (ms->dirtyThrottling) {
-          if (ms->fence[0])
-              ms->ctx->screen->fence_finish(ms->ctx->screen,
-                                            ms->fence[0], 0);
+       if (ms->dirtyThrottling) {
+           if (ms->fence[0])
+               ms->ctx->screen->fence_finish(ms->ctx->screen,
+                                             ms->fence[0], 0);
   
-          /* The amount of rendering generated by a block handler can be
-           * quite small.  Let us get a fair way ahead of hardware before
-           * throttling.
-           */
-          for (j = 0; j < XORG_NR_FENCES - 1; j++)
-              ms->screen->fence_reference(ms->screen,
-                                          &ms->fence[j],
-                                          ms->fence[j+1]);
-
-          ms->screen->fence_reference(ms->screen,
-                                      &ms->fence[XORG_NR_FENCES-1],
-                                      NULL);
-       }
+           /* The amount of rendering generated by a block handler can be
+            * quite small.  Let us get a fair way ahead of hardware before
+            * throttling.
+            */
+           for (j = 0; j < XORG_NR_FENCES - 1; j++)
+               ms->screen->fence_reference(ms->screen,
+                                           &ms->fence[j],
+                                           ms->fence[j+1]);
+
+           ms->screen->fence_reference(ms->screen,
+                                       &ms->fence[XORG_NR_FENCES-1],
+                                       NULL);
+       }
     }
-        
 
 #ifdef DRM_MODE_FEATURE_DIRTYFB
     {
@@ -608,6 +603,19 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
 #endif
 }
 
+static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
+                              pointer pReadmask)
+{
+    ScreenPtr pScreen = screenInfo.screens[i];
+    modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]);
+
+    pScreen->BlockHandler = ms->blockHandler;
+    pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
+    pScreen->BlockHandler = drv_block_handler;
+
+    xorg_flush(pScreen);
+}
+
 static Bool
 drv_create_screen_resources(ScreenPtr pScreen)
 {
@@ -671,6 +679,65 @@ drv_set_master(ScrnInfoPtr pScrn)
 }
 
 
+static void drv_load_palette(ScrnInfoPtr pScrn, int numColors,
+                            int *indices, LOCO *colors, VisualPtr pVisual)
+{
+    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    modesettingPtr ms = modesettingPTR(pScrn);
+    int index, j, i;
+    int c;
+
+    switch(pScrn->depth) {
+    case 15:
+       for (i = 0; i < numColors; i++) {
+           index = indices[i];
+           for (j = 0; j < 8; j++) {
+               ms->lut_r[index * 8 + j] = colors[index].red << 8;
+               ms->lut_g[index * 8 + j] = colors[index].green << 8;
+               ms->lut_b[index * 8 + j] = colors[index].blue << 8;
+           }
+       }
+       break;
+    case 16:
+       for (i = 0; i < numColors; i++) {
+           index = indices[i];
+
+           if (index < 32) {
+               for (j = 0; j < 8; j++) {
+                   ms->lut_r[index * 8 + j] = colors[index].red << 8;
+                   ms->lut_b[index * 8 + j] = colors[index].blue << 8;
+               }
+           }
+
+           for (j = 0; j < 4; j++) {
+               ms->lut_g[index * 4 + j] = colors[index].green << 8;
+           }
+       }
+       break;
+    default:
+       for (i = 0; i < numColors; i++) {
+           index = indices[i];
+           ms->lut_r[index] = colors[index].red << 8;
+           ms->lut_g[index] = colors[index].green << 8;
+           ms->lut_b[index] = colors[index].blue << 8;
+       }
+       break;
+    }
+
+    for (c = 0; c < xf86_config->num_crtc; c++) {
+       xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+       /* Make the change through RandR */
+#ifdef RANDR_12_INTERFACE
+       if (crtc->randr_crtc)
+           RRCrtcGammaSet(crtc->randr_crtc, ms->lut_r, ms->lut_g, ms->lut_b);
+       else
+#endif
+           crtc->funcs->gamma_set(crtc, ms->lut_r, ms->lut_g, ms->lut_b, 256);
+    }
+}
+
+
 static Bool
 drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 {
@@ -810,6 +877,10 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     if (!miCreateDefColormap(pScreen))
        return FALSE;
+    if (!xf86HandleColormaps(pScreen, 256, 8, drv_load_palette, NULL,
+                            CMAP_PALETTED_TRUECOLOR |
+                            CMAP_RELOAD_ON_MODE_SWITCH))
+       return FALSE;
 
     xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
index 4b1c02bad42e323175185837ac1a4b573f08d7b9..718a3453939d3452f45e8dbff772e246359f6246 100644 (file)
@@ -46,6 +46,8 @@
 #include "util/u_math.h"
 #include "util/u_debug.h"
 #include "util/u_format.h"
+#include "util/u_box.h"
+#include "util/u_surface.h"
 
 #define DEBUG_PRINT 0
 #define ROUND_UP_TEXTURES 1
@@ -188,8 +190,8 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x,  int y, int w,  int h, char *dst,
     if (!priv || !priv->tex)
        return FALSE;
 
-    transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0,
-                                          PIPE_TRANSFER_READ, x, y, w, h);
+    transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
+                                 PIPE_TRANSFER_READ, x, y, w, h);
     if (!transfer)
        return FALSE;
 
@@ -222,8 +224,8 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
     if (!priv || !priv->tex)
        return FALSE;
 
-    transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0,
-                                          PIPE_TRANSFER_WRITE, x, y, w, h);
+    transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
+                                 PIPE_TRANSFER_WRITE, x, y, w, h);
     if (!transfer)
        return FALSE;
 
@@ -265,7 +267,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
         assert(pPix->drawable.height <= priv->tex->height0);
 
        priv->map_transfer =
-          pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0,
+          pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
 #ifdef EXA_MIXED_PIXMAPS
                                        PIPE_TRANSFER_MAP_DIRECTLY |
 #endif
@@ -449,6 +451,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
        exa->copy.use_surface_copy = TRUE;
     }
     else {
+       struct pipe_surface surf_tmpl;
        exa->copy.use_surface_copy = FALSE;
 
        if (exa->copy.dst == exa->copy.src)
@@ -458,11 +461,13 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
           pipe_resource_reference(&exa->copy.src_texture,
                                  exa->copy.src->tex);
 
+       memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+       u_surface_default_template(&surf_tmpl, exa->copy.dst->tex,
+                                  PIPE_BIND_RENDER_TARGET);
        exa->copy.dst_surface =
-          exa->scrn->get_tex_surface(exa->scrn,
-                                     exa->copy.dst->tex,
-                                     0, 0, 0,
-                                     PIPE_BIND_RENDER_TARGET);
+          exa->pipe->create_surface(exa->pipe,
+                                    exa->copy.dst->tex,
+                                    &surf_tmpl);
 
 
        renderer_copy_prepare(exa->renderer, 
@@ -492,19 +497,14 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
    (void) priv;
 
    if (exa->copy.use_surface_copy) {
-      struct pipe_subresource subdst, subsrc;
-      subdst.face = 0;
-      subdst.level = 0;
-      subsrc.face = 0;
-      subsrc.level = 0;
+      struct pipe_box src_box;
+      u_box_2d(srcX, srcY, width, height, &src_box);
       exa->pipe->resource_copy_region( exa->pipe,
                                        exa->copy.dst->tex,
-                                       subdst,
+                                       0,
                                        dstX, dstY, 0,
                                        exa->copy.src->tex,
-                                       subsrc,
-                                       srcX, srcY, 0,
-                                       width, height );
+                                       0, &src_box);
    }
    else {
       renderer_copy_pixmap(exa->renderer, 
@@ -874,24 +874,21 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
         }
 
        template.depth0 = 1;
+       template.array_size = 1;
        template.last_level = 0;
        template.bind = PIPE_BIND_RENDER_TARGET | priv->flags;
        priv->tex_flags = priv->flags;
        texture = exa->scrn->resource_create(exa->scrn, &template);
 
        if (priv->tex) {
-           struct pipe_subresource subdst, subsrc;
-
-           subdst.face = 0;
-           subdst.level = 0;
-           subsrc.face = 0;
-           subsrc.level = 0;
+            struct pipe_box src_box;
+            u_box_origin_2d(min(width, texture->width0),
+                            min(height, texture->height0),
+                            &src_box);
             exa->pipe->resource_copy_region(exa->pipe, texture,
-                                            subdst, 0, 0, 0,
+                                            0, 0, 0, 0,
                                             priv->tex,
-                                            subsrc, 0, 0, 0,
-                                            min(width, texture->width0),
-                                            min(height, texture->height0));
+                                            0, &src_box);
        }
 
        pipe_resource_reference(&priv->tex, texture);
@@ -947,6 +944,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
     template.width0 = width;
     template.height0 = height;
     template.depth0 = 1;
+    template.array_size = 1;
     template.last_level = 0;
     template.bind |= PIPE_BIND_RENDER_TARGET;
     template.bind |= PIPE_BIND_SCANOUT;
@@ -1063,10 +1061,14 @@ out_err:
 }
 
 struct pipe_surface *
-xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv)
+xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv)
 {
-   return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0,
-                                PIPE_BIND_RENDER_TARGET);
+   struct pipe_surface surf_tmpl;
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   u_surface_default_template(&surf_tmpl, priv->tex,
+                              PIPE_BIND_RENDER_TARGET);
+
+   return pipe->create_surface(pipe, priv->tex, &surf_tmpl);
 
 }
 
index 86a1afc06e660cac1750744899a77b69459e8d32..1f78f60be743f8f6237359d4e3d98715acd36603 100644 (file)
@@ -72,7 +72,7 @@ do {                                                          \
 } while(0)
 
 struct pipe_surface *
-xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv);
+xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv);
 
 void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags,
                     struct pipe_fence_handle **fence);
index 92f1cc50653bf0ffec05b934a2b8eb2349b1ca7d..a3d7c5a70e21d4af59dee3e7c705c5bd49f33d6a 100644 (file)
@@ -10,6 +10,7 @@
 #include "util/u_sampler.h"
 
 #include "util/u_inlines.h"
+#include "util/u_box.h"
 
 #include <math.h>
 
@@ -535,6 +536,7 @@ renderer_clone_texture(struct xorg_renderer *r,
    templ.width0 = src->width0;
    templ.height0 = src->height0;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    pt = screen->resource_create(screen, &templ);
@@ -546,19 +548,15 @@ renderer_clone_texture(struct xorg_renderer *r,
 
    {
       /* copy source framebuffer surface into texture */
-      struct pipe_subresource subsrc, subdst;
-      subsrc.face = 0;
-      subsrc.level = 0;
-      subdst.face = 0;
-      subdst.level = 0;
+      struct pipe_box src_box;
+      u_box_origin_2d(src->width0, src->height0, &src_box);
+
       pipe->resource_copy_region(pipe,
                                  pt, /* dest */
-                                 subdst,
+                                 0, /* dest_level */
                                  0, 0, 0, /* destx/y/z */
                                  src,
-                                 subsrc,
-                                 0, 0, 0,
-                                 src->width0, src->height0);
+                                 0, &src_box);
    }
 
    return pt;
index a3fb5e5dad0551402147dbc218fd55d84f91ac60..664e8c75730477ed386aa56b9ed8a8ab6e3beb11 100644 (file)
@@ -129,6 +129,7 @@ typedef struct _modesettingRec
     /* kms */
     struct kms_driver *kms;
     struct kms_bo *root_bo;
+    uint16_t lut_r[256], lut_g[256], lut_b[256];
 
     /* gallium */
     struct pipe_screen *screen;
@@ -156,6 +157,7 @@ CustomizerPtr xorg_customizer(ScrnInfoPtr pScrn);
 
 Bool xorg_has_gallium(ScrnInfoPtr pScrn);
 
+void xorg_flush(ScreenPtr pScreen);
 /***********************************************************************
  * xorg_exa.c
  */
index f64959f00e914620bc8ec84cc3358e9a2124ae04..c72ba9ef8dbd67b1346d055db988a6e56c0a1acb 100644 (file)
@@ -171,6 +171,7 @@ create_component_texture(struct pipe_context *pipe,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &templ);
@@ -312,17 +313,17 @@ copy_packed_data(ScrnInfoPtr pScrn,
    int y_array_size = w * h;
 
    ytrans = pipe_get_transfer(pipe, dst[0],
-                                   0, 0, 0,
-                                   PIPE_TRANSFER_WRITE,
-                                   left, top, w, h);
+                              0, 0,
+                              PIPE_TRANSFER_WRITE,
+                              left, top, w, h);
    utrans = pipe_get_transfer(pipe, dst[1],
-                                   0, 0, 0,
-                                   PIPE_TRANSFER_WRITE,
-                                   left, top, w, h);
+                              0, 0,
+                              PIPE_TRANSFER_WRITE,
+                              left, top, w, h);
    vtrans = pipe_get_transfer(pipe, dst[2],
-                                   0, 0, 0,
-                                   PIPE_TRANSFER_WRITE,
-                                   left, top, w, h);
+                              0, 0,
+                              PIPE_TRANSFER_WRITE,
+                              left, top, w, h);
 
    ymap = (char*)pipe->transfer_map(pipe, ytrans);
    umap = (char*)pipe->transfer_map(pipe, utrans);
@@ -533,7 +534,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
    if (!dst || !dst->tex)
       XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex");
 
-   dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
+   dst_surf = xorg_gpu_surface(pPriv->r->pipe, dst);
    hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
 
 #ifdef COMPOSITE
diff --git a/src/gallium/targets/dri-noop/Makefile b/src/gallium/targets/dri-noop/Makefile
deleted file mode 100644 (file)
index 21c5f4f..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-TOP = ../../../..
-include $(TOP)/configs/current
-
-LIBNAME = noop_dri.so
-
-DRIVER_DEFINES = \
-       -D__NOT_HAVE_DRM_H
-
-PIPE_DRIVERS = \
-       $(TOP)/src/gallium/state_trackers/dri/sw/libdrisw.a \
-       $(TOP)/src/gallium/winsys/sw/dri/libswdri.a \
-       $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-       $(TOP)/src/gallium/drivers/trace/libtrace.a \
-       $(TOP)/src/gallium/drivers/rbug/librbug.a \
-       $(TOP)/src/gallium/drivers/noop/libnoop.a
-
-SWRAST_COMMON_GALLIUM_SOURCES = \
-       $(TOP)/src/mesa/drivers/dri/common/utils.c \
-       $(TOP)/src/mesa/drivers/dri/common/drisw_util.c \
-       $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c
-
-C_SOURCES = \
-       swrast_drm_api.c \
-       $(SWRAST_COMMON_GALLIUM_SOURCES) \
-       $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.dri
-
-INCLUDES += \
-       -I$(TOP)/src/gallium/winsys/sw/dri
-
-symlinks:
diff --git a/src/gallium/targets/dri-noop/SConscript b/src/gallium/targets/dri-noop/SConscript
deleted file mode 100644 (file)
index 9c04ee6..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-env.Append(CPPPATH = [
-    '#/src/gallium/winsys/sw/dri',
-])
-
-env.Prepend(LIBS = [
-    st_drisw,
-    ws_dri,
-    noop,
-    mesa,
-    glsl,
-    gallium,
-    COMMON_DRI_SW_OBJECTS
-])
-
-env.Prepend(LIBS = [noop])
-
-swrastg_sources = [
-    'swrast_drm_api.c'
-]
-
-module = env.LoadableModule(
-    target ='noop_dri.so',
-    source = swrastg_sources,
-    SHLIBPREFIX = '',
-)
-
-env.Alias('dri-noop', module)
diff --git a/src/gallium/targets/dri-noop/swrast_drm_api.c b/src/gallium/targets/dri-noop/swrast_drm_api.c
deleted file mode 100644 (file)
index a99779f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "pipe/p_compiler.h"
-#include "util/u_memory.h"
-#include "dri_sw_winsys.h"
-#include "noop/noop_public.h"
-
-#include "target-helpers/inline_debug_helper.h"
-#include "target-helpers/inline_sw_helper.h"
-
-
-struct pipe_screen *
-drisw_create_screen(struct drisw_loader_funcs *lf)
-{
-   struct sw_winsys *winsys = NULL;
-   struct pipe_screen *screen = NULL;
-
-   winsys = dri_create_sw_winsys(lf);
-   if (winsys == NULL)
-      return NULL;
-
-   screen = noop_screen_create(winsys);
-   if (!screen)
-      goto fail;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-
-fail:
-   if (winsys)
-      winsys->destroy(winsys);
-
-   return NULL;
-}
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
index 2f64f312b841cdad42c8f7120ddd8ac10fd4a5b4..eb1ee859a00389a594b18c1b5ded32fcec1332ca 100644 (file)
@@ -10,6 +10,7 @@ PIPE_DRIVERS = \
        $(TOP)/src/gallium/drivers/rbug/librbug.a \
        $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
        $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+       $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
        $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
 
 C_SOURCES = \
index 661283de6a837784bb49f7cf33ebf650cf1387b6..c8fae2d85851641bce0f6095f26810b58dc99cd0 100644 (file)
@@ -9,7 +9,8 @@ PIPE_DRIVERS = \
        $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
        $(TOP)/src/gallium/drivers/trace/libtrace.a \
-       $(TOP)/src/gallium/drivers/rbug/librbug.a
+       $(TOP)/src/gallium/drivers/rbug/librbug.a \
+       $(TOP)/src/gallium/drivers/noop/libnoop.a
 
 C_SOURCES = \
        target.c \
@@ -17,7 +18,7 @@ C_SOURCES = \
        $(DRIVER_SOURCES)
 
 DRIVER_DEFINES = \
-       -DGALLIUM_RBUG -DGALLIUM_TRACE
+       -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_NOOP
 
 include ../Makefile.dri
 
index 8753e2bab1759bbc7990d45c60f571da16a00ea5..2fe345402de95f157725443f89c45fa6a9ee61e3 100644 (file)
@@ -1,5 +1,5 @@
 #include "state_tracker/drm_driver.h"
-#include "target-helpers/inline_debug_helper.h"
+#include "target-helpers/inline_noop_helper.h"
 #include "r600/drm/r600_drm_public.h"
 #include "r600/r600_public.h"
 
index 7888e4f2c8bc9c0e7aa2f7aa3ffa4b7c2f883562..17dd02105121688a724951e31a91b42de8021273 100644 (file)
@@ -2,14 +2,14 @@ Import('*')
 
 env = drienv.Clone()
 
-env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE'])
+if True:
+    env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD', 'GALLIUM_SOFTPIPE'])
+    env.Prepend(LIBS = [trace, rbug, galahad, softpipe, ws_wrapper])
 
 env.Prepend(LIBS = [
     st_dri,
     svgadrm,
     svga,
-    trace,
-    rbug,
     mesa,
     glsl,
     gallium,
@@ -22,4 +22,4 @@ module = env.LoadableModule(
     SHLIBPREFIX = '',
 )
 
-env.Alias('dri-vmwgfx', module)
\ No newline at end of file
+env.Alias('dri-vmwgfx', module)
index 15089d6db264a20126697f4aeb6ee36e2c627e97..1362851d6bef866d674db97eb83d2e621e241645 100644 (file)
@@ -1,4 +1,5 @@
 
+#include "target-helpers/inline_wrapper_sw_helper.h"
 #include "target-helpers/inline_debug_helper.h"
 #include "state_tracker/drm_driver.h"
 #include "svga/drm/svga_drm_public.h"
@@ -18,6 +19,8 @@ create_screen(int fd)
    if (!screen)
       return NULL;
 
+   screen = sw_screen_wrap(screen);
+
    screen = debug_screen_wrap(screen);
 
    return screen;
diff --git a/src/gallium/targets/egl-gdi/SConscript b/src/gallium/targets/egl-gdi/SConscript
deleted file mode 100644 (file)
index d52eeb7..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#######################################################################
-# SConscript for egl-gdi target
-
-Import('*')
-
-env = env.Clone()
-
-env.Append(CPPPATH = [
-        '#/src/gallium/state_trackers/egl',
-        '#/src/gallium/state_trackers/vega',
-        '#/src/egl/main',
-        '#/src/mesa',
-])
-
-env.Append(CPPDEFINES = [
-        'FEATURE_VG=1',
-        'GALLIUM_SOFTPIPE',
-        'GALLIUM_RBUG',
-        'GALLIUM_TRACE',
-])
-
-env.Append(LIBS = [
-    'gdi32',
-    'user32',
-    'kernel32',
-    'ws2_32',
-])
-
-env.Prepend(LIBS = [
-    st_egl_gdi,
-    ws_gdi,
-    identity,
-    trace,
-    rbug,
-    softpipe,
-    vgapi,
-    st_vega,
-    gallium,
-    egl,
-])
-
-if env['llvm']:
-    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-    env.Prepend(LIBS = [llvmpipe])
-
-egl_gallium = env.SharedLibrary(
-    target ='egl_gallium',
-    source = 'egl-static.c',
-)
-
-env['no_import_lib'] = 1
-
-egl_gdi = env.InstallSharedLibrary(egl_gallium)
-
-env.Alias('egl-gdi', egl_gdi)
diff --git a/src/gallium/targets/egl-gdi/egl-static.c b/src/gallium/targets/egl-gdi/egl-static.c
deleted file mode 100644 (file)
index da6e5ce..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.9
- *
- * Copyright (C) 2010 LunarG Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *    Chia-I Wu <olv@lunarg.com>
- */
-
-#include "common/egl_g3d_loader.h"
-#include "state_tracker/st_gl_api.h"
-#include "vg_api.h"
-#include "target-helpers/inline_sw_helper.h"
-#include "target-helpers/inline_debug_helper.h"
-#include "egldriver.h"
-
-static struct st_api *stapis[ST_API_COUNT];
-
-static struct st_api *
-get_st_api(enum st_api_type api)
-{
-   struct st_api *stapi;
-
-   stapi = stapis[api];
-   if (stapi)
-      return stapi;
-
-   switch (api) {
-#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
-   case ST_API_OPENGL:
-      stapi = st_gl_api_create();
-      break;
-#endif
-#if FEATURE_VG
-   case ST_API_OPENVG:
-      stapi = (struct st_api *) vg_api_get();
-      break;
-#endif
-   default:
-      break;
-   }
-
-   stapis[api] = stapi;
-
-   return stapi;
-}
-
-static struct st_api *
-guess_gl_api(enum st_profile_type profile)
-{
-   return get_st_api(ST_API_OPENGL);
-}
-
-static struct pipe_screen *
-create_drm_screen(const char *name, int fd)
-{
-   return NULL;
-}
-
-static struct pipe_screen *
-create_sw_screen(struct sw_winsys *ws)
-{
-   struct pipe_screen *screen;
-
-   screen = sw_screen_create(ws);
-   if (screen)
-      screen = debug_screen_wrap(screen);
-
-   return screen;
-}
-
-static void
-init_loader(struct egl_g3d_loader *loader)
-{
-#if FEATURE_GL
-   loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_DEFAULT_MASK;
-#endif
-#if FEATURE_ES1
-   loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES1_MASK;
-#endif
-#if FEATURE_ES2
-   loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES2_MASK;
-#endif
-#if FEATURE_VG
-   loader->profile_masks[ST_API_OPENVG] |= ST_PROFILE_DEFAULT_MASK;
-#endif
-
-   loader->get_st_api = get_st_api;
-   loader->guess_gl_api = guess_gl_api;
-   loader->create_drm_screen = create_drm_screen;
-   loader->create_sw_screen = create_sw_screen;
-}
-
-static void
-egl_g3d_unload(_EGLDriver *drv)
-{
-   int i;
-
-   egl_g3d_destroy_driver(drv);
-
-   for (i = 0; i < ST_API_COUNT; i++) {
-      if (stapis[i]) {
-         stapis[i]->destroy(stapis[i]);
-         stapis[i] = NULL;
-      }
-   }
-}
-
-static struct egl_g3d_loader loader;
-
-_EGLDriver *
-_eglMain(const char *args)
-{
-   _EGLDriver *drv;
-
-   init_loader(&loader);
-   drv = egl_g3d_create_driver(&loader);
-   if (drv) {
-      drv->Name = "Gallium";
-      drv->Unload = egl_g3d_unload;
-   }
-
-   return drv;
-}
diff --git a/src/gallium/targets/egl-static/SConscript b/src/gallium/targets/egl-static/SConscript
new file mode 100644 (file)
index 0000000..381ef4e
--- /dev/null
@@ -0,0 +1,127 @@
+#######################################################################
+# SConscript for egl-static target
+
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+    '#/include',
+    '#/src/egl/main',
+    '#/src/gallium/auxiliary',
+    '#/src/gallium/drivers',
+    '#/src/gallium/include',
+    '#/src/gallium/winsys',
+    '#/src/gallium/state_trackers/egl',
+    '#/src/gallium/state_trackers/vega',
+    '#/src/mesa',
+])
+
+env.Append(CPPDEFINES = [
+    'GALLIUM_SOFTPIPE',
+    'GALLIUM_RBUG',
+    'GALLIUM_TRACE',
+    'GALLIUM_GALAHAD',
+    '_EGL_MAIN=_eglBuiltInDriverGALLIUM',
+])
+
+env.Prepend(LIBS = [
+    softpipe,
+    rbug,
+    trace,
+    galahad,
+    gallium,
+    egl,
+    st_egl,
+])
+
+if env['llvm']:
+    env.Append(CPPDEFINES = ['GALLIUM_LLVMPIPE'])
+    env.Prepend(LIBS = [llvmpipe])
+
+sources = [
+    'egl.c',
+    'egl_pipe.c',
+    'egl_st.c',
+]
+
+if env['platform'] == 'windows':
+    sources.append('#src/egl/main/egl.def')
+
+    env.Append(LIBS = [
+        'gdi32',
+        'user32',
+        'kernel32',
+        'ws2_32',
+    ])
+
+    env.Prepend(LIBS = [
+        ws_gdi,
+    ])
+else:
+    # OpenGL
+    env.Append(CPPDEFINES = ['FEATURE_GL=1'])
+    env.Prepend(LIBS = ['GL', 'talloc', glsl, mesa])
+
+# OpenVG
+if True:
+    env.Append(CPPDEFINES = ['FEATURE_VG=1'])
+    env.Prepend(LIBPATH = [openvg.dir])
+    # manually add LIBPREFIX on windows
+    openvg_name = 'OpenVG' if env['platform'] != 'windows' else 'libOpenVG'
+    env.Prepend(LIBS = [openvg_name, st_vega])
+
+if env['x11']:
+    env.Prepend(LIBS = [
+        ws_xlib,
+        env['X11_LIBS'],
+    ])
+
+if env['dri']:
+    env.ParseConfig('pkg-config --cflags --libs xfixes')
+
+# pipe drivers
+if env['drm']:
+    env.ParseConfig('pkg-config --cflags --libs libdrm')
+
+    if env['drm_intel']:
+        env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
+        env.Append(CPPDEFINES = ['_EGL_PIPE_I915', '_EGL_PIPE_I965'])
+        env.Prepend(LIBS = [
+            i915drm,
+            i915,
+            i965drm,
+            i965,
+            ws_wrapper,
+        ])
+
+    if env['drm_radeon']:
+        env.ParseConfig('pkg-config --cflags --libs libdrm_radeon')
+        env.Append(CPPDEFINES = ['_EGL_PIPE_R300', '_EGL_PIPE_R600'])
+        env.Prepend(LIBS = [
+            radeonwinsys,
+            r300,
+            r600winsys,
+            r600,
+        ])
+
+    env.Append(CPPDEFINES = ['_EGL_PIPE_VMWGFX'])
+    env.Prepend(LIBS = [
+        svgadrm,
+        svga,
+    ])
+
+# libEGL.dll
+env['LIBPREFIX'] = 'lib'
+env['SHLIBPREFIX'] = 'lib'
+
+egl_gallium = env.SharedLibrary(
+    target ='EGL',
+    source = sources,
+)
+
+env.Depends(egl_gallium, [openvg])
+
+egl_gallium = env.InstallSharedLibrary(egl_gallium, version=(1, 4, 0))
+
+env.Alias('egl-gallium', egl_gallium)
diff --git a/src/gallium/targets/egl-static/egl.c b/src/gallium/targets/egl-static/egl.c
new file mode 100644 (file)
index 0000000..e617ff5
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.10
+ *
+ * Copyright (C) 2010-2011 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "common/egl_g3d_loader.h"
+#include "egldriver.h"
+
+#include "egl_pipe.h"
+#include "egl_st.h"
+
+static struct egl_g3d_loader egl_g3d_loader;
+
+static struct st_module {
+   boolean initialized;
+   struct st_api *stapi;
+} st_modules[ST_API_COUNT];
+
+static struct st_api *
+get_st_api(enum st_api_type api)
+{
+   struct st_module *stmod = &st_modules[api];
+
+   if (!stmod->initialized) {
+      stmod->stapi = egl_st_create_api(api);
+      stmod->initialized = TRUE;
+   }
+
+   return stmod->stapi;
+}
+
+static struct st_api *
+guess_gl_api(enum st_profile_type profile)
+{
+   return get_st_api(ST_API_OPENGL);
+}
+
+static struct pipe_screen *
+create_drm_screen(const char *name, int fd)
+{
+   return egl_pipe_create_drm_screen(name, fd);
+}
+
+static struct pipe_screen *
+create_sw_screen(struct sw_winsys *ws)
+{
+   return egl_pipe_create_swrast_screen(ws);
+}
+
+static const struct egl_g3d_loader *
+loader_init(void)
+{
+   int i;
+
+   for (i = 0; i < ST_API_COUNT; i++)
+      egl_g3d_loader.profile_masks[i] = egl_st_get_profile_mask(i);
+
+   egl_g3d_loader.get_st_api = get_st_api;
+   egl_g3d_loader.guess_gl_api = guess_gl_api;
+   egl_g3d_loader.create_drm_screen = create_drm_screen;
+   egl_g3d_loader.create_sw_screen = create_sw_screen;
+
+   return &egl_g3d_loader;
+}
+
+static void
+loader_fini(void)
+{
+   int i;
+
+   for (i = 0; i < ST_API_COUNT; i++) {
+      struct st_module *stmod = &st_modules[i];
+
+      if (stmod->stapi) {
+         stmod->stapi->destroy(stmod->stapi);
+         stmod->stapi = NULL;
+      }
+      stmod->initialized = FALSE;
+   }
+}
+
+static void
+egl_g3d_unload(_EGLDriver *drv)
+{
+   egl_g3d_destroy_driver(drv);
+   loader_fini();
+}
+
+_EGLDriver *
+_EGL_MAIN(const char *args)
+{
+   const struct egl_g3d_loader *loader;
+   _EGLDriver *drv;
+
+   loader = loader_init();
+   drv = egl_g3d_create_driver(loader);
+   if (!drv) {
+      loader_fini();
+      return NULL;
+   }
+
+   drv->Name = "Gallium";
+   drv->Unload = egl_g3d_unload;
+
+   return drv;
+}
diff --git a/src/gallium/targets/egl-static/egl_pipe.c b/src/gallium/targets/egl-static/egl_pipe.c
new file mode 100644 (file)
index 0000000..a33d419
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.10
+ *
+ * Copyright (C) 2011 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Chia-I Wu <olv@lunarg.com>
+ */
+#include "target-helpers/inline_debug_helper.h"
+#include "target-helpers/inline_sw_helper.h"
+#include "egl_pipe.h"
+
+/* for i915 */
+#include "i915/drm/i915_drm_public.h"
+#include "i915/i915_public.h"
+/* for i965 */
+#include "target-helpers/inline_wrapper_sw_helper.h"
+#include "i965/drm/i965_drm_public.h"
+#include "i965/brw_public.h"
+/* for nouveau */
+#include "nouveau/drm/nouveau_drm_public.h"
+/* for r300 */
+#include "radeon/drm/radeon_drm_public.h"
+#include "r300/r300_public.h"
+/* for r600 */
+#include "r600/drm/r600_drm_public.h"
+#include "r600/r600_public.h"
+/* for vmwgfx */
+#include "svga/drm/svga_drm_public.h"
+#include "svga/svga_public.h"
+
+static struct pipe_screen *
+pipe_i915_create_screen(int fd)
+{
+#if _EGL_PIPE_I915
+   struct i915_winsys *iws;
+   struct pipe_screen *screen;
+
+   iws = i915_drm_winsys_create(fd);
+   if (!iws)
+      return NULL;
+
+   screen = i915_screen_create(iws);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+#else
+   return NULL;
+#endif
+}
+
+static struct pipe_screen *
+pipe_i965_create_screen(int fd)
+{
+#if _EGL_PIPE_I965
+   struct brw_winsys_screen *bws;
+   struct pipe_screen *screen;
+
+   bws = i965_drm_winsys_screen_create(fd);
+   if (!bws)
+      return NULL;
+
+   screen = brw_screen_create(bws);
+   if (!screen)
+      return NULL;
+
+   screen = sw_screen_wrap(screen);
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+#else
+   return NULL;
+#endif
+}
+
+static struct pipe_screen *
+pipe_nouveau_create_screen(int fd)
+{
+#if _EGL_PIPE_NOUVEAU
+   struct pipe_screen *screen;
+
+   screen = nouveau_drm_screen_create(fd);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+#else
+   return NULL;
+#endif
+}
+
+static struct pipe_screen *
+pipe_r300_create_screen(int fd)
+{
+#if _EGL_PIPE_R300
+   struct r300_winsys_screen *sws;
+   struct pipe_screen *screen;
+
+   sws = r300_drm_winsys_screen_create(fd);
+   if (!sws)
+      return NULL;
+
+   screen = r300_screen_create(sws);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+#else
+   return NULL;
+#endif
+}
+
+static struct pipe_screen *
+pipe_r600_create_screen(int fd)
+{
+#if _EGL_PIPE_R600
+   struct radeon *rw;
+   struct pipe_screen *screen;
+
+   rw = r600_drm_winsys_create(fd);
+   if (!rw)
+      return NULL;
+
+   screen = r600_screen_create(rw);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+#else
+   return NULL;
+#endif
+}
+
+static struct pipe_screen *
+pipe_vmwgfx_create_screen(int fd)
+{
+#if _EGL_PIPE_VMWGFX
+   struct svga_winsys_screen *sws;
+   struct pipe_screen *screen;
+
+   sws = svga_drm_winsys_screen_create(fd);
+   if (!sws)
+      return NULL;
+
+   screen = svga_screen_create(sws);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+#else
+   return NULL;
+#endif
+}
+
+struct pipe_screen *
+egl_pipe_create_drm_screen(const char *name, int fd)
+{
+   if (strcmp(name, "i915") == 0)
+      return pipe_i915_create_screen(fd);
+   else if (strcmp(name, "i965") == 0)
+      return pipe_i965_create_screen(fd);
+   else if (strcmp(name, "nouveau") == 0)
+      return pipe_nouveau_create_screen(fd);
+   else if (strcmp(name, "r300") == 0)
+      return pipe_r300_create_screen(fd);
+   else if (strcmp(name, "r600") == 0)
+      return pipe_r600_create_screen(fd);
+   else if (strcmp(name, "vmwgfx") == 0)
+      return pipe_vmwgfx_create_screen(fd);
+   else
+      return NULL;
+}
+
+struct pipe_screen *
+egl_pipe_create_swrast_screen(struct sw_winsys *ws)
+{
+   struct pipe_screen *screen;
+
+   screen = sw_screen_create(ws);
+   if (screen)
+      screen = debug_screen_wrap(screen);
+
+   return screen;
+}
diff --git a/src/gallium/targets/egl-static/egl_pipe.h b/src/gallium/targets/egl-static/egl_pipe.h
new file mode 100644 (file)
index 0000000..569b2d0
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.10
+ *
+ * Copyright (C) 2011 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Chia-I Wu <olv@lunarg.com>
+ */
+#ifndef _EGL_PIPE_H_
+#define _EGL_PIPE_H_
+
+struct pipe_screen;
+struct sw_winsys;
+
+struct pipe_screen *
+egl_pipe_create_drm_screen(const char *name, int fd);
+
+struct pipe_screen *
+egl_pipe_create_swrast_screen(struct sw_winsys *ws);
+
+#endif /* _EGL_PIPE_H_ */
diff --git a/src/gallium/targets/egl-static/egl_st.c b/src/gallium/targets/egl-static/egl_st.c
new file mode 100644 (file)
index 0000000..3db5262
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.10
+ *
+ * Copyright (C) 2011 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Chia-I Wu <olv@lunarg.com>
+ */
+#include "util/u_debug.h"
+#include "state_tracker/st_api.h"
+#include "egl_st.h"
+
+/* for st/mesa */
+#include "state_tracker/st_gl_api.h"
+/* for st/vega */
+#include "vg_api.h"
+
+static struct st_api *
+st_GL_create_api(void)
+{
+#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
+   return st_gl_api_create();
+#else
+   return NULL;
+#endif
+}
+
+static struct st_api *
+st_OpenVG_create_api(void)
+{
+#if FEATURE_VG
+   return (struct st_api *) vg_api_get();
+#else
+   return NULL;
+#endif
+}
+
+struct st_api *
+egl_st_create_api(enum st_api_type api)
+{
+   struct st_api *stapi;
+
+   switch (api) {
+   case ST_API_OPENGL:
+      stapi = st_GL_create_api();
+      break;
+   case ST_API_OPENVG:
+      stapi = st_OpenVG_create_api();
+      break;
+   default:
+      assert(!"Unknown API Type\n");
+      stapi = NULL;
+      break;
+   }
+
+   return stapi;
+}
+
+uint
+egl_st_get_profile_mask(enum st_api_type api)
+{
+   uint mask = 0x0;
+
+   switch (api) {
+   case ST_API_OPENGL:
+#if FEATURE_GL
+      mask |= ST_PROFILE_DEFAULT_MASK;
+#endif
+#if FEATURE_ES1
+      mask |= ST_PROFILE_OPENGL_ES1_MASK;
+#endif
+#if FEATURE_ES2
+      mask |= ST_PROFILE_OPENGL_ES2_MASK;
+#endif
+      break;
+   case ST_API_OPENVG:
+#if FEATURE_VG
+      mask |= ST_PROFILE_DEFAULT_MASK;
+#endif
+      break;
+   default:
+      break;
+   }
+
+   return mask;
+}
diff --git a/src/gallium/targets/egl-static/egl_st.h b/src/gallium/targets/egl-static/egl_st.h
new file mode 100644 (file)
index 0000000..ba82faf
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.10
+ *
+ * Copyright (C) 2011 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Chia-I Wu <olv@lunarg.com>
+ */
+#ifndef _EGL_ST_H_
+#define _EGL_ST_H_
+
+#include "pipe/p_compiler.h"
+#include "state_tracker/st_api.h"
+
+struct st_api *
+egl_st_create_api(enum st_api_type api);
+
+uint
+egl_st_get_profile_mask(enum st_api_type api);
+
+#endif /* _EGL_ST_H_ */
index 63e9352144e21d58ef01bf96e39a8ea05f14bd1b..017c1952141ec3ff5e8aa8b67926d22bd63fc35b 100644 (file)
@@ -57,12 +57,6 @@ endif
 ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),)
 egl_CPPFLAGS += $(API_DEFINES)
 endif
-ifneq ($(filter $(GLESv1_CM_LIB), $(EGL_CLIENT_APIS)),)
-egl_CPPFLAGS += -DFEATURE_ES1=1
-endif
-ifneq ($(filter $(GLESv2_LIB), $(EGL_CLIENT_APIS)),)
-egl_CPPFLAGS += -DFEATURE_ES2=1
-endif
 ifneq ($(filter $(VG_LIB), $(EGL_CLIENT_APIS)),)
 egl_CPPFLAGS += -DFEATURE_VG=1
 endif
@@ -80,7 +74,8 @@ i965_CPPFLAGS :=
 i965_SYS := -ldrm_intel
 i965_LIBS := \
        $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
-       $(TOP)/src/gallium/drivers/i965/libi965.a
+       $(TOP)/src/gallium/drivers/i965/libi965.a \
+       $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
 
 # nouveau pipe driver
 nouveau_CPPFLAGS :=
@@ -89,6 +84,7 @@ nouveau_LIBS := \
        $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
        $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
        $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+       $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
        $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
 
 # r300 pipe driver
@@ -127,20 +123,10 @@ endif
 
 # OpenGL state tracker
 GL_CPPFLAGS := -I$(TOP)/src/mesa $(API_DEFINES)
-# do not link to $(GL_LIB) as the it supports GLES too
+# cannot not link to $(GL_LIB) as the app might want GLES
 GL_SYS := $(DRI_LIB_DEPS)
 GL_LIBS := $(TOP)/src/mesa/libmesagallium.a
 
-# OpenGL ES 1.x state tracker
-GLESv1_CM_CPPFLAGS := -I$(TOP)/src/mesa
-GLESv1_CM_SYS := $(DRI_LIB_DEPS) -l$(GLESv1_CM_LIB)
-GLESv1_CM_LIBS := $(TOP)/src/mesa/libes1gallium.a
-
-# OpenGL ES 2.x state tracker
-GLESv2_CPPFLAGS := -I$(TOP)/src/mesa
-GLESv2_SYS := $(DRI_LIB_DEPS) -l$(GLESv2_LIB)
-GLESv2_LIBS := $(TOP)/src/mesa/libes2gallium.a
-
 # OpenVG state tracker
 OpenVG_CPPFLAGS := -I$(TOP)/src/gallium/state_trackers/vega
 OpenVG_SYS := -lm -l$(VG_LIB)
@@ -225,12 +211,6 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)swrast.so: pipe_swrast.o $(swrast_LIBS)
 $(OUTPUT_PATH)/$(ST_PREFIX)$(GL_LIB).so: st_GL.o $(GL_LIBS)
        $(call mklib-cxx,GL)
 
-$(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv1_CM_LIB).so: st_GLESv1_CM.o $(GLESv1_CM_LIBS)
-       $(call mklib-cxx,GLESv1_CM)
-
-$(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv2_LIB).so: st_GLESv2.o $(GLESv2_LIBS)
-       $(call mklib-cxx,GLESv2)
-
 $(OUTPUT_PATH)/$(ST_PREFIX)$(VG_LIB).so: st_OpenVG.o $(OpenVG_LIBS)
        $(call mklib,OpenVG)
 
index 786d5d1105e783b2b9299fd1ee35abfb0a636344..61fe5069e919c6edc857ee9fc1d979d9d6abe4a0 100644 (file)
@@ -100,9 +100,14 @@ load_st_module(struct st_module *stmod,
 {
    struct st_api *(*create_api)(void);
 
-   _eglLog(_EGL_DEBUG, "searching for st module %s", name);
+   if (name) {
+      _eglLog(_EGL_DEBUG, "searching for st module %s", name);
+      stmod->name = loader_strdup(name);
+   }
+   else {
+      stmod->name = NULL;
+   }
 
-   stmod->name = loader_strdup(name);
    if (stmod->name)
       _eglSearchPathForEach(dlopen_st_module_cb, (void *) stmod);
    else
@@ -200,19 +205,7 @@ get_st_api_full(enum st_api_type api, enum st_profile_type profile)
    switch (api) {
    case ST_API_OPENGL:
       symbol = ST_CREATE_OPENGL_SYMBOL;
-      switch (profile) {
-      case ST_PROFILE_OPENGL_ES1:
-         names[count++] = "GLESv1_CM";
-         names[count++] = "GL";
-         break;
-      case ST_PROFILE_OPENGL_ES2:
-         names[count++] = "GLESv2";
-         names[count++] = "GL";
-         break;
-      default:
-         names[count++] = "GL";
-         break;
-      }
+      names[count++] = "GL";
       break;
    case ST_API_OPENVG:
       symbol = ST_CREATE_OPENVG_SYMBOL;
@@ -232,6 +225,21 @@ get_st_api_full(enum st_api_type api, enum st_profile_type profile)
          break;
    }
 
+   /* try again with libGL.so loaded */
+   if (!stmod->stapi && api == ST_API_OPENGL) {
+      struct util_dl_library *glapi = util_dl_open("libGL" UTIL_DL_EXT);
+
+      if (glapi) {
+         _eglLog(_EGL_DEBUG, "retry with libGL" UTIL_DL_EXT " loaded");
+         /* skip the last name (which is NULL) */
+         for (i = 0; i < count - 1; i++) {
+            if (load_st_module(stmod, names[i], symbol))
+               break;
+         }
+         util_dl_close(glapi);
+      }
+   }
+
    if (!stmod->stapi) {
       EGLint level = (egl_g3d_loader.profile_masks[api]) ?
          _EGL_WARNING : _EGL_DEBUG;
diff --git a/src/gallium/targets/egl/st_GLESv1_CM.c b/src/gallium/targets/egl/st_GLESv1_CM.c
deleted file mode 100644 (file)
index c1df844..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "state_tracker/st_gl_api.h"
-#include "egl.h"
-
-PUBLIC struct st_api *
-st_api_create_OpenGL(void)
-{
-   return st_gl_api_create();
-}
diff --git a/src/gallium/targets/egl/st_GLESv2.c b/src/gallium/targets/egl/st_GLESv2.c
deleted file mode 100644 (file)
index c1df844..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "state_tracker/st_gl_api.h"
-#include "egl.h"
-
-PUBLIC struct st_api *
-st_api_create_OpenGL(void)
-{
-   return st_gl_api_create();
-}
index e5cf526d33a02b49ea5823a4c265e8b1df5c1cad..09cba895d2a8f334cc5345c4acba6dd4830b848f 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
+#include "pipe/p_shader_tokens.h"
 #include "pipe/p_state.h"
 #include "tgsi/tgsi_text.h"
 #include "util/u_debug.h"
index 1d6e664eabd6557c3b3d49566bae5f6ef07f5a49..112904ab5fe88e6a690e31564808d34d9d9216dd 100644 (file)
@@ -100,7 +100,7 @@ no_winsys:
 
 static void
 gdi_present(struct pipe_screen *screen,
-            struct pipe_surface *surface,
+            struct pipe_resource *res,
             HDC hDC)
 {
    /* This will fail if any interposing layer (trace, debug, etc) has
@@ -119,14 +119,14 @@ gdi_present(struct pipe_screen *screen,
 #ifdef HAVE_LLVMPIPE
    if (use_llvmpipe) {
       winsys = llvmpipe_screen(screen)->winsys;
-      dt = llvmpipe_resource(surface->texture)->dt;
+      dt = llvmpipe_resource(res)->dt;
       gdi_sw_display(winsys, dt, hDC);
       return;
    }
 #endif
 
    winsys = softpipe_screen(screen)->winsys,
-   dt = softpipe_resource(surface->texture)->dt,
+   dt = softpipe_resource(res)->dt,
    gdi_sw_display(winsys, dt, hDC);
 }
 
index 9a3e0e07b0d2aa9661d90b0c9c19786f6cde3d46..1a5892b94a0c32da16a6db85c69c5b68a8c3c779 100644 (file)
@@ -35,7 +35,6 @@
 #include "state_tracker/xlib_sw_winsys.h"
 #include "xm_public.h"
 
-#include "state_tracker/st_api.h"
 #include "state_tracker/st_gl_api.h"
 #include "target-helpers/inline_sw_helper.h"
 #include "target-helpers/inline_debug_helper.h"
index 94465e520439daf78b7f127a6d5f3946ae227ba2..7979209993dbc96ad3b5ed544adcc348eecd8562 100644 (file)
@@ -362,8 +362,10 @@ vmw_video_close(struct vmw_customizer *vmw)
        /* make sure the port is stoped as well */
        vmw_xv_stop_video(pScrn, &video->port[i], TRUE);
        vmw_ioctl_unref_stream(vmw, video->port[i].streamId);
+       REGION_UNINIT(pScreen, &video->port[i].clipBoxes);
     }
 
+
     /* XXX: I'm sure this function is missing code for turning off Xv */
 
     free(vmw->video_priv);
@@ -448,7 +450,16 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_customizer *vmw)
     vmw->video_priv = video;
 
     adaptor->type = XvInputMask | XvImageMask | XvWindowMask;
-    adaptor->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+
+    /**
+     * Note: CLIP_TO_VIEWPORT was removed from the flags, since with the
+     * crtc/output based modesetting, the viewport is not updated on
+     * RandR modeswitches. Hence the video may incorrectly be clipped away.
+     * The correct approach, (if needed) would be to clip against the
+     * scanout area union of all active crtcs. Revisit if needed.
+     */
+
+    adaptor->flags = VIDEO_OVERLAID_IMAGES;
     adaptor->name = "VMware Video Engine";
     adaptor->nEncodings = VMWARE_VID_NUM_ENCODINGS;
     adaptor->pEncodings = vmwareVideoEncodings;
@@ -463,6 +474,7 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_customizer *vmw)
         video->port[i].flags = SVGA_VIDEO_FLAG_COLORKEY;
         video->port[i].colorKey = VMWARE_VIDEO_COLORKEY;
         video->port[i].isAutoPaintColorkey = TRUE;
+        REGION_NULL(pScrn->pScreen, &video->port[i].clipBoxes);
         adaptor->pPortPrivates[i].ptr = &video->port[i];
     }
 
@@ -554,7 +566,9 @@ vmw_video_port_init(ScrnInfoPtr pScrn, struct vmw_video_port *port,
     REGION_COPY(pScrn->pScreen, &port->clipBoxes, clipBoxes);
 
     if (port->isAutoPaintColorkey)
-        xf86XVFillKeyHelper(pScrn->pScreen, port->colorKey, clipBoxes);
+       xf86XVFillKeyHelper(pScrn->pScreen, port->colorKey, clipBoxes);
+
+    xorg_flush(pScrn->pScreen);
 
     return port->play(pScrn, port, src_x, src_y, drw_x, drw_y, src_w, src_h,
                       drw_w, drw_h, format, buf, width, height, clipBoxes);
@@ -641,11 +655,12 @@ vmw_video_port_play(ScrnInfoPtr pScrn, struct vmw_video_port *port,
      */
     if (!REGION_EQUAL(pScrn->pScreen, &port->clipBoxes, clipBoxes)) {
         REGION_COPY(pScrn->pScreen, &port->clipBoxes, clipBoxes);
-        if (port->isAutoPaintColorkey) {
+        if (port->isAutoPaintColorkey)
             xf86XVFillKeyHelper(pScrn->pScreen, port->colorKey, clipBoxes);
-        }
     }
 
+    xorg_flush(pScrn->pScreen);
+
     ret = drmCommandWrite(vmw->fd, DRM_VMW_CONTROL_STREAM, &arg, sizeof(arg));
     if (ret) {
        vmw_video_port_cleanup(pScrn, port);
@@ -865,6 +880,8 @@ vmw_xv_stop_video(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
     if (!vmw->video_priv)
         return;
 
+    REGION_EMPTY(pScrn->pScreen, &port->clipBoxes);
+
     if (!cleanup)
         return;
 
index ee4581ef1eda6f00a8600eb53af66bca8e565fc9..1ff80cadeec3f534e571b143d49aa38127dfe542 100644 (file)
@@ -20,6 +20,7 @@ static const int HEIGHT = 300;
 struct pipe_screen *screen;
 struct pipe_context *ctx;
 struct pipe_surface *surf;
+struct pipe_resource *tex;
 static void *window = NULL;
 
 static void draw( void )
@@ -31,13 +32,14 @@ static void draw( void )
 
    graw_save_surface_to_file(ctx, surf, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, tex, 0, 0, window);
 }
 
 static void init( void )
 {
    struct pipe_framebuffer_state fb;
-   struct pipe_resource *tex, templat;
+   struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -66,6 +68,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -76,9 +79,12 @@ static void init( void )
    if (tex == NULL)
       exit(4);
 
-   surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, tex, &surf_tmpl);
    if (surf == NULL)
       exit(5);
 
index 19af83fda8885b936103c0a05d58cdd49f7f3213..37be2d0830c74d8b54f5c84ba177cc8bee756e4f 100644 (file)
@@ -119,6 +119,7 @@ static void init_fs_constbuf( void )
    templat.width0 = sizeof(constants1);
    templat.height0 = 1;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_CONSTANT_BUFFER;
@@ -139,7 +140,7 @@ static void init_fs_constbuf( void )
 
       ctx->transfer_inline_write(ctx,
                                  constbuf1,
-                                 u_subresource(0,0),
+                                 0,
                                  PIPE_TRANSFER_WRITE,
                                  &box,
                                  constants1,
@@ -156,7 +157,7 @@ static void init_fs_constbuf( void )
 
       ctx->transfer_inline_write(ctx,
                                  constbuf2,
-                                 u_subresource(0,0),
+                                 0,
                                  PIPE_TRANSFER_WRITE,
                                  &box,
                                  constants2,
@@ -280,7 +281,7 @@ static void draw( void )
 
    graw_save_surface_to_file(ctx, surf, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
 }
 
 #define SIZE 16
@@ -340,6 +341,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -354,7 +356,7 @@ static void init_tex( void )
 
    ctx->transfer_inline_write(ctx,
                               samptex,
-                              u_subresource(0,0),
+                              0,
                               PIPE_TRANSFER_WRITE,
                               &box,
                               tex2d,
@@ -368,7 +370,7 @@ static void init_tex( void )
       struct pipe_transfer *t;
       uint32_t *ptr;
       t = pipe_get_transfer(ctx, samptex,
-                            0, 0, 0, /* face, level, zslice */
+                            0, 0, /* level, layer */
                             PIPE_TRANSFER_READ,
                             0, 0, SIZE, SIZE); /* x, y, width, height */
 
@@ -387,8 +389,6 @@ static void init_tex( void )
    memset(&sv_template, 0, sizeof sv_template);
    sv_template.format = samptex->format;
    sv_template.texture = samptex;
-   sv_template.first_level = 0;
-   sv_template.last_level = 0;
    sv_template.swizzle_r = 0;
    sv_template.swizzle_g = 1;
    sv_template.swizzle_b = 2;
@@ -424,6 +424,7 @@ static void init( void )
 {
    struct pipe_framebuffer_state fb;
    struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -450,6 +451,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -460,9 +462,12 @@ static void init( void )
    if (rttex == NULL)
       exit(4);
 
-   surf = screen->get_tex_surface(screen, rttex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, rttex, &surf_tmpl);
    if (surf == NULL)
       exit(5);
 
index ef29f134980daa2ec859122c3590f4d5312b5482..812666a8c84a09cca0efe6ba047d14247fdb3d8a 100644 (file)
@@ -156,6 +156,7 @@ static void init_fs_constbuf( void )
    templat.width0 = sizeof(constants1);
    templat.height0 = 1;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_CONSTANT_BUFFER;
@@ -172,7 +173,7 @@ static void init_fs_constbuf( void )
 
       ctx->transfer_inline_write(ctx,
                                  constbuf1,
-                                 u_subresource(0,0),
+                                 0,
                                  PIPE_TRANSFER_WRITE,
                                  &box,
                                  constants1,
@@ -189,7 +190,7 @@ static void init_fs_constbuf( void )
 
       ctx->transfer_inline_write(ctx,
                                  constbuf2,
-                                 u_subresource(0,0),
+                                 0,
                                  PIPE_TRANSFER_WRITE,
                                  &box,
                                  constants2,
@@ -344,7 +345,7 @@ static void draw( void )
 
    graw_save_surface_to_file(ctx, surf, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
 }
 
 #define SIZE 16
@@ -404,6 +405,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -418,7 +420,7 @@ static void init_tex( void )
 
    ctx->transfer_inline_write(ctx,
                               samptex,
-                              u_subresource(0,0),
+                              0,
                               PIPE_TRANSFER_WRITE,
                               &box,
                               tex2d,
@@ -432,7 +434,7 @@ static void init_tex( void )
       struct pipe_transfer *t;
       uint32_t *ptr;
       t = pipe_get_transfer(ctx, samptex,
-                            0, 0, 0, /* face, level, zslice */
+                            0, 0, /* level, layer */
                             PIPE_TRANSFER_READ,
                             0, 0, SIZE, SIZE); /* x, y, width, height */
 
@@ -451,8 +453,6 @@ static void init_tex( void )
    memset(&sv_template, 0, sizeof sv_template);
    sv_template.format = samptex->format;
    sv_template.texture = samptex;
-   sv_template.first_level = 0;
-   sv_template.last_level = 0;
    sv_template.swizzle_r = 0;
    sv_template.swizzle_g = 1;
    sv_template.swizzle_b = 2;
@@ -488,6 +488,7 @@ static void init( void )
 {
    struct pipe_framebuffer_state fb;
    struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -514,6 +515,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -524,9 +526,12 @@ static void init( void )
    if (rttex == NULL)
       exit(4);
 
-   surf = screen->get_tex_surface(screen, rttex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, rttex, &surf_tmpl);
    if (surf == NULL)
       exit(5);
 
index 35eade939e6bf869ac0b242c45259713882035cd..952131d765bde0abdc0882353d4b8a51a698a42e 100644 (file)
@@ -151,7 +151,7 @@ static void draw( void )
 
    graw_save_surface_to_file(ctx, surf, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
 }
 
 #define SIZE 16
@@ -211,6 +211,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -225,7 +226,7 @@ static void init_tex( void )
 
    ctx->transfer_inline_write(ctx,
                               samptex,
-                              u_subresource(0,0),
+                              0,
                               PIPE_TRANSFER_WRITE,
                               &box,
                               tex2d,
@@ -239,7 +240,7 @@ static void init_tex( void )
       struct pipe_transfer *t;
       uint32_t *ptr;
       t = pipe_get_transfer(ctx, samptex,
-                            0, 0, 0, /* face, level, zslice */
+                            0, 0, /* level, layer */
                             PIPE_TRANSFER_READ,
                             0, 0, SIZE, SIZE); /* x, y, width, height */
 
@@ -258,8 +259,6 @@ static void init_tex( void )
    memset(&sv_template, 0, sizeof sv_template);
    sv_template.format = samptex->format;
    sv_template.texture = samptex;
-   sv_template.first_level = 0;
-   sv_template.last_level = 0;
    sv_template.swizzle_r = 0;
    sv_template.swizzle_g = 1;
    sv_template.swizzle_b = 2;
@@ -295,6 +294,7 @@ static void init( void )
 {
    struct pipe_framebuffer_state fb;
    struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -321,6 +321,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -331,9 +332,12 @@ static void init( void )
    if (rttex == NULL)
       exit(4);
 
-   surf = screen->get_tex_surface(screen, rttex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, rttex, &surf_tmpl);
    if (surf == NULL)
       exit(5);
 
index 0a6c362d17245852b1fe71c891b3b29b6b1b4a20..b53f0a046ca8c1750a368e824eada7039c2da337 100644 (file)
@@ -28,6 +28,7 @@ static const int HEIGHT = 300;
 static struct pipe_screen *screen = NULL;
 static struct pipe_context *ctx = NULL;
 static struct pipe_surface *surf = NULL;
+static struct pipe_resource *tex = NULL;
 static void *window = NULL;
 
 struct vertex {
@@ -155,7 +156,7 @@ static void draw( void )
       ctx->delete_fs_state(ctx, fs);
    }
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, tex, 0, 0, window);
    ctx->destroy(ctx);
 
    exit(0);
@@ -165,7 +166,8 @@ static void draw( void )
 static void init( void )
 {
    struct pipe_framebuffer_state fb;
-   struct pipe_resource *tex, templat;
+   struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -203,11 +205,16 @@ static void init( void )
       exit(4);
    }
 
-   surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
-   if (surf == NULL)
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, tex, &surf_tmpl);
+   if (surf == NULL) {
+      fprintf(stderr, "Unable to create tex surface!\n");
       exit(5);
+   }
 
    memset(&fb, 0, sizeof fb);
    fb.nr_cbufs = 1;
index 731c4e10cfdc9c4eb5f45563bc8a3b8cb03d6644..84ff3e6773528b702bc0a7b208b61cea65fdcc71 100644 (file)
@@ -23,6 +23,7 @@ static const int HEIGHT = 300;
 static struct pipe_screen *screen = NULL;
 static struct pipe_context *ctx = NULL;
 static struct pipe_surface *surf = NULL;
+static struct pipe_resource *tex = NULL;
 static void *window = NULL;
 
 struct vertex {
@@ -164,14 +165,15 @@ static void draw( void )
    util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, tex, 0, 0, window);
 }
 
 
 static void init( void )
 {
    struct pipe_framebuffer_state fb;
-   struct pipe_resource *tex, templat;
+   struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -198,6 +200,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -208,9 +211,12 @@ static void init( void )
    if (tex == NULL)
       exit(4);
 
-   surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, tex, &surf_tmpl);
    if (surf == NULL)
       exit(5);
 
index 76443811629ed7668273654bdc9a64709d7463d0..f33c061b22b861c72c2d49578f2f70aa6a7194ae 100644 (file)
@@ -27,6 +27,7 @@ static const int HEIGHT = 300;
 static struct pipe_screen *screen = NULL;
 static struct pipe_context *ctx = NULL;
 static struct pipe_surface *surf = NULL;
+static struct pipe_resource *tex = NULL;
 static void *window = NULL;
 
 struct vertex {
@@ -216,14 +217,15 @@ static void draw( void )
 
    graw_save_surface_to_file(ctx, surf, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, tex, 0, 0, window);
 }
 
 
 static void init( void )
 {
    struct pipe_framebuffer_state fb;
-   struct pipe_resource *tex, templat;
+   struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -250,6 +252,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -260,9 +263,12 @@ static void init( void )
    if (tex == NULL)
       exit(4);
 
-   surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, tex, &surf_tmpl);
    if (surf == NULL)
       exit(5);
 
index 025a1470dc906473bfee5561ecd3570c3496f842..2742c7c99e051162f480af0c5397316026f2580f 100644 (file)
@@ -25,6 +25,7 @@ static const int HEIGHT = 300;
 static struct pipe_screen *screen = NULL;
 static struct pipe_context *ctx = NULL;
 static struct pipe_surface *surf = NULL;
+static struct pipe_resource *tex = NULL;
 static void *window = NULL;
 
 struct vertex {
@@ -144,14 +145,15 @@ static void draw( void )
 
    graw_save_surface_to_file(ctx, surf, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, tex, 0, 0, window);
 }
 
 
 static void init( void )
 {
    struct pipe_framebuffer_state fb;
-   struct pipe_resource *tex, templat;
+   struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -180,6 +182,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -192,11 +195,14 @@ static void init( void )
       exit(4);
    }
 
-   surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, tex, &surf_tmpl);
    if (surf == NULL) {
-      fprintf(stderr, "Unable to get tex surface!\n");
+      fprintf(stderr, "Unable to create tex surface!\n");
       exit(5);
    }
 
index 440c40bdcdab9bfb0917345cb3ce7b68f83a5f67..58908f38a23ed06485fb3a96e7015398e25100e1 100644 (file)
@@ -87,6 +87,7 @@ static void init_fs_constbuf( void )
    templat.width0 = sizeof(constants);
    templat.height0 = 1;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_CONSTANT_BUFFER;
@@ -101,7 +102,7 @@ static void init_fs_constbuf( void )
 
    ctx->transfer_inline_write(ctx,
                               constbuf,
-                              u_subresource(0,0),
+                              0,
                               PIPE_TRANSFER_WRITE,
                               &box,
                               constants,
@@ -231,7 +232,7 @@ static void draw( void )
 
    graw_save_surface_to_file(ctx, surf, NULL);
 
-   screen->flush_frontbuffer(screen, surf, window);
+   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
 }
 
 #define SIZE 16
@@ -291,6 +292,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -305,7 +307,7 @@ static void init_tex( void )
 
    ctx->transfer_inline_write(ctx,
                               samptex,
-                              u_subresource(0,0),
+                              0,
                               PIPE_TRANSFER_WRITE,
                               &box,
                               tex2d,
@@ -319,7 +321,7 @@ static void init_tex( void )
       struct pipe_transfer *t;
       uint32_t *ptr;
       t = pipe_get_transfer(ctx, samptex,
-                            0, 0, 0, /* face, level, zslice */
+                            0, 0, /* level, layer */
                             PIPE_TRANSFER_READ,
                             0, 0, SIZE, SIZE); /* x, y, width, height */
 
@@ -338,8 +340,6 @@ static void init_tex( void )
    memset(&sv_template, 0, sizeof sv_template);
    sv_template.format = samptex->format;
    sv_template.texture = samptex;
-   sv_template.first_level = 0;
-   sv_template.last_level = 0;
    sv_template.swizzle_r = 0;
    sv_template.swizzle_g = 1;
    sv_template.swizzle_b = 2;
@@ -375,6 +375,7 @@ static void init( void )
 {
    struct pipe_framebuffer_state fb;
    struct pipe_resource templat;
+   struct pipe_surface surf_tmpl;
    int i;
 
    /* It's hard to say whether window or screen should be created
@@ -401,6 +402,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
@@ -411,9 +413,12 @@ static void init( void )
    if (rttex == NULL)
       exit(4);
 
-   surf = screen->get_tex_surface(screen, rttex, 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET |
-                                  PIPE_BIND_DISPLAY_TARGET);
+   surf_tmpl.format = templat.format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = 0;
+   surf_tmpl.u.tex.first_layer = 0;
+   surf_tmpl.u.tex.last_layer = 0;
+   surf = ctx->create_surface(ctx, rttex, &surf_tmpl);
    if (surf == NULL)
       exit(5);
 
index 954a701a53f9af8d918bb72cbcd177e9a840e126..84371223f66177ff238a6031bf468ef8bcff4931 100755 (executable)
@@ -251,14 +251,6 @@ class Screen(Object):
     def texture_release(self, surface):
         pass
 
-    def get_tex_surface(self, texture, face, level, zslice, usage):
-        if texture is None:
-            return None
-        return texture.get_surface(face, level, zslice)
-    
-    def tex_surface_destroy(self, surface):
-        self.interpreter.unregister_object(surface)
-
     def tex_surface_release(self, surface):
         pass
 
@@ -282,7 +274,7 @@ class Screen(Object):
     def fence_reference(self, dst, src):
         pass
     
-    def flush_frontbuffer(self, surface):
+    def flush_frontbuffer(self, resource):
         pass
 
 
@@ -581,7 +573,7 @@ class Context(Object):
         if transfer and usage & gallium.PIPE_TRANSFER_READ:
             if self.interpreter.options.all:
                 surface = texture.get_surface(sr.face, sr.level, box.z)
-                self.interpreter.present(self.real, transfer.surface, 'transf_read', box.x, box.y, box.w, box.h)
+                self.interpreter.present(self.real, transfer.surface, 'transf_read', box.x, box.y, box.width, box.height)
         return transfer
     
     def tex_transfer_destroy(self, transfer):
@@ -589,6 +581,10 @@ class Context(Object):
 
     def transfer_inline_write(self, resource, sr, usage, box, stride, slice_stride, data):
         self.real.transfer_inline_write(resource, sr, usage, box, data, stride, slice_stride)
+        if self.interpreter.options.all:
+            for z in range(box.z, box.z + box.depth):
+                surface = resource.get_surface(sr.face, sr.level, box.z)
+                self.interpreter.present(self.real, surface, 'transf_inline_write%u' % z, box.x, box.y, box.width, box.height)
 
     def _set_dirty(self):
         if self.interpreter.options.step:
@@ -627,7 +623,13 @@ class Context(Object):
         if self.zsbuf:
             if self.interpreter.options.all:
                 self.interpreter.present(self.real, self.zsbuf, "zsbuf")
-    
+    def create_surface(self, texture, level, layer, usage):
+        if texture is None:
+            return None
+        return texture.get_surface(level, layer)
+
+    def surface_destroy(self, surface):
+        self.interpreter.unregister_object(surface)
 
 class Interpreter(parser.TraceDumper):
     
index cf88edcdc56f91322ea3be2bad43c4570fe24e78..92c5b4dbb183f3ac5111ae6b9551d98a1d8b7511 100644 (file)
@@ -92,6 +92,7 @@ struct program
 
 static void init_prog(struct program *p)
 {
+       struct pipe_surface surf_tmpl;
        /* create the software rasterizer */
        p->screen = sw_screen_create(null_sw_create());
        /* wrap the screen with any debugger */
@@ -141,6 +142,7 @@ static void init_prog(struct program *p)
                tmplt.width0 = WIDTH;
                tmplt.height0 = HEIGHT;
                tmplt.depth0 = 1;
+               tmplt.array_size = 1;
                tmplt.last_level = 0;
                tmplt.bind = PIPE_BIND_RENDER_TARGET;
 
@@ -153,7 +155,6 @@ static void init_prog(struct program *p)
                struct pipe_transfer *t;
                struct pipe_resource t_tmplt;
                struct pipe_sampler_view v_tmplt;
-               struct pipe_subresource sub;
                struct pipe_box box;
 
                memset(&t_tmplt, 0, sizeof(t_tmplt));
@@ -162,17 +163,17 @@ static void init_prog(struct program *p)
                t_tmplt.width0 = 2;
                t_tmplt.height0 = 2;
                t_tmplt.depth0 = 1;
+               t_tmplt.array_size = 1;
                t_tmplt.last_level = 0;
                t_tmplt.bind = PIPE_BIND_RENDER_TARGET;
 
                p->tex = p->screen->resource_create(p->screen, &t_tmplt);
 
-               memset(&sub, 0, sizeof(sub));
                memset(&box, 0, sizeof(box));
                box.width = 2;
                box.height = 2;
 
-               t = p->pipe->get_transfer(p->pipe, p->tex, sub, PIPE_TRANSFER_WRITE, &box);
+               t = p->pipe->get_transfer(p->pipe, p->tex, 0, PIPE_TRANSFER_WRITE, &box);
 
                ptr = p->pipe->transfer_map(p->pipe, t);
                ptr[0] = 0xffff0000;
@@ -210,12 +211,17 @@ static void init_prog(struct program *p)
        p->sampler.mag_img_filter = PIPE_TEX_MIPFILTER_LINEAR;
        p->sampler.normalized_coords = 1;
 
+       surf_tmpl.format = templat.format;
+       surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+       surf_tmpl.u.tex.level = 0;
+       surf_tmpl.u.tex.first_layer = 0;
+       surf_tmpl.u.tex.last_layer = 0;
        /* drawing destination */
        memset(&p->framebuffer, 0, sizeof(p->framebuffer));
        p->framebuffer.width = WIDTH;
        p->framebuffer.height = HEIGHT;
        p->framebuffer.nr_cbufs = 1;
-       p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+       p->framebuffer.cbufs[0] = p->pipe->create_surface(p->pipe, p->target, &surf_tmpl);
 
        /* viewport, depth isn't really needed */
        {
index 667a27b28ab87363e55ecca72be4459b7c9ae4f8..37c1573051f1da16ee2b18dc612d1539008acda9 100644 (file)
@@ -87,6 +87,7 @@ struct program
 
 static void init_prog(struct program *p)
 {
+       struct pipe_surface surf_tmpl;
        /* create the software rasterizer */
        p->screen = sw_screen_create(null_sw_create());
        /* wrap the screen with any debugger */
@@ -132,6 +133,7 @@ static void init_prog(struct program *p)
                tmplt.width0 = WIDTH;
                tmplt.height0 = HEIGHT;
                tmplt.depth0 = 1;
+               tmplt.array_size = 1;
                tmplt.last_level = 0;
                tmplt.bind = PIPE_BIND_RENDER_TARGET;
 
@@ -150,12 +152,17 @@ static void init_prog(struct program *p)
        p->rasterizer.cull_face = PIPE_FACE_NONE;
        p->rasterizer.gl_rasterization_rules = 1;
 
+       surf_tmpl.format = templat.format;
+       surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+       surf_tmpl.u.tex.level = 0;
+       surf_tmpl.u.tex.first_layer = 0;
+       surf_tmpl.u.tex.last_layer = 0;
        /* drawing destination */
        memset(&p->framebuffer, 0, sizeof(p->framebuffer));
        p->framebuffer.width = WIDTH;
        p->framebuffer.height = HEIGHT;
        p->framebuffer.nr_cbufs = 1;
-       p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+       p->framebuffer.cbufs[0] = p->pipe->create_surface(p->pipe, p->target, &surf_tmpl);
 
        /* viewport, depth isn't really needed */
        {
index c6daa52a379e0bad756aae8ab2d109f619778853..ebe86dcf196d0a2b39da746724219bb4bea10e25 100644 (file)
@@ -14,9 +14,6 @@
 #define INTEL_BATCH_CLIPRECTS    0x2
 
 #undef INTEL_RUN_SYNC
-#undef INTEL_MAP_BATCHBUFFER
-#undef INTEL_MAP_GTT
-#define INTEL_ALWAYS_FLUSH
 
 struct i915_drm_batchbuffer
 {
@@ -72,11 +69,7 @@ i915_drm_batchbuffer_create(struct i915_winsys *iws)
 
    batch->actual_size = idws->max_batch_size;
 
-#ifdef INTEL_MAP_BATCHBUFFER
-   batch->base.map = NULL;
-#else
    batch->base.map = MALLOC(batch->actual_size);
-#endif
    batch->base.ptr = NULL;
    batch->base.size = 0;
 
@@ -94,7 +87,7 @@ static int
 i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
                             struct i915_winsys_buffer *buffer,
                             enum i915_winsys_buffer_usage usage,
-                            unsigned pre_add)
+                            unsigned pre_add, bool fenced)
 {
    struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
    unsigned write_domain = 0;
@@ -104,37 +97,44 @@ i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
 
    assert(batch->base.relocs < batch->base.max_relocs);
 
-   if (usage == I915_USAGE_SAMPLER) {
+   switch (usage) {
+   case I915_USAGE_SAMPLER:
       write_domain = 0;
       read_domain = I915_GEM_DOMAIN_SAMPLER;
-
-   } else if (usage == I915_USAGE_RENDER) {
+      break;
+   case I915_USAGE_RENDER:
       write_domain = I915_GEM_DOMAIN_RENDER;
       read_domain = I915_GEM_DOMAIN_RENDER;
-
-   } else if (usage == I915_USAGE_2D_TARGET) {
+      break;
+   case I915_USAGE_2D_TARGET:
       write_domain = I915_GEM_DOMAIN_RENDER;
       read_domain = I915_GEM_DOMAIN_RENDER;
-
-   } else if (usage == I915_USAGE_2D_SOURCE) {
+      break;
+   case I915_USAGE_2D_SOURCE:
       write_domain = 0;
       read_domain = I915_GEM_DOMAIN_RENDER;
-
-   } else if (usage == I915_USAGE_VERTEX) {
+      break;
+   case I915_USAGE_VERTEX:
       write_domain = 0;
       read_domain = I915_GEM_DOMAIN_VERTEX;
-
-   } else {
+      break;
+   default:
       assert(0);
       return -1;
    }
 
    offset = (unsigned)(batch->base.ptr - batch->base.map);
 
-   ret = drm_intel_bo_emit_reloc(batch->bo, offset,
-                                 intel_bo(buffer), pre_add,
-                                 read_domain,
-                                 write_domain);
+   if (fenced)
+      ret = drm_intel_bo_emit_reloc_fence(batch->bo, offset,
+                                   intel_bo(buffer), pre_add,
+                                   read_domain,
+                                   write_domain);
+   else
+      ret = drm_intel_bo_emit_reloc(batch->bo, offset,
+                                   intel_bo(buffer), pre_add,
+                                   read_domain,
+                                   write_domain);
 
    ((uint32_t*)batch->base.ptr)[0] = intel_bo(buffer)->offset + pre_add;
    batch->base.ptr += 4;
@@ -150,70 +150,32 @@ i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
                             struct pipe_fence_handle **fence)
 {
    struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
-   unsigned used = 0;
-   int ret = 0;
+   unsigned used;
+   int ret;
 
-   assert(i915_winsys_batchbuffer_space(ibatch) >= 0);
+   /* MI_BATCH_BUFFER_END */
+   i915_winsys_batchbuffer_dword_unchecked(ibatch, (0xA<<23));
 
    used = batch->base.ptr - batch->base.map;
-   assert((used & 3) == 0);
-
-
-#ifdef INTEL_ALWAYS_FLUSH
-   /* MI_FLUSH | FLUSH_MAP_CACHE */
-   i915_winsys_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0));
-   used += 4;
-#endif
-
-   if ((used & 4) == 0) {
+   if (used & 4) {
       /* MI_NOOP */
-      i915_winsys_batchbuffer_dword(ibatch, 0);
+      i915_winsys_batchbuffer_dword_unchecked(ibatch, 0);
+      used += 4;
    }
-   /* MI_BATCH_BUFFER_END */
-   i915_winsys_batchbuffer_dword(ibatch, (0xA<<23));
-
-   used = batch->base.ptr - batch->base.map;
-   assert((used & 4) == 0);
-
-#ifdef INTEL_MAP_BATCHBUFFER
-#ifdef INTEL_MAP_GTT
-   drm_intel_gem_bo_unmap_gtt(batch->bo);
-#else
-   drm_intel_bo_unmap(batch->bo);
-#endif
-#else
-   drm_intel_bo_subdata(batch->bo, 0, used, batch->base.map);
-#endif
 
    /* Do the sending to HW */
-   if (i915_drm_winsys(ibatch->iws)->send_cmd)
+   ret = drm_intel_bo_subdata(batch->bo, 0, used, batch->base.map);
+   if (ret == 0 && i915_drm_winsys(ibatch->iws)->send_cmd)
       ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
-   else
-      ret = 0;
 
    if (ret != 0 || i915_drm_winsys(ibatch->iws)->dump_cmd) {
-#ifdef INTEL_MAP_BATCHBUFFER
-#ifdef INTEL_MAP_GTT
-      drm_intel_gem_bo_map_gtt(batch->bo);
-#else
-      drm_intel_bo_map(batch->bo, 0);
-#endif
-#endif
       i915_dump_batchbuffer(ibatch);
       assert(ret == 0);
-#ifdef INTEL_MAP_BATCHBUFFER
-#ifdef INTEL_MAP_GTT
-   drm_intel_gem_bo_unmap_gtt(batch->bo);
-#else
-   drm_intel_bo_unmap(batch->bo);
-#endif
-#endif
-   } else {
+   }
+
 #ifdef INTEL_RUN_SYNC
-      drm_intel_bo_map(batch->bo, FALSE);
-      drm_intel_bo_unmap(batch->bo);
+   drm_intel_bo_wait_rendering(batch->bo);
 #endif
-   }
 
    if (fence) {
       ibatch->iws->fence_reference(ibatch->iws, fence, NULL);
@@ -237,9 +199,7 @@ i915_drm_batchbuffer_destroy(struct i915_winsys_batchbuffer *ibatch)
    if (batch->bo)
       drm_intel_bo_unreference(batch->bo);
 
-#ifndef INTEL_MAP_BATCHBUFFER
    FREE(batch->base.map);
-#endif
    FREE(batch);
 }
 
index 15ec4487457795a72c1ee11ac430c9979fe934c2..01dd4bf062f943079441bacd9e2b3b2fdd5b07fc 100644 (file)
@@ -5,14 +5,31 @@
 
 #include "i915_drm.h"
 
+static char *i915_drm_type_to_name(enum i915_winsys_buffer_type type)
+{
+   char *name;
+
+   if (type == I915_NEW_TEXTURE) {
+      name = "gallium3d_texture";
+   } else if (type == I915_NEW_VERTEX) {
+      name = "gallium3d_vertex";
+   } else if (type == I915_NEW_SCANOUT) {
+      name = "gallium3d_scanout";
+   } else {
+      assert(0);
+      name = "gallium3d_unknown";
+   }
+
+   return name;
+}
+
 static struct i915_winsys_buffer *
 i915_drm_buffer_create(struct i915_winsys *iws,
-                        unsigned size, unsigned alignment,
+                        unsigned size,
                         enum i915_winsys_buffer_type type)
 {
    struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer);
    struct i915_drm_winsys *idws = i915_drm_winsys(iws);
-   char *name;
 
    if (!buf)
       return NULL;
@@ -21,22 +38,48 @@ i915_drm_buffer_create(struct i915_winsys *iws,
    buf->flinked = FALSE;
    buf->flink = 0;
 
-   if (type == I915_NEW_TEXTURE) {
-      name = "gallium3d_texture";
-   } else if (type == I915_NEW_VERTEX) {
-      name = "gallium3d_vertex";
-   } else if (type == I915_NEW_SCANOUT) {
-      name = "gallium3d_scanout";
-   } else {
-      assert(0);
-      name = "gallium3d_unknown";
-   }
+   buf->bo = drm_intel_bo_alloc(idws->gem_manager,
+                                i915_drm_type_to_name(type), size, 0);
 
-   buf->bo = drm_intel_bo_alloc(idws->gem_manager, name, size, alignment);
+   if (!buf->bo)
+      goto err;
+
+   return (struct i915_winsys_buffer *)buf;
+
+err:
+   assert(0);
+   FREE(buf);
+   return NULL;
+}
+
+static struct i915_winsys_buffer *
+i915_drm_buffer_create_tiled(struct i915_winsys *iws,
+                             unsigned *stride, unsigned height, 
+                             enum i915_winsys_buffer_tile *tiling,
+                             enum i915_winsys_buffer_type type)
+{
+   struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer);
+   struct i915_drm_winsys *idws = i915_drm_winsys(iws);
+   unsigned long pitch = 0;
+   uint32_t tiling_mode = *tiling;
+
+   if (!buf)
+      return NULL;
+
+   buf->magic = 0xDEAD1337;
+   buf->flinked = FALSE;
+   buf->flink = 0;
+
+   buf->bo = drm_intel_bo_alloc_tiled(idws->gem_manager,
+                                      i915_drm_type_to_name(type),
+                                     *stride, height, 1,
+                                      &tiling_mode, &pitch, 0);
 
    if (!buf->bo)
       goto err;
 
+   *stride = pitch;
+   *tiling = tiling_mode;
    return (struct i915_winsys_buffer *)buf;
 
 err:
@@ -47,8 +90,9 @@ err:
 
 static struct i915_winsys_buffer *
 i915_drm_buffer_from_handle(struct i915_winsys *iws,
-                             struct winsys_handle *whandle,
-                             unsigned *stride)
+                            struct winsys_handle *whandle,
+                            enum i915_winsys_buffer_tile *tiling,
+                            unsigned *stride)
 {
    struct i915_drm_winsys *idws = i915_drm_winsys(iws);
    struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer);
@@ -68,6 +112,7 @@ i915_drm_buffer_from_handle(struct i915_winsys *iws,
    drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle);
 
    *stride = whandle->stride;
+   *tiling = tile;
 
    return (struct i915_winsys_buffer *)buf;
 
@@ -103,24 +148,6 @@ i915_drm_buffer_get_handle(struct i915_winsys *iws,
    return TRUE;
 }
 
-static int
-i915_drm_buffer_set_fence_reg(struct i915_winsys *iws,
-                               struct i915_winsys_buffer *buffer,
-                               unsigned stride,
-                               enum i915_winsys_buffer_tile tile)
-{
-   struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
-   assert(I915_TILING_NONE == I915_TILE_NONE);
-   assert(I915_TILING_X == I915_TILE_X);
-   assert(I915_TILING_Y == I915_TILE_Y);
-
-   if (tile != I915_TILE_NONE) {
-      assert(buf->map_count == 0);
-   }
-
-   return drm_intel_bo_set_tiling(buf->bo, &tile, stride);
-}
-
 static void *
 i915_drm_buffer_map(struct i915_winsys *iws,
                      struct i915_winsys_buffer *buffer,
@@ -190,9 +217,9 @@ void
 i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws)
 {
    idws->base.buffer_create = i915_drm_buffer_create;
+   idws->base.buffer_create_tiled = i915_drm_buffer_create_tiled;
    idws->base.buffer_from_handle = i915_drm_buffer_from_handle;
    idws->base.buffer_get_handle = i915_drm_buffer_get_handle;
-   idws->base.buffer_set_fence_reg = i915_drm_buffer_set_fence_reg;
    idws->base.buffer_map = i915_drm_buffer_map;
    idws->base.buffer_unmap = i915_drm_buffer_unmap;
    idws->base.buffer_write = i915_drm_buffer_write;
index cc0b6a99577220e49e9b0485f290dfc6c7caba50..2288b48b2bde84cf557e565129afead87ba69889 100644 (file)
@@ -69,6 +69,7 @@ i915_drm_winsys_create(int drmFD)
 
    idws->gem_manager = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size);
    drm_intel_bufmgr_gem_enable_reuse(idws->gem_manager);
+   drm_intel_bufmgr_gem_enable_fenced_relocs(idws->gem_manager);
 
    idws->dump_cmd = debug_get_bool_option("I915_DUMP_CMD", FALSE);
    idws->send_cmd = !debug_get_bool_option("I915_NO_HW", FALSE);
index a480cfed57bf4b7e585f4a0083a39af4203635c8..44773ae30e7492bd368683593267af9f73128286 100644 (file)
@@ -61,7 +61,7 @@ static int
 i915_sw_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
                           struct i915_winsys_buffer *buffer,
                           enum i915_winsys_buffer_usage usage,
-                          unsigned pre_add)
+                          unsigned pre_add, bool fenced)
 {
    struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch);
    int ret = 0;
index df175688861579fd04a74ff36f24096a4131ecb9..834805e621df2ab1c7000e6bb9fb7f8d54115c1c 100644 (file)
@@ -4,28 +4,15 @@
 
 static struct i915_winsys_buffer *
 i915_sw_buffer_create(struct i915_winsys *iws,
-                      unsigned size, unsigned alignment,
+                      unsigned size,
                       enum i915_winsys_buffer_type type)
 {
    struct i915_sw_buffer *buf = CALLOC_STRUCT(i915_sw_buffer);
-   char *name;
 
    if (!buf)
       return NULL;
 
-   if (type == I915_NEW_TEXTURE) {
-      name = "gallium3d_texture";
-   } else if (type == I915_NEW_VERTEX) {
-      name = "gallium3d_vertex";
-   } else if (type == I915_NEW_SCANOUT) {
-      name = "gallium3d_scanout";
-   } else {
-      assert(0);
-      name = "gallium3d_unknown";
-   }
-
    buf->magic = 0xDEAD1337;
-   buf->name = name;
    buf->type = type;
    buf->ptr = CALLOC(size, 1);
 
@@ -40,21 +27,32 @@ err:
    return NULL;
 }
 
-static int
-i915_sw_buffer_set_fence_reg(struct i915_winsys *iws,
-                               struct i915_winsys_buffer *buffer,
-                               unsigned stride,
-                               enum i915_winsys_buffer_tile tile)
+static struct i915_winsys_buffer *
+i915_sw_buffer_create_tiled(struct i915_winsys *iws,
+                      unsigned *stride, unsigned height, 
+                      enum i915_winsys_buffer_tile *tiling,
+                      enum i915_winsys_buffer_type type)
 {
-   struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
+   struct i915_sw_buffer *buf = CALLOC_STRUCT(i915_sw_buffer);
+
+   if (!buf)
+      return NULL;
+
+   buf->magic = 0xDEAD1337;
+   buf->type = type;
+   buf->ptr = CALLOC(*stride * height, 1);
+   buf->tiling = *tiling;
+   buf->stride = *stride;
 
-   if (tile != I915_TILE_NONE) {
-      assert(buf->map_count == 0);
-   }
+   if (!buf->ptr)
+      goto err;
 
-   buf->tile = tile;
+   return (struct i915_winsys_buffer *)buf;
 
-   return 0;
+err:
+   assert(0);
+   FREE(buf);
+   return NULL;
 }
 
 static void *
@@ -108,7 +106,7 @@ void
 i915_sw_winsys_init_buffer_functions(struct i915_sw_winsys *isws)
 {
    isws->base.buffer_create = i915_sw_buffer_create;
-   isws->base.buffer_set_fence_reg = i915_sw_buffer_set_fence_reg;
+   isws->base.buffer_create_tiled = i915_sw_buffer_create_tiled;
    isws->base.buffer_map = i915_sw_buffer_map;
    isws->base.buffer_unmap = i915_sw_buffer_unmap;
    isws->base.buffer_write = i915_sw_buffer_write;
index b7b43669f30674a5b4dfe8ba2c53c3f38d2af9d6..3af2548419e4343ccc85f7b3b114f2b0391349c5 100644 (file)
@@ -43,8 +43,8 @@ struct i915_sw_buffer {
    void *ptr;
    unsigned map_count;
    enum i915_winsys_buffer_type type;
-   enum i915_winsys_buffer_tile tile;
-   const char *name;
+   enum i915_winsys_buffer_tile tiling;
+   unsigned stride;
 };
 
 static INLINE struct i915_sw_buffer *
index ed62db60bbb9cc5912a29afc731b210467835dda..a904179eeb9281a800fe89ceac363c4655b6be9b 100644 (file)
@@ -325,7 +325,7 @@ i965_libdrm_bo_subdata(struct brw_winsys_buffer *buffer,
       brw_dump_data( idws->base.pci_id,
                     data_type,
                     buf->bo->offset + offset, 
-                    data, size );
+                    data, size, buffer->sws->gen );
 
    /* XXX: use bo_map_gtt/memcpy/unmap_gtt under some circumstances???
     */
@@ -464,7 +464,7 @@ i965_libdrm_bo_flush_range(struct brw_winsys_buffer *buffer,
                     buf->data_type,
                     buf->bo->offset + offset, 
                     (char*)buf->bo->virtual + offset, 
-                    length );
+                    length, buffer->sws->gen );
 }
 
 static void 
index baadd6e89cad70b906483649a02cc81cb2206107..c22df6643aab03fd50312fb476b95f840240939d 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "i965/brw_winsys.h"
 #include "i965/brw_screen.h"
+#include "i965/brw_resource.h"
 #include "i965/brw_reg.h"
 #include "i965/brw_structs_dump.h"
 
@@ -421,25 +422,28 @@ xlib_create_brw_winsys_screen( void )
 
 static void
 xlib_i965_display_surface(struct xmesa_buffer *xm_buffer,
-                          struct pipe_surface *surf)
+                          struct pipe_resource *resource,
+                          unsigned level, unsigned layer)
 {
-   struct brw_surface *surface = brw_surface(surf);
-   struct xlib_brw_buffer *bo = xlib_brw_buffer(surface->bo);
-
+   struct brw_texture *tex = brw_texture(resource);
+   struct xlib_brw_buffer *bo = xlib_brw_buffer(tex->bo);
+   /* not sure if the resource is really useful here but
+      since it was never implemented anyway... */
    if (BRW_DEBUG & DEBUG_WINSYS)
-      debug_printf("%s offset %x+%x sz %dx%d\n", __FUNCTION__, 
+      debug_printf("%s level %u layer %u offset %x base sz %dx%d\n", __FUNCTION__,
+                   level, layer,
                    bo->offset,
-                   surface->draw_offset,
-                   surf->width,
-                   surf->height);
+                   resource->width0,
+                   resource->height0);
 }
 
 static void
 xlib_i965_flush_frontbuffer(struct pipe_screen *screen,
-                           struct pipe_surface *surf,
-                           void *context_private)
+                            struct pipe_resource *resource,
+                            unsigned level, unsigned layer,
+                            void *context_private)
 {
-   xlib_i965_display_surface(NULL, surf);
+   xlib_i965_display_surface(NULL, resource, level, layer);
 }
 
 
index d4bf124ce6f2c28ae43831098b2298734cdb0d48..648d6c8a8e21fdb8196ccbf0739de6e140db6182 100644 (file)
@@ -50,6 +50,9 @@ nouveau_drm_screen_create(int fd)
        case 0xa0:
                init = nv50_screen_create;
                break;
+       case 0xc0:
+               init = nvc0_screen_create;
+               break;
        default:
                debug_printf("%s: unknown chipset nv%02x\n", __func__,
                             dev->chipset);
index a396205f897530de518543f7b463a7131fd5798b..7310734f0516121055c426e3c4f055638f794a12 100644 (file)
@@ -8,12 +8,11 @@ C_SOURCES = \
        bof.c \
        evergreen_hw_context.c \
        radeon_bo.c \
-       radeon_bo_pb.c \
        radeon_pciid.c \
-       r600.c \
        r600_bo.c \
        r600_drm.c \
-       r600_hw_context.c
+       r600_hw_context.c \
+       r600_bomgr.c
 
 LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r600 \
                   $(shell pkg-config libdrm --cflags-only-I)
index cc053c06dd0e4ab105d14ab285d820c52d84ac53..f97434e995df9b780fea08e35a7eb971e3225459 100644 (file)
@@ -6,12 +6,11 @@ r600_sources = [
     'bof.c',
     'evergreen_hw_context.c',
     'radeon_bo.c',
-    'radeon_bo_pb.c',
     'radeon_pciid.c',
-    'r600.c',
     'r600_bo.c',
     'r600_drm.c',
     'r600_hw_context.c',
+    'r600_bomgr.c',
 ]
 
 env.ParseConfig('pkg-config --cflags libdrm_radeon')
index e1f163eab621ad0d7e30b62ced4c19ff73c90133..3fdafc3928378d58b51dde49ece2814957f3afcd 100644 (file)
@@ -36,7 +36,6 @@
 #include "pipe/p_compiler.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
-#include <pipebuffer/pb_bufmgr.h>
 #include "r600_priv.h"
 
 #define GROUP_FORCE_NEW_BLOCK  0
@@ -622,10 +621,7 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon)
        /* save 16dwords space for fence mecanism */
        ctx->pm4_ndwords -= 16;
 
-       r = r600_context_init_fence(ctx);
-       if (r) {
-               goto out_err;
-       }
+       LIST_INITHEAD(&ctx->fenced_bo);
 
        /* init dirty list */
        LIST_INITHEAD(&ctx->dirty);
@@ -881,59 +877,3 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr
        ctx->pm4_dirty_cdwords = 0;
 }
 
-static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
-{
-       struct r600_range *range;
-       struct r600_block *block;
-
-       range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
-       block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
-       block->reg[0] = state->regs[0].value;
-       block->reg[1] = state->regs[1].value;
-       block->reg[2] = state->regs[2].value;
-       block->reg[3] = state->regs[3].value;
-       block->reg[4] = state->regs[4].value;
-       block->reg[5] = state->regs[5].value;
-       block->reg[6] = state->regs[6].value;
-       block->reg[7] = state->regs[7].value;
-       r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
-       r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
-       if (state->regs[0].bo) {
-               /* VERTEX RESOURCE, we preted there is 2 bo to relocate so
-                * we have single case btw VERTEX & TEXTURE resource
-                */
-               r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
-               r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
-       } else {
-               /* TEXTURE RESOURCE */
-               r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
-               r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
-       }
-       if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
-               block->status |= R600_BLOCK_STATUS_ENABLED;
-               block->status |= R600_BLOCK_STATUS_DIRTY;
-               ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
-               LIST_ADDTAIL(&block->list,&ctx->dirty);
-       }
-}
-
-void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
-       unsigned offset = R_030000_RESOURCE0_WORD0 + 0x20 * rid;
-
-       evergreen_resource_set(ctx, state, offset);
-}
-
-void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
-       unsigned offset = R_030000_RESOURCE0_WORD0 + 0x1600 + 0x20 * rid;
-
-       evergreen_resource_set(ctx, state, offset);
-}
-
-void evergreen_fs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
-       unsigned offset = R_030000_RESOURCE0_WORD0 + 0x7C00 + 0x20 * rid;
-
-       evergreen_resource_set(ctx, state, offset);
-}
diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c
deleted file mode 100644 (file)
index f5e53e2..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *      Jerome Glisse
- */
-#include "xf86drm.h"
-#include "radeon_drm.h"
-#include "pipe/p_compiler.h"
-#include "util/u_inlines.h"
-#include <pipebuffer/pb_bufmgr.h>
-#include "r600_priv.h"
-
-enum radeon_family r600_get_family(struct radeon *r600)
-{
-       return r600->family;
-}
-
-enum chip_class r600_get_family_class(struct radeon *radeon)
-{
-       return radeon->chip_class;
-}
-
-struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon)
-{
-       return &radeon->tiling_info;
-}
-
-static int r600_get_device(struct radeon *r600)
-{
-       struct drm_radeon_info info;
-
-       r600->device = 0;
-       info.request = RADEON_INFO_DEVICE_ID;
-       info.value = (uintptr_t)&r600->device;
-       return drmCommandWriteRead(r600->fd, DRM_RADEON_INFO, &info, sizeof(struct drm_radeon_info));
-}
-
-struct radeon *r600_new(int fd, unsigned device)
-{
-       struct radeon *r600;
-       int r;
-
-       r600 = calloc(1, sizeof(*r600));
-       if (r600 == NULL) {
-               return NULL;
-       }
-       r600->fd = fd;
-       r600->device = device;
-       if (fd >= 0) {
-               r = r600_get_device(r600);
-               if (r) {
-                       R600_ERR("Failed to get device id\n");
-                       r600_delete(r600);
-                       return NULL;
-               }
-       }
-       r600->family = radeon_family_from_device(r600->device);
-       if (r600->family == CHIP_UNKNOWN) {
-               R600_ERR("Unknown chipset 0x%04X\n", r600->device);
-               r600_delete(r600);
-               return NULL;
-       }
-       switch (r600->family) {
-       case CHIP_R600:
-       case CHIP_RV610:
-       case CHIP_RV630:
-       case CHIP_RV670:
-       case CHIP_RV620:
-       case CHIP_RV635:
-       case CHIP_RS780:
-       case CHIP_RS880:
-       case CHIP_RV770:
-       case CHIP_RV730:
-       case CHIP_RV710:
-       case CHIP_RV740:
-       case CHIP_CEDAR:
-       case CHIP_REDWOOD:
-       case CHIP_JUNIPER:
-       case CHIP_CYPRESS:
-       case CHIP_HEMLOCK:
-       case CHIP_PALM:
-               break;
-       case CHIP_R100:
-       case CHIP_RV100:
-       case CHIP_RS100:
-       case CHIP_RV200:
-       case CHIP_RS200:
-       case CHIP_R200:
-       case CHIP_RV250:
-       case CHIP_RS300:
-       case CHIP_RV280:
-       case CHIP_R300:
-       case CHIP_R350:
-       case CHIP_RV350:
-       case CHIP_RV380:
-       case CHIP_R420:
-       case CHIP_R423:
-       case CHIP_RV410:
-       case CHIP_RS400:
-       case CHIP_RS480:
-       case CHIP_RS600:
-       case CHIP_RS690:
-       case CHIP_RS740:
-       case CHIP_RV515:
-       case CHIP_R520:
-       case CHIP_RV530:
-       case CHIP_RV560:
-       case CHIP_RV570:
-       case CHIP_R580:
-       default:
-               R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device);
-               break;
-       }
-
-       /* setup class */
-       switch (r600->family) {
-       case CHIP_R600:
-       case CHIP_RV610:
-       case CHIP_RV630:
-       case CHIP_RV670:
-       case CHIP_RV620:
-       case CHIP_RV635:
-       case CHIP_RS780:
-       case CHIP_RS880:
-               r600->chip_class = R600;
-               break;
-       case CHIP_RV770:
-       case CHIP_RV730:
-       case CHIP_RV710:
-       case CHIP_RV740:
-               r600->chip_class = R700;
-               break;
-       case CHIP_CEDAR:
-       case CHIP_REDWOOD:
-       case CHIP_JUNIPER:
-       case CHIP_CYPRESS:
-       case CHIP_HEMLOCK:
-       case CHIP_PALM:
-               r600->chip_class = EVERGREEN;
-               break;
-       default:
-               R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device);
-               break;
-       }
-
-       return r600;
-}
-
-void r600_delete(struct radeon *r600)
-{
-       if (r600 == NULL)
-               return;
-       drmClose(r600->fd);
-       free(r600);
-}
index 251f009a6b05b93d9e20b4bbe0f5ae3c737ae162..6a3737f0a4a8c6030784a5de0f58d76478622d3a 100644 (file)
@@ -36,142 +36,153 @@ struct r600_bo *r600_bo(struct radeon *radeon,
                        unsigned size, unsigned alignment,
                        unsigned binding, unsigned usage)
 {
-       struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo));
-       struct pb_desc desc;
-       struct pb_manager *man;
+       struct r600_bo *bo;
+       struct radeon_bo *rbo;
 
-       desc.alignment = alignment;
-       desc.usage = (PB_USAGE_CPU_READ_WRITE | PB_USAGE_GPU_READ_WRITE);
-       ws_bo->size = size;
+       if (binding & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) {
+               bo = r600_bomgr_bo_create(radeon->bomgr, size, alignment, *radeon->cfence);
+               if (bo) {
+                       return bo;
+               }
+       }
 
-       if (binding & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
-               man = radeon->cman;
-       else
-               man = radeon->kman;
+       rbo = radeon_bo(radeon, 0, size, alignment);
+       if (rbo == NULL) {
+               return NULL;
+       }
+
+       bo = calloc(1, sizeof(struct r600_bo));
+       bo->size = size;
+       bo->alignment = alignment;
+       bo->bo = rbo;
+       if (binding & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) {
+               r600_bomgr_bo_init(radeon->bomgr, bo);
+       }
 
        /* Staging resources particpate in transfers and blits only
         * and are used for uploads and downloads from regular
         * resources.  We generate them internally for some transfers.
         */
        if (usage == PIPE_USAGE_STAGING)
-                ws_bo->domains = RADEON_GEM_DOMAIN_CPU | RADEON_GEM_DOMAIN_GTT;
-        else
-                ws_bo->domains = (RADEON_GEM_DOMAIN_CPU |
-                                  RADEON_GEM_DOMAIN_GTT |
-                                  RADEON_GEM_DOMAIN_VRAM);
-
-
-       ws_bo->pb = man->create_buffer(man, size, &desc);
-       if (ws_bo->pb == NULL) {
-               free(ws_bo);
-               return NULL;
-       }
+               bo->domains = RADEON_GEM_DOMAIN_CPU | RADEON_GEM_DOMAIN_GTT;
+       else
+               bo->domains = (RADEON_GEM_DOMAIN_CPU |
+                               RADEON_GEM_DOMAIN_GTT |
+                               RADEON_GEM_DOMAIN_VRAM);
 
-       pipe_reference_init(&ws_bo->reference, 1);
-       return ws_bo;
+       pipe_reference_init(&bo->reference, 1);
+       return bo;
 }
 
 struct r600_bo *r600_bo_handle(struct radeon *radeon,
                               unsigned handle, unsigned *array_mode)
 {
-       struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo));
-       struct radeon_bo *bo;
+       struct r600_bo *bo = calloc(1, sizeof(struct r600_bo));
+       struct radeon_bo *rbo;
 
-       ws_bo->pb = radeon_bo_pb_create_buffer_from_handle(radeon->kman, handle);
-       if (!ws_bo->pb) {
-               free(ws_bo);
+       rbo = bo->bo = radeon_bo(radeon, handle, 0, 0);
+       if (rbo == NULL) {
+               free(bo);
                return NULL;
        }
-       bo = radeon_bo_pb_get_bo(ws_bo->pb);
-       ws_bo->size = bo->size;
-       ws_bo->domains = (RADEON_GEM_DOMAIN_CPU |
-                         RADEON_GEM_DOMAIN_GTT |
-                         RADEON_GEM_DOMAIN_VRAM);
+       bo->size = rbo->size;
+       bo->domains = (RADEON_GEM_DOMAIN_CPU |
+                       RADEON_GEM_DOMAIN_GTT |
+                       RADEON_GEM_DOMAIN_VRAM);
 
-       pipe_reference_init(&ws_bo->reference, 1);
+       pipe_reference_init(&bo->reference, 1);
 
-       radeon_bo_get_tiling_flags(radeon, bo, &ws_bo->tiling_flags,
-                                  &ws_bo->kernel_pitch);
+       radeon_bo_get_tiling_flags(radeon, rbo, &bo->tiling_flags, &bo->kernel_pitch);
        if (array_mode) {
-               if (ws_bo->tiling_flags) {
-                       if (ws_bo->tiling_flags & RADEON_TILING_MICRO)
+               if (bo->tiling_flags) {
+                       if (bo->tiling_flags & RADEON_TILING_MICRO)
                                *array_mode = V_0280A0_ARRAY_1D_TILED_THIN1;
-                       if ((ws_bo->tiling_flags & (RADEON_TILING_MICRO | RADEON_TILING_MACRO)) ==
+                       if ((bo->tiling_flags & (RADEON_TILING_MICRO | RADEON_TILING_MACRO)) ==
                            (RADEON_TILING_MICRO | RADEON_TILING_MACRO))
                                *array_mode = V_0280A0_ARRAY_2D_TILED_THIN1;
                } else {
                        *array_mode = 0;
                }
        }
-       return ws_bo;
+       return bo;
 }
 
 void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx)
 {
-       return pb_map(bo->pb, usage, ctx);
+       struct pipe_context *pctx = ctx;
+
+       if (usage & PB_USAGE_UNSYNCHRONIZED) {
+               radeon_bo_map(radeon, bo->bo);
+               return (uint8_t *) bo->bo->data + bo->offset;
+       }
+
+       if (p_atomic_read(&bo->bo->reference.count) > 1) {
+               if (usage & PB_USAGE_DONTBLOCK) {
+                       return NULL;
+               }
+               if (ctx) {
+                       pctx->flush(pctx, 0, NULL);
+               }
+       }
+
+       if (usage & PB_USAGE_DONTBLOCK) {
+               uint32_t domain;
+
+               if (radeon_bo_busy(radeon, bo->bo, &domain))
+                       return NULL;
+               if (radeon_bo_map(radeon, bo->bo)) {
+                       return NULL;
+               }
+               goto out;
+       }
+
+       radeon_bo_map(radeon, bo->bo);
+       if (radeon_bo_wait(radeon, bo->bo)) {
+               radeon_bo_unmap(radeon, bo->bo);
+               return NULL;
+       }
+
+out:
+       return (uint8_t *) bo->bo->data + bo->offset;
 }
 
 void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo)
 {
-       pb_unmap(bo->pb);
+       radeon_bo_unmap(radeon, bo->bo);
 }
 
-static void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo)
+void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo)
 {
-       if (bo->pb)
-               pb_reference(&bo->pb, NULL);
+       if (bo->manager_id) {
+               if (!r600_bomgr_bo_destroy(radeon->bomgr, bo)) {
+                       /* destroy is delayed by buffer manager */
+                       return;
+               }
+       }
+       radeon_bo_reference(radeon, &bo->bo, NULL);
        free(bo);
 }
 
-void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst,
-                           struct r600_bo *src)
+void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst, struct r600_bo *src)
 {
        struct r600_bo *old = *dst;
-               
+
        if (pipe_reference(&(*dst)->reference, &src->reference)) {
                r600_bo_destroy(radeon, old);
        }
        *dst = src;
 }
 
-unsigned r600_bo_get_handle(struct r600_bo *pb_bo)
-{
-       struct radeon_bo *bo;
-
-       bo = radeon_bo_pb_get_bo(pb_bo->pb);
-       if (!bo)
-               return 0;
-
-       return bo->handle;
-}
-
-unsigned r600_bo_get_size(struct r600_bo *pb_bo)
-{
-       struct radeon_bo *bo;
-
-       bo = radeon_bo_pb_get_bo(pb_bo->pb);
-       if (!bo)
-               return 0;
-
-       return bo->size;
-}
-
-boolean r600_bo_get_winsys_handle(struct radeon *radeon, struct r600_bo *pb_bo,
+boolean r600_bo_get_winsys_handle(struct radeon *radeon, struct r600_bo *bo,
                                unsigned stride, struct winsys_handle *whandle)
 {
-       struct radeon_bo *bo;
-
-       bo = radeon_bo_pb_get_bo(pb_bo->pb);
-       if (!bo)
-               return FALSE;
-
        whandle->stride = stride;
        switch(whandle->type) {
        case DRM_API_HANDLE_TYPE_KMS:
-               whandle->handle = r600_bo_get_handle(pb_bo);
+               whandle->handle = r600_bo_get_handle(bo);
                break;
        case DRM_API_HANDLE_TYPE_SHARED:
-               if (radeon_bo_get_name(radeon, bo, &whandle->handle))
+               if (radeon_bo_get_name(radeon, bo->bo, &whandle->handle))
                        return FALSE;
                break;
        default:
diff --git a/src/gallium/winsys/r600/drm/r600_bomgr.c b/src/gallium/winsys/r600/drm/r600_bomgr.c
new file mode 100644 (file)
index 0000000..446ef0f
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2010 VMWare.
+ * Copyright 2010 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *      Jose Fonseca <jrfonseca-at-vmware-dot-com>
+ *      Thomas Hellström <thomas-at-vmware-dot-com>
+ *      Jerome Glisse <jglisse@redhat.com>
+ */
+#include <util/u_memory.h>
+#include <util/u_double_list.h>
+#include <util/u_time.h>
+#include <pipebuffer/pb_bufmgr.h>
+#include "r600_priv.h"
+
+static void r600_bomgr_timeout_flush(struct r600_bomgr *mgr)
+{
+       struct r600_bo *bo, *tmp;
+       int64_t now;
+
+       now = os_time_get();
+       LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &mgr->delayed, list) {
+               if(!os_time_timeout(bo->start, bo->end, now))
+                       break;
+
+               mgr->num_delayed--;
+               bo->manager_id = 0;
+               LIST_DEL(&bo->list);
+               r600_bo_destroy(mgr->radeon, bo);
+       }
+}
+
+static INLINE int r600_bo_is_compat(struct r600_bomgr *mgr,
+                                       struct r600_bo *bo,
+                                       unsigned size,
+                                       unsigned alignment,
+                                       unsigned cfence)
+{
+       if(bo->size < size) {
+               return 0;
+       }
+
+       /* be lenient with size */
+       if(bo->size >= 2*size) {
+               return 0;
+       }
+
+       if(!pb_check_alignment(alignment, bo->alignment)) {
+               return 0;
+       }
+
+       if (!fence_is_after(cfence, bo->fence)) {
+               return 0;
+       }
+
+       return 1;
+}
+
+struct r600_bo *r600_bomgr_bo_create(struct r600_bomgr *mgr,
+                                       unsigned size,
+                                       unsigned alignment,
+                                       unsigned cfence)
+{
+       struct r600_bo *bo, *tmp;
+       int64_t now;
+
+
+       pipe_mutex_lock(mgr->mutex);
+
+       now = os_time_get();
+       LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &mgr->delayed, list) {
+               if(r600_bo_is_compat(mgr, bo, size, alignment, cfence)) {
+                       LIST_DEL(&bo->list);
+                       --mgr->num_delayed;
+                       r600_bomgr_timeout_flush(mgr);
+                       pipe_mutex_unlock(mgr->mutex);
+                       LIST_INITHEAD(&bo->list);
+                       pipe_reference_init(&bo->reference, 1);
+                       return bo;
+               }
+
+               if(os_time_timeout(bo->start, bo->end, now)) {
+                       mgr->num_delayed--;
+                       bo->manager_id = 0;
+                       LIST_DEL(&bo->list);
+                       r600_bo_destroy(mgr->radeon, bo);
+               }
+       }
+
+       pipe_mutex_unlock(mgr->mutex);
+       return NULL;
+}
+
+void r600_bomgr_bo_init(struct r600_bomgr *mgr, struct r600_bo *bo)
+{
+       LIST_INITHEAD(&bo->list);
+       bo->manager_id = 1;
+}
+
+bool r600_bomgr_bo_destroy(struct r600_bomgr *mgr, struct r600_bo *bo)
+{
+       bo->start = os_time_get();
+       bo->end = bo->start + mgr->usecs;
+       pipe_mutex_lock(mgr->mutex);
+       LIST_ADDTAIL(&bo->list, &mgr->delayed);
+       ++mgr->num_delayed;
+       pipe_mutex_unlock(mgr->mutex);
+       return FALSE;
+}
+
+void r600_bomgr_destroy(struct r600_bomgr *mgr)
+{
+       struct r600_bo *bo, *tmp;
+
+       pipe_mutex_lock(mgr->mutex);
+       LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &mgr->delayed, list) {
+               mgr->num_delayed--;
+               bo->manager_id = 0;
+               LIST_DEL(&bo->list);
+               r600_bo_destroy(mgr->radeon, bo);
+       }
+       pipe_mutex_unlock(mgr->mutex);
+
+       FREE(mgr);
+}
+
+struct r600_bomgr *r600_bomgr_create(struct radeon *radeon, unsigned usecs)
+{
+       struct r600_bomgr *mgr;
+
+       mgr = CALLOC_STRUCT(r600_bomgr);
+       if (mgr == NULL)
+               return NULL;
+
+       mgr->radeon = radeon;
+       mgr->usecs = usecs;
+       LIST_INITHEAD(&mgr->delayed);
+       mgr->num_delayed = 0;
+       pipe_mutex_init(mgr->mutex);
+
+       return mgr;
+}
index 8b1d88aed7d8909c9cbf9667fe5881563af17057..ee262c3ea52a74c946e0fab8095bd0495b24c7f0 100644 (file)
 #ifndef RADEON_INFO_TILING_CONFIG
 #define RADEON_INFO_TILING_CONFIG 0x6
 #endif
+
+static struct radeon *radeon_new(int fd, unsigned device);
+
+enum radeon_family r600_get_family(struct radeon *r600)
+{
+       return r600->family;
+}
+
+enum chip_class r600_get_family_class(struct radeon *radeon)
+{
+       return radeon->chip_class;
+}
+
+struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon)
+{
+       return &radeon->tiling_info;
+}
+
 static int radeon_get_device(struct radeon *radeon)
 {
        struct drm_radeon_info info;
@@ -108,7 +126,19 @@ static int radeon_drm_get_tiling(struct radeon *radeon)
        return 0;
 }
 
-struct radeon *radeon_new(int fd, unsigned device)
+static int radeon_init_fence(struct radeon *radeon)
+{
+       radeon->fence = 1;
+       radeon->fence_bo = r600_bo(radeon, 4096, 0, 0, 0);
+       if (radeon->fence_bo == NULL) {
+               return -ENOMEM;
+       }
+       radeon->cfence = r600_bo_map(radeon, radeon->fence_bo, PB_USAGE_UNSYNCHRONIZED, NULL);
+       *radeon->cfence = 0;
+       return 0;
+}
+
+static struct radeon *radeon_new(int fd, unsigned device)
 {
        struct radeon *radeon;
        int r;
@@ -132,59 +162,6 @@ struct radeon *radeon_new(int fd, unsigned device)
                fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->device);
                return radeon_decref(radeon);
        }
-       switch (radeon->family) {
-       case CHIP_R600:
-       case CHIP_RV610:
-       case CHIP_RV630:
-       case CHIP_RV670:
-       case CHIP_RV620:
-       case CHIP_RV635:
-       case CHIP_RS780:
-       case CHIP_RS880:
-       case CHIP_RV770:
-       case CHIP_RV730:
-       case CHIP_RV710:
-       case CHIP_RV740:
-       case CHIP_CEDAR:
-       case CHIP_REDWOOD:
-       case CHIP_JUNIPER:
-       case CHIP_CYPRESS:
-       case CHIP_HEMLOCK:
-       case CHIP_PALM:
-               break;
-       case CHIP_R100:
-       case CHIP_RV100:
-       case CHIP_RS100:
-       case CHIP_RV200:
-       case CHIP_RS200:
-       case CHIP_R200:
-       case CHIP_RV250:
-       case CHIP_RS300:
-       case CHIP_RV280:
-       case CHIP_R300:
-       case CHIP_R350:
-       case CHIP_RV350:
-       case CHIP_RV380:
-       case CHIP_R420:
-       case CHIP_R423:
-       case CHIP_RV410:
-       case CHIP_RS400:
-       case CHIP_RS480:
-       case CHIP_RS600:
-       case CHIP_RS690:
-       case CHIP_RS740:
-       case CHIP_RV515:
-       case CHIP_R520:
-       case CHIP_RV530:
-       case CHIP_RV560:
-       case CHIP_RV570:
-       case CHIP_R580:
-       default:
-               fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
-                       __func__, radeon->device);
-               break;
-       }
-
        /* setup class */
        switch (radeon->family) {
        case CHIP_R600:
@@ -213,6 +190,9 @@ struct radeon *radeon_new(int fd, unsigned device)
        case CHIP_CYPRESS:
        case CHIP_HEMLOCK:
        case CHIP_PALM:
+       case CHIP_BARTS:
+       case CHIP_TURKS:
+       case CHIP_CAICOS:
                radeon->chip_class = EVERGREEN;
                /* set default group bytes, overridden by tiling info ioctl */
                radeon->tiling_info.group_bytes = 512;
@@ -227,12 +207,15 @@ struct radeon *radeon_new(int fd, unsigned device)
                if (radeon_drm_get_tiling(radeon))
                        return NULL;
        }
-       radeon->kman = radeon_bo_pbmgr_create(radeon);
-       if (!radeon->kman)
+       radeon->bomgr = r600_bomgr_create(radeon, 1000000);
+       if (radeon->bomgr == NULL) {
                return NULL;
-       radeon->cman = pb_cache_manager_create(radeon->kman, 100000);
-       if (!radeon->cman)
+       }
+       r = radeon_init_fence(radeon);
+       if (r) {
+               radeon_decref(radeon);
                return NULL;
+       }
        return radeon;
 }
 
@@ -249,14 +232,15 @@ struct radeon *radeon_decref(struct radeon *radeon)
                return NULL;
        }
 
-        if (radeon->cman)
-           radeon->cman->destroy(radeon->cman);
+       if (radeon->fence_bo) {
+               r600_bo_reference(radeon, &radeon->fence_bo, NULL);
+       }
 
-        if (radeon->kman)
-           radeon->kman->destroy(radeon->kman);
+       if (radeon->bomgr)
+               r600_bomgr_destroy(radeon->bomgr);
 
-        if (radeon->fd >= 0)
-           drmClose(radeon->fd);
+       if (radeon->fd >= 0)
+               drmClose(radeon->fd);
 
        free(radeon);
        return NULL;
index de228918953590f91722ee2358ee027252b0dc29..f10e2fda6f2b530f3038b45ae818e2301258746d 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include <assert.h>
+#include <pipe/p_compiler.h>
+#include <util/u_inlines.h>
+#include <util/u_memory.h>
+#include <pipebuffer/pb_bufmgr.h>
 #include "xf86drm.h"
-#include "r600.h"
-#include "r600d.h"
 #include "radeon_drm.h"
-#include "bof.h"
-#include "pipe/p_compiler.h"
-#include "util/u_inlines.h"
-#include "util/u_memory.h"
-#include <pipebuffer/pb_bufmgr.h>
 #include "r600_priv.h"
+#include "bof.h"
+#include "r600d.h"
 
 #define GROUP_FORCE_NEW_BLOCK  0
 
-int r600_context_init_fence(struct r600_context *ctx)
-{
-       ctx->fence = 1;
-       ctx->fence_bo = r600_bo(ctx->radeon, 4096, 0, 0, 0);
-       if (ctx->fence_bo == NULL) {
-               return -ENOMEM;
-       }
-       ctx->cfence = r600_bo_map(ctx->radeon, ctx->fence_bo, PB_USAGE_UNSYNCHRONIZED, NULL);
-       *ctx->cfence = 0;
-       LIST_INITHEAD(&ctx->fenced_bo);
-       return 0;
-}
-
 static void INLINE r600_context_update_fenced_list(struct r600_context *ctx)
 {
        for (int i = 0; i < ctx->creloc; i++) {
                if (!LIST_IS_EMPTY(&ctx->bo[i]->fencedlist))
                        LIST_DELINIT(&ctx->bo[i]->fencedlist);
                LIST_ADDTAIL(&ctx->bo[i]->fencedlist, &ctx->fenced_bo);
-               ctx->bo[i]->fence = ctx->fence;
+               ctx->bo[i]->fence = ctx->radeon->fence;
                ctx->bo[i]->ctx = ctx;
        }
 }
@@ -71,7 +57,7 @@ static void INLINE r600_context_fence_wraparound(struct r600_context *ctx, unsig
        struct radeon_bo *tmp;
 
        LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &ctx->fenced_bo, fencedlist) {
-               if (bo->fence <= *ctx->cfence) {
+               if (bo->fence <= *ctx->radeon->cfence) {
                        LIST_DELINIT(&bo->fencedlist);
                        bo->fence = 0;
                } else {
@@ -618,6 +604,9 @@ void r600_context_fini(struct r600_context *ctx)
                                        range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
                                        range->blocks[CTX_BLOCK_ID(ctx, offset)] = NULL;
                                }
+                               for (int k = 1; k <= block->nbo; k++) {
+                                       r600_bo_reference(ctx->radeon, &block->reloc[k].bo, NULL);
+                               }
                                free(block);
                        }
                }
@@ -629,9 +618,6 @@ void r600_context_fini(struct r600_context *ctx)
        free(ctx->pm4);
 
        r600_context_clear_fenced_bo(ctx);
-       if (ctx->fence_bo) {
-               r600_bo_reference(ctx->radeon, &ctx->fence_bo, NULL);
-       }
        memset(ctx, 0, sizeof(struct r600_context));
 }
 
@@ -760,10 +746,7 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon)
        /* save 16dwords space for fence mecanism */
        ctx->pm4_ndwords -= 16;
 
-       r = r600_context_init_fence(ctx);
-       if (r) {
-               goto out_err;
-       }
+       LIST_INITHEAD(&ctx->fenced_bo);
 
        /* init dirty list */
        LIST_INITHEAD(&ctx->dirty);
@@ -811,6 +794,7 @@ void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *r
        ctx->reloc[ctx->creloc].write_domain = rbo->domains & (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM);
        ctx->reloc[ctx->creloc].flags = 0;
        radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo);
+       rbo->fence = ctx->radeon->fence;
        ctx->creloc++;
        /* set PKT3 to point to proper reloc */
        *pm4 = bo->reloc_id;
@@ -833,6 +817,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat
                        /* find relocation */
                        id = block->pm4_bo_index[id];
                        r600_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo);
+                       state->regs[i].bo->fence = ctx->radeon->fence;
                }
                if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
                        block->status |= R600_BLOCK_STATUS_ENABLED;
@@ -872,10 +857,13 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx
                 */
                r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
                r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
+               state->regs[0].bo->fence = ctx->radeon->fence;
        } else {
                /* TEXTURE RESOURCE */
                r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
                r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
+               state->regs[2].bo->fence = ctx->radeon->fence;
+               state->regs[3].bo->fence = ctx->radeon->fence;
        }
        if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
                block->status |= R600_BLOCK_STATUS_ENABLED;
@@ -1108,18 +1096,18 @@ void r600_context_flush(struct r600_context *ctx)
        /* suspend queries */
        r600_context_queries_suspend(ctx);
 
-       radeon_bo_pbmgr_flush_maps(ctx->radeon->kman);
-
        /* emit fence */
+       ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0);
+       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4);
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4);
        ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT) | EVENT_INDEX(5);
        ctx->pm4[ctx->pm4_cdwords++] = 0;
        ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24);
-       ctx->pm4[ctx->pm4_cdwords++] = ctx->fence;
+       ctx->pm4[ctx->pm4_cdwords++] = ctx->radeon->fence;
        ctx->pm4[ctx->pm4_cdwords++] = 0;
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
        ctx->pm4[ctx->pm4_cdwords++] = 0;
-       r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], ctx->fence_bo);
+       r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], ctx->radeon->fence_bo);
 
 #if 1
        /* emit cs */
@@ -1136,18 +1124,18 @@ void r600_context_flush(struct r600_context *ctx)
        r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib,
                                sizeof(struct drm_radeon_cs));
 #else
-       *ctx->cfence = ctx->fence;
+       *ctx->radeon->cfence = ctx->radeon->fence;
 #endif
 
        r600_context_update_fenced_list(ctx);
 
-       fence = ctx->fence + 1;
-       if (fence < ctx->fence) {
+       fence = ctx->radeon->fence + 1;
+       if (fence < ctx->radeon->fence) {
                /* wrap around */
                fence = 1;
                r600_context_fence_wraparound(ctx, fence);
        }
-       ctx->fence = fence;
+       ctx->radeon->fence = fence;
 
        /* restart */
        for (int i = 0; i < ctx->creloc; i++) {
index 9fd77b71c775c562097d47f71fc5a25d6fc9009e..a38a6481b4febf8d9ed294ecb3f13e28dc8cc7f0 100644 (file)
 #include <stdint.h>
 #include <stdlib.h>
 #include <assert.h>
-#include <pipebuffer/pb_bufmgr.h>
-#include "util/u_double_list.h"
+#include <util/u_double_list.h>
+#include <util/u_inlines.h>
+#include <os/os_thread.h>
 #include "r600.h"
 
+struct r600_bomgr;
+struct r600_bo;
+
 struct radeon {
        int                             fd;
        int                             refcount;
        unsigned                        device;
        unsigned                        family;
        enum chip_class                 chip_class;
-       struct pb_manager *kman; /* kernel bo manager */
-       struct pb_manager *cman; /* cached bo manager */
-       struct r600_tiling_info tiling_info;
+       struct r600_tiling_info         tiling_info;
+       struct r600_bomgr               *bomgr;
+       unsigned                        fence;
+       unsigned                        *cfence;
+       struct r600_bo                  *fence_bo;
 };
 
-struct radeon *r600_new(int fd, unsigned device);
-void r600_delete(struct radeon *r600);
-
 struct r600_reg {
        unsigned                        opcode;
        unsigned                        offset_base;
@@ -75,28 +78,49 @@ struct radeon_bo {
 
 struct r600_bo {
        struct pipe_reference           reference;
-       struct pb_buffer                *pb;
        unsigned                        size;
        unsigned                        tiling_flags;
-       unsigned                        kernel_pitch;
+       unsigned                        kernel_pitch;
        unsigned                        domains;
+       struct radeon_bo                *bo;
+       unsigned                        fence;
+       /* manager data */
+       struct list_head                list;
+       unsigned                        manager_id;
+       unsigned                        alignment;
+       unsigned                        offset;
+       int64_t                         start;
+       int64_t                         end;
 };
 
+struct r600_bomgr {
+       struct radeon                   *radeon;
+       unsigned                        usecs;
+       pipe_mutex                      mutex;
+       struct list_head                delayed;
+       unsigned                        num_delayed;
+};
 
-/* radeon_pciid.c */
-unsigned radeon_family_from_device(unsigned device);
+/*
+ * r600_drm.c
+ */
+struct radeon *r600_new(int fd, unsigned device);
+void r600_delete(struct radeon *r600);
 
-/* r600_drm.c */
-struct radeon *radeon_decref(struct radeon *radeon);
+/*
+ * radeon_pciid.c
+ */
+unsigned radeon_family_from_device(unsigned device);
 
-/* radeon_bo.c */
+/*
+ * radeon_bo.c
+ */
 struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
                            unsigned size, unsigned alignment);
 void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst,
                         struct radeon_bo *src);
 int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo);
 int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain);
-void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr);
 int radeon_bo_fencelist(struct radeon *radeon, struct radeon_bo **bolist, uint32_t num_bo);
 int radeon_bo_get_tiling_flags(struct radeon *radeon,
                               struct radeon_bo *bo,
@@ -106,13 +130,9 @@ int radeon_bo_get_name(struct radeon *radeon,
                       struct radeon_bo *bo,
                       uint32_t *name);
 
-/* radeon_bo_pb.c */
-struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
-struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon);
-struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr,
-                                                        uint32_t handle);
-
-/* r600_hw_context.c */
+/*
+ * r600_hw_context.c
+ */
 int r600_context_init_fence(struct r600_context *ctx);
 void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo);
 void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags,
@@ -120,14 +140,27 @@ void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags,
 struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset);
 int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg);
 
-/* r600_bo.c */
-unsigned r600_bo_get_handle(struct r600_bo *bo);
-unsigned r600_bo_get_size(struct r600_bo *bo);
-static INLINE struct radeon_bo *r600_bo_get_bo(struct r600_bo *bo)
-{
-       return radeon_bo_pb_get_bo(bo->pb);
-}
+/*
+ * r600_bo.c
+ */
+void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo);
+
+/*
+ * r600_bomgr.c
+ */
+struct r600_bomgr *r600_bomgr_create(struct radeon *radeon, unsigned usecs);
+void r600_bomgr_destroy(struct r600_bomgr *mgr);
+bool r600_bomgr_bo_destroy(struct r600_bomgr *mgr, struct r600_bo *bo);
+void r600_bomgr_bo_init(struct r600_bomgr *mgr, struct r600_bo *bo);
+struct r600_bo *r600_bomgr_bo_create(struct r600_bomgr *mgr,
+                                       unsigned size,
+                                       unsigned alignment,
+                                       unsigned cfence);
 
+
+/*
+ * helpers
+ */
 #define CTX_RANGE_ID(ctx, offset) (((offset) >> (ctx)->hash_shift) & 255)
 #define CTX_BLOCK_ID(ctx, offset) ((offset) & ((1 << (ctx)->hash_shift) - 1))
 
@@ -175,6 +208,9 @@ static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struc
        LIST_DELINIT(&block->list);
 }
 
+/*
+ * radeon_bo.c
+ */
 static inline int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
 {
        bo->map_count++;
@@ -187,4 +223,35 @@ static inline void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo)
        assert(bo->map_count >= 0);
 }
 
+/*
+ * r600_bo
+ */
+static inline struct radeon_bo *r600_bo_get_bo(struct r600_bo *bo)
+{
+       return bo->bo;
+}
+
+static unsigned inline r600_bo_get_handle(struct r600_bo *bo)
+{
+       return bo->bo->handle;
+}
+
+static unsigned inline r600_bo_get_size(struct r600_bo *bo)
+{
+       return bo->size;
+}
+
+/*
+ * fence
+ */
+static inline bool fence_is_after(unsigned fence, unsigned ofence)
+{
+       /* handle wrap around */
+       if (fence < 0x80000000 && ofence > 0x80000000)
+               return TRUE;
+       if (fence > ofence)
+               return TRUE;
+       return FALSE;
+}
+
 #endif
index 4a08d504aabfcece687df22f606a90f8a71018e6..1c1ac76fe69d0b5099b1e91353b47e0a7597b3eb 100644 (file)
@@ -91,6 +91,7 @@
 #define PKT3_SET_CTL_CONST                     0x6F
 #define PKT3_SURFACE_BASE_UPDATE               0x73
 
+#define EVENT_TYPE_PS_PARTIAL_FLUSH            0x10
 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14
 #define EVENT_TYPE_ZPASS_DONE                  0x15
 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT   0x16
index 557cfb959705708aa573818f77885847ad78e2c6..7e5f392efae079d2d87af07be19aa5646a7d29a7 100644 (file)
@@ -156,7 +156,7 @@ int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo)
         if (!bo->shared) {
                 if (!bo->fence)
                        return 0;
-               if (bo->fence <= *bo->ctx->cfence) {
+               if (bo->fence <= *radeon->cfence) {
                        LIST_DELINIT(&bo->fencedlist);
                        bo->fence = 0;
                        return 0;
@@ -181,7 +181,7 @@ int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain
        if (!bo->shared) {
                if (!bo->fence)
                        return 0;
-               if (bo->fence <= *bo->ctx->cfence) {
+               if (bo->fence <= *radeon->cfence) {
                        LIST_DELINIT(&bo->fencedlist);
                        bo->fence = 0;
                        return 0;
diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c
deleted file mode 100644 (file)
index 312552f..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright 2010 Dave Airlie
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *      Dave Airlie
- */
-#include <util/u_inlines.h>
-#include <util/u_memory.h>
-#include <util/u_double_list.h>
-#include <pipebuffer/pb_buffer.h>
-#include <pipebuffer/pb_bufmgr.h>
-#include "r600_priv.h"
-
-struct radeon_bo_pb {
-       struct pb_buffer b;
-       struct radeon_bo *bo;
-
-       struct radeon_bo_pbmgr *mgr;
-       struct list_head maplist;
-};
-
-extern const struct pb_vtbl radeon_bo_pb_vtbl;
-
-static INLINE struct radeon_bo_pb *radeon_bo_pb(struct pb_buffer *buf)
-{
-       assert(buf);
-       assert(buf->vtbl == &radeon_bo_pb_vtbl);
-       return (struct radeon_bo_pb *)buf;
-}
-
-struct radeon_bo_pbmgr {
-       struct pb_manager b;
-       struct radeon *radeon;
-       struct list_head buffer_map_list;
-};
-
-static INLINE struct radeon_bo_pbmgr *radeon_bo_pbmgr(struct pb_manager *mgr)
-{
-       assert(mgr);
-       return (struct radeon_bo_pbmgr *)mgr;
-}
-
-static void radeon_bo_pb_destroy(struct pb_buffer *_buf)
-{
-       struct radeon_bo_pb *buf = radeon_bo_pb(_buf);
-
-       /* If this buffer is on the list of buffers to unmap,
-        * do the unmapping now.
-        */
-       if (!LIST_IS_EMPTY(&buf->maplist))
-               radeon_bo_unmap(buf->mgr->radeon, buf->bo);
-
-       LIST_DEL(&buf->maplist);
-       radeon_bo_reference(buf->mgr->radeon, &buf->bo, NULL);
-       FREE(buf);
-}
-
-static void *
-radeon_bo_pb_map_internal(struct pb_buffer *_buf,
-                         unsigned flags, void *ctx)
-{
-       struct radeon_bo_pb *buf = radeon_bo_pb(_buf);
-       struct pipe_context *pctx = ctx;
-
-       if (flags & PB_USAGE_UNSYNCHRONIZED) {
-               if (radeon_bo_map(buf->mgr->radeon, buf->bo)) {
-                       return NULL;
-               }
-               LIST_DELINIT(&buf->maplist);
-               return buf->bo->data;
-       }
-
-       if (p_atomic_read(&buf->bo->reference.count) > 1) {
-               if (flags & PB_USAGE_DONTBLOCK) {
-                       return NULL;
-               }
-               if (ctx) {
-                       pctx->flush(pctx, 0, NULL);
-               }
-       }
-
-       if (flags & PB_USAGE_DONTBLOCK) {
-               uint32_t domain;
-               if (radeon_bo_busy(buf->mgr->radeon, buf->bo, &domain))
-                       return NULL;
-               if (radeon_bo_map(buf->mgr->radeon, buf->bo)) {
-                       return NULL;
-               }
-               goto out;
-       }
-
-       if (radeon_bo_map(buf->mgr->radeon, buf->bo)) {
-               return NULL;
-       }
-       if (radeon_bo_wait(buf->mgr->radeon, buf->bo)) {
-               radeon_bo_unmap(buf->mgr->radeon, buf->bo);
-               return NULL;
-       }
-out:
-       LIST_DELINIT(&buf->maplist);
-       return buf->bo->data;
-}
-
-static void radeon_bo_pb_unmap_internal(struct pb_buffer *_buf)
-{
-       struct radeon_bo_pb *buf = radeon_bo_pb(_buf);
-       LIST_ADDTAIL(&buf->maplist, &buf->mgr->buffer_map_list);
-}
-
-static void
-radeon_bo_pb_get_base_buffer(struct pb_buffer *buf,
-                            struct pb_buffer **base_buf,
-                            unsigned *offset)
-{
-       *base_buf = buf;
-       *offset = 0;
-}
-
-static enum pipe_error
-radeon_bo_pb_validate(struct pb_buffer *_buf, 
-                     struct pb_validate *vl,
-                     unsigned flags)
-{
-       /* Always pinned */
-       return PIPE_OK;
-}
-
-static void
-radeon_bo_pb_fence(struct pb_buffer *buf,
-                  struct pipe_fence_handle *fence)
-{
-}
-
-const struct pb_vtbl radeon_bo_pb_vtbl = {
-    radeon_bo_pb_destroy,
-    radeon_bo_pb_map_internal,
-    radeon_bo_pb_unmap_internal,
-    radeon_bo_pb_validate,
-    radeon_bo_pb_fence,
-    radeon_bo_pb_get_base_buffer,
-};
-
-struct pb_buffer *
-radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr,
-                                      uint32_t handle)
-{
-       struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr);
-       struct radeon *radeon = mgr->radeon;
-       struct radeon_bo_pb *bo;
-       struct radeon_bo *hw_bo;
-
-       hw_bo = radeon_bo(radeon, handle, 0, 0);
-       if (hw_bo == NULL)
-               return NULL;
-
-       bo = CALLOC_STRUCT(radeon_bo_pb);
-       if (!bo) {
-               radeon_bo_reference(radeon, &hw_bo, NULL);
-               return NULL;
-       }
-
-       LIST_INITHEAD(&bo->maplist);
-       pipe_reference_init(&bo->b.base.reference, 1);
-       bo->b.base.alignment = 0;
-       bo->b.base.usage = PB_USAGE_GPU_WRITE | PB_USAGE_GPU_READ;
-       bo->b.base.size = hw_bo->size;
-       bo->b.vtbl = &radeon_bo_pb_vtbl;
-       bo->mgr = mgr;
-
-       bo->bo = hw_bo;
-
-       return &bo->b;
-}
-
-static struct pb_buffer *
-radeon_bo_pb_create_buffer(struct pb_manager *_mgr,
-                          pb_size size,
-                          const struct pb_desc *desc)
-{
-       struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr);
-       struct radeon *radeon = mgr->radeon;
-       struct radeon_bo_pb *bo;
-
-       bo = CALLOC_STRUCT(radeon_bo_pb);
-       if (!bo)
-               goto error1;
-
-       pipe_reference_init(&bo->b.base.reference, 1);
-       bo->b.base.alignment = desc->alignment;
-       bo->b.base.usage = desc->usage;
-       bo->b.base.size = size;
-       bo->b.vtbl = &radeon_bo_pb_vtbl;
-       bo->mgr = mgr;
-
-       LIST_INITHEAD(&bo->maplist);
-
-       bo->bo = radeon_bo(radeon, 0, size, desc->alignment);
-       if (bo->bo == NULL)
-               goto error2;
-       return &bo->b;
-
-error2:
-       FREE(bo);
-error1:
-       return NULL;
-}
-
-static void
-radeon_bo_pbmgr_flush(struct pb_manager *mgr)
-{
-    /* NOP */
-}
-
-static void
-radeon_bo_pbmgr_destroy(struct pb_manager *_mgr)
-{
-       struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr);
-       FREE(mgr);
-}
-
-struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon)
-{
-       struct radeon_bo_pbmgr *mgr;
-
-       mgr = CALLOC_STRUCT(radeon_bo_pbmgr);
-       if (!mgr)
-               return NULL;
-
-       mgr->b.destroy = radeon_bo_pbmgr_destroy;
-       mgr->b.create_buffer = radeon_bo_pb_create_buffer;
-       mgr->b.flush = radeon_bo_pbmgr_flush;
-
-       mgr->radeon = radeon;
-       LIST_INITHEAD(&mgr->buffer_map_list);
-       return &mgr->b;
-}
-
-void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr)
-{
-       struct radeon_bo_pbmgr *mgr = radeon_bo_pbmgr(_mgr);
-       struct radeon_bo_pb *rpb = NULL;
-       struct radeon_bo_pb *t_rpb;
-
-       LIST_FOR_EACH_ENTRY_SAFE(rpb, t_rpb, &mgr->buffer_map_list, maplist) {
-               radeon_bo_unmap(mgr->radeon, rpb->bo);
-               LIST_DELINIT(&rpb->maplist);
-       }
-
-       LIST_INITHEAD(&mgr->buffer_map_list);
-}
-
-struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf)
-{
-       struct radeon_bo_pb *buf;
-       if (_buf->vtbl == &radeon_bo_pb_vtbl) {
-               buf = radeon_bo_pb(_buf);
-               return buf->bo;
-       } else {
-               struct pb_buffer *base_buf;
-               pb_size offset;
-               pb_get_base_buffer(_buf, &base_buf, &offset);
-               if (base_buf->vtbl == &radeon_bo_pb_vtbl) {
-                       buf = radeon_bo_pb(base_buf);
-                       return buf->bo;
-               }
-       }
-       return NULL;
-}
index 18bddc1a7ab5652d8f4004fa4dd9479f7c58a43b..e2622abd46855b5b42d977c32787e772cedefc6e 100644 (file)
@@ -24,7 +24,7 @@
  *      Jerome Glisse
  */
 #include <stdlib.h>
-#include "r600.h"
+#include "r600_priv.h"
 
 struct pci_id {
        unsigned        vendor;
@@ -445,6 +445,42 @@ struct pci_id radeon_pci_id[] = {
        {0x1002, 0x9803, CHIP_PALM},
        {0x1002, 0x9804, CHIP_PALM},
        {0x1002, 0x9805, CHIP_PALM},
+       {0x1002, 0x6720, CHIP_BARTS},
+       {0x1002, 0x6721, CHIP_BARTS},
+       {0x1002, 0x6722, CHIP_BARTS},
+       {0x1002, 0x6723, CHIP_BARTS},
+       {0x1002, 0x6724, CHIP_BARTS},
+       {0x1002, 0x6725, CHIP_BARTS},
+       {0x1002, 0x6726, CHIP_BARTS},
+       {0x1002, 0x6727, CHIP_BARTS},
+       {0x1002, 0x6728, CHIP_BARTS},
+       {0x1002, 0x6729, CHIP_BARTS},
+       {0x1002, 0x6738, CHIP_BARTS},
+       {0x1002, 0x6739, CHIP_BARTS},
+       {0x1002, 0x6740, CHIP_TURKS},
+       {0x1002, 0x6741, CHIP_TURKS},
+       {0x1002, 0x6742, CHIP_TURKS},
+       {0x1002, 0x6743, CHIP_TURKS},
+       {0x1002, 0x6744, CHIP_TURKS},
+       {0x1002, 0x6745, CHIP_TURKS},
+       {0x1002, 0x6746, CHIP_TURKS},
+       {0x1002, 0x6747, CHIP_TURKS},
+       {0x1002, 0x6748, CHIP_TURKS},
+       {0x1002, 0x6749, CHIP_TURKS},
+       {0x1002, 0x6750, CHIP_TURKS},
+       {0x1002, 0x6758, CHIP_TURKS},
+       {0x1002, 0x6759, CHIP_TURKS},
+       {0x1002, 0x6760, CHIP_CAICOS},
+       {0x1002, 0x6761, CHIP_CAICOS},
+       {0x1002, 0x6762, CHIP_CAICOS},
+       {0x1002, 0x6763, CHIP_CAICOS},
+       {0x1002, 0x6764, CHIP_CAICOS},
+       {0x1002, 0x6765, CHIP_CAICOS},
+       {0x1002, 0x6766, CHIP_CAICOS},
+       {0x1002, 0x6767, CHIP_CAICOS},
+       {0x1002, 0x6768, CHIP_CAICOS},
+       {0x1002, 0x6770, CHIP_CAICOS},
+       {0x1002, 0x6779, CHIP_CAICOS},
        {0, 0},
 };
 
@@ -460,80 +496,3 @@ unsigned radeon_family_from_device(unsigned device)
        }
        return CHIP_UNKNOWN;
 }
-
-int radeon_is_family_compatible(unsigned family1, unsigned family2)
-{
-       switch (family1) {
-       case CHIP_R600:
-       case CHIP_RV610:
-       case CHIP_RV630:
-       case CHIP_RV670:
-       case CHIP_RV620:
-       case CHIP_RV635:
-       case CHIP_RS780:
-       case CHIP_RS880:
-       case CHIP_RV770:
-       case CHIP_RV730:
-       case CHIP_RV710:
-       case CHIP_RV740:
-       case CHIP_CEDAR:
-       case CHIP_REDWOOD:
-       case CHIP_JUNIPER:
-       case CHIP_CYPRESS:
-       case CHIP_HEMLOCK:
-       case CHIP_PALM:
-               switch (family2) {
-               case CHIP_R600:
-               case CHIP_RV610:
-               case CHIP_RV630:
-               case CHIP_RV670:
-               case CHIP_RV620:
-               case CHIP_RV635:
-               case CHIP_RS780:
-               case CHIP_RS880:
-               case CHIP_RV770:
-               case CHIP_RV730:
-               case CHIP_RV710:
-               case CHIP_RV740:
-               case CHIP_CEDAR:
-               case CHIP_REDWOOD:
-               case CHIP_JUNIPER:
-               case CHIP_CYPRESS:
-               case CHIP_HEMLOCK:
-               case CHIP_PALM:
-                       return 1;
-               default:
-                       return 0;
-               }
-               break;
-       case CHIP_R100:
-       case CHIP_RV100:
-       case CHIP_RS100:
-       case CHIP_RV200:
-       case CHIP_RS200:
-       case CHIP_R200:
-       case CHIP_RV250:
-       case CHIP_RS300:
-       case CHIP_RV280:
-       case CHIP_R300:
-       case CHIP_R350:
-       case CHIP_RV350:
-       case CHIP_RV380:
-       case CHIP_R420:
-       case CHIP_R423:
-       case CHIP_RV410:
-       case CHIP_RS400:
-       case CHIP_RS480:
-       case CHIP_RS600:
-       case CHIP_RS690:
-       case CHIP_RS740:
-       case CHIP_RV515:
-       case CHIP_R520:
-       case CHIP_RV530:
-       case CHIP_RV560:
-       case CHIP_RV570:
-       case CHIP_R580:
-       default:
-               return 0;
-       }
-}
index 7f69e39273599da042112859591c8394adb1d67f..7e339a2ecfeffd418f51b70b4f0ce675e57da663 100644 (file)
@@ -6,7 +6,8 @@ LIBNAME = radeonwinsys
 
 C_SOURCES = \
        radeon_drm_buffer.c \
-       radeon_drm.c \
+       radeon_drm_cs.c \
+       radeon_drm_common.c \
        radeon_r300.c
 
 LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r300 \
index 60e409fe10f01a588907ffcdefd23fc5f8d9eb36..80816621848e2afc223524b5ad366c09d4f18c9b 100644 (file)
@@ -4,7 +4,8 @@ env = env.Clone()
 
 radeon_sources = [
     'radeon_drm_buffer.c',
-    'radeon_drm.c',
+    'radeon_drm_cs.c',
+    'radeon_drm_common.c',
     'radeon_r300.c',
 ]
 
diff --git a/src/gallium/winsys/radeon/drm/radeon_buffer.h b/src/gallium/winsys/radeon/drm/radeon_buffer.h
deleted file mode 100644 (file)
index a8137d8..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright Â© 2008 Jérôme Glisse
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
- * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- */
-/*
- * Authors:
- *      Jérôme Glisse <glisse@freedesktop.org>
- */
-#ifndef RADEON_BUFFER_H
-#define RADEON_BUFFER_H
-
-#include <stdio.h>
-
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-
-#include "pipebuffer/pb_buffer.h"
-#include "pipebuffer/pb_bufmgr.h"
-
-#include "radeon_bo.h"
-#include "radeon_cs.h"
-
-#include "radeon_winsys.h"
-
-#define RADEON_PB_USAGE_VERTEX      (1 << 28)
-#define RADEON_PB_USAGE_DOMAIN_GTT  (1 << 29)
-#define RADEON_PB_USAGE_DOMAIN_VRAM (1 << 30)
-
-static INLINE struct pb_buffer *
-radeon_pb_buffer(struct r300_winsys_buffer *buffer)
-{
-    return (struct pb_buffer *)buffer;
-}
-
-static INLINE struct r300_winsys_buffer *
-radeon_libdrm_winsys_buffer(struct pb_buffer *buffer)
-{
-    return (struct r300_winsys_buffer *)buffer;
-}
-
-struct pb_manager *
-radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws);
-
-void radeon_drm_bufmgr_add_buffer(struct r300_winsys_cs *cs,
-                                  struct r300_winsys_buffer *buf,
-                                  enum r300_buffer_domain rd,
-                                  enum r300_buffer_domain wd);
-
-void radeon_drm_bufmgr_write_reloc(struct r300_winsys_cs *cs,
-                                   struct r300_winsys_buffer *buf,
-                                  enum r300_buffer_domain rd,
-                                   enum r300_buffer_domain wd);
-
-struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr,
-                                                             uint32_t handle);
-
-void radeon_drm_bufmgr_get_tiling(struct r300_winsys_screen *ws,
-                                  struct r300_winsys_buffer *buf,
-                                  enum r300_buffer_tiling *microtiled,
-                                  enum r300_buffer_tiling *macrotiled);
-
-void radeon_drm_bufmgr_set_tiling(struct r300_winsys_screen *ws,
-                                  struct r300_winsys_buffer *buf,
-                                  enum r300_buffer_tiling microtiled,
-                                  enum r300_buffer_tiling macrotiled,
-                                  uint32_t pitch);
-
-void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr);
-
-boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
-                                    struct winsys_handle *whandle);
-
-boolean radeon_drm_bufmgr_is_buffer_referenced(struct r300_winsys_cs *cs,
-                                               struct r300_winsys_buffer *buf,
-                                               enum r300_reference_domain domain);
-
-void radeon_drm_bufmgr_wait(struct r300_winsys_screen *ws,
-                            struct r300_winsys_buffer *buf);
-
-void *radeon_drm_buffer_map(struct r300_winsys_screen *ws,
-                            struct r300_winsys_buffer *buf,
-                            struct r300_winsys_cs *cs,
-                            enum pipe_transfer_usage usage);
-
-void radeon_drm_buffer_unmap(struct r300_winsys_screen *ws,
-                             struct r300_winsys_buffer *buf);
-
-#endif
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.c b/src/gallium/winsys/radeon/drm/radeon_drm.c
deleted file mode 100644 (file)
index 86d4f94..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright Â© 2009 Corbin Simpson
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
- * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- */
-/*
- * Authors:
- *      Corbin Simpson <MostAwesomeDude@gmail.com>
- *      Joakim Sindholt <opensource@zhasha.com>
- */
-
-#include "radeon_drm.h"
-#include "radeon_r300.h"
-#include "radeon_buffer.h"
-#include "radeon_drm_public.h"
-
-#include "r300_winsys.h"
-
-#include "util/u_memory.h"
-
-#include "xf86drm.h"
-
-static struct radeon_libdrm_winsys *
-radeon_winsys_create(int fd)
-{
-    struct radeon_libdrm_winsys *rws;
-
-    rws = CALLOC_STRUCT(radeon_libdrm_winsys);
-    if (rws == NULL) {
-        return NULL;
-    }
-
-    rws->fd = fd;
-    return rws;
-}
-
-/* Enable/disable Hyper-Z access. Return TRUE on success. */
-static boolean radeon_set_hyperz_access(int fd, boolean enable)
-{
-#ifndef RADEON_INFO_WANT_HYPERZ
-#define RADEON_INFO_WANT_HYPERZ 7
-#endif
-
-    struct drm_radeon_info info = {0};
-    unsigned value = enable ? 1 : 0;
-
-    if (!debug_get_bool_option("RADEON_HYPERZ", FALSE))
-        return FALSE;
-
-    info.value = (unsigned long)&value;
-    info.request = RADEON_INFO_WANT_HYPERZ;
-
-    if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0)
-        return FALSE;
-
-    if (enable && !value)
-        return FALSE;
-
-    return TRUE;
-}
-
-/* Helper function to do the ioctls needed for setup and init. */
-static void do_ioctls(int fd, struct radeon_libdrm_winsys* winsys)
-{
-    struct drm_radeon_gem_info gem_info = {0};
-    struct drm_radeon_info info = {0};
-    int target = 0;
-    int retval;
-    drmVersionPtr version;
-
-    info.value = (unsigned long)&target;
-
-    /* We do things in a specific order here.
-     *
-     * DRM version first. We need to be sure we're running on a KMS chipset.
-     * This is also for some features.
-     *
-     * Then, the PCI ID. This is essential and should return usable numbers
-     * for all Radeons. If this fails, we probably got handed an FD for some
-     * non-Radeon card.
-     *
-     * The GB and Z pipe requests should always succeed, but they might not
-     * return sensical values for all chipsets, but that's alright because
-     * the pipe drivers already know that.
-     *
-     * The GEM info is actually bogus on the kernel side, as well as our side
-     * (see radeon_gem_info_ioctl in radeon_gem.c) but that's alright because
-     * we don't actually use the info for anything yet. */
-
-    version = drmGetVersion(fd);
-    if (version->version_major != 2) {
-        fprintf(stderr, "%s: DRM version is %d.%d.%d but this driver is "
-                "only compatible with 2.x.x\n", __FUNCTION__,
-                version->version_major, version->version_minor,
-                version->version_patchlevel);
-        drmFreeVersion(version);
-        exit(1);
-    }
-
-/* XXX Remove this ifdef when libdrm version 2.4.19 becomes mandatory. */
-#ifdef RADEON_BO_FLAGS_MICRO_TILE_SQUARE
-    // Supported since 2.1.0.
-    winsys->squaretiling = version->version_major > 2 ||
-                           version->version_minor >= 1;
-#endif
-
-    winsys->drm_2_3_0 = version->version_major > 2 ||
-                        version->version_minor >= 3;
-
-    winsys->drm_2_6_0 = version->version_major > 2 ||
-                        (version->version_major == 2 &&
-                         version->version_minor >= 6);
-
-    info.request = RADEON_INFO_DEVICE_ID;
-    retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
-    if (retval) {
-        fprintf(stderr, "%s: Failed to get PCI ID, "
-                "error number %d\n", __FUNCTION__, retval);
-        exit(1);
-    }
-    winsys->pci_id = target;
-
-    info.request = RADEON_INFO_NUM_GB_PIPES;
-    retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
-    if (retval) {
-        fprintf(stderr, "%s: Failed to get GB pipe count, "
-                "error number %d\n", __FUNCTION__, retval);
-        exit(1);
-    }
-    winsys->gb_pipes = target;
-
-    info.request = RADEON_INFO_NUM_Z_PIPES;
-    retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
-    if (retval) {
-        fprintf(stderr, "%s: Failed to get Z pipe count, "
-                "error number %d\n", __FUNCTION__, retval);
-        exit(1);
-    }
-    winsys->z_pipes = target;
-
-    winsys->hyperz = radeon_set_hyperz_access(fd, TRUE);
-
-    retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO,
-            &gem_info, sizeof(gem_info));
-    if (retval) {
-        fprintf(stderr, "%s: Failed to get MM info, error number %d\n",
-                __FUNCTION__, retval);
-        exit(1);
-    }
-    winsys->gart_size = gem_info.gart_size;
-    winsys->vram_size = gem_info.vram_size;
-
-    debug_printf("radeon: Successfully grabbed chipset info from kernel!\n"
-                 "radeon: DRM version: %d.%d.%d ID: 0x%04x GB: %d Z: %d\n"
-                 "radeon: GART size: %d MB VRAM size: %d MB\n"
-                 "radeon: HyperZ: %s\n",
-                 version->version_major, version->version_minor,
-                 version->version_patchlevel, winsys->pci_id,
-                 winsys->gb_pipes, winsys->z_pipes,
-                 winsys->gart_size / 1024 / 1024,
-                 winsys->vram_size / 1024 / 1024,
-                 winsys->hyperz ? "YES" : "NO");
-
-    drmFreeVersion(version);
-}
-
-/* Create a pipe_screen. */
-struct r300_winsys_screen* r300_drm_winsys_screen_create(int drmFB)
-{
-    struct radeon_libdrm_winsys* rws; 
-    boolean ret;
-
-    rws = radeon_winsys_create(drmFB);
-    if (!rws)
-       return NULL;
-
-    do_ioctls(drmFB, rws);
-
-    /* The state tracker can organize a softpipe fallback if no hw
-     * driver is found.
-     */
-    if (is_r3xx(rws->pci_id)) {
-        ret = radeon_setup_winsys(drmFB, rws);
-       if (ret == FALSE)
-           goto fail;
-        return &rws->base;
-    }
-
-fail:
-    FREE(rws);
-    return NULL;
-}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.h b/src/gallium/winsys/radeon/drm/radeon_drm.h
deleted file mode 100644 (file)
index 061229f..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/* 
- * Copyright Â© 2009 Corbin Simpson
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
- * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- */
-/*
- * Authors:
- *      Corbin Simpson <MostAwesomeDude@gmail.com>
- */
-#ifndef RADEON_DRM_H
-#define RADEON_DRM_H
-
-#include "state_tracker/drm_driver.h"
-
-/* Guess at whether this chipset should use r300g.
- *
- * I believe that this check is valid, but I haven't been exhaustive. */
-static INLINE boolean is_r3xx(int pciid)
-{
-      switch (pciid) {
-      case 0x4144: /* PCI_CHIP_R300_AD */
-      case 0x4145: /* PCI_CHIP_R300_AE */
-      case 0x4146: /* PCI_CHIP_R300_AF */
-      case 0x4147: /* PCI_CHIP_R300_AG */
-      case 0x4E44: /* PCI_CHIP_R300_ND */
-      case 0x4E45: /* PCI_CHIP_R300_NE */
-      case 0x4E46: /* PCI_CHIP_R300_NF */
-      case 0x4E47: /* PCI_CHIP_R300_NG */
-      case 0x4E48: /* PCI_CHIP_R350_NH */
-      case 0x4E49: /* PCI_CHIP_R350_NI */
-      case 0x4E4B: /* PCI_CHIP_R350_NK */
-      case 0x4148: /* PCI_CHIP_R350_AH */
-      case 0x4149: /* PCI_CHIP_R350_AI */
-      case 0x414A: /* PCI_CHIP_R350_AJ */
-      case 0x414B: /* PCI_CHIP_R350_AK */
-      case 0x4E4A: /* PCI_CHIP_R360_NJ */
-      case 0x4150: /* PCI_CHIP_RV350_AP */
-      case 0x4151: /* PCI_CHIP_RV350_AQ */
-      case 0x4152: /* PCI_CHIP_RV350_AR */
-      case 0x4153: /* PCI_CHIP_RV350_AS */
-      case 0x4154: /* PCI_CHIP_RV350_AT */
-      case 0x4155: /* PCI_CHIP_RV350_AU */
-      case 0x4156: /* PCI_CHIP_RV350_AV */
-      case 0x4E50: /* PCI_CHIP_RV350_NP */
-      case 0x4E51: /* PCI_CHIP_RV350_NQ */
-      case 0x4E52: /* PCI_CHIP_RV350_NR */
-      case 0x4E53: /* PCI_CHIP_RV350_NS */
-      case 0x4E54: /* PCI_CHIP_RV350_NT */
-      case 0x4E56: /* PCI_CHIP_RV350_NV */
-      case 0x5460: /* PCI_CHIP_RV370_5460 */
-      case 0x5462: /* PCI_CHIP_RV370_5462 */
-      case 0x5464: /* PCI_CHIP_RV370_5464 */
-      case 0x5B60: /* PCI_CHIP_RV370_5B60 */
-      case 0x5B62: /* PCI_CHIP_RV370_5B62 */
-      case 0x5B63: /* PCI_CHIP_RV370_5B63 */
-      case 0x5B64: /* PCI_CHIP_RV370_5B64 */
-      case 0x5B65: /* PCI_CHIP_RV370_5B65 */
-      case 0x3150: /* PCI_CHIP_RV380_3150 */
-      case 0x3152: /* PCI_CHIP_RV380_3152 */
-      case 0x3154: /* PCI_CHIP_RV380_3154 */
-      case 0x3155: /* PCI_CHIP_RV380_3155 */
-      case 0x3E50: /* PCI_CHIP_RV380_3E50 */
-      case 0x3E54: /* PCI_CHIP_RV380_3E54 */
-      case 0x4A48: /* PCI_CHIP_R420_JH */
-      case 0x4A49: /* PCI_CHIP_R420_JI */
-      case 0x4A4A: /* PCI_CHIP_R420_JJ */
-      case 0x4A4B: /* PCI_CHIP_R420_JK */
-      case 0x4A4C: /* PCI_CHIP_R420_JL */
-      case 0x4A4D: /* PCI_CHIP_R420_JM */
-      case 0x4A4E: /* PCI_CHIP_R420_JN */
-      case 0x4A4F: /* PCI_CHIP_R420_JO */
-      case 0x4A50: /* PCI_CHIP_R420_JP */
-      case 0x4A54: /* PCI_CHIP_R420_JT */
-      case 0x5548: /* PCI_CHIP_R423_UH */
-      case 0x5549: /* PCI_CHIP_R423_UI */
-      case 0x554A: /* PCI_CHIP_R423_UJ */
-      case 0x554B: /* PCI_CHIP_R423_UK */
-      case 0x5550: /* PCI_CHIP_R423_5550 */
-      case 0x5551: /* PCI_CHIP_R423_UQ */
-      case 0x5552: /* PCI_CHIP_R423_UR */
-      case 0x5554: /* PCI_CHIP_R423_UT */
-      case 0x5D57: /* PCI_CHIP_R423_5D57 */
-      case 0x554C: /* PCI_CHIP_R430_554C */
-      case 0x554D: /* PCI_CHIP_R430_554D */
-      case 0x554E: /* PCI_CHIP_R430_554E */
-      case 0x554F: /* PCI_CHIP_R430_554F */
-      case 0x5D48: /* PCI_CHIP_R430_5D48 */
-      case 0x5D49: /* PCI_CHIP_R430_5D49 */
-      case 0x5D4A: /* PCI_CHIP_R430_5D4A */
-      case 0x5D4C: /* PCI_CHIP_R480_5D4C */
-      case 0x5D4D: /* PCI_CHIP_R480_5D4D */
-      case 0x5D4E: /* PCI_CHIP_R480_5D4E */
-      case 0x5D4F: /* PCI_CHIP_R480_5D4F */
-      case 0x5D50: /* PCI_CHIP_R480_5D50 */
-      case 0x5D52: /* PCI_CHIP_R480_5D52 */
-      case 0x4B49: /* PCI_CHIP_R481_4B49 */
-      case 0x4B4A: /* PCI_CHIP_R481_4B4A */
-      case 0x4B4B: /* PCI_CHIP_R481_4B4B */
-      case 0x4B4C: /* PCI_CHIP_R481_4B4C */
-      case 0x564A: /* PCI_CHIP_RV410_564A */
-      case 0x564B: /* PCI_CHIP_RV410_564B */
-      case 0x564F: /* PCI_CHIP_RV410_564F */
-      case 0x5652: /* PCI_CHIP_RV410_5652 */
-      case 0x5653: /* PCI_CHIP_RV410_5653 */
-      case 0x5657: /* PCI_CHIP_RV410_5657 */
-      case 0x5E48: /* PCI_CHIP_RV410_5E48 */
-      case 0x5E4A: /* PCI_CHIP_RV410_5E4A */
-      case 0x5E4B: /* PCI_CHIP_RV410_5E4B */
-      case 0x5E4C: /* PCI_CHIP_RV410_5E4C */
-      case 0x5E4D: /* PCI_CHIP_RV410_5E4D */
-      case 0x5E4F: /* PCI_CHIP_RV410_5E4F */
-      case 0x5A41: /* PCI_CHIP_RS400_5A41 */
-      case 0x5A42: /* PCI_CHIP_RS400_5A42 */
-      case 0x5A61: /* PCI_CHIP_RC410_5A61 */
-      case 0x5A62: /* PCI_CHIP_RC410_5A62 */
-      case 0x5954: /* PCI_CHIP_RS480_5954 */
-      case 0x5955: /* PCI_CHIP_RS480_5955 */
-      case 0x5974: /* PCI_CHIP_RS482_5974 */
-      case 0x5975: /* PCI_CHIP_RS482_5975 */
-      case 0x7100: /* PCI_CHIP_R520_7100 */
-      case 0x7101: /* PCI_CHIP_R520_7101 */
-      case 0x7102: /* PCI_CHIP_R520_7102 */
-      case 0x7103: /* PCI_CHIP_R520_7103 */
-      case 0x7104: /* PCI_CHIP_R520_7104 */
-      case 0x7105: /* PCI_CHIP_R520_7105 */
-      case 0x7106: /* PCI_CHIP_R520_7106 */
-      case 0x7108: /* PCI_CHIP_R520_7108 */
-      case 0x7109: /* PCI_CHIP_R520_7109 */
-      case 0x710A: /* PCI_CHIP_R520_710A */
-      case 0x710B: /* PCI_CHIP_R520_710B */
-      case 0x710C: /* PCI_CHIP_R520_710C */
-      case 0x710E: /* PCI_CHIP_R520_710E */
-      case 0x710F: /* PCI_CHIP_R520_710F */
-      case 0x7140: /* PCI_CHIP_RV515_7140 */
-      case 0x7141: /* PCI_CHIP_RV515_7141 */
-      case 0x7142: /* PCI_CHIP_RV515_7142 */
-      case 0x7143: /* PCI_CHIP_RV515_7143 */
-      case 0x7144: /* PCI_CHIP_RV515_7144 */
-      case 0x7145: /* PCI_CHIP_RV515_7145 */
-      case 0x7146: /* PCI_CHIP_RV515_7146 */
-      case 0x7147: /* PCI_CHIP_RV515_7147 */
-      case 0x7149: /* PCI_CHIP_RV515_7149 */
-      case 0x714A: /* PCI_CHIP_RV515_714A */
-      case 0x714B: /* PCI_CHIP_RV515_714B */
-      case 0x714C: /* PCI_CHIP_RV515_714C */
-      case 0x714D: /* PCI_CHIP_RV515_714D */
-      case 0x714E: /* PCI_CHIP_RV515_714E */
-      case 0x714F: /* PCI_CHIP_RV515_714F */
-      case 0x7151: /* PCI_CHIP_RV515_7151 */
-      case 0x7152: /* PCI_CHIP_RV515_7152 */
-      case 0x7153: /* PCI_CHIP_RV515_7153 */
-      case 0x715E: /* PCI_CHIP_RV515_715E */
-      case 0x715F: /* PCI_CHIP_RV515_715F */
-      case 0x7180: /* PCI_CHIP_RV515_7180 */
-      case 0x7181: /* PCI_CHIP_RV515_7181 */
-      case 0x7183: /* PCI_CHIP_RV515_7183 */
-      case 0x7186: /* PCI_CHIP_RV515_7186 */
-      case 0x7187: /* PCI_CHIP_RV515_7187 */
-      case 0x7188: /* PCI_CHIP_RV515_7188 */
-      case 0x718A: /* PCI_CHIP_RV515_718A */
-      case 0x718B: /* PCI_CHIP_RV515_718B */
-      case 0x718C: /* PCI_CHIP_RV515_718C */
-      case 0x718D: /* PCI_CHIP_RV515_718D */
-      case 0x718F: /* PCI_CHIP_RV515_718F */
-      case 0x7193: /* PCI_CHIP_RV515_7193 */
-      case 0x7196: /* PCI_CHIP_RV515_7196 */
-      case 0x719B: /* PCI_CHIP_RV515_719B */
-      case 0x719F: /* PCI_CHIP_RV515_719F */
-      case 0x7200: /* PCI_CHIP_RV515_7200 */
-      case 0x7210: /* PCI_CHIP_RV515_7210 */
-      case 0x7211: /* PCI_CHIP_RV515_7211 */
-      case 0x71C0: /* PCI_CHIP_RV530_71C0 */
-      case 0x71C1: /* PCI_CHIP_RV530_71C1 */
-      case 0x71C2: /* PCI_CHIP_RV530_71C2 */
-      case 0x71C3: /* PCI_CHIP_RV530_71C3 */
-      case 0x71C4: /* PCI_CHIP_RV530_71C4 */
-      case 0x71C5: /* PCI_CHIP_RV530_71C5 */
-      case 0x71C6: /* PCI_CHIP_RV530_71C6 */
-      case 0x71C7: /* PCI_CHIP_RV530_71C7 */
-      case 0x71CD: /* PCI_CHIP_RV530_71CD */
-      case 0x71CE: /* PCI_CHIP_RV530_71CE */
-      case 0x71D2: /* PCI_CHIP_RV530_71D2 */
-      case 0x71D4: /* PCI_CHIP_RV530_71D4 */
-      case 0x71D5: /* PCI_CHIP_RV530_71D5 */
-      case 0x71D6: /* PCI_CHIP_RV530_71D6 */
-      case 0x71DA: /* PCI_CHIP_RV530_71DA */
-      case 0x71DE: /* PCI_CHIP_RV530_71DE */
-      case 0x7281: /* PCI_CHIP_RV560_7281 */
-      case 0x7283: /* PCI_CHIP_RV560_7283 */
-      case 0x7287: /* PCI_CHIP_RV560_7287 */
-      case 0x7290: /* PCI_CHIP_RV560_7290 */
-      case 0x7291: /* PCI_CHIP_RV560_7291 */
-      case 0x7293: /* PCI_CHIP_RV560_7293 */
-      case 0x7297: /* PCI_CHIP_RV560_7297 */
-      case 0x7280: /* PCI_CHIP_RV570_7280 */
-      case 0x7288: /* PCI_CHIP_RV570_7288 */
-      case 0x7289: /* PCI_CHIP_RV570_7289 */
-      case 0x728B: /* PCI_CHIP_RV570_728B */
-      case 0x728C: /* PCI_CHIP_RV570_728C */
-      case 0x7240: /* PCI_CHIP_R580_7240 */
-      case 0x7243: /* PCI_CHIP_R580_7243 */
-      case 0x7244: /* PCI_CHIP_R580_7244 */
-      case 0x7245: /* PCI_CHIP_R580_7245 */
-      case 0x7246: /* PCI_CHIP_R580_7246 */
-      case 0x7247: /* PCI_CHIP_R580_7247 */
-      case 0x7248: /* PCI_CHIP_R580_7248 */
-      case 0x7249: /* PCI_CHIP_R580_7249 */
-      case 0x724A: /* PCI_CHIP_R580_724A */
-      case 0x724B: /* PCI_CHIP_R580_724B */
-      case 0x724C: /* PCI_CHIP_R580_724C */
-      case 0x724D: /* PCI_CHIP_R580_724D */
-      case 0x724E: /* PCI_CHIP_R580_724E */
-      case 0x724F: /* PCI_CHIP_R580_724F */
-      case 0x7284: /* PCI_CHIP_R580_7284 */
-      case 0x793F: /* PCI_CHIP_RS600_793F */
-      case 0x7941: /* PCI_CHIP_RS600_7941 */
-      case 0x7942: /* PCI_CHIP_RS600_7942 */
-      case 0x791E: /* PCI_CHIP_RS690_791E */
-      case 0x791F: /* PCI_CHIP_RS690_791F */
-      case 0x796C: /* PCI_CHIP_RS740_796C */
-      case 0x796D: /* PCI_CHIP_RS740_796D */
-      case 0x796E: /* PCI_CHIP_RS740_796E */
-      case 0x796F: /* PCI_CHIP_RS740_796F */
-             return TRUE;
-      default:
-             return FALSE;
-      }
-}
-
-#endif
index 78723948d41fbdd1509cee863112f1ebc00df17a..5e14287ec2dde15b3537968982dd6aaeb947f743 100644 (file)
@@ -1,19 +1,17 @@
-
-#include <sys/ioctl.h>
-#include "radeon_drm.h"
-#include "radeon_bo_gem.h"
-#include "radeon_cs_gem.h"
-#include "radeon_buffer.h"
+#include "radeon_drm_buffer.h"
+#include "radeon_drm_cs.h"
 
 #include "util/u_hash_table.h"
-#include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_simple_list.h"
-#include "pipebuffer/pb_buffer.h"
 #include "pipebuffer/pb_bufmgr.h"
 #include "os/os_thread.h"
 
-#include "radeon_winsys.h"
+#include "state_tracker/drm_driver.h"
+
+#include <radeon_drm.h>
+#include <radeon_bo_gem.h>
+#include <sys/ioctl.h>
 
 struct radeon_drm_bufmgr;
 
@@ -45,7 +43,7 @@ struct radeon_drm_bufmgr {
     struct pb_manager base;
 
     /* Winsys. */
-    struct radeon_libdrm_winsys *rws;
+    struct radeon_drm_winsys *rws;
 
     /* List of mapped buffers and its mutex. */
     struct radeon_drm_buffer buffer_map_list;
@@ -115,7 +113,7 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
                               unsigned flags, void *flush_ctx)
 {
     struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
-    struct radeon_libdrm_cs *cs = flush_ctx;
+    struct radeon_drm_cs *cs = flush_ctx;
     int write = 0;
 
     /* Note how we use radeon_bo_is_referenced_by_cs here. There are
@@ -157,7 +155,7 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
      * we cannot flush. */
     assert(cs || !radeon_bo_is_referenced_by_cs(buf->bo, NULL));
 
-    if (cs && radeon_bo_is_referenced_by_cs(buf->bo, cs->cs)) {
+    if (cs && radeon_bo_is_referenced_by_cs(buf->bo, NULL)) {
         cs->flush_cs(cs->flush_data);
     }
 
@@ -225,7 +223,7 @@ radeon_drm_bufmgr_create_buffer_from_handle_unsafe(struct pb_manager *_mgr,
                                                    uint32_t handle)
 {
     struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
-    struct radeon_libdrm_winsys *rws = mgr->rws;
+    struct radeon_drm_winsys *rws = mgr->rws;
     struct radeon_drm_buffer *buf;
     struct radeon_bo *bo;
 
@@ -284,7 +282,7 @@ radeon_drm_bufmgr_create_buffer(struct pb_manager *_mgr,
                                const struct pb_desc *desc)
 {
     struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
-    struct radeon_libdrm_winsys *rws = mgr->rws;
+    struct radeon_drm_winsys *rws = mgr->rws;
     struct radeon_drm_buffer *buf;
     uint32_t domain;
 
@@ -345,7 +343,7 @@ static int handle_compare(void *key1, void *key2)
 }
 
 struct pb_manager *
-radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
+radeon_drm_bufmgr_create(struct radeon_drm_winsys *rws)
 {
     struct radeon_drm_bufmgr *mgr;
 
@@ -383,18 +381,18 @@ static struct radeon_drm_buffer *get_drm_buffer(struct pb_buffer *_buf)
     return buf;
 }
 
-void *radeon_drm_buffer_map(struct r300_winsys_screen *ws,
-                            struct r300_winsys_buffer *buf,
-                            struct r300_winsys_cs *cs,
-                            enum pipe_transfer_usage usage)
+static void *radeon_drm_buffer_map(struct r300_winsys_screen *ws,
+                                   struct r300_winsys_buffer *buf,
+                                   struct r300_winsys_cs *cs,
+                                   enum pipe_transfer_usage usage)
 {
     struct pb_buffer *_buf = radeon_pb_buffer(buf);
 
-    return pb_map(_buf, get_pb_usage_from_transfer_flags(usage), radeon_libdrm_cs(cs));
+    return pb_map(_buf, get_pb_usage_from_transfer_flags(usage), radeon_drm_cs(cs));
 }
 
-void radeon_drm_buffer_unmap(struct r300_winsys_screen *ws,
-                             struct r300_winsys_buffer *buf)
+static void radeon_drm_buffer_unmap(struct r300_winsys_screen *ws,
+                                    struct r300_winsys_buffer *buf)
 {
     struct pb_buffer *_buf = radeon_pb_buffer(buf);
 
@@ -425,10 +423,10 @@ boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
     return TRUE;
 }
 
-void radeon_drm_bufmgr_get_tiling(struct r300_winsys_screen *ws,
-                                  struct r300_winsys_buffer *_buf,
-                                  enum r300_buffer_tiling *microtiled,
-                                  enum r300_buffer_tiling *macrotiled)
+static void radeon_drm_buffer_get_tiling(struct r300_winsys_screen *ws,
+                                         struct r300_winsys_buffer *_buf,
+                                         enum r300_buffer_tiling *microtiled,
+                                         enum r300_buffer_tiling *macrotiled)
 {
     struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
     uint32_t flags = 0, pitch;
@@ -444,11 +442,11 @@ void radeon_drm_bufmgr_get_tiling(struct r300_winsys_screen *ws,
        *macrotiled = R300_BUFFER_TILED;
 }
 
-void radeon_drm_bufmgr_set_tiling(struct r300_winsys_screen *ws,
-                                  struct r300_winsys_buffer *_buf,
-                                  enum r300_buffer_tiling microtiled,
-                                  enum r300_buffer_tiling macrotiled,
-                                  uint32_t pitch)
+static void radeon_drm_buffer_set_tiling(struct r300_winsys_screen *ws,
+                                         struct r300_winsys_buffer *_buf,
+                                         enum r300_buffer_tiling microtiled,
+                                         enum r300_buffer_tiling macrotiled,
+                                         uint32_t pitch)
 {
     struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
     uint32_t flags = 0;
@@ -465,66 +463,30 @@ void radeon_drm_bufmgr_set_tiling(struct r300_winsys_screen *ws,
     radeon_bo_set_tiling(buf->bo, flags, pitch);
 }
 
-static uint32_t get_gem_domain(enum r300_buffer_domain domain)
-{
-    uint32_t res = 0;
-
-    if (domain & R300_DOMAIN_GTT)
-        res |= RADEON_GEM_DOMAIN_GTT;
-    if (domain & R300_DOMAIN_VRAM)
-        res |= RADEON_GEM_DOMAIN_VRAM;
-    return res;
-}
-
-void radeon_drm_bufmgr_add_buffer(struct r300_winsys_cs *rcs,
-                                  struct r300_winsys_buffer *_buf,
-                                  enum r300_buffer_domain rd,
-                                  enum r300_buffer_domain wd)
-{
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-    struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
-    uint32_t gem_rd = get_gem_domain(rd);
-    uint32_t gem_wd = get_gem_domain(wd);
-
-    radeon_cs_space_add_persistent_bo(cs->cs, buf->bo, gem_rd, gem_wd);
-}
-
-void radeon_drm_bufmgr_write_reloc(struct r300_winsys_cs *rcs,
-                                   struct r300_winsys_buffer *_buf,
-                                  enum r300_buffer_domain rd,
-                                   enum r300_buffer_domain wd)
+static struct r300_winsys_cs_buffer *radeon_drm_get_cs_handle(
+        struct r300_winsys_screen *rws,
+        struct r300_winsys_buffer *_buf)
 {
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-    struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
-    int retval;
-    uint32_t gem_rd = get_gem_domain(rd);
-    uint32_t gem_wd = get_gem_domain(wd);
-
-    cs->cs->cdw = cs->base.cdw;
-    retval = radeon_cs_write_reloc(cs->cs, buf->bo, gem_rd, gem_wd, 0);
-    cs->base.cdw = cs->cs->cdw;
-    if (retval) {
-        fprintf(stderr, "radeon: Relocation of %p (%d, %d, %d) failed!\n",
-                buf, gem_rd, gem_wd, 0);
-    }
+    /* return pure radeon_bo. */
+    return (struct r300_winsys_cs_buffer*)
+            get_drm_buffer(radeon_pb_buffer(_buf))->bo;
 }
 
-boolean radeon_drm_bufmgr_is_buffer_referenced(struct r300_winsys_cs *rcs,
-                                               struct r300_winsys_buffer *_buf,
+static boolean radeon_drm_is_buffer_referenced(struct r300_winsys_cs *rcs,
+                                               struct r300_winsys_cs_buffer *_buf,
                                                enum r300_reference_domain domain)
 {
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-    struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
+    struct radeon_bo *bo = (struct radeon_bo*)_buf;
     uint32_t tmp;
 
     if (domain & R300_REF_CS) {
-        if (radeon_bo_is_referenced_by_cs(buf->bo, cs->cs)) {
+        if (radeon_bo_is_referenced_by_cs(bo, NULL)) {
             return TRUE;
         }
     }
 
     if (domain & R300_REF_HW) {
-        if (radeon_bo_is_busy(buf->bo, &tmp)) {
+        if (radeon_bo_is_busy(bo, &tmp)) {
             return TRUE;
         }
     }
@@ -550,10 +512,21 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr)
     pipe_mutex_unlock(mgr->buffer_map_list_mutex);
 }
 
-void radeon_drm_bufmgr_wait(struct r300_winsys_screen *ws,
-                            struct r300_winsys_buffer *_buf)
+static void radeon_drm_buffer_wait(struct r300_winsys_screen *ws,
+                                   struct r300_winsys_buffer *_buf)
 {
     struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
 
     radeon_bo_wait(buf->bo);
 }
+
+void radeon_drm_bufmgr_init_functions(struct radeon_drm_winsys *ws)
+{
+    ws->base.buffer_get_cs_handle = radeon_drm_get_cs_handle;
+    ws->base.buffer_set_tiling = radeon_drm_buffer_set_tiling;
+    ws->base.buffer_get_tiling = radeon_drm_buffer_get_tiling;
+    ws->base.buffer_map = radeon_drm_buffer_map;
+    ws->base.buffer_unmap = radeon_drm_buffer_unmap;
+    ws->base.buffer_wait = radeon_drm_buffer_wait;
+    ws->base.cs_is_buffer_referenced = radeon_drm_is_buffer_referenced;
+}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.h b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.h
new file mode 100644 (file)
index 0000000..494abdc
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright Â© 2008 Jérôme Glisse
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors:
+ *      Jérôme Glisse <glisse@freedesktop.org>
+ */
+#ifndef RADEON_DRM_BUFFER_H
+#define RADEON_DRM_BUFFER_H
+
+#include "radeon_winsys.h"
+
+#define RADEON_PB_USAGE_VERTEX      (1 << 28)
+#define RADEON_PB_USAGE_DOMAIN_GTT  (1 << 29)
+#define RADEON_PB_USAGE_DOMAIN_VRAM (1 << 30)
+
+static INLINE struct pb_buffer *
+radeon_pb_buffer(struct r300_winsys_buffer *buffer)
+{
+    return (struct pb_buffer *)buffer;
+}
+
+struct pb_manager *radeon_drm_bufmgr_create(struct radeon_drm_winsys *rws);
+struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr,
+                                                             uint32_t handle);
+void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr);
+boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
+                                    struct winsys_handle *whandle);
+void radeon_drm_bufmgr_init_functions(struct radeon_drm_winsys *ws);
+
+#endif
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_common.c b/src/gallium/winsys/radeon/drm/radeon_drm_common.c
new file mode 100644 (file)
index 0000000..fe71f08
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+ * Copyright Â© 2009 Corbin Simpson
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors:
+ *      Corbin Simpson <MostAwesomeDude@gmail.com>
+ *      Joakim Sindholt <opensource@zhasha.com>
+ */
+
+#include "radeon_winsys.h"
+#include "radeon_drm_buffer.h"
+#include "radeon_drm_cs.h"
+#include "radeon_drm_public.h"
+
+#include "pipebuffer/pb_bufmgr.h"
+#include "util/u_memory.h"
+
+#include <radeon_drm.h>
+#include <radeon_bo_gem.h>
+#include <radeon_cs_gem.h>
+#include <xf86drm.h>
+#include <stdio.h>
+
+
+/* Enable/disable Hyper-Z access. Return TRUE on success. */
+static boolean radeon_set_hyperz_access(int fd, boolean enable)
+{
+#ifndef RADEON_INFO_WANT_HYPERZ
+#define RADEON_INFO_WANT_HYPERZ 7
+#endif
+
+    struct drm_radeon_info info = {0};
+    unsigned value = enable ? 1 : 0;
+
+    if (!debug_get_bool_option("RADEON_HYPERZ", FALSE))
+        return FALSE;
+
+    info.value = (unsigned long)&value;
+    info.request = RADEON_INFO_WANT_HYPERZ;
+
+    if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0)
+        return FALSE;
+
+    if (enable && !value)
+        return FALSE;
+
+    return TRUE;
+}
+
+/* Helper function to do the ioctls needed for setup and init. */
+static void do_ioctls(struct radeon_drm_winsys *winsys)
+{
+    struct drm_radeon_gem_info gem_info = {0};
+    struct drm_radeon_info info = {0};
+    int target = 0;
+    int retval;
+    drmVersionPtr version;
+
+    info.value = (unsigned long)&target;
+
+    /* We do things in a specific order here.
+     *
+     * DRM version first. We need to be sure we're running on a KMS chipset.
+     * This is also for some features.
+     *
+     * Then, the PCI ID. This is essential and should return usable numbers
+     * for all Radeons. If this fails, we probably got handed an FD for some
+     * non-Radeon card.
+     *
+     * The GB and Z pipe requests should always succeed, but they might not
+     * return sensical values for all chipsets, but that's alright because
+     * the pipe drivers already know that.
+     *
+     * The GEM info is actually bogus on the kernel side, as well as our side
+     * (see radeon_gem_info_ioctl in radeon_gem.c) but that's alright because
+     * we don't actually use the info for anything yet. */
+
+    version = drmGetVersion(winsys->fd);
+    if (version->version_major != 2) {
+        fprintf(stderr, "%s: DRM version is %d.%d.%d but this driver is "
+                "only compatible with 2.x.x\n", __FUNCTION__,
+                version->version_major, version->version_minor,
+                version->version_patchlevel);
+        drmFreeVersion(version);
+        exit(1);
+    }
+
+/* XXX Remove this ifdef when libdrm version 2.4.19 becomes mandatory. */
+#ifdef RADEON_BO_FLAGS_MICRO_TILE_SQUARE
+    // Supported since 2.1.0.
+    winsys->squaretiling = version->version_major > 2 ||
+                           version->version_minor >= 1;
+#endif
+
+    winsys->drm_2_3_0 = version->version_major > 2 ||
+                        version->version_minor >= 3;
+
+    winsys->drm_2_6_0 = version->version_major > 2 ||
+                        (version->version_major == 2 &&
+                         version->version_minor >= 6);
+
+    winsys->drm_2_8_0 = version->version_major > 2 ||
+                        (version->version_major == 2 &&
+                         version->version_minor >= 8);
+
+    info.request = RADEON_INFO_DEVICE_ID;
+    retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_INFO, &info, sizeof(info));
+    if (retval) {
+        fprintf(stderr, "%s: Failed to get PCI ID, "
+                "error number %d\n", __FUNCTION__, retval);
+        exit(1);
+    }
+    winsys->pci_id = target;
+
+    info.request = RADEON_INFO_NUM_GB_PIPES;
+    retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_INFO, &info, sizeof(info));
+    if (retval) {
+        fprintf(stderr, "%s: Failed to get GB pipe count, "
+                "error number %d\n", __FUNCTION__, retval);
+        exit(1);
+    }
+    winsys->gb_pipes = target;
+
+    info.request = RADEON_INFO_NUM_Z_PIPES;
+    retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_INFO, &info, sizeof(info));
+    if (retval) {
+        fprintf(stderr, "%s: Failed to get Z pipe count, "
+                "error number %d\n", __FUNCTION__, retval);
+        exit(1);
+    }
+    winsys->z_pipes = target;
+
+    winsys->hyperz = radeon_set_hyperz_access(winsys->fd, TRUE);
+
+    retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_GEM_INFO,
+            &gem_info, sizeof(gem_info));
+    if (retval) {
+        fprintf(stderr, "%s: Failed to get MM info, error number %d\n",
+                __FUNCTION__, retval);
+        exit(1);
+    }
+    winsys->gart_size = gem_info.gart_size;
+    winsys->vram_size = gem_info.vram_size;
+
+    debug_printf("radeon: Successfully grabbed chipset info from kernel!\n"
+                 "radeon: DRM version: %d.%d.%d ID: 0x%04x GB: %d Z: %d\n"
+                 "radeon: GART size: %d MB VRAM size: %d MB\n"
+                 "radeon: HyperZ: %s\n",
+                 version->version_major, version->version_minor,
+                 version->version_patchlevel, winsys->pci_id,
+                 winsys->gb_pipes, winsys->z_pipes,
+                 winsys->gart_size / 1024 / 1024,
+                 winsys->vram_size / 1024 / 1024,
+                 winsys->hyperz ? "YES" : "NO");
+
+    drmFreeVersion(version);
+}
+
+static void radeon_winsys_destroy(struct r300_winsys_screen *rws)
+{
+    struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws;
+
+    ws->cman->destroy(ws->cman);
+    ws->kman->destroy(ws->kman);
+
+    radeon_bo_manager_gem_dtor(ws->bom);
+    FREE(rws);
+}
+
+struct r300_winsys_screen *r300_drm_winsys_screen_create(int fd)
+{
+    struct radeon_drm_winsys *ws = CALLOC_STRUCT(radeon_drm_winsys);
+    if (!ws) {
+        return NULL;
+    }
+
+    ws->fd = fd;
+    do_ioctls(ws);
+
+    if (!is_r3xx(ws->pci_id)) {
+        goto fail;
+    }
+
+    /* Create managers. */
+    ws->bom = radeon_bo_manager_gem_ctor(fd);
+    if (!ws->bom)
+       goto fail;
+    ws->kman = radeon_drm_bufmgr_create(ws);
+    if (!ws->kman)
+       goto fail;
+    ws->cman = pb_cache_manager_create(ws->kman, 1000000);
+    if (!ws->cman)
+       goto fail;
+
+    /* Set functions. */
+    ws->base.destroy = radeon_winsys_destroy;
+
+    radeon_drm_bufmgr_init_functions(ws);
+    radeon_drm_cs_init_functions(ws);
+    radeon_winsys_init_functions(ws);
+
+    return &ws->base;
+
+fail:
+    if (ws->bom)
+       radeon_bo_manager_gem_dtor(ws->bom);
+
+    if (ws->cman)
+       ws->cman->destroy(ws->cman);
+    if (ws->kman)
+       ws->kman->destroy(ws->kman);
+
+    FREE(ws);
+    return NULL;
+}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
new file mode 100644 (file)
index 0000000..60bc36b
--- /dev/null
@@ -0,0 +1,360 @@
+/*
+ * Copyright Â© 2008 Jérôme Glisse
+ * Copyright Â© 2010 Marek Olšák <maraeo@gmail.com>
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors:
+ *      Marek Olšák <maraeo@gmail.com>
+ *
+ * Based on work from libdrm_radeon by:
+ *      Aapo Tahkola <aet@rasterburn.org>
+ *      Nicolai Haehnle <prefect_@gmx.net>
+ *      Jérôme Glisse <glisse@freedesktop.org>
+ */
+
+/*
+    This file replaces libdrm's radeon_cs_gem with our own implemention.
+    It's optimized specifically for r300g, but r600g could use it as well.
+    Reloc writes and space checking are faster and simpler than their
+    counterparts in libdrm (the time complexity of all the functions
+    is O(1) in nearly all scenarios, thanks to hashing).
+
+    It works like this:
+
+    cs_add_reloc(cs, buf, read_domain, write_domain) adds a new relocation and
+    also adds the size of 'buf' to the used_gart and used_vram winsys variables
+    based on the domains, which are simply or'd for the accounting purposes.
+    The adding is skipped if the reloc is already present in the list, but it
+    accounts any newly-referenced domains.
+
+    cs_validate is then called, which just checks:
+        used_vram/gart < vram/gart_size * 0.8
+    The 0.8 number allows for some memory fragmentation. If the validation
+    fails, the pipe driver flushes CS and tries do the validation again,
+    i.e. it validates only that one operation. If it fails again, it drops
+    the operation on the floor and prints some nasty message to stderr.
+    (done in the pipe driver)
+
+    cs_write_reloc(cs, buf) just writes a reloc that has been added using
+    cs_add_reloc. The read_domain and write_domain parameters have been removed,
+    because we already specify them in cs_add_reloc.
+*/
+
+#include "radeon_drm_cs.h"
+#include "radeon_drm_buffer.h"
+
+#include "util/u_memory.h"
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <radeon_bo.h>
+#include <xf86drm.h>
+
+#define RELOC_DWORDS (sizeof(struct drm_radeon_cs_reloc) / sizeof(uint32_t))
+
+static struct r300_winsys_cs *radeon_drm_cs_create(struct r300_winsys_screen *rws)
+{
+    struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
+    struct radeon_drm_cs *cs;
+
+    cs = CALLOC_STRUCT(radeon_drm_cs);
+    if (!cs) {
+        return NULL;
+    }
+
+    cs->ws = ws;
+    cs->nrelocs = 256;
+    cs->relocs_bo = (struct radeon_bo**)
+                     CALLOC(1, cs->nrelocs * sizeof(struct radeon_bo*));
+    if (!cs->relocs_bo) {
+        FREE(cs);
+        return NULL;
+    }
+
+    cs->relocs = (struct drm_radeon_cs_reloc*)
+                 CALLOC(1, cs->nrelocs * sizeof(struct drm_radeon_cs_reloc));
+    if (!cs->relocs) {
+        FREE(cs->relocs_bo);
+        FREE(cs);
+        return NULL;
+    }
+
+    cs->chunks[0].chunk_id = RADEON_CHUNK_ID_IB;
+    cs->chunks[0].length_dw = 0;
+    cs->chunks[0].chunk_data = (uint64_t)(uintptr_t)cs->base.buf;
+    cs->chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
+    cs->chunks[1].length_dw = 0;
+    cs->chunks[1].chunk_data = (uint64_t)(uintptr_t)cs->relocs;
+    return &cs->base;
+}
+
+#define OUT_CS(cs, value) (cs)->buf[(cs)->cdw++] = (value)
+
+static inline void update_domains(struct drm_radeon_cs_reloc *reloc,
+                                  enum r300_buffer_domain rd,
+                                  enum r300_buffer_domain wd,
+                                  enum r300_buffer_domain *added_domains)
+{
+    *added_domains = (rd | wd) & ~(reloc->read_domains | reloc->write_domain);
+
+    if (reloc->read_domains & wd) {
+        reloc->read_domains = rd;
+        reloc->write_domain = wd;
+    } else if (rd & reloc->write_domain) {
+        reloc->read_domains = rd;
+        reloc->write_domain |= wd;
+    } else {
+        reloc->read_domains |= rd;
+        reloc->write_domain |= wd;
+    }
+}
+
+static int radeon_get_reloc(struct radeon_drm_cs *cs,
+                            struct radeon_bo *bo)
+{
+    struct drm_radeon_cs_reloc *reloc;
+    unsigned i;
+    unsigned hash = bo->handle & (sizeof(cs->is_handle_added)-1);
+
+    if (cs->is_handle_added[hash]) {
+        reloc = cs->relocs_hashlist[hash];
+        if (reloc->handle == bo->handle) {
+            return cs->reloc_indices_hashlist[hash];
+        }
+
+        /* Hash collision, look for the BO in the list of relocs linearly. */
+        for (i = cs->crelocs; i != 0;) {
+            --i;
+            reloc = &cs->relocs[i];
+            if (reloc->handle == bo->handle) {
+                /* Put this reloc in the hash list.
+                 * This will prevent additional hash collisions if there are
+                 * several subsequent get_reloc calls of the same buffer.
+                 *
+                 * Example: Assuming buffers A,B,C collide in the hash list,
+                 * the following sequence of relocs:
+                 *         AAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCC
+                 * will collide here: ^ and here:   ^,
+                 * meaning that we should get very few collisions in the end. */
+                cs->relocs_hashlist[hash] = reloc;
+                cs->reloc_indices_hashlist[hash] = i;
+                /*printf("write_reloc collision, hash: %i, handle: %i\n", hash, bo->handle);*/
+                return i;
+            }
+        }
+    }
+
+    return -1;
+}
+
+static void radeon_add_reloc(struct radeon_drm_cs *cs,
+                             struct radeon_bo *bo,
+                             enum r300_buffer_domain rd,
+                             enum r300_buffer_domain wd,
+                             enum r300_buffer_domain *added_domains)
+{
+    struct drm_radeon_cs_reloc *reloc;
+    unsigned i;
+    unsigned hash = bo->handle & (sizeof(cs->is_handle_added)-1);
+
+    if (cs->is_handle_added[hash]) {
+        reloc = cs->relocs_hashlist[hash];
+        if (reloc->handle == bo->handle) {
+            update_domains(reloc, rd, wd, added_domains);
+            return;
+        }
+
+        /* Hash collision, look for the BO in the list of relocs linearly. */
+        for (i = cs->crelocs; i != 0;) {
+            --i;
+            reloc = &cs->relocs[i];
+            if (reloc->handle == bo->handle) {
+                update_domains(reloc, rd, wd, added_domains);
+
+                cs->relocs_hashlist[hash] = reloc;
+                cs->reloc_indices_hashlist[hash] = i;
+                /*printf("write_reloc collision, hash: %i, handle: %i\n", hash, bo->handle);*/
+                return;
+            }
+        }
+    }
+
+    /* New relocation, check if the backing array is large enough. */
+    if (cs->crelocs >= cs->nrelocs) {
+        uint32_t size;
+        cs->nrelocs += 10;
+
+        size = cs->nrelocs * sizeof(struct radeon_bo*);
+        cs->relocs_bo = (struct radeon_bo**)realloc(cs->relocs_bo, size);
+
+        size = cs->nrelocs * sizeof(struct drm_radeon_cs_reloc);
+        cs->relocs = (struct drm_radeon_cs_reloc*)realloc(cs->relocs, size);
+
+        cs->chunks[1].chunk_data = (uint64_t)(uintptr_t)cs->relocs;
+    }
+
+    /* Initialize the new relocation. */
+    radeon_bo_ref(bo);
+    cs->relocs_bo[cs->crelocs] = bo;
+    reloc = &cs->relocs[cs->crelocs];
+    reloc->handle = bo->handle;
+    reloc->read_domains = rd;
+    reloc->write_domain = wd;
+    reloc->flags = 0;
+
+    cs->is_handle_added[hash] = TRUE;
+    cs->relocs_hashlist[hash] = reloc;
+    cs->reloc_indices_hashlist[hash] = cs->crelocs;
+
+    cs->chunks[1].length_dw += RELOC_DWORDS;
+    cs->crelocs++;
+
+    *added_domains = rd | wd;
+}
+
+static void radeon_drm_cs_add_reloc(struct r300_winsys_cs *rcs,
+                                    struct r300_winsys_cs_buffer *buf,
+                                    enum r300_buffer_domain rd,
+                                    enum r300_buffer_domain wd)
+{
+    struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+    struct radeon_bo *bo = (struct radeon_bo*)buf;
+    enum r300_buffer_domain added_domains;
+
+    radeon_add_reloc(cs, bo, rd, wd, &added_domains);
+
+    if (!added_domains)
+        return;
+
+    if (added_domains & R300_DOMAIN_GTT)
+        cs->used_gart += bo->size;
+    if (added_domains & R300_DOMAIN_VRAM)
+        cs->used_vram += bo->size;
+}
+
+static boolean radeon_drm_cs_validate(struct r300_winsys_cs *rcs)
+{
+    struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+
+    return cs->used_gart < cs->ws->gart_size * 0.8 &&
+           cs->used_vram < cs->ws->vram_size * 0.8;
+}
+
+static void radeon_drm_cs_write_reloc(struct r300_winsys_cs *rcs,
+                                      struct r300_winsys_cs_buffer *buf)
+{
+    struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+    struct radeon_bo *bo = (struct radeon_bo*)buf;
+
+    unsigned index = radeon_get_reloc(cs, bo);
+
+    if (index == -1) {
+        fprintf(stderr, "r300: Cannot get a relocation in %s.\n", __func__);
+        return;
+    }
+
+    OUT_CS(&cs->base, 0xc0001000);
+    OUT_CS(&cs->base, index * RELOC_DWORDS);
+}
+
+static void radeon_drm_cs_emit(struct r300_winsys_cs *rcs)
+{
+    struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+    uint64_t chunk_array[2];
+    unsigned i;
+    int r;
+
+    if (cs->base.cdw) {
+        /* Unmap buffers. */
+        radeon_drm_bufmgr_flush_maps(cs->ws->kman);
+
+        /* Prepare the arguments. */
+        cs->chunks[0].length_dw = cs->base.cdw;
+
+        chunk_array[0] = (uint64_t)(uintptr_t)&cs->chunks[0];
+        chunk_array[1] = (uint64_t)(uintptr_t)&cs->chunks[1];
+
+        cs->cs.num_chunks = 2;
+        cs->cs.chunks = (uint64_t)(uintptr_t)chunk_array;
+
+        /* Emit. */
+        r = drmCommandWriteRead(cs->ws->fd, DRM_RADEON_CS,
+                                &cs->cs, sizeof(struct drm_radeon_cs));
+        if (r) {
+            if (debug_get_bool_option("RADEON_DUMP_CS", FALSE)) {
+                fprintf(stderr, "radeon: The kernel rejected CS, dumping...\n");
+                fprintf(stderr, "VENDORID:DEVICEID 0x%04X:0x%04X\n", 0x1002,
+                        cs->ws->pci_id);
+                for (i = 0; i < cs->base.cdw; i++) {
+                    fprintf(stderr, "0x%08X\n", cs->base.buf[i]);
+                }
+            } else {
+                fprintf(stderr, "radeon: The kernel rejected CS, "
+                                "see dmesg for more information.\n");
+            }
+        }
+    }
+
+    /* Unreference buffers, cleanup. */
+    for (i = 0; i < cs->crelocs; i++) {
+        radeon_bo_unref((struct radeon_bo*)cs->relocs_bo[i]);
+        cs->relocs_bo[i] = NULL;
+    }
+
+    cs->base.cdw = 0;
+    cs->crelocs = 0;
+    cs->chunks[0].length_dw = 0;
+    cs->chunks[1].length_dw = 0;
+    cs->used_gart = 0;
+    cs->used_vram = 0;
+    memset(cs->is_handle_added, 0, sizeof(cs->is_handle_added));
+}
+
+static void radeon_drm_cs_destroy(struct r300_winsys_cs *rcs)
+{
+    struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+    FREE(cs->relocs_bo);
+    FREE(cs->relocs);
+    FREE(cs);
+}
+
+static void radeon_drm_cs_set_flush(struct r300_winsys_cs *rcs,
+                             void (*flush)(void *), void *user)
+{
+    struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+    cs->flush_cs = flush;
+    cs->flush_data = user;
+}
+
+void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws)
+{
+    ws->base.cs_create = radeon_drm_cs_create;
+    ws->base.cs_destroy = radeon_drm_cs_destroy;
+    ws->base.cs_add_reloc = radeon_drm_cs_add_reloc;
+    ws->base.cs_validate = radeon_drm_cs_validate;
+    ws->base.cs_write_reloc = radeon_drm_cs_write_reloc;
+    ws->base.cs_flush = radeon_drm_cs_emit;
+    ws->base.cs_set_flush = radeon_drm_cs_set_flush;
+}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.h b/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
new file mode 100644 (file)
index 0000000..7604653
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef RADEON_DRM_CS_H
+#define RADEON_DRM_CS_H
+
+#include "radeon_winsys.h"
+#include <radeon_drm.h>
+
+struct radeon_drm_cs {
+    struct r300_winsys_cs base;
+
+    /* The winsys. */
+    struct radeon_drm_winsys *ws;
+
+    /* Flush CS. */
+    void (*flush_cs)(void *);
+    void *flush_data;
+
+    /* Relocs. */
+    unsigned                    crelocs;
+    unsigned                    nrelocs;
+    struct drm_radeon_cs_reloc  *relocs;
+    struct radeon_bo            **relocs_bo;
+    struct drm_radeon_cs        cs;
+    struct drm_radeon_cs_chunk  chunks[2];
+
+    unsigned used_vram;
+    unsigned used_gart;
+
+    /* 0 = BO not added, 1 = BO added */
+    char                        is_handle_added[256];
+    struct drm_radeon_cs_reloc  *relocs_hashlist[256];
+    unsigned                    reloc_indices_hashlist[256];
+};
+
+static INLINE struct radeon_drm_cs *
+radeon_drm_cs(struct r300_winsys_cs *base)
+{
+    return (struct radeon_drm_cs*)base;
+}
+
+void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws);
+
+#endif
index 0d96ae8c470f0cfc1d78da216908b2f59d715f60..3a208cdd4c467e7f5e21f2edd55da6a1f957bb0f 100644 (file)
@@ -1,9 +1,222 @@
-
 #ifndef RADEON_DRM_PUBLIC_H
 #define RADEON_DRM_PUBLIC_H
 
+#include "pipe/p_defines.h"
+
 struct r300_winsys_screen;
 
-struct r300_winsys_screen *r300_drm_winsys_screen_create(int drmFD);
+struct r300_winsys_screen *r300_drm_winsys_screen_create(int fd);
+
+static INLINE boolean is_r3xx(int pciid)
+{
+      switch (pciid) {
+      case 0x4144: /* PCI_CHIP_R300_AD */
+      case 0x4145: /* PCI_CHIP_R300_AE */
+      case 0x4146: /* PCI_CHIP_R300_AF */
+      case 0x4147: /* PCI_CHIP_R300_AG */
+      case 0x4E44: /* PCI_CHIP_R300_ND */
+      case 0x4E45: /* PCI_CHIP_R300_NE */
+      case 0x4E46: /* PCI_CHIP_R300_NF */
+      case 0x4E47: /* PCI_CHIP_R300_NG */
+      case 0x4E48: /* PCI_CHIP_R350_NH */
+      case 0x4E49: /* PCI_CHIP_R350_NI */
+      case 0x4E4B: /* PCI_CHIP_R350_NK */
+      case 0x4148: /* PCI_CHIP_R350_AH */
+      case 0x4149: /* PCI_CHIP_R350_AI */
+      case 0x414A: /* PCI_CHIP_R350_AJ */
+      case 0x414B: /* PCI_CHIP_R350_AK */
+      case 0x4E4A: /* PCI_CHIP_R360_NJ */
+      case 0x4150: /* PCI_CHIP_RV350_AP */
+      case 0x4151: /* PCI_CHIP_RV350_AQ */
+      case 0x4152: /* PCI_CHIP_RV350_AR */
+      case 0x4153: /* PCI_CHIP_RV350_AS */
+      case 0x4154: /* PCI_CHIP_RV350_AT */
+      case 0x4155: /* PCI_CHIP_RV350_AU */
+      case 0x4156: /* PCI_CHIP_RV350_AV */
+      case 0x4E50: /* PCI_CHIP_RV350_NP */
+      case 0x4E51: /* PCI_CHIP_RV350_NQ */
+      case 0x4E52: /* PCI_CHIP_RV350_NR */
+      case 0x4E53: /* PCI_CHIP_RV350_NS */
+      case 0x4E54: /* PCI_CHIP_RV350_NT */
+      case 0x4E56: /* PCI_CHIP_RV350_NV */
+      case 0x5460: /* PCI_CHIP_RV370_5460 */
+      case 0x5462: /* PCI_CHIP_RV370_5462 */
+      case 0x5464: /* PCI_CHIP_RV370_5464 */
+      case 0x5B60: /* PCI_CHIP_RV370_5B60 */
+      case 0x5B62: /* PCI_CHIP_RV370_5B62 */
+      case 0x5B63: /* PCI_CHIP_RV370_5B63 */
+      case 0x5B64: /* PCI_CHIP_RV370_5B64 */
+      case 0x5B65: /* PCI_CHIP_RV370_5B65 */
+      case 0x3150: /* PCI_CHIP_RV380_3150 */
+      case 0x3152: /* PCI_CHIP_RV380_3152 */
+      case 0x3154: /* PCI_CHIP_RV380_3154 */
+      case 0x3155: /* PCI_CHIP_RV380_3155 */
+      case 0x3E50: /* PCI_CHIP_RV380_3E50 */
+      case 0x3E54: /* PCI_CHIP_RV380_3E54 */
+      case 0x4A48: /* PCI_CHIP_R420_JH */
+      case 0x4A49: /* PCI_CHIP_R420_JI */
+      case 0x4A4A: /* PCI_CHIP_R420_JJ */
+      case 0x4A4B: /* PCI_CHIP_R420_JK */
+      case 0x4A4C: /* PCI_CHIP_R420_JL */
+      case 0x4A4D: /* PCI_CHIP_R420_JM */
+      case 0x4A4E: /* PCI_CHIP_R420_JN */
+      case 0x4A4F: /* PCI_CHIP_R420_JO */
+      case 0x4A50: /* PCI_CHIP_R420_JP */
+      case 0x4A54: /* PCI_CHIP_R420_JT */
+      case 0x5548: /* PCI_CHIP_R423_UH */
+      case 0x5549: /* PCI_CHIP_R423_UI */
+      case 0x554A: /* PCI_CHIP_R423_UJ */
+      case 0x554B: /* PCI_CHIP_R423_UK */
+      case 0x5550: /* PCI_CHIP_R423_5550 */
+      case 0x5551: /* PCI_CHIP_R423_UQ */
+      case 0x5552: /* PCI_CHIP_R423_UR */
+      case 0x5554: /* PCI_CHIP_R423_UT */
+      case 0x5D57: /* PCI_CHIP_R423_5D57 */
+      case 0x554C: /* PCI_CHIP_R430_554C */
+      case 0x554D: /* PCI_CHIP_R430_554D */
+      case 0x554E: /* PCI_CHIP_R430_554E */
+      case 0x554F: /* PCI_CHIP_R430_554F */
+      case 0x5D48: /* PCI_CHIP_R430_5D48 */
+      case 0x5D49: /* PCI_CHIP_R430_5D49 */
+      case 0x5D4A: /* PCI_CHIP_R430_5D4A */
+      case 0x5D4C: /* PCI_CHIP_R480_5D4C */
+      case 0x5D4D: /* PCI_CHIP_R480_5D4D */
+      case 0x5D4E: /* PCI_CHIP_R480_5D4E */
+      case 0x5D4F: /* PCI_CHIP_R480_5D4F */
+      case 0x5D50: /* PCI_CHIP_R480_5D50 */
+      case 0x5D52: /* PCI_CHIP_R480_5D52 */
+      case 0x4B49: /* PCI_CHIP_R481_4B49 */
+      case 0x4B4A: /* PCI_CHIP_R481_4B4A */
+      case 0x4B4B: /* PCI_CHIP_R481_4B4B */
+      case 0x4B4C: /* PCI_CHIP_R481_4B4C */
+      case 0x564A: /* PCI_CHIP_RV410_564A */
+      case 0x564B: /* PCI_CHIP_RV410_564B */
+      case 0x564F: /* PCI_CHIP_RV410_564F */
+      case 0x5652: /* PCI_CHIP_RV410_5652 */
+      case 0x5653: /* PCI_CHIP_RV410_5653 */
+      case 0x5657: /* PCI_CHIP_RV410_5657 */
+      case 0x5E48: /* PCI_CHIP_RV410_5E48 */
+      case 0x5E4A: /* PCI_CHIP_RV410_5E4A */
+      case 0x5E4B: /* PCI_CHIP_RV410_5E4B */
+      case 0x5E4C: /* PCI_CHIP_RV410_5E4C */
+      case 0x5E4D: /* PCI_CHIP_RV410_5E4D */
+      case 0x5E4F: /* PCI_CHIP_RV410_5E4F */
+      case 0x5A41: /* PCI_CHIP_RS400_5A41 */
+      case 0x5A42: /* PCI_CHIP_RS400_5A42 */
+      case 0x5A61: /* PCI_CHIP_RC410_5A61 */
+      case 0x5A62: /* PCI_CHIP_RC410_5A62 */
+      case 0x5954: /* PCI_CHIP_RS480_5954 */
+      case 0x5955: /* PCI_CHIP_RS480_5955 */
+      case 0x5974: /* PCI_CHIP_RS482_5974 */
+      case 0x5975: /* PCI_CHIP_RS482_5975 */
+      case 0x7100: /* PCI_CHIP_R520_7100 */
+      case 0x7101: /* PCI_CHIP_R520_7101 */
+      case 0x7102: /* PCI_CHIP_R520_7102 */
+      case 0x7103: /* PCI_CHIP_R520_7103 */
+      case 0x7104: /* PCI_CHIP_R520_7104 */
+      case 0x7105: /* PCI_CHIP_R520_7105 */
+      case 0x7106: /* PCI_CHIP_R520_7106 */
+      case 0x7108: /* PCI_CHIP_R520_7108 */
+      case 0x7109: /* PCI_CHIP_R520_7109 */
+      case 0x710A: /* PCI_CHIP_R520_710A */
+      case 0x710B: /* PCI_CHIP_R520_710B */
+      case 0x710C: /* PCI_CHIP_R520_710C */
+      case 0x710E: /* PCI_CHIP_R520_710E */
+      case 0x710F: /* PCI_CHIP_R520_710F */
+      case 0x7140: /* PCI_CHIP_RV515_7140 */
+      case 0x7141: /* PCI_CHIP_RV515_7141 */
+      case 0x7142: /* PCI_CHIP_RV515_7142 */
+      case 0x7143: /* PCI_CHIP_RV515_7143 */
+      case 0x7144: /* PCI_CHIP_RV515_7144 */
+      case 0x7145: /* PCI_CHIP_RV515_7145 */
+      case 0x7146: /* PCI_CHIP_RV515_7146 */
+      case 0x7147: /* PCI_CHIP_RV515_7147 */
+      case 0x7149: /* PCI_CHIP_RV515_7149 */
+      case 0x714A: /* PCI_CHIP_RV515_714A */
+      case 0x714B: /* PCI_CHIP_RV515_714B */
+      case 0x714C: /* PCI_CHIP_RV515_714C */
+      case 0x714D: /* PCI_CHIP_RV515_714D */
+      case 0x714E: /* PCI_CHIP_RV515_714E */
+      case 0x714F: /* PCI_CHIP_RV515_714F */
+      case 0x7151: /* PCI_CHIP_RV515_7151 */
+      case 0x7152: /* PCI_CHIP_RV515_7152 */
+      case 0x7153: /* PCI_CHIP_RV515_7153 */
+      case 0x715E: /* PCI_CHIP_RV515_715E */
+      case 0x715F: /* PCI_CHIP_RV515_715F */
+      case 0x7180: /* PCI_CHIP_RV515_7180 */
+      case 0x7181: /* PCI_CHIP_RV515_7181 */
+      case 0x7183: /* PCI_CHIP_RV515_7183 */
+      case 0x7186: /* PCI_CHIP_RV515_7186 */
+      case 0x7187: /* PCI_CHIP_RV515_7187 */
+      case 0x7188: /* PCI_CHIP_RV515_7188 */
+      case 0x718A: /* PCI_CHIP_RV515_718A */
+      case 0x718B: /* PCI_CHIP_RV515_718B */
+      case 0x718C: /* PCI_CHIP_RV515_718C */
+      case 0x718D: /* PCI_CHIP_RV515_718D */
+      case 0x718F: /* PCI_CHIP_RV515_718F */
+      case 0x7193: /* PCI_CHIP_RV515_7193 */
+      case 0x7196: /* PCI_CHIP_RV515_7196 */
+      case 0x719B: /* PCI_CHIP_RV515_719B */
+      case 0x719F: /* PCI_CHIP_RV515_719F */
+      case 0x7200: /* PCI_CHIP_RV515_7200 */
+      case 0x7210: /* PCI_CHIP_RV515_7210 */
+      case 0x7211: /* PCI_CHIP_RV515_7211 */
+      case 0x71C0: /* PCI_CHIP_RV530_71C0 */
+      case 0x71C1: /* PCI_CHIP_RV530_71C1 */
+      case 0x71C2: /* PCI_CHIP_RV530_71C2 */
+      case 0x71C3: /* PCI_CHIP_RV530_71C3 */
+      case 0x71C4: /* PCI_CHIP_RV530_71C4 */
+      case 0x71C5: /* PCI_CHIP_RV530_71C5 */
+      case 0x71C6: /* PCI_CHIP_RV530_71C6 */
+      case 0x71C7: /* PCI_CHIP_RV530_71C7 */
+      case 0x71CD: /* PCI_CHIP_RV530_71CD */
+      case 0x71CE: /* PCI_CHIP_RV530_71CE */
+      case 0x71D2: /* PCI_CHIP_RV530_71D2 */
+      case 0x71D4: /* PCI_CHIP_RV530_71D4 */
+      case 0x71D5: /* PCI_CHIP_RV530_71D5 */
+      case 0x71D6: /* PCI_CHIP_RV530_71D6 */
+      case 0x71DA: /* PCI_CHIP_RV530_71DA */
+      case 0x71DE: /* PCI_CHIP_RV530_71DE */
+      case 0x7281: /* PCI_CHIP_RV560_7281 */
+      case 0x7283: /* PCI_CHIP_RV560_7283 */
+      case 0x7287: /* PCI_CHIP_RV560_7287 */
+      case 0x7290: /* PCI_CHIP_RV560_7290 */
+      case 0x7291: /* PCI_CHIP_RV560_7291 */
+      case 0x7293: /* PCI_CHIP_RV560_7293 */
+      case 0x7297: /* PCI_CHIP_RV560_7297 */
+      case 0x7280: /* PCI_CHIP_RV570_7280 */
+      case 0x7288: /* PCI_CHIP_RV570_7288 */
+      case 0x7289: /* PCI_CHIP_RV570_7289 */
+      case 0x728B: /* PCI_CHIP_RV570_728B */
+      case 0x728C: /* PCI_CHIP_RV570_728C */
+      case 0x7240: /* PCI_CHIP_R580_7240 */
+      case 0x7243: /* PCI_CHIP_R580_7243 */
+      case 0x7244: /* PCI_CHIP_R580_7244 */
+      case 0x7245: /* PCI_CHIP_R580_7245 */
+      case 0x7246: /* PCI_CHIP_R580_7246 */
+      case 0x7247: /* PCI_CHIP_R580_7247 */
+      case 0x7248: /* PCI_CHIP_R580_7248 */
+      case 0x7249: /* PCI_CHIP_R580_7249 */
+      case 0x724A: /* PCI_CHIP_R580_724A */
+      case 0x724B: /* PCI_CHIP_R580_724B */
+      case 0x724C: /* PCI_CHIP_R580_724C */
+      case 0x724D: /* PCI_CHIP_R580_724D */
+      case 0x724E: /* PCI_CHIP_R580_724E */
+      case 0x724F: /* PCI_CHIP_R580_724F */
+      case 0x7284: /* PCI_CHIP_R580_7284 */
+      case 0x793F: /* PCI_CHIP_RS600_793F */
+      case 0x7941: /* PCI_CHIP_RS600_7941 */
+      case 0x7942: /* PCI_CHIP_RS600_7942 */
+      case 0x791E: /* PCI_CHIP_RS690_791E */
+      case 0x791F: /* PCI_CHIP_RS690_791F */
+      case 0x796C: /* PCI_CHIP_RS740_796C */
+      case 0x796D: /* PCI_CHIP_RS740_796D */
+      case 0x796E: /* PCI_CHIP_RS740_796E */
+      case 0x796F: /* PCI_CHIP_RS740_796F */
+             return TRUE;
+      default:
+             return FALSE;
+      }
+}
 
 #endif
index 420522f5c1f355728b032f8f6cf2b2469e306b52..bacf181b47c8df4cf0d881933c101bfdcaf06027 100644 (file)
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
-#include "radeon_r300.h"
-#include "radeon_buffer.h"
-
-#include "radeon_bo_gem.h"
-#include "radeon_cs_gem.h"
-#include "state_tracker/drm_driver.h"
+#include "radeon_drm_buffer.h"
 
 #include "util/u_memory.h"
+#include "pipebuffer/pb_bufmgr.h"
+
+#include "state_tracker/drm_driver.h"
 
 static unsigned get_pb_usage_from_create_flags(unsigned bind, unsigned usage,
                                                enum r300_buffer_domain domain)
@@ -73,7 +71,7 @@ radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,
                                  unsigned usage,
                                  enum r300_buffer_domain domain)
 {
-    struct radeon_libdrm_winsys *ws = radeon_libdrm_winsys(rws);
+    struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
     struct pb_desc desc;
     struct pb_manager *provider;
     struct pb_buffer *buffer;
@@ -92,7 +90,7 @@ radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,
     if (!buffer)
        return NULL;
 
-    return radeon_libdrm_winsys_buffer(buffer);
+    return (struct r300_winsys_buffer*)buffer;
 }
 
 static void radeon_r300_winsys_buffer_reference(struct r300_winsys_screen *rws,
@@ -104,7 +102,7 @@ static void radeon_r300_winsys_buffer_reference(struct r300_winsys_screen *rws,
 
     pb_reference(&_dst, _src);
 
-    *pdst = radeon_libdrm_winsys_buffer(_dst);
+    *pdst = (struct r300_winsys_buffer*)_dst;
 }
 
 static struct r300_winsys_buffer *radeon_r300_winsys_buffer_from_handle(struct r300_winsys_screen *rws,
@@ -112,7 +110,7 @@ static struct r300_winsys_buffer *radeon_r300_winsys_buffer_from_handle(struct r
                                                                         unsigned *stride,
                                                                         unsigned *size)
 {
-    struct radeon_libdrm_winsys *ws = radeon_libdrm_winsys(rws);
+    struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
     struct pb_buffer *_buf;
 
     _buf = radeon_drm_bufmgr_create_buffer_from_handle(ws->kman, whandle->handle);
@@ -122,7 +120,7 @@ static struct r300_winsys_buffer *radeon_r300_winsys_buffer_from_handle(struct r
     if (size)
         *size = _buf->base.size;
 
-    return radeon_libdrm_winsys_buffer(_buf);
+    return (struct r300_winsys_buffer*)_buf;
 }
 
 static boolean radeon_r300_winsys_buffer_get_handle(struct r300_winsys_screen *rws,
@@ -135,70 +133,10 @@ static boolean radeon_r300_winsys_buffer_get_handle(struct r300_winsys_screen *r
     return radeon_drm_bufmgr_get_handle(_buf, whandle);
 }
 
-static void radeon_r300_winsys_cs_set_flush(struct r300_winsys_cs *rcs,
-                                            void (*flush)(void *),
-                                            void *user)
-{
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-    cs->flush_cs = flush;
-    cs->flush_data = user;
-    radeon_cs_space_set_flush(cs->cs, flush, user);
-}
-
-static boolean radeon_r300_winsys_cs_validate(struct r300_winsys_cs *rcs)
-{
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-
-    return radeon_cs_space_check(cs->cs) >= 0;
-}
-
-static void radeon_r300_winsys_cs_reset_buffers(struct r300_winsys_cs *rcs)
-{
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-    radeon_cs_space_reset_bos(cs->cs);
-}
-
-static void radeon_r300_winsys_cs_flush(struct r300_winsys_cs *rcs)
-{
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-    int retval;
-
-    /* Don't flush a zero-sized CS. */
-    if (!cs->base.cdw) {
-        return;
-    }
-
-    cs->cs->cdw = cs->base.cdw;
-
-    radeon_drm_bufmgr_flush_maps(cs->ws->kman);
-
-    /* Emit the CS. */
-    retval = radeon_cs_emit(cs->cs);
-    if (retval) {
-        if (debug_get_bool_option("RADEON_DUMP_CS", FALSE)) {
-            fprintf(stderr, "radeon: The kernel rejected CS, dumping...\n");
-            radeon_cs_print(cs->cs, stderr);
-        } else {
-            fprintf(stderr, "radeon: The kernel rejected CS, "
-                            "see dmesg for more information.\n");
-        }
-    }
-
-    /* Reset CS.
-     * Someday, when we care about performance, we should really find a way
-     * to rotate between two or three CS objects so that the GPU can be
-     * spinning through one CS while another one is being filled. */
-    radeon_cs_erase(cs->cs);
-
-    cs->base.ptr = cs->cs->packets;
-    cs->base.cdw = cs->cs->cdw;
-    cs->base.ndw = cs->cs->ndw;
-}
-
 static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
                                  enum r300_value_id id)
 {
-    struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
+    struct radeon_drm_winsys *ws = (struct radeon_drm_winsys *)rws;
 
     switch(id) {
     case R300_VID_PCI_ID:
@@ -213,110 +151,19 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
         return ws->drm_2_3_0;
     case R300_VID_DRM_2_6_0:
         return ws->drm_2_6_0;
+    case R300_VID_DRM_2_8_0:
+        return ws->drm_2_8_0;
     case R300_CAN_HYPERZ:
         return ws->hyperz;
     }
     return 0;
 }
 
-static struct r300_winsys_cs *radeon_r300_winsys_cs_create(struct r300_winsys_screen *rws)
+void radeon_winsys_init_functions(struct radeon_drm_winsys *ws)
 {
-    struct radeon_libdrm_winsys *ws = radeon_libdrm_winsys(rws);
-    struct radeon_libdrm_cs *cs = CALLOC_STRUCT(radeon_libdrm_cs);
-
-    if (!cs)
-        return NULL;
-
-    /* Size limit on IBs is 64 kibibytes. */
-    cs->cs = radeon_cs_create(ws->csm, 1024 * 64 / 4);
-    if (!cs->cs) {
-        FREE(cs);
-        return NULL;
-    }
-
-    radeon_cs_set_limit(cs->cs,
-            RADEON_GEM_DOMAIN_GTT, ws->gart_size);
-    radeon_cs_set_limit(cs->cs,
-            RADEON_GEM_DOMAIN_VRAM, ws->vram_size);
-
-    cs->ws = ws;
-    cs->base.ptr = cs->cs->packets;
-    cs->base.cdw = cs->cs->cdw;
-    cs->base.ndw = cs->cs->ndw;
-    return &cs->base;
-}
-
-static void radeon_r300_winsys_cs_destroy(struct r300_winsys_cs *rcs)
-{
-    struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
-    radeon_cs_destroy(cs->cs);
-    FREE(cs);
-}
-
-static void radeon_winsys_destroy(struct r300_winsys_screen *rws)
-{
-    struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
-
-    ws->cman->destroy(ws->cman);
-    ws->kman->destroy(ws->kman);
-
-    radeon_bo_manager_gem_dtor(ws->bom);
-    radeon_cs_manager_gem_dtor(ws->csm);
-
-    FREE(rws);
-}
-
-boolean radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
-{
-    ws->csm = radeon_cs_manager_gem_ctor(fd);
-    if (!ws->csm)
-       goto fail;
-    ws->bom = radeon_bo_manager_gem_ctor(fd);
-    if (!ws->bom)
-       goto fail;
-    ws->kman = radeon_drm_bufmgr_create(ws);
-    if (!ws->kman)
-       goto fail;
-
-    ws->cman = pb_cache_manager_create(ws->kman, 100000);
-    if (!ws->cman)
-       goto fail;
-
-    ws->base.destroy = radeon_winsys_destroy;
     ws->base.get_value = radeon_get_value;
-
     ws->base.buffer_create = radeon_r300_winsys_buffer_create;
-    ws->base.buffer_set_tiling = radeon_drm_bufmgr_set_tiling;
-    ws->base.buffer_get_tiling = radeon_drm_bufmgr_get_tiling;
-    ws->base.buffer_map = radeon_drm_buffer_map;
-    ws->base.buffer_unmap = radeon_drm_buffer_unmap;
-    ws->base.buffer_wait = radeon_drm_bufmgr_wait;
     ws->base.buffer_reference = radeon_r300_winsys_buffer_reference;
     ws->base.buffer_from_handle = radeon_r300_winsys_buffer_from_handle;
     ws->base.buffer_get_handle = radeon_r300_winsys_buffer_get_handle;
-
-    ws->base.cs_create = radeon_r300_winsys_cs_create;
-    ws->base.cs_destroy = radeon_r300_winsys_cs_destroy;
-    ws->base.cs_add_buffer = radeon_drm_bufmgr_add_buffer;
-    ws->base.cs_validate = radeon_r300_winsys_cs_validate;
-    ws->base.cs_write_reloc = radeon_drm_bufmgr_write_reloc;
-    ws->base.cs_flush = radeon_r300_winsys_cs_flush;
-    ws->base.cs_reset_buffers = radeon_r300_winsys_cs_reset_buffers;
-    ws->base.cs_set_flush = radeon_r300_winsys_cs_set_flush;
-    ws->base.cs_is_buffer_referenced = radeon_drm_bufmgr_is_buffer_referenced;
-    return TRUE;
-
-fail:
-    if (ws->csm)
-       radeon_cs_manager_gem_dtor(ws->csm);
-
-    if (ws->bom)
-       radeon_bo_manager_gem_dtor(ws->bom);
-
-    if (ws->cman)
-       ws->cman->destroy(ws->cman);
-    if (ws->kman)
-       ws->kman->destroy(ws->kman);
-
-    return FALSE;
 }
diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.h b/src/gallium/winsys/radeon/drm/radeon_r300.h
deleted file mode 100644 (file)
index 2703464..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#ifndef RADEON_R300_H
-#define RADEON_R300_H
-
-#include "radeon_winsys.h"
-
-boolean radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* winsys);
-
-#endif /* RADEON_R300_H */
index 6f4aa4bce30c2cfc28629cb4b1e4dbac9d6a7c54..492edfef8c3cde378a91e45547020d81d8f869d3 100644 (file)
 
 #include "r300_winsys.h"
 
-struct radeon_libdrm_winsys {
-    /* Parent class. */
+struct radeon_drm_winsys {
     struct r300_winsys_screen base;
 
-    struct pb_manager *kman;
+    int fd; /* DRM file descriptor */
 
+    struct radeon_bo_manager *bom; /* Radeon BO manager. */
+    struct pb_manager *kman;
     struct pb_manager *cman;
 
-    /* PCI ID */
-    uint32_t pci_id;
-
-    /* GB pipe count */
-    uint32_t gb_pipes;
-
-    /* Z pipe count (rv530 only) */
-    uint32_t z_pipes;
-
-    /* GART size. */
-    uint32_t gart_size;
-
-    /* VRAM size. */
-    uint32_t vram_size;
-
-    /* Square tiling support. */
-    boolean squaretiling;
-
-    /* DRM 2.3.0
-     *   - R500 VAP regs
-     *   - MSPOS regs
-     *   - Fixed texture 3D size calculation
-     */
+    uint32_t pci_id;        /* PCI ID */
+    uint32_t gb_pipes;      /* GB pipe count */
+    uint32_t z_pipes;       /* Z pipe count (rv530 only) */
+    uint32_t gart_size;     /* GART size. */
+    uint32_t vram_size;     /* VRAM size. */
+    boolean squaretiling;   /* Square tiling support. */
+    /* DRM 2.3.0 (R500 VAP regs, MSPOS regs, fixed tex3D size checking) */
     boolean drm_2_3_0;
-
-    /* DRM 2.6.0
-     *   - Hyper-Z
-     *   - GB_Z_PEQ_CONFIG allowed on rv350->r4xx, we should initialize it
-     */
+    /* DRM 2.6.0 (Hyper-Z, GB_Z_PEQ_CONFIG allowed on rv350->r4xx, FG_ALPHA_VALUE) */
     boolean drm_2_6_0;
-
-    /* hyperz user */
+    /* DRM 2.8.0 (US_FORMAT regs, ARGB2101010 colorbuffer) */
+    boolean drm_2_8_0;
+    /* Hyper-Z user */
     boolean hyperz;
-
-    /* DRM FD */
-    int fd;
-
-    /* Radeon BO manager. */
-    struct radeon_bo_manager *bom;
-
-    /* Radeon CS manager. */
-    struct radeon_cs_manager *csm;
-};
-
-struct radeon_libdrm_cs {
-    struct r300_winsys_cs base;
-
-    /* The winsys. */
-    struct radeon_libdrm_winsys *ws;
-
-    /* The libdrm command stream. */
-    struct radeon_cs *cs;
-
-    /* Flush CS. */
-    void (*flush_cs)(void *);
-    void *flush_data;
 };
 
-static INLINE struct radeon_libdrm_cs *
-radeon_libdrm_cs(struct r300_winsys_cs *base)
+static INLINE struct radeon_drm_winsys *
+radeon_drm_winsys(struct r300_winsys_screen *base)
 {
-    return (struct radeon_libdrm_cs*)base;
+    return (struct radeon_drm_winsys*)base;
 }
 
-static INLINE struct radeon_libdrm_winsys *
-radeon_libdrm_winsys(struct r300_winsys_screen *base)
-{
-    return (struct radeon_libdrm_winsys*)base;
-}
+void radeon_winsys_init_functions(struct radeon_drm_winsys *ws);
 
 #endif
index 51a4c55e5a2815537d756a471e6809cb8094d365..cc3003d252f644cecb37661c3e8ce395c2ab9762 100644 (file)
@@ -45,8 +45,6 @@ vmw_winsys_create( int fd, boolean use_old_scanout_flag )
 
    vws->ioctl.drm_fd = fd;
    vws->use_old_scanout_flag = use_old_scanout_flag;
-   debug_printf("%s: use_old_scanout_flag == %s\n", __FUNCTION__,
-               use_old_scanout_flag ? "true" : "false");
 
    if (!vmw_ioctl_init(vws))
       goto out_no_ioctl;
index bc2623e7b77ad35dd3d8cec8c6d3539478e138a8..4ecfdbf391583e024ac7e77d452d8c0f1c6c5d41 100644 (file)
@@ -61,10 +61,8 @@ struct wrapper_sw_displaytarget
    struct pipe_resource *tex;
    struct pipe_transfer *transfer;
 
-   unsigned width;
-   unsigned height;
    unsigned map_count;
-   unsigned stride; /**< because we give stride at create */
+   unsigned stride; /**< because we get stride at create */
    void *ptr;
 };
 
@@ -93,9 +91,9 @@ wsw_dt_get_stride(struct wrapper_sw_displaytarget *wdt, unsigned *stride)
    struct pipe_resource *tex = wdt->tex;
    struct pipe_transfer *tr;
 
-   tr = pipe_get_transfer(pipe, tex, 0, 0, 0,
-                         PIPE_TRANSFER_READ_WRITE,
-                         0, 0, wdt->width, wdt->height);
+   tr = pipe_get_transfer(pipe, tex, 0, 0,
+                          PIPE_TRANSFER_READ_WRITE,
+                          0, 0, wdt->tex->width0, wdt->tex->height0);
    if (!tr)
       return FALSE;
 
@@ -149,6 +147,8 @@ wsw_dt_create(struct sw_winsys *ws,
    templ.target = wsw->target;
    templ.width0 = width;
    templ.height0 = height;
+   templ.depth0 = 1;
+   templ.array_size = 1;
    templ.format = format;
    templ.bind = bind;
 
@@ -204,9 +204,9 @@ wsw_dt_map(struct sw_winsys *ws,
 
       assert(!wdt->transfer);
 
-      tr = pipe_get_transfer(pipe, tex, 0, 0, 0,
-                            PIPE_TRANSFER_READ_WRITE,
-                            0, 0, wdt->width, wdt->height);
+      tr = pipe_get_transfer(pipe, tex, 0, 0,
+                             PIPE_TRANSFER_READ_WRITE,
+                             0, 0, wdt->tex->width0, wdt->tex->height0);
       if (!tr)
          return NULL;
 
@@ -246,6 +246,7 @@ wsw_dt_unmap(struct sw_winsys *ws,
 
    pipe->transfer_unmap(pipe, wdt->transfer);
    pipe->transfer_destroy(pipe, wdt->transfer);
+   pipe->flush(pipe, 0, NULL);
    wdt->transfer = NULL;
 }
 
diff --git a/src/getopt/SConscript b/src/getopt/SConscript
new file mode 100644 (file)
index 0000000..14cabed
--- /dev/null
@@ -0,0 +1,15 @@
+Import('*')
+
+if not env['msvc']:
+    Return()
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = ['.'])
+
+getopt = env.ConvenienceLibrary(
+    target = 'getopt',
+    source = ['getopt_long.c'],
+)
+
+Export('getopt')
diff --git a/src/getopt/getopt.h b/src/getopt/getopt.h
new file mode 100644 (file)
index 0000000..117608f
--- /dev/null
@@ -0,0 +1,82 @@
+/*     $OpenBSD: getopt.h,v 1.2 2008/06/26 05:42:04 ray Exp $  */
+/*     $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $    */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _GETOPT_H_
+#define _GETOPT_H_
+
+/*
+ * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
+ */
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct option {
+       /* name of long option */
+       const char *name;
+       /*
+        * one of no_argument, required_argument, and optional_argument:
+        * whether option takes an argument
+        */
+       int has_arg;
+       /* if not NULL, set *flag to val when option found */
+       int *flag;
+       /* if flag not NULL, value to set *flag to; else return value */
+       int val;
+};
+
+int     getopt_long(int, char * const *, const char *,
+           const struct option *, int *);
+int     getopt_long_only(int, char * const *, const char *,
+           const struct option *, int *);
+#ifndef _GETOPT_DEFINED_
+#define _GETOPT_DEFINED_
+int     getopt(int, char * const *, const char *);
+int     getsubopt(char **, char * const *, char **);
+
+extern   char *optarg;                  /* getopt(3) external variables */
+extern   int opterr;
+extern   int optind;
+extern   int optopt;
+extern   int optreset;
+extern   char *suboptarg;               /* getsubopt(3) external variable */
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !_GETOPT_H_ */
diff --git a/src/getopt/getopt_long.c b/src/getopt/getopt_long.c
new file mode 100644 (file)
index 0000000..81268b8
--- /dev/null
@@ -0,0 +1,511 @@
+/*     $OpenBSD: getopt_long.c,v 1.24 2010/07/22 19:31:53 blambert Exp $       */
+/*     $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $      */
+
+/*
+ * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int    opterr = 1;             /* if error message should be printed */
+int    optind = 1;             /* index into parent argv vector */
+int    optopt = '?';           /* character checked for validity */
+int    optreset;               /* reset getopt */
+char    *optarg;               /* argument associated with option */
+
+#define PRINT_ERROR    ((opterr) && (*options != ':'))
+
+#define FLAG_PERMUTE   0x01    /* permute non-options to the end of argv */
+#define FLAG_ALLARGS   0x02    /* treat non-options as args to option "-1" */
+#define FLAG_LONGONLY  0x04    /* operate as getopt_long_only */
+
+/* return values */
+#define        BADCH           (int)'?'
+#define        BADARG          ((*options == ':') ? (int)':' : (int)'?')
+#define        INORDER         (int)1
+
+#define        EMSG            ""
+
+static int getopt_internal(int, char * const *, const char *,
+                          const struct option *, int *, int);
+static int parse_long_options(char * const *, const char *,
+                             const struct option *, int *, int);
+static int gcd(int, int);
+static void permute_args(int, int, int, char * const *);
+
+static char *place = EMSG; /* option letter processing */
+
+/* XXX: set optreset to 1 rather than these two */
+static int nonopt_start = -1; /* first non option argument (for permute) */
+static int nonopt_end = -1;   /* first option after non options (for permute) */
+
+/* Error messages */
+static const char recargchar[] = "option requires an argument -- %c";
+static const char recargstring[] = "option requires an argument -- %s";
+static const char ambig[] = "ambiguous option -- %.*s";
+static const char noarg[] = "option doesn't take an argument -- %.*s";
+static const char illoptchar[] = "unknown option -- %c";
+static const char illoptstring[] = "unknown option -- %s";
+
+/*
+ * Compute the greatest common divisor of a and b.
+ */
+static int
+gcd(int a, int b)
+{
+       int c;
+
+       c = a % b;
+       while (c != 0) {
+               a = b;
+               b = c;
+               c = a % b;
+       }
+
+       return (b);
+}
+
+/*
+ * Exchange the block from nonopt_start to nonopt_end with the block
+ * from nonopt_end to opt_end (keeping the same order of arguments
+ * in each block).
+ */
+static void
+permute_args(int panonopt_start, int panonopt_end, int opt_end,
+       char * const *nargv)
+{
+       int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
+       char *swap;
+
+       /*
+        * compute lengths of blocks and number and size of cycles
+        */
+       nnonopts = panonopt_end - panonopt_start;
+       nopts = opt_end - panonopt_end;
+       ncycle = gcd(nnonopts, nopts);
+       cyclelen = (opt_end - panonopt_start) / ncycle;
+
+       for (i = 0; i < ncycle; i++) {
+               cstart = panonopt_end+i;
+               pos = cstart;
+               for (j = 0; j < cyclelen; j++) {
+                       if (pos >= panonopt_end)
+                               pos -= nnonopts;
+                       else
+                               pos += nopts;
+                       swap = nargv[pos];
+                       /* LINTED const cast */
+                       ((char **) nargv)[pos] = nargv[cstart];
+                       /* LINTED const cast */
+                       ((char **)nargv)[cstart] = swap;
+               }
+       }
+}
+
+/*
+ * parse_long_options --
+ *     Parse long options in argc/argv argument vector.
+ * Returns -1 if short_too is set and the option does not match long_options.
+ */
+static int
+parse_long_options(char * const *nargv, const char *options,
+       const struct option *long_options, int *idx, int short_too)
+{
+       char *current_argv, *has_equal;
+       size_t current_argv_len;
+       int i, match;
+
+       current_argv = place;
+       match = -1;
+
+       optind++;
+
+       if ((has_equal = strchr(current_argv, '=')) != NULL) {
+               /* argument found (--option=arg) */
+               current_argv_len = has_equal - current_argv;
+               has_equal++;
+       } else
+               current_argv_len = strlen(current_argv);
+
+       for (i = 0; long_options[i].name; i++) {
+               /* find matching long option */
+               if (strncmp(current_argv, long_options[i].name,
+                   current_argv_len))
+                       continue;
+
+               if (strlen(long_options[i].name) == current_argv_len) {
+                       /* exact match */
+                       match = i;
+                       break;
+               }
+               /*
+                * If this is a known short option, don't allow
+                * a partial match of a single character.
+                */
+               if (short_too && current_argv_len == 1)
+                       continue;
+
+               if (match == -1)        /* partial match */
+                       match = i;
+               else {
+                       /* ambiguous abbreviation */
+                       if (PRINT_ERROR)
+                               fprintf(stderr, ambig, (int)current_argv_len,
+                                    current_argv);
+                       optopt = 0;
+                       return (BADCH);
+               }
+       }
+       if (match != -1) {              /* option found */
+               if (long_options[match].has_arg == no_argument
+                   && has_equal) {
+                       if (PRINT_ERROR)
+                               fprintf(stderr, noarg, (int)current_argv_len,
+                                    current_argv);
+                       /*
+                        * XXX: GNU sets optopt to val regardless of flag
+                        */
+                       if (long_options[match].flag == NULL)
+                               optopt = long_options[match].val;
+                       else
+                               optopt = 0;
+                       return (BADARG);
+               }
+               if (long_options[match].has_arg == required_argument ||
+                   long_options[match].has_arg == optional_argument) {
+                       if (has_equal)
+                               optarg = has_equal;
+                       else if (long_options[match].has_arg ==
+                           required_argument) {
+                               /*
+                                * optional argument doesn't use next nargv
+                                */
+                               optarg = nargv[optind++];
+                       }
+               }
+               if ((long_options[match].has_arg == required_argument)
+                   && (optarg == NULL)) {
+                       /*
+                        * Missing argument; leading ':' indicates no error
+                        * should be generated.
+                        */
+                       if (PRINT_ERROR)
+                               fprintf(stderr, recargstring,
+                                   current_argv);
+                       /*
+                        * XXX: GNU sets optopt to val regardless of flag
+                        */
+                       if (long_options[match].flag == NULL)
+                               optopt = long_options[match].val;
+                       else
+                               optopt = 0;
+                       --optind;
+                       return (BADARG);
+               }
+       } else {                        /* unknown option */
+               if (short_too) {
+                       --optind;
+                       return (-1);
+               }
+               if (PRINT_ERROR)
+                       fprintf(stderr, illoptstring, current_argv);
+               optopt = 0;
+               return (BADCH);
+       }
+       if (idx)
+               *idx = match;
+       if (long_options[match].flag) {
+               *long_options[match].flag = long_options[match].val;
+               return (0);
+       } else
+               return (long_options[match].val);
+}
+
+/*
+ * getopt_internal --
+ *     Parse argc/argv argument vector.  Called by user level routines.
+ */
+static int
+getopt_internal(int nargc, char * const *nargv, const char *options,
+       const struct option *long_options, int *idx, int flags)
+{
+       char *oli;                              /* option letter list index */
+       int optchar, short_too;
+       static int posixly_correct = -1;
+
+       if (options == NULL)
+               return (-1);
+
+       /*
+        * Disable GNU extensions if POSIXLY_CORRECT is set or options
+        * string begins with a '+'.
+        */
+       if (posixly_correct == -1)
+               posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
+       if (posixly_correct || *options == '+')
+               flags &= ~FLAG_PERMUTE;
+       else if (*options == '-')
+               flags |= FLAG_ALLARGS;
+       if (*options == '+' || *options == '-')
+               options++;
+
+       /*
+        * XXX Some GNU programs (like cvs) set optind to 0 instead of
+        * XXX using optreset.  Work around this braindamage.
+        */
+       if (optind == 0)
+               optind = optreset = 1;
+
+       optarg = NULL;
+       if (optreset)
+               nonopt_start = nonopt_end = -1;
+start:
+       if (optreset || !*place) {              /* update scanning pointer */
+               optreset = 0;
+               if (optind >= nargc) {          /* end of argument vector */
+                       place = EMSG;
+                       if (nonopt_end != -1) {
+                               /* do permutation, if we have to */
+                               permute_args(nonopt_start, nonopt_end,
+                                   optind, nargv);
+                               optind -= nonopt_end - nonopt_start;
+                       }
+                       else if (nonopt_start != -1) {
+                               /*
+                                * If we skipped non-options, set optind
+                                * to the first of them.
+                                */
+                               optind = nonopt_start;
+                       }
+                       nonopt_start = nonopt_end = -1;
+                       return (-1);
+               }
+               if (*(place = nargv[optind]) != '-' ||
+                   (place[1] == '\0' && strchr(options, '-') == NULL)) {
+                       place = EMSG;           /* found non-option */
+                       if (flags & FLAG_ALLARGS) {
+                               /*
+                                * GNU extension:
+                                * return non-option as argument to option 1
+                                */
+                               optarg = nargv[optind++];
+                               return (INORDER);
+                       }
+                       if (!(flags & FLAG_PERMUTE)) {
+                               /*
+                                * If no permutation wanted, stop parsing
+                                * at first non-option.
+                                */
+                               return (-1);
+                       }
+                       /* do permutation */
+                       if (nonopt_start == -1)
+                               nonopt_start = optind;
+                       else if (nonopt_end != -1) {
+                               permute_args(nonopt_start, nonopt_end,
+                                   optind, nargv);
+                               nonopt_start = optind -
+                                   (nonopt_end - nonopt_start);
+                               nonopt_end = -1;
+                       }
+                       optind++;
+                       /* process next argument */
+                       goto start;
+               }
+               if (nonopt_start != -1 && nonopt_end == -1)
+                       nonopt_end = optind;
+
+               /*
+                * If we have "-" do nothing, if "--" we are done.
+                */
+               if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
+                       optind++;
+                       place = EMSG;
+                       /*
+                        * We found an option (--), so if we skipped
+                        * non-options, we have to permute.
+                        */
+                       if (nonopt_end != -1) {
+                               permute_args(nonopt_start, nonopt_end,
+                                   optind, nargv);
+                               optind -= nonopt_end - nonopt_start;
+                       }
+                       nonopt_start = nonopt_end = -1;
+                       return (-1);
+               }
+       }
+
+       /*
+        * Check long options if:
+        *  1) we were passed some
+        *  2) the arg is not just "-"
+        *  3) either the arg starts with -- we are getopt_long_only()
+        */
+       if (long_options != NULL && place != nargv[optind] &&
+           (*place == '-' || (flags & FLAG_LONGONLY))) {
+               short_too = 0;
+               if (*place == '-')
+                       place++;                /* --foo long option */
+               else if (*place != ':' && strchr(options, *place) != NULL)
+                       short_too = 1;          /* could be short option too */
+
+               optchar = parse_long_options(nargv, options, long_options,
+                   idx, short_too);
+               if (optchar != -1) {
+                       place = EMSG;
+                       return (optchar);
+               }
+       }
+
+       if ((optchar = (int)*place++) == (int)':' ||
+           (optchar == (int)'-' && *place != '\0') ||
+           (oli = strchr(options, optchar)) == NULL) {
+               /*
+                * If the user specified "-" and  '-' isn't listed in
+                * options, return -1 (non-option) as per POSIX.
+                * Otherwise, it is an unknown option character (or ':').
+                */
+               if (optchar == (int)'-' && *place == '\0')
+                       return (-1);
+               if (!*place)
+                       ++optind;
+               if (PRINT_ERROR)
+                       fprintf(stderr, illoptchar, optchar);
+               optopt = optchar;
+               return (BADCH);
+       }
+       if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
+               /* -W long-option */
+               if (*place)                     /* no space */
+                       /* NOTHING */;
+               else if (++optind >= nargc) {   /* no arg */
+                       place = EMSG;
+                       if (PRINT_ERROR)
+                               fprintf(stderr, recargchar, optchar);
+                       optopt = optchar;
+                       return (BADARG);
+               } else                          /* white space */
+                       place = nargv[optind];
+               optchar = parse_long_options(nargv, options, long_options,
+                   idx, 0);
+               place = EMSG;
+               return (optchar);
+       }
+       if (*++oli != ':') {                    /* doesn't take argument */
+               if (!*place)
+                       ++optind;
+       } else {                                /* takes (optional) argument */
+               optarg = NULL;
+               if (*place)                     /* no white space */
+                       optarg = place;
+               else if (oli[1] != ':') {       /* arg not optional */
+                       if (++optind >= nargc) {        /* no arg */
+                               place = EMSG;
+                               if (PRINT_ERROR)
+                                       fprintf(stderr, recargchar, optchar);
+                               optopt = optchar;
+                               return (BADARG);
+                       } else
+                               optarg = nargv[optind];
+               }
+               place = EMSG;
+               ++optind;
+       }
+       /* dump back option letter */
+       return (optchar);
+}
+
+/*
+ * getopt --
+ *     Parse argc/argv argument vector.
+ *
+ * [eventually this will replace the BSD getopt]
+ */
+int
+getopt(int nargc, char * const *nargv, const char *options)
+{
+
+       /*
+        * We don't pass FLAG_PERMUTE to getopt_internal() since
+        * the BSD getopt(3) (unlike GNU) has never done this.
+        *
+        * Furthermore, since many privileged programs call getopt()
+        * before dropping privileges it makes sense to keep things
+        * as simple (and bug-free) as possible.
+        */
+       return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
+}
+
+/*
+ * getopt_long --
+ *     Parse argc/argv argument vector.
+ */
+int
+getopt_long(int nargc, char * const *nargv, const char *options,
+    const struct option *long_options, int *idx)
+{
+
+       return (getopt_internal(nargc, nargv, options, long_options, idx,
+           FLAG_PERMUTE));
+}
+
+/*
+ * getopt_long_only --
+ *     Parse argc/argv argument vector.
+ */
+int
+getopt_long_only(int nargc, char * const *nargv, const char *options,
+    const struct option *long_options, int *idx)
+{
+
+       return (getopt_internal(nargc, nargv, options, long_options, idx,
+           FLAG_PERMUTE|FLAG_LONGONLY));
+}
index 4c212313e45e2b0165e0b68978d3017f11fe6d7b..162ed42be1fb4e530ab692ea6b165d54b95ddcf0 100644 (file)
@@ -1,2 +1,3 @@
 glsl_compiler
 glsl_parser.output
+builtin_function.cpp
index f5aadc347bd5e20f86ef92521a32a82a4a405b77..c9525446633aa9a02ad6964add8279e359f74c67 100644 (file)
@@ -16,6 +16,7 @@ GLCPP_SOURCES = \
        glcpp/glcpp.c
 
 C_SOURCES = \
+       strtod.c \
        $(LIBGLCPP_SOURCES)
 
 CXX_SOURCES = \
@@ -23,7 +24,6 @@ CXX_SOURCES = \
        ast_function.cpp \
        ast_to_hir.cpp \
        ast_type.cpp \
-       builtin_function.cpp \
        glsl_lexer.cpp \
        glsl_parser.cpp \
        glsl_parser_extras.cpp \
@@ -52,6 +52,7 @@ CXX_SOURCES = \
        loop_analysis.cpp \
        loop_controls.cpp \
        loop_unroll.cpp \
+       lower_discard.cpp \
        lower_if_to_cond_assign.cpp \
        lower_instructions.cpp \
        lower_jumps.cpp \
@@ -70,6 +71,7 @@ CXX_SOURCES = \
        opt_dead_code.cpp \
        opt_dead_code_local.cpp \
        opt_dead_functions.cpp \
+       opt_discard_simplification.cpp \
        opt_function_inlining.cpp \
        opt_if_simplification.cpp \
        opt_noop_swizzle.cpp \
@@ -127,8 +129,8 @@ ALL_SOURCES = \
 
 default: depend lib$(LIBNAME).a $(APPS)
 
-lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template
-       $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS)
+lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template
+       $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o
 
 depend: $(ALL_SOURCES) Makefile
        rm -f depend
@@ -137,7 +139,7 @@ depend: $(ALL_SOURCES) Makefile
 
 # Remove .o and backup files
 clean:
-       rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak
+       rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak builtin_function.cpp builtin_function.o builtin_stubs.o builtin_compiler
        -rm -f $(APPS)
 
 # Dummy target
@@ -171,13 +173,11 @@ glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
 glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
        bison -v -o "$@" --defines=glcpp/glcpp-parse.h $<
 
-builtins: builtin_function.cpp builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py
-       @echo Bootstrapping the compiler...
-       cp builtins/tools/builtin_function.cpp .
-       make glsl_compiler
+builtin_compiler: $(GLSL2_OBJECTS) $(OBJECTS) builtin_stubs.o
+       $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(GLSL2_OBJECTS) builtin_stubs.o $(TALLOC_LIBS) -o $@
+
+builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler
        @echo Regenerating builtin_function.cpp...
-       $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py > builtin_function.cpp
-       @echo Rebuilding the real compiler...
-       make glsl_compiler
+       $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py $(PWD)/builtin_compiler > builtin_function.cpp
 
 -include depend
index fd22f668631f4bef7a32d29cf7e876881832a232..88a83fdb6fa0c37649d2c5a3cf523c1bdf14e4e0 100644 (file)
@@ -2,11 +2,14 @@ import common
 
 Import('*')
 
+from sys import executable as python_cmd
+
 env = env.Clone()
 
 env.Prepend(CPPPATH = [
     '#src/mapi',
     '#src/mesa',
+    '#src/glsl',
 ])
 
 if env['platform'] == 'windows':
@@ -20,7 +23,6 @@ sources = [
     'ast_function.cpp',
     'ast_to_hir.cpp',
     'ast_type.cpp',
-    'builtin_function.cpp',
     'glsl_lexer.cpp',
     'glsl_parser.cpp',
     'glsl_parser_extras.cpp',
@@ -49,6 +51,7 @@ sources = [
     'loop_analysis.cpp',
     'loop_controls.cpp',
     'loop_unroll.cpp',
+    'lower_discard.cpp',
     'lower_if_to_cond_assign.cpp',
     'lower_instructions.cpp',
     'lower_jumps.cpp',
@@ -66,6 +69,7 @@ sources = [
     'opt_dead_code.cpp',
     'opt_dead_code_local.cpp',
     'opt_dead_functions.cpp',
+    'opt_discard_simplification.cpp',
     'opt_function_inlining.cpp',
     'opt_if_simplification.cpp',
     'opt_noop_swizzle.cpp',
@@ -74,7 +78,51 @@ sources = [
     'opt_swizzle_swizzle.cpp',
     'opt_tree_grafting.cpp',
     's_expression.cpp',
-]
+    'strtod.c',
+] 
+
+
+if env['platform'] == common.host_platform:
+    if env['msvc']:
+        env.Prepend(CPPPATH = ['#/src/getopt'])
+        env.PrependUnique(LIBS = [getopt])
+
+    if env['platform'] == 'windows':
+        env.Prepend(CPPPATH = ['#src/talloc'])
+        env.Prepend(LIBS = [talloc])
+    else:
+        env.Prepend(LIBS = ['talloc'])
+
+    builtin_compiler = env.Program(
+        target = 'builtin_compiler',
+        source = sources + ['main.cpp', 'builtin_stubs.cpp',
+                            '#src/mesa/program/hash_table.c',
+                            '#src/mesa/program/symbol_table.c'],
+    )
+
+    builtin_glsl_function = env.CodeGenerate(
+        target = 'builtin_function.cpp',
+        script = 'builtins/tools/generate_builtins.py',
+        source = builtin_compiler,
+        command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
+    )
+
+    env.Depends(builtin_glsl_function, ['builtins/tools/generate_builtins.py', 'builtins/tools/texture_builtins.py'] + Glob('builtins/ir/*'))
+
+    if env['msvc']:
+        # There is no LD_LIBRARY_PATH equivalent on Windows. We need to ensure
+        # talloc.dll is on the same dir as builtin_function.
+        talloc_dll_src = talloc.dir.File('talloc.dll')
+        talloc_dll_dst = builtin_compiler[0].dir.File('talloc.dll')
+        talloc_dll = env.Command(talloc_dll_dst, talloc_dll_src, Copy(talloc_dll_dst, talloc_dll_src))
+        env.Depends('builtin_function.cpp', talloc_dll)
+
+    Export('builtin_glsl_function')
+
+    if common.cross_compiling:
+        Return()
+
+sources += builtin_glsl_function
 
 glsl = env.ConvenienceLibrary(
     target = 'glsl',
index e5aa5c1b3b5925207702eff31edca7b68c5f2b6c..cd933cfc58850cd221633d474098707e2af2c294 100644 (file)
@@ -349,7 +349,11 @@ struct ast_type_qualifier {
          * qualifier is used.
          */
         unsigned explicit_location:1;
-      } q;
+      }
+      /** \brief Set of flags, accessed by name. */
+      q;
+
+      /** \brief Set of flags, accessed as a bitmask. */
       unsigned i;
    } flags;
 
@@ -714,4 +718,8 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
                                 exec_list *instructions,
                                 struct _mesa_glsl_parse_state *state);
 
+void
+emit_function(_mesa_glsl_parse_state *state, exec_list *instructions,
+             ir_function *f);
+
 #endif /* AST_H */
index 1e66033348c87191a54de7c8201eb396e5a9d08b..6ecf779c935abaf7a8ef7741f7ae5387f30b6a59 100644 (file)
@@ -93,13 +93,40 @@ prototype_string(const glsl_type *return_type, const char *name,
 
 
 static ir_rvalue *
-process_call(exec_list *instructions, ir_function *f,
-            YYLTYPE *loc, exec_list *actual_parameters,
-            struct _mesa_glsl_parse_state *state)
+match_function_by_name(exec_list *instructions, const char *name,
+                      YYLTYPE *loc, exec_list *actual_parameters,
+                      struct _mesa_glsl_parse_state *state)
 {
    void *ctx = state;
+   ir_function *f = state->symbols->get_function(name);
+   ir_function_signature *sig;
+
+   sig = f ? f->matching_signature(actual_parameters) : NULL;
+
+   /* FINISHME: This doesn't handle the case where shader X contains a
+    * FINISHME: matching signature but shader X + N contains an _exact_
+    * FINISHME: matching signature.
+    */
+   if (sig == NULL && (f == NULL || state->es_shader || !f->has_user_signature()) && state->symbols->get_type(name) == NULL && (state->language_version == 110 || state->symbols->get_variable(name) == NULL)) {
+      /* The current shader doesn't contain a matching function or signature.
+       * Before giving up, look for the prototype in the built-in functions.
+       */
+      for (unsigned i = 0; i < state->num_builtins_to_link; i++) {
+        ir_function *builtin;
+        builtin = state->builtins_to_link[i]->symbols->get_function(name);
+        sig = builtin ? builtin->matching_signature(actual_parameters) : NULL;
+        if (sig != NULL) {
+           if (f == NULL) {
+              f = new(ctx) ir_function(name);
+              state->symbols->add_global_function(f);
+              emit_function(state, instructions, f);
+           }
 
-   ir_function_signature *sig = f->matching_signature(actual_parameters);
+           f->add_signature(sig->clone_prototype(f, NULL));
+           break;
+        }
+      }
+   }
 
    if (sig != NULL) {
       /* Verify that 'out' and 'inout' actual parameters are lvalues.  This
@@ -164,45 +191,35 @@ process_call(exec_list *instructions, ir_function *f,
         return NULL;
       }
    } else {
-      char *str = prototype_string(NULL, f->name, actual_parameters);
+      char *str = prototype_string(NULL, name, actual_parameters);
 
       _mesa_glsl_error(loc, state, "no matching function for call to `%s'",
                       str);
       talloc_free(str);
 
       const char *prefix = "candidates are: ";
-      foreach_list (node, &f->signatures) {
-        ir_function_signature *sig = (ir_function_signature *) node;
 
-        str = prototype_string(sig->return_type, f->name, &sig->parameters);
-        _mesa_glsl_error(loc, state, "%s%s\n", prefix, str);
-        talloc_free(str);
+      for (int i = -1; i < state->num_builtins_to_link; i++) {
+        glsl_symbol_table *syms = i >= 0 ? state->builtins_to_link[i]->symbols
+                                         : state->symbols;
+        f = syms->get_function(name);
+        if (f == NULL)
+           continue;
 
-        prefix = "                ";
-      }
+        foreach_list (node, &f->signatures) {
+           ir_function_signature *sig = (ir_function_signature *) node;
 
-      return ir_call::get_error_instruction(ctx);
-   }
-}
+           str = prototype_string(sig->return_type, f->name, &sig->parameters);
+           _mesa_glsl_error(loc, state, "%s%s\n", prefix, str);
+           talloc_free(str);
 
+           prefix = "                ";
+        }
 
-static ir_rvalue *
-match_function_by_name(exec_list *instructions, const char *name,
-                      YYLTYPE *loc, exec_list *actual_parameters,
-                      struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   ir_function *f = state->symbols->get_function(name);
+      }
 
-   if (f == NULL) {
-      _mesa_glsl_error(loc, state, "function `%s' undeclared", name);
       return ir_call::get_error_instruction(ctx);
    }
-
-   /* Once we've determined that the function being called might exist, try
-    * to find an overload of the function that matches the parameters.
-    */
-   return process_call(instructions, f, loc, actual_parameters, state);
 }
 
 
index d615b30e7daf23c0b75c8e1f811e8a3b2d89feec..365a6e2676fd225200ab9c2a35d0511baa2881ac 100644 (file)
@@ -60,7 +60,7 @@ void
 _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
 {
    _mesa_glsl_initialize_variables(instructions, state);
-   _mesa_glsl_initialize_functions(instructions, state);
+   _mesa_glsl_initialize_functions(state);
 
    state->symbols->language_version = state->language_version;
 
@@ -598,17 +598,15 @@ ir_rvalue *
 validate_assignment(struct _mesa_glsl_parse_state *state,
                    const glsl_type *lhs_type, ir_rvalue *rhs)
 {
-   const glsl_type *rhs_type = rhs->type;
-
    /* If there is already some error in the RHS, just return it.  Anything
     * else will lead to an avalanche of error message back to the user.
     */
-   if (rhs_type->is_error())
+   if (rhs->type->is_error())
       return rhs;
 
    /* If the types are identical, the assignment can trivially proceed.
     */
-   if (rhs_type == lhs_type)
+   if (rhs->type == lhs_type)
       return rhs;
 
    /* If the array element types are the same and the size of the LHS is zero,
@@ -625,8 +623,7 @@ validate_assignment(struct _mesa_glsl_parse_state *state,
 
    /* Check for implicit conversion in GLSL 1.20 */
    if (apply_implicit_conversion(lhs_type, rhs, state)) {
-      rhs_type = rhs->type;
-      if (rhs_type == lhs_type)
+      if (rhs->type == lhs_type)
         return rhs;
    }
 
@@ -745,6 +742,94 @@ ast_node::hir(exec_list *instructions,
    return NULL;
 }
 
+static void
+mark_whole_array_access(ir_rvalue *access)
+{
+   ir_dereference_variable *deref = access->as_dereference_variable();
+
+   if (deref) {
+      deref->var->max_array_access = deref->type->length - 1;
+   }
+}
+
+static ir_rvalue *
+do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
+{
+   int join_op;
+   ir_rvalue *cmp = NULL;
+
+   if (operation == ir_binop_all_equal)
+      join_op = ir_binop_logic_and;
+   else
+      join_op = ir_binop_logic_or;
+
+   switch (op0->type->base_type) {
+   case GLSL_TYPE_FLOAT:
+   case GLSL_TYPE_UINT:
+   case GLSL_TYPE_INT:
+   case GLSL_TYPE_BOOL:
+      return new(mem_ctx) ir_expression(operation, op0, op1);
+
+   case GLSL_TYPE_ARRAY: {
+      for (unsigned int i = 0; i < op0->type->length; i++) {
+        ir_rvalue *e0, *e1, *result;
+
+        e0 = new(mem_ctx) ir_dereference_array(op0->clone(mem_ctx, NULL),
+                                               new(mem_ctx) ir_constant(i));
+        e1 = new(mem_ctx) ir_dereference_array(op1->clone(mem_ctx, NULL),
+                                               new(mem_ctx) ir_constant(i));
+        result = do_comparison(mem_ctx, operation, e0, e1);
+
+        if (cmp) {
+           cmp = new(mem_ctx) ir_expression(join_op, cmp, result);
+        } else {
+           cmp = result;
+        }
+      }
+
+      mark_whole_array_access(op0);
+      mark_whole_array_access(op1);
+      break;
+   }
+
+   case GLSL_TYPE_STRUCT: {
+      for (unsigned int i = 0; i < op0->type->length; i++) {
+        ir_rvalue *e0, *e1, *result;
+        const char *field_name = op0->type->fields.structure[i].name;
+
+        e0 = new(mem_ctx) ir_dereference_record(op0->clone(mem_ctx, NULL),
+                                                field_name);
+        e1 = new(mem_ctx) ir_dereference_record(op1->clone(mem_ctx, NULL),
+                                                field_name);
+        result = do_comparison(mem_ctx, operation, e0, e1);
+
+        if (cmp) {
+           cmp = new(mem_ctx) ir_expression(join_op, cmp, result);
+        } else {
+           cmp = result;
+        }
+      }
+      break;
+   }
+
+   case GLSL_TYPE_ERROR:
+   case GLSL_TYPE_VOID:
+   case GLSL_TYPE_SAMPLER:
+      /* I assume a comparison of a struct containing a sampler just
+       * ignores the sampler present in the type.
+       */
+      break;
+
+   default:
+      assert(!"Should not get here.");
+      break;
+   }
+
+   if (cmp == NULL)
+      cmp = new(mem_ctx) ir_constant(true);
+
+   return cmp;
+}
 
 ir_rvalue *
 ast_expression::hir(exec_list *instructions,
@@ -941,11 +1026,10 @@ ast_expression::hir(exec_list *instructions,
         error_emitted = true;
       }
 
-      result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
-                                     op[0], op[1]);
+      result = do_comparison(ctx, operations[this->oper], op[0], op[1]);
       type = glsl_type::bool_type;
 
-      assert(result->type == glsl_type::bool_type);
+      assert(error_emitted || (result->type == glsl_type::bool_type));
       break;
 
    case ast_bit_and:
@@ -1480,6 +1564,40 @@ ast_expression::hir(exec_list *instructions,
         }
       }
 
+      /* From page 23 (29 of the PDF) of the GLSL 1.30 spec:
+       *
+       *    "Samplers aggregated into arrays within a shader (using square
+       *    brackets [ ]) can only be indexed with integral constant
+       *    expressions [...]."
+       *
+       * This restriction was added in GLSL 1.30.  Shaders using earlier version
+       * of the language should not be rejected by the compiler front-end for
+       * using this construct.  This allows useful things such as using a loop
+       * counter as the index to an array of samplers.  If the loop in unrolled,
+       * the code should compile correctly.  Instead, emit a warning.
+       */
+      if (array->type->is_array() &&
+          array->type->element_type()->is_sampler() &&
+          const_index == NULL) {
+
+        if (state->language_version == 100) {
+           _mesa_glsl_warning(&loc, state,
+                              "sampler arrays indexed with non-constant "
+                              "expressions is optional in GLSL ES 1.00");
+        } else if (state->language_version < 130) {
+           _mesa_glsl_warning(&loc, state,
+                              "sampler arrays indexed with non-constant "
+                              "expressions is forbidden in GLSL 1.30 and "
+                              "later");
+        } else {
+           _mesa_glsl_error(&loc, state,
+                            "sampler arrays indexed with non-constant "
+                            "expressions is forbidden in GLSL 1.30 and "
+                            "later");
+           error_emitted = true;
+        }
+      }
+
       if (error_emitted)
         result->type = glsl_type::error_type;
 
@@ -1505,6 +1623,7 @@ ast_expression::hir(exec_list *instructions,
       result = new(ctx) ir_dereference_variable(var);
 
       if (var != NULL) {
+        var->used = true;
         type = result->type;
       } else {
         _mesa_glsl_error(& loc, state, "`%s' undeclared",
@@ -1679,8 +1798,16 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
                                 struct _mesa_glsl_parse_state *state,
                                 YYLTYPE *loc)
 {
-   if (qual->flags.q.invariant)
-      var->invariant = 1;
+   if (qual->flags.q.invariant) {
+      if (var->used) {
+        _mesa_glsl_error(loc, state,
+                         "variable `%s' may not be redeclared "
+                         "`invariant' after being used",
+                         var->name);
+      } else {
+        var->invariant = 1;
+      }
+   }
 
    /* FINISHME: Mark 'in' variables at global scope as read-only. */
    if (qual->flags.q.constant || qual->flags.q.attribute
@@ -1734,6 +1861,23 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
    else if (qual->flags.q.uniform)
       var->mode = ir_var_uniform;
 
+   if (state->all_invariant && (state->current_function == NULL)) {
+      switch (state->target) {
+      case vertex_shader:
+        if (var->mode == ir_var_out)
+           var->invariant = true;
+        break;
+      case geometry_shader:
+        if ((var->mode == ir_var_in) || (var->mode == ir_var_out))
+           var->invariant = true;
+        break;
+      case fragment_shader:
+        if (var->mode == ir_var_in)
+           var->invariant = true;
+        break;
+      }
+   }
+
    if (qual->flags.q.flat)
       var->interpolation = ir_var_flat;
    else if (qual->flags.q.noperspective)
@@ -1813,6 +1957,52 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
       }
    }
 
+   /* Does the declaration use the 'layout' keyword?
+    */
+   const bool uses_layout = qual->flags.q.pixel_center_integer
+      || qual->flags.q.origin_upper_left
+      || qual->flags.q.explicit_location;
+
+   /* Does the declaration use the deprecated 'attribute' or 'varying'
+    * keywords?
+    */
+   const bool uses_deprecated_qualifier = qual->flags.q.attribute
+      || qual->flags.q.varying;
+
+   /* Is the 'layout' keyword used with parameters that allow relaxed checking.
+    * Many implementations of GL_ARB_fragment_coord_conventions_enable and some
+    * implementations (only Mesa?) GL_ARB_explicit_attrib_location_enable
+    * allowed the layout qualifier to be used with 'varying' and 'attribute'.
+    * These extensions and all following extensions that add the 'layout'
+    * keyword have been modified to require the use of 'in' or 'out'.
+    *
+    * The following extension do not allow the deprecated keywords:
+    *
+    *    GL_AMD_conservative_depth
+    *    GL_ARB_gpu_shader5
+    *    GL_ARB_separate_shader_objects
+    *    GL_ARB_tesselation_shader
+    *    GL_ARB_transform_feedback3
+    *    GL_ARB_uniform_buffer_object
+    *
+    * It is unknown whether GL_EXT_shader_image_load_store or GL_NV_gpu_shader5
+    * allow layout with the deprecated keywords.
+    */
+   const bool relaxed_layout_qualifier_checking =
+      state->ARB_fragment_coord_conventions_enable;
+
+   if (uses_layout && uses_deprecated_qualifier) {
+      if (relaxed_layout_qualifier_checking) {
+        _mesa_glsl_warning(loc, state,
+                           "`layout' qualifier may not be used with "
+                           "`attribute' or `varying'");
+      } else {
+        _mesa_glsl_error(loc, state,
+                         "`layout' qualifier may not be used with "
+                         "`attribute' or `varying'");
+      }
+   }
+
    if (var->type->is_array() && state->language_version != 110) {
       var->array_lvalue = true;
    }
@@ -1870,6 +2060,11 @@ ast_declarator_list::hir(exec_list *instructions,
            _mesa_glsl_error(& loc, state,
                             "`%s' cannot be marked invariant, fragment shader "
                             "inputs only\n", decl->identifier);
+        } else if (earlier->used) {
+           _mesa_glsl_error(& loc, state,
+                            "variable `%s' may not be redeclared "
+                            "`invariant' after being used",
+                            earlier->name);
         } else {
            earlier->invariant = true;
         }
@@ -1939,20 +2134,23 @@ ast_declarator_list::hir(exec_list *instructions,
        *
        *     Local variables can only use the qualifier const."
        *
-       * This is relaxed in GLSL 1.30.
+       * This is relaxed in GLSL 1.30.  It is also relaxed by any extension
+       * that adds the 'layout' keyword.
        */
-      if (state->language_version < 120) {
+      if ((state->language_version < 130)
+         && !state->ARB_explicit_attrib_location_enable
+         && !state->ARB_fragment_coord_conventions_enable) {
         if (this->type->qualifier.flags.q.out) {
            _mesa_glsl_error(& loc, state,
                             "`out' qualifier in declaration of `%s' "
-                            "only valid for function parameters in GLSL 1.10.",
-                            decl->identifier);
+                            "only valid for function parameters in %s.",
+                            decl->identifier, state->version_string);
         }
         if (this->type->qualifier.flags.q.in) {
            _mesa_glsl_error(& loc, state,
                             "`in' qualifier in declaration of `%s' "
-                            "only valid for function parameters in GLSL 1.10.",
-                            decl->identifier);
+                            "only valid for function parameters in %s.",
+                            decl->identifier, state->version_string);
         }
         /* FINISHME: Test for other invalid qualifiers. */
       }
@@ -2060,6 +2258,25 @@ ast_declarator_list::hir(exec_list *instructions,
         }
       }
 
+      /* Integer vertex outputs must be qualified with 'flat'.
+       *
+       * From section 4.3.6 of the GLSL 1.30 spec:
+       *    "If a vertex output is a signed or unsigned integer or integer
+       *    vector, then it must be qualified with the interpolation qualifier
+       *    flat."
+       */
+      if (state->language_version >= 130
+          && state->target == vertex_shader
+          && state->current_function == NULL
+          && var->type->is_integer()
+          && var->mode == ir_var_out
+          && var->interpolation != ir_var_flat) {
+
+         _mesa_glsl_error(&loc, state, "If a vertex output is an integer, "
+                          "then it must be qualified with 'flat'");
+      }
+
+
       /* Process the initializer and add its instructions to a temporary
        * list.  This list will be added to the instruction stream (below) after
        * the declaration is added.  This is done because in some cases (such as
@@ -2143,10 +2360,37 @@ ast_declarator_list::hir(exec_list *instructions,
 
            /* Never emit code to initialize a uniform.
             */
-           if (!this->type->qualifier.flags.q.uniform)
+           const glsl_type *initializer_type;
+           if (!this->type->qualifier.flags.q.uniform) {
               result = do_assignment(&initializer_instructions, state,
                                      lhs, rhs,
                                      this->get_location());
+              initializer_type = result->type;
+           } else
+              initializer_type = rhs->type;
+
+           /* If the declared variable is an unsized array, it must inherrit
+            * its full type from the initializer.  A declaration such as
+            *
+            *     uniform float a[] = float[](1.0, 2.0, 3.0, 3.0);
+            *
+            * becomes
+            *
+            *     uniform float a[4] = float[](1.0, 2.0, 3.0, 3.0);
+            *
+            * The assignment generated in the if-statement (below) will also
+            * automatically handle this case for non-uniforms.
+            *
+            * If the declared variable is not an array, the types must
+            * already match exactly.  As a result, the type assignment
+            * here can be done unconditionally.  For non-uniforms the call
+            * to do_assignment can change the type of the initializer (via
+            * the implicit conversion rules).  For uniforms the initializer
+            * must be a constant expression, and the type of that expression
+            * was validated above.
+            */
+           var->type = initializer_type;
+
            var->read_only = temp;
         }
       }
@@ -2219,6 +2463,27 @@ ast_declarator_list::hir(exec_list *instructions,
             */
            earlier->origin_upper_left = var->origin_upper_left;
            earlier->pixel_center_integer = var->pixel_center_integer;
+
+        /* According to section 4.3.7 of the GLSL 1.30 spec,
+         * the following built-in varaibles can be redeclared with an
+         * interpolation qualifier:
+         *    * gl_FrontColor
+         *    * gl_BackColor
+         *    * gl_FrontSecondaryColor
+         *    * gl_BackSecondaryColor
+         *    * gl_Color
+         *    * gl_SecondaryColor
+         */
+        } else if (state->language_version >= 130
+                   && (strcmp(var->name, "gl_FrontColor") == 0
+                        || strcmp(var->name, "gl_BackColor") == 0
+                        || strcmp(var->name, "gl_FrontSecondaryColor") == 0
+                        || strcmp(var->name, "gl_BackSecondaryColor") == 0
+                        || strcmp(var->name, "gl_Color") == 0
+                        || strcmp(var->name, "gl_SecondaryColor") == 0)
+                   && earlier->type == var->type
+                   && earlier->mode == var->mode) {
+           earlier->interpolation = var->interpolation;
         } else {
            YYLTYPE loc = this->get_location();
            _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier);
@@ -2253,7 +2518,7 @@ ast_declarator_list::hir(exec_list *instructions,
        *     after the initializer if present or immediately after the name
        *     being declared if not."
        */
-      if (!state->symbols->add_variable(var->name, var)) {
+      if (!state->symbols->add_variable(var)) {
         YYLTYPE loc = this->get_location();
         _mesa_glsl_error(&loc, state, "name `%s' already taken in the "
                          "current scope", decl->identifier);
@@ -2393,6 +2658,27 @@ ast_parameter_declarator::parameters_to_hir(exec_list *ast_parameters,
 }
 
 
+void
+emit_function(_mesa_glsl_parse_state *state, exec_list *instructions,
+             ir_function *f)
+{
+   /* Emit the new function header */
+   if (state->current_function == NULL) {
+      instructions->push_tail(f);
+   } else {
+      /* IR invariants disallow function declarations or definitions nested
+       * within other function definitions.  Insert the new ir_function
+       * block in the instruction sequence before the ir_function block
+       * containing the current ir_function_signature.
+       */
+      ir_function *const curr =
+        const_cast<ir_function *>(state->current_function->function());
+
+      curr->insert_before(f);
+   }
+}
+
+
 ir_rvalue *
 ast_function::hir(exec_list *instructions,
                  struct _mesa_glsl_parse_state *state)
@@ -2495,7 +2781,7 @@ ast_function::hir(exec_list *instructions,
       }
    } else {
       f = new(ctx) ir_function(name);
-      if (!state->symbols->add_function(f->name, f)) {
+      if (!state->symbols->add_function(f)) {
         /* This function name shadows a non-function use of the same name. */
         YYLTYPE loc = this->get_location();
 
@@ -2504,24 +2790,7 @@ ast_function::hir(exec_list *instructions,
         return NULL;
       }
 
-      /* Emit the new function header */
-      if (state->current_function == NULL)
-        instructions->push_tail(f);
-      else {
-        /* IR invariants disallow function declarations or definitions nested
-         * within other function definitions.  Insert the new ir_function
-         * block in the instruction sequence before the ir_function block
-         * containing the current ir_function_signature.
-         *
-         * This can only happen in a GLSL 1.10 shader.  In all other GLSL
-         * versions this nesting is disallowed.  There is a check for this at
-         * the top of this function.
-         */
-        ir_function *const curr =
-           const_cast<ir_function *>(state->current_function->function());
-
-        curr->insert_before(f);
-      }
+      emit_function(state, instructions, f);
    }
 
    /* Verify the return type of main() */
@@ -2587,7 +2856,7 @@ ast_function_definition::hir(exec_list *instructions,
 
         _mesa_glsl_error(& loc, state, "parameter `%s' redeclared", var->name);
       } else {
-        state->symbols->add_variable(var->name, var);
+        state->symbols->add_variable(var);
       }
    }
 
diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
deleted file mode 100644 (file)
index bc36814..0000000
+++ /dev/null
@@ -1,13693 +0,0 @@
-/* DO NOT MODIFY - automatically generated by generate_builtins.py */
-/*
- * Copyright Â© 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include "main/core.h" /* for struct gl_shader */
-#include "glsl_parser_extras.h"
-#include "ir_reader.h"
-#include "program.h"
-#include "ast.h"
-
-extern "C" struct gl_shader *
-_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
-
-gl_shader *
-read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
-{
-   struct gl_context fakeCtx;
-   fakeCtx.API = API_OPENGL;
-   gl_shader *sh = _mesa_new_shader(NULL, 0, target);
-   struct _mesa_glsl_parse_state *st =
-      new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
-
-   st->language_version = 130;
-   st->symbols->language_version = 130;
-   st->ARB_texture_rectangle_enable = true;
-   st->EXT_texture_array_enable = true;
-   _mesa_glsl_initialize_types(st);
-
-   sh->ir = new(sh) exec_list;
-   sh->symbols = st->symbols;
-
-   /* Read the IR containing the prototypes */
-   _mesa_glsl_read_ir(st, sh->ir, protos, true);
-
-   /* Read ALL the function bodies, telling the IR reader not to scan for
-    * prototypes (we've already created them).  The IR reader will skip any
-    * signature that does not already exist as a prototype.
-    */
-   for (unsigned i = 0; i < count; i++) {
-      _mesa_glsl_read_ir(st, sh->ir, functions[i], false);
-
-      if (st->error) {
-         printf("error reading builtin: %.35s ...\n", functions[i]);
-         printf("Info log:\n%s\n", st->info_log);
-         talloc_free(sh);
-         return NULL;
-      }
-   }
-
-   reparent_ir(sh->ir, sh);
-   delete st;
-
-   return sh;
-}
-
-static const char builtin_abs[] =
-   "((function abs\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float abs (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 abs (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 abs (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 abs (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_acos[] =
-   "((function acos\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float - (constant float (1.5707963))\n"
-   "                                  (call asin ((var_ref x)))))))\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 - (constant float (1.5707963))\n"
-   "                                 (call asin ((var_ref x)))))))\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 - (constant float (1.5707963))\n"
-   "                                 (call asin ((var_ref x)))))))\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 - (constant float (1.5707963))\n"
-   "                                 (call asin ((var_ref x)))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_acosh[] =
-   "((function acosh\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float log (expression float + (var_ref x) (expression float sqrt (expression float - (expression float * (var_ref x) (var_ref x)) (constant float (1)))))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 log (expression vec2 + (var_ref x) (expression vec2 sqrt (expression vec2 - (expression vec2 * (var_ref x) (var_ref x)) (constant vec2 (1)))))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 log (expression vec3 + (var_ref x) (expression vec3 sqrt (expression vec3 - (expression vec3 * (var_ref x) (var_ref x)) (constant vec3 (1)))))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 log (expression vec4 + (var_ref x) (expression vec4 sqrt (expression vec4 - (expression vec4 * (var_ref x) (var_ref x)) (constant vec4 (1)))))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_all[] =
-   "((function all\n"
-   "   (signature bool\n"
-   "     (parameters\n"
-   "       (declare (in) bvec2 arg0))\n"
-   "     ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n"
-   "\n"
-   "   (signature bool\n"
-   "     (parameters\n"
-   "       (declare (in) bvec3 arg0))\n"
-   "     ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n"
-   "\n"
-   "   (signature bool\n"
-   "     (parameters\n"
-   "       (declare (in) bvec4 arg0))\n"
-   "     ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_any[] =
-   "((function any\n"
-   "   (signature bool\n"
-   "     (parameters\n"
-   "       (declare (in) bvec2 arg0))\n"
-   "     ((return (expression bool any (var_ref arg0)))))\n"
-   "\n"
-   "   (signature bool\n"
-   "     (parameters\n"
-   "       (declare (in) bvec3 arg0))\n"
-   "     ((return (expression bool any (var_ref arg0)))))\n"
-   "\n"
-   "   (signature bool\n"
-   "     (parameters\n"
-   "       (declare (in) bvec4 arg0))\n"
-   "     ((return (expression bool any (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_asin[] =
-   "((function asin\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float *\n"
-   "          (expression float sign (var_ref x))\n"
-   "          (expression float -\n"
-   "           (expression float *\n"
-   "            (constant float (3.1415926))\n"
-   "            (constant float (0.5)))\n"
-   "           (expression float *\n"
-   "            (expression float sqrt\n"
-   "             (expression float -\n"
-   "              (constant float (1.0))\n"
-   "              (expression float abs (var_ref x))))\n"
-   "            (expression float +\n"
-   "             (constant float (1.5707288))\n"
-   "             (expression float *\n"
-   "              (expression float abs (var_ref x))\n"
-   "              (expression float +\n"
-   "               (constant float (-0.2121144))\n"
-   "               (expression float *\n"
-   "                (constant float (0.0742610))\n"
-   "                (expression float abs (var_ref x))))))))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 *\n"
-   "          (expression vec2 sign (var_ref x))\n"
-   "          (expression vec2 -\n"
-   "           (expression float *\n"
-   "            (constant float (3.1415926))\n"
-   "            (constant float (0.5)))\n"
-   "           (expression vec2 *\n"
-   "            (expression vec2 sqrt\n"
-   "             (expression vec2 -\n"
-   "              (constant float (1.0))\n"
-   "              (expression vec2 abs (var_ref x))))\n"
-   "            (expression vec2 +\n"
-   "             (constant float (1.5707288))\n"
-   "             (expression vec2 *\n"
-   "              (expression vec2 abs (var_ref x))\n"
-   "              (expression vec2 +\n"
-   "               (constant float (-0.2121144))\n"
-   "               (expression vec2 *\n"
-   "                (constant float (0.0742610))\n"
-   "                (expression vec2 abs (var_ref x))))))))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 *\n"
-   "          (expression vec3 sign (var_ref x))\n"
-   "          (expression vec3 -\n"
-   "           (expression float *\n"
-   "            (constant float (3.1415926))\n"
-   "            (constant float (0.5)))\n"
-   "           (expression vec3 *\n"
-   "            (expression vec3 sqrt\n"
-   "             (expression vec3 -\n"
-   "              (constant float (1.0))\n"
-   "              (expression vec3 abs (var_ref x))))\n"
-   "            (expression vec3 +\n"
-   "             (constant float (1.5707288))\n"
-   "             (expression vec3 *\n"
-   "              (expression vec3 abs (var_ref x))\n"
-   "              (expression vec3 +\n"
-   "               (constant float (-0.2121144))\n"
-   "               (expression vec3 *\n"
-   "                (constant float (0.0742610))\n"
-   "                (expression vec3 abs (var_ref x))))))))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 *\n"
-   "          (expression vec4 sign (var_ref x))\n"
-   "          (expression vec4 -\n"
-   "           (expression float *\n"
-   "            (constant float (3.1415926))\n"
-   "            (constant float (0.5)))\n"
-   "           (expression vec4 *\n"
-   "            (expression vec4 sqrt\n"
-   "             (expression vec4 -\n"
-   "              (constant float (1.0))\n"
-   "              (expression vec4 abs (var_ref x))))\n"
-   "            (expression vec4 +\n"
-   "             (constant float (1.5707288))\n"
-   "             (expression vec4 *\n"
-   "              (expression vec4 abs (var_ref x))\n"
-   "              (expression vec4 +\n"
-   "               (constant float (-0.2121144))\n"
-   "               (expression vec4 *\n"
-   "                (constant float (0.0742610))\n"
-   "                (expression vec4 abs (var_ref x))))))))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_asinh[] =
-   "((function asinh\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float log (expression float + (var_ref x) (expression float sqrt (expression float + (expression float * (var_ref x) (var_ref x)) (constant float (1)))))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 log (expression vec2 + (var_ref x) (expression vec2 sqrt (expression vec2 + (expression vec2 * (var_ref x) (var_ref x)) (constant vec2 (1)))))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 log (expression vec3 + (var_ref x) (expression vec3 sqrt (expression vec3 + (expression vec3 * (var_ref x) (var_ref x)) (constant vec3 (1)))))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 log (expression vec4 + (var_ref x) (expression vec4 sqrt (expression vec4 + (expression vec4 * (var_ref x) (var_ref x)) (constant vec4 (1)))))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_atan[] =
-   "((function atan\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float y_over_x))\n"
-   "     ((return (call asin ((expression float *\n"
-   "                      (var_ref y_over_x)\n"
-   "                      (expression float rsq\n"
-   "                       (expression float +\n"
-   "                        (expression float *\n"
-   "                         (var_ref y_over_x)\n"
-   "                         (var_ref y_over_x))\n"
-   "                        (constant float (1.0))))))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 y_over_x))\n"
-   "     ((return (call asin ((expression vec2 *\n"
-   "                      (var_ref y_over_x)\n"
-   "                      (expression vec2 rsq\n"
-   "                       (expression vec2 +\n"
-   "                        (expression vec2 *\n"
-   "                         (var_ref y_over_x)\n"
-   "                         (var_ref y_over_x))\n"
-   "                        (constant float (1.0))))))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 y_over_x))\n"
-   "     ((return (call asin ((expression vec3 *\n"
-   "                      (var_ref y_over_x)\n"
-   "                      (expression vec3 rsq\n"
-   "                       (expression vec3 +\n"
-   "                        (expression vec3 *\n"
-   "                         (var_ref y_over_x)\n"
-   "                         (var_ref y_over_x))\n"
-   "                        (constant float (1.0))))))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 y_over_x))\n"
-   "     ((return (call asin ((expression vec4 *\n"
-   "                      (var_ref y_over_x)\n"
-   "                      (expression vec4 rsq\n"
-   "                       (expression vec4 +\n"
-   "                        (expression vec4 *\n"
-   "                         (var_ref y_over_x)\n"
-   "                         (var_ref y_over_x))\n"
-   "                        (constant float (1.0))))))))))\n"
-   "\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in ) float y)\n"
-   "      (declare (in ) float x)\n"
-   "    )\n"
-   "    (\n"
-   "      (declare () float r)\n"
-   "      (if (expression bool > (expression float abs (var_ref x)) (constant float (0.000100))) (\n"
-   "        (assign (constant bool (1)) (x) (var_ref r) (call atan ((expression float / (var_ref y) (var_ref x)))))\n"
-   "        (if (expression bool < (var_ref x) (constant float (0.000000)) ) (\n"
-   "          (if (expression bool >= (var_ref y) (constant float (0.000000)) )\n"
-   "              ((assign (constant bool (1)) (x) (var_ref r) (expression float + (var_ref r) (constant float (3.141593)))))\n"
-   "              ((assign (constant bool (1)) (x) (var_ref r) (expression float - (var_ref r) (constant float (3.141593))))))\n"
-   "        )\n"
-   "        (\n"
-   "        ))\n"
-   "      )\n"
-   "      (\n"
-   "        (declare () float sgn)\n"
-   "        (assign (constant bool (1)) (x) (var_ref sgn) (expression float sign (var_ref y)))\n"
-   "        (assign (constant bool (1)) (x) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))\n"
-   "      ))\n"
-   "\n"
-   "      (return (var_ref r) )\n"
-   "    ))\n"
-   "\n"
-   "\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 y)\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((declare () vec2 r)\n"
-   "      (assign (constant bool (1)) (x) (var_ref r)\n"
-   "         (call atan ((swiz x (var_ref y))\n"
-   "                     (swiz x (var_ref x)))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref r)\n"
-   "         (call atan ((swiz y (var_ref y))\n"
-   "                     (swiz y (var_ref x)))))\n"
-   "      (return (var_ref r))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 y)\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((declare () vec3 r)\n"
-   "      (assign (constant bool (1)) (x) (var_ref r)\n"
-   "         (call atan ((swiz x (var_ref y))\n"
-   "                     (swiz x (var_ref x)))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref r)\n"
-   "         (call atan ((swiz y (var_ref y))\n"
-   "                     (swiz y (var_ref x)))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref r)\n"
-   "         (call atan ((swiz z (var_ref y))\n"
-   "                     (swiz z (var_ref x)))))\n"
-   "      (return (var_ref r))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 y)\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((declare () vec4 r)\n"
-   "      (assign (constant bool (1)) (x) (var_ref r)\n"
-   "         (call atan ((swiz x (var_ref y))\n"
-   "                     (swiz x (var_ref x)))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref r)\n"
-   "         (call atan ((swiz y (var_ref y))\n"
-   "                     (swiz y (var_ref x)))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref r)\n"
-   "         (call atan ((swiz z (var_ref y))\n"
-   "                     (swiz z (var_ref x)))))\n"
-   "      (assign (constant bool (1)) (w) (var_ref r)\n"
-   "         (call atan ((swiz w (var_ref y))\n"
-   "                     (swiz w (var_ref x)))))\n"
-   "      (return (var_ref r)))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_atanh[] =
-   "((function atanh\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float * (constant float (0.5))\n"
-   "                (expression float log\n"
-   "             (expression float /\n"
-   "                    (expression float + (constant float (1)) (var_ref x))\n"
-   "                    (expression float - (constant float (1)) (var_ref x))))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 * (constant vec2 (0.5))\n"
-   "                (expression vec2 log\n"
-   "             (expression vec2 /\n"
-   "                    (expression vec2 + (constant vec2 (1)) (var_ref x))\n"
-   "                    (expression vec2 - (constant vec2 (1)) (var_ref x))))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 * (constant vec3 (0.5))\n"
-   "                (expression vec3 log\n"
-   "             (expression vec3 /\n"
-   "                    (expression vec3 + (constant vec3 (1)) (var_ref x))\n"
-   "                    (expression vec3 - (constant vec3 (1)) (var_ref x))))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 * (constant vec4 (0.5))\n"
-   "                (expression vec4 log\n"
-   "             (expression vec4 /\n"
-   "                    (expression vec4 + (constant vec4 (1)) (var_ref x))\n"
-   "                    (expression vec4 - (constant vec4 (1)) (var_ref x))))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_ceil[] =
-   "((function ceil\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float ceil (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 ceil (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 ceil (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 ceil (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_clamp[] =
-   "((function clamp\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0)\n"
-   "       (declare (in) float arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1)\n"
-   "       (declare (in) vec2 arg2))\n"
-   "     ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1)\n"
-   "       (declare (in) vec3 arg2))\n"
-   "     ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1)\n"
-   "       (declare (in) vec4 arg2))\n"
-   "     ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2  arg0)\n"
-   "       (declare (in) float arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3  arg0)\n"
-   "       (declare (in) float arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4  arg0)\n"
-   "       (declare (in) float arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature int\n"
-   "     (parameters\n"
-   "       (declare (in) int arg0)\n"
-   "       (declare (in) int arg1)\n"
-   "       (declare (in) int arg2))\n"
-   "     ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1)\n"
-   "       (declare (in) ivec2 arg2))\n"
-   "     ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1)\n"
-   "       (declare (in) ivec3 arg2))\n"
-   "     ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1)\n"
-   "       (declare (in) ivec4 arg2))\n"
-   "     ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) int arg1)\n"
-   "       (declare (in) int arg2))\n"
-   "     ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) int arg1)\n"
-   "       (declare (in) int arg2))\n"
-   "     ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) int arg1)\n"
-   "       (declare (in) int arg2))\n"
-   "     ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uint\n"
-   "     (parameters\n"
-   "       (declare (in) uint arg0)\n"
-   "       (declare (in) uint arg1)\n"
-   "       (declare (in) uint arg2))\n"
-   "     ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1)\n"
-   "       (declare (in) uvec2 arg2))\n"
-   "     ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1)\n"
-   "       (declare (in) uvec3 arg2))\n"
-   "     ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1)\n"
-   "       (declare (in) uvec4 arg2))\n"
-   "     ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uint arg1)\n"
-   "       (declare (in) uint arg2))\n"
-   "     ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uint arg1)\n"
-   "       (declare (in) uint arg2))\n"
-   "     ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uint arg1)\n"
-   "       (declare (in) uint arg2))\n"
-   "     ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_cos[] =
-   "((function cos\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float angle))\n"
-   "     ((return (expression float cos (var_ref angle)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 angle))\n"
-   "     ((return (expression vec2 cos (var_ref angle)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 angle))\n"
-   "     ((return (expression vec3 cos (var_ref angle)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 angle))\n"
-   "     ((return (expression vec4 cos (var_ref angle)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_cosh[] =
-   "((function cosh\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float * (constant float (0.5))\n"
-   "                (expression float +\n"
-   "             (expression float exp (var_ref x))\n"
-   "             (expression float exp (expression float neg (var_ref x))))))))\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 * (constant vec2 (0.5))\n"
-   "                (expression vec2 +\n"
-   "             (expression vec2 exp (var_ref x))\n"
-   "             (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 * (constant vec3 (0.5))\n"
-   "                (expression vec3 +\n"
-   "             (expression vec3 exp (var_ref x))\n"
-   "             (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 * (constant vec4 (0.5))\n"
-   "                (expression vec4 +\n"
-   "             (expression vec4 exp (var_ref x))\n"
-   "             (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_cross[] =
-   "((function cross\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 a)\n"
-   "       (declare (in) vec3 b))\n"
-   "     ((return (expression vec3 -\n"
-   "        (expression vec3 * (swiz yzx (var_ref a)) (swiz zxy (var_ref b)))\n"
-   "        (expression vec3 * (swiz zxy (var_ref a)) (swiz yzx (var_ref b)))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_dFdx[] =
-   "((function dFdx\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float p))\n"
-   "     ((return (expression float dFdx (var_ref p)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 p))\n"
-   "     ((return (expression vec2 dFdx (var_ref p)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 p))\n"
-   "     ((return (expression vec3 dFdx (var_ref p)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 p))\n"
-   "     ((return (expression vec4 dFdx (var_ref p)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_dFdy[] =
-   "((function dFdy\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float p))\n"
-   "     ((return (expression float dFdy (var_ref p)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 p))\n"
-   "     ((return (expression vec2 dFdy (var_ref p)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 p))\n"
-   "     ((return (expression vec3 dFdy (var_ref p)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 p))\n"
-   "     ((return (expression vec4 dFdy (var_ref p)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_degrees[] =
-   "((function degrees\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float * (var_ref arg0) (constant float (57.295780))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_distance[] =
-   "((function distance\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float p0)\n"
-   "       (declare (in) float p1))\n"
-   "     ((return (expression float abs (expression float - (var_ref p0) (var_ref p1))))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 p0)\n"
-   "       (declare (in) vec2 p1))\n"
-   "     ((declare () vec2 p)\n"
-   "      (assign (constant bool (1)) (xy) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))\n"
-   "      (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 p0)\n"
-   "       (declare (in) vec3 p1))\n"
-   "     ((declare () vec3 p)\n"
-   "      (assign (constant bool (1)) (xyz) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))\n"
-   "      (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 p0)\n"
-   "       (declare (in) vec4 p1))\n"
-   "     ((declare () vec4 p)\n"
-   "      (assign (constant bool (1)) (xyzw) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))\n"
-   "      (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_dot[] =
-   "((function dot\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression float * (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_equal[] =
-   "((function equal\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) bvec2 arg0)\n"
-   "       (declare (in) bvec2 arg1))\n"
-   "     ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) bvec3 arg0)\n"
-   "       (declare (in) bvec3 arg1))\n"
-   "     ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) bvec4 arg0)\n"
-   "       (declare (in) bvec4 arg1))\n"
-   "     ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_exp[] =
-   "((function exp\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float exp (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 exp (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 exp (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 exp (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_exp2[] =
-   "((function exp2\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float exp2 (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 exp2 (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 exp2 (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 exp2 (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_faceforward[] =
-   "((function faceforward\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float N)\n"
-   "       (declare (in) float I)\n"
-   "       (declare (in) float Nref))\n"
-   "     ((if (expression bool < (expression float * (var_ref Nref) (var_ref I)) (constant float (0)))\n"
-   "          ((return (var_ref N)))\n"
-   "     ((return (expression float neg (var_ref N)))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 N)\n"
-   "       (declare (in) vec2 I)\n"
-   "       (declare (in) vec2 Nref))\n"
-   "     ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n"
-   "          ((return (var_ref N)))\n"
-   "     ((return (expression vec2 neg (var_ref N)))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 N)\n"
-   "       (declare (in) vec3 I)\n"
-   "       (declare (in) vec3 Nref))\n"
-   "     ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n"
-   "          ((return (var_ref N)))\n"
-   "     ((return (expression vec3 neg (var_ref N)))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 N)\n"
-   "       (declare (in) vec4 I)\n"
-   "       (declare (in) vec4 Nref))\n"
-   "     ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n"
-   "          ((return (var_ref N)))\n"
-   "     ((return (expression vec4 neg (var_ref N)))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_floor[] =
-   "((function floor\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float floor (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 floor (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 floor (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 floor (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_fract[] =
-   "((function fract\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float fract (var_ref x)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 fract (var_ref x)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 fract (var_ref x)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 fract (var_ref x)))))\n"
-   "))\n"
-   "\n"
-   ""
-;
-static const char builtin_ftransform[] =
-   "((declare (uniform) mat4 gl_ModelViewProjectionMatrix)\n"
-   " (declare (in) vec4 gl_Vertex)\n"
-   " (function ftransform\n"
-   "   (signature vec4\n"
-   "     (parameters)\n"
-   "    ((return (expression vec4 *\n"
-   "         (var_ref gl_ModelViewProjectionMatrix)\n"
-   "         (var_ref gl_Vertex)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_fwidth[] =
-   "((function fwidth\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float p))\n"
-   "     ((return (expression float +\n"
-   "                (expression float abs (expression float dFdx (var_ref p)))\n"
-   "                (expression float abs (expression float dFdy (var_ref p)))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 p))\n"
-   "     ((return (expression vec2 +\n"
-   "                (expression vec2 abs (expression vec2 dFdx (var_ref p)))\n"
-   "                (expression vec2 abs (expression vec2 dFdy (var_ref p)))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 p))\n"
-   "     ((return (expression vec3 +\n"
-   "                (expression vec3 abs (expression vec3 dFdx (var_ref p)))\n"
-   "                (expression vec3 abs (expression vec3 dFdy (var_ref p)))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 p))\n"
-   "     ((return (expression vec4 +\n"
-   "                (expression vec4 abs (expression vec4 dFdx (var_ref p)))\n"
-   "                (expression vec4 abs (expression vec4 dFdy (var_ref p)))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_greaterThan[] =
-   "((function greaterThan\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_greaterThanEqual[] =
-   "((function greaterThanEqual\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_inversesqrt[] =
-   "((function inversesqrt\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float rsq (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 rsq (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 rsq (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 rsq (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_length[] =
-   "((function length\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float abs (var_ref arg0)))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_lessThan[] =
-   "((function lessThan\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_lessThanEqual[] =
-   "((function lessThanEqual\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_log[] =
-   "((function log\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float log (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 log (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 log (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 log (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_log2[] =
-   "((function log2\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float log2 (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 log2 (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 log2 (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 log2 (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_matrixCompMult[] =
-   "((function matrixCompMult\n"
-   "   (signature mat2\n"
-   "     (parameters\n"
-   "       (declare (in) mat2 x)\n"
-   "       (declare (in) mat2 y))\n"
-   "     ((declare () mat2 z)\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat3\n"
-   "     (parameters\n"
-   "       (declare (in) mat3 x)\n"
-   "       (declare (in) mat3 y))\n"
-   "     ((declare () mat3 z)\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2)))  (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat4\n"
-   "     (parameters\n"
-   "       (declare (in) mat4 x)\n"
-   "       (declare (in) mat4 y))\n"
-   "     ((declare () mat4 z)\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2)))  (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (3)))  (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat2x3\n"
-   "     (parameters\n"
-   "       (declare (in) mat2x3 x)\n"
-   "       (declare (in) mat2x3 y))\n"
-   "     ((declare () mat2x3 z)\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat3x2\n"
-   "     (parameters\n"
-   "       (declare (in) mat3x2 x)\n"
-   "       (declare (in) mat3x2 y))\n"
-   "     ((declare () mat3x2 z)\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2)))  (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat2x4\n"
-   "     (parameters\n"
-   "       (declare (in) mat2x4 x)\n"
-   "       (declare (in) mat2x4 y))\n"
-   "     ((declare () mat2x4 z)\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat4x2\n"
-   "     (parameters\n"
-   "       (declare (in) mat4x2 x)\n"
-   "       (declare (in) mat4x2 y))\n"
-   "     ((declare () mat4x2 z)\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2)))  (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (3)))  (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat3x4\n"
-   "     (parameters\n"
-   "       (declare (in) mat3x4 x)\n"
-   "       (declare (in) mat3x4 y))\n"
-   "     ((declare () mat3x4 z)\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2)))  (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
-   "(return (var_ref z))))\n"
-   "\n"
-   "   (signature mat4x3\n"
-   "     (parameters\n"
-   "       (declare (in) mat4x3 x)\n"
-   "       (declare (in) mat4x3 y))\n"
-   "     ((declare () mat4x3 z)\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2)))  (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (3)))  (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n"
-   "(return (var_ref z))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_max[] =
-   "((function max\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression float max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature int\n"
-   "     (parameters\n"
-   "       (declare (in) int arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression int max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2  arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3  arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4  arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uint\n"
-   "     (parameters\n"
-   "       (declare (in) uint arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uint max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2  arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3  arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4  arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_min[] =
-   "((function min\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression float min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature int\n"
-   "     (parameters\n"
-   "       (declare (in) int arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression int min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2  arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3  arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4  arg0)\n"
-   "       (declare (in) int arg1))\n"
-   "     ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uint\n"
-   "     (parameters\n"
-   "       (declare (in) uint arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uint min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2  arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3  arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4  arg0)\n"
-   "       (declare (in) uint arg1))\n"
-   "     ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_mix[] =
-   "((function mix\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0)\n"
-   "       (declare (in) float arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1)\n"
-   "       (declare (in) vec2 arg2))\n"
-   "     ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1)\n"
-   "       (declare (in) vec3 arg2))\n"
-   "     ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1)\n"
-   "       (declare (in) vec4 arg2))\n"
-   "     ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1)\n"
-   "       (declare (in) float arg2))\n"
-   "     ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n"
-   "\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float v1)\n"
-   "       (declare (in) float v2)\n"
-   "       (declare (in) bool  a))\n"
-   "     ((assign (var_ref a) (var_ref v1) (var_ref v2))\n"
-   "      (return (var_ref v1))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 v1)\n"
-   "       (declare (in) vec2 v2)\n"
-   "       (declare (in) bvec2 a))\n"
-   "     ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n"
-   "      (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n"
-   "      (return (var_ref v1))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 v1)\n"
-   "       (declare (in) vec3 v2)\n"
-   "       (declare (in) bvec3 a))\n"
-   "     ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n"
-   "      (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n"
-   "      (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))\n"
-   "      (return (var_ref v1))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 v1)\n"
-   "       (declare (in) vec4 v2)\n"
-   "       (declare (in) bvec4 a))\n"
-   "     ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n"
-   "      (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n"
-   "      (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))\n"
-   "      (assign (swiz w (var_ref a)) (w) (var_ref v1) (swiz w (var_ref v2)))\n"
-   "      (return (var_ref v1))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_mod[] =
-   "((function mod\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression float % (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4  arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_modf[] =
-   "((function modf\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in)  float x)\n"
-   "       (declare (out) float i))\n"
-   "     ((declare () float t)\n"
-   "      (assign (constant bool (1)) (x) (var_ref t)\n"
-   "                                      (expression float trunc (var_ref x)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref i) (var_ref t))\n"
-   "      (return (expression float - (var_ref x) (var_ref t)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in)  vec2 x)\n"
-   "       (declare (out) vec2 i))\n"
-   "     ((declare () vec2 t)\n"
-   "      (assign (constant bool (1)) (xy) (var_ref t)\n"
-   "                                       (expression vec2 trunc (var_ref x)))\n"
-   "      (assign (constant bool (1)) (xy) (var_ref i) (var_ref t))\n"
-   "      (return (expression vec2 - (var_ref x) (var_ref t)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in)  vec3 x)\n"
-   "       (declare (out) vec3 i))\n"
-   "     ((declare () vec3 t)\n"
-   "      (assign (constant bool (1)) (xyz) (var_ref t)\n"
-   "                                        (expression vec3 trunc (var_ref x)))\n"
-   "      (assign (constant bool (1)) (xyz) (var_ref i) (var_ref t))\n"
-   "      (return (expression vec3 - (var_ref x) (var_ref t)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in)  vec4 x)\n"
-   "       (declare (out) vec4 i))\n"
-   "     ((declare () vec4 t)\n"
-   "      (assign (constant bool (1)) (xyzw) (var_ref t)\n"
-   "                                         (expression vec4 trunc (var_ref x)))\n"
-   "      (assign (constant bool (1)) (xyzw) (var_ref i) (var_ref t))\n"
-   "      (return (expression vec4 - (var_ref x) (var_ref t)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_noise1[] =
-   "((function noise1\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float noise (var_ref x)))))\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression float noise (var_ref x)))))\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression float noise (var_ref x)))))\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression float noise (var_ref x)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_noise2[] =
-   "((function noise2\n"
-   "  (signature vec2\n"
-   "    (parameters (declare (in) vec4 p))\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () vec2 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec2\n"
-   "    (parameters (declare (in) vec3 p))\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () vec2 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in ) vec2 p)\n"
-   "    )\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () vec2 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in ) float p)\n"
-   "    )\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () vec2 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "))\n"
-   ""
-;
-static const char builtin_noise3[] =
-   "((function noise3\n"
-   "  (signature vec3\n"
-   "    (parameters (declare (in) vec4 p))\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () float c)\n"
-   "      (declare () vec3 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec3\n"
-   "    (parameters (declare (in) vec3 p))\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () float c)\n"
-   "      (declare () vec3 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec3\n"
-   "    (parameters (declare (in) vec2 p))\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () float c)\n"
-   "      (declare () vec3 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec3\n"
-   "    (parameters (declare (in) float p))\n"
-   "    (\n"
-   "      (declare () float a)\n"
-   "      (declare () float b)\n"
-   "      (declare () float c)\n"
-   "      (declare () vec3 t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
-   "      (return (var_ref t))\n"
-   "    ))\n"
-   "))\n"
-   ""
-;
-static const char builtin_noise4[] =
-   "((function noise4\n"
-   "  (signature vec4\n"
-   "    (parameters (declare (in) vec4 p))\n"
-   "    (\n"
-   "      (declare () float _x)\n"
-   "      (declare () float _y)\n"
-   "      (declare () float _z)\n"
-   "      (declare () float _w)\n"
-   "      (declare () vec4 _r)\n"
-   "\n"
-   "      (declare () vec4 _p)\n"
-   "      (assign (constant bool (1)) (xyzw) (var_ref _p) (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0))) )\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
-   "      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
-   "      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
-   "      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
-   "      (return (var_ref _r))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec4\n"
-   "    (parameters (declare (in) vec3 p))\n"
-   "    (\n"
-   "      (declare () float _x)\n"
-   "      (declare () float _y)\n"
-   "      (declare () float _z)\n"
-   "      (declare () float _w)\n"
-   "      (declare () vec4 _r)\n"
-   "\n"
-   "      (declare () vec3 _p)\n"
-   "      (assign (constant bool (1)) (xyz) (var_ref _p) (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0))) )\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
-   "      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
-   "      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
-   "      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
-   "      (return (var_ref _r))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec4\n"
-   "    (parameters (declare (in) vec2 p))\n"
-   "    (\n"
-   "      (declare () float _x)\n"
-   "      (declare () float _y)\n"
-   "      (declare () float _z)\n"
-   "      (declare () float _w)\n"
-   "      (declare () vec4 _r)\n"
-   "\n"
-   "      (declare () vec2 _p)\n"
-   "      (assign (constant bool (1)) (xy) (var_ref _p) (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0))) )\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
-   "      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
-   "      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
-   "      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
-   "      (return (var_ref _r))\n"
-   "    ))\n"
-   "\n"
-   "  (signature vec4\n"
-   "    (parameters (declare (in) float p))\n"
-   "    (\n"
-   "      (declare () float _x)\n"
-   "      (declare () float _y)\n"
-   "      (declare () float _z)\n"
-   "      (declare () float _w)\n"
-   "      (declare () vec4 _r)\n"
-   "\n"
-   "      (declare () float _p)\n"
-   "      (assign (constant bool (1)) (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
-   "      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
-   "      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
-   "      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
-   "      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
-   "      (return (var_ref _r))\n"
-   "    ))\n"
-   "))\n"
-   ""
-;
-static const char builtin_normalize[] =
-   "((function normalize\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float sign (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_not[] =
-   "((function not\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) bvec2 arg0))\n"
-   "     ((return (expression bvec2 ! (var_ref arg0)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) bvec3 arg0))\n"
-   "     ((return (expression bvec3 ! (var_ref arg0)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) bvec4 arg0))\n"
-   "     ((return (expression bvec4 ! (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_notEqual[] =
-   "((function notEqual\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) bvec2 arg0)\n"
-   "       (declare (in) bvec2 arg1))\n"
-   "     ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) bvec3 arg0)\n"
-   "       (declare (in) bvec3 arg1))\n"
-   "     ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) bvec4 arg0)\n"
-   "       (declare (in) bvec4 arg1))\n"
-   "     ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 arg0)\n"
-   "       (declare (in) ivec2 arg1))\n"
-   "     ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 arg0)\n"
-   "       (declare (in) ivec3 arg1))\n"
-   "     ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 arg0)\n"
-   "       (declare (in) ivec4 arg1))\n"
-   "     ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec2\n"
-   "     (parameters\n"
-   "       (declare (in) uvec2 arg0)\n"
-   "       (declare (in) uvec2 arg1))\n"
-   "     ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec3\n"
-   "     (parameters\n"
-   "       (declare (in) uvec3 arg0)\n"
-   "       (declare (in) uvec3 arg1))\n"
-   "     ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature bvec4\n"
-   "     (parameters\n"
-   "       (declare (in) uvec4 arg0)\n"
-   "       (declare (in) uvec4 arg1))\n"
-   "     ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_outerProduct[] =
-   "((function outerProduct\n"
-   "   (signature mat2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 u)\n"
-   "       (declare (in) vec2 v))\n"
-   "     ((declare () mat2 m)\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "\n"
-   "   (signature mat2x3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 u)\n"
-   "       (declare (in) vec2 v))\n"
-   "     ((declare () mat2x3 m)\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "\n"
-   "   (signature mat2x4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 u)\n"
-   "       (declare (in) vec2 v))\n"
-   "     ((declare () mat2x4 m)\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "\n"
-   "   (signature mat3x2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 u)\n"
-   "       (declare (in) vec3 v))\n"
-   "     ((declare () mat3x2 m)\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
-   "      (return (var_ref m))\n"
-   " ))\n"
-   "\n"
-   "   (signature mat3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 u)\n"
-   "       (declare (in) vec3 v))\n"
-   "     ((declare () mat3 m)\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "\n"
-   "   (signature mat3x4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 u)\n"
-   "       (declare (in) vec3 v))\n"
-   "     ((declare () mat3x4 m)\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "\n"
-   "   (signature mat4x2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 u)\n"
-   "       (declare (in) vec4 v))\n"
-   "     ((declare () mat4x2 m)\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "\n"
-   "   (signature mat4x3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 u)\n"
-   "       (declare (in) vec4 v))\n"
-   "     ((declare () mat4x3 m)\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "\n"
-   "   (signature mat4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 u)\n"
-   "       (declare (in) vec4 v))\n"
-   "     ((declare () mat4 m)\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
-   "      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n"
-   "      (return (var_ref m))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_pow[] =
-   "((function pow\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0)\n"
-   "       (declare (in) float arg1))\n"
-   "     ((return (expression float pow (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0)\n"
-   "       (declare (in) vec2 arg1))\n"
-   "     ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0)\n"
-   "       (declare (in) vec3 arg1))\n"
-   "     ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0)\n"
-   "       (declare (in) vec4 arg1))\n"
-   "     ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_radians[] =
-   "((function radians\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_reflect[] =
-   "((function reflect\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float i)\n"
-   "       (declare (in) float n))\n"
-   "     ((return (expression float -\n"
-   "          (var_ref i)\n"
-   "          (expression float *\n"
-   "           (constant float (2.0))\n"
-   "           (expression float *\n"
-   "            (expression float *\n"
-   "             (var_ref n)\n"
-   "             (var_ref i))\n"
-   "            (var_ref n)))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 i)\n"
-   "       (declare (in) vec2 n))\n"
-   "     ((return (expression vec2 -\n"
-   "          (var_ref i)\n"
-   "          (expression vec2 *\n"
-   "           (constant float (2.0))\n"
-   "           (expression vec2 *\n"
-   "            (expression float dot\n"
-   "             (var_ref n)\n"
-   "             (var_ref i))\n"
-   "            (var_ref n)))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 i)\n"
-   "       (declare (in) vec3 n))\n"
-   "     ((return (expression vec3 -\n"
-   "          (var_ref i)\n"
-   "          (expression vec3 *\n"
-   "           (constant float (2.0))\n"
-   "           (expression vec3 *\n"
-   "            (expression float dot\n"
-   "             (var_ref n)\n"
-   "             (var_ref i))\n"
-   "            (var_ref n)))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 i)\n"
-   "       (declare (in) vec4 n))\n"
-   "     ((return (expression vec4 -\n"
-   "          (var_ref i)\n"
-   "          (expression vec4 *\n"
-   "           (constant float (2.0))\n"
-   "           (expression vec4 *\n"
-   "            (expression float dot\n"
-   "             (var_ref n)\n"
-   "             (var_ref i))\n"
-   "            (var_ref n)))))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_refract[] =
-   "((function refract\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float i)\n"
-   "       (declare (in) float n)\n"
-   "       (declare (in) float eta))\n"
-   "     ((declare () float k)\n"
-   "      (assign (constant bool (1)) (x) (var_ref k)\n"
-   "              (expression float - (constant float (1.0))\n"
-   "           (expression float * (var_ref eta)\n"
-   "             (expression float * (var_ref eta)\n"
-   "               (expression float - (constant float (1.0))\n"
-   "                 (expression float * \n"
-   "                   (expression float * (var_ref n) (var_ref i))\n"
-   "                   (expression float * (var_ref n) (var_ref i))))))))\n"
-   "      (if (expression bool < (var_ref k) (constant float (0.0)))\n"
-   "          ((return (constant float (0.0))))\n"
-   "     ((return (expression float -\n"
-   "                (expression float * (var_ref eta) (var_ref i))\n"
-   "                (expression float *\n"
-   "                  (expression float +\n"
-   "                    (expression float * (var_ref eta)\n"
-   "                      (expression float * (var_ref n) (var_ref i)))\n"
-   "                    (expression float sqrt (var_ref k)))\n"
-   "                  (var_ref n))))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 i)\n"
-   "       (declare (in) vec2 n)\n"
-   "       (declare (in) float eta))\n"
-   "     ((declare () float k)\n"
-   "      (assign (constant bool (1)) (x) (var_ref k)\n"
-   "              (expression float - (constant float (1.0))\n"
-   "           (expression float * (var_ref eta)\n"
-   "             (expression float * (var_ref eta)\n"
-   "               (expression float - (constant float (1.0))\n"
-   "                 (expression float * \n"
-   "                   (expression float dot (var_ref n) (var_ref i))\n"
-   "                   (expression float dot (var_ref n) (var_ref i))))))))\n"
-   "      (if (expression bool < (var_ref k) (constant float (0.0)))\n"
-   "          ((return (constant vec2 (0.0 0.0))))\n"
-   "     ((return (expression vec2 -\n"
-   "                (expression vec2 * (var_ref eta) (var_ref i))\n"
-   "                (expression vec2 *\n"
-   "                  (expression float +\n"
-   "                    (expression float * (var_ref eta)\n"
-   "                      (expression float dot (var_ref n) (var_ref i)))\n"
-   "                    (expression float sqrt (var_ref k)))\n"
-   "                  (var_ref n))))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 i)\n"
-   "       (declare (in) vec3 n)\n"
-   "       (declare (in) float eta))\n"
-   "     ((declare () float k)\n"
-   "      (assign (constant bool (1)) (x) (var_ref k)\n"
-   "              (expression float - (constant float (1.0))\n"
-   "           (expression float * (var_ref eta)\n"
-   "             (expression float * (var_ref eta)\n"
-   "               (expression float - (constant float (1.0))\n"
-   "                 (expression float * \n"
-   "                   (expression float dot (var_ref n) (var_ref i))\n"
-   "                   (expression float dot (var_ref n) (var_ref i))))))))\n"
-   "      (if (expression bool < (var_ref k) (constant float (0.0)))\n"
-   "          ((return (constant vec3 (0.0 0.0 0.0))))\n"
-   "     ((return (expression vec3 -\n"
-   "                (expression vec3 * (var_ref eta) (var_ref i))\n"
-   "                (expression vec3 *\n"
-   "                  (expression float +\n"
-   "                    (expression float * (var_ref eta)\n"
-   "                      (expression float dot (var_ref n) (var_ref i)))\n"
-   "                    (expression float sqrt (var_ref k)))\n"
-   "                  (var_ref n))))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 i)\n"
-   "       (declare (in) vec4 n)\n"
-   "       (declare (in) float eta))\n"
-   "     ((declare () float k)\n"
-   "      (assign (constant bool (1)) (x) (var_ref k)\n"
-   "              (expression float - (constant float (1.0))\n"
-   "           (expression float * (var_ref eta)\n"
-   "             (expression float * (var_ref eta)\n"
-   "               (expression float - (constant float (1.0))\n"
-   "                 (expression float * \n"
-   "                   (expression float dot (var_ref n) (var_ref i))\n"
-   "                   (expression float dot (var_ref n) (var_ref i))))))))\n"
-   "      (if (expression bool < (var_ref k) (constant float (0.0)))\n"
-   "          ((return (constant vec4 (0.0 0.0 0.0 0.0))))\n"
-   "     ((return (expression vec4 -\n"
-   "                (expression vec4 * (var_ref eta) (var_ref i))\n"
-   "                (expression vec4 *\n"
-   "                  (expression float +\n"
-   "                    (expression float * (var_ref eta)\n"
-   "                      (expression float dot (var_ref n) (var_ref i)))\n"
-   "                    (expression float sqrt (var_ref k)))\n"
-   "                  (var_ref n))))))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_round[] =
-   "((function round\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float round_even (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 round_even (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 round_even (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 round_even (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_roundEven[] =
-   "((function roundEven\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float round_even (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 round_even (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 round_even (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 round_even (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow1D[] =
-   "((function shadow1D\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DShadow sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DShadow sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow1DArray[] =
-   "((function shadow1DArray\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArrayShadow sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArrayShadow sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow1DArrayLod[] =
-   "((function shadow1DArrayLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArrayShadow sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow1DLod[] =
-   "((function shadow1DLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DShadow sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow1DProj[] =
-   "((function shadow1DProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DShadow sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DShadow sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow1DProjLod[] =
-   "((function shadow1DProjLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DShadow sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow2D[] =
-   "((function shadow2D\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DShadow sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DShadow sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow2DArray[] =
-   "((function shadow2DArray\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArrayShadow sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) 1 (swiz w (var_ref P)) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow2DLod[] =
-   "((function shadow2DLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DShadow sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow2DProj[] =
-   "((function shadow2DProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DShadow sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DShadow sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow2DProjLod[] =
-   "((function shadow2DProjLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DShadow sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow2DRect[] =
-   "((function shadow2DRect\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DRectShadow sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_shadow2DRectProj[] =
-   "((function shadow2DRectProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DRectShadow sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_sign[] =
-   "((function sign\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float sign (var_ref x)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 sign (var_ref x)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 sign (var_ref x)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 sign (var_ref x)))))\n"
-   "\n"
-   "   (signature int\n"
-   "     (parameters\n"
-   "       (declare (in) int x))\n"
-   "     ((return (expression int sign (var_ref x)))))\n"
-   "\n"
-   "   (signature ivec2\n"
-   "     (parameters\n"
-   "       (declare (in) ivec2 x))\n"
-   "     ((return (expression ivec2 sign (var_ref x)))))\n"
-   "\n"
-   "   (signature ivec3\n"
-   "     (parameters\n"
-   "       (declare (in) ivec3 x))\n"
-   "     ((return (expression ivec3 sign (var_ref x)))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) ivec4 x))\n"
-   "     ((return (expression ivec4 sign (var_ref x)))))\n"
-   "))\n"
-   "\n"
-   ""
-;
-static const char builtin_sin[] =
-   "((function sin\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float angle))\n"
-   "     ((return (expression float sin (var_ref angle)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 angle))\n"
-   "     ((return (expression vec2 sin (var_ref angle)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 angle))\n"
-   "     ((return (expression vec3 sin (var_ref angle)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 angle))\n"
-   "     ((return (expression vec4 sin (var_ref angle)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_sinh[] =
-   "((function sinh\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float * (constant float (0.5))\n"
-   "                (expression float -\n"
-   "             (expression float exp (var_ref x))\n"
-   "             (expression float exp (expression float neg (var_ref x))))))))\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 * (constant vec2 (0.5))\n"
-   "                (expression vec2 -\n"
-   "             (expression vec2 exp (var_ref x))\n"
-   "             (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 * (constant vec3 (0.5))\n"
-   "                (expression vec3 -\n"
-   "             (expression vec3 exp (var_ref x))\n"
-   "             (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 * (constant vec4 (0.5))\n"
-   "                (expression vec4 -\n"
-   "             (expression vec4 exp (var_ref x))\n"
-   "             (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_smoothstep[] =
-   "((function smoothstep\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float edge0)\n"
-   "       (declare (in) float edge1)\n"
-   "       (declare (in) float x))\n"
-   "     ((declare () float t)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) float edge0)\n"
-   "       (declare (in) float edge1)\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((declare () vec2 t)\n"
-   "      (declare () vec2 retval)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (y) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
-   "      (return (var_ref retval))\n"
-   "      ))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) float edge0)\n"
-   "       (declare (in) float edge1)\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((declare () vec3 t)\n"
-   "      (declare () vec3 retval)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (y) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (z) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
-   "      (return (var_ref retval))\n"
-   "      ))\n"
-   "\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) float edge0)\n"
-   "       (declare (in) float edge1)\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((declare () vec4 t)\n"
-   "      (declare () vec4 retval)\n"
-   "\n"
-   "      (assign (constant bool (1)) (x) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (y) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (z) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
-   "\n"
-   "      (assign (constant bool (1)) (w) (var_ref t)\n"
-   "              (expression float max\n"
-   "                     (expression float min\n"
-   "                                 (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
-   "                                 (constant float (1.0)))\n"
-   "                     (constant float (0.0))))\n"
-   "      (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n"
-   "      (return (var_ref retval))\n"
-   "      ))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 edge0)\n"
-   "       (declare (in) vec2 edge1)\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 max\n"
-   "                          (expression vec2 min\n"
-   "                                      (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))\n"
-   "                                      (constant vec2 (1.0 1.0)))\n"
-   "                          (constant vec2 (0.0 0.0))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 edge0)\n"
-   "       (declare (in) vec3 edge1)\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 max\n"
-   "                          (expression vec3 min\n"
-   "                                      (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))\n"
-   "                                      (constant vec3 (1.0 1.0 1.0)))\n"
-   "                          (constant vec3 (0.0 0.0 0.0))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 edge0)\n"
-   "       (declare (in) vec4 edge1)\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 max\n"
-   "                          (expression vec4 min\n"
-   "                                      (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))\n"
-   "                                      (constant vec4 (1.0 1.0 1.0 1.0)))\n"
-   "                          (constant vec4 (0.0 0.0 0.0 0.0))))))\n"
-   "))\n"
-   "\n"
-   ""
-;
-static const char builtin_sqrt[] =
-   "((function sqrt\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float sqrt (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 sqrt (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 sqrt (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 sqrt (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_step[] =
-   "((function step\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float edge)\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) float edge)\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((declare () vec2 t)\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
-   "      (return (var_ref t))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) float edge)\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((declare () vec3 t)\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
-   "      (return (var_ref t))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) float edge)\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((declare () vec4 t)\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
-   "      (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n"
-   "      (return (var_ref t))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 edge)\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((declare () vec2 t)\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
-   "      (return (var_ref t))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 edge)\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((declare () vec3 t)\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n"
-   "      (return (var_ref t))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 edge)\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((declare () vec4 t)\n"
-   "      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n"
-   "      (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n"
-   "      (return (var_ref t))))\n"
-   "))\n"
-   "\n"
-   ""
-;
-static const char builtin_tan[] =
-   "((function tan\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float angle))\n"
-   "     ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle))))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 angle))\n"
-   "     ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 angle))\n"
-   "     ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 angle))\n"
-   "     ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_tanh[] =
-   "((function tanh\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float x))\n"
-   "     ((return (expression float /\n"
-   "                (expression float -\n"
-   "             (expression float exp (var_ref x))\n"
-   "             (expression float exp (expression float neg (var_ref x))))\n"
-   "                (expression float +\n"
-   "             (expression float exp (var_ref x))\n"
-   "             (expression float exp (expression float neg (var_ref x))))))))\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 x))\n"
-   "     ((return (expression vec2 /\n"
-   "                (expression vec2 -\n"
-   "             (expression vec2 exp (var_ref x))\n"
-   "             (expression vec2 exp (expression vec2 neg (var_ref x))))\n"
-   "                (expression vec2 +\n"
-   "             (expression vec2 exp (var_ref x))\n"
-   "             (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 x))\n"
-   "     ((return (expression vec3 /\n"
-   "                (expression vec3 -\n"
-   "             (expression vec3 exp (var_ref x))\n"
-   "             (expression vec3 exp (expression vec3 neg (var_ref x))))\n"
-   "                (expression vec3 +\n"
-   "             (expression vec3 exp (var_ref x))\n"
-   "             (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 x))\n"
-   "     ((return (expression vec4 /\n"
-   "                (expression vec4 -\n"
-   "             (expression vec4 exp (var_ref x))\n"
-   "             (expression vec4 exp (expression vec4 neg (var_ref x))))\n"
-   "                (expression vec4 +\n"
-   "             (expression vec4 exp (var_ref x))\n"
-   "             (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n"
-   "))\n"
-   ""
-;
-static const char builtin_texelFetch[] =
-   "((function texelFetch\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) int P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) int P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) int P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) ivec2 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) ivec2 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) ivec2 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) ivec3 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) ivec3 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) ivec3 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) ivec2 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1DArray sampler)\n"
-   "       (declare (in) ivec2 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1DArray sampler)\n"
-   "       (declare (in) ivec2 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) ivec3 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2DArray sampler)\n"
-   "       (declare (in) ivec3 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2DArray sampler)\n"
-   "       (declare (in) ivec3 P) \n"
-   "       (declare (in) int lod) )\n"
-   "     ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture[] =
-   "((function texture\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) float P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) float P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) float P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) samplerCube sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isamplerCube sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usamplerCube sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) samplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isamplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usamplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture1D[] =
-   "((function texture1D\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) float P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture1DArray[] =
-   "((function texture1DArray\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture1DArrayLod[] =
-   "((function texture1DArrayLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture1DLod[] =
-   "((function texture1DLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture1DProj[] =
-   "((function texture1DProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture1DProjLod[] =
-   "((function texture1DProjLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2D[] =
-   "((function texture2D\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2DArray[] =
-   "((function texture2DArray\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2DArrayLod[] =
-   "((function texture2DArrayLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2DLod[] =
-   "((function texture2DLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2DProj[] =
-   "((function texture2DProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2DProjLod[] =
-   "((function texture2DProjLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2DRect[] =
-   "((function texture2DRect\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DRect sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture2DRectProj[] =
-   "((function texture2DRectProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DRect sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DRect sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture3D[] =
-   "((function texture3D\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture3DLod[] =
-   "((function texture3DLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture3DProj[] =
-   "((function texture3DProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_texture3DProjLod[] =
-   "((function texture3DProjLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_textureCube[] =
-   "((function textureCube\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) samplerCube sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) samplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_textureCubeLod[] =
-   "((function textureCubeLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) samplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_textureGrad[] =
-   "((function textureGrad\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) samplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isamplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usamplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_textureLod[] =
-   "((function textureLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) float P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) samplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isamplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usamplerCube sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1DArray sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2DArray sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_textureProj[] =
-   "((function textureProj\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec2 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec3 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec4 P) )\n"
-   "     ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float bias) )\n"
-   "     ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_textureProjGrad[] =
-   "((function textureProjGrad\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float dPdx) \n"
-   "       (declare (in) float dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) vec2 dPdx) \n"
-   "       (declare (in) vec2 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) vec3 dPdx) \n"
-   "       (declare (in) vec3 dPdy) )\n"
-   "     ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_textureProjLod[] =
-   "((function textureProjLod\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec2 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler1D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec3 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler2D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) sampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature ivec4\n"
-   "     (parameters\n"
-   "       (declare (in) isampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "   (signature uvec4\n"
-   "     (parameters\n"
-   "       (declare (in) usampler3D sampler)\n"
-   "       (declare (in) vec4 P) \n"
-   "       (declare (in) float lod) )\n"
-   "     ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n"
-   "\n"
-   "))\n"
-   ""
-;
-static const char builtin_transpose[] =
-   "((function transpose\n"
-   "   (signature mat2\n"
-   "     (parameters\n"
-   "       (declare (in) mat2 m))\n"
-   "     ((declare () mat2 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat3x2\n"
-   "     (parameters\n"
-   "       (declare (in) mat2x3 m))\n"
-   "     ((declare () mat3x2 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat4x2\n"
-   "     (parameters\n"
-   "       (declare (in) mat2x4 m))\n"
-   "     ((declare () mat4x2 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat2x3\n"
-   "     (parameters\n"
-   "       (declare (in) mat3x2 m))\n"
-   "     ((declare () mat2x3 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat3\n"
-   "     (parameters\n"
-   "       (declare (in) mat3 m))\n"
-   "     ((declare () mat3 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat4x3\n"
-   "     (parameters\n"
-   "       (declare (in) mat3x4 m))\n"
-   "     ((declare () mat4x3 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat2x4\n"
-   "     (parameters\n"
-   "       (declare (in) mat4x2 m))\n"
-   "     ((declare () mat2x4 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat3x4\n"
-   "     (parameters\n"
-   "       (declare (in) mat4x3 m))\n"
-   "     ((declare () mat3x4 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))\n"
-   "(return (var_ref t))))\n"
-   "\n"
-   "   (signature mat4\n"
-   "     (parameters\n"
-   "       (declare (in) mat4 m))\n"
-   "     ((declare () mat4 t)\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))\n"
-   "      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (3)))))\n"
-   "(return (var_ref t))))\n"
-   ")\n"
-   "\n"
-   ")\n"
-   "\n"
-   ""
-;
-static const char builtin_trunc[] =
-   "((function trunc\n"
-   "   (signature float\n"
-   "     (parameters\n"
-   "       (declare (in) float arg0))\n"
-   "     ((return (expression float trunc (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec2\n"
-   "     (parameters\n"
-   "       (declare (in) vec2 arg0))\n"
-   "     ((return (expression vec2 trunc (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec3\n"
-   "     (parameters\n"
-   "       (declare (in) vec3 arg0))\n"
-   "     ((return (expression vec3 trunc (var_ref arg0)))))\n"
-   "\n"
-   "   (signature vec4\n"
-   "     (parameters\n"
-   "       (declare (in) vec4 arg0))\n"
-   "     ((return (expression vec4 trunc (var_ref arg0)))))\n"
-   "))\n"
-   ""
-;
-static const char prototypes_for_100_frag[] =
-   "(\n"
-   "(function radians\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float degrees))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 degrees))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 degrees))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 degrees))\n"
-   "    ()))\n"
-   "(function degrees\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float radians))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 radians))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 radians))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 radians))\n"
-   "    ()))\n"
-   "(function sin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function cos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function tan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function asin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function acos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function atan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y_over_x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y_over_x))\n"
-   "    ()))\n"
-   "(function pow\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function exp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function exp2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function inversesqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function abs\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sign\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function floor\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ceil\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function fract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function mod\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function min\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function max\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function clamp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 minVal)\n"
-   "      (declare (in) vec2 maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 minVal)\n"
-   "      (declare (in) vec3 maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 minVal)\n"
-   "      (declare (in) vec4 maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ()))\n"
-   "(function mix\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) float a))\n"
-   "    ()))\n"
-   "(function step\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function smoothstep\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge0)\n"
-   "      (declare (in) vec2 edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge0)\n"
-   "      (declare (in) vec3 edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge0)\n"
-   "      (declare (in) vec4 edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function length\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function distance\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p0)\n"
-   "      (declare (in) float p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p0)\n"
-   "      (declare (in) vec2 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p0)\n"
-   "      (declare (in) vec3 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p0)\n"
-   "      (declare (in) vec4 p1))\n"
-   "    ()))\n"
-   "(function dot\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function cross\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ()))\n"
-   "(function normalize\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function faceforward\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float Nref))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 Nref))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 Nref))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 Nref))\n"
-   "    ()))\n"
-   "(function reflect\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N))\n"
-   "    ()))\n"
-   "(function refract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ()))\n"
-   "(function matrixCompMult\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 x)\n"
-   "      (declare (in) mat2 y))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 x)\n"
-   "      (declare (in) mat3 y))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 x)\n"
-   "      (declare (in) mat4 y))\n"
-   "    ()))\n"
-   "(function lessThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function lessThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function equal\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function notEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function any\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function all\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function not\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function textureCube\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ())))"
-;
-static const char *functions_for_100_frag [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_atan,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cross,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_sign,
-   builtin_sin,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_texture2D,
-   builtin_texture2DProj,
-   builtin_textureCube,
-};
-static const char prototypes_for_100_vert[] =
-   "(\n"
-   "(function radians\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float degrees))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 degrees))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 degrees))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 degrees))\n"
-   "    ()))\n"
-   "(function degrees\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float radians))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 radians))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 radians))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 radians))\n"
-   "    ()))\n"
-   "(function sin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function cos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function tan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function asin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function acos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function atan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y_over_x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y_over_x))\n"
-   "    ()))\n"
-   "(function pow\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function exp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function exp2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function inversesqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function abs\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sign\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function floor\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ceil\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function fract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function mod\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function min\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function max\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function clamp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 minVal)\n"
-   "      (declare (in) vec2 maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 minVal)\n"
-   "      (declare (in) vec3 maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 minVal)\n"
-   "      (declare (in) vec4 maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ()))\n"
-   "(function mix\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) float a))\n"
-   "    ()))\n"
-   "(function step\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function smoothstep\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge0)\n"
-   "      (declare (in) vec2 edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge0)\n"
-   "      (declare (in) vec3 edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge0)\n"
-   "      (declare (in) vec4 edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function length\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function distance\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p0)\n"
-   "      (declare (in) float p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p0)\n"
-   "      (declare (in) vec2 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p0)\n"
-   "      (declare (in) vec3 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p0)\n"
-   "      (declare (in) vec4 p1))\n"
-   "    ()))\n"
-   "(function dot\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function cross\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ()))\n"
-   "(function normalize\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function faceforward\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float Nref))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 Nref))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 Nref))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 Nref))\n"
-   "    ()))\n"
-   "(function reflect\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N))\n"
-   "    ()))\n"
-   "(function refract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ()))\n"
-   "(function matrixCompMult\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 x)\n"
-   "      (declare (in) mat2 y))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 x)\n"
-   "      (declare (in) mat3 y))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 x)\n"
-   "      (declare (in) mat4 y))\n"
-   "    ()))\n"
-   "(function lessThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function lessThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function equal\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function notEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function any\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function all\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function not\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function texture2DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture2DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function textureCube\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function textureCubeLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ())))"
-;
-static const char *functions_for_100_vert [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_atan,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cross,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_sign,
-   builtin_sin,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_texture2D,
-   builtin_texture2DLod,
-   builtin_texture2DProj,
-   builtin_texture2DProjLod,
-   builtin_textureCube,
-   builtin_textureCubeLod,
-};
-static const char prototypes_for_110_frag[] =
-   "(\n"
-   "(function radians\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float degrees))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 degrees))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 degrees))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 degrees))\n"
-   "    ()))\n"
-   "(function degrees\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float radians))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 radians))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 radians))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 radians))\n"
-   "    ()))\n"
-   "(function sin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function cos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function tan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function asin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function acos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function atan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y_over_x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y_over_x))\n"
-   "    ()))\n"
-   "(function pow\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function exp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function exp2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function inversesqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function abs\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sign\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function floor\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ceil\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function fract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function mod\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function min\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function max\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function clamp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 minVal)\n"
-   "      (declare (in) vec2 maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 minVal)\n"
-   "      (declare (in) vec3 maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 minVal)\n"
-   "      (declare (in) vec4 maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ()))\n"
-   "(function mix\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) float a))\n"
-   "    ()))\n"
-   "(function step\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function smoothstep\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge0)\n"
-   "      (declare (in) vec2 edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge0)\n"
-   "      (declare (in) vec3 edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge0)\n"
-   "      (declare (in) vec4 edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function length\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function distance\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p0)\n"
-   "      (declare (in) float p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p0)\n"
-   "      (declare (in) vec2 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p0)\n"
-   "      (declare (in) vec3 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p0)\n"
-   "      (declare (in) vec4 p1))\n"
-   "    ()))\n"
-   "(function dot\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function cross\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ()))\n"
-   "(function normalize\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function faceforward\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float Nref))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 Nref))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 Nref))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 Nref))\n"
-   "    ()))\n"
-   "(function reflect\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N))\n"
-   "    ()))\n"
-   "(function refract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ()))\n"
-   "(function matrixCompMult\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 x)\n"
-   "      (declare (in) mat2 y))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 x)\n"
-   "      (declare (in) mat3 y))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 x)\n"
-   "      (declare (in) mat4 y))\n"
-   "    ()))\n"
-   "(function lessThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function lessThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function equal\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function notEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function any\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function all\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function not\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function texture1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture3D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture3DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function textureCube\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function dFdx\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p))\n"
-   "    ()))\n"
-   "(function dFdy\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p))\n"
-   "    ()))\n"
-   "(function fwidth\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p))\n"
-   "    ()))\n"
-   "(function noise1\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise2\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise3\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise4\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())))"
-;
-static const char *functions_for_110_frag [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_atan,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cross,
-   builtin_dFdx,
-   builtin_dFdy,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_fwidth,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_noise1,
-   builtin_noise2,
-   builtin_noise3,
-   builtin_noise4,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_shadow1D,
-   builtin_shadow1DProj,
-   builtin_shadow2D,
-   builtin_shadow2DProj,
-   builtin_sign,
-   builtin_sin,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_texture1D,
-   builtin_texture1DProj,
-   builtin_texture2D,
-   builtin_texture2DProj,
-   builtin_texture3D,
-   builtin_texture3DProj,
-   builtin_textureCube,
-};
-static const char prototypes_for_110_vert[] =
-   "(\n"
-   "(function radians\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float degrees))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 degrees))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 degrees))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 degrees))\n"
-   "    ()))\n"
-   "(function degrees\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float radians))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 radians))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 radians))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 radians))\n"
-   "    ()))\n"
-   "(function sin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function cos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function tan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function asin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function acos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function atan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y_over_x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y_over_x))\n"
-   "    ()))\n"
-   "(function pow\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function exp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function exp2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function inversesqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function abs\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sign\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function floor\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ceil\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function fract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function mod\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function min\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function max\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function clamp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 minVal)\n"
-   "      (declare (in) vec2 maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 minVal)\n"
-   "      (declare (in) vec3 maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 minVal)\n"
-   "      (declare (in) vec4 maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ()))\n"
-   "(function mix\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) float a))\n"
-   "    ()))\n"
-   "(function step\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function smoothstep\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge0)\n"
-   "      (declare (in) vec2 edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge0)\n"
-   "      (declare (in) vec3 edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge0)\n"
-   "      (declare (in) vec4 edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function length\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function distance\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p0)\n"
-   "      (declare (in) float p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p0)\n"
-   "      (declare (in) vec2 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p0)\n"
-   "      (declare (in) vec3 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p0)\n"
-   "      (declare (in) vec4 p1))\n"
-   "    ()))\n"
-   "(function dot\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function cross\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ()))\n"
-   "(function normalize\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ftransform\n"
-   "  (signature vec4\n"
-   "    (parameters)\n"
-   "    ()))\n"
-   "(function faceforward\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float Nref))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 Nref))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 Nref))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 Nref))\n"
-   "    ()))\n"
-   "(function reflect\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N))\n"
-   "    ()))\n"
-   "(function refract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ()))\n"
-   "(function matrixCompMult\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 x)\n"
-   "      (declare (in) mat2 y))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 x)\n"
-   "      (declare (in) mat3 y))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 x)\n"
-   "      (declare (in) mat4 y))\n"
-   "    ()))\n"
-   "(function lessThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function lessThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function equal\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function notEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function any\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function all\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function not\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function texture1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord))\n"
-   "    ()))\n"
-   "(function texture1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function texture1DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture1DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function texture2DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture2DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture3D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function texture3DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function texture3DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture3DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function textureCube\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function textureCubeLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function shadow2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function shadow1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function shadow2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function shadow1DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow2DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow1DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow2DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function noise1\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise2\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise3\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise4\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())))"
-;
-static const char *functions_for_110_vert [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_atan,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cross,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_ftransform,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_noise1,
-   builtin_noise2,
-   builtin_noise3,
-   builtin_noise4,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_shadow1D,
-   builtin_shadow1DLod,
-   builtin_shadow1DProj,
-   builtin_shadow1DProjLod,
-   builtin_shadow2D,
-   builtin_shadow2DLod,
-   builtin_shadow2DProj,
-   builtin_shadow2DProjLod,
-   builtin_sign,
-   builtin_sin,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_texture1D,
-   builtin_texture1DLod,
-   builtin_texture1DProj,
-   builtin_texture1DProjLod,
-   builtin_texture2D,
-   builtin_texture2DLod,
-   builtin_texture2DProj,
-   builtin_texture2DProjLod,
-   builtin_texture3D,
-   builtin_texture3DLod,
-   builtin_texture3DProj,
-   builtin_texture3DProjLod,
-   builtin_textureCube,
-   builtin_textureCubeLod,
-};
-static const char prototypes_for_120_frag[] =
-   "(\n"
-   "(function radians\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float degrees))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 degrees))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 degrees))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 degrees))\n"
-   "    ()))\n"
-   "(function degrees\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float radians))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 radians))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 radians))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 radians))\n"
-   "    ()))\n"
-   "(function sin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function cos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function tan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function asin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function acos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function atan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y_over_x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y_over_x))\n"
-   "    ()))\n"
-   "(function pow\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function exp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function exp2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function inversesqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function abs\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sign\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function floor\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ceil\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function fract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function mod\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function min\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function max\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function clamp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 minVal)\n"
-   "      (declare (in) vec2 maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 minVal)\n"
-   "      (declare (in) vec3 maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 minVal)\n"
-   "      (declare (in) vec4 maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ()))\n"
-   "(function mix\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) float a))\n"
-   "    ()))\n"
-   "(function step\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function smoothstep\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge0)\n"
-   "      (declare (in) vec2 edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge0)\n"
-   "      (declare (in) vec3 edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge0)\n"
-   "      (declare (in) vec4 edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function length\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function distance\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p0)\n"
-   "      (declare (in) float p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p0)\n"
-   "      (declare (in) vec2 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p0)\n"
-   "      (declare (in) vec3 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p0)\n"
-   "      (declare (in) vec4 p1))\n"
-   "    ()))\n"
-   "(function dot\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function cross\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ()))\n"
-   "(function normalize\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function faceforward\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float Nref))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 Nref))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 Nref))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 Nref))\n"
-   "    ()))\n"
-   "(function reflect\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N))\n"
-   "    ()))\n"
-   "(function refract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ()))\n"
-   "(function matrixCompMult\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 x)\n"
-   "      (declare (in) mat2 y))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 x)\n"
-   "      (declare (in) mat3 y))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 x)\n"
-   "      (declare (in) mat4 y))\n"
-   "    ())\n"
-   "  (signature mat2x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x3 x)\n"
-   "      (declare (in) mat2x3 y))\n"
-   "    ())\n"
-   "  (signature mat2x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x4 x)\n"
-   "      (declare (in) mat2x4 y))\n"
-   "    ())\n"
-   "  (signature mat3x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x2 x)\n"
-   "      (declare (in) mat3x2 y))\n"
-   "    ())\n"
-   "  (signature mat3x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x4 x)\n"
-   "      (declare (in) mat3x4 y))\n"
-   "    ())\n"
-   "  (signature mat4x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x2 x)\n"
-   "      (declare (in) mat4x2 y))\n"
-   "    ())\n"
-   "  (signature mat4x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x3 x)\n"
-   "      (declare (in) mat4x3 y))\n"
-   "    ()))\n"
-   "(function outerProduct\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 c)\n"
-   "      (declare (in) vec2 r))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 c)\n"
-   "      (declare (in) vec3 r))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 c)\n"
-   "      (declare (in) vec4 r))\n"
-   "    ())\n"
-   "  (signature mat2x3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 c)\n"
-   "      (declare (in) vec2 r))\n"
-   "    ())\n"
-   "  (signature mat3x2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 c)\n"
-   "      (declare (in) vec3 r))\n"
-   "    ())\n"
-   "  (signature mat2x4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 c)\n"
-   "      (declare (in) vec2 r))\n"
-   "    ())\n"
-   "  (signature mat4x2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 c)\n"
-   "      (declare (in) vec4 r))\n"
-   "    ())\n"
-   "  (signature mat3x4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 c)\n"
-   "      (declare (in) vec3 r))\n"
-   "    ())\n"
-   "  (signature mat4x3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 c)\n"
-   "      (declare (in) vec4 r))\n"
-   "    ()))\n"
-   "(function transpose\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 m))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 m))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 m))\n"
-   "    ())\n"
-   "  (signature mat2x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x2 m))\n"
-   "    ())\n"
-   "  (signature mat3x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x3 m))\n"
-   "    ())\n"
-   "  (signature mat2x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x2 m))\n"
-   "    ())\n"
-   "  (signature mat4x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x4 m))\n"
-   "    ())\n"
-   "  (signature mat3x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x3 m))\n"
-   "    ())\n"
-   "  (signature mat4x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x4 m))\n"
-   "    ()))\n"
-   "(function lessThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function lessThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function equal\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function notEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function any\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function all\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function not\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function texture1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture3D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture3DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function textureCube\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function dFdx\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p))\n"
-   "    ()))\n"
-   "(function dFdy\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p))\n"
-   "    ()))\n"
-   "(function fwidth\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p))\n"
-   "    ()))\n"
-   "(function noise1\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise2\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise3\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise4\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())))"
-;
-static const char *functions_for_120_frag [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_atan,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cross,
-   builtin_dFdx,
-   builtin_dFdy,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_fwidth,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_noise1,
-   builtin_noise2,
-   builtin_noise3,
-   builtin_noise4,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_outerProduct,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_shadow1D,
-   builtin_shadow1DProj,
-   builtin_shadow2D,
-   builtin_shadow2DProj,
-   builtin_sign,
-   builtin_sin,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_texture1D,
-   builtin_texture1DProj,
-   builtin_texture2D,
-   builtin_texture2DProj,
-   builtin_texture3D,
-   builtin_texture3DProj,
-   builtin_textureCube,
-   builtin_transpose,
-};
-static const char prototypes_for_120_vert[] =
-   "(\n"
-   "(function radians\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float degrees))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 degrees))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 degrees))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 degrees))\n"
-   "    ()))\n"
-   "(function degrees\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float radians))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 radians))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 radians))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 radians))\n"
-   "    ()))\n"
-   "(function sin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function cos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function tan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function asin\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function acos\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float angle))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 angle))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 angle))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 angle))\n"
-   "    ()))\n"
-   "(function atan\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float y_over_x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 y_over_x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 y_over_x))\n"
-   "    ()))\n"
-   "(function pow\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function exp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function exp2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function log2\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function inversesqrt\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function abs\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function sign\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function floor\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ceil\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function fract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function mod\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function min\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function max\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float y))\n"
-   "    ()))\n"
-   "(function clamp\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 minVal)\n"
-   "      (declare (in) vec2 maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 minVal)\n"
-   "      (declare (in) vec3 maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 minVal)\n"
-   "      (declare (in) vec4 maxVal))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) float minVal)\n"
-   "      (declare (in) float maxVal))\n"
-   "    ()))\n"
-   "(function mix\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) vec2 a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) vec3 a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) vec4 a))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y)\n"
-   "      (declare (in) float a))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y)\n"
-   "      (declare (in) float a))\n"
-   "    ()))\n"
-   "(function step\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function smoothstep\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 edge0)\n"
-   "      (declare (in) vec2 edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 edge0)\n"
-   "      (declare (in) vec3 edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 edge0)\n"
-   "      (declare (in) vec4 edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float edge0)\n"
-   "      (declare (in) float edge1)\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function length\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function distance\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float p0)\n"
-   "      (declare (in) float p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 p0)\n"
-   "      (declare (in) vec2 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 p0)\n"
-   "      (declare (in) vec3 p1))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 p0)\n"
-   "      (declare (in) vec4 p1))\n"
-   "    ()))\n"
-   "(function dot\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x)\n"
-   "      (declare (in) float y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ()))\n"
-   "(function cross\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ()))\n"
-   "(function normalize\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function ftransform\n"
-   "  (signature vec4\n"
-   "    (parameters)\n"
-   "    ()))\n"
-   "(function faceforward\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float Nref))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 Nref))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 Nref))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 Nref))\n"
-   "    ()))\n"
-   "(function reflect\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N))\n"
-   "    ()))\n"
-   "(function refract\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float I)\n"
-   "      (declare (in) float N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 I)\n"
-   "      (declare (in) vec2 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 I)\n"
-   "      (declare (in) vec3 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 I)\n"
-   "      (declare (in) vec4 N)\n"
-   "      (declare (in) float eta))\n"
-   "    ()))\n"
-   "(function matrixCompMult\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 x)\n"
-   "      (declare (in) mat2 y))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 x)\n"
-   "      (declare (in) mat3 y))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 x)\n"
-   "      (declare (in) mat4 y))\n"
-   "    ())\n"
-   "  (signature mat2x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x3 x)\n"
-   "      (declare (in) mat2x3 y))\n"
-   "    ())\n"
-   "  (signature mat2x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x4 x)\n"
-   "      (declare (in) mat2x4 y))\n"
-   "    ())\n"
-   "  (signature mat3x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x2 x)\n"
-   "      (declare (in) mat3x2 y))\n"
-   "    ())\n"
-   "  (signature mat3x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x4 x)\n"
-   "      (declare (in) mat3x4 y))\n"
-   "    ())\n"
-   "  (signature mat4x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x2 x)\n"
-   "      (declare (in) mat4x2 y))\n"
-   "    ())\n"
-   "  (signature mat4x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x3 x)\n"
-   "      (declare (in) mat4x3 y))\n"
-   "    ()))\n"
-   "(function outerProduct\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 c)\n"
-   "      (declare (in) vec2 r))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 c)\n"
-   "      (declare (in) vec3 r))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 c)\n"
-   "      (declare (in) vec4 r))\n"
-   "    ())\n"
-   "  (signature mat2x3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 c)\n"
-   "      (declare (in) vec2 r))\n"
-   "    ())\n"
-   "  (signature mat3x2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 c)\n"
-   "      (declare (in) vec3 r))\n"
-   "    ())\n"
-   "  (signature mat2x4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 c)\n"
-   "      (declare (in) vec2 r))\n"
-   "    ())\n"
-   "  (signature mat4x2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 c)\n"
-   "      (declare (in) vec4 r))\n"
-   "    ())\n"
-   "  (signature mat3x4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 c)\n"
-   "      (declare (in) vec3 r))\n"
-   "    ())\n"
-   "  (signature mat4x3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 c)\n"
-   "      (declare (in) vec4 r))\n"
-   "    ()))\n"
-   "(function transpose\n"
-   "  (signature mat2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2 m))\n"
-   "    ())\n"
-   "  (signature mat3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3 m))\n"
-   "    ())\n"
-   "  (signature mat4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4 m))\n"
-   "    ())\n"
-   "  (signature mat2x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x2 m))\n"
-   "    ())\n"
-   "  (signature mat3x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x3 m))\n"
-   "    ())\n"
-   "  (signature mat2x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x2 m))\n"
-   "    ())\n"
-   "  (signature mat4x2\n"
-   "    (parameters\n"
-   "      (declare (in) mat2x4 m))\n"
-   "    ())\n"
-   "  (signature mat3x4\n"
-   "    (parameters\n"
-   "      (declare (in) mat4x3 m))\n"
-   "    ())\n"
-   "  (signature mat4x3\n"
-   "    (parameters\n"
-   "      (declare (in) mat3x4 m))\n"
-   "    ()))\n"
-   "(function lessThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function lessThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThan\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function greaterThanEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ()))\n"
-   "(function equal\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function notEqual\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x)\n"
-   "      (declare (in) vec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x)\n"
-   "      (declare (in) vec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x)\n"
-   "      (declare (in) vec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) ivec2 x)\n"
-   "      (declare (in) ivec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) ivec3 x)\n"
-   "      (declare (in) ivec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) ivec4 x)\n"
-   "      (declare (in) ivec4 y))\n"
-   "    ())\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x)\n"
-   "      (declare (in) bvec2 y))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x)\n"
-   "      (declare (in) bvec3 y))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x)\n"
-   "      (declare (in) bvec4 y))\n"
-   "    ()))\n"
-   "(function any\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function all\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bool\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function not\n"
-   "  (signature bvec2\n"
-   "    (parameters\n"
-   "      (declare (in) bvec2 x))\n"
-   "    ())\n"
-   "  (signature bvec3\n"
-   "    (parameters\n"
-   "      (declare (in) bvec3 x))\n"
-   "    ())\n"
-   "  (signature bvec4\n"
-   "    (parameters\n"
-   "      (declare (in) bvec4 x))\n"
-   "    ()))\n"
-   "(function texture1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord))\n"
-   "    ()))\n"
-   "(function texture1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function texture1DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) float coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture1DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function texture2DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture2DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture3D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function texture3DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function texture3DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture3DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler3D sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function textureCube\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function textureCubeLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) samplerCube sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow1D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function shadow2D\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function shadow1DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function shadow2DProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function shadow1DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow2DLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow1DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow2DProjLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DShadow sampler)\n"
-   "      (declare (in) vec4 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function noise1\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature float\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise2\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec2\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise3\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec3\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ()))\n"
-   "(function noise4\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) float x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec2 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec3 x))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) vec4 x))\n"
-   "    ())))"
-;
-static const char *functions_for_120_vert [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_atan,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cross,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_ftransform,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_noise1,
-   builtin_noise2,
-   builtin_noise3,
-   builtin_noise4,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_outerProduct,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_shadow1D,
-   builtin_shadow1DLod,
-   builtin_shadow1DProj,
-   builtin_shadow1DProjLod,
-   builtin_shadow2D,
-   builtin_shadow2DLod,
-   builtin_shadow2DProj,
-   builtin_shadow2DProjLod,
-   builtin_sign,
-   builtin_sin,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_texture1D,
-   builtin_texture1DLod,
-   builtin_texture1DProj,
-   builtin_texture1DProjLod,
-   builtin_texture2D,
-   builtin_texture2DLod,
-   builtin_texture2DProj,
-   builtin_texture2DProjLod,
-   builtin_texture3D,
-   builtin_texture3DLod,
-   builtin_texture3DProj,
-   builtin_texture3DProjLod,
-   builtin_textureCube,
-   builtin_textureCubeLod,
-   builtin_transpose,
-};
-static const char prototypes_for_130_frag[] =
-{'(',
-'(','f','u','n','c','t','i','o','n',' ','r','a','d','i','a','n','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','e','g','r','e','e','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','i','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','o','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','s','i','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','c','o','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','t','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','i','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','o','s','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','a','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','s','i','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','c','o','s','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','t','a','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','p','o','w',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','e','x','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','o','g',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','e','x','p','2',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','o','g','2',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','q','r','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','i','n','v','e','r','s','e','s','q','r','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','b','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','i','g','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','l','o','o','r',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','r','u','n','c',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','o','u','n','d',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','o','u','n','d','E','v','e','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','e','i','l',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','r','a','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','o','d','f',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','f','l','o','a','t',' ','i',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','v','e','c','2',' ','i',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','v','e','c','3',' ','i',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','v','e','c','4',' ','i',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','i','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','a','x',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','l','a','m','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','i','x',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','t','e','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','m','o','o','t','h','s','t','e','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','e','n','g','t','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','i','s','t','a','n','c','e',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','p','1',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','p','1',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','p','1',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','p','1',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','o','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','r','o','s','s',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','r','m','a','l','i','z','e',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','a','c','e','f','o','r','w','a','r','d',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N','r','e','f',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N','r','e','f',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N','r','e','f',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N','r','e','f',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','e','f','l','e','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','e','f','r','a','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','a','t','r','i','x','C','o','m','p','M','u','l','t',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','3',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','o','u','t','e','r','P','r','o','d','u','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','r','a','n','s','p','o','s','e',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','2',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','3',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','2',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','4',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','3',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','4',' ','m',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','e','s','s','T','h','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','e','s','s','T','h','a','n','E','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','g','r','e','a','t','e','r','T','h','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','g','r','e','a','t','e','r','T','h','a','n','E','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','e','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','t','E','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','n','y',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','l','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','t',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','e','l','F','e','t','c','h',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','G','r','a','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','P','r','o','j','G','r','a','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','C','u','b','e',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','C','u','b','e','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','F','d','x',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','p',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','F','d','y',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','p',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','w','i','d','t','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','p',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','p',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','1',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','2',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','3',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','4',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',')'} ;
-static const char *functions_for_130_frag [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_acosh,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_asinh,
-   builtin_atan,
-   builtin_atanh,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cosh,
-   builtin_cross,
-   builtin_dFdx,
-   builtin_dFdy,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_fwidth,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_modf,
-   builtin_noise1,
-   builtin_noise2,
-   builtin_noise3,
-   builtin_noise4,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_outerProduct,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_round,
-   builtin_roundEven,
-   builtin_shadow1D,
-   builtin_shadow1DLod,
-   builtin_shadow1DProj,
-   builtin_shadow1DProjLod,
-   builtin_shadow2D,
-   builtin_shadow2DLod,
-   builtin_shadow2DProj,
-   builtin_shadow2DProjLod,
-   builtin_sign,
-   builtin_sin,
-   builtin_sinh,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_tanh,
-   builtin_texelFetch,
-   builtin_texture,
-   builtin_texture1D,
-   builtin_texture1DLod,
-   builtin_texture1DProj,
-   builtin_texture1DProjLod,
-   builtin_texture2D,
-   builtin_texture2DLod,
-   builtin_texture2DProj,
-   builtin_texture2DProjLod,
-   builtin_texture3D,
-   builtin_texture3DLod,
-   builtin_texture3DProj,
-   builtin_texture3DProjLod,
-   builtin_textureCube,
-   builtin_textureCubeLod,
-   builtin_textureGrad,
-   builtin_textureLod,
-   builtin_textureProj,
-   builtin_textureProjGrad,
-   builtin_textureProjLod,
-   builtin_transpose,
-   builtin_trunc,
-};
-static const char prototypes_for_130_vert[] =
-{'(',
-'(','f','u','n','c','t','i','o','n',' ','r','a','d','i','a','n','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','d','e','g','r','e','e','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','e','g','r','e','e','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r','a','d','i','a','n','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','i','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','o','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','s','i','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','c','o','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a','n','g','l','e',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a','n','g','l','e',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','t','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y','_','o','v','e','r','_','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','i','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','o','s','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','a','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','s','i','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','c','o','s','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','t','a','n','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','p','o','w',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','e','x','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','o','g',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','e','x','p','2',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','o','g','2',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','q','r','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','i','n','v','e','r','s','e','s','q','r','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','b','s',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','i','g','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','l','o','o','r',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','r','u','n','c',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','o','u','n','d',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','o','u','n','d','E','v','e','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','e','i','l',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','r','a','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','o','d','f',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','f','l','o','a','t',' ','i',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','v','e','c','2',' ','i',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','v','e','c','3',' ','i',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','o','u','t',')',' ','v','e','c','4',' ','i',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','i','n',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','a','x',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','l','a','m','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','i','n','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','i','n','V','a','l',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','i','n','t',' ','m','a','x','V','a','l',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','i','x',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','a',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','t','e','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','m','o','o','t','h','s','t','e','p',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','d','g','e','1',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','e','n','g','t','h',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','i','s','t','a','n','c','e',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','p','1',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','p','1',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','p','1',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','p','0',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','p','1',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','d','o','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','c','r','o','s','s',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','r','m','a','l','i','z','e',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','t','r','a','n','s','f','o','r','m',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','f','a','c','e','f','o','r','w','a','r','d',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N','r','e','f',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N','r','e','f',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N','r','e','f',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N','r','e','f',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','e','f','l','e','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','r','e','f','r','a','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','I',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','N',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','e','t','a',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','m','a','t','r','i','x','C','o','m','p','M','u','l','t',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','3',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','o','u','t','e','r','P','r','o','d','u','c','t',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','r',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','r',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','r','a','n','s','p','o','s','e',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','2',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','3',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','2','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','2',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','2','x','4',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','3','x','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','4','x','3',' ','m',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','m','a','t','4','x','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','m','a','t','3','x','4',' ','m',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','e','s','s','T','h','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','l','e','s','s','T','h','a','n','E','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','g','r','e','a','t','e','r','T','h','a','n',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','g','r','e','a','t','e','r','T','h','a','n','E','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','e','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','t','E','q','u','a','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','v','e','c','4',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','n','y',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','a','l','l',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','o','o','l',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','t',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','b','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','b','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','e','l','F','e','t','c','h',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','n','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','G','r','a','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D','A','r','r','a','y',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','A','r','r','a','y','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','P','r','o','j','G','r','a','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','i','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','i','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','u','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','u','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','d','P','d','y',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','P',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','x',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','d','P','d','y',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','1','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','2','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','3','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','3','D',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','C','u','b','e',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','t','e','x','t','u','r','e','C','u','b','e','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','C','u','b','e',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D','P','r','o','j',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','b','i','a','s',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','1','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','1','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','s','h','a','d','o','w','2','D','P','r','o','j','L','o','d',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','s','a','m','p','l','e','r','2','D','S','h','a','d','o','w',' ','s','a','m','p','l','e','r',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','c','o','o','r','d',')',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','l','o','d',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','1',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','f','l','o','a','t',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','2',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','2',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','3',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','3',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',
-'(','f','u','n','c','t','i','o','n',' ','n','o','i','s','e','4',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','f','l','o','a','t',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','2',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','3',' ','x',')',')',' ','(',')',')',' ','(','s','i','g','n','a','t','u','r','e',' ','v','e','c','4',' ','(','p','a','r','a','m','e','t','e','r','s',' ','(','d','e','c','l','a','r','e',' ','(','i','n',')',' ','v','e','c','4',' ','x',')',')',' ','(',')',')',')',')'} ;
-static const char *functions_for_130_vert [] = {
-   builtin_abs,
-   builtin_acos,
-   builtin_acosh,
-   builtin_all,
-   builtin_any,
-   builtin_asin,
-   builtin_asinh,
-   builtin_atan,
-   builtin_atanh,
-   builtin_ceil,
-   builtin_clamp,
-   builtin_cos,
-   builtin_cosh,
-   builtin_cross,
-   builtin_degrees,
-   builtin_distance,
-   builtin_dot,
-   builtin_equal,
-   builtin_exp,
-   builtin_exp2,
-   builtin_faceforward,
-   builtin_floor,
-   builtin_fract,
-   builtin_ftransform,
-   builtin_greaterThan,
-   builtin_greaterThanEqual,
-   builtin_inversesqrt,
-   builtin_length,
-   builtin_lessThan,
-   builtin_lessThanEqual,
-   builtin_log,
-   builtin_log2,
-   builtin_matrixCompMult,
-   builtin_max,
-   builtin_min,
-   builtin_mix,
-   builtin_mod,
-   builtin_modf,
-   builtin_noise1,
-   builtin_noise2,
-   builtin_noise3,
-   builtin_noise4,
-   builtin_normalize,
-   builtin_not,
-   builtin_notEqual,
-   builtin_outerProduct,
-   builtin_pow,
-   builtin_radians,
-   builtin_reflect,
-   builtin_refract,
-   builtin_round,
-   builtin_roundEven,
-   builtin_shadow1D,
-   builtin_shadow1DLod,
-   builtin_shadow1DProj,
-   builtin_shadow1DProjLod,
-   builtin_shadow2D,
-   builtin_shadow2DLod,
-   builtin_shadow2DProj,
-   builtin_shadow2DProjLod,
-   builtin_sign,
-   builtin_sin,
-   builtin_sinh,
-   builtin_smoothstep,
-   builtin_sqrt,
-   builtin_step,
-   builtin_tan,
-   builtin_tanh,
-   builtin_texelFetch,
-   builtin_texture,
-   builtin_texture1D,
-   builtin_texture1DLod,
-   builtin_texture1DProj,
-   builtin_texture1DProjLod,
-   builtin_texture2D,
-   builtin_texture2DLod,
-   builtin_texture2DProj,
-   builtin_texture2DProjLod,
-   builtin_texture3D,
-   builtin_texture3DLod,
-   builtin_texture3DProj,
-   builtin_texture3DProjLod,
-   builtin_textureCube,
-   builtin_textureCubeLod,
-   builtin_textureGrad,
-   builtin_textureLod,
-   builtin_textureProj,
-   builtin_textureProjGrad,
-   builtin_textureProjLod,
-   builtin_transpose,
-   builtin_trunc,
-};
-static const char prototypes_for_ARB_texture_rectangle_frag[] =
-   "(\n"
-   "(function texture2DRect\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRect sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture2DRectProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRect sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRect sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function shadow2DRect\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRectShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function shadow2DRectProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRectShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())))"
-;
-static const char *functions_for_ARB_texture_rectangle_frag [] = {
-   builtin_shadow2DRect,
-   builtin_shadow2DRectProj,
-   builtin_texture2DRect,
-   builtin_texture2DRectProj,
-};
-static const char prototypes_for_ARB_texture_rectangle_vert[] =
-   "(\n"
-   "(function texture2DRect\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRect sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture2DRectProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRect sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRect sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ()))\n"
-   "(function shadow2DRect\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRectShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function shadow2DRectProj\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DRectShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())))"
-;
-static const char *functions_for_ARB_texture_rectangle_vert [] = {
-   builtin_shadow2DRect,
-   builtin_shadow2DRectProj,
-   builtin_texture2DRect,
-   builtin_texture2DRectProj,
-};
-static const char prototypes_for_EXT_texture_array_frag[] =
-   "(\n"
-   "(function texture1DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArray sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArray sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function texture2DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DArray sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DArray sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow1DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArrayShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ())\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArrayShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float bias))\n"
-   "    ()))\n"
-   "(function shadow2DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DArrayShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())))"
-;
-static const char *functions_for_EXT_texture_array_frag [] = {
-   builtin_shadow1DArray,
-   builtin_shadow2DArray,
-   builtin_texture1DArray,
-   builtin_texture2DArray,
-};
-static const char prototypes_for_EXT_texture_array_vert[] =
-   "(\n"
-   "(function texture1DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArray sampler)\n"
-   "      (declare (in) vec2 coord))\n"
-   "    ()))\n"
-   "(function texture1DArrayLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArray sampler)\n"
-   "      (declare (in) vec2 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function texture2DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DArray sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function texture2DArrayLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DArray sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow1DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArrayShadow sampler)\n"
-   "      (declare (in) vec3 coord))\n"
-   "    ()))\n"
-   "(function shadow1DArrayLod\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler1DArrayShadow sampler)\n"
-   "      (declare (in) vec3 coord)\n"
-   "      (declare (in) float lod))\n"
-   "    ()))\n"
-   "(function shadow2DArray\n"
-   "  (signature vec4\n"
-   "    (parameters\n"
-   "      (declare (in) sampler2DArrayShadow sampler)\n"
-   "      (declare (in) vec4 coord))\n"
-   "    ())))"
-;
-static const char *functions_for_EXT_texture_array_vert [] = {
-   builtin_shadow1DArray,
-   builtin_shadow1DArrayLod,
-   builtin_shadow2DArray,
-   builtin_texture1DArray,
-   builtin_texture1DArrayLod,
-   builtin_texture2DArray,
-   builtin_texture2DArrayLod,
-};
-static gl_shader *builtin_profiles[12];
-
-void *builtin_mem_ctx = NULL;
-
-void
-_mesa_glsl_release_functions(void)
-{
-   talloc_free(builtin_mem_ctx);
-   builtin_mem_ctx = NULL;
-   memset(builtin_profiles, 0, sizeof(builtin_profiles));
-}
-
-static void
-_mesa_read_profile(struct _mesa_glsl_parse_state *state,
-                  exec_list *instructions,
-                   int profile_index,
-                  const char *prototypes,
-                  const char **functions,
-                   int count)
-{
-   gl_shader *sh = builtin_profiles[profile_index];
-
-   if (sh == NULL) {
-      sh = read_builtins(GL_VERTEX_SHADER, prototypes, functions, count);
-      talloc_steal(builtin_mem_ctx, sh);
-      builtin_profiles[profile_index] = sh;
-   }
-
-   import_prototypes(sh->ir, instructions, state->symbols, state);
-   state->builtins_to_link[state->num_builtins_to_link] = sh;
-   state->num_builtins_to_link++;
-}
-
-void
-_mesa_glsl_initialize_functions(exec_list *instructions,
-                                struct _mesa_glsl_parse_state *state)
-{
-   if (builtin_mem_ctx == NULL) {
-      builtin_mem_ctx = talloc_init("GLSL built-in functions");
-      memset(&builtin_profiles, 0, sizeof(builtin_profiles));
-   }
-
-   state->num_builtins_to_link = 0;
-
-   if (state->target == fragment_shader && state->language_version == 100) {
-      _mesa_read_profile(state, instructions, 0,
-                         prototypes_for_100_frag,
-                         functions_for_100_frag,
-                         Elements(functions_for_100_frag));
-   }
-
-   if (state->target == vertex_shader && state->language_version == 100) {
-      _mesa_read_profile(state, instructions, 1,
-                         prototypes_for_100_vert,
-                         functions_for_100_vert,
-                         Elements(functions_for_100_vert));
-   }
-
-   if (state->target == fragment_shader && state->language_version == 110) {
-      _mesa_read_profile(state, instructions, 2,
-                         prototypes_for_110_frag,
-                         functions_for_110_frag,
-                         Elements(functions_for_110_frag));
-   }
-
-   if (state->target == vertex_shader && state->language_version == 110) {
-      _mesa_read_profile(state, instructions, 3,
-                         prototypes_for_110_vert,
-                         functions_for_110_vert,
-                         Elements(functions_for_110_vert));
-   }
-
-   if (state->target == fragment_shader && state->language_version == 120) {
-      _mesa_read_profile(state, instructions, 4,
-                         prototypes_for_120_frag,
-                         functions_for_120_frag,
-                         Elements(functions_for_120_frag));
-   }
-
-   if (state->target == vertex_shader && state->language_version == 120) {
-      _mesa_read_profile(state, instructions, 5,
-                         prototypes_for_120_vert,
-                         functions_for_120_vert,
-                         Elements(functions_for_120_vert));
-   }
-
-   if (state->target == fragment_shader && state->language_version == 130) {
-      _mesa_read_profile(state, instructions, 6,
-                         prototypes_for_130_frag,
-                         functions_for_130_frag,
-                         Elements(functions_for_130_frag));
-   }
-
-   if (state->target == vertex_shader && state->language_version == 130) {
-      _mesa_read_profile(state, instructions, 7,
-                         prototypes_for_130_vert,
-                         functions_for_130_vert,
-                         Elements(functions_for_130_vert));
-   }
-
-   if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) {
-      _mesa_read_profile(state, instructions, 8,
-                         prototypes_for_ARB_texture_rectangle_frag,
-                         functions_for_ARB_texture_rectangle_frag,
-                         Elements(functions_for_ARB_texture_rectangle_frag));
-   }
-
-   if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) {
-      _mesa_read_profile(state, instructions, 9,
-                         prototypes_for_ARB_texture_rectangle_vert,
-                         functions_for_ARB_texture_rectangle_vert,
-                         Elements(functions_for_ARB_texture_rectangle_vert));
-   }
-
-   if (state->target == fragment_shader && state->EXT_texture_array_enable) {
-      _mesa_read_profile(state, instructions, 10,
-                         prototypes_for_EXT_texture_array_frag,
-                         functions_for_EXT_texture_array_frag,
-                         Elements(functions_for_EXT_texture_array_frag));
-   }
-
-   if (state->target == vertex_shader && state->EXT_texture_array_enable) {
-      _mesa_read_profile(state, instructions, 11,
-                         prototypes_for_EXT_texture_array_vert,
-                         functions_for_EXT_texture_array_vert,
-                         Elements(functions_for_EXT_texture_array_vert));
-   }
-
-}
diff --git a/src/glsl/builtin_stubs.cpp b/src/glsl/builtin_stubs.cpp
new file mode 100644 (file)
index 0000000..00b3294
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright Â© 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdio.h>
+#include "glsl_parser_extras.h"
+
+/* A dummy file.  When compiling prototypes, we don't care about builtins.
+ * We really don't want to half-compile builtin_functions.cpp and fail, though.
+ */
+void
+_mesa_glsl_release_functions(void)
+{
+}
+
+void
+_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state)
+{
+}
index 443ae1606ed7f0dfac96948d6da35bf69c4cf0f1..8ccbf6e312f7b61b7cbcd1af8aca7bc7e4d6ae31 100644 (file)
 const glsl_type glsl_type::_error_type =
    glsl_type(GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0, "");
 
-const glsl_type glsl_type::void_type =
+const glsl_type glsl_type::_void_type =
    glsl_type(GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0, "void");
 
 const glsl_type *const glsl_type::error_type = & glsl_type::_error_type;
+const glsl_type *const glsl_type::void_type = & glsl_type::_void_type;
 
 /** \name Core built-in types
  *
index 3f97e0d46f1c5aacec99b6efcee5f4fa8799e590..cfecc1f1749717711ea50089fba8f0794df7085d 100644 (file)
     (
       (declare () float r)
       (if (expression bool > (expression float abs (var_ref x)) (constant float (0.000100))) (
-        (assign (constant bool (1)) (x) (var_ref r) (call atan ((expression float / (var_ref y) (var_ref x)))))
+        (assign (x) (var_ref r) (call atan ((expression float / (var_ref y) (var_ref x)))))
         (if (expression bool < (var_ref x) (constant float (0.000000)) ) (
           (if (expression bool >= (var_ref y) (constant float (0.000000)) )
-              ((assign (constant bool (1)) (x) (var_ref r) (expression float + (var_ref r) (constant float (3.141593)))))
-              ((assign (constant bool (1)) (x) (var_ref r) (expression float - (var_ref r) (constant float (3.141593))))))
+              ((assign (x) (var_ref r) (expression float + (var_ref r) (constant float (3.141593)))))
+              ((assign (x) (var_ref r) (expression float - (var_ref r) (constant float (3.141593))))))
         )
         (
         ))
       )
       (
         (declare () float sgn)
-        (assign (constant bool (1)) (x) (var_ref sgn) (expression float sign (var_ref y)))
-        (assign (constant bool (1)) (x) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))
+        (assign (x) (var_ref sgn) (expression float sign (var_ref y)))
+        (assign (x) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))
       ))
 
       (return (var_ref r) )
        (declare (in) vec2 y)
        (declare (in) vec2 x))
      ((declare () vec2 r)
-      (assign (constant bool (1)) (x) (var_ref r)
+      (assign (x) (var_ref r)
              (call atan ((swiz x (var_ref y))
                          (swiz x (var_ref x)))))
-      (assign (constant bool (1)) (y) (var_ref r)
+      (assign (y) (var_ref r)
              (call atan ((swiz y (var_ref y))
                          (swiz y (var_ref x)))))
       (return (var_ref r))))
        (declare (in) vec3 y)
        (declare (in) vec3 x))
      ((declare () vec3 r)
-      (assign (constant bool (1)) (x) (var_ref r)
+      (assign (x) (var_ref r)
              (call atan ((swiz x (var_ref y))
                          (swiz x (var_ref x)))))
-      (assign (constant bool (1)) (y) (var_ref r)
+      (assign (y) (var_ref r)
              (call atan ((swiz y (var_ref y))
                          (swiz y (var_ref x)))))
-      (assign (constant bool (1)) (z) (var_ref r)
+      (assign (z) (var_ref r)
              (call atan ((swiz z (var_ref y))
                          (swiz z (var_ref x)))))
       (return (var_ref r))))
        (declare (in) vec4 y)
        (declare (in) vec4 x))
      ((declare () vec4 r)
-      (assign (constant bool (1)) (x) (var_ref r)
+      (assign (x) (var_ref r)
              (call atan ((swiz x (var_ref y))
                          (swiz x (var_ref x)))))
-      (assign (constant bool (1)) (y) (var_ref r)
+      (assign (y) (var_ref r)
              (call atan ((swiz y (var_ref y))
                          (swiz y (var_ref x)))))
-      (assign (constant bool (1)) (z) (var_ref r)
+      (assign (z) (var_ref r)
              (call atan ((swiz z (var_ref y))
                          (swiz z (var_ref x)))))
-      (assign (constant bool (1)) (w) (var_ref r)
+      (assign (w) (var_ref r)
              (call atan ((swiz w (var_ref y))
                          (swiz w (var_ref x)))))
       (return (var_ref r)))))
index 7789ca6314dd860e2fd05134efeea4822b58747f..c249f8c99621b3adb4cdb7561dbe06feca45ef1d 100644 (file)
@@ -10,7 +10,7 @@
        (declare (in) vec2 p0)
        (declare (in) vec2 p1))
      ((declare () vec2 p)
-      (assign (constant bool (1)) (xy) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))
+      (assign (xy) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))
       (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
 
    (signature float
@@ -18,7 +18,7 @@
        (declare (in) vec3 p0)
        (declare (in) vec3 p1))
      ((declare () vec3 p)
-      (assign (constant bool (1)) (xyz) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))
+      (assign (xyz) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))
       (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
 
    (signature float
@@ -26,6 +26,6 @@
        (declare (in) vec4 p0)
        (declare (in) vec4 p1))
      ((declare () vec4 p)
-      (assign (constant bool (1)) (xyzw) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))
+      (assign (xyzw) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))
       (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
 ))
index 4be9b03e31e0786c00a789aaa96cb21b1316adb1..2400f11afadc431e38c6cba081600658dc9b1bfa 100644 (file)
@@ -4,8 +4,8 @@
        (declare (in) mat2 x)
        (declare (in) mat2 y))
      ((declare () mat2 z)
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
 (return (var_ref z))))
 
    (signature mat3
@@ -13,9 +13,9 @@
        (declare (in) mat3 x)
        (declare (in) mat3 y))
      ((declare () mat3 z)
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2)))  (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (2)))  (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
 (return (var_ref z))))
 
    (signature mat4
        (declare (in) mat4 x)
        (declare (in) mat4 y))
      ((declare () mat4 z)
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2)))  (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (3)))  (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (2)))  (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (3)))  (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
 (return (var_ref z))))
 
    (signature mat2x3
@@ -34,8 +34,8 @@
        (declare (in) mat2x3 x)
        (declare (in) mat2x3 y))
      ((declare () mat2x3 z)
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
 (return (var_ref z))))
 
    (signature mat3x2
@@ -43,9 +43,9 @@
        (declare (in) mat3x2 x)
        (declare (in) mat3x2 y))
      ((declare () mat3x2 z)
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2)))  (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (2)))  (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
 (return (var_ref z))))
 
    (signature mat2x4
@@ -53,8 +53,8 @@
        (declare (in) mat2x4 x)
        (declare (in) mat2x4 y))
      ((declare () mat2x4 z)
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
 (return (var_ref z))))
 
    (signature mat4x2
        (declare (in) mat4x2 x)
        (declare (in) mat4x2 y))
      ((declare () mat4x2 z)
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2)))  (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (3)))  (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (0)))  (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (1)))  (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (2)))  (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+      (assign (xy) (array_ref (var_ref z) (constant int (3)))  (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
 (return (var_ref z))))
 
    (signature mat3x4
@@ -73,9 +73,9 @@
        (declare (in) mat3x4 x)
        (declare (in) mat3x4 y))
      ((declare () mat3x4 z)
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2)))  (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (0)))  (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (1)))  (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xyzw) (array_ref (var_ref z) (constant int (2)))  (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
 (return (var_ref z))))
 
    (signature mat4x3
@@ -83,9 +83,9 @@
        (declare (in) mat4x3 x)
        (declare (in) mat4x3 y))
      ((declare () mat4x3 z)
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2)))  (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (3)))  (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (0)))  (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (1)))  (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (2)))  (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+      (assign (xyz) (array_ref (var_ref z) (constant int (3)))  (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
 (return (var_ref z))))
 ))
index 2b935a91a7cc75ee935a7f01eb65d98195c00f9e..f4f631567bdd9c465fe014bd4dbb1bb8a51da9db 100644 (file)
@@ -4,9 +4,8 @@
        (declare (in)  float x)
        (declare (out) float i))
      ((declare () float t)
-      (assign (constant bool (1)) (x) (var_ref t)
-                                      (expression float trunc (var_ref x)))
-      (assign (constant bool (1)) (x) (var_ref i) (var_ref t))
+      (assign (x) (var_ref t) (expression float trunc (var_ref x)))
+      (assign (x) (var_ref i) (var_ref t))
       (return (expression float - (var_ref x) (var_ref t)))))
 
    (signature vec2
@@ -14,9 +13,8 @@
        (declare (in)  vec2 x)
        (declare (out) vec2 i))
      ((declare () vec2 t)
-      (assign (constant bool (1)) (xy) (var_ref t)
-                                       (expression vec2 trunc (var_ref x)))
-      (assign (constant bool (1)) (xy) (var_ref i) (var_ref t))
+      (assign (xy) (var_ref t) (expression vec2 trunc (var_ref x)))
+      (assign (xy) (var_ref i) (var_ref t))
       (return (expression vec2 - (var_ref x) (var_ref t)))))
 
    (signature vec3
@@ -24,9 +22,8 @@
        (declare (in)  vec3 x)
        (declare (out) vec3 i))
      ((declare () vec3 t)
-      (assign (constant bool (1)) (xyz) (var_ref t)
-                                        (expression vec3 trunc (var_ref x)))
-      (assign (constant bool (1)) (xyz) (var_ref i) (var_ref t))
+      (assign (xyz) (var_ref t) (expression vec3 trunc (var_ref x)))
+      (assign (xyz) (var_ref i) (var_ref t))
       (return (expression vec3 - (var_ref x) (var_ref t)))))
 
    (signature vec4
@@ -34,8 +31,7 @@
        (declare (in)  vec4 x)
        (declare (out) vec4 i))
      ((declare () vec4 t)
-      (assign (constant bool (1)) (xyzw) (var_ref t)
-                                         (expression vec4 trunc (var_ref x)))
-      (assign (constant bool (1)) (xyzw) (var_ref i) (var_ref t))
+      (assign (xyzw) (var_ref t) (expression vec4 trunc (var_ref x)))
+      (assign (xyzw) (var_ref i) (var_ref t))
       (return (expression vec4 - (var_ref x) (var_ref t)))))
 ))
index 383fccfadfbe9e694ffca845adddd14cf9868c1b..d3366145fed9e75f145da1c58d1f70eff2735c84 100644 (file)
@@ -6,10 +6,10 @@
       (declare () float b)
       (declare () vec2 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
       (return (var_ref t))
     ))
 
       (declare () float b)
       (declare () vec2 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
       (return (var_ref t))
     ))
 
       (declare () float b)
       (declare () vec2 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
       (return (var_ref t))
     ))
 
       (declare () float b)
       (declare () vec2 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
       (return (var_ref t))
     ))
 ))
index ed7ad5190f2518d6badd37bae55473f7fb0631d6..1d8aa3f30d0ed6b2b9be50d339fefbff85993498 100644 (file)
@@ -7,13 +7,13 @@
       (declare () float c)
       (declare () vec3 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
-      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+      (assign (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
-      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
+      (assign (z) (var_ref t) (var_ref c))
       (return (var_ref t))
     ))
 
       (declare () float c)
       (declare () vec3 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
-      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
+      (assign (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
-      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
+      (assign (z) (var_ref t) (var_ref c))
       (return (var_ref t))
     ))
 
       (declare () float c)
       (declare () vec3 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
-      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
+      (assign (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
-      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
+      (assign (z) (var_ref t) (var_ref c))
       (return (var_ref t))
     ))
 
       (declare () float c)
       (declare () vec3 t)
 
-      (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
-      (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))
+      (assign (x) (var_ref a) (expression float noise (var_ref p)))
+      (assign (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
+      (assign (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref t) (var_ref a))
-      (assign (constant bool (1)) (y) (var_ref t) (var_ref b))
-      (assign (constant bool (1)) (z) (var_ref t) (var_ref c))
+      (assign (x) (var_ref t) (var_ref a))
+      (assign (y) (var_ref t) (var_ref b))
+      (assign (z) (var_ref t) (var_ref c))
       (return (var_ref t))
     ))
 ))
index 77a2529a180d39f813614c06bd20bfb62c1099b5..d0894fd5e3e0e7fadaf0d7c3360106609d9e734b 100644 (file)
@@ -9,17 +9,17 @@
       (declare () vec4 _r)
 
       (declare () vec4 _p)
-      (assign (constant bool (1)) (xyzw) (var_ref _p) (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0))) )
+      (assign (xyzw) (var_ref _p) (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0))) )
 
-      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
-      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
-      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+      (assign (x) (var_ref _x) (expression float noise(var_ref p)))
+      (assign (x) (var_ref _y) (expression float noise(expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+      (assign (x) (var_ref _z) (expression float noise(var_ref _p)))
+      (assign (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
-      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
-      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
-      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
+      (assign (x) (var_ref _r) (var_ref _x))
+      (assign (y) (var_ref _r) (var_ref _y))
+      (assign (z) (var_ref _r) (var_ref _z))
+      (assign (w) (var_ref _r) (var_ref _w))
       (return (var_ref _r))
     ))
 
       (declare () vec4 _r)
 
       (declare () vec3 _p)
-      (assign (constant bool (1)) (xyz) (var_ref _p) (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0))) )
+      (assign (xyz) (var_ref _p) (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0))) )
 
-      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
-      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
-      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))
+      (assign (x) (var_ref _x) (expression float noise(var_ref p)))
+      (assign (x) (var_ref _y) (expression float noise(expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
+      (assign (x) (var_ref _z) (expression float noise(var_ref _p)))
+      (assign (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
-      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
-      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
-      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
+      (assign (x) (var_ref _r) (var_ref _x))
+      (assign (y) (var_ref _r) (var_ref _y))
+      (assign (z) (var_ref _r) (var_ref _z))
+      (assign (w) (var_ref _r) (var_ref _w))
       (return (var_ref _r))
     ))
 
       (declare () vec4 _r)
 
       (declare () vec2 _p)
-      (assign (constant bool (1)) (xy) (var_ref _p) (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0))) )
+      (assign (xy) (var_ref _p) (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0))) )
 
-      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
-      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
-      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))
+      (assign (x) (var_ref _x) (expression float noise(var_ref p)))
+      (assign (x) (var_ref _y) (expression float noise(expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
+      (assign (x) (var_ref _z) (expression float noise(var_ref _p)))
+      (assign (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
-      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
-      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
-      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
+      (assign (x) (var_ref _r) (var_ref _x))
+      (assign (y) (var_ref _r) (var_ref _y))
+      (assign (z) (var_ref _r) (var_ref _z))
+      (assign (w) (var_ref _r) (var_ref _w))
       (return (var_ref _r))
     ))
 
       (declare () vec4 _r)
 
       (declare () float _p)
-      (assign (constant bool (1)) (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )
+      (assign (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )
 
-      (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
-      (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))
-      (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
-      (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))
+      (assign (x) (var_ref _x) (expression float noise(var_ref p)))
+      (assign (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))
+      (assign (x) (var_ref _z) (expression float noise(var_ref _p)))
+      (assign (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))
 
-      (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
-      (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
-      (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
-      (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
+      (assign (x) (var_ref _r) (var_ref _x))
+      (assign (y) (var_ref _r) (var_ref _y))
+      (assign (z) (var_ref _r) (var_ref _z))
+      (assign (w) (var_ref _r) (var_ref _w))
       (return (var_ref _r))
     ))
 ))
index 61d46261548e175cfef61ae5431b1161e82e28ac..0e3f375bbac7c7cebb495a40e2b249fee057978e 100644 (file)
@@ -4,8 +4,8 @@
        (declare (in) vec2 u)
        (declare (in) vec2 v))
      ((declare () mat2 m)
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
       (return (var_ref m))))
 
    (signature mat2x3
@@ -13,8 +13,8 @@
        (declare (in) vec3 u)
        (declare (in) vec2 v))
      ((declare () mat2x3 m)
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
       (return (var_ref m))))
 
    (signature mat2x4
@@ -22,8 +22,8 @@
        (declare (in) vec4 u)
        (declare (in) vec2 v))
      ((declare () mat2x4 m)
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
       (return (var_ref m))))
 
    (signature mat3x2
@@ -31,9 +31,9 @@
        (declare (in) vec2 u)
        (declare (in) vec3 v))
      ((declare () mat3x2 m)
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
       (return (var_ref m))
  ))
 
@@ -42,9 +42,9 @@
        (declare (in) vec3 u)
        (declare (in) vec3 v))
      ((declare () mat3 m)
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
       (return (var_ref m))))
 
    (signature mat3x4
@@ -52,9 +52,9 @@
        (declare (in) vec4 u)
        (declare (in) vec3 v))
      ((declare () mat3x4 m)
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
       (return (var_ref m))))
 
    (signature mat4x2
        (declare (in) vec2 u)
        (declare (in) vec4 v))
      ((declare () mat4x2 m)
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
-      (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
+      (assign (xy) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))
       (return (var_ref m))))
 
    (signature mat4x3
        (declare (in) vec3 u)
        (declare (in) vec4 v))
      ((declare () mat4x3 m)
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
-      (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
+      (assign (xyz) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))
       (return (var_ref m))))
 
    (signature mat4
@@ -84,9 +84,9 @@
        (declare (in) vec4 u)
        (declare (in) vec4 v))
      ((declare () mat4 m)
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
-      (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
+      (assign (xyzw) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))
       (return (var_ref m))))
 ))
index f6319b0ed47424c5ab836424c8ac3ef6f8cab088..60899f01cecd4c2a9e275c0cc2582477e27c47f6 100644 (file)
@@ -5,7 +5,7 @@
        (declare (in) float n)
        (declare (in) float eta))
      ((declare () float k)
-      (assign (constant bool (1)) (x) (var_ref k)
+      (assign (x) (var_ref k)
               (expression float - (constant float (1.0))
                (expression float * (var_ref eta)
                  (expression float * (var_ref eta)
@@ -30,7 +30,7 @@
        (declare (in) vec2 n)
        (declare (in) float eta))
      ((declare () float k)
-      (assign (constant bool (1)) (x) (var_ref k)
+      (assign (x) (var_ref k)
               (expression float - (constant float (1.0))
                (expression float * (var_ref eta)
                  (expression float * (var_ref eta)
@@ -55,7 +55,7 @@
        (declare (in) vec3 n)
        (declare (in) float eta))
      ((declare () float k)
-      (assign (constant bool (1)) (x) (var_ref k)
+      (assign (x) (var_ref k)
               (expression float - (constant float (1.0))
                (expression float * (var_ref eta)
                  (expression float * (var_ref eta)
@@ -80,7 +80,7 @@
        (declare (in) vec4 n)
        (declare (in) float eta))
      ((declare () float k)
-      (assign (constant bool (1)) (x) (var_ref k)
+      (assign (x) (var_ref k)
               (expression float - (constant float (1.0))
                (expression float * (var_ref eta)
                  (expression float * (var_ref eta)
index 0164219a05604f4ec2b71b8e0c9e21a3e3ff9dca..94c98b29e53856a27835b7806c469d9f71fc302f 100644 (file)
@@ -5,40 +5,26 @@
        (declare (in) float edge1)
        (declare (in) float x))
      ((declare () float t)
-
-      (assign (constant bool (1)) (x) (var_ref t)
+      (assign (x) (var_ref t)
               (expression float max
                          (expression float min
                                      (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
                                      (constant float (1.0)))
                          (constant float (0.0))))
-      (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))
-
+      (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.0)) (expression float * (constant float (2.0)) (var_ref t))))))))
    (signature vec2
      (parameters
        (declare (in) float edge0)
        (declare (in) float edge1)
        (declare (in) vec2 x))
      ((declare () vec2 t)
-      (declare () vec2 retval)
-
-      (assign (constant bool (1)) (x) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
+      (assign (xy) (var_ref t)
+              (expression vec2 max
+                         (expression vec2 min
+                                     (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
                                      (constant float (1.0)))
                          (constant float (0.0))))
-      (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
-
-      (assign (constant bool (1)) (y) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
-                                     (constant float (1.0)))
-                         (constant float (0.0))))
-      (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
-      (return (var_ref retval))
-      ))
+      (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t))))))))
 
    (signature vec3
      (parameters
        (declare (in) float edge1)
        (declare (in) vec3 x))
      ((declare () vec3 t)
-      (declare () vec3 retval)
-
-      (assign (constant bool (1)) (x) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
-                                     (constant float (1.0)))
-                         (constant float (0.0))))
-      (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
-
-      (assign (constant bool (1)) (y) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
-                                     (constant float (1.0)))
-                         (constant float (0.0))))
-      (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
-
-      (assign (constant bool (1)) (z) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
+      (assign (xyz) (var_ref t)
+              (expression vec3 max
+                         (expression vec3 min
+                                     (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
                                      (constant float (1.0)))
                          (constant float (0.0))))
-      (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
-      (return (var_ref retval))
-      ))
+      (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t))))))))
 
 
    (signature vec4
        (declare (in) float edge1)
        (declare (in) vec4 x))
      ((declare () vec4 t)
-      (declare () vec4 retval)
-
-      (assign (constant bool (1)) (x) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
-                                     (constant float (1.0)))
-                         (constant float (0.0))))
-      (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
-
-      (assign (constant bool (1)) (y) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
-                                     (constant float (1.0)))
-                         (constant float (0.0))))
-      (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
-
-      (assign (constant bool (1)) (z) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
+      (assign (xyzw) (var_ref t)
+              (expression vec4 max
+                         (expression vec4 min
+                                     (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
                                      (constant float (1.0)))
                          (constant float (0.0))))
-      (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
-
-      (assign (constant bool (1)) (w) (var_ref t)
-              (expression float max
-                         (expression float min
-                                     (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
-                                     (constant float (1.0)))
-                         (constant float (0.0))))
-      (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))
-      (return (var_ref retval))
-      ))
+      (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t))))))))
 
    (signature vec2
      (parameters
        (declare (in) vec2 edge0)
        (declare (in) vec2 edge1)
        (declare (in) vec2 x))
-     ((return (expression vec2 max
+     ((declare () vec2 t)
+      (assign (xy) (var_ref t)
+              (expression vec2 max
                           (expression vec2 min
                                       (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))
-                                      (constant vec2 (1.0 1.0)))
-                          (constant vec2 (0.0 0.0))))))
+                                      (constant float (1.0)))
+                          (constant float (0.0))))
+      (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t))))))))
 
    (signature vec3
      (parameters
        (declare (in) vec3 edge0)
        (declare (in) vec3 edge1)
        (declare (in) vec3 x))
-     ((return (expression vec3 max
+     ((declare () vec3 t)
+      (assign (xyz) (var_ref t)
+              (expression vec3 max
                           (expression vec3 min
                                       (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))
-                                      (constant vec3 (1.0 1.0 1.0)))
-                          (constant vec3 (0.0 0.0 0.0))))))
+                                      (constant float (1.0)))
+                          (constant float (0.0))))
+      (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t))))))))
 
    (signature vec4
      (parameters
        (declare (in) vec4 edge0)
        (declare (in) vec4 edge1)
        (declare (in) vec4 x))
-     ((return (expression vec4 max
+     ((declare () vec4 t)
+      (assign (xyzw) (var_ref t)
+              (expression vec4 max
                           (expression vec4 min
                                       (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))
-                                      (constant vec4 (1.0 1.0 1.0 1.0)))
-                          (constant vec4 (0.0 0.0 0.0 0.0))))))
+                                      (constant float (1.0)))
+                          (constant float (0.0))))
+      (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t))))))))
 ))
 
index 7aec9d7a6cc62f3cc5ff35bf1d7a5a1758ad9ca2..efcd7bc80234daa3f94dc46faea79a764e3fe4fa 100644 (file)
@@ -10,8 +10,8 @@
        (declare (in) float edge)
        (declare (in) vec2 x))
      ((declare () vec2 t)
-      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+      (assign (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+      (assign (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
       (return (var_ref t))))
 
    (signature vec3
@@ -19,9 +19,9 @@
        (declare (in) float edge)
        (declare (in) vec3 x))
      ((declare () vec3 t)
-      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
+      (assign (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+      (assign (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+      (assign (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
       (return (var_ref t))))
 
    (signature vec4
        (declare (in) float edge)
        (declare (in) vec4 x))
      ((declare () vec4 t)
-      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
-      (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))
+      (assign (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+      (assign (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+      (assign (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
+      (assign (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))
       (return (var_ref t))))
 
    (signature vec2
@@ -40,8 +40,8 @@
        (declare (in) vec2 edge)
        (declare (in) vec2 x))
      ((declare () vec2 t)
-      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
-      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+      (assign (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+      (assign (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
       (return (var_ref t))))
 
    (signature vec3
@@ -49,9 +49,9 @@
        (declare (in) vec3 edge)
        (declare (in) vec3 x))
      ((declare () vec3 t)
-      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
-      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
-      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
+      (assign (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+      (assign (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+      (assign (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
       (return (var_ref t))))
 
    (signature vec4
        (declare (in) vec4 edge)
        (declare (in) vec4 x))
      ((declare () vec4 t)
-      (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
-      (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
-      (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
-      (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))
+      (assign (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+      (assign (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+      (assign (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
+      (assign (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))
       (return (var_ref t))))
 ))
 
index 4bed4489bf4e434413256ff3aee4911c90304a81..043327d235b852ebe0ef6c3e64ea2c5236de4727 100644 (file)
      (parameters
        (declare (in) mat2 m))
      ((declare () mat2 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
 (return (var_ref t))))
 
    (signature mat3x2
      (parameters
        (declare (in) mat2x3 m))
      ((declare () mat3x2 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
 (return (var_ref t))))
 
    (signature mat4x2
      (parameters
        (declare (in) mat2x4 m))
      ((declare () mat4x2 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
 (return (var_ref t))))
 
    (signature mat2x3
      (parameters
        (declare (in) mat3x2 m))
      ((declare () mat2x3 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
 (return (var_ref t))))
 
    (signature mat3
      (parameters
        (declare (in) mat3 m))
      ((declare () mat3 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+      (assign (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
 (return (var_ref t))))
 
    (signature mat4x3
      (parameters
        (declare (in) mat3x4 m))
      ((declare () mat4x3 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
+      (assign (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))
 (return (var_ref t))))
 
    (signature mat2x4
      (parameters
        (declare (in) mat4x2 m))
      ((declare () mat2x4 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+      (assign (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
+      (assign (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
 (return (var_ref t))))
 
    (signature mat3x4
      (parameters
        (declare (in) mat4x3 m))
      ((declare () mat3x4 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+      (assign (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+      (assign (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
+      (assign (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
+      (assign (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))
 (return (var_ref t))))
 
    (signature mat4
      (parameters
        (declare (in) mat4 m))
      ((declare () mat4 t)
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))
-      (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (3)))))
+      (assign (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+      (assign (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
+      (assign (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+      (assign (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
+      (assign (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+      (assign (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))
+      (assign (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
+      (assign (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
+      (assign (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))
+      (assign (w) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (3)))))
 (return (var_ref t))))
 )
 
diff --git a/src/glsl/builtins/tools/builtin_function.cpp b/src/glsl/builtins/tools/builtin_function.cpp
deleted file mode 100644 (file)
index c44804f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright Â© 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include "glsl_parser_extras.h"
-
-/* A dummy file.  When compiling prototypes, we don't care about builtins.
- * We really don't want to half-compile builtin_functions.cpp and fail, though.
- */
-void
-_mesa_glsl_release_functions(void)
-{
-}
-
-void
-_mesa_glsl_initialize_functions(exec_list *instructions,
-                               struct _mesa_glsl_parse_state *state)
-{
-}
index 1f1056ea096dcfef89598135c310ddfd72f287cc..3a938a022da5e571fb181269c7a2ac79439acfe2 100755 (executable)
@@ -1,16 +1,27 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
+from __future__ import with_statement
+
 import re
+import sys
 from glob import glob
 from os import path
 from subprocess import Popen, PIPE
+from sys import argv
 
 # Local module: generator for texture lookup builtins
 from texture_builtins import generate_texture_functions
 
 builtins_dir = path.join(path.dirname(path.abspath(__file__)), "..")
 
+# Get the path to the standalone GLSL compiler
+if len(argv) != 2:
+    print "Usage:", argv[0], "<path to compiler>"
+    sys.exit(1)
+
+compiler = argv[1]
+
 # Read the files in builtins/ir/*...add them to the supplied dictionary.
 def read_ir_files(fs):
     for filename in glob(path.join(path.join(builtins_dir, 'ir'), '*')):
@@ -47,14 +58,13 @@ def write_function_definitions():
         print stringify(v), ';'
 
 def run_compiler(args):
-    compiler_path = path.join(path.join(builtins_dir, '..'), 'glsl_compiler')
-    command = [compiler_path, '--dump-lir'] + args
+    command = [compiler, '--dump-lir'] + args
     p = Popen(command, 1, stdout=PIPE, shell=False)
     output = p.communicate()[0]
 
     # Clean up output a bit by killing whitespace before a closing paren.
-    kill_paren_whitespace = re.compile(r'[ \n]*\)', re.MULTILINE);
-    output = kill_paren_whitespace.sub(')', output);
+    kill_paren_whitespace = re.compile(r'[ \n]*\)', re.MULTILINE)
+    output = kill_paren_whitespace.sub(')', output)
 
     # Also toss any duplicate newlines
     output = output.replace('\n\n', '\n')
@@ -69,12 +79,12 @@ def write_profile(filename, profile):
         return
 
     # Kill any global variable declarations.  We don't want them.
-    kill_globals = re.compile(r'^\(declare.*\n', re.MULTILINE);
+    kill_globals = re.compile(r'^\(declare.*\n', re.MULTILINE)
     proto_ir = kill_globals.sub('', proto_ir)
 
     # Kill pointer addresses.  They're not necessary in prototypes and just
     # clutter the diff output.
-    proto_ir = re.sub(r'@0x[0-9a-f]+', '', proto_ir);
+    proto_ir = re.sub(r'@0x[0-9a-f]+', '', proto_ir)
 
     print 'static const char prototypes_for_' + profile + '[] ='
     print stringify(proto_ir), ';'
@@ -200,7 +210,6 @@ _mesa_glsl_release_functions(void)
 
 static void
 _mesa_read_profile(struct _mesa_glsl_parse_state *state,
-                  exec_list *instructions,
                    int profile_index,
                   const char *prototypes,
                   const char **functions,
@@ -214,14 +223,12 @@ _mesa_read_profile(struct _mesa_glsl_parse_state *state,
       builtin_profiles[profile_index] = sh;
    }
 
-   import_prototypes(sh->ir, instructions, state->symbols, state);
    state->builtins_to_link[state->num_builtins_to_link] = sh;
    state->num_builtins_to_link++;
 }
 
 void
-_mesa_glsl_initialize_functions(exec_list *instructions,
-                                struct _mesa_glsl_parse_state *state)
+_mesa_glsl_initialize_functions(struct _mesa_glsl_parse_state *state)
 {
    if (builtin_mem_ctx == NULL) {
       builtin_mem_ctx = talloc_init("GLSL built-in functions");
@@ -231,7 +238,7 @@ _mesa_glsl_initialize_functions(exec_list *instructions,
    state->num_builtins_to_link = 0;
 """
 
-    i=0
+    i = 0
     for (filename, profile) in profiles:
         if profile.endswith('_vert'):
             check = 'state->target == vertex_shader && '
@@ -245,7 +252,7 @@ _mesa_glsl_initialize_functions(exec_list *instructions,
             check += 'state->' + version + '_enable'
 
         print '   if (' + check + ') {'
-        print '      _mesa_read_profile(state, instructions, %d,' % i
+        print '      _mesa_read_profile(state, %d,' % i
         print '                         prototypes_for_' + profile + ','
         print '                         functions_for_' + profile + ','
         print '                         Elements(functions_for_' + profile + '));'
index 0cd1fe5d598b44032ec068f078bc74e232ba6791..a5566dc0aaf7a2d8418b72a201134a42ccbf2bc4 100644 (file)
@@ -1,9 +1,10 @@
-/* A Bison parser, made by GNU Bison 2.4.3.  */
+
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
 /* Skeleton implementation for Bison's Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2009, 2010 Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -45,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -219,7 +220,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value);
 
 
 /* Line 189 of yacc.c  */
-#line 223 "glcpp/glcpp-parse.c"
+#line 224 "glcpp/glcpp-parse.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -307,7 +308,7 @@ typedef struct YYLTYPE
 
 
 /* Line 264 of yacc.c  */
-#line 311 "glcpp/glcpp-parse.c"
+#line 312 "glcpp/glcpp-parse.c"
 
 #ifdef short
 # undef short
@@ -357,7 +358,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
+# if YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -636,13 +637,13 @@ static const yytype_uint16 yyrline[] =
      216,   219,   222,   225,   233,   252,   262,   267,   272,   291,
      306,   309,   312,   333,   337,   346,   351,   352,   355,   358,
      361,   364,   367,   370,   373,   376,   379,   382,   385,   388,
-     391,   394,   397,   400,   403,   406,   409,   412,   415,   418,
-     424,   429,   437,   438,   442,   448,   449,   452,   454,   461,
-     465,   469,   474,   480,   488,   494,   502,   506,   510,   514,
-     518,   525,   526,   527,   528,   529,   530,   531,   532,   533,
-     534,   535,   536,   537,   538,   539,   540,   541,   542,   543,
-     544,   545,   546,   547,   548,   549,   550,   551,   552,   553,
-     554,   555
+     391,   394,   397,   400,   408,   411,   414,   417,   420,   423,
+     429,   434,   442,   443,   447,   453,   454,   457,   459,   466,
+     470,   474,   479,   484,   492,   498,   506,   510,   514,   518,
+     522,   529,   530,   531,   532,   533,   534,   535,   536,   537,
+     538,   539,   540,   541,   542,   543,   544,   545,   546,   547,
+     548,   549,   550,   551,   552,   553,   554,   555,   556,   557,
+     558,   559
 };
 #endif
 
@@ -945,18 +946,9 @@ static const yytype_uint8 yystos[] =
 
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
+   Once GCC version 2 has supplanted version 1, this can go.  */
 
 #define YYFAIL         goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
@@ -1013,7 +1005,7 @@ while (YYID (0))
    we won't break user code: when these are the locations we know.  */
 
 #ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+# if YYLTYPE_IS_TRIVIAL
 #  define YY_LOCATION_PRINT(File, Loc)                 \
      fprintf (File, "%d.%d-%d.%d",                     \
              (Loc).first_line, (Loc).first_column,     \
@@ -1555,7 +1547,7 @@ YYLTYPE yylloc;
     YYLTYPE *yylsp;
 
     /* The locations where the error started and ended.  */
-    YYLTYPE yyerror_range[3];
+    YYLTYPE yyerror_range[2];
 
     YYSIZE_T yystacksize;
 
@@ -1602,7 +1594,7 @@ YYLTYPE yylloc;
   yyvsp = yyvs;
   yylsp = yyls;
 
-#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+#if YYLTYPE_IS_TRIVIAL
   /* Initialize the default location before parsing starts.  */
   yylloc.first_line   = yylloc.last_line   = 1;
   yylloc.first_column = yylloc.last_column = 1;
@@ -1610,7 +1602,7 @@ YYLTYPE yylloc;
 
 /* User initialization code.  */
 
-/* Line 1251 of yacc.c  */
+/* Line 1242 of yacc.c  */
 #line 155 "glcpp/glcpp-parse.y"
 {
        yylloc.first_line = 1;
@@ -1620,8 +1612,8 @@ YYLTYPE yylloc;
        yylloc.source = 0;
 }
 
-/* Line 1251 of yacc.c  */
-#line 1625 "glcpp/glcpp-parse.c"
+/* Line 1242 of yacc.c  */
+#line 1617 "glcpp/glcpp-parse.c"
   yylsp[0] = yylloc;
 
   goto yysetstate;
@@ -1808,7 +1800,7 @@ yyreduce:
     {
         case 4:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 194 "glcpp/glcpp-parse.y"
     {
                glcpp_print(parser->output, "\n");
@@ -1817,7 +1809,7 @@ yyreduce:
 
   case 5:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 197 "glcpp/glcpp-parse.y"
     {
                _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list));
@@ -1828,7 +1820,7 @@ yyreduce:
 
   case 8:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 207 "glcpp/glcpp-parse.y"
     {
                _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival));
@@ -1837,7 +1829,7 @@ yyreduce:
 
   case 9:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 210 "glcpp/glcpp-parse.y"
     {
                _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival));
@@ -1846,7 +1838,7 @@ yyreduce:
 
   case 10:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 216 "glcpp/glcpp-parse.y"
     {
                _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list));
@@ -1855,7 +1847,7 @@ yyreduce:
 
   case 11:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 219 "glcpp/glcpp-parse.y"
     {
                _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list));
@@ -1864,7 +1856,7 @@ yyreduce:
 
   case 12:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 222 "glcpp/glcpp-parse.y"
     {
                _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list));
@@ -1873,7 +1865,7 @@ yyreduce:
 
   case 13:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 225 "glcpp/glcpp-parse.y"
     {
                macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str));
@@ -1887,7 +1879,7 @@ yyreduce:
 
   case 14:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 233 "glcpp/glcpp-parse.y"
     {
                /* Be careful to only evaluate the 'if' expression if
@@ -1912,7 +1904,7 @@ yyreduce:
 
   case 15:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 252 "glcpp/glcpp-parse.y"
     {
                /* #if without an expression is only an error if we
@@ -1928,7 +1920,7 @@ yyreduce:
 
   case 16:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 262 "glcpp/glcpp-parse.y"
     {
                macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
@@ -1939,7 +1931,7 @@ yyreduce:
 
   case 17:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 267 "glcpp/glcpp-parse.y"
     {
                macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
@@ -1950,7 +1942,7 @@ yyreduce:
 
   case 18:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 272 "glcpp/glcpp-parse.y"
     {
                /* Be careful to only evaluate the 'elif' expression
@@ -1975,7 +1967,7 @@ yyreduce:
 
   case 19:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 291 "glcpp/glcpp-parse.y"
     {
                /* #elif without an expression is an error unless we
@@ -1996,7 +1988,7 @@ yyreduce:
 
   case 20:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 306 "glcpp/glcpp-parse.y"
     {
                _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1);
@@ -2005,7 +1997,7 @@ yyreduce:
 
   case 21:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 309 "glcpp/glcpp-parse.y"
     {
                _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)]));
@@ -2014,7 +2006,7 @@ yyreduce:
 
   case 22:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 312 "glcpp/glcpp-parse.y"
     {
                macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
@@ -2041,7 +2033,7 @@ yyreduce:
 
   case 24:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 337 "glcpp/glcpp-parse.y"
     {
                if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) {
@@ -2056,7 +2048,7 @@ yyreduce:
 
   case 25:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 346 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (1)].ival);
@@ -2065,7 +2057,7 @@ yyreduce:
 
   case 27:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 352 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival);
@@ -2074,7 +2066,7 @@ yyreduce:
 
   case 28:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 355 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival);
@@ -2083,7 +2075,7 @@ yyreduce:
 
   case 29:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 358 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival);
@@ -2092,7 +2084,7 @@ yyreduce:
 
   case 30:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 361 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival);
@@ -2101,7 +2093,7 @@ yyreduce:
 
   case 31:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 364 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival);
@@ -2110,7 +2102,7 @@ yyreduce:
 
   case 32:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 367 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival);
@@ -2119,7 +2111,7 @@ yyreduce:
 
   case 33:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 370 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival);
@@ -2128,7 +2120,7 @@ yyreduce:
 
   case 34:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 373 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival);
@@ -2137,7 +2129,7 @@ yyreduce:
 
   case 35:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 376 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival);
@@ -2146,7 +2138,7 @@ yyreduce:
 
   case 36:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 379 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival);
@@ -2155,7 +2147,7 @@ yyreduce:
 
   case 37:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 382 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival);
@@ -2164,7 +2156,7 @@ yyreduce:
 
   case 38:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 385 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival);
@@ -2173,7 +2165,7 @@ yyreduce:
 
   case 39:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 388 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival);
@@ -2182,7 +2174,7 @@ yyreduce:
 
   case 40:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 391 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival);
@@ -2191,7 +2183,7 @@ yyreduce:
 
   case 41:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 394 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival);
@@ -2200,7 +2192,7 @@ yyreduce:
 
   case 42:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 397 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival);
@@ -2209,17 +2201,22 @@ yyreduce:
 
   case 43:
 
-/* Line 1464 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 400 "glcpp/glcpp-parse.y"
     {
-               (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival);
+               if ((yyvsp[(3) - (3)].ival) == 0) {
+                       yyerror (& (yylsp[(1) - (3)]), parser,
+                                "division by 0 in preprocessor directive");
+               } else {
+                       (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival);
+               }
        ;}
     break;
 
   case 44:
 
-/* Line 1464 of yacc.c  */
-#line 403 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 408 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival);
        ;}
@@ -2227,8 +2224,8 @@ yyreduce:
 
   case 45:
 
-/* Line 1464 of yacc.c  */
-#line 406 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 411 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = ! (yyvsp[(2) - (2)].ival);
        ;}
@@ -2236,8 +2233,8 @@ yyreduce:
 
   case 46:
 
-/* Line 1464 of yacc.c  */
-#line 409 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 414 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = ~ (yyvsp[(2) - (2)].ival);
        ;}
@@ -2245,8 +2242,8 @@ yyreduce:
 
   case 47:
 
-/* Line 1464 of yacc.c  */
-#line 412 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 417 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = - (yyvsp[(2) - (2)].ival);
        ;}
@@ -2254,8 +2251,8 @@ yyreduce:
 
   case 48:
 
-/* Line 1464 of yacc.c  */
-#line 415 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 420 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = + (yyvsp[(2) - (2)].ival);
        ;}
@@ -2263,8 +2260,8 @@ yyreduce:
 
   case 49:
 
-/* Line 1464 of yacc.c  */
-#line 418 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 423 "glcpp/glcpp-parse.y"
     {
                (yyval.ival) = (yyvsp[(2) - (3)].ival);
        ;}
@@ -2272,8 +2269,8 @@ yyreduce:
 
   case 50:
 
-/* Line 1464 of yacc.c  */
-#line 424 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 429 "glcpp/glcpp-parse.y"
     {
                (yyval.string_list) = _string_list_create (parser);
                _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str));
@@ -2283,8 +2280,8 @@ yyreduce:
 
   case 51:
 
-/* Line 1464 of yacc.c  */
-#line 429 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 434 "glcpp/glcpp-parse.y"
     {
                (yyval.string_list) = (yyvsp[(1) - (3)].string_list);   
                _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str));
@@ -2294,15 +2291,15 @@ yyreduce:
 
   case 52:
 
-/* Line 1464 of yacc.c  */
-#line 437 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 442 "glcpp/glcpp-parse.y"
     { (yyval.token_list) = NULL; ;}
     break;
 
   case 54:
 
-/* Line 1464 of yacc.c  */
-#line 442 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 447 "glcpp/glcpp-parse.y"
     {
                yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #");
        ;}
@@ -2310,15 +2307,15 @@ yyreduce:
 
   case 55:
 
-/* Line 1464 of yacc.c  */
-#line 448 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 453 "glcpp/glcpp-parse.y"
     { (yyval.token_list) = NULL; ;}
     break;
 
   case 58:
 
-/* Line 1464 of yacc.c  */
-#line 454 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 459 "glcpp/glcpp-parse.y"
     {
                glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive");
        ;}
@@ -2326,8 +2323,8 @@ yyreduce:
 
   case 59:
 
-/* Line 1464 of yacc.c  */
-#line 461 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 466 "glcpp/glcpp-parse.y"
     {
                int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0;
                (yyval.token) = _token_create_ival (parser, INTEGER, v);
@@ -2336,8 +2333,8 @@ yyreduce:
 
   case 60:
 
-/* Line 1464 of yacc.c  */
-#line 465 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 470 "glcpp/glcpp-parse.y"
     {
                int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0;
                (yyval.token) = _token_create_ival (parser, INTEGER, v);
@@ -2346,10 +2343,9 @@ yyreduce:
 
   case 62:
 
-/* Line 1464 of yacc.c  */
-#line 474 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 479 "glcpp/glcpp-parse.y"
     {
-               parser->space_tokens = 1;
                (yyval.token_list) = _token_list_create (parser);
                _token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token));
                talloc_unlink (parser, (yyvsp[(1) - (1)].token));
@@ -2358,8 +2354,8 @@ yyreduce:
 
   case 63:
 
-/* Line 1464 of yacc.c  */
-#line 480 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 484 "glcpp/glcpp-parse.y"
     {
                (yyval.token_list) = (yyvsp[(1) - (2)].token_list);
                _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@@ -2369,8 +2365,8 @@ yyreduce:
 
   case 64:
 
-/* Line 1464 of yacc.c  */
-#line 488 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 492 "glcpp/glcpp-parse.y"
     {
                parser->space_tokens = 1;
                (yyval.token_list) = _token_list_create (parser);
@@ -2381,8 +2377,8 @@ yyreduce:
 
   case 65:
 
-/* Line 1464 of yacc.c  */
-#line 494 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 498 "glcpp/glcpp-parse.y"
     {
                (yyval.token_list) = (yyvsp[(1) - (2)].token_list);
                _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@@ -2392,8 +2388,8 @@ yyreduce:
 
   case 66:
 
-/* Line 1464 of yacc.c  */
-#line 502 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 506 "glcpp/glcpp-parse.y"
     {
                (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str));
                (yyval.token)->location = yylloc;
@@ -2402,8 +2398,8 @@ yyreduce:
 
   case 67:
 
-/* Line 1464 of yacc.c  */
-#line 506 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 510 "glcpp/glcpp-parse.y"
     {
                (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str));
                (yyval.token)->location = yylloc;
@@ -2412,8 +2408,8 @@ yyreduce:
 
   case 68:
 
-/* Line 1464 of yacc.c  */
-#line 510 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 514 "glcpp/glcpp-parse.y"
     {
                (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival));
                (yyval.token)->location = yylloc;
@@ -2422,8 +2418,8 @@ yyreduce:
 
   case 69:
 
-/* Line 1464 of yacc.c  */
-#line 514 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 518 "glcpp/glcpp-parse.y"
     {
                (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str));
                (yyval.token)->location = yylloc;
@@ -2432,8 +2428,8 @@ yyreduce:
 
   case 70:
 
-/* Line 1464 of yacc.c  */
-#line 518 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 522 "glcpp/glcpp-parse.y"
     {
                (yyval.token) = _token_create_ival (parser, SPACE, SPACE);
                (yyval.token)->location = yylloc;
@@ -2442,225 +2438,225 @@ yyreduce:
 
   case 71:
 
-/* Line 1464 of yacc.c  */
-#line 525 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 529 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '['; ;}
     break;
 
   case 72:
 
-/* Line 1464 of yacc.c  */
-#line 526 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 530 "glcpp/glcpp-parse.y"
     { (yyval.ival) = ']'; ;}
     break;
 
   case 73:
 
-/* Line 1464 of yacc.c  */
-#line 527 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 531 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '('; ;}
     break;
 
   case 74:
 
-/* Line 1464 of yacc.c  */
-#line 528 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 532 "glcpp/glcpp-parse.y"
     { (yyval.ival) = ')'; ;}
     break;
 
   case 75:
 
-/* Line 1464 of yacc.c  */
-#line 529 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 533 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '{'; ;}
     break;
 
   case 76:
 
-/* Line 1464 of yacc.c  */
-#line 530 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 534 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '}'; ;}
     break;
 
   case 77:
 
-/* Line 1464 of yacc.c  */
-#line 531 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 535 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '.'; ;}
     break;
 
   case 78:
 
-/* Line 1464 of yacc.c  */
-#line 532 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 536 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '&'; ;}
     break;
 
   case 79:
 
-/* Line 1464 of yacc.c  */
-#line 533 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 537 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '*'; ;}
     break;
 
   case 80:
 
-/* Line 1464 of yacc.c  */
-#line 534 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 538 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '+'; ;}
     break;
 
   case 81:
 
-/* Line 1464 of yacc.c  */
-#line 535 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 539 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '-'; ;}
     break;
 
   case 82:
 
-/* Line 1464 of yacc.c  */
-#line 536 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 540 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '~'; ;}
     break;
 
   case 83:
 
-/* Line 1464 of yacc.c  */
-#line 537 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 541 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '!'; ;}
     break;
 
   case 84:
 
-/* Line 1464 of yacc.c  */
-#line 538 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 542 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '/'; ;}
     break;
 
   case 85:
 
-/* Line 1464 of yacc.c  */
-#line 539 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 543 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '%'; ;}
     break;
 
   case 86:
 
-/* Line 1464 of yacc.c  */
-#line 540 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 544 "glcpp/glcpp-parse.y"
     { (yyval.ival) = LEFT_SHIFT; ;}
     break;
 
   case 87:
 
-/* Line 1464 of yacc.c  */
-#line 541 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 545 "glcpp/glcpp-parse.y"
     { (yyval.ival) = RIGHT_SHIFT; ;}
     break;
 
   case 88:
 
-/* Line 1464 of yacc.c  */
-#line 542 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 546 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '<'; ;}
     break;
 
   case 89:
 
-/* Line 1464 of yacc.c  */
-#line 543 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 547 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '>'; ;}
     break;
 
   case 90:
 
-/* Line 1464 of yacc.c  */
-#line 544 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 548 "glcpp/glcpp-parse.y"
     { (yyval.ival) = LESS_OR_EQUAL; ;}
     break;
 
   case 91:
 
-/* Line 1464 of yacc.c  */
-#line 545 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 549 "glcpp/glcpp-parse.y"
     { (yyval.ival) = GREATER_OR_EQUAL; ;}
     break;
 
   case 92:
 
-/* Line 1464 of yacc.c  */
-#line 546 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 550 "glcpp/glcpp-parse.y"
     { (yyval.ival) = EQUAL; ;}
     break;
 
   case 93:
 
-/* Line 1464 of yacc.c  */
-#line 547 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 551 "glcpp/glcpp-parse.y"
     { (yyval.ival) = NOT_EQUAL; ;}
     break;
 
   case 94:
 
-/* Line 1464 of yacc.c  */
-#line 548 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 552 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '^'; ;}
     break;
 
   case 95:
 
-/* Line 1464 of yacc.c  */
-#line 549 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 553 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '|'; ;}
     break;
 
   case 96:
 
-/* Line 1464 of yacc.c  */
-#line 550 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 554 "glcpp/glcpp-parse.y"
     { (yyval.ival) = AND; ;}
     break;
 
   case 97:
 
-/* Line 1464 of yacc.c  */
-#line 551 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 555 "glcpp/glcpp-parse.y"
     { (yyval.ival) = OR; ;}
     break;
 
   case 98:
 
-/* Line 1464 of yacc.c  */
-#line 552 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 556 "glcpp/glcpp-parse.y"
     { (yyval.ival) = ';'; ;}
     break;
 
   case 99:
 
-/* Line 1464 of yacc.c  */
-#line 553 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 557 "glcpp/glcpp-parse.y"
     { (yyval.ival) = ','; ;}
     break;
 
   case 100:
 
-/* Line 1464 of yacc.c  */
-#line 554 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 558 "glcpp/glcpp-parse.y"
     { (yyval.ival) = '='; ;}
     break;
 
   case 101:
 
-/* Line 1464 of yacc.c  */
-#line 555 "glcpp/glcpp-parse.y"
+/* Line 1455 of yacc.c  */
+#line 559 "glcpp/glcpp-parse.y"
     { (yyval.ival) = PASTE; ;}
     break;
 
 
 
-/* Line 1464 of yacc.c  */
-#line 2664 "glcpp/glcpp-parse.c"
+/* Line 1455 of yacc.c  */
+#line 2660 "glcpp/glcpp-parse.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2732,7 +2728,7 @@ yyerrlab:
 #endif
     }
 
-  yyerror_range[1] = yylloc;
+  yyerror_range[0] = yylloc;
 
   if (yyerrstatus == 3)
     {
@@ -2769,7 +2765,7 @@ yyerrorlab:
   if (/*CONSTCOND*/ 0)
      goto yyerrorlab;
 
-  yyerror_range[1] = yylsp[1-yylen];
+  yyerror_range[0] = yylsp[1-yylen];
   /* Do not reclaim the symbols of the rule which action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
@@ -2803,7 +2799,7 @@ yyerrlab1:
       if (yyssp == yyss)
        YYABORT;
 
-      yyerror_range[1] = *yylsp;
+      yyerror_range[0] = *yylsp;
       yydestruct ("Error: popping",
                  yystos[yystate], yyvsp, yylsp, parser);
       YYPOPSTACK (1);
@@ -2813,10 +2809,10 @@ yyerrlab1:
 
   *++yyvsp = yylval;
 
-  yyerror_range[2] = yylloc;
+  yyerror_range[1] = yylloc;
   /* Using YYLLOC is tempting, but would change the location of
      the lookahead.  YYLOC is available though.  */
-  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
   *++yylsp = yyloc;
 
   /* Shift the error token.  */
@@ -2878,8 +2874,8 @@ yyreturn:
 
 
 
-/* Line 1684 of yacc.c  */
-#line 558 "glcpp/glcpp-parse.y"
+/* Line 1675 of yacc.c  */
+#line 562 "glcpp/glcpp-parse.y"
 
 
 string_list_t *
@@ -3150,11 +3146,32 @@ _token_list_trim_trailing_space (token_list_t *list)
        }
 }
 
+int
+_token_list_is_empty_ignoring_space (token_list_t *l)
+{
+       token_node_t *n;
+
+       if (l == NULL)
+               return 1;
+
+       n = l->head;
+       while (n != NULL && n->token->type == SPACE)
+               n = n->next;
+
+       return n == NULL;
+}
+
 int
 _token_list_equal_ignoring_space (token_list_t *a, token_list_t *b)
 {
        token_node_t *node_a, *node_b;
 
+       if (a == NULL || b == NULL) {
+               int a_empty = _token_list_is_empty_ignoring_space(a);
+               int b_empty = _token_list_is_empty_ignoring_space(b);
+               return a_empty == b_empty;
+       }
+
        node_a = a->head;
        node_b = b->head;
 
index 8475e08f00c9776e505fb8f0b9de76432502deb4..e71c0e8b38217bba1379dd04d97b358516cbfe8d 100644 (file)
@@ -398,7 +398,12 @@ expression:
                $$ = $1 % $3;
        }
 |      expression '/' expression {
-               $$ = $1 / $3;
+               if ($3 == 0) {
+                       yyerror (& @1, parser,
+                                "division by 0 in preprocessor directive");
+               } else {
+                       $$ = $1 / $3;
+               }
        }
 |      expression '*' expression {
                $$ = $1 * $3;
@@ -472,7 +477,6 @@ conditional_token:
 conditional_tokens:
        /* Exactly the same as pp_tokens, but using conditional_token */
        conditional_token {
-               parser->space_tokens = 1;
                $$ = _token_list_create (parser);
                _token_list_append ($$, $1);
                talloc_unlink (parser, $1);
@@ -825,11 +829,32 @@ _token_list_trim_trailing_space (token_list_t *list)
        }
 }
 
+int
+_token_list_is_empty_ignoring_space (token_list_t *l)
+{
+       token_node_t *n;
+
+       if (l == NULL)
+               return 1;
+
+       n = l->head;
+       while (n != NULL && n->token->type == SPACE)
+               n = n->next;
+
+       return n == NULL;
+}
+
 int
 _token_list_equal_ignoring_space (token_list_t *a, token_list_t *b)
 {
        token_node_t *node_a, *node_b;
 
+       if (a == NULL || b == NULL) {
+               int a_empty = _token_list_is_empty_ignoring_space(a);
+               int b_empty = _token_list_is_empty_ignoring_space(b);
+               return a_empty == b_empty;
+       }
+
        node_a = a->head;
        node_b = b->head;
 
diff --git a/src/glsl/glcpp/tests/092-redefine-macro-error-2.c b/src/glsl/glcpp/tests/092-redefine-macro-error-2.c
new file mode 100644 (file)
index 0000000..3c161a5
--- /dev/null
@@ -0,0 +1,5 @@
+#define A
+#define A 1
+
+#define B 1
+#define B
diff --git a/src/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected b/src/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected
new file mode 100644 (file)
index 0000000..0026f91
--- /dev/null
@@ -0,0 +1,10 @@
+0:2(9): preprocessor error: Redefinition of macro A
+
+0:5(9): preprocessor error: Redefinition of macro B
+
+
+
+
+
+
+
diff --git a/src/glsl/glcpp/tests/093-divide-by-zero.c b/src/glsl/glcpp/tests/093-divide-by-zero.c
new file mode 100644 (file)
index 0000000..bf65d4f
--- /dev/null
@@ -0,0 +1,2 @@
+#if (1 / 0)
+#endif
diff --git a/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c b/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c
new file mode 100644 (file)
index 0000000..a9c6f36
--- /dev/null
@@ -0,0 +1,2 @@
+#if 1 || (1 / 0)
+#endif
diff --git a/src/glsl/glcpp/tests/095-recursive-define.c b/src/glsl/glcpp/tests/095-recursive-define.c
new file mode 100644 (file)
index 0000000..801d90c
--- /dev/null
@@ -0,0 +1,3 @@
+#define A(a, b) B(a, b)
+#define C A(0, C)
+C
index e3d0a3cfc9dfe191e878d13ec3dcf8b8e7619730..7c0a51b99bfc3e2846109aa49fe7ca95465ee87b 100644 (file)
@@ -54,7 +54,6 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -158,7 +159,15 @@ typedef void* yyscan_t;
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
 #define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
@@ -349,8 +358,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
        *yy_cp = '\0'; \
        yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 209
-#define YY_END_OF_BUFFER 210
+#define YY_NUM_RULES 210
+#define YY_END_OF_BUFFER 211
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -358,98 +367,100 @@ struct yy_trans_info
        flex_int32_t yy_verify;
        flex_int32_t yy_nxt;
        };
-static yyconst flex_int16_t yy_accept[813] =
+static yyconst flex_int16_t yy_accept[836] =
     {   0,
-        0,    0,   15,   15,    0,    0,  210,  208,    1,   20,
-      208,  208,  208,  208,  208,  208,  208,  208,  119,  117,
-      208,  208,  208,  207,  208,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  208,    1,  208,  209,   15,
-       19,  209,   18,   16,   17,   13,   12,    1,  101,  110,
-      102,  113,  107,   96,  109,   97,  116,  121,  108,  122,
-      119,    0,    0,  124,  119,    0,  117,  117,  105,   98,
-      100,   99,  106,  207,  114,  104,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,   29,  207,
-
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,   33,  207,  207,   60,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  115,
-      103,    1,    0,    0,    2,    0,    0,    0,    0,   15,
-       14,   18,   17,    0,  121,  120,    0,  122,    0,  123,
-      118,  111,  112,  207,  127,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,   32,  207,  207,  207,
-
-      207,  207,  207,  207,  207,  207,  207,   25,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,   61,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-        0,    0,    0,    0,   14,    0,  121,    0,  120,    0,
-      122,  123,  118,  207,  207,   23,  207,  207,  174,  167,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,   31,
-      130,  207,  207,  207,  207,   67,  207,  207,  135,  149,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-
-      207,  207,  146,  170,   48,   49,   50,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  133,  125,  207,
-      207,   26,  207,  207,  207,  207,  207,  207,  207,   45,
-       46,   47,   94,  207,  207,    0,    0,    0,    0,    0,
-      120,  207,  207,   27,   36,   37,   38,  207,  128,  207,
-       22,  207,  207,  207,  207,  157,  158,  159,  207,  126,
-      207,  150,   24,  160,  161,  162,  172,  154,  155,  156,
-      207,  207,  207,   62,  152,  207,  207,  207,   39,   40,
-       41,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-
-      207,  207,  207,  207,  207,  207,  207,  147,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  129,  207,
-      207,  169,   42,   43,   44,  207,  207,   30,    0,    0,
-        0,    0,  177,  207,  207,  175,  207,  207,  207,  148,
-      143,  180,  207,  207,  207,  207,  207,  207,  138,  207,
-      207,  207,   95,   51,   52,   53,   54,   55,   56,   57,
-       58,   59,  207,  207,  207,  207,  153,  134,  207,  207,
-      141,   35,  207,  207,  166,   68,  142,   93,  178,  136,
-      207,  207,  207,  207,  207,  207,  207,  207,    0,    0,
-        0,    0,  207,  207,  207,  137,   34,  207,  207,  207,
-
-      207,  207,  207,  181,  182,  183,  207,  207,  207,  207,
-      207,  171,  207,  207,  207,  207,  207,  207,  207,  207,
-      131,  207,  207,  207,  207,  207,   63,  207,  207,   64,
-      207,    0,    0,    0,    0,    0,  207,   65,   28,  144,
-      185,  186,  187,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  139,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  132,  189,  190,  191,  207,
-      207,  151,  207,  140,    0,    0,    6,    0,    0,    0,
-       11,    3,   21,  207,  207,  207,  207,  207,  207,  207,
-      207,  207,  184,  145,   66,  207,  207,  207,  207,  168,
-
-      207,  176,  173,  206,   70,   71,   72,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,    0,    0,    0,
-        0,    0,    0,  207,  207,  207,  188,  207,  207,  207,
-      207,  207,   81,   82,   83,  207,  207,  207,  207,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  192,   87,
-       88,   89,  207,    4,    0,    5,    0,    0,    0,    0,
-        0,  207,  207,  207,  207,  207,  207,  207,  203,  207,
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-       73,  207,  207,  207,  207,  207,  207,    0,    0,    0,
-      207,  207,  204,  193,  207,  194,  207,  207,  207,   84,
-
-      207,  207,  207,  207,  207,  207,  207,  207,  207,  207,
-      207,  205,  207,  207,   90,    0,    0,  195,  196,  207,
-      199,  207,  200,  207,  207,   69,  207,  207,  207,  163,
-      207,  164,  179,  207,  197,  198,  207,  207,    0,    0,
-      207,  207,  207,  207,   74,  207,   75,  207,  207,  207,
-      207,  207,    0,    0,    0,  207,  207,   85,   86,  207,
-       76,  207,  207,   77,  207,   91,   92,    0,    0,    0,
-      207,  207,  207,  207,  207,  207,    0,    0,    0,  207,
-      207,  207,  207,  207,   78,    0,    0,    7,    0,    0,
-      201,  202,  207,  207,  207,    0,    8,    0,    0,  207,
-
-      207,  165,    0,    0,   79,   80,    0,    0,    9,    0,
-       10,    0
+        0,    0,   16,   16,    0,    0,  211,  209,    1,   21,
+      209,  209,  209,  209,  209,  209,  209,  209,  120,  118,
+      209,  209,  209,  208,  209,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  209,    1,  209,  210,   16,
+       20,  210,   19,   17,   18,   14,   13,    1,  102,  111,
+      103,  114,  108,   97,  110,   98,  117,  122,  109,  123,
+      120,    0,    0,  125,  120,    0,  118,  118,  106,   99,
+      101,  100,  107,  208,  115,  105,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,   30,  208,
+
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,   34,  208,  208,   61,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  116,
+      104,    1,    0,    0,    2,    0,    0,    0,    0,   16,
+       15,   19,   18,    0,  122,  121,    0,  123,    0,  124,
+      119,  112,  113,  208,  128,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,   33,  208,  208,  208,
+
+      208,  208,  208,  208,  208,  208,  208,   26,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,   62,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+        0,    0,    0,    0,   15,    0,  122,    0,  121,    0,
+      123,  124,  119,  208,  208,   24,  208,  208,  175,  168,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,   32,
+      131,  208,  208,  208,  208,   68,  208,  208,  136,  150,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+
+      208,  208,  147,  171,   49,   50,   51,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  134,  126,  208,
+      208,   27,  208,  208,  208,  208,  208,  208,  208,   46,
+       47,   48,   95,  208,  208,    0,    0,    0,    0,    0,
+      121,  208,  208,   28,   37,   38,   39,  208,  129,  208,
+       23,  208,  208,  208,  208,  158,  159,  160,  208,  127,
+      208,  151,   25,  161,  162,  163,  173,  155,  156,  157,
+      208,  208,  208,   63,  153,  208,  208,  208,   40,   41,
+       42,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+
+      208,  208,  208,  208,  208,  208,  208,  148,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  130,  208,
+      208,  170,   43,   44,   45,  208,  208,   31,    0,    0,
+        0,    0,  178,  208,  208,  176,  208,  208,  208,  149,
+      144,  181,  208,  208,  208,  208,  208,  208,  139,  208,
+      208,  208,   96,   52,   53,   54,   55,   56,   57,   58,
+       59,   60,  208,  208,  208,  208,  154,  135,  208,  208,
+      142,   36,  208,  208,  167,   69,  143,   94,  179,  137,
+      208,  208,  208,  208,  208,  208,  208,  208,    0,    0,
+        0,    0,  208,  208,  208,  138,   35,  208,  208,  208,
+
+      208,  208,  208,  182,  183,  184,  208,  208,  208,  208,
+      208,  172,  208,  208,  208,  208,  208,  208,  208,  208,
+      132,  208,  208,  208,  208,  208,   64,  208,  208,   65,
+      208,    0,    0,    0,    0,    0,  208,   66,   29,  145,
+      186,  187,  188,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  140,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  133,  190,  191,  192,  208,
+      208,  152,  208,  141,    0,    0,    6,    0,    0,    0,
+       12,    3,   22,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  185,  146,   67,  208,  208,  208,  208,  169,
+
+      208,  177,  174,  207,   71,   72,   73,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,    0,    0,    0,
+        0,    0,    0,    0,  208,  208,  208,  189,  208,  208,
+      208,  208,  208,   82,   83,   84,  208,  208,  208,  208,
+      208,  208,  208,  208,  208,  208,  208,  208,  208,  193,
+       88,   89,   90,  208,    4,    0,    5,    0,    0,    0,
+        0,    0,    0,  208,  208,  208,  208,  208,  208,  208,
+      204,  208,  208,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,   74,  208,  208,  208,  208,  208,  208,    0,
+        0,    0,    0,  208,  208,  205,  194,  208,  195,  208,
+
+      208,  208,   85,  208,  208,  208,  208,  208,  208,  208,
+      208,  208,  208,  208,  206,  208,  208,   91,    0,    0,
+        0,  196,  197,  208,  200,  208,  201,  208,  208,   70,
+      208,  208,  208,  164,  208,  165,  180,  208,  198,  199,
+      208,  208,    0,    0,    0,  208,  208,  208,  208,   75,
+      208,   76,  208,  208,  208,  208,  208,    0,    0,    0,
+        0,  208,  208,   86,   87,  208,   77,  208,  208,   78,
+      208,   92,   93,    0,    0,    0,    0,  208,  208,  208,
+      208,  208,  208,    0,    0,    0,    0,  208,  208,  208,
+      208,  208,   79,    0,    0,    0,    7,    0,    0,  202,
+
+      203,  208,  208,  208,    0,    0,    8,    0,    0,  208,
+      208,  166,    0,    0,    0,   80,   81,    0,    0,    0,
+        9,    0,    0,   10,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   11,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -461,13 +472,13 @@ static yyconst flex_int32_t yy_ec[256] =
        10,   11,   12,    1,   13,   14,   15,   16,   17,   18,
        19,   20,   21,   21,   21,   22,   22,   23,    1,   24,
        25,   26,    1,    1,   27,   28,   29,   30,   31,   32,
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   34,   35,   33,   36,   33,   33,   37,   33,   33,
-        1,    1,    1,   38,   39,    1,   40,   41,   42,   43,
+       33,   34,   34,   34,   34,   35,   34,   34,   34,   34,
+       34,   36,   37,   38,   39,   34,   34,   40,   34,   34,
+        1,    1,    1,   41,   42,    1,   43,   44,   45,   46,
 
-       44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
-       54,   55,   33,   56,   57,   58,   59,   60,   61,   62,
-       63,   64,    1,   65,    1,    1,    1,    1,    1,    1,
+       47,   48,   49,   50,   51,   52,   53,   54,   55,   56,
+       57,   58,   34,   59,   60,   61,   62,   63,   64,   65,
+       66,   67,    1,   68,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -484,350 +495,357 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[66] =
+static yyconst flex_int32_t yy_meta[69] =
     {   0,
-        1,    2,    3,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    4,    4,    4,    4,    4,
-        4,    5,    1,    1,    1,    1,    6,    6,    6,    6,
-        5,    5,    7,    7,    7,    7,    8,    1,    7,    6,
-        6,    6,    6,    5,    5,    7,    7,    7,    7,    7,
-        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
-        7,    8,    7,    7,    1
+        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    3,    3,    3,    3,    3,
+        3,    3,    1,    1,    1,    1,    4,    4,    4,    4,
+        3,    3,    5,    5,    5,    5,    5,    5,    5,    5,
+        1,    5,    4,    4,    4,    4,    3,    3,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    1
     } ;
 
-static yyconst flex_int16_t yy_base[824] =
+static yyconst flex_int16_t yy_base[845] =
     {   0,
-        0,   64,   70,    0, 1185, 1184, 1186, 1189,   65, 1189,
-     1160, 1159,  128, 1158,  125,  126,  124, 1157,  140,  189,
-      123, 1156,  138,    0,  127,  124,  113,  135,  144,  161,
-      176, 1126,  130,  187,  140,  143,  161, 1120,  182,  174,
-      202,  199,  211,  212, 1131,  130,  263,  255, 1189,  189,
-     1189, 1162,  256, 1189,    0, 1189, 1189,  215, 1189, 1189,
-     1189, 1189, 1189, 1189, 1189, 1189, 1189,  248, 1189,  250,
-      112,  302,  319, 1189, 1189,    0,    0, 1189, 1151, 1189,
-     1189, 1189, 1150,    0, 1189, 1189, 1116, 1121, 1114, 1117,
-     1126, 1125, 1111, 1114, 1126,  144, 1120, 1107, 1104, 1118,
-
-     1104, 1101, 1101, 1107,  175,  191, 1101, 1112, 1097, 1103,
-     1107, 1108,    0, 1099, 1110,  247, 1109, 1104, 1084,  230,
-     1088, 1102, 1092,  241, 1085,  228, 1098, 1100, 1082, 1078,
-     1086, 1083, 1072, 1081,  173, 1079, 1085, 1080, 1083, 1071,
-     1074,  233,  240,  260, 1084, 1071, 1084,  239, 1077, 1189,
-     1189,  307,  301,  323, 1189, 1062, 1075, 1066, 1077,  249,
-        0,  368,    0,  379, 1189,  298,  390, 1189,  397,  404,
-      291, 1189, 1189, 1072,    0, 1063, 1067, 1077, 1074,  270,
-     1057, 1057, 1061,  291, 1072, 1069, 1069, 1067, 1064, 1055,
-     1062, 1048, 1046, 1059, 1044, 1061,    0, 1058, 1045, 1053,
-
-     1050, 1054, 1055, 1048, 1045, 1033, 1032, 1046, 1049, 1036,
-     1045, 1032, 1039, 1029,  335, 1035, 1038, 1028, 1036, 1024,
-     1028, 1019, 1034, 1024, 1015, 1034, 1017, 1015, 1026, 1015,
-     1010, 1008, 1022, 1007, 1009, 1006, 1018, 1017, 1020, 1001,
-      306, 1010, 1005, 1003, 1013,  991,  339, 1010, 1012, 1000,
-      992,  996, 1008,  991,    0,  411,  421,  438, 1189,  451,
-      458, 1189, 1189,  986,  997,    0,  994,  344,    0,    0,
-      987,  985,  987,  982,  991,  979,  997,  985,  350,    0,
-        0,  979,  990,  989,  989,    0,  973,  353,    0,    0,
-      975,  357,  983,  984,  974,  968,  967,  968,  967,  967,
-
-      361,  962,    0,    0,  958,  957,  956,  958,  959,  964,
-      958,  954,  968,  963,  962,  961,  952,  955,  955,  947,
-      950,  945,  954,  959,  944,  957,  947,    0,    0,  954,
-      950,    0,  941,  941,  947,  937,  945,  426,  942,    0,
-        0,    0,    0,  931,  944,  943,  942,  939,  927,  465,
-      475,  939,  941,    0,    0,    0,    0,  927,    0,  927,
-        0,  926,  927,  921,  932,    0,    0,    0,  922,    0,
-      918,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      929,  481,  928,    0,    0,  926,  922,  918,    0,    0,
-        0,  910,  443,  486,  493,  915,  911,  917,  907,  905,
-
-      919,  903,  903,  917,  905,  917,  912,    0,  910,  907,
-      911,  894,  896,  903,  909,  904,  903,  890,    0,  892,
-      893,    0,    0,    0,    0,  890,  894,    0,  888,  938,
-      887,  890,    0,  878,  888,    0,  876,  876,  890,    0,
-      892,    0,  497,  901,  900,  899,  869,  868,    0,  886,
-      885,  880,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  868,  882,  868,  865,    0,    0,  871,  870,
-        0,    0,  868,  860,    0,    0,    0,    0,    0,    0,
-      857,  869,  500,  861,  868,  867,  864,  858,  851,  519,
-      867,  852,  847,  861,  859,    0,    0,  851,  871,  870,
-
-      869,  839,  838,  495,  496,    0,  851,  854,  852,  840,
-      836,    0,  849,  846,  845,  834,  833,  832,  515,  841,
-        0,  854,  853,  852,  822,  821,    0,  836,  822,    0,
-      833,  828,  543,  545,  873,  821,  829,    0,    0,    0,
-      845,  844,    0,  825,  828,  812,  820,  810,  818,  819,
-      819,  818,  803,  539,  816,    0,  817,  805,  804,  800,
-      825,  824,  823,  793,  792,    0,  823,  822,    0,  803,
-      806,    0,  552,    0,  792,  557, 1189,  580,    0,  590,
-      499, 1189,    0,  789,  788,  798,  798,  785,  800,  783,
-      798,  793,    0,    0,    0,  806,  805,  804,  774,    0,
-
-      774,    0,    0,    0,  559,  568,  797,  785,  788,  772,
-      771,  781,  781,  794,  793,  792,  762,  767,  552,  613,
-      363,  775,  763,  761,  760,  771,    0,  774,  770,  772,
-      768,  754,  782,  781,    0,  766,  758,  749,  757,  747,
-      758,  754,  756,  754,  754,  741,  740,  751,    0,  767,
-      766,    0,  751, 1189,  391, 1189,  620,    0,  640,  750,
-      732,  749,  748,  731,  723,  731,  721,  729,    0,  726,
-      725,  736,  719,  722,  737,  720,  733,  734,  731,  728,
-      736,  730,  729,  712,  711,  710,  721,  402,  705,  715,
-      699,  698,    0,  725,  698,  723,  696,  700,  699,    0,
-
-      710,  713,  709,  711,  688,  702,  686,  680,  688,  671,
-      662,    0,  640,  639,    0,  648,  641,    0,    0,  645,
-        0,  644,    0,  650,  649,    0,  625,  633,  623,  650,
-      630,    0,    0,  643,    0,    0,  642,  641,  582,  632,
-      639,  638,  614,  613,  635,  608,  633,  607,  590,  607,
-      586,  585,  611,  380,  526,  545,  544,    0,    0,  538,
-        0,  504,  510,    0,  495,    0,    0,  550,  572,  483,
-      470,  454,  462,  449,  445,  404,  419,  616,  619,  391,
-      387,  404,  392,  290,    0,  617,  642, 1189,  644,  570,
-        0,    0,  263,  258,  139,  645, 1189,  643,  618,  107,
-
-       77,    0,   23,  662,    0,    0,  663,  664, 1189,  665,
-     1189, 1189,  697,  702,  707,  712,  714,  716,  722,  729,
-      734,  739,  744
+        0,   67,   73,    0, 1210, 1209, 1211, 1214,   68, 1214,
+     1185, 1184,  134, 1183,  131,  132,  130, 1182,  146,  198,
+      129, 1181,  144,    0,  130,  113,  124,  141,  150,  126,
+      181, 1148,  159,  192,  118,  129,  146, 1142,  147,  174,
+      206,  192,  203,  222, 1153,  203,  221,  231, 1214,  260,
+     1214, 1187,  279, 1214,    0, 1214, 1214,  270, 1214, 1214,
+     1214, 1214, 1214, 1214, 1214, 1214, 1214,  244, 1214,  255,
+      139,  290,  307, 1214, 1214,    0,    0, 1214, 1176, 1214,
+     1214, 1214, 1175,    0, 1214, 1214, 1138, 1143, 1136, 1139,
+     1148, 1147, 1133, 1136, 1148,  144, 1142, 1129, 1126, 1140,
+
+     1126, 1123, 1123, 1129,  219,  193, 1123, 1134, 1119, 1125,
+     1129, 1130,    0, 1121, 1132,  278, 1131, 1126, 1106,  224,
+     1110, 1124, 1114,  232, 1107,  271, 1120, 1122, 1104, 1100,
+     1108, 1105, 1094, 1103,  234, 1101, 1107, 1102, 1105, 1093,
+     1096,  226,  145,  262, 1106, 1093, 1106,  263, 1099, 1214,
+     1214,  338,  331,  343, 1214, 1084, 1097, 1088, 1099,  345,
+        0,  334,    0,  345, 1214,  328,  391, 1214,  352,  398,
+      338, 1214, 1214, 1094,    0, 1085, 1089, 1099, 1096,  332,
+     1079, 1079, 1083,  320, 1094, 1091, 1091, 1089, 1086, 1077,
+     1084, 1070, 1068, 1081, 1066, 1083,    0, 1080, 1067, 1075,
+
+     1072, 1076, 1077, 1070, 1067, 1055, 1054, 1068, 1071, 1058,
+     1067, 1054, 1061, 1051,  364, 1057, 1060, 1050, 1058, 1046,
+     1050, 1041, 1056, 1046, 1037, 1056, 1039, 1037, 1048, 1037,
+     1032, 1030, 1044, 1029, 1031, 1028, 1040, 1039, 1042, 1023,
+      338, 1032, 1027, 1025, 1035, 1013,  403, 1032, 1034, 1022,
+     1014, 1018, 1030, 1013,    0,  415,  422,  439, 1214,  446,
+      455, 1214, 1214, 1008, 1019,    0, 1016,  406,    0,    0,
+     1009, 1007, 1009, 1004, 1013, 1001, 1019, 1007,  409,    0,
+        0, 1001, 1012, 1011, 1011,    0,  995,  429,    0,    0,
+      997,  460, 1005, 1006,  996,  990,  989,  990,  989,  989,
+
+      463,  984,    0,    0,  980,  979,  978,  980,  981,  986,
+      980,  976,  990,  985,  984,  983,  974,  977,  977,  969,
+      972,  967,  976,  981,  966,  979,  969,    0,    0,  976,
+      972,    0,  963,  963,  969,  959,  967,  466,  964,    0,
+        0,    0,    0,  953,  966,  965,  964,  961,  949,  472,
+      479,  961,  963,    0,    0,    0,    0,  949,    0,  949,
+        0,  948,  949,  943,  954,    0,    0,    0,  944,    0,
+      940,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      951,  487,  950,    0,    0,  948,  944,  940,    0,    0,
+        0,  932,  489,  494,  499,  937,  933,  939,  929,  927,
+
+      941,  925,  925,  939,  927,  939,  934,    0,  932,  929,
+      933,  916,  918,  925,  931,  926,  925,  912,    0,  914,
+      915,    0,    0,    0,    0,  912,  916,    0,  910,  963,
+      909,  912,    0,  900,  910,    0,  898,  898,  912,    0,
+      914,    0,  503,  926,  925,  924,  891,  890,    0,  908,
+      907,  902,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,  890,  904,  890,  887,    0,    0,  893,  892,
+        0,    0,  890,  882,    0,    0,    0,    0,    0,    0,
+      879,  891,  506,  883,  890,  889,  886,  880,  873,  524,
+      889,  874,  869,  883,  881,    0,    0,  873,  896,  895,
+
+      894,  861,  860,  361,  365,    0,  873,  876,  874,  862,
+      858,    0,  871,  868,  867,  856,  855,  854,  519,  863,
+        0,  879,  878,  877,  844,  843,    0,  858,  844,    0,
+      855,  850,  547,  553,  898,  843,  851,    0,    0,    0,
+      870,  869,    0,  847,  850,  834,  842,  832,  840,  841,
+      841,  840,  825,  559,  838,    0,  839,  827,  826,  822,
+      850,  849,  848,  815,  814,    0,  848,  847,    0,  825,
+      828,    0,  562,    0,  814,  580, 1214,  587,    0,  607,
+      584, 1214,    0,  811,  810,  820,  820,  807,  822,  805,
+      820,  815,    0,    0,    0,  831,  830,  829,  796,    0,
+
+      796,    0,    0,    0,  502,  524,  820,  807,  810,  794,
+      793,  803,  803,  819,  818,  817,  784,  789,  615,  640,
+      550,  806,  796,  784,  782,  781,  792,    0,  795,  791,
+      793,  789,  775,  806,  805,    0,  787,  779,  770,  778,
+      768,  779,  775,  777,  775,  775,  762,  761,  772,    0,
+      791,  790,    0,  772, 1214,  555, 1214,  647,    0,  667,
+      785,  770,  752,  769,  768,  751,  743,  751,  741,  749,
+        0,  746,  745,  756,  739,  742,  757,  740,  753,  754,
+      751,  748,  757,  750,  749,  732,  731,  730,  741,  582,
+      754,  724,  734,  718,  717,    0,  745,  717,  743,  715,
+
+      719,  718,    0,  729,  732,  728,  730,  711,  725,  709,
+      710,  718,  701,  700,    0,  706,  705,    0,  728,  713,
+      706,    0,    0,  710,    0,  709,    0,  715,  714,    0,
+      690,  698,  688,  716,  695,    0,    0,  708,    0,    0,
+      707,  706,  746,  611,  696,  703,  702,  678,  677,  705,
+      677,  703,  689,  674,  691,  670,  669,  190,  613,  557,
+      667,  687,  686,    0,    0,  681,    0,  680,  686,    0,
+      671,    0,    0,  671,  590,  343,  672,  645,  644,  654,
+      635,  631,  612,  612,  604,  443,  635,  576,  575,  549,
+       25,   87,    0,  183,  500,  552, 1214,  636,  591,    0,
+
+        0,  196,  258,  254,  272,  609, 1214,  614,  598,  279,
+      284,    0,  336,  348,  671,    0,    0,  362,  672,  688,
+     1214,  394,  689, 1214,  408,  670,  691,  649,  651,  474,
+      476,  693,  694, 1214, 1214,  704,  707,  710,  530,  591,
+      713,  717,  720,  722
     } ;
 
-static yyconst flex_int16_t yy_def[824] =
+static yyconst flex_int16_t yy_def[845] =
     {   0,
-      812,    1,  812,    3,  813,  813,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  814,  812,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  815,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  816,  812,  817,
-       19,  812,  812,  812,  812,  818,   20,  812,  812,  812,
-      812,  812,  812,  814,  812,  812,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      819,  812,  815,  812,  812,  817,  812,  812,  812,  812,
-      818,  812,  812,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      812,  812,  812,  812,  819,  812,  812,  812,  812,  812,
-      812,  812,  812,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  812,  812,  812,  812,  812,
-      812,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  812,  812,
-      812,  812,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  812,  812,
-      812,  812,  814,  814,  814,  814,  814,  814,  814,  814,
-
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  812,  820,  812,  812,  812,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  812,  812,  812,  812,  821,  812,
-      812,  812,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  812,  822,  812,
-      821,  812,  812,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  812,  812,  812,  812,  823,  812,  812,
-      812,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  823,  812,  812,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  812,  812,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  814,  812,  812,
-      814,  814,  814,  814,  814,  814,  814,  814,  814,  814,
-      814,  814,  812,  812,  812,  814,  814,  814,  814,  814,
-      814,  814,  814,  814,  814,  814,  814,  812,  812,  812,
-      814,  814,  814,  814,  814,  814,  812,  812,  812,  814,
-      814,  814,  814,  814,  814,  812,  812,  812,  812,  812,
-      814,  814,  814,  814,  814,  812,  812,  812,  812,  814,
-
-      814,  814,  812,  812,  814,  814,  812,  812,  812,  812,
-      812,    0,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812
+      835,    1,  835,    3,  836,  836,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  837,  835,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  838,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  839,  835,  840,
+       19,  835,  835,  835,  835,  841,   20,  835,  835,  835,
+      835,  835,  835,  837,  835,  835,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      842,  835,  838,  835,  835,  840,  835,  835,  835,  835,
+      841,  835,  835,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      835,  835,  835,  835,  842,  835,  835,  835,  835,  835,
+      835,  835,  835,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  835,  835,  835,  835,  835,
+      835,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  835,  835,
+      835,  835,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  835,  835,
+      835,  835,  837,  837,  837,  837,  837,  837,  837,  837,
+
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  835,  835,  835,  835,  835,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  835,  835,  835,  835,  843,  835,
+      835,  835,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  835,  835,  835,
+      843,  835,  835,  835,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  835,  835,  835,  835,  844,  835,
+      835,  835,  835,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  844,
+      835,  835,  835,  837,  837,  837,  837,  837,  837,  837,
+
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  835,  835,
+      835,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  835,  835,  835,  837,  837,  837,  837,  837,
+      837,  837,  837,  837,  837,  837,  837,  835,  835,  835,
+      835,  837,  837,  837,  837,  837,  837,  837,  837,  837,
+      837,  837,  837,  835,  835,  835,  835,  837,  837,  837,
+      837,  837,  837,  835,  835,  835,  835,  837,  837,  837,
+      837,  837,  837,  835,  835,  835,  835,  835,  835,  837,
+
+      837,  837,  837,  837,  835,  835,  835,  835,  835,  837,
+      837,  837,  835,  835,  835,  837,  837,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,    0,  835,  835,  835,  835,  835,
+      835,  835,  835,  835
     } ;
 
-static yyconst flex_int16_t yy_nxt[1255] =
+static yyconst flex_int16_t yy_nxt[1283] =
     {   0,
         8,    9,   10,    9,   11,    8,   12,   13,    8,    8,
        14,   15,   16,   17,   18,   19,   20,   20,   20,   20,
        20,   20,    8,   21,   22,   23,   24,   24,   24,   24,
-       24,   24,   24,   24,   24,   24,   24,   25,   24,   26,
-       27,   28,   29,   30,   31,   32,   33,   34,   24,   24,
-       35,   36,   37,   38,   39,   40,   41,   42,   43,   44,
-       45,   24,   24,   24,   46,   47,   58,  807,   58,   48,
-       49,   50,   51,   50,   49,   49,   49,   49,   49,   49,
-       49,   49,   49,   49,   52,   49,   53,   53,   53,   53,
-       53,   53,   54,   49,   49,   49,   55,   55,   55,   55,
-
-       55,   55,   55,   55,   55,   55,   55,   49,   55,   55,
+       24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
+       25,   24,   26,   27,   28,   29,   30,   31,   32,   33,
+       34,   24,   24,   35,   36,   37,   38,   39,   40,   41,
+       42,   43,   44,   45,   24,   24,   24,   46,   47,   58,
+      803,   58,   48,   49,   50,   51,   50,   49,   49,   49,
+       49,   49,   49,   49,   49,   49,   49,   52,   49,   53,
+       53,   53,   53,   53,   53,   54,   49,   49,   49,   55,
+
        55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
+       55,   55,   55,   49,   55,   55,   55,   55,   55,   55,
        55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   49,   61,   64,  806,   66,   68,
-       68,   68,   68,   68,   68,   68,   79,   80,  812,   65,
-       67,   85,   62,   70,  150,   71,   71,   71,   71,   71,
-       71,   72,   82,   83,   86,   87,   90,  805,   91,  110,
-       73,   74,   92,  812,   93,   75,   76,  111,   94,  119,
-       88,   89,  121,   73,   74,   95,  122,   97,   96,  112,
-      160,   98,  160,  120,  151,  183,  184,   99,   75,  802,
-
-      123,   76,   70,  100,   77,   77,   77,   77,   77,   77,
-       77,  101,  231,  102,  124,  104,   58,  129,   58,   73,
-       74,  126,  103,  105,   78,  193,  106,  130,  232,  107,
-      195,  113,   73,   74,  114,  108,  194,  127,  115,  116,
-      128,  131,  138,  117,  196,  139,  118,   78,  132,  133,
-      160,  146,  160,  134,  140,  147,  154,  155,  142,  135,
-      136,  141,  137,  143,  152,  148,   58,  144,  153,  221,
-      145,  162,  162,  162,  162,  162,  162,  162,  164,  165,
-      167,  168,  213,  222,  239,  240,  248,  241,  218,  249,
-      214,  164,  165,  167,  168,  219,  242,  205,  156,  243,
-
-      206,  207,  154,  155,  208,  157,  209,  244,  152,  158,
-       58,  801,  153,  269,  159,   70,  800,   72,   72,   72,
-       72,   72,   72,   72,  154,  155,  263,  270,  258,  259,
-      169,  169,   73,   74,  170,  170,  170,  170,  170,  170,
-      170,  258,  259,  795,  156,   73,   74,  274,  275,  263,
-      333,  157,  305,  306,  307,  158,  340,  341,  342,  334,
-      159,  355,  356,  357,  576,  577,  156,  366,  367,  368,
-      374,  375,  376,  157,  378,  379,  380,  158,  389,  390,
-      391,  768,  159,  162,  162,  162,  162,  162,  162,  162,
-      256,  256,  655,  656,  257,  257,  257,  257,  257,  257,
-
-      257,  260,  260,  655,  656,  261,  261,  261,  261,  261,
-      261,  261,  170,  170,  170,  170,  170,  170,  170,  170,
-      170,  170,  170,  170,  170,  170,  257,  257,  257,  257,
-      257,  257,  257,  769,  794,  262,  257,  257,  257,  257,
-      257,  257,  257,  423,  424,  425,  793,  792,  262,  350,
-      350,  791,  165,  351,  351,  351,  351,  351,  351,  351,
-      454,  455,  456,  786,  785,  165,  261,  261,  261,  261,
-      261,  261,  261,  261,  261,  261,  261,  261,  261,  261,
-      351,  351,  351,  351,  351,  351,  351,  784,  783,  168,
-      351,  351,  351,  351,  351,  351,  351,  444,  445,  446,
-
-      581,  782,  168,  457,  458,  459,  259,  781,  447,  448,
-      460,  461,  462,  499,  500,  501,  522,  523,  524,  259,
-      490,  546,  548,  780,  502,  503,  779,  525,  526,  547,
-      549,  561,  562,  563,  533,  534,  534,  534,  534,  534,
-      534,  622,  564,  565,  576,  577,  576,  577,  776,  775,
-      774,  768,  623,  655,  656,  596,  597,  598,  576,  577,
-      580,  580,  580,  580,  580,  580,  580,  599,  614,  615,
-      616,  798,  619,  620,  620,  620,  620,  620,  620,  579,
-      617,  576,  577,  753,  773,  638,  772,  771,  658,  770,
-      754,  576,  577,  639,  640,  578,  578,  578,  578,  578,
-
-      578,  641,  642,  769,  579,  580,  580,  580,  580,  580,
-      580,  580,  753,  658,  655,  656,  777,  787,  796,  754,
-      789,  655,  656,  799,  778,  788,  797,  790,  659,  659,
-      659,  659,  659,  659,  659,  657,  657,  657,  657,  657,
-      657,  655,  656,  787,  798,  789,  796,  767,  766,  765,
-      764,  788,  790,  763,  797,  659,  659,  659,  659,  659,
-      659,  659,  803,  808,  810,  808,  810,  762,  761,  760,
-      804,  809,  811,  809,  811,  759,  758,  757,  756,  755,
-      752,  751,  750,  749,  748,  747,  746,  745,  744,  743,
-      742,  741,  740,  739,  738,  737,  799,   56,   56,   56,
-
-       56,   56,   56,   56,   56,   84,   84,   84,   84,   84,
-      163,  163,  163,  163,  163,   68,   68,  166,  166,  171,
-      171,  171,  255,  255,  736,  255,  255,  255,  255,  255,
-      578,  578,  578,  735,  734,  733,  578,  621,  621,  621,
-      657,  657,  657,  732,  731,  730,  657,  688,  688,  688,
-      729,  728,  727,  726,  725,  724,  723,  722,  721,  720,
-      719,  718,  717,  716,  715,  714,  713,  712,  711,  710,
-      709,  708,  707,  706,  705,  704,  703,  702,  701,  700,
-      699,  698,  697,  696,  695,  694,  693,  692,  691,  690,
-      689,  687,  686,  685,  684,  683,  682,  681,  680,  679,
-
-      678,  677,  676,  675,  674,  673,  672,  671,  670,  669,
-      668,  667,  666,  665,  664,  663,  662,  661,  660,  654,
-      653,  652,  651,  650,  649,  648,  647,  646,  645,  644,
-      643,  637,  636,  635,  634,  633,  632,  631,  630,  629,
-      628,  627,  626,  625,  624,  618,  613,  612,  611,  610,
-      609,  608,  607,  606,  605,  604,  603,  602,  601,  600,
-      595,  594,  593,  592,  591,  590,  589,  588,  587,  586,
-      585,  584,  583,  582,  581,  575,  574,  573,  572,  571,
-      570,  569,  568,  567,  566,  560,  559,  558,  557,  556,
-      555,  554,  553,  552,  551,  550,  545,  544,  543,  542,
-
-      541,  540,  539,  538,  537,  536,  535,  532,  531,  530,
-      529,  528,  527,  521,  520,  519,  518,  517,  516,  515,
-      514,  513,  512,  511,  510,  509,  508,  507,  506,  505,
-      504,  498,  497,  496,  495,  494,  493,  492,  491,  490,
-      489,  488,  487,  486,  485,  484,  483,  482,  481,  480,
-      479,  478,  477,  476,  475,  474,  473,  472,  471,  470,
-      469,  468,  467,  466,  465,  464,  463,  453,  452,  451,
-      450,  449,  443,  442,  441,  440,  439,  438,  437,  436,
-      435,  434,  433,  432,  431,  430,  429,  428,  427,  426,
-      422,  421,  420,  419,  418,  417,  416,  415,  414,  413,
-
-      412,  411,  410,  409,  408,  407,  406,  405,  404,  403,
-      402,  401,  400,  399,  398,  397,  396,  395,  394,  393,
-      392,  388,  387,  386,  385,  384,  383,  382,  381,  377,
-      373,  372,  371,  370,  369,  365,  364,  363,  362,  361,
-      360,  359,  358,  354,  353,  352,  349,  348,  347,  346,
-      345,  344,  343,  339,  338,  337,  336,  335,  332,  331,
-      330,  329,  328,  327,  326,  325,  324,  323,  322,  321,
-      320,  319,  318,  317,  316,  315,  314,  313,  312,  311,
-      310,  309,  308,  304,  303,  302,  301,  300,  299,  298,
-      297,  296,  295,  294,  293,  292,  291,  290,  289,  288,
-
-      287,  286,  285,  284,  283,  282,  281,  280,  279,  278,
-      277,  276,  273,  272,  271,  268,  267,  266,  265,  264,
-      254,  253,  252,  251,  250,  247,  246,  245,  238,  237,
-      236,  235,  234,  233,  230,  229,  228,  227,  226,  225,
-      224,  223,  220,  217,  216,  215,  212,  211,  210,  204,
-      203,  202,  201,  200,  199,  198,  197,  192,  191,  190,
-      189,  188,  187,  186,  185,  182,  181,  180,  179,  178,
-      177,  176,  175,  174,  173,  172,  161,  149,  125,  109,
-       81,   69,   63,   60,   59,  812,   57,   57,    7,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812
+       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
+       49,   61,   64,  804,   66,   68,   68,   68,   68,   68,
+       68,   68,   79,   80,   85,   65,   67,   87,   62,   70,
+      119,   71,   71,   71,   71,   71,   71,   72,   82,   83,
+       86,  121,   88,   89,  120,  122,   73,   74,  835,  101,
+       90,  102,   91,   93,   75,   76,   92,   94,  123,  126,
+      103,  758,   73,   74,   95,  241,   97,   96,  183,  184,
+
+       98,  110,  124,  835,  242,  127,   99,   75,  128,  111,
+       76,   70,  100,   77,   77,   77,   77,   77,   77,   77,
+      129,  112,  152,  104,   58,  805,  153,  150,   73,   74,
+      130,  105,  154,  155,  106,  195,   78,  107,  138,  113,
+      774,  139,  114,  108,   73,   74,  115,  116,  131,  196,
+      140,  117,  810,  142,  118,  132,  133,  141,  143,   78,
+      134,  160,  144,  160,  146,  145,  135,  136,  147,  137,
+      151,   58,  193,   58,  164,  165,  231,  156,  148,  213,
+      239,  240,  218,  194,  157,  167,  168,  214,  158,  219,
+      164,  165,  232,  159,  162,  162,  162,  162,  162,  162,
+
+      162,  167,  168,   70,  243,   72,   72,   72,   72,   72,
+       72,   72,  244,  248,  811,  221,  249,  812,  169,  169,
+       73,   74,  170,  170,  170,  170,  170,  170,  170,  222,
+      813,  205,  154,  155,  206,  207,   73,   74,  208,  152,
+      209,   58,  816,  153,  154,  155,  160,  817,  160,  162,
+      162,  162,  162,  162,  162,  162,  256,  256,  258,  259,
+      257,  257,  257,  257,  257,  257,  257,  170,  170,  170,
+      170,  170,  170,  170,  258,  259,  263,  156,  269,  274,
+      275,  305,  306,  307,  157,  333,  818,  546,  158,  156,
+      785,  548,  270,  159,  334,  819,  157,  547,  786,  263,
+
+      158,  549,  260,  260,  822,  159,  261,  261,  261,  261,
+      261,  261,  261,  170,  170,  170,  170,  170,  170,  170,
+      340,  341,  342,  355,  356,  357,  366,  367,  368,  262,
+      257,  257,  257,  257,  257,  257,  257,  257,  257,  257,
+      257,  257,  257,  257,  796,  262,  374,  375,  376,  825,
+      350,  350,  797,  165,  351,  351,  351,  351,  351,  351,
+      351,  261,  261,  261,  261,  261,  261,  261,  826,  165,
+      261,  261,  261,  261,  261,  261,  261,  378,  379,  380,
+      389,  390,  391,  423,  424,  425,  168,  351,  351,  351,
+      351,  351,  351,  351,  351,  351,  351,  351,  351,  351,
+
+      351,  806,  168,  444,  445,  446,  454,  455,  456,  807,
+      259,  457,  458,  459,  447,  448,  460,  461,  462,  499,
+      500,  501,  522,  523,  524,  490,  259,  831,  639,  832,
+      502,  503,   68,  525,  526,  561,  562,  563,  640,  533,
+      534,  534,  534,  534,  534,  534,  564,  565,  576,  577,
+      641,  576,  577,  796,  576,  577,  656,  657,  775,  642,
+      643,  797,  578,  578,  578,  578,  578,  578,  580,  580,
+      580,  580,  580,  580,  580,  596,  597,  598,  614,  615,
+      616,  576,  577,  656,  657,  581,  579,  599,  576,  577,
+      617,  775,  808,  166,  802,  619,  620,  620,  620,  620,
+
+      620,  620,  578,  578,  578,  578,  578,  578,  576,  577,
+      806,  579,  759,  776,  759,  808,  656,  657,  807,  760,
+      622,  760,  580,  580,  580,  580,  580,  580,  580,  623,
+      658,  658,  658,  658,  658,  658,  798,  798,  801,  800,
+      624,  656,  657,  799,  799,  814,  776,  809,  656,  657,
+      829,  795,  829,  815,  659,  660,  660,  660,  660,  660,
+      660,  660,  658,  658,  658,  658,  658,  658,  656,  657,
+      809,  827,  820,  823,  794,  793,  792,  791,  828,  659,
+      821,  824,  660,  660,  660,  660,  660,  660,  660,  820,
+      823,  830,  827,  830,  833,  833,  790,  821,  824,  828,
+
+      789,  788,  834,  834,   56,   56,   56,   56,   56,   84,
+       84,   84,  163,  163,  163,  171,  171,  255,  787,  255,
+      255,  255,  621,  621,  690,  690,  784,  783,  782,  781,
+      780,  779,  778,  777,  773,  772,  771,  770,  769,  768,
+      767,  766,  765,  764,  763,  762,  761,  758,  757,  756,
+      755,  754,  753,  752,  751,  750,  749,  748,  747,  746,
+      745,  744,  743,  742,  741,  740,  739,  738,  737,  736,
+      735,  734,  733,  732,  731,  730,  729,  728,  727,  726,
+      725,  724,  723,  722,  721,  720,  719,  718,  717,  716,
+      715,  714,  713,  712,  711,  710,  709,  708,  707,  706,
+
+      705,  704,  703,  702,  701,  700,  699,  698,  697,  696,
+      695,  694,  693,  692,  691,  689,  688,  687,  686,  685,
+      684,  683,  682,  681,  680,  679,  678,  677,  676,  675,
+      674,  673,  672,  671,  670,  669,  668,  667,  666,  665,
+      664,  663,  662,  661,  655,  654,  653,  652,  651,  650,
+      649,  648,  647,  646,  645,  644,  638,  637,  636,  635,
+      634,  633,  632,  631,  630,  629,  628,  627,  626,  625,
+      618,  613,  612,  611,  610,  609,  608,  607,  606,  605,
+      604,  603,  602,  601,  600,  595,  594,  593,  592,  591,
+      590,  589,  588,  587,  586,  585,  584,  583,  582,  581,
+
+      575,  574,  573,  572,  571,  570,  569,  568,  567,  566,
+      560,  559,  558,  557,  556,  555,  554,  553,  552,  551,
+      550,  545,  544,  543,  542,  541,  540,  539,  538,  537,
+      536,  535,  532,  531,  530,  529,  528,  527,  521,  520,
+      519,  518,  517,  516,  515,  514,  513,  512,  511,  510,
+      509,  508,  507,  506,  505,  504,  498,  497,  496,  495,
+      494,  493,  492,  491,  490,  489,  488,  487,  486,  485,
+      484,  483,  482,  481,  480,  479,  478,  477,  476,  475,
+      474,  473,  472,  471,  470,  469,  468,  467,  466,  465,
+      464,  463,  453,  452,  451,  450,  449,  443,  442,  441,
+
+      440,  439,  438,  437,  436,  435,  434,  433,  432,  431,
+      430,  429,  428,  427,  426,  422,  421,  420,  419,  418,
+      417,  416,  415,  414,  413,  412,  411,  410,  409,  408,
+      407,  406,  405,  404,  403,  402,  401,  400,  399,  398,
+      397,  396,  395,  394,  393,  392,  388,  387,  386,  385,
+      384,  383,  382,  381,  377,  373,  372,  371,  370,  369,
+      365,  364,  363,  362,  361,  360,  359,  358,  354,  353,
+      352,  349,  348,  347,  346,  345,  344,  343,  339,  338,
+      337,  336,  335,  332,  331,  330,  329,  328,  327,  326,
+      325,  324,  323,  322,  321,  320,  319,  318,  317,  316,
+
+      315,  314,  313,  312,  311,  310,  309,  308,  304,  303,
+      302,  301,  300,  299,  298,  297,  296,  295,  294,  293,
+      292,  291,  290,  289,  288,  287,  286,  285,  284,  283,
+      282,  281,  280,  279,  278,  277,  276,  273,  272,  271,
+      268,  267,  266,  265,  264,  254,  253,  252,  251,  250,
+      247,  246,  245,  238,  237,  236,  235,  234,  233,  230,
+      229,  228,  227,  226,  225,  224,  223,  220,  217,  216,
+      215,  212,  211,  210,  204,  203,  202,  201,  200,  199,
+      198,  197,  192,  191,  190,  189,  188,  187,  186,  185,
+      182,  181,  180,  179,  178,  177,  176,  175,  174,  173,
+
+      172,  161,  149,  125,  109,   81,   69,   63,   60,   59,
+      835,   57,   57,    7,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835
     } ;
 
-static yyconst flex_int16_t yy_chk[1255] =
+static yyconst flex_int16_t yy_chk[1283] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -835,138 +853,141 @@ static yyconst flex_int16_t yy_chk[1255] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    2,    9,  803,    9,    2,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    9,
+      791,    9,    2,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
 
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,   13,   15,  801,   16,   17,
-       17,   17,   17,   17,   17,   17,   21,   21,   71,   15,
-       16,   25,   13,   19,   46,   19,   19,   19,   19,   19,
-       19,   19,   23,   23,   25,   26,   27,  800,   27,   33,
-       19,   19,   27,   71,   28,   19,   19,   33,   28,   35,
-       26,   26,   36,   19,   19,   28,   36,   29,   28,   33,
-       50,   29,   50,   35,   46,   96,   96,   29,   19,  795,
-
-       37,   19,   20,   29,   20,   20,   20,   20,   20,   20,
-       20,   30,  135,   30,   37,   31,   58,   40,   58,   20,
-       20,   39,   30,   31,   20,  105,   31,   40,  135,   31,
-      106,   34,   20,   20,   34,   31,  105,   39,   34,   34,
-       39,   41,   42,   34,  106,   42,   34,   20,   41,   41,
-      160,   44,  160,   41,   42,   44,   48,   48,   43,   41,
-       41,   42,   41,   43,   47,   44,   47,   43,   47,  126,
-       43,   53,   53,   53,   53,   53,   53,   53,   68,   68,
-       70,   70,  120,  126,  142,  142,  148,  143,  124,  148,
-      120,   68,   68,   70,   70,  124,  143,  116,   48,  144,
-
-      116,  116,  153,  153,  116,   48,  116,  144,  152,   48,
-      152,  794,  152,  180,   48,   72,  793,   72,   72,   72,
-       72,   72,   72,   72,  154,  154,  171,  180,  166,  166,
-       73,   73,   72,   72,   73,   73,   73,   73,   73,   73,
-       73,  166,  166,  784,  153,   72,   72,  184,  184,  171,
-      241,  153,  215,  215,  215,  153,  247,  247,  247,  241,
-      153,  268,  268,  268,  621,  621,  154,  279,  279,  279,
-      288,  288,  288,  154,  292,  292,  292,  154,  301,  301,
-      301,  754,  154,  162,  162,  162,  162,  162,  162,  162,
-      164,  164,  655,  655,  164,  164,  164,  164,  164,  164,
-
-      164,  167,  167,  688,  688,  167,  167,  167,  167,  167,
-      167,  167,  169,  169,  169,  169,  169,  169,  169,  170,
-      170,  170,  170,  170,  170,  170,  256,  256,  256,  256,
-      256,  256,  256,  754,  783,  170,  257,  257,  257,  257,
-      257,  257,  257,  338,  338,  338,  782,  781,  170,  258,
-      258,  780,  257,  258,  258,  258,  258,  258,  258,  258,
-      393,  393,  393,  777,  776,  257,  260,  260,  260,  260,
-      260,  260,  260,  261,  261,  261,  261,  261,  261,  261,
-      350,  350,  350,  350,  350,  350,  350,  775,  774,  261,
-      351,  351,  351,  351,  351,  351,  351,  382,  382,  382,
-
-      581,  773,  261,  394,  394,  394,  351,  772,  382,  382,
-      395,  395,  395,  443,  443,  443,  483,  483,  483,  351,
-      490,  504,  505,  771,  443,  443,  770,  483,  483,  504,
-      505,  519,  519,  519,  490,  490,  490,  490,  490,  490,
-      490,  581,  519,  519,  533,  533,  534,  534,  765,  763,
-      762,  768,  581,  619,  619,  554,  554,  554,  576,  576,
-      534,  534,  534,  534,  534,  534,  534,  554,  573,  573,
-      573,  790,  576,  576,  576,  576,  576,  576,  576,  533,
-      573,  578,  578,  739,  760,  605,  757,  756,  619,  755,
-      739,  580,  580,  605,  606,  578,  578,  578,  578,  578,
-
-      578,  606,  606,  768,  533,  580,  580,  580,  580,  580,
-      580,  580,  753,  619,  620,  620,  769,  778,  786,  753,
-      779,  657,  657,  790,  769,  778,  786,  779,  620,  620,
-      620,  620,  620,  620,  620,  657,  657,  657,  657,  657,
-      657,  659,  659,  787,  798,  789,  796,  752,  751,  750,
-      749,  787,  789,  748,  796,  659,  659,  659,  659,  659,
-      659,  659,  799,  804,  807,  808,  810,  747,  746,  745,
-      799,  804,  807,  808,  810,  744,  743,  742,  741,  740,
-      738,  737,  734,  731,  730,  729,  728,  727,  725,  724,
-      722,  720,  717,  716,  714,  713,  798,  813,  813,  813,
-
-      813,  813,  813,  813,  813,  814,  814,  814,  814,  814,
-      815,  815,  815,  815,  815,  816,  816,  817,  817,  818,
-      818,  818,  819,  819,  711,  819,  819,  819,  819,  819,
-      820,  820,  820,  710,  709,  708,  820,  821,  821,  821,
-      822,  822,  822,  707,  706,  705,  822,  823,  823,  823,
-      704,  703,  702,  701,  699,  698,  697,  696,  695,  694,
-      692,  691,  690,  689,  687,  686,  685,  684,  683,  682,
-      681,  680,  679,  678,  677,  676,  675,  674,  673,  672,
-      671,  670,  668,  667,  666,  665,  664,  663,  662,  661,
-      660,  653,  651,  650,  648,  647,  646,  645,  644,  643,
-
-      642,  641,  640,  639,  638,  637,  636,  634,  633,  632,
-      631,  630,  629,  628,  626,  625,  624,  623,  622,  618,
-      617,  616,  615,  614,  613,  612,  611,  610,  609,  608,
-      607,  601,  599,  598,  597,  596,  592,  591,  590,  589,
-      588,  587,  586,  585,  584,  575,  571,  570,  568,  567,
-      565,  564,  563,  562,  561,  560,  559,  558,  557,  555,
-      553,  552,  551,  550,  549,  548,  547,  546,  545,  544,
-      542,  541,  537,  536,  535,  532,  531,  529,  528,  526,
-      525,  524,  523,  522,  520,  518,  517,  516,  515,  514,
-      513,  511,  510,  509,  508,  507,  503,  502,  501,  500,
-
-      499,  498,  495,  494,  493,  492,  491,  489,  488,  487,
-      486,  485,  484,  482,  481,  474,  473,  470,  469,  466,
-      465,  464,  463,  452,  451,  450,  448,  447,  446,  445,
-      444,  441,  439,  438,  437,  435,  434,  432,  431,  430,
-      429,  427,  426,  421,  420,  418,  417,  416,  415,  414,
-      413,  412,  411,  410,  409,  407,  406,  405,  404,  403,
-      402,  401,  400,  399,  398,  397,  396,  392,  388,  387,
-      386,  383,  381,  371,  369,  365,  364,  363,  362,  360,
-      358,  353,  352,  349,  348,  347,  346,  345,  344,  339,
-      337,  336,  335,  334,  333,  331,  330,  327,  326,  325,
-
-      324,  323,  322,  321,  320,  319,  318,  317,  316,  315,
-      314,  313,  312,  311,  310,  309,  308,  307,  306,  305,
-      302,  300,  299,  298,  297,  296,  295,  294,  293,  291,
-      287,  285,  284,  283,  282,  278,  277,  276,  275,  274,
-      273,  272,  271,  267,  265,  264,  254,  253,  252,  251,
-      250,  249,  248,  246,  245,  244,  243,  242,  240,  239,
-      238,  237,  236,  235,  234,  233,  232,  231,  230,  229,
-      228,  227,  226,  225,  224,  223,  222,  221,  220,  219,
-      218,  217,  216,  214,  213,  212,  211,  210,  209,  208,
-      207,  206,  205,  204,  203,  202,  201,  200,  199,  198,
-
-      196,  195,  194,  193,  192,  191,  190,  189,  188,  187,
-      186,  185,  183,  182,  181,  179,  178,  177,  176,  174,
-      159,  158,  157,  156,  149,  147,  146,  145,  141,  140,
-      139,  138,  137,  136,  134,  133,  132,  131,  130,  129,
-      128,  127,  125,  123,  122,  121,  119,  118,  117,  115,
-      114,  112,  111,  110,  109,  108,  107,  104,  103,  102,
-      101,  100,   99,   98,   97,   95,   94,   93,   92,   91,
-       90,   89,   88,   87,   83,   79,   52,   45,   38,   32,
-       22,   18,   14,   12,   11,    7,    6,    5,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,   13,   15,  792,   16,   17,   17,   17,   17,   17,
+       17,   17,   21,   21,   25,   15,   16,   26,   13,   19,
+       35,   19,   19,   19,   19,   19,   19,   19,   23,   23,
+       25,   36,   26,   26,   35,   36,   19,   19,   71,   30,
+       27,   30,   27,   28,   19,   19,   27,   28,   37,   39,
+       30,  758,   19,   19,   28,  143,   29,   28,   96,   96,
+
+       29,   33,   37,   71,  143,   39,   29,   19,   39,   33,
+       19,   20,   29,   20,   20,   20,   20,   20,   20,   20,
+       40,   33,   47,   31,   47,  794,   47,   46,   20,   20,
+       40,   31,   48,   48,   31,  106,   20,   31,   42,   34,
+      758,   42,   34,   31,   20,   20,   34,   34,   41,  106,
+       42,   34,  802,   43,   34,   41,   41,   42,   43,   20,
+       41,   50,   43,   50,   44,   43,   41,   41,   44,   41,
+       46,   58,  105,   58,   68,   68,  135,   48,   44,  120,
+      142,  142,  124,  105,   48,   70,   70,  120,   48,  124,
+       68,   68,  135,   48,   53,   53,   53,   53,   53,   53,
+
+       53,   70,   70,   72,  144,   72,   72,   72,   72,   72,
+       72,   72,  144,  148,  803,  126,  148,  804,   73,   73,
+       72,   72,   73,   73,   73,   73,   73,   73,   73,  126,
+      805,  116,  153,  153,  116,  116,   72,   72,  116,  152,
+      116,  152,  810,  152,  154,  154,  160,  811,  160,  162,
+      162,  162,  162,  162,  162,  162,  164,  164,  166,  166,
+      164,  164,  164,  164,  164,  164,  164,  169,  169,  169,
+      169,  169,  169,  169,  166,  166,  171,  153,  180,  184,
+      184,  215,  215,  215,  153,  241,  813,  504,  153,  154,
+      776,  505,  180,  153,  241,  814,  154,  504,  776,  171,
+
+      154,  505,  167,  167,  818,  154,  167,  167,  167,  167,
+      167,  167,  167,  170,  170,  170,  170,  170,  170,  170,
+      247,  247,  247,  268,  268,  268,  279,  279,  279,  170,
+      256,  256,  256,  256,  256,  256,  256,  257,  257,  257,
+      257,  257,  257,  257,  786,  170,  288,  288,  288,  822,
+      258,  258,  786,  257,  258,  258,  258,  258,  258,  258,
+      258,  260,  260,  260,  260,  260,  260,  260,  825,  257,
+      261,  261,  261,  261,  261,  261,  261,  292,  292,  292,
+      301,  301,  301,  338,  338,  338,  261,  350,  350,  350,
+      350,  350,  350,  350,  351,  351,  351,  351,  351,  351,
+
+      351,  795,  261,  382,  382,  382,  393,  393,  393,  795,
+      351,  394,  394,  394,  382,  382,  395,  395,  395,  443,
+      443,  443,  483,  483,  483,  490,  351,  830,  605,  831,
+      443,  443,  839,  483,  483,  519,  519,  519,  605,  490,
+      490,  490,  490,  490,  490,  490,  519,  519,  533,  533,
+      606,  621,  621,  796,  534,  534,  656,  656,  760,  606,
+      606,  796,  533,  533,  533,  533,  533,  533,  534,  534,
+      534,  534,  534,  534,  534,  554,  554,  554,  573,  573,
+      573,  576,  576,  690,  690,  581,  533,  554,  578,  578,
+      573,  775,  799,  840,  790,  576,  576,  576,  576,  576,
+
+      576,  576,  578,  578,  578,  578,  578,  578,  580,  580,
+      806,  533,  744,  760,  759,  808,  619,  619,  806,  744,
+      581,  759,  580,  580,  580,  580,  580,  580,  580,  581,
+      619,  619,  619,  619,  619,  619,  787,  798,  789,  788,
+      581,  620,  620,  787,  798,  809,  775,  799,  658,  658,
+      828,  785,  829,  809,  619,  620,  620,  620,  620,  620,
+      620,  620,  658,  658,  658,  658,  658,  658,  660,  660,
+      808,  826,  815,  819,  784,  783,  782,  781,  826,  619,
+      815,  819,  660,  660,  660,  660,  660,  660,  660,  820,
+      823,  828,  827,  829,  832,  833,  780,  820,  823,  827,
+
+      779,  778,  832,  833,  836,  836,  836,  836,  836,  837,
+      837,  837,  838,  838,  838,  841,  841,  842,  777,  842,
+      842,  842,  843,  843,  844,  844,  774,  771,  769,  768,
+      766,  763,  762,  761,  757,  756,  755,  754,  753,  752,
+      751,  750,  749,  748,  747,  746,  745,  743,  742,  741,
+      738,  735,  734,  733,  732,  731,  729,  728,  726,  724,
+      721,  720,  719,  717,  716,  714,  713,  712,  711,  710,
+      709,  708,  707,  706,  705,  704,  702,  701,  700,  699,
+      698,  697,  695,  694,  693,  692,  691,  689,  688,  687,
+      686,  685,  684,  683,  682,  681,  680,  679,  678,  677,
+
+      676,  675,  674,  673,  672,  670,  669,  668,  667,  666,
+      665,  664,  663,  662,  661,  654,  652,  651,  649,  648,
+      647,  646,  645,  644,  643,  642,  641,  640,  639,  638,
+      637,  635,  634,  633,  632,  631,  630,  629,  627,  626,
+      625,  624,  623,  622,  618,  617,  616,  615,  614,  613,
+      612,  611,  610,  609,  608,  607,  601,  599,  598,  597,
+      596,  592,  591,  590,  589,  588,  587,  586,  585,  584,
+      575,  571,  570,  568,  567,  565,  564,  563,  562,  561,
+      560,  559,  558,  557,  555,  553,  552,  551,  550,  549,
+      548,  547,  546,  545,  544,  542,  541,  537,  536,  535,
+
+      532,  531,  529,  528,  526,  525,  524,  523,  522,  520,
+      518,  517,  516,  515,  514,  513,  511,  510,  509,  508,
+      507,  503,  502,  501,  500,  499,  498,  495,  494,  493,
+      492,  491,  489,  488,  487,  486,  485,  484,  482,  481,
+      474,  473,  470,  469,  466,  465,  464,  463,  452,  451,
+      450,  448,  447,  446,  445,  444,  441,  439,  438,  437,
+      435,  434,  432,  431,  430,  429,  427,  426,  421,  420,
+      418,  417,  416,  415,  414,  413,  412,  411,  410,  409,
+      407,  406,  405,  404,  403,  402,  401,  400,  399,  398,
+      397,  396,  392,  388,  387,  386,  383,  381,  371,  369,
+
+      365,  364,  363,  362,  360,  358,  353,  352,  349,  348,
+      347,  346,  345,  344,  339,  337,  336,  335,  334,  333,
+      331,  330,  327,  326,  325,  324,  323,  322,  321,  320,
+      319,  318,  317,  316,  315,  314,  313,  312,  311,  310,
+      309,  308,  307,  306,  305,  302,  300,  299,  298,  297,
+      296,  295,  294,  293,  291,  287,  285,  284,  283,  282,
+      278,  277,  276,  275,  274,  273,  272,  271,  267,  265,
+      264,  254,  253,  252,  251,  250,  249,  248,  246,  245,
+      244,  243,  242,  240,  239,  238,  237,  236,  235,  234,
+      233,  232,  231,  230,  229,  228,  227,  226,  225,  224,
+
+      223,  222,  221,  220,  219,  218,  217,  216,  214,  213,
+      212,  211,  210,  209,  208,  207,  206,  205,  204,  203,
+      202,  201,  200,  199,  198,  196,  195,  194,  193,  192,
+      191,  190,  189,  188,  187,  186,  185,  183,  182,  181,
+      179,  178,  177,  176,  174,  159,  158,  157,  156,  149,
+      147,  146,  145,  141,  140,  139,  138,  137,  136,  134,
+      133,  132,  131,  130,  129,  128,  127,  125,  123,  122,
+      121,  119,  118,  117,  115,  114,  112,  111,  110,  109,
+      108,  107,  104,  103,  102,  101,  100,   99,   98,   97,
+       95,   94,   93,   92,   91,   90,   89,   88,   87,   83,
+
+       79,   52,   45,   38,   32,   22,   18,   14,   12,   11,
+        7,    6,    5,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835,  835,  835,  835,  835,  835,  835,  835,  835,
+      835,  835
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -1001,6 +1022,7 @@ static yyconst flex_int16_t yy_chk[1255] =
  * DEALINGS IN THE SOFTWARE.
  */
 #include <ctype.h>
+#include "strtod.h"
 #include "ast.h"
 #include "glsl_parser_extras.h"
 #include "glsl_parser.h"
@@ -1054,7 +1076,7 @@ static yyconst flex_int16_t yy_chk[1255] =
  */
 #define ES yyextra->es_shader
 
-#line 1058 "glsl_lexer.cpp"
+#line 1080 "glsl_lexer.cpp"
 
 #define INITIAL 0
 #define PP 1
@@ -1141,10 +1163,6 @@ int _mesa_glsl_get_lineno (yyscan_t yyscanner );
 
 void _mesa_glsl_set_lineno (int line_number ,yyscan_t yyscanner );
 
-int _mesa_glsl_get_column  (yyscan_t yyscanner );
-
-void _mesa_glsl_set_column (int column_no ,yyscan_t yyscanner );
-
 YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner );
 
 void _mesa_glsl_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -1185,7 +1203,12 @@ static int input (yyscan_t yyscanner );
 
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
 #define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -1204,7 +1227,7 @@ static int input (yyscan_t yyscanner );
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
                { \
                int c = '*'; \
-               unsigned n; \
+               size_t n; \
                for ( n = 0; n < max_size && \
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
@@ -1292,10 +1315,10 @@ YY_DECL
        register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 94 "glsl_lexer.lpp"
+#line 95 "glsl_lexer.lpp"
 
 
-#line 1299 "glsl_lexer.cpp"
+#line 1322 "glsl_lexer.cpp"
 
     yylval = yylval_param;
 
@@ -1353,13 +1376,13 @@ yy_match:
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                {
                                yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 813 )
+                               if ( yy_current_state >= 836 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                        ++yy_cp;
                        }
-               while ( yy_current_state != 812 );
+               while ( yy_current_state != 835 );
                yy_cp = yyg->yy_last_accepting_cpos;
                yy_current_state = yyg->yy_last_accepting_state;
 
@@ -1381,7 +1404,7 @@ do_action:        /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 96 "glsl_lexer.lpp"
+#line 97 "glsl_lexer.lpp"
 ;
        YY_BREAK
 /* Preprocessor tokens. */ 
@@ -1390,17 +1413,17 @@ case 2:
 yyg->yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 99 "glsl_lexer.lpp"
+#line 100 "glsl_lexer.lpp"
 ;
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 100 "glsl_lexer.lpp"
+#line 101 "glsl_lexer.lpp"
 { BEGIN PP; return VERSION; }
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 101 "glsl_lexer.lpp"
+#line 102 "glsl_lexer.lpp"
 { BEGIN PP; return EXTENSION; }
        YY_BREAK
 case 5:
@@ -1408,7 +1431,7 @@ case 5:
 yyg->yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 102 "glsl_lexer.lpp"
+#line 103 "glsl_lexer.lpp"
 {
                                   /* Eat characters until the first digit is
                                    * encountered
@@ -1430,7 +1453,7 @@ case 6:
 yyg->yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 117 "glsl_lexer.lpp"
+#line 118 "glsl_lexer.lpp"
 {
                                   /* Eat characters until the first digit is
                                    * encountered
@@ -1448,7 +1471,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 131 "glsl_lexer.lpp"
+#line 132 "glsl_lexer.lpp"
 {
                                  BEGIN PP;
                                  return PRAGMA_DEBUG_ON;
@@ -1456,7 +1479,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 135 "glsl_lexer.lpp"
+#line 136 "glsl_lexer.lpp"
 {
                                  BEGIN PP;
                                  return PRAGMA_DEBUG_OFF;
@@ -1464,7 +1487,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 139 "glsl_lexer.lpp"
+#line 140 "glsl_lexer.lpp"
 {
                                  BEGIN PP;
                                  return PRAGMA_OPTIMIZE_ON;
@@ -1472,7 +1495,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 143 "glsl_lexer.lpp"
+#line 144 "glsl_lexer.lpp"
 {
                                  BEGIN PP;
                                  return PRAGMA_OPTIMIZE_OFF;
@@ -1480,436 +1503,444 @@ YY_RULE_SETUP
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 147 "glsl_lexer.lpp"
-{ BEGIN PRAGMA; }
+#line 148 "glsl_lexer.lpp"
+{
+                                 BEGIN PP;
+                                 return PRAGMA_INVARIANT_ALL;
+                               }
        YY_BREAK
 case 12:
-/* rule 12 can match eol */
 YY_RULE_SETUP
-#line 149 "glsl_lexer.lpp"
-{ BEGIN 0; yylineno++; yycolumn = 0; }
+#line 152 "glsl_lexer.lpp"
+{ BEGIN PRAGMA; }
        YY_BREAK
 case 13:
+/* rule 13 can match eol */
 YY_RULE_SETUP
-#line 150 "glsl_lexer.lpp"
-{ }
+#line 154 "glsl_lexer.lpp"
+{ BEGIN 0; yylineno++; yycolumn = 0; }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 152 "glsl_lexer.lpp"
+#line 155 "glsl_lexer.lpp"
 { }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 153 "glsl_lexer.lpp"
+#line 157 "glsl_lexer.lpp"
 { }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 154 "glsl_lexer.lpp"
-return COLON;
+#line 158 "glsl_lexer.lpp"
+{ }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 155 "glsl_lexer.lpp"
+#line 159 "glsl_lexer.lpp"
+return COLON;
+       YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 160 "glsl_lexer.lpp"
 {
                                   yylval->identifier = strdup(yytext);
                                   return IDENTIFIER;
                                }
        YY_BREAK
-case 18:
+case 19:
 YY_RULE_SETUP
-#line 159 "glsl_lexer.lpp"
+#line 164 "glsl_lexer.lpp"
 {
                                    yylval->n = strtol(yytext, NULL, 10);
                                    return INTCONSTANT;
                                }
        YY_BREAK
-case 19:
-/* rule 19 can match eol */
-YY_RULE_SETUP
-#line 163 "glsl_lexer.lpp"
-{ BEGIN 0; yylineno++; yycolumn = 0; return EOL; }
-       YY_BREAK
 case 20:
 /* rule 20 can match eol */
 YY_RULE_SETUP
-#line 165 "glsl_lexer.lpp"
-{ yylineno++; yycolumn = 0; }
+#line 168 "glsl_lexer.lpp"
+{ BEGIN 0; yylineno++; yycolumn = 0; return EOL; }
        YY_BREAK
 case 21:
+/* rule 21 can match eol */
 YY_RULE_SETUP
-#line 167 "glsl_lexer.lpp"
-return ATTRIBUTE;
+#line 170 "glsl_lexer.lpp"
+{ yylineno++; yycolumn = 0; }
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 168 "glsl_lexer.lpp"
-return CONST_TOK;
+#line 172 "glsl_lexer.lpp"
+return ATTRIBUTE;
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 169 "glsl_lexer.lpp"
-return BOOL_TOK;
+#line 173 "glsl_lexer.lpp"
+return CONST_TOK;
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 170 "glsl_lexer.lpp"
-return FLOAT_TOK;
+#line 174 "glsl_lexer.lpp"
+return BOOL_TOK;
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 171 "glsl_lexer.lpp"
-return INT_TOK;
+#line 175 "glsl_lexer.lpp"
+return FLOAT_TOK;
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 172 "glsl_lexer.lpp"
-KEYWORD(130, 130, UINT_TOK);
+#line 176 "glsl_lexer.lpp"
+return INT_TOK;
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 174 "glsl_lexer.lpp"
-return BREAK;
+#line 177 "glsl_lexer.lpp"
+KEYWORD(130, 130, UINT_TOK);
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 175 "glsl_lexer.lpp"
-return CONTINUE;
+#line 179 "glsl_lexer.lpp"
+return BREAK;
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 176 "glsl_lexer.lpp"
-return DO;
+#line 180 "glsl_lexer.lpp"
+return CONTINUE;
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 177 "glsl_lexer.lpp"
-return WHILE;
+#line 181 "glsl_lexer.lpp"
+return DO;
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 178 "glsl_lexer.lpp"
-return ELSE;
+#line 182 "glsl_lexer.lpp"
+return WHILE;
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 179 "glsl_lexer.lpp"
-return FOR;
+#line 183 "glsl_lexer.lpp"
+return ELSE;
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 180 "glsl_lexer.lpp"
-return IF;
+#line 184 "glsl_lexer.lpp"
+return FOR;
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 181 "glsl_lexer.lpp"
-return DISCARD;
+#line 185 "glsl_lexer.lpp"
+return IF;
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 182 "glsl_lexer.lpp"
-return RETURN;
+#line 186 "glsl_lexer.lpp"
+return DISCARD;
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 184 "glsl_lexer.lpp"
-return BVEC2;
+#line 187 "glsl_lexer.lpp"
+return RETURN;
        YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 185 "glsl_lexer.lpp"
-return BVEC3;
+#line 189 "glsl_lexer.lpp"
+return BVEC2;
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 186 "glsl_lexer.lpp"
-return BVEC4;
+#line 190 "glsl_lexer.lpp"
+return BVEC3;
        YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 187 "glsl_lexer.lpp"
-return IVEC2;
+#line 191 "glsl_lexer.lpp"
+return BVEC4;
        YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 188 "glsl_lexer.lpp"
-return IVEC3;
+#line 192 "glsl_lexer.lpp"
+return IVEC2;
        YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 189 "glsl_lexer.lpp"
-return IVEC4;
+#line 193 "glsl_lexer.lpp"
+return IVEC3;
        YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 190 "glsl_lexer.lpp"
-KEYWORD(130, 130, UVEC2);
+#line 194 "glsl_lexer.lpp"
+return IVEC4;
        YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 191 "glsl_lexer.lpp"
-KEYWORD(130, 130, UVEC3);
+#line 195 "glsl_lexer.lpp"
+KEYWORD(130, 130, UVEC2);
        YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 192 "glsl_lexer.lpp"
-KEYWORD(130, 130, UVEC4);
+#line 196 "glsl_lexer.lpp"
+KEYWORD(130, 130, UVEC3);
        YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 193 "glsl_lexer.lpp"
-return VEC2;
+#line 197 "glsl_lexer.lpp"
+KEYWORD(130, 130, UVEC4);
        YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 194 "glsl_lexer.lpp"
-return VEC3;
+#line 198 "glsl_lexer.lpp"
+return VEC2;
        YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 195 "glsl_lexer.lpp"
-return VEC4;
+#line 199 "glsl_lexer.lpp"
+return VEC3;
        YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 196 "glsl_lexer.lpp"
-return MAT2X2;
+#line 200 "glsl_lexer.lpp"
+return VEC4;
        YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 197 "glsl_lexer.lpp"
-return MAT3X3;
+#line 201 "glsl_lexer.lpp"
+return MAT2X2;
        YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 198 "glsl_lexer.lpp"
-return MAT4X4;
+#line 202 "glsl_lexer.lpp"
+return MAT3X3;
        YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 199 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT2X2);
+#line 203 "glsl_lexer.lpp"
+return MAT4X4;
        YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 200 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT2X3);
+#line 204 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT2X2);
        YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 201 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT2X4);
+#line 205 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT2X3);
        YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 202 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT3X2);
+#line 206 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT2X4);
        YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 203 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT3X3);
+#line 207 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT3X2);
        YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 204 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT3X4);
+#line 208 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT3X3);
        YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 205 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT4X2);
+#line 209 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT3X4);
        YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 206 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT4X3);
+#line 210 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT4X2);
        YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 207 "glsl_lexer.lpp"
-KEYWORD(120, 120, MAT4X4);
+#line 211 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT4X3);
        YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 209 "glsl_lexer.lpp"
-return IN_TOK;
+#line 212 "glsl_lexer.lpp"
+KEYWORD(120, 120, MAT4X4);
        YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 210 "glsl_lexer.lpp"
-return OUT_TOK;
+#line 214 "glsl_lexer.lpp"
+return IN_TOK;
        YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 211 "glsl_lexer.lpp"
-return INOUT_TOK;
+#line 215 "glsl_lexer.lpp"
+return OUT_TOK;
        YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 212 "glsl_lexer.lpp"
-return UNIFORM;
+#line 216 "glsl_lexer.lpp"
+return INOUT_TOK;
        YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 213 "glsl_lexer.lpp"
-return VARYING;
+#line 217 "glsl_lexer.lpp"
+return UNIFORM;
        YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 214 "glsl_lexer.lpp"
-KEYWORD(120, 120, CENTROID);
+#line 218 "glsl_lexer.lpp"
+return VARYING;
        YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 215 "glsl_lexer.lpp"
-KEYWORD(120 || ES, 120 || ES, INVARIANT);
+#line 219 "glsl_lexer.lpp"
+KEYWORD(120, 120, CENTROID);
        YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 216 "glsl_lexer.lpp"
-KEYWORD(130 || ES, 130, FLAT);
+#line 220 "glsl_lexer.lpp"
+KEYWORD(120 || ES, 120 || ES, INVARIANT);
        YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 217 "glsl_lexer.lpp"
-KEYWORD(130, 130, SMOOTH);
+#line 221 "glsl_lexer.lpp"
+KEYWORD(130 || ES, 130, FLAT);
        YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 218 "glsl_lexer.lpp"
-KEYWORD(130, 130, NOPERSPECTIVE);
+#line 222 "glsl_lexer.lpp"
+KEYWORD(130, 130, SMOOTH);
        YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 220 "glsl_lexer.lpp"
-return SAMPLER1D;
+#line 223 "glsl_lexer.lpp"
+KEYWORD(130, 130, NOPERSPECTIVE);
        YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 221 "glsl_lexer.lpp"
-return SAMPLER2D;
+#line 225 "glsl_lexer.lpp"
+return SAMPLER1D;
        YY_BREAK
 case 72:
 YY_RULE_SETUP
-#line 222 "glsl_lexer.lpp"
-return SAMPLER3D;
+#line 226 "glsl_lexer.lpp"
+return SAMPLER2D;
        YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 223 "glsl_lexer.lpp"
-return SAMPLERCUBE;
+#line 227 "glsl_lexer.lpp"
+return SAMPLER3D;
        YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 224 "glsl_lexer.lpp"
-KEYWORD(130, 130, SAMPLER1DARRAY);
+#line 228 "glsl_lexer.lpp"
+return SAMPLERCUBE;
        YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 225 "glsl_lexer.lpp"
-KEYWORD(130, 130, SAMPLER2DARRAY);
+#line 229 "glsl_lexer.lpp"
+KEYWORD(130, 130, SAMPLER1DARRAY);
        YY_BREAK
 case 76:
 YY_RULE_SETUP
-#line 226 "glsl_lexer.lpp"
-return SAMPLER1DSHADOW;
+#line 230 "glsl_lexer.lpp"
+KEYWORD(130, 130, SAMPLER2DARRAY);
        YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 227 "glsl_lexer.lpp"
-return SAMPLER2DSHADOW;
+#line 231 "glsl_lexer.lpp"
+return SAMPLER1DSHADOW;
        YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 228 "glsl_lexer.lpp"
-KEYWORD(130, 130, SAMPLERCUBESHADOW);
+#line 232 "glsl_lexer.lpp"
+return SAMPLER2DSHADOW;
        YY_BREAK
 case 79:
 YY_RULE_SETUP
-#line 229 "glsl_lexer.lpp"
-KEYWORD(130, 130, SAMPLER1DARRAYSHADOW);
+#line 233 "glsl_lexer.lpp"
+KEYWORD(130, 130, SAMPLERCUBESHADOW);
        YY_BREAK
 case 80:
 YY_RULE_SETUP
-#line 230 "glsl_lexer.lpp"
-KEYWORD(130, 130, SAMPLER2DARRAYSHADOW);
+#line 234 "glsl_lexer.lpp"
+KEYWORD(130, 130, SAMPLER1DARRAYSHADOW);
        YY_BREAK
 case 81:
 YY_RULE_SETUP
-#line 231 "glsl_lexer.lpp"
-KEYWORD(130, 130, ISAMPLER1D);
+#line 235 "glsl_lexer.lpp"
+KEYWORD(130, 130, SAMPLER2DARRAYSHADOW);
        YY_BREAK
 case 82:
 YY_RULE_SETUP
-#line 232 "glsl_lexer.lpp"
-KEYWORD(130, 130, ISAMPLER2D);
+#line 236 "glsl_lexer.lpp"
+KEYWORD(130, 130, ISAMPLER1D);
        YY_BREAK
 case 83:
 YY_RULE_SETUP
-#line 233 "glsl_lexer.lpp"
-KEYWORD(130, 130, ISAMPLER3D);
+#line 237 "glsl_lexer.lpp"
+KEYWORD(130, 130, ISAMPLER2D);
        YY_BREAK
 case 84:
 YY_RULE_SETUP
-#line 234 "glsl_lexer.lpp"
-KEYWORD(130, 130, ISAMPLERCUBE);
+#line 238 "glsl_lexer.lpp"
+KEYWORD(130, 130, ISAMPLER3D);
        YY_BREAK
 case 85:
 YY_RULE_SETUP
-#line 235 "glsl_lexer.lpp"
-KEYWORD(130, 130, ISAMPLER1DARRAY);
+#line 239 "glsl_lexer.lpp"
+KEYWORD(130, 130, ISAMPLERCUBE);
        YY_BREAK
 case 86:
 YY_RULE_SETUP
-#line 236 "glsl_lexer.lpp"
-KEYWORD(130, 130, ISAMPLER2DARRAY);
+#line 240 "glsl_lexer.lpp"
+KEYWORD(130, 130, ISAMPLER1DARRAY);
        YY_BREAK
 case 87:
 YY_RULE_SETUP
-#line 237 "glsl_lexer.lpp"
-KEYWORD(130, 130, USAMPLER1D);
+#line 241 "glsl_lexer.lpp"
+KEYWORD(130, 130, ISAMPLER2DARRAY);
        YY_BREAK
 case 88:
 YY_RULE_SETUP
-#line 238 "glsl_lexer.lpp"
-KEYWORD(130, 130, USAMPLER2D);
+#line 242 "glsl_lexer.lpp"
+KEYWORD(130, 130, USAMPLER1D);
        YY_BREAK
 case 89:
 YY_RULE_SETUP
-#line 239 "glsl_lexer.lpp"
-KEYWORD(130, 130, USAMPLER3D);
+#line 243 "glsl_lexer.lpp"
+KEYWORD(130, 130, USAMPLER2D);
        YY_BREAK
 case 90:
 YY_RULE_SETUP
-#line 240 "glsl_lexer.lpp"
-KEYWORD(130, 130, USAMPLERCUBE);
+#line 244 "glsl_lexer.lpp"
+KEYWORD(130, 130, USAMPLER3D);
        YY_BREAK
 case 91:
 YY_RULE_SETUP
-#line 241 "glsl_lexer.lpp"
-KEYWORD(130, 130, USAMPLER1DARRAY);
+#line 245 "glsl_lexer.lpp"
+KEYWORD(130, 130, USAMPLERCUBE);
        YY_BREAK
 case 92:
 YY_RULE_SETUP
-#line 242 "glsl_lexer.lpp"
-KEYWORD(130, 130, USAMPLER2DARRAY);
+#line 246 "glsl_lexer.lpp"
+KEYWORD(130, 130, USAMPLER1DARRAY);
        YY_BREAK
 case 93:
 YY_RULE_SETUP
-#line 245 "glsl_lexer.lpp"
-return STRUCT;
+#line 247 "glsl_lexer.lpp"
+KEYWORD(130, 130, USAMPLER2DARRAY);
        YY_BREAK
 case 94:
 YY_RULE_SETUP
-#line 246 "glsl_lexer.lpp"
-return VOID_TOK;
+#line 250 "glsl_lexer.lpp"
+return STRUCT;
        YY_BREAK
 case 95:
 YY_RULE_SETUP
-#line 248 "glsl_lexer.lpp"
+#line 251 "glsl_lexer.lpp"
+return VOID_TOK;
+       YY_BREAK
+case 96:
+YY_RULE_SETUP
+#line 253 "glsl_lexer.lpp"
 {
                  if ((yyextra->language_version >= 140)
                      || yyextra->ARB_explicit_attrib_location_enable
@@ -1921,132 +1952,124 @@ YY_RULE_SETUP
                   }
                }
        YY_BREAK
-case 96:
-YY_RULE_SETUP
-#line 259 "glsl_lexer.lpp"
-return INC_OP;
-       YY_BREAK
 case 97:
 YY_RULE_SETUP
-#line 260 "glsl_lexer.lpp"
-return DEC_OP;
+#line 264 "glsl_lexer.lpp"
+return INC_OP;
        YY_BREAK
 case 98:
 YY_RULE_SETUP
-#line 261 "glsl_lexer.lpp"
-return LE_OP;
+#line 265 "glsl_lexer.lpp"
+return DEC_OP;
        YY_BREAK
 case 99:
 YY_RULE_SETUP
-#line 262 "glsl_lexer.lpp"
-return GE_OP;
+#line 266 "glsl_lexer.lpp"
+return LE_OP;
        YY_BREAK
 case 100:
 YY_RULE_SETUP
-#line 263 "glsl_lexer.lpp"
-return EQ_OP;
+#line 267 "glsl_lexer.lpp"
+return GE_OP;
        YY_BREAK
 case 101:
 YY_RULE_SETUP
-#line 264 "glsl_lexer.lpp"
-return NE_OP;
+#line 268 "glsl_lexer.lpp"
+return EQ_OP;
        YY_BREAK
 case 102:
 YY_RULE_SETUP
-#line 265 "glsl_lexer.lpp"
-return AND_OP;
+#line 269 "glsl_lexer.lpp"
+return NE_OP;
        YY_BREAK
 case 103:
 YY_RULE_SETUP
-#line 266 "glsl_lexer.lpp"
-return OR_OP;
+#line 270 "glsl_lexer.lpp"
+return AND_OP;
        YY_BREAK
 case 104:
 YY_RULE_SETUP
-#line 267 "glsl_lexer.lpp"
-return XOR_OP;
+#line 271 "glsl_lexer.lpp"
+return OR_OP;
        YY_BREAK
 case 105:
 YY_RULE_SETUP
-#line 268 "glsl_lexer.lpp"
-return LEFT_OP;
+#line 272 "glsl_lexer.lpp"
+return XOR_OP;
        YY_BREAK
 case 106:
 YY_RULE_SETUP
-#line 269 "glsl_lexer.lpp"
-return RIGHT_OP;
+#line 273 "glsl_lexer.lpp"
+return LEFT_OP;
        YY_BREAK
 case 107:
 YY_RULE_SETUP
-#line 271 "glsl_lexer.lpp"
-return MUL_ASSIGN;
+#line 274 "glsl_lexer.lpp"
+return RIGHT_OP;
        YY_BREAK
 case 108:
 YY_RULE_SETUP
-#line 272 "glsl_lexer.lpp"
-return DIV_ASSIGN;
+#line 276 "glsl_lexer.lpp"
+return MUL_ASSIGN;
        YY_BREAK
 case 109:
 YY_RULE_SETUP
-#line 273 "glsl_lexer.lpp"
-return ADD_ASSIGN;
+#line 277 "glsl_lexer.lpp"
+return DIV_ASSIGN;
        YY_BREAK
 case 110:
 YY_RULE_SETUP
-#line 274 "glsl_lexer.lpp"
-return MOD_ASSIGN;
+#line 278 "glsl_lexer.lpp"
+return ADD_ASSIGN;
        YY_BREAK
 case 111:
 YY_RULE_SETUP
-#line 275 "glsl_lexer.lpp"
-return LEFT_ASSIGN;
+#line 279 "glsl_lexer.lpp"
+return MOD_ASSIGN;
        YY_BREAK
 case 112:
 YY_RULE_SETUP
-#line 276 "glsl_lexer.lpp"
-return RIGHT_ASSIGN;
+#line 280 "glsl_lexer.lpp"
+return LEFT_ASSIGN;
        YY_BREAK
 case 113:
 YY_RULE_SETUP
-#line 277 "glsl_lexer.lpp"
-return AND_ASSIGN;
+#line 281 "glsl_lexer.lpp"
+return RIGHT_ASSIGN;
        YY_BREAK
 case 114:
 YY_RULE_SETUP
-#line 278 "glsl_lexer.lpp"
-return XOR_ASSIGN;
+#line 282 "glsl_lexer.lpp"
+return AND_ASSIGN;
        YY_BREAK
 case 115:
 YY_RULE_SETUP
-#line 279 "glsl_lexer.lpp"
-return OR_ASSIGN;
+#line 283 "glsl_lexer.lpp"
+return XOR_ASSIGN;
        YY_BREAK
 case 116:
 YY_RULE_SETUP
-#line 280 "glsl_lexer.lpp"
-return SUB_ASSIGN;
+#line 284 "glsl_lexer.lpp"
+return OR_ASSIGN;
        YY_BREAK
 case 117:
 YY_RULE_SETUP
-#line 282 "glsl_lexer.lpp"
-{
-                           yylval->n = strtol(yytext, NULL, 10);
-                           return IS_UINT ? UINTCONSTANT : INTCONSTANT;
-                       }
+#line 285 "glsl_lexer.lpp"
+return SUB_ASSIGN;
        YY_BREAK
 case 118:
 YY_RULE_SETUP
-#line 286 "glsl_lexer.lpp"
+#line 287 "glsl_lexer.lpp"
 {
-                           yylval->n = strtol(yytext + 2, NULL, 16);
+                           yylval->n = strtol(yytext, NULL, 10);
                            return IS_UINT ? UINTCONSTANT : INTCONSTANT;
                        }
        YY_BREAK
 case 119:
 YY_RULE_SETUP
-#line 290 "glsl_lexer.lpp"
+#line 291 "glsl_lexer.lpp"
 {
-                           yylval->n = strtol(yytext, NULL, 8);
+                           yylval->n = strtol(yytext + 2, NULL, 16);
                            return IS_UINT ? UINTCONSTANT : INTCONSTANT;
                        }
        YY_BREAK
@@ -2054,464 +2077,472 @@ case 120:
 YY_RULE_SETUP
 #line 295 "glsl_lexer.lpp"
 {
-                           yylval->real = strtod(yytext, NULL);
-                           return FLOATCONSTANT;
+                           yylval->n = strtol(yytext, NULL, 8);
+                           return IS_UINT ? UINTCONSTANT : INTCONSTANT;
                        }
        YY_BREAK
 case 121:
 YY_RULE_SETUP
-#line 299 "glsl_lexer.lpp"
+#line 300 "glsl_lexer.lpp"
 {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
        YY_BREAK
 case 122:
 YY_RULE_SETUP
-#line 303 "glsl_lexer.lpp"
+#line 304 "glsl_lexer.lpp"
 {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
        YY_BREAK
 case 123:
 YY_RULE_SETUP
-#line 307 "glsl_lexer.lpp"
+#line 308 "glsl_lexer.lpp"
 {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
        YY_BREAK
 case 124:
 YY_RULE_SETUP
-#line 311 "glsl_lexer.lpp"
+#line 312 "glsl_lexer.lpp"
 {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
        YY_BREAK
 case 125:
 YY_RULE_SETUP
 #line 316 "glsl_lexer.lpp"
+{
+                           yylval->real = glsl_strtod(yytext, NULL);
+                           return FLOATCONSTANT;
+                       }
+       YY_BREAK
+case 126:
+YY_RULE_SETUP
+#line 321 "glsl_lexer.lpp"
 {
                            yylval->n = 1;
                            return BOOLCONSTANT;
                        }
        YY_BREAK
-case 126:
+case 127:
 YY_RULE_SETUP
-#line 320 "glsl_lexer.lpp"
+#line 325 "glsl_lexer.lpp"
 {
                            yylval->n = 0;
                            return BOOLCONSTANT;
                        }
        YY_BREAK
 /* Reserved words in GLSL 1.10. */
-case 127:
+case 128:
 YY_RULE_SETUP
-#line 327 "glsl_lexer.lpp"
+#line 332 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, ASM);
        YY_BREAK
-case 128:
+case 129:
 YY_RULE_SETUP
-#line 328 "glsl_lexer.lpp"
+#line 333 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, CLASS);
        YY_BREAK
-case 129:
+case 130:
 YY_RULE_SETUP
-#line 329 "glsl_lexer.lpp"
+#line 334 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, UNION);
        YY_BREAK
-case 130:
+case 131:
 YY_RULE_SETUP
-#line 330 "glsl_lexer.lpp"
+#line 335 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, ENUM);
        YY_BREAK
-case 131:
+case 132:
 YY_RULE_SETUP
-#line 331 "glsl_lexer.lpp"
+#line 336 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, TYPEDEF);
        YY_BREAK
-case 132:
+case 133:
 YY_RULE_SETUP
-#line 332 "glsl_lexer.lpp"
+#line 337 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, TEMPLATE);
        YY_BREAK
-case 133:
+case 134:
 YY_RULE_SETUP
-#line 333 "glsl_lexer.lpp"
+#line 338 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, THIS);
        YY_BREAK
-case 134:
+case 135:
 YY_RULE_SETUP
-#line 334 "glsl_lexer.lpp"
+#line 339 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, PACKED_TOK);
        YY_BREAK
-case 135:
+case 136:
 YY_RULE_SETUP
-#line 335 "glsl_lexer.lpp"
+#line 340 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, GOTO);
        YY_BREAK
-case 136:
+case 137:
 YY_RULE_SETUP
-#line 336 "glsl_lexer.lpp"
+#line 341 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 130, SWITCH);
        YY_BREAK
-case 137:
+case 138:
 YY_RULE_SETUP
-#line 337 "glsl_lexer.lpp"
+#line 342 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 130, DEFAULT);
        YY_BREAK
-case 138:
+case 139:
 YY_RULE_SETUP
-#line 338 "glsl_lexer.lpp"
+#line 343 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, INLINE_TOK);
        YY_BREAK
-case 139:
+case 140:
 YY_RULE_SETUP
-#line 339 "glsl_lexer.lpp"
+#line 344 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, NOINLINE);
        YY_BREAK
-case 140:
+case 141:
 YY_RULE_SETUP
-#line 340 "glsl_lexer.lpp"
+#line 345 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, VOLATILE);
        YY_BREAK
-case 141:
+case 142:
 YY_RULE_SETUP
-#line 341 "glsl_lexer.lpp"
+#line 346 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, PUBLIC_TOK);
        YY_BREAK
-case 142:
+case 143:
 YY_RULE_SETUP
-#line 342 "glsl_lexer.lpp"
+#line 347 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, STATIC);
        YY_BREAK
-case 143:
+case 144:
 YY_RULE_SETUP
-#line 343 "glsl_lexer.lpp"
+#line 348 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, EXTERN);
        YY_BREAK
-case 144:
+case 145:
 YY_RULE_SETUP
-#line 344 "glsl_lexer.lpp"
+#line 349 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, EXTERNAL);
        YY_BREAK
-case 145:
+case 146:
 YY_RULE_SETUP
-#line 345 "glsl_lexer.lpp"
+#line 350 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, INTERFACE);
        YY_BREAK
-case 146:
+case 147:
 YY_RULE_SETUP
-#line 346 "glsl_lexer.lpp"
+#line 351 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, LONG_TOK);
        YY_BREAK
-case 147:
+case 148:
 YY_RULE_SETUP
-#line 347 "glsl_lexer.lpp"
+#line 352 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, SHORT_TOK);
        YY_BREAK
-case 148:
+case 149:
 YY_RULE_SETUP
-#line 348 "glsl_lexer.lpp"
+#line 353 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 400, DOUBLE_TOK);
        YY_BREAK
-case 149:
+case 150:
 YY_RULE_SETUP
-#line 349 "glsl_lexer.lpp"
+#line 354 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, HALF);
        YY_BREAK
-case 150:
+case 151:
 YY_RULE_SETUP
-#line 350 "glsl_lexer.lpp"
+#line 355 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, FIXED_TOK);
        YY_BREAK
-case 151:
+case 152:
 YY_RULE_SETUP
-#line 351 "glsl_lexer.lpp"
+#line 356 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, UNSIGNED);
        YY_BREAK
-case 152:
+case 153:
 YY_RULE_SETUP
-#line 352 "glsl_lexer.lpp"
+#line 357 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, INPUT_TOK);
        YY_BREAK
-case 153:
+case 154:
 YY_RULE_SETUP
-#line 353 "glsl_lexer.lpp"
+#line 358 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, OUTPUT);
        YY_BREAK
-case 154:
+case 155:
 YY_RULE_SETUP
-#line 354 "glsl_lexer.lpp"
+#line 359 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, HVEC2);
        YY_BREAK
-case 155:
+case 156:
 YY_RULE_SETUP
-#line 355 "glsl_lexer.lpp"
+#line 360 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, HVEC3);
        YY_BREAK
-case 156:
+case 157:
 YY_RULE_SETUP
-#line 356 "glsl_lexer.lpp"
+#line 361 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, HVEC4);
        YY_BREAK
-case 157:
+case 158:
 YY_RULE_SETUP
-#line 357 "glsl_lexer.lpp"
+#line 362 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 400, DVEC2);
        YY_BREAK
-case 158:
+case 159:
 YY_RULE_SETUP
-#line 358 "glsl_lexer.lpp"
+#line 363 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 400, DVEC3);
        YY_BREAK
-case 159:
+case 160:
 YY_RULE_SETUP
-#line 359 "glsl_lexer.lpp"
+#line 364 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 400, DVEC4);
        YY_BREAK
-case 160:
+case 161:
 YY_RULE_SETUP
-#line 360 "glsl_lexer.lpp"
+#line 365 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, FVEC2);
        YY_BREAK
-case 161:
+case 162:
 YY_RULE_SETUP
-#line 361 "glsl_lexer.lpp"
+#line 366 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, FVEC3);
        YY_BREAK
-case 162:
+case 163:
 YY_RULE_SETUP
-#line 362 "glsl_lexer.lpp"
+#line 367 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, FVEC4);
        YY_BREAK
-case 163:
+case 164:
 YY_RULE_SETUP
-#line 363 "glsl_lexer.lpp"
+#line 368 "glsl_lexer.lpp"
 return SAMPLER2DRECT;
        YY_BREAK
-case 164:
+case 165:
 YY_RULE_SETUP
-#line 364 "glsl_lexer.lpp"
+#line 369 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, SAMPLER3DRECT);
        YY_BREAK
-case 165:
+case 166:
 YY_RULE_SETUP
-#line 365 "glsl_lexer.lpp"
+#line 370 "glsl_lexer.lpp"
 return SAMPLER2DRECTSHADOW;
        YY_BREAK
-case 166:
+case 167:
 YY_RULE_SETUP
-#line 366 "glsl_lexer.lpp"
+#line 371 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, SIZEOF);
        YY_BREAK
-case 167:
+case 168:
 YY_RULE_SETUP
-#line 367 "glsl_lexer.lpp"
+#line 372 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, CAST);
        YY_BREAK
-case 168:
+case 169:
 YY_RULE_SETUP
-#line 368 "glsl_lexer.lpp"
+#line 373 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, NAMESPACE);
        YY_BREAK
-case 169:
+case 170:
 YY_RULE_SETUP
-#line 369 "glsl_lexer.lpp"
+#line 374 "glsl_lexer.lpp"
 KEYWORD(110 || ES, 999, USING);
        YY_BREAK
 /* Additional reserved words in GLSL 1.20. */
-case 170:
+case 171:
 YY_RULE_SETUP
-#line 372 "glsl_lexer.lpp"
+#line 377 "glsl_lexer.lpp"
 KEYWORD(120, 130 || ES, LOWP);
        YY_BREAK
-case 171:
+case 172:
 YY_RULE_SETUP
-#line 373 "glsl_lexer.lpp"
+#line 378 "glsl_lexer.lpp"
 KEYWORD(120, 130 || ES, MEDIUMP);
        YY_BREAK
-case 172:
+case 173:
 YY_RULE_SETUP
-#line 374 "glsl_lexer.lpp"
+#line 379 "glsl_lexer.lpp"
 KEYWORD(120, 130 || ES, HIGHP);
        YY_BREAK
-case 173:
+case 174:
 YY_RULE_SETUP
-#line 375 "glsl_lexer.lpp"
+#line 380 "glsl_lexer.lpp"
 KEYWORD(120, 130 || ES, PRECISION);
        YY_BREAK
 /* Additional reserved words in GLSL 1.30. */
-case 174:
+case 175:
 YY_RULE_SETUP
-#line 378 "glsl_lexer.lpp"
+#line 383 "glsl_lexer.lpp"
 KEYWORD(130, 130, CASE);
        YY_BREAK
-case 175:
+case 176:
 YY_RULE_SETUP
-#line 379 "glsl_lexer.lpp"
+#line 384 "glsl_lexer.lpp"
 KEYWORD(130, 999, COMMON);
        YY_BREAK
-case 176:
+case 177:
 YY_RULE_SETUP
-#line 380 "glsl_lexer.lpp"
+#line 385 "glsl_lexer.lpp"
 KEYWORD(130, 999, PARTITION);
        YY_BREAK
-case 177:
+case 178:
 YY_RULE_SETUP
-#line 381 "glsl_lexer.lpp"
+#line 386 "glsl_lexer.lpp"
 KEYWORD(130, 999, ACTIVE);
        YY_BREAK
-case 178:
+case 179:
 YY_RULE_SETUP
-#line 382 "glsl_lexer.lpp"
+#line 387 "glsl_lexer.lpp"
 KEYWORD(130 || ES, 999, SUPERP);
        YY_BREAK
-case 179:
+case 180:
 YY_RULE_SETUP
-#line 383 "glsl_lexer.lpp"
+#line 388 "glsl_lexer.lpp"
 KEYWORD(130, 140, SAMPLERBUFFER);
        YY_BREAK
-case 180:
+case 181:
 YY_RULE_SETUP
-#line 384 "glsl_lexer.lpp"
+#line 389 "glsl_lexer.lpp"
 KEYWORD(130, 999, FILTER);
        YY_BREAK
-case 181:
+case 182:
 YY_RULE_SETUP
-#line 385 "glsl_lexer.lpp"
+#line 390 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE1D);
        YY_BREAK
-case 182:
+case 183:
 YY_RULE_SETUP
-#line 386 "glsl_lexer.lpp"
+#line 391 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE2D);
        YY_BREAK
-case 183:
+case 184:
 YY_RULE_SETUP
-#line 387 "glsl_lexer.lpp"
+#line 392 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE3D);
        YY_BREAK
-case 184:
+case 185:
 YY_RULE_SETUP
-#line 388 "glsl_lexer.lpp"
+#line 393 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGECUBE);
        YY_BREAK
-case 185:
+case 186:
 YY_RULE_SETUP
-#line 389 "glsl_lexer.lpp"
+#line 394 "glsl_lexer.lpp"
 KEYWORD(130, 999, IIMAGE1D);
        YY_BREAK
-case 186:
+case 187:
 YY_RULE_SETUP
-#line 390 "glsl_lexer.lpp"
+#line 395 "glsl_lexer.lpp"
 KEYWORD(130, 999, IIMAGE2D);
        YY_BREAK
-case 187:
+case 188:
 YY_RULE_SETUP
-#line 391 "glsl_lexer.lpp"
+#line 396 "glsl_lexer.lpp"
 KEYWORD(130, 999, IIMAGE3D);
        YY_BREAK
-case 188:
+case 189:
 YY_RULE_SETUP
-#line 392 "glsl_lexer.lpp"
+#line 397 "glsl_lexer.lpp"
 KEYWORD(130, 999, IIMAGECUBE);
        YY_BREAK
-case 189:
+case 190:
 YY_RULE_SETUP
-#line 393 "glsl_lexer.lpp"
+#line 398 "glsl_lexer.lpp"
 KEYWORD(130, 999, UIMAGE1D);
        YY_BREAK
-case 190:
+case 191:
 YY_RULE_SETUP
-#line 394 "glsl_lexer.lpp"
+#line 399 "glsl_lexer.lpp"
 KEYWORD(130, 999, UIMAGE2D);
        YY_BREAK
-case 191:
+case 192:
 YY_RULE_SETUP
-#line 395 "glsl_lexer.lpp"
+#line 400 "glsl_lexer.lpp"
 KEYWORD(130, 999, UIMAGE3D);
        YY_BREAK
-case 192:
+case 193:
 YY_RULE_SETUP
-#line 396 "glsl_lexer.lpp"
+#line 401 "glsl_lexer.lpp"
 KEYWORD(130, 999, UIMAGECUBE);
        YY_BREAK
-case 193:
+case 194:
 YY_RULE_SETUP
-#line 397 "glsl_lexer.lpp"
+#line 402 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE1DARRAY);
        YY_BREAK
-case 194:
+case 195:
 YY_RULE_SETUP
-#line 398 "glsl_lexer.lpp"
+#line 403 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE2DARRAY);
        YY_BREAK
-case 195:
+case 196:
 YY_RULE_SETUP
-#line 399 "glsl_lexer.lpp"
+#line 404 "glsl_lexer.lpp"
 KEYWORD(130, 999, IIMAGE1DARRAY);
        YY_BREAK
-case 196:
+case 197:
 YY_RULE_SETUP
-#line 400 "glsl_lexer.lpp"
+#line 405 "glsl_lexer.lpp"
 KEYWORD(130, 999, IIMAGE2DARRAY);
        YY_BREAK
-case 197:
+case 198:
 YY_RULE_SETUP
-#line 401 "glsl_lexer.lpp"
+#line 406 "glsl_lexer.lpp"
 KEYWORD(130, 999, UIMAGE1DARRAY);
        YY_BREAK
-case 198:
+case 199:
 YY_RULE_SETUP
-#line 402 "glsl_lexer.lpp"
+#line 407 "glsl_lexer.lpp"
 KEYWORD(130, 999, UIMAGE2DARRAY);
        YY_BREAK
-case 199:
+case 200:
 YY_RULE_SETUP
-#line 403 "glsl_lexer.lpp"
+#line 408 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE1DSHADOW);
        YY_BREAK
-case 200:
+case 201:
 YY_RULE_SETUP
-#line 404 "glsl_lexer.lpp"
+#line 409 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE2DSHADOW);
        YY_BREAK
-case 201:
+case 202:
 YY_RULE_SETUP
-#line 405 "glsl_lexer.lpp"
+#line 410 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE1DARRAYSHADOW);
        YY_BREAK
-case 202:
+case 203:
 YY_RULE_SETUP
-#line 406 "glsl_lexer.lpp"
+#line 411 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGE2DARRAYSHADOW);
        YY_BREAK
-case 203:
+case 204:
 YY_RULE_SETUP
-#line 407 "glsl_lexer.lpp"
+#line 412 "glsl_lexer.lpp"
 KEYWORD(130, 999, IMAGEBUFFER);
        YY_BREAK
-case 204:
+case 205:
 YY_RULE_SETUP
-#line 408 "glsl_lexer.lpp"
+#line 413 "glsl_lexer.lpp"
 KEYWORD(130, 999, IIMAGEBUFFER);
        YY_BREAK
-case 205:
+case 206:
 YY_RULE_SETUP
-#line 409 "glsl_lexer.lpp"
+#line 414 "glsl_lexer.lpp"
 KEYWORD(130, 999, UIMAGEBUFFER);
        YY_BREAK
-case 206:
+case 207:
 YY_RULE_SETUP
-#line 410 "glsl_lexer.lpp"
+#line 415 "glsl_lexer.lpp"
 KEYWORD(130, 999, ROW_MAJOR);
        YY_BREAK
-case 207:
+case 208:
 YY_RULE_SETUP
-#line 412 "glsl_lexer.lpp"
+#line 417 "glsl_lexer.lpp"
 {
                            struct _mesa_glsl_parse_state *state = yyextra;
                            void *ctx = state;  
@@ -2519,17 +2550,17 @@ YY_RULE_SETUP
                            return IDENTIFIER;
                        }
        YY_BREAK
-case 208:
+case 209:
 YY_RULE_SETUP
-#line 419 "glsl_lexer.lpp"
+#line 424 "glsl_lexer.lpp"
 { return yytext[0]; }
        YY_BREAK
-case 209:
+case 210:
 YY_RULE_SETUP
-#line 421 "glsl_lexer.lpp"
+#line 426 "glsl_lexer.lpp"
 ECHO;
        YY_BREAK
-#line 2533 "glsl_lexer.cpp"
+#line 2564 "glsl_lexer.cpp"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(PP):
 case YY_STATE_EOF(PRAGMA):
@@ -2827,7 +2858,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 813 )
+                       if ( yy_current_state >= 836 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2856,11 +2887,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                {
                yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 813 )
+               if ( yy_current_state >= 836 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 812);
+       yy_is_jam = (yy_current_state == 835);
 
        return yy_is_jam ? 0 : yy_current_state;
 }
@@ -3265,8 +3296,8 @@ YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscann
 
 /** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will
  * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
@@ -3672,7 +3703,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 421 "glsl_lexer.lpp"
+#line 426 "glsl_lexer.lpp"
 
 
 
index 7a3f1a67e66c9f4b1a932361524a7811ee0209cc..d30759be2b808601c37cefa8986d902ae520ba95 100644 (file)
@@ -22,6 +22,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 #include <ctype.h>
+#include "strtod.h"
 #include "ast.h"
 #include "glsl_parser_extras.h"
 #include "glsl_parser.h"
@@ -144,6 +145,10 @@ HASH               ^{SPC}#{SPC}
                                  BEGIN PP;
                                  return PRAGMA_OPTIMIZE_OFF;
                                }
+^{SPC}#{SPC}pragma{SPCP}STDGL{SPCP}invariant{SPC}\({SPC}all{SPC}\) {
+                                 BEGIN PP;
+                                 return PRAGMA_INVARIANT_ALL;
+                               }
 ^{SPC}#{SPC}pragma{SPCP}       { BEGIN PRAGMA; }
 
 <PRAGMA>\n                     { BEGIN 0; yylineno++; yycolumn = 0; }
@@ -293,23 +298,23 @@ layout            {
                        }
 
 [0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]?  {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
 \.[0-9]+([eE][+-]?[0-9]+)?[fF]?                {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
 [0-9]+\.([eE][+-]?[0-9]+)?[fF]?                {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
 [0-9]+[eE][+-]?[0-9]+[fF]?             {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
 [0-9]+[fF]             {
-                           yylval->real = strtod(yytext, NULL);
+                           yylval->real = glsl_strtod(yytext, NULL);
                            return FLOATCONSTANT;
                        }
 
index 23e439c7c5463c04f41793fe17af2c7bd4135b7f..2190458e47d30e9709696aa9c0ff15b0522889d2 100644 (file)
@@ -1,9 +1,10 @@
-/* A Bison parser, made by GNU Bison 2.4.3.  */
+
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
 /* Skeleton implementation for Bison's Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2009, 2010 Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -45,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 
 
 /* Line 189 of yacc.c  */
-#line 117 "glsl_parser.cpp"
+#line 118 "glsl_parser.cpp"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
      PRAGMA_DEBUG_OFF = 372,
      PRAGMA_OPTIMIZE_ON = 373,
      PRAGMA_OPTIMIZE_OFF = 374,
-     LAYOUT_TOK = 375,
-     ASM = 376,
-     CLASS = 377,
-     UNION = 378,
-     ENUM = 379,
-     TYPEDEF = 380,
-     TEMPLATE = 381,
-     THIS = 382,
-     PACKED_TOK = 383,
-     GOTO = 384,
-     INLINE_TOK = 385,
-     NOINLINE = 386,
-     VOLATILE = 387,
-     PUBLIC_TOK = 388,
-     STATIC = 389,
-     EXTERN = 390,
-     EXTERNAL = 391,
-     LONG_TOK = 392,
-     SHORT_TOK = 393,
-     DOUBLE_TOK = 394,
-     HALF = 395,
-     FIXED_TOK = 396,
-     UNSIGNED = 397,
-     INPUT_TOK = 398,
-     OUPTUT = 399,
-     HVEC2 = 400,
-     HVEC3 = 401,
-     HVEC4 = 402,
-     DVEC2 = 403,
-     DVEC3 = 404,
-     DVEC4 = 405,
-     FVEC2 = 406,
-     FVEC3 = 407,
-     FVEC4 = 408,
-     SAMPLER2DRECT = 409,
-     SAMPLER3DRECT = 410,
-     SAMPLER2DRECTSHADOW = 411,
-     SIZEOF = 412,
-     CAST = 413,
-     NAMESPACE = 414,
-     USING = 415,
-     ERROR_TOK = 416,
-     COMMON = 417,
-     PARTITION = 418,
-     ACTIVE = 419,
-     SAMPLERBUFFER = 420,
-     FILTER = 421,
-     IMAGE1D = 422,
-     IMAGE2D = 423,
-     IMAGE3D = 424,
-     IMAGECUBE = 425,
-     IMAGE1DARRAY = 426,
-     IMAGE2DARRAY = 427,
-     IIMAGE1D = 428,
-     IIMAGE2D = 429,
-     IIMAGE3D = 430,
-     IIMAGECUBE = 431,
-     IIMAGE1DARRAY = 432,
-     IIMAGE2DARRAY = 433,
-     UIMAGE1D = 434,
-     UIMAGE2D = 435,
-     UIMAGE3D = 436,
-     UIMAGECUBE = 437,
-     UIMAGE1DARRAY = 438,
-     UIMAGE2DARRAY = 439,
-     IMAGE1DSHADOW = 440,
-     IMAGE2DSHADOW = 441,
-     IMAGEBUFFER = 442,
-     IIMAGEBUFFER = 443,
-     UIMAGEBUFFER = 444,
-     IMAGE1DARRAYSHADOW = 445,
-     IMAGE2DARRAYSHADOW = 446,
-     ROW_MAJOR = 447
+     PRAGMA_INVARIANT_ALL = 375,
+     LAYOUT_TOK = 376,
+     ASM = 377,
+     CLASS = 378,
+     UNION = 379,
+     ENUM = 380,
+     TYPEDEF = 381,
+     TEMPLATE = 382,
+     THIS = 383,
+     PACKED_TOK = 384,
+     GOTO = 385,
+     INLINE_TOK = 386,
+     NOINLINE = 387,
+     VOLATILE = 388,
+     PUBLIC_TOK = 389,
+     STATIC = 390,
+     EXTERN = 391,
+     EXTERNAL = 392,
+     LONG_TOK = 393,
+     SHORT_TOK = 394,
+     DOUBLE_TOK = 395,
+     HALF = 396,
+     FIXED_TOK = 397,
+     UNSIGNED = 398,
+     INPUT_TOK = 399,
+     OUPTUT = 400,
+     HVEC2 = 401,
+     HVEC3 = 402,
+     HVEC4 = 403,
+     DVEC2 = 404,
+     DVEC3 = 405,
+     DVEC4 = 406,
+     FVEC2 = 407,
+     FVEC3 = 408,
+     FVEC4 = 409,
+     SAMPLER2DRECT = 410,
+     SAMPLER3DRECT = 411,
+     SAMPLER2DRECTSHADOW = 412,
+     SIZEOF = 413,
+     CAST = 414,
+     NAMESPACE = 415,
+     USING = 416,
+     ERROR_TOK = 417,
+     COMMON = 418,
+     PARTITION = 419,
+     ACTIVE = 420,
+     SAMPLERBUFFER = 421,
+     FILTER = 422,
+     IMAGE1D = 423,
+     IMAGE2D = 424,
+     IMAGE3D = 425,
+     IMAGECUBE = 426,
+     IMAGE1DARRAY = 427,
+     IMAGE2DARRAY = 428,
+     IIMAGE1D = 429,
+     IIMAGE2D = 430,
+     IIMAGE3D = 431,
+     IIMAGECUBE = 432,
+     IIMAGE1DARRAY = 433,
+     IIMAGE2DARRAY = 434,
+     UIMAGE1D = 435,
+     UIMAGE2D = 436,
+     UIMAGE3D = 437,
+     UIMAGECUBE = 438,
+     UIMAGE1DARRAY = 439,
+     UIMAGE2DARRAY = 440,
+     IMAGE1DSHADOW = 441,
+     IMAGE2DSHADOW = 442,
+     IMAGEBUFFER = 443,
+     IIMAGEBUFFER = 444,
+     UIMAGEBUFFER = 445,
+     IMAGE1DARRAYSHADOW = 446,
+     IMAGE2DARRAYSHADOW = 447,
+     ROW_MAJOR = 448
    };
 #endif
 
@@ -373,7 +375,7 @@ typedef union YYSTYPE
 
 
 /* Line 214 of yacc.c  */
-#line 377 "glsl_parser.cpp"
+#line 379 "glsl_parser.cpp"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -398,7 +400,7 @@ typedef struct YYLTYPE
 
 
 /* Line 264 of yacc.c  */
-#line 402 "glsl_parser.cpp"
+#line 404 "glsl_parser.cpp"
 
 #ifdef short
 # undef short
@@ -448,7 +450,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
+# if YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -615,20 +617,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  5
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   3718
+#define YYLAST   3738
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  217
+#define YYNTOKENS  218
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  87
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  278
+#define YYNRULES  279
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  413
+#define YYNSTATES  415
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   447
+#define YYMAXUTOK   448
 
 #define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -639,16 +641,16 @@ static const yytype_uint8 yytranslate[] =
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,   201,     2,     2,     2,   205,   208,     2,
-     193,   194,   203,   199,   198,   200,   197,   204,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,   212,   214,
-     206,   213,   207,   211,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,   202,     2,     2,     2,   206,   209,     2,
+     194,   195,   204,   200,   199,   201,   198,   205,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,   213,   215,
+     207,   214,   208,   212,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,   195,     2,   196,   209,     2,     2,     2,     2,     2,
+       2,   196,     2,   197,   210,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,   215,   210,   216,   202,     2,     2,     2,
+       2,     2,     2,   216,   211,   217,   203,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -680,7 +682,7 @@ static const yytype_uint8 yytranslate[] =
      155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
      165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
      175,   176,   177,   178,   179,   180,   181,   182,   183,   184,
-     185,   186,   187,   188,   189,   190,   191,   192
+     185,   186,   187,   188,   189,   190,   191,   192,   193
 };
 
 #if YYDEBUG
@@ -689,151 +691,151 @@ static const yytype_uint8 yytranslate[] =
 static const yytype_uint16 yyprhs[] =
 {
        0,     0,     3,     4,     9,    10,    14,    17,    20,    23,
-      26,    27,    30,    36,    38,    41,    43,    45,    47,    49,
-      51,    53,    57,    59,    64,    66,    70,    73,    76,    78,
-      80,    82,    86,    89,    92,    95,    97,   100,   104,   107,
-     109,   111,   113,   115,   118,   121,   124,   126,   128,   130,
-     132,   134,   138,   142,   146,   148,   152,   156,   158,   162,
-     166,   168,   172,   176,   180,   184,   186,   190,   194,   196,
-     200,   202,   206,   208,   212,   214,   218,   220,   224,   226,
-     230,   232,   238,   240,   244,   246,   248,   250,   252,   254,
-     256,   258,   260,   262,   264,   266,   268,   272,   274,   277,
-     280,   285,   288,   290,   292,   295,   299,   303,   306,   312,
-     316,   319,   323,   326,   327,   329,   331,   333,   335,   337,
-     341,   347,   354,   362,   371,   377,   379,   382,   387,   393,
-     400,   408,   413,   416,   418,   421,   426,   428,   432,   434,
-     438,   440,   442,   444,   446,   448,   450,   453,   455,   458,
-     461,   465,   467,   469,   471,   473,   476,   478,   480,   483,
-     486,   488,   490,   493,   495,   499,   504,   506,   508,   510,
-     512,   514,   516,   518,   520,   522,   524,   526,   528,   530,
-     532,   534,   536,   538,   540,   542,   544,   546,   548,   550,
-     552,   554,   556,   558,   560,   562,   564,   566,   568,   570,
-     572,   574,   576,   578,   580,   582,   584,   586,   588,   590,
-     592,   594,   596,   598,   600,   602,   604,   606,   608,   610,
-     612,   614,   616,   618,   624,   629,   631,   634,   638,   640,
-     644,   646,   651,   653,   655,   657,   659,   661,   663,   665,
-     667,   669,   671,   673,   676,   680,   682,   684,   687,   691,
-     693,   696,   698,   701,   707,   711,   713,   715,   720,   726,
-     730,   733,   739,   747,   754,   756,   758,   760,   761,   764,
-     768,   771,   774,   777,   781,   784,   786,   788,   790
+      26,    29,    30,    33,    39,    41,    44,    46,    48,    50,
+      52,    54,    56,    60,    62,    67,    69,    73,    76,    79,
+      81,    83,    85,    89,    92,    95,    98,   100,   103,   107,
+     110,   112,   114,   116,   118,   121,   124,   127,   129,   131,
+     133,   135,   137,   141,   145,   149,   151,   155,   159,   161,
+     165,   169,   171,   175,   179,   183,   187,   189,   193,   197,
+     199,   203,   205,   209,   211,   215,   217,   221,   223,   227,
+     229,   233,   235,   241,   243,   247,   249,   251,   253,   255,
+     257,   259,   261,   263,   265,   267,   269,   271,   275,   277,
+     280,   283,   288,   291,   293,   295,   298,   302,   306,   309,
+     315,   319,   322,   326,   329,   330,   332,   334,   336,   338,
+     340,   344,   350,   357,   365,   374,   380,   382,   385,   390,
+     396,   403,   411,   416,   419,   421,   424,   429,   431,   435,
+     437,   441,   443,   445,   447,   449,   451,   453,   456,   458,
+     461,   464,   468,   470,   472,   474,   476,   479,   481,   483,
+     486,   489,   491,   493,   496,   498,   502,   507,   509,   511,
+     513,   515,   517,   519,   521,   523,   525,   527,   529,   531,
+     533,   535,   537,   539,   541,   543,   545,   547,   549,   551,
+     553,   555,   557,   559,   561,   563,   565,   567,   569,   571,
+     573,   575,   577,   579,   581,   583,   585,   587,   589,   591,
+     593,   595,   597,   599,   601,   603,   605,   607,   609,   611,
+     613,   615,   617,   619,   621,   627,   632,   634,   637,   641,
+     643,   647,   649,   654,   656,   658,   660,   662,   664,   666,
+     668,   670,   672,   674,   676,   679,   683,   685,   687,   690,
+     694,   696,   699,   701,   704,   710,   714,   716,   718,   723,
+     729,   733,   736,   742,   750,   757,   759,   761,   763,   764,
+     767,   771,   774,   777,   780,   784,   787,   789,   791,   793
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int16 yyrhs[] =
 {
-     218,     0,    -1,    -1,   220,   222,   219,   224,    -1,    -1,
+     219,     0,    -1,    -1,   221,   223,   220,   225,    -1,    -1,
      109,    78,   113,    -1,   116,   113,    -1,   117,   113,    -1,
-     118,   113,    -1,   119,   113,    -1,    -1,   222,   223,    -1,
-     110,    76,   112,    76,   113,    -1,   302,    -1,   224,   302,
-      -1,    76,    -1,   225,    -1,    78,    -1,    79,    -1,    77,
-      -1,    80,    -1,   193,   252,   194,    -1,   226,    -1,   227,
-     195,   228,   196,    -1,   229,    -1,   227,   197,    76,    -1,
-     227,    84,    -1,   227,    85,    -1,   252,    -1,   230,    -1,
-     231,    -1,   227,   197,   231,    -1,   233,   194,    -1,   232,
-     194,    -1,   234,    74,    -1,   234,    -1,   234,   250,    -1,
-     233,   198,   250,    -1,   235,   193,    -1,   273,    -1,    76,
-      -1,    81,    -1,   227,    -1,    84,   236,    -1,    85,   236,
-      -1,   237,   236,    -1,   199,    -1,   200,    -1,   201,    -1,
-     202,    -1,   236,    -1,   238,   203,   236,    -1,   238,   204,
-     236,    -1,   238,   205,   236,    -1,   238,    -1,   239,   199,
-     238,    -1,   239,   200,   238,    -1,   239,    -1,   240,    82,
-     239,    -1,   240,    83,   239,    -1,   240,    -1,   241,   206,
-     240,    -1,   241,   207,   240,    -1,   241,    86,   240,    -1,
-     241,    87,   240,    -1,   241,    -1,   242,    88,   241,    -1,
-     242,    89,   241,    -1,   242,    -1,   243,   208,   242,    -1,
-     243,    -1,   244,   209,   243,    -1,   244,    -1,   245,   210,
-     244,    -1,   245,    -1,   246,    90,   245,    -1,   246,    -1,
-     247,    92,   246,    -1,   247,    -1,   248,    91,   247,    -1,
-     248,    -1,   248,   211,   252,   212,   250,    -1,   249,    -1,
-     236,   251,   250,    -1,   213,    -1,    93,    -1,    94,    -1,
-      96,    -1,    95,    -1,   102,    -1,    97,    -1,    98,    -1,
-      99,    -1,   100,    -1,   101,    -1,   250,    -1,   252,   198,
-     250,    -1,   249,    -1,   255,   214,    -1,   263,   214,    -1,
-     108,   277,   274,   214,    -1,   256,   194,    -1,   258,    -1,
-     257,    -1,   258,   260,    -1,   257,   198,   260,    -1,   265,
-      76,   193,    -1,   273,    76,    -1,   273,    76,   195,   253,
-     196,    -1,   270,   261,   259,    -1,   261,   259,    -1,   270,
-     261,   262,    -1,   261,   262,    -1,    -1,    33,    -1,    34,
-      -1,    35,    -1,   273,    -1,   264,    -1,   263,   198,    76,
-      -1,   263,   198,    76,   195,   196,    -1,   263,   198,    76,
-     195,   253,   196,    -1,   263,   198,    76,   195,   196,   213,
-     283,    -1,   263,   198,    76,   195,   253,   196,   213,   283,
-      -1,   263,   198,    76,   213,   283,    -1,   265,    -1,   265,
-      76,    -1,   265,    76,   195,   196,    -1,   265,    76,   195,
-     253,   196,    -1,   265,    76,   195,   196,   213,   283,    -1,
-     265,    76,   195,   253,   196,   213,   283,    -1,   265,    76,
-     213,   283,    -1,   103,    76,    -1,   273,    -1,   271,   273,
-      -1,   120,   193,   267,   194,    -1,   268,    -1,   267,   198,
-     268,    -1,    76,    -1,    76,   213,    78,    -1,    40,    -1,
-      39,    -1,    38,    -1,     4,    -1,   272,    -1,   266,    -1,
-     266,   272,    -1,   269,    -1,   269,   272,    -1,   103,   272,
-      -1,   103,   269,   272,    -1,   103,    -1,     4,    -1,     3,
-      -1,    37,    -1,    32,    37,    -1,    33,    -1,    34,    -1,
-      32,    33,    -1,    32,    34,    -1,    36,    -1,   274,    -1,
-     277,   274,    -1,   275,    -1,   275,   195,   196,    -1,   275,
-     195,   253,   196,    -1,   276,    -1,   278,    -1,    76,    -1,
-      74,    -1,     6,    -1,     7,    -1,     8,    -1,     5,    -1,
-      29,    -1,    30,    -1,    31,    -1,    20,    -1,    21,    -1,
-      22,    -1,    23,    -1,    24,    -1,    25,    -1,    26,    -1,
-      27,    -1,    28,    -1,    41,    -1,    42,    -1,    43,    -1,
-      44,    -1,    45,    -1,    46,    -1,    47,    -1,    48,    -1,
-      49,    -1,    50,    -1,    51,    -1,   154,    -1,    52,    -1,
-      53,    -1,    54,    -1,    55,    -1,   156,    -1,    56,    -1,
-      57,    -1,    58,    -1,    59,    -1,    60,    -1,    61,    -1,
-      62,    -1,    63,    -1,    64,    -1,    65,    -1,    66,    -1,
-      67,    -1,    68,    -1,    69,    -1,    70,    -1,    71,    -1,
-      72,    -1,   106,    -1,   105,    -1,   104,    -1,    73,    76,
-     215,   279,   216,    -1,    73,   215,   279,   216,    -1,   280,
-      -1,   279,   280,    -1,   273,   281,   214,    -1,   282,    -1,
-     281,   198,   282,    -1,    76,    -1,    76,   195,   253,   196,
-      -1,   250,    -1,   254,    -1,   287,    -1,   286,    -1,   284,
-      -1,   291,    -1,   292,    -1,   295,    -1,   296,    -1,   297,
-      -1,   301,    -1,   215,   216,    -1,   215,   290,   216,    -1,
-     289,    -1,   286,    -1,   215,   216,    -1,   215,   290,   216,
-      -1,   285,    -1,   290,   285,    -1,   214,    -1,   252,   214,
-      -1,    14,   193,   252,   194,   293,    -1,   285,    12,   285,
-      -1,   285,    -1,   252,    -1,   265,    76,   213,   283,    -1,
-      17,   193,   252,   194,   287,    -1,    18,   252,   212,    -1,
-      19,   212,    -1,    75,   193,   294,   194,   288,    -1,    11,
-     285,    75,   193,   252,   194,   214,    -1,    13,   193,   298,
-     300,   194,   288,    -1,   291,    -1,   284,    -1,   294,    -1,
-      -1,   299,   214,    -1,   299,   214,   252,    -1,    10,   214,
-      -1,     9,   214,    -1,    16,   214,    -1,    16,   252,   214,
-      -1,    15,   214,    -1,   303,    -1,   254,    -1,   221,    -1,
-     255,   289,    -1
+     118,   113,    -1,   119,   113,    -1,   120,   113,    -1,    -1,
+     223,   224,    -1,   110,    76,   112,    76,   113,    -1,   303,
+      -1,   225,   303,    -1,    76,    -1,   226,    -1,    78,    -1,
+      79,    -1,    77,    -1,    80,    -1,   194,   253,   195,    -1,
+     227,    -1,   228,   196,   229,   197,    -1,   230,    -1,   228,
+     198,    76,    -1,   228,    84,    -1,   228,    85,    -1,   253,
+      -1,   231,    -1,   232,    -1,   228,   198,   232,    -1,   234,
+     195,    -1,   233,   195,    -1,   235,    74,    -1,   235,    -1,
+     235,   251,    -1,   234,   199,   251,    -1,   236,   194,    -1,
+     274,    -1,    76,    -1,    81,    -1,   228,    -1,    84,   237,
+      -1,    85,   237,    -1,   238,   237,    -1,   200,    -1,   201,
+      -1,   202,    -1,   203,    -1,   237,    -1,   239,   204,   237,
+      -1,   239,   205,   237,    -1,   239,   206,   237,    -1,   239,
+      -1,   240,   200,   239,    -1,   240,   201,   239,    -1,   240,
+      -1,   241,    82,   240,    -1,   241,    83,   240,    -1,   241,
+      -1,   242,   207,   241,    -1,   242,   208,   241,    -1,   242,
+      86,   241,    -1,   242,    87,   241,    -1,   242,    -1,   243,
+      88,   242,    -1,   243,    89,   242,    -1,   243,    -1,   244,
+     209,   243,    -1,   244,    -1,   245,   210,   244,    -1,   245,
+      -1,   246,   211,   245,    -1,   246,    -1,   247,    90,   246,
+      -1,   247,    -1,   248,    92,   247,    -1,   248,    -1,   249,
+      91,   248,    -1,   249,    -1,   249,   212,   253,   213,   251,
+      -1,   250,    -1,   237,   252,   251,    -1,   214,    -1,    93,
+      -1,    94,    -1,    96,    -1,    95,    -1,   102,    -1,    97,
+      -1,    98,    -1,    99,    -1,   100,    -1,   101,    -1,   251,
+      -1,   253,   199,   251,    -1,   250,    -1,   256,   215,    -1,
+     264,   215,    -1,   108,   278,   275,   215,    -1,   257,   195,
+      -1,   259,    -1,   258,    -1,   259,   261,    -1,   258,   199,
+     261,    -1,   266,    76,   194,    -1,   274,    76,    -1,   274,
+      76,   196,   254,   197,    -1,   271,   262,   260,    -1,   262,
+     260,    -1,   271,   262,   263,    -1,   262,   263,    -1,    -1,
+      33,    -1,    34,    -1,    35,    -1,   274,    -1,   265,    -1,
+     264,   199,    76,    -1,   264,   199,    76,   196,   197,    -1,
+     264,   199,    76,   196,   254,   197,    -1,   264,   199,    76,
+     196,   197,   214,   284,    -1,   264,   199,    76,   196,   254,
+     197,   214,   284,    -1,   264,   199,    76,   214,   284,    -1,
+     266,    -1,   266,    76,    -1,   266,    76,   196,   197,    -1,
+     266,    76,   196,   254,   197,    -1,   266,    76,   196,   197,
+     214,   284,    -1,   266,    76,   196,   254,   197,   214,   284,
+      -1,   266,    76,   214,   284,    -1,   103,    76,    -1,   274,
+      -1,   272,   274,    -1,   121,   194,   268,   195,    -1,   269,
+      -1,   268,   199,   269,    -1,    76,    -1,    76,   214,    78,
+      -1,    40,    -1,    39,    -1,    38,    -1,     4,    -1,   273,
+      -1,   267,    -1,   267,   273,    -1,   270,    -1,   270,   273,
+      -1,   103,   273,    -1,   103,   270,   273,    -1,   103,    -1,
+       4,    -1,     3,    -1,    37,    -1,    32,    37,    -1,    33,
+      -1,    34,    -1,    32,    33,    -1,    32,    34,    -1,    36,
+      -1,   275,    -1,   278,   275,    -1,   276,    -1,   276,   196,
+     197,    -1,   276,   196,   254,   197,    -1,   277,    -1,   279,
+      -1,    76,    -1,    74,    -1,     6,    -1,     7,    -1,     8,
+      -1,     5,    -1,    29,    -1,    30,    -1,    31,    -1,    20,
+      -1,    21,    -1,    22,    -1,    23,    -1,    24,    -1,    25,
+      -1,    26,    -1,    27,    -1,    28,    -1,    41,    -1,    42,
+      -1,    43,    -1,    44,    -1,    45,    -1,    46,    -1,    47,
+      -1,    48,    -1,    49,    -1,    50,    -1,    51,    -1,   155,
+      -1,    52,    -1,    53,    -1,    54,    -1,    55,    -1,   157,
+      -1,    56,    -1,    57,    -1,    58,    -1,    59,    -1,    60,
+      -1,    61,    -1,    62,    -1,    63,    -1,    64,    -1,    65,
+      -1,    66,    -1,    67,    -1,    68,    -1,    69,    -1,    70,
+      -1,    71,    -1,    72,    -1,   106,    -1,   105,    -1,   104,
+      -1,    73,    76,   216,   280,   217,    -1,    73,   216,   280,
+     217,    -1,   281,    -1,   280,   281,    -1,   274,   282,   215,
+      -1,   283,    -1,   282,   199,   283,    -1,    76,    -1,    76,
+     196,   254,   197,    -1,   251,    -1,   255,    -1,   288,    -1,
+     287,    -1,   285,    -1,   292,    -1,   293,    -1,   296,    -1,
+     297,    -1,   298,    -1,   302,    -1,   216,   217,    -1,   216,
+     291,   217,    -1,   290,    -1,   287,    -1,   216,   217,    -1,
+     216,   291,   217,    -1,   286,    -1,   291,   286,    -1,   215,
+      -1,   253,   215,    -1,    14,   194,   253,   195,   294,    -1,
+     286,    12,   286,    -1,   286,    -1,   253,    -1,   266,    76,
+     214,   284,    -1,    17,   194,   253,   195,   288,    -1,    18,
+     253,   213,    -1,    19,   213,    -1,    75,   194,   295,   195,
+     289,    -1,    11,   286,    75,   194,   253,   195,   215,    -1,
+      13,   194,   299,   301,   195,   289,    -1,   292,    -1,   285,
+      -1,   295,    -1,    -1,   300,   215,    -1,   300,   215,   253,
+      -1,    10,   215,    -1,     9,   215,    -1,    16,   215,    -1,
+      16,   253,   215,    -1,    15,   215,    -1,   304,    -1,   255,
+      -1,   222,    -1,   256,   290,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   212,   212,   211,   218,   220,   240,   241,   242,   243,
-     246,   248,   252,   261,   269,   280,   284,   291,   298,   305,
-     312,   319,   326,   327,   333,   337,   344,   350,   359,   363,
-     367,   368,   377,   378,   382,   383,   387,   393,   405,   409,
-     415,   422,   433,   434,   440,   446,   456,   457,   458,   459,
-     463,   464,   470,   476,   485,   486,   492,   501,   502,   508,
-     517,   518,   524,   530,   536,   545,   546,   552,   561,   562,
-     571,   572,   581,   582,   591,   592,   601,   602,   611,   612,
-     621,   622,   631,   632,   641,   642,   643,   644,   645,   646,
-     647,   648,   649,   650,   651,   655,   659,   675,   679,   683,
-     687,   701,   705,   706,   710,   715,   723,   734,   744,   759,
-     766,   771,   782,   795,   798,   803,   808,   817,   821,   822,
-     831,   840,   849,   858,   867,   880,   891,   900,   909,   918,
-     927,   936,   945,   959,   966,   977,   984,   985,  1004,  1033,
-    1074,  1079,  1084,  1092,  1100,  1101,  1102,  1107,  1108,  1113,
-    1118,  1124,  1132,  1137,  1142,  1147,  1153,  1158,  1163,  1168,
-    1173,  1181,  1182,  1190,  1191,  1197,  1206,  1212,  1218,  1227,
-    1228,  1229,  1230,  1231,  1232,  1233,  1234,  1235,  1236,  1237,
-    1238,  1239,  1240,  1241,  1242,  1243,  1244,  1245,  1246,  1247,
-    1248,  1249,  1250,  1251,  1252,  1253,  1254,  1255,  1256,  1257,
-    1258,  1259,  1260,  1261,  1262,  1263,  1264,  1265,  1266,  1267,
-    1268,  1269,  1270,  1271,  1272,  1273,  1274,  1275,  1276,  1277,
-    1281,  1292,  1303,  1317,  1323,  1332,  1337,  1345,  1360,  1365,
-    1373,  1379,  1388,  1392,  1398,  1399,  1403,  1404,  1405,  1406,
-    1407,  1408,  1409,  1413,  1419,  1428,  1429,  1433,  1439,  1448,
-    1458,  1470,  1476,  1485,  1494,  1499,  1507,  1511,  1525,  1529,
-    1530,  1534,  1541,  1548,  1558,  1559,  1563,  1565,  1571,  1576,
-    1585,  1591,  1597,  1603,  1609,  1618,  1619,  1620,  1624
+       0,   213,   213,   212,   219,   221,   246,   247,   248,   249,
+     250,   262,   264,   268,   277,   285,   296,   300,   307,   314,
+     321,   328,   335,   342,   343,   349,   353,   360,   366,   375,
+     379,   383,   384,   393,   394,   398,   399,   403,   409,   421,
+     425,   431,   438,   449,   450,   456,   462,   472,   473,   474,
+     475,   479,   480,   486,   492,   501,   502,   508,   517,   518,
+     524,   533,   534,   540,   546,   552,   561,   562,   568,   577,
+     578,   587,   588,   597,   598,   607,   608,   617,   618,   627,
+     628,   637,   638,   647,   648,   657,   658,   659,   660,   661,
+     662,   663,   664,   665,   666,   667,   671,   675,   691,   695,
+     699,   703,   717,   721,   722,   726,   731,   739,   750,   760,
+     775,   782,   787,   798,   811,   814,   819,   824,   833,   837,
+     838,   847,   856,   865,   874,   883,   896,   907,   916,   925,
+     934,   943,   952,   961,   975,   982,   993,  1000,  1001,  1020,
+    1049,  1090,  1095,  1100,  1108,  1116,  1117,  1118,  1123,  1124,
+    1129,  1134,  1140,  1148,  1153,  1158,  1163,  1169,  1174,  1179,
+    1184,  1189,  1197,  1198,  1206,  1207,  1213,  1222,  1228,  1234,
+    1243,  1244,  1245,  1246,  1247,  1248,  1249,  1250,  1251,  1252,
+    1253,  1254,  1255,  1256,  1257,  1258,  1259,  1260,  1261,  1262,
+    1263,  1264,  1265,  1266,  1267,  1268,  1269,  1270,  1271,  1272,
+    1273,  1274,  1275,  1276,  1277,  1278,  1279,  1280,  1281,  1282,
+    1283,  1284,  1285,  1286,  1287,  1288,  1289,  1290,  1291,  1292,
+    1293,  1297,  1307,  1317,  1330,  1336,  1345,  1350,  1358,  1373,
+    1378,  1386,  1392,  1401,  1405,  1411,  1412,  1416,  1417,  1418,
+    1419,  1420,  1421,  1422,  1426,  1432,  1441,  1442,  1446,  1452,
+    1461,  1471,  1483,  1489,  1498,  1507,  1512,  1520,  1524,  1538,
+    1542,  1543,  1547,  1554,  1561,  1571,  1572,  1576,  1578,  1584,
+    1589,  1598,  1604,  1610,  1616,  1622,  1631,  1632,  1633,  1637
 };
 #endif
 
@@ -864,28 +866,28 @@ static const char *const yytname[] =
   "LOWP", "MEDIUMP", "HIGHP", "SUPERP", "PRECISION", "VERSION",
   "EXTENSION", "LINE", "COLON", "EOL", "INTERFACE", "OUTPUT",
   "PRAGMA_DEBUG_ON", "PRAGMA_DEBUG_OFF", "PRAGMA_OPTIMIZE_ON",
-  "PRAGMA_OPTIMIZE_OFF", "LAYOUT_TOK", "ASM", "CLASS", "UNION", "ENUM",
-  "TYPEDEF", "TEMPLATE", "THIS", "PACKED_TOK", "GOTO", "INLINE_TOK",
-  "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL",
-  "LONG_TOK", "SHORT_TOK", "DOUBLE_TOK", "HALF", "FIXED_TOK", "UNSIGNED",
-  "INPUT_TOK", "OUPTUT", "HVEC2", "HVEC3", "HVEC4", "DVEC2", "DVEC3",
-  "DVEC4", "FVEC2", "FVEC3", "FVEC4", "SAMPLER2DRECT", "SAMPLER3DRECT",
-  "SAMPLER2DRECTSHADOW", "SIZEOF", "CAST", "NAMESPACE", "USING",
-  "ERROR_TOK", "COMMON", "PARTITION", "ACTIVE", "SAMPLERBUFFER", "FILTER",
-  "IMAGE1D", "IMAGE2D", "IMAGE3D", "IMAGECUBE", "IMAGE1DARRAY",
-  "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D", "IIMAGE3D", "IIMAGECUBE",
-  "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D", "UIMAGE2D", "UIMAGE3D",
-  "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY", "IMAGE1DSHADOW",
-  "IMAGE2DSHADOW", "IMAGEBUFFER", "IIMAGEBUFFER", "UIMAGEBUFFER",
-  "IMAGE1DARRAYSHADOW", "IMAGE2DARRAYSHADOW", "ROW_MAJOR", "'('", "')'",
-  "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", "'~'", "'*'", "'/'",
-  "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "':'", "'='", "';'",
-  "'{'", "'}'", "$accept", "translation_unit", "$@1", "version_statement",
-  "pragma_statement", "extension_statement_list", "extension_statement",
-  "external_declaration_list", "variable_identifier", "primary_expression",
-  "postfix_expression", "integer_expression", "function_call",
-  "function_call_or_method", "function_call_generic",
-  "function_call_header_no_parameters",
+  "PRAGMA_OPTIMIZE_OFF", "PRAGMA_INVARIANT_ALL", "LAYOUT_TOK", "ASM",
+  "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", "THIS", "PACKED_TOK",
+  "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC",
+  "EXTERN", "EXTERNAL", "LONG_TOK", "SHORT_TOK", "DOUBLE_TOK", "HALF",
+  "FIXED_TOK", "UNSIGNED", "INPUT_TOK", "OUPTUT", "HVEC2", "HVEC3",
+  "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", "FVEC3", "FVEC4",
+  "SAMPLER2DRECT", "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", "SIZEOF",
+  "CAST", "NAMESPACE", "USING", "ERROR_TOK", "COMMON", "PARTITION",
+  "ACTIVE", "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", "IMAGE3D",
+  "IMAGECUBE", "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D",
+  "IIMAGE3D", "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D",
+  "UIMAGE2D", "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY",
+  "IMAGE1DSHADOW", "IMAGE2DSHADOW", "IMAGEBUFFER", "IIMAGEBUFFER",
+  "UIMAGEBUFFER", "IMAGE1DARRAYSHADOW", "IMAGE2DARRAYSHADOW", "ROW_MAJOR",
+  "'('", "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", "'~'",
+  "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "':'",
+  "'='", "';'", "'{'", "'}'", "$accept", "translation_unit", "$@1",
+  "version_statement", "pragma_statement", "extension_statement_list",
+  "extension_statement", "external_declaration_list",
+  "variable_identifier", "primary_expression", "postfix_expression",
+  "integer_expression", "function_call", "function_call_or_method",
+  "function_call_generic", "function_call_header_no_parameters",
   "function_call_header_with_parameters", "function_call_header",
   "function_identifier", "unary_expression", "unary_operator",
   "multiplicative_expression", "additive_expression", "shift_expression",
@@ -940,76 +942,76 @@ static const yytype_uint16 yytoknum[] =
      415,   416,   417,   418,   419,   420,   421,   422,   423,   424,
      425,   426,   427,   428,   429,   430,   431,   432,   433,   434,
      435,   436,   437,   438,   439,   440,   441,   442,   443,   444,
-     445,   446,   447,    40,    41,    91,    93,    46,    44,    43,
-      45,    33,   126,    42,    47,    37,    60,    62,    38,    94,
-     124,    63,    58,    61,    59,   123,   125
+     445,   446,   447,   448,    40,    41,    91,    93,    46,    44,
+      43,    45,    33,   126,    42,    47,    37,    60,    62,    38,
+      94,   124,    63,    58,    61,    59,   123,   125
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint16 yyr1[] =
 {
-       0,   217,   219,   218,   220,   220,   221,   221,   221,   221,
-     222,   222,   223,   224,   224,   225,   226,   226,   226,   226,
-     226,   226,   227,   227,   227,   227,   227,   227,   228,   229,
-     230,   230,   231,   231,   232,   232,   233,   233,   234,   235,
-     235,   235,   236,   236,   236,   236,   237,   237,   237,   237,
-     238,   238,   238,   238,   239,   239,   239,   240,   240,   240,
-     241,   241,   241,   241,   241,   242,   242,   242,   243,   243,
-     244,   244,   245,   245,   246,   246,   247,   247,   248,   248,
-     249,   249,   250,   250,   251,   251,   251,   251,   251,   251,
-     251,   251,   251,   251,   251,   252,   252,   253,   254,   254,
-     254,   255,   256,   256,   257,   257,   258,   259,   259,   260,
-     260,   260,   260,   261,   261,   261,   261,   262,   263,   263,
-     263,   263,   263,   263,   263,   264,   264,   264,   264,   264,
-     264,   264,   264,   265,   265,   266,   267,   267,   268,   268,
-     269,   269,   269,   270,   271,   271,   271,   271,   271,   271,
-     271,   271,   272,   272,   272,   272,   272,   272,   272,   272,
-     272,   273,   273,   274,   274,   274,   275,   275,   275,   276,
-     276,   276,   276,   276,   276,   276,   276,   276,   276,   276,
-     276,   276,   276,   276,   276,   276,   276,   276,   276,   276,
-     276,   276,   276,   276,   276,   276,   276,   276,   276,   276,
-     276,   276,   276,   276,   276,   276,   276,   276,   276,   276,
-     276,   276,   276,   276,   276,   276,   276,   276,   276,   276,
-     277,   277,   277,   278,   278,   279,   279,   280,   281,   281,
-     282,   282,   283,   284,   285,   285,   286,   286,   286,   286,
-     286,   286,   286,   287,   287,   288,   288,   289,   289,   290,
-     290,   291,   291,   292,   293,   293,   294,   294,   295,   296,
-     296,   297,   297,   297,   298,   298,   299,   299,   300,   300,
-     301,   301,   301,   301,   301,   302,   302,   302,   303
+       0,   218,   220,   219,   221,   221,   222,   222,   222,   222,
+     222,   223,   223,   224,   225,   225,   226,   227,   227,   227,
+     227,   227,   227,   228,   228,   228,   228,   228,   228,   229,
+     230,   231,   231,   232,   232,   233,   233,   234,   234,   235,
+     236,   236,   236,   237,   237,   237,   237,   238,   238,   238,
+     238,   239,   239,   239,   239,   240,   240,   240,   241,   241,
+     241,   242,   242,   242,   242,   242,   243,   243,   243,   244,
+     244,   245,   245,   246,   246,   247,   247,   248,   248,   249,
+     249,   250,   250,   251,   251,   252,   252,   252,   252,   252,
+     252,   252,   252,   252,   252,   252,   253,   253,   254,   255,
+     255,   255,   256,   257,   257,   258,   258,   259,   260,   260,
+     261,   261,   261,   261,   262,   262,   262,   262,   263,   264,
+     264,   264,   264,   264,   264,   264,   265,   265,   265,   265,
+     265,   265,   265,   265,   266,   266,   267,   268,   268,   269,
+     269,   270,   270,   270,   271,   272,   272,   272,   272,   272,
+     272,   272,   272,   273,   273,   273,   273,   273,   273,   273,
+     273,   273,   274,   274,   275,   275,   275,   276,   276,   276,
+     277,   277,   277,   277,   277,   277,   277,   277,   277,   277,
+     277,   277,   277,   277,   277,   277,   277,   277,   277,   277,
+     277,   277,   277,   277,   277,   277,   277,   277,   277,   277,
+     277,   277,   277,   277,   277,   277,   277,   277,   277,   277,
+     277,   277,   277,   277,   277,   277,   277,   277,   277,   277,
+     277,   278,   278,   278,   279,   279,   280,   280,   281,   282,
+     282,   283,   283,   284,   285,   286,   286,   287,   287,   287,
+     287,   287,   287,   287,   288,   288,   289,   289,   290,   290,
+     291,   291,   292,   292,   293,   294,   294,   295,   295,   296,
+     297,   297,   298,   298,   298,   299,   299,   300,   300,   301,
+     301,   302,   302,   302,   302,   302,   303,   303,   303,   304
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
        0,     2,     0,     4,     0,     3,     2,     2,     2,     2,
-       0,     2,     5,     1,     2,     1,     1,     1,     1,     1,
-       1,     3,     1,     4,     1,     3,     2,     2,     1,     1,
-       1,     3,     2,     2,     2,     1,     2,     3,     2,     1,
-       1,     1,     1,     2,     2,     2,     1,     1,     1,     1,
-       1,     3,     3,     3,     1,     3,     3,     1,     3,     3,
-       1,     3,     3,     3,     3,     1,     3,     3,     1,     3,
-       1,     3,     1,     3,     1,     3,     1,     3,     1,     3,
-       1,     5,     1,     3,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     3,     1,     2,     2,
-       4,     2,     1,     1,     2,     3,     3,     2,     5,     3,
-       2,     3,     2,     0,     1,     1,     1,     1,     1,     3,
-       5,     6,     7,     8,     5,     1,     2,     4,     5,     6,
-       7,     4,     2,     1,     2,     4,     1,     3,     1,     3,
-       1,     1,     1,     1,     1,     1,     2,     1,     2,     2,
-       3,     1,     1,     1,     1,     2,     1,     1,     2,     2,
-       1,     1,     2,     1,     3,     4,     1,     1,     1,     1,
+       2,     0,     2,     5,     1,     2,     1,     1,     1,     1,
+       1,     1,     3,     1,     4,     1,     3,     2,     2,     1,
+       1,     1,     3,     2,     2,     2,     1,     2,     3,     2,
+       1,     1,     1,     1,     2,     2,     2,     1,     1,     1,
+       1,     1,     3,     3,     3,     1,     3,     3,     1,     3,
+       3,     1,     3,     3,     3,     3,     1,     3,     3,     1,
+       3,     1,     3,     1,     3,     1,     3,     1,     3,     1,
+       3,     1,     5,     1,     3,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     3,     1,     2,
+       2,     4,     2,     1,     1,     2,     3,     3,     2,     5,
+       3,     2,     3,     2,     0,     1,     1,     1,     1,     1,
+       3,     5,     6,     7,     8,     5,     1,     2,     4,     5,
+       6,     7,     4,     2,     1,     2,     4,     1,     3,     1,
+       3,     1,     1,     1,     1,     1,     1,     2,     1,     2,
+       2,     3,     1,     1,     1,     1,     2,     1,     1,     2,
+       2,     1,     1,     2,     1,     3,     4,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     5,     4,     1,     2,     3,     1,     3,
-       1,     4,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     2,     3,     1,     1,     2,     3,     1,
-       2,     1,     2,     5,     3,     1,     1,     4,     5,     3,
-       2,     5,     7,     6,     1,     1,     1,     0,     2,     3,
-       2,     2,     2,     3,     2,     1,     1,     1,     2
+       1,     1,     1,     1,     5,     4,     1,     2,     3,     1,
+       3,     1,     4,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     2,     3,     1,     1,     2,     3,
+       1,     2,     1,     2,     5,     3,     1,     1,     4,     5,
+       3,     2,     5,     7,     6,     1,     1,     1,     0,     2,
+       3,     2,     2,     2,     3,     2,     1,     1,     1,     2
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -1017,614 +1019,638 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint16 yydefact[] =
 {
-       4,     0,     0,    10,     0,     1,     2,     5,     0,     0,
-      11,     0,   153,   152,   173,   170,   171,   172,   177,   178,
-     179,   180,   181,   182,   183,   184,   185,   174,   175,   176,
-       0,   156,   157,   160,   154,   142,   141,   140,   186,   187,
-     188,   189,   190,   191,   192,   193,   194,   195,   196,   198,
-     199,   200,   201,   203,   204,   205,   206,   207,   208,   209,
-     210,   211,   212,   213,   214,   215,   216,   217,   218,   219,
-       0,   169,   168,   151,   222,   221,   220,     0,     0,     0,
-       0,     0,     0,   197,   202,   277,     3,   276,     0,     0,
-     103,   113,     0,   118,   125,   145,   147,     0,   144,   133,
-     161,   163,   166,     0,   167,    13,   275,     0,   158,   159,
-     155,     0,     0,   132,     0,   149,     0,     6,     7,     8,
-       9,     0,    14,    98,     0,   278,   101,   113,   143,   114,
-     115,   116,   104,     0,   113,     0,    99,   126,   146,   148,
-     134,     0,   162,     0,     0,     0,     0,   225,   150,     0,
-     138,     0,   136,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    15,    19,    17,    18,    20,    41,
-       0,     0,     0,    46,    47,    48,    49,   251,     0,   247,
-      16,    22,    42,    24,    29,    30,     0,     0,    35,     0,
-      50,     0,    54,    57,    60,    65,    68,    70,    72,    74,
-      76,    78,    80,    82,    95,     0,   233,     0,   133,   236,
-     249,   235,   234,     0,   237,   238,   239,   240,   241,   242,
-     105,   110,   112,   117,     0,   119,   106,     0,     0,   164,
-      50,    97,     0,    39,    12,     0,   230,     0,   228,   224,
-     226,   100,     0,   135,     0,   271,   270,     0,     0,     0,
-     274,   272,     0,     0,     0,   260,     0,    43,    44,     0,
-     243,     0,    26,    27,     0,     0,    33,    32,     0,   169,
-      36,    38,    85,    86,    88,    87,    90,    91,    92,    93,
-      94,    89,    84,     0,    45,     0,     0,     0,     0,     0,
+       4,     0,     0,    11,     0,     1,     2,     5,     0,     0,
+      12,     0,   154,   153,   174,   171,   172,   173,   178,   179,
+     180,   181,   182,   183,   184,   185,   186,   175,   176,   177,
+       0,   157,   158,   161,   155,   143,   142,   141,   187,   188,
+     189,   190,   191,   192,   193,   194,   195,   196,   197,   199,
+     200,   201,   202,   204,   205,   206,   207,   208,   209,   210,
+     211,   212,   213,   214,   215,   216,   217,   218,   219,   220,
+       0,   170,   169,   152,   223,   222,   221,     0,     0,     0,
+       0,     0,     0,     0,   198,   203,   278,     3,   277,     0,
+       0,   104,   114,     0,   119,   126,   146,   148,     0,   145,
+     134,   162,   164,   167,     0,   168,    14,   276,     0,   159,
+     160,   156,     0,     0,   133,     0,   150,     0,     6,     7,
+       8,     9,    10,     0,    15,    99,     0,   279,   102,   114,
+     144,   115,   116,   117,   105,     0,   114,     0,   100,   127,
+     147,   149,   135,     0,   163,     0,     0,     0,     0,   226,
+     151,     0,   139,     0,   137,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    16,    20,    18,    19,
+      21,    42,     0,     0,     0,    47,    48,    49,    50,   252,
+       0,   248,    17,    23,    43,    25,    30,    31,     0,     0,
+      36,     0,    51,     0,    55,    58,    61,    66,    69,    71,
+      73,    75,    77,    79,    81,    83,    96,     0,   234,     0,
+     134,   237,   250,   236,   235,     0,   238,   239,   240,   241,
+     242,   243,   106,   111,   113,   118,     0,   120,   107,     0,
+       0,   165,    51,    98,     0,    40,    13,     0,   231,     0,
+     229,   225,   227,   101,     0,   136,     0,   272,   271,     0,
+       0,     0,   275,   273,     0,     0,     0,   261,     0,    44,
+      45,     0,   244,     0,    27,    28,     0,     0,    34,    33,
+       0,   170,    37,    39,    86,    87,    89,    88,    91,    92,
+      93,    94,    95,    90,    85,     0,    46,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   252,   248,   250,   107,
-     109,   111,     0,     0,   127,     0,   232,   131,   165,   223,
-       0,     0,   227,   139,   137,     0,   265,   264,   267,     0,
-     273,     0,   259,   151,   256,     0,     0,    21,   244,     0,
-      28,    25,    31,    37,    83,    51,    52,    53,    55,    56,
-      58,    59,    63,    64,    61,    62,    66,    67,    69,    71,
-      73,    75,    77,    79,     0,    96,     0,   120,     0,   124,
-       0,   128,     0,   229,     0,   266,     0,     0,     0,     0,
-       0,     0,    23,     0,     0,     0,   121,   129,     0,   231,
-       0,   268,     0,   255,   253,   258,     0,   246,   261,   245,
-      81,   108,   122,     0,   130,     0,   269,   263,     0,   257,
-     123,   262,   254
+       0,     0,     0,     0,     0,     0,     0,     0,   253,   249,
+     251,   108,   110,   112,     0,     0,   128,     0,   233,   132,
+     166,   224,     0,     0,   228,   140,   138,     0,   266,   265,
+     268,     0,   274,     0,   260,   152,   257,     0,     0,    22,
+     245,     0,    29,    26,    32,    38,    84,    52,    53,    54,
+      56,    57,    59,    60,    64,    65,    62,    63,    67,    68,
+      70,    72,    74,    76,    78,    80,     0,    97,     0,   121,
+       0,   125,     0,   129,     0,   230,     0,   267,     0,     0,
+       0,     0,     0,     0,    24,     0,     0,     0,   122,   130,
+       0,   232,     0,   269,     0,   256,   254,   259,     0,   247,
+     262,   246,    82,   109,   123,     0,   131,     0,   270,   264,
+       0,   258,   124,   263,   255
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     2,     9,     3,    85,     6,    10,    86,   180,   181,
-     182,   339,   183,   184,   185,   186,   187,   188,   189,   190,
-     191,   192,   193,   194,   195,   196,   197,   198,   199,   200,
-     201,   202,   203,   204,   283,   205,   232,   206,   207,    89,
-      90,    91,   221,   132,   133,   222,    92,    93,    94,    95,
-     151,   152,    96,   134,    97,    98,   233,   100,   101,   102,
-     103,   104,   146,   147,   237,   238,   317,   209,   210,   211,
-     212,   398,   399,   213,   214,   215,   394,   336,   216,   217,
-     218,   328,   376,   377,   219,   105,   106
+      -1,     2,     9,     3,    86,     6,    10,    87,   182,   183,
+     184,   341,   185,   186,   187,   188,   189,   190,   191,   192,
+     193,   194,   195,   196,   197,   198,   199,   200,   201,   202,
+     203,   204,   205,   206,   285,   207,   234,   208,   209,    90,
+      91,    92,   223,   134,   135,   224,    93,    94,    95,    96,
+     153,   154,    97,   136,    98,    99,   235,   101,   102,   103,
+     104,   105,   148,   149,   239,   240,   319,   211,   212,   213,
+     214,   400,   401,   215,   216,   217,   396,   338,   218,   219,
+     220,   330,   378,   379,   221,   106,   107
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -350
+#define YYPACT_NINF -321
 static const yytype_int16 yypact[] =
 {
-     -78,   -56,    54,  -350,   -52,  -350,   -37,  -350,     8,  3302,
-    -350,   -26,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-    -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-      88,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-    -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-    -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-    -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-     -66,  -350,  -350,    42,  -350,  -350,  -350,    70,    -4,    10,
-      29,    34,   -79,  -350,  -350,  -350,  3302,  -350,   -19,   -24,
-     -69,     5,  -154,  -350,   102,    16,    16,  3490,  -350,  -350,
-    -350,    18,  -350,  3562,  -350,  -350,  -350,   108,  -350,  -350,
-    -350,    -8,  3490,  -350,    16,  -350,  3562,  -350,  -350,  -350,
-    -350,   138,  -350,  -350,   387,  -350,  -350,    24,  -350,  -350,
-    -350,  -350,  -350,  3490,   147,   141,  -350,  -166,  -350,  -350,
-    -350,  2387,  -350,   106,  3490,   144,  1772,  -350,  -350,     7,
-      11,   -87,  -350,    14,    15,  1243,    30,    32,    20,  2004,
-      37,  2936,    25,    39,   -65,  -350,  -350,  -350,  -350,  -350,
-    2936,  2936,  2936,  -350,  -350,  -350,  -350,  -350,   601,  -350,
-    -350,  -350,   -59,  -350,  -350,  -350,    28,   -82,  3119,    43,
-     -30,  2936,   -11,    -2,   118,   -74,   114,    35,    31,    36,
-     148,   152,   -77,  -350,  -350,  -115,  -350,    40,    52,  -350,
-    -350,  -350,  -350,   815,  -350,  -350,  -350,  -350,  -350,  -350,
-    -350,  -350,  -350,   172,  3490,  -180,  -350,  2570,  2936,  -350,
-    -350,  -350,    53,  -350,  -350,  1888,    55,  -113,  -350,  -350,
-    -350,  -350,   173,  -350,   138,  -350,  -350,   178,  1656,  2936,
-    -350,  -350,  -108,  2936,  -161,  -350,  2204,  -350,  -350,   -68,
-    -350,  1029,  -350,  -350,  2936,  3418,  -350,  -350,  2936,    61,
-    -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-    -350,  -350,  -350,  2936,  -350,  2936,  2936,  2936,  2936,  2936,
-    2936,  2936,  2936,  2936,  2936,  2936,  2936,  2936,  2936,  2936,
-    2936,  2936,  2936,  2936,  2936,  2936,  -350,  -350,  -350,    63,
-    -350,  -350,  2753,  2936,    46,    60,  -350,  -350,  -350,  -350,
-    2936,   144,  -350,  -350,  -350,    67,  -350,  -350,  2204,   -55,
-    -350,   -54,  -350,   238,    65,   188,    71,  -350,  -350,    72,
-      65,    73,  -350,  -350,  -350,  -350,  -350,  -350,   -11,   -11,
-      -2,    -2,   118,   118,   118,   118,   -74,   -74,   114,    35,
-      31,    36,   148,   152,  -157,  -350,  2936,    56,    83,  -350,
-    2936,    68,    84,  -350,  2936,  -350,    69,    90,  1243,    74,
-      77,  1456,  -350,  2936,    86,  2936,    79,  -350,  2936,  -350,
-     -53,  2936,  1456,   255,  -350,  -350,  2936,  -350,  -350,  -350,
-    -350,  -350,  -350,  2936,  -350,    80,    65,  -350,  1243,  -350,
-    -350,  -350,  -350
+     -86,   -57,    45,  -321,   -56,  -321,   -50,  -321,   -10,  3320,
+    -321,   -26,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+    -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+      79,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+    -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+    -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+    -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+     -70,  -321,  -321,    43,  -321,  -321,  -321,    18,   -22,   -12,
+      -5,     2,    25,  -101,  -321,  -321,  -321,  3320,  -321,   -43,
+     -55,   -54,     6,  -148,  -321,    52,   211,   211,  3509,  -321,
+    -321,  -321,   -47,  -321,  3581,  -321,  -321,  -321,   110,  -321,
+    -321,  -321,   -14,  3509,  -321,   211,  -321,  3581,  -321,  -321,
+    -321,  -321,  -321,   131,  -321,  -321,   389,  -321,  -321,    15,
+    -321,  -321,  -321,  -321,  -321,  3509,   109,   136,  -321,  -152,
+    -321,  -321,  -321,  2400,  -321,   105,  3509,   143,  1781,  -321,
+    -321,     7,     9,  -107,  -321,    10,    12,  1249,    27,    36,
+      17,  2015,    40,  2952,    22,    42,   -65,  -321,  -321,  -321,
+    -321,  -321,  2952,  2952,  2952,  -321,  -321,  -321,  -321,  -321,
+     604,  -321,  -321,  -321,   -20,  -321,  -321,  -321,    47,   -92,
+    3136,    46,   -67,  2952,   -24,   -16,   111,   -73,   108,    37,
+      41,    39,   162,   161,   -82,  -321,  -321,  -147,  -321,    44,
+      61,  -321,  -321,  -321,  -321,   819,  -321,  -321,  -321,  -321,
+    -321,  -321,  -321,  -321,  -321,   181,  3509,  -160,  -321,  2584,
+    2952,  -321,  -321,  -321,    63,  -321,  -321,  1898,    62,  -146,
+    -321,  -321,  -321,  -321,   183,  -321,   131,  -321,  -321,   187,
+    1664,  2952,  -321,  -321,  -144,  2952,  -140,  -321,  2216,  -321,
+    -321,   -81,  -321,  1034,  -321,  -321,  2952,  3437,  -321,  -321,
+    2952,    70,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+    -321,  -321,  -321,  -321,  -321,  2952,  -321,  2952,  2952,  2952,
+    2952,  2952,  2952,  2952,  2952,  2952,  2952,  2952,  2952,  2952,
+    2952,  2952,  2952,  2952,  2952,  2952,  2952,  2952,  -321,  -321,
+    -321,    74,  -321,  -321,  2768,  2952,    64,    69,  -321,  -321,
+    -321,  -321,  2952,   143,  -321,  -321,  -321,    82,  -321,  -321,
+    2216,   -74,  -321,   -68,  -321,   235,    78,   203,    85,  -321,
+    -321,    84,    78,    88,  -321,  -321,  -321,  -321,  -321,  -321,
+     -24,   -24,   -16,   -16,   111,   111,   111,   111,   -73,   -73,
+     108,    37,    41,    39,   162,   161,  -129,  -321,  2952,    71,
+      86,  -321,  2952,    72,    87,  -321,  2952,  -321,    73,    92,
+    1249,    75,    76,  1463,  -321,  2952,    95,  2952,    80,  -321,
+    2952,  -321,   -63,  2952,  1463,   277,  -321,  -321,  2952,  -321,
+    -321,  -321,  -321,  -321,  -321,  2952,  -321,    81,    78,  -321,
+    1249,  -321,  -321,  -321,  -321
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,  -350,
-    -350,  -350,  -350,  -350,    22,  -350,  -350,  -350,  -350,  -135,
-    -350,   -83,   -81,  -104,   -85,   -13,    -6,    -5,    -3,    -1,
-      -7,  -350,  -133,   -97,  -350,  -156,  -193,     9,    12,  -350,
-    -350,  -350,    76,   170,   168,    81,  -350,  -350,  -239,  -350,
-    -350,    59,   -71,  -350,  -350,   -72,    -9,     1,  -350,  -350,
-     227,  -350,   163,  -139,  -350,   -12,  -283,    62,  -151,  -349,
-     -67,   -84,   223,   135,    66,  -350,  -350,   -10,  -350,  -350,
-    -350,  -350,  -350,  -350,  -350,   229,  -350
+    -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,  -321,
+    -321,  -321,  -321,  -321,    26,  -321,  -321,  -321,  -321,  -135,
+    -321,   -91,   -88,  -106,   -90,    -3,    -6,    -4,    -2,    -1,
+       0,  -321,  -139,  -174,  -321,  -156,  -217,    11,    13,  -321,
+    -321,  -321,    83,   170,   164,    89,  -321,  -321,  -243,  -321,
+    -321,    56,   -71,  -321,  -321,   -72,    -9,   -32,  -321,  -321,
+     227,  -321,   160,  -131,  -321,   -15,  -195,    57,  -154,  -320,
+     -69,   -84,   222,   133,    66,  -321,  -321,   -13,  -321,  -321,
+    -321,  -321,  -321,  -321,  -321,   231,  -321
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -169
+#define YYTABLE_NINF -170
 static const yytype_int16 yytable[] =
 {
-      99,   115,   114,   252,   247,   254,   230,   240,   231,   128,
-     111,  -168,   292,   293,   303,   312,   259,   335,    87,    12,
-      13,    88,     4,   138,   139,   262,   263,   226,   128,   227,
-     369,     1,   397,   313,   315,   257,   258,   305,   129,   130,
-     131,   305,   148,   397,   135,    12,    13,   228,    30,    31,
-      32,   332,    33,    34,     5,   383,   284,   129,   130,   131,
-     136,     7,   308,   272,   273,   274,   275,   276,   277,   278,
-     279,   280,   281,     8,    30,    31,    32,    99,    33,    34,
-      35,    36,    37,   305,    11,   321,   107,   387,   140,   335,
-     305,   270,   230,   329,   231,    87,   240,   331,    88,   306,
-     334,   322,   402,   145,   142,   404,   330,   243,   340,   117,
-     308,   244,   267,   409,   121,   208,   268,   149,   113,   368,
-     410,   108,   109,   118,   223,   110,   337,   372,   -40,   127,
-     305,   316,   294,   295,   304,   145,   264,   145,   265,   378,
-     379,   405,   119,   305,   305,   305,   208,   120,   364,   112,
-     345,   346,   347,   230,   230,   230,   230,   230,   230,   230,
-     230,   230,   230,   230,   230,   230,   230,   230,   230,   208,
-     126,   343,   334,   384,    74,    75,    76,   230,   137,   231,
-     129,   130,   131,   282,   143,   230,   344,   231,   352,   353,
-     354,   355,   285,   286,   287,   123,   124,   288,   289,  -102,
-     290,   291,   296,   297,   208,   348,   349,   144,   365,   350,
-     351,   356,   357,   141,   150,   223,   316,   225,   390,   234,
-     236,   241,   266,   248,   242,   249,   145,   393,   245,   246,
-     253,   230,   256,   231,   250,   406,   271,   255,   301,   208,
-     299,    12,    13,   298,   302,   -39,   300,   208,   309,   318,
-     320,   323,   208,   325,   123,   -34,   371,   412,   366,   370,
-     374,   115,   114,   305,   380,   381,   -40,   408,   382,   385,
-      30,    31,    32,   316,    33,    34,    35,    36,    37,   386,
-     389,   388,   401,   391,   392,   358,   400,   342,   316,   178,
-     396,   316,   403,   359,   411,   360,   363,   220,   361,   316,
-     310,   362,   224,   324,   116,   311,   316,   235,   407,   373,
-     326,   125,   395,   261,   327,   122,     0,     0,   375,   208,
+     100,   116,   115,   249,   233,   254,   112,   256,   232,   305,
+     130,  -169,   317,   294,   295,   337,   272,   242,   261,   130,
+      88,     4,    89,     1,   140,   141,   274,   275,   276,   277,
+     278,   279,   280,   281,   282,   283,   314,   259,   260,   131,
+     132,   133,   228,   150,   229,     5,    12,    13,   131,   132,
+     133,   137,   307,   323,   315,   307,   318,     7,   286,   307,
+       8,   310,   230,   399,   264,   265,    11,   138,   308,   324,
+     307,   332,   144,   334,   399,    30,    31,    32,   100,    33,
+      34,    35,    36,    37,   385,   151,   108,   337,   245,   142,
+     233,   118,   246,   123,   232,   331,   345,   370,    88,   333,
+      89,   119,   336,   269,   147,   374,   242,   270,   120,   310,
+     342,   346,   109,   110,   339,   121,   111,   210,   307,   114,
+     371,   380,    74,    75,    76,   307,   225,   381,   139,   -41,
+     306,   307,   407,   367,   296,   297,   307,   147,   122,   147,
+     128,   318,   131,   132,   133,   129,   113,   284,   210,   143,
+     366,   386,   347,   348,   349,   232,   232,   232,   232,   232,
+     232,   232,   232,   232,   232,   232,   232,   232,   232,   232,
+     232,   210,   125,   126,   336,   233,   266,   389,   267,   232,
+     287,   288,   289,   233,   290,   291,   145,   232,   354,   355,
+     356,   357,   404,   292,   293,   406,   298,   299,   318,   350,
+     351,  -103,   146,   411,   352,   353,   210,   152,   358,   359,
+     412,   402,   227,   318,    12,    13,   318,   225,   236,   238,
+     392,   250,   243,   244,   318,   247,   395,   248,   147,   233,
+     251,   318,   252,   232,   255,   257,   258,   408,    12,    13,
+     273,   210,   268,    30,    31,    32,   300,    33,    34,   210,
+     302,   301,   303,   304,   210,   -40,   414,   311,   322,   125,
+     320,   325,   327,   116,   115,   -35,   373,    30,    31,    32,
+     368,    33,    34,    35,    36,    37,   376,   307,   372,   382,
+     383,   384,   -41,   388,   391,   387,   390,   394,   393,   410,
+     398,   180,   403,   344,   405,   361,   413,   360,   362,   222,
+     226,   363,   326,   364,   117,   365,   237,   328,   375,   312,
+     409,   127,   397,   263,     0,   313,   329,   377,   124,     0,
+       0,   210,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   208,
-       0,     0,   208,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,   208,     0,     0,     0,     0,     0,     0,
-      12,    13,    14,    15,    16,    17,   153,   154,   155,   208,
-     156,   157,   158,   159,   160,   161,   162,    18,    19,    20,
-      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
-      31,    32,     0,    33,    34,    35,    36,    37,    38,    39,
-      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
-      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    71,   163,   164,   165,   166,   167,   168,   169,     0,
-       0,   170,   171,     0,     0,     0,     0,     0,     0,     0,
+       0,   210,     0,     0,   210,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   210,     0,     0,     0,     0,
+       0,     0,    12,    13,    14,    15,    16,    17,   155,   156,
+     157,   210,   158,   159,   160,   161,   162,   163,   164,    18,
+      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,    31,    32,     0,    33,    34,    35,    36,    37,
+      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
+      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
+      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
+      68,    69,    70,    71,   165,   166,   167,   168,   169,   170,
+     171,     0,     0,   172,   173,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-      73,    74,    75,    76,     0,    77,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    82,     0,     0,
+       0,     0,    73,    74,    75,    76,     0,    77,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      83,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    83,     0,    84,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,    84,     0,    85,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     172,     0,     0,     0,     0,     0,   173,   174,   175,   176,
+       0,     0,     0,   174,     0,     0,     0,     0,     0,   175,
+     176,   177,   178,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   179,   180,   181,    12,    13,    14,
+      15,    16,    17,   155,   156,   157,     0,   158,   159,   160,
+     161,   162,   163,   164,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    31,    32,     0,
+      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
+      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    71,   165,
+     166,   167,   168,   169,   170,   171,     0,     0,   172,   173,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,   177,   178,   179,    12,    13,    14,    15,    16,    17,
-     153,   154,   155,     0,   156,   157,   158,   159,   160,   161,
-     162,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-      27,    28,    29,    30,    31,    32,     0,    33,    34,    35,
-      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
-      66,    67,    68,    69,    70,    71,   163,   164,   165,   166,
-     167,   168,   169,     0,     0,   170,   171,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    73,    74,    75,
+      76,     0,    77,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    83,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    84,
+       0,    85,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,   174,     0,
+       0,     0,     0,     0,   175,   176,   177,   178,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   179,
+     180,   262,    12,    13,    14,    15,    16,    17,   155,   156,
+     157,     0,   158,   159,   160,   161,   162,   163,   164,    18,
+      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,    31,    32,     0,    33,    34,    35,    36,    37,
+      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
+      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
+      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
+      68,    69,    70,    71,   165,   166,   167,   168,   169,   170,
+     171,     0,     0,   172,   173,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    73,    74,    75,    76,     0,    77,
+       0,     0,    73,    74,    75,    76,     0,    77,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    82,     0,     0,     0,     0,     0,     0,     0,     0,
+      83,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,    83,     0,    84,     0,     0,
+       0,     0,     0,     0,    84,     0,    85,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   172,     0,     0,     0,     0,     0,
-     173,   174,   175,   176,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,   177,   178,   260,    12,    13,
-      14,    15,    16,    17,   153,   154,   155,     0,   156,   157,
-     158,   159,   160,   161,   162,    18,    19,    20,    21,    22,
-      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
-       0,    33,    34,    35,    36,    37,    38,    39,    40,    41,
-      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
-      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
-     163,   164,   165,   166,   167,   168,   169,     0,     0,   170,
-     171,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    73,    74,
-      75,    76,     0,    77,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,    82,     0,     0,     0,     0,
+       0,     0,     0,   174,     0,     0,     0,     0,     0,   175,
+     176,   177,   178,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   179,   180,   309,    12,    13,    14,
+      15,    16,    17,   155,   156,   157,     0,   158,   159,   160,
+     161,   162,   163,   164,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    31,    32,     0,
+      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
+      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    71,   165,
+     166,   167,   168,   169,   170,   171,     0,     0,   172,   173,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    73,    74,    75,
+      76,     0,    77,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    83,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    83,
-       0,    84,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    84,
+       0,    85,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   172,     0,
-       0,     0,     0,     0,   173,   174,   175,   176,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   177,
-     178,   307,    12,    13,    14,    15,    16,    17,   153,   154,
-     155,     0,   156,   157,   158,   159,   160,   161,   162,    18,
+       0,     0,     0,     0,     0,     0,     0,     0,   174,     0,
+       0,     0,     0,     0,   175,   176,   177,   178,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   179,
+     180,   340,    12,    13,    14,    15,    16,    17,   155,   156,
+     157,     0,   158,   159,   160,   161,   162,   163,   164,    18,
       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
       29,    30,    31,    32,     0,    33,    34,    35,    36,    37,
       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
       48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
       58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    71,   163,   164,   165,   166,   167,   168,
-     169,     0,     0,   170,   171,     0,     0,     0,     0,     0,
+      68,    69,    70,    71,   165,   166,   167,   168,   169,   170,
+     171,     0,     0,   172,   173,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,    73,    74,    75,    76,     0,    77,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    82,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      83,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    83,     0,    84,     0,     0,     0,     0,
+       0,     0,     0,     0,    84,     0,    85,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   172,     0,     0,     0,     0,     0,   173,   174,
-     175,   176,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,   177,   178,   338,    12,    13,    14,    15,
-      16,    17,   153,   154,   155,     0,   156,   157,   158,   159,
-     160,   161,   162,    18,    19,    20,    21,    22,    23,    24,
+       0,     0,     0,   174,     0,     0,     0,     0,     0,   175,
+     176,   177,   178,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   179,   180,    12,    13,    14,    15,
+      16,    17,   155,   156,   157,     0,   158,   159,   160,   161,
+     162,   163,   164,    18,    19,    20,    21,    22,    23,    24,
       25,    26,    27,    28,    29,    30,    31,    32,     0,    33,
       34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
       54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
-      64,    65,    66,    67,    68,    69,    70,    71,   163,   164,
-     165,   166,   167,   168,   169,     0,     0,   170,   171,     0,
+      64,    65,    66,    67,    68,    69,    70,    71,   165,   166,
+     167,   168,   169,   170,   171,     0,     0,   172,   173,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,    73,    74,    75,    76,
        0,    77,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    82,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    83,     0,    84,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   172,     0,     0,     0,
-       0,     0,   173,   174,   175,   176,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   177,   178,    12,
-      13,    14,    15,    16,    17,   153,   154,   155,     0,   156,
-     157,   158,   159,   160,   161,   162,    18,    19,    20,    21,
-      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
-      32,     0,    33,    34,    35,    36,    37,    38,    39,    40,
-      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
-      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
-      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
-      71,   163,   164,   165,   166,   167,   168,   169,     0,     0,
-     170,   171,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    73,
-      74,    75,    76,     0,    77,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,    82,     0,     0,     0,
+       0,     0,     0,     0,    83,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,    84,     0,
+      85,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-      83,     0,    84,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   174,     0,     0,
+       0,     0,     0,   175,   176,   177,   178,    12,    13,    14,
+      15,    16,    17,     0,     0,     0,     0,     0,   179,   126,
+       0,     0,     0,     0,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    31,    32,     0,
+      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
+      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    71,     0,
+     166,   167,   168,   169,   170,   171,     0,     0,   172,   173,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   172,
-       0,     0,     0,     0,     0,   173,   174,   175,   176,    12,
-      13,    14,    15,    16,    17,     0,     0,     0,     0,     0,
-     177,   124,     0,     0,     0,     0,    18,    19,    20,    21,
-      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
-      32,     0,    33,    34,    35,    36,    37,    38,    39,    40,
-      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
-      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
-      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
-      71,     0,   164,   165,   166,   167,   168,   169,     0,     0,
-     170,   171,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    73,
-      74,    75,    76,     0,    77,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,    82,    14,    15,    16,
-      17,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,    18,    19,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,     0,     0,     0,     0,     0,     0,
-      83,     0,    84,    38,    39,    40,    41,    42,    43,    44,
-      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
-      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
-      65,    66,    67,    68,    69,    70,    71,     0,    72,   172,
-       0,     0,     0,     0,     0,   173,   174,   175,   176,     0,
+       0,     0,     0,     0,     0,     0,     0,    73,    74,    75,
+      76,     0,    77,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    83,    14,    15,    16,    17,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     177,     0,     0,     0,     0,     0,    74,    75,    76,     0,
+       0,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+      27,    28,    29,     0,     0,     0,     0,     0,     0,    84,
+       0,    85,    38,    39,    40,    41,    42,    43,    44,    45,
+      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    71,     0,    72,   174,     0,
+       0,     0,     0,     0,   175,   176,   177,   178,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   179,
+       0,     0,     0,     0,     0,    74,    75,    76,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,    14,    15,    16,    17,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,    18,    19,
       20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
-       0,     0,     0,     0,     0,     0,    83,     0,    84,    38,
+       0,     0,     0,     0,     0,     0,    84,     0,    85,    38,
       39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
       49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
       59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
       69,    70,    71,     0,    72,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   239,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,   241,     0,
        0,     0,    74,    75,    76,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    14,
-      15,    16,    17,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,    29,     0,     0,     0,     0,
-       0,     0,    83,     0,    84,    38,    39,    40,    41,    42,
-      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
-      63,    64,    65,    66,    67,    68,    69,    70,    71,     0,
-     164,   165,   166,   167,   168,   169,     0,     0,   170,   171,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   319,     0,     0,     0,    74,    75,
-      76,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    83,     0,
-      84,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   172,     0,     0,
-       0,     0,     0,   173,   174,   175,   176,    12,    13,    14,
-      15,    16,    17,     0,     0,     0,     0,     0,   251,     0,
-       0,     0,     0,     0,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,    29,    30,    31,    32,     0,
-      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
-      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
-      63,    64,    65,    66,    67,    68,    69,    70,    71,     0,
-     164,   165,   166,   167,   168,   169,     0,     0,   170,   171,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   333,    74,    75,
-      76,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    82,     0,     0,     0,     0,     0,
+      14,    15,    16,    17,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,    29,     0,     0,     0,
+       0,     0,     0,    84,     0,    85,    38,    39,    40,    41,
+      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
+      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
+      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
+       0,   166,   167,   168,   169,   170,   171,     0,     0,   172,
+     173,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   321,     0,     0,     0,    74,
+      75,    76,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    83,     0,
-      84,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,    14,    15,    16,    17,     0,   172,     0,     0,
-       0,     0,     0,   173,   174,   175,   176,    18,    19,    20,
-      21,    22,    23,    24,    25,    26,    27,    28,    29,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    38,    39,
-      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
-      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    71,     0,   164,   165,   166,   167,   168,   169,     0,
-       0,   170,   171,     0,     0,     0,     0,     0,     0,     0,
+      84,     0,    85,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    74,    75,    76,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   174,
+       0,     0,     0,     0,     0,   175,   176,   177,   178,    12,
+      13,    14,    15,    16,    17,     0,     0,     0,     0,     0,
+     253,     0,     0,     0,     0,     0,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
+      32,     0,    33,    34,    35,    36,    37,    38,    39,    40,
+      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      71,     0,   166,   167,   168,   169,   170,   171,     0,     0,
+     172,   173,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   335,
+      74,    75,    76,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    83,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    83,     0,    84,     0,     0,     0,     0,     0,     0,
+       0,    84,     0,    85,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,    14,    15,    16,    17,     0,
-     172,     0,     0,   229,     0,     0,   173,   174,   175,   176,
+     174,     0,     0,     0,     0,     0,   175,   176,   177,   178,
       18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
       28,    29,     0,     0,     0,     0,     0,     0,     0,     0,
        0,    38,    39,    40,    41,    42,    43,    44,    45,    46,
       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    71,     0,   164,   165,   166,   167,
-     168,   169,     0,     0,   170,   171,     0,     0,     0,     0,
+      67,    68,    69,    70,    71,     0,   166,   167,   168,   169,
+     170,   171,     0,     0,   172,   173,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,    74,    75,    76,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    83,     0,    84,     0,     0,     0,
+       0,     0,     0,     0,     0,    84,     0,    85,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    14,    15,
-      16,    17,     0,   172,     0,     0,   314,     0,     0,   173,
-     174,   175,   176,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,    28,    29,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    38,    39,    40,    41,    42,    43,
-      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
-      64,    65,    66,    67,    68,    69,    70,    71,     0,   164,
-     165,   166,   167,   168,   169,     0,     0,   170,   171,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    14,
+      15,    16,    17,     0,   174,     0,     0,   231,     0,     0,
+     175,   176,   177,   178,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    38,    39,    40,    41,    42,
+      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    71,     0,
+     166,   167,   168,   169,   170,   171,     0,     0,   172,   173,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    74,    75,    76,
+       0,     0,     0,     0,     0,     0,     0,     0,    74,    75,
+      76,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    84,
+       0,    85,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    83,     0,    84,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    14,    15,    16,    17,     0,   174,     0,
+       0,   316,     0,     0,   175,   176,   177,   178,    18,    19,
+      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    38,
+      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    71,     0,   166,   167,   168,   169,   170,   171,
+       0,     0,   172,   173,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,    74,    75,    76,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    14,    15,    16,    17,     0,   172,     0,     0,   367,
-       0,     0,   173,   174,   175,   176,    18,    19,    20,    21,
-      22,    23,    24,    25,    26,    27,    28,    29,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    38,    39,    40,
-      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
-      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
-      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
-      71,     0,   164,   165,   166,   167,   168,   169,     0,     0,
-     170,   171,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-      74,    75,    76,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    84,     0,    85,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    14,    15,    16,
+      17,     0,   174,     0,     0,   369,     0,     0,   175,   176,
+     177,   178,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    38,    39,    40,    41,    42,    43,    44,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
+      65,    66,    67,    68,    69,    70,    71,     0,   166,   167,
+     168,   169,   170,   171,     0,     0,   172,   173,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    74,    75,    76,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-      83,     0,    84,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    14,    15,    16,    17,     0,   172,
-       0,     0,     0,     0,     0,   173,   174,   175,   176,    18,
-      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
-      29,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
-      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
-      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,   269,     0,   164,   165,   166,   167,   168,
-     169,     0,     0,   170,   171,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    84,     0,    85,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    74,    75,    76,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    14,    15,    16,    17,     0,   174,     0,     0,     0,
+       0,     0,   175,   176,   177,   178,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,    29,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    38,    39,    40,
+      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+     271,     0,   166,   167,   168,   169,   170,   171,     0,     0,
+     172,   173,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      74,    75,    76,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    83,     0,    84,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,    12,    13,    14,    15,    16,
-      17,     0,   172,     0,     0,     0,     0,     0,   173,   174,
-     175,   176,    18,    19,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    30,    31,    32,     0,    33,    34,
-      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
-      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
-      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
-      65,    66,    67,    68,    69,    70,    71,     0,    72,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    84,     0,    85,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,    73,    74,    75,    76,     0,
-      77,     0,     0,     0,     0,     0,     0,     0,    78,    79,
-      80,    81,    82,    14,    15,    16,    17,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    18,    19,
-      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
-       0,     0,     0,     0,     0,     0,    83,     0,    84,    38,
-      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
-      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
-      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
-      69,    70,    71,     0,   341,    14,    15,    16,    17,   169,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    12,    13,    14,    15,    16,    17,     0,
+     174,     0,     0,     0,     0,     0,   175,   176,   177,   178,
       18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
-      28,    29,    74,    75,    76,     0,     0,     0,     0,     0,
-       0,    38,    39,    40,    41,    42,    43,    44,    45,    46,
+      28,    29,    30,    31,    32,     0,    33,    34,    35,    36,
+      37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    71,     0,    72,    14,    15,    16,
-      17,     0,    83,     0,    84,     0,     0,     0,     0,     0,
-       0,     0,    18,    19,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    74,    75,    76,     0,     0,     0,
-       0,     0,     0,    38,    39,    40,    41,    42,    43,    44,
-      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
-      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
-      65,    66,    67,    68,    69,    70,    71,     0,    72,     0,
-       0,     0,     0,     0,    83,     0,    84,     0,     0,     0,
+      67,    68,    69,    70,    71,     0,    72,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    73,    74,    75,    76,     0,    77,     0,
+       0,     0,     0,     0,     0,     0,    78,    79,    80,    81,
+      82,    83,    14,    15,    16,    17,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,     0,
+       0,     0,     0,     0,     0,    84,     0,    85,    38,    39,
+      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
+      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
+      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
+      70,    71,     0,   343,    14,    15,    16,    17,   171,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    18,
+      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    74,    75,    76,     0,     0,     0,     0,     0,     0,
+      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
+      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
+      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
+      68,    69,    70,    71,     0,    72,    14,    15,    16,    17,
+       0,     0,    84,     0,    85,     0,     0,     0,     0,     0,
+       0,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+      27,    28,    29,    74,    75,    76,     0,     0,     0,     0,
+       0,     0,    38,    39,    40,    41,    42,    43,    44,    45,
+      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    71,     0,    72,     0,     0,
+       0,     0,     0,     0,    84,     0,    85,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,    83,     0,    84
+       0,     0,     0,     0,     0,     0,    84,     0,    85
 };
 
 static const yytype_int16 yycheck[] =
 {
-       9,    73,    73,   159,   155,   161,   141,   146,   141,     4,
-      76,    76,    86,    87,    91,   195,   172,   256,     9,     3,
-       4,     9,    78,    95,    96,    84,    85,   193,     4,   195,
-     313,   109,   381,   213,   227,   170,   171,   198,    33,    34,
-      35,   198,   114,   392,   198,     3,     4,   213,    32,    33,
-      34,   212,    36,    37,     0,   212,   191,    33,    34,    35,
-     214,   113,   213,    93,    94,    95,    96,    97,    98,    99,
-     100,   101,   102,   110,    32,    33,    34,    86,    36,    37,
-      38,    39,    40,   198,    76,   198,   112,   370,    97,   328,
-     198,   188,   227,   249,   227,    86,   235,   253,    86,   214,
-     256,   214,   385,   112,   103,   388,   214,   194,   264,   113,
-     261,   198,   194,   396,   193,   124,   198,   116,    76,   312,
-     403,    33,    34,   113,   133,    37,   194,   320,   193,   198,
-     198,   228,   206,   207,   211,   144,   195,   146,   197,   194,
-     194,   194,   113,   198,   198,   198,   155,   113,   304,   215,
-     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
-     295,   296,   297,   298,   299,   300,   301,   302,   303,   178,
-     194,   268,   328,   366,   104,   105,   106,   312,    76,   312,
-      33,    34,    35,   213,    76,   320,   283,   320,   292,   293,
-     294,   295,   203,   204,   205,   214,   215,   199,   200,   194,
-      82,    83,    88,    89,   213,   288,   289,   215,   305,   290,
-     291,   296,   297,   195,    76,   224,   313,    76,   374,   113,
-      76,   214,   194,   193,   213,   193,   235,   378,   214,   214,
-     193,   366,   193,   366,   214,   391,   193,   212,    90,   248,
-     209,     3,     4,   208,    92,   193,   210,   256,    76,   196,
-     195,    78,   261,    75,   214,   194,   196,   408,   195,   213,
-     193,   333,   333,   198,    76,   194,   193,    12,   196,   213,
-      32,    33,    34,   370,    36,    37,    38,    39,    40,   196,
-     196,   213,   196,   214,   194,   298,   383,   265,   385,   215,
-     213,   388,   213,   299,   214,   300,   303,   127,   301,   396,
-     224,   302,   134,   244,    77,   224,   403,   144,   392,   321,
-     248,    88,   379,   178,   248,    86,    -1,    -1,   328,   328,
+       9,    73,    73,   157,   143,   161,    76,   163,   143,    91,
+       4,    76,   229,    86,    87,   258,   190,   148,   174,     4,
+       9,    78,     9,   109,    96,    97,    93,    94,    95,    96,
+      97,    98,    99,   100,   101,   102,   196,   172,   173,    33,
+      34,    35,   194,   115,   196,     0,     3,     4,    33,    34,
+      35,   199,   199,   199,   214,   199,   230,   113,   193,   199,
+     110,   215,   214,   383,    84,    85,    76,   215,   215,   215,
+     199,   215,   104,   213,   394,    32,    33,    34,    87,    36,
+      37,    38,    39,    40,   213,   117,   112,   330,   195,    98,
+     229,   113,   199,   194,   229,   251,   270,   314,    87,   255,
+      87,   113,   258,   195,   113,   322,   237,   199,   113,   263,
+     266,   285,    33,    34,   195,   113,    37,   126,   199,    76,
+     315,   195,   104,   105,   106,   199,   135,   195,    76,   194,
+     212,   199,   195,   307,   207,   208,   199,   146,   113,   148,
+     195,   315,    33,    34,    35,   199,   216,   214,   157,   196,
+     306,   368,   287,   288,   289,   290,   291,   292,   293,   294,
+     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
+     305,   180,   215,   216,   330,   314,   196,   372,   198,   314,
+     204,   205,   206,   322,   200,   201,    76,   322,   294,   295,
+     296,   297,   387,    82,    83,   390,    88,    89,   372,   290,
+     291,   195,   216,   398,   292,   293,   215,    76,   298,   299,
+     405,   385,    76,   387,     3,     4,   390,   226,   113,    76,
+     376,   194,   215,   214,   398,   215,   380,   215,   237,   368,
+     194,   405,   215,   368,   194,   213,   194,   393,     3,     4,
+     194,   250,   195,    32,    33,    34,   209,    36,    37,   258,
+     211,   210,    90,    92,   263,   194,   410,    76,   196,   215,
+     197,    78,    75,   335,   335,   195,   197,    32,    33,    34,
+     196,    36,    37,    38,    39,    40,   194,   199,   214,    76,
+     195,   197,   194,   197,   197,   214,   214,   195,   215,    12,
+     214,   216,   197,   267,   214,   301,   215,   300,   302,   129,
+     136,   303,   246,   304,    77,   305,   146,   250,   323,   226,
+     394,    89,   381,   180,    -1,   226,   250,   330,    87,    -1,
+      -1,   330,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   378,
-      -1,    -1,   381,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,   392,    -1,    -1,    -1,    -1,    -1,    -1,
-       3,     4,     5,     6,     7,     8,     9,    10,    11,   408,
-      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
-      33,    34,    -1,    36,    37,    38,    39,    40,    41,    42,
-      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
-      63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
-      73,    74,    75,    76,    77,    78,    79,    80,    81,    -1,
-      -1,    84,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   380,    -1,    -1,   383,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   394,    -1,    -1,    -1,    -1,
+      -1,    -1,     3,     4,     5,     6,     7,     8,     9,    10,
+      11,   410,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,    -1,    36,    37,    38,    39,    40,
+      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      71,    72,    73,    74,    75,    76,    77,    78,    79,    80,
+      81,    -1,    -1,    84,    85,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     103,   104,   105,   106,    -1,   108,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   120,    -1,    -1,
+      -1,    -1,   103,   104,   105,   106,    -1,   108,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     121,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,   154,    -1,   156,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   155,    -1,   157,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     193,    -1,    -1,    -1,    -1,    -1,   199,   200,   201,   202,
+      -1,    -1,    -1,   194,    -1,    -1,    -1,    -1,    -1,   200,
+     201,   202,   203,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   215,   216,   217,     3,     4,     5,
+       6,     7,     8,     9,    10,    11,    -1,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    31,    32,    33,    34,    -1,
+      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
+      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
+      76,    77,    78,    79,    80,    81,    -1,    -1,    84,    85,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,   214,   215,   216,     3,     4,     5,     6,     7,     8,
-       9,    10,    11,    -1,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
-      29,    30,    31,    32,    33,    34,    -1,    36,    37,    38,
-      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
-      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
-      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
-      69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
-      79,    80,    81,    -1,    -1,    84,    85,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,   104,   105,
+     106,    -1,   108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   121,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   103,   104,   105,   106,    -1,   108,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,   120,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,
+      -1,   157,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   154,    -1,   156,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   194,    -1,
+      -1,    -1,    -1,    -1,   200,   201,   202,   203,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   215,
+     216,   217,     3,     4,     5,     6,     7,     8,     9,    10,
+      11,    -1,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,    -1,    36,    37,    38,    39,    40,
+      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      71,    72,    73,    74,    75,    76,    77,    78,    79,    80,
+      81,    -1,    -1,    84,    85,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   103,   104,   105,   106,    -1,   108,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     121,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   193,    -1,    -1,    -1,    -1,    -1,
-     199,   200,   201,   202,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   214,   215,   216,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    -1,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
-      -1,    36,    37,    38,    39,    40,    41,    42,    43,    44,
-      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
-      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
-      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
-      75,    76,    77,    78,    79,    80,    81,    -1,    -1,    84,
-      85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,   104,
-     105,   106,    -1,   108,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   120,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   155,    -1,   157,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   194,    -1,    -1,    -1,    -1,    -1,   200,
+     201,   202,   203,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   215,   216,   217,     3,     4,     5,
+       6,     7,     8,     9,    10,    11,    -1,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    31,    32,    33,    34,    -1,
+      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
+      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
+      76,    77,    78,    79,    80,    81,    -1,    -1,    84,    85,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,   104,   105,
+     106,    -1,   108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   121,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   154,
-      -1,   156,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,
+      -1,   157,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   193,    -1,
-      -1,    -1,    -1,    -1,   199,   200,   201,   202,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   214,
-     215,   216,     3,     4,     5,     6,     7,     8,     9,    10,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   194,    -1,
+      -1,    -1,    -1,    -1,   200,   201,   202,   203,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   215,
+     216,   217,     3,     4,     5,     6,     7,     8,     9,    10,
       11,    -1,    13,    14,    15,    16,    17,    18,    19,    20,
       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
       31,    32,    33,    34,    -1,    36,    37,    38,    39,    40,
@@ -1635,17 +1661,17 @@ static const yytype_int16 yycheck[] =
       81,    -1,    -1,    84,    85,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,   103,   104,   105,   106,    -1,   108,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   120,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     121,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,   154,    -1,   156,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   155,    -1,   157,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,   193,    -1,    -1,    -1,    -1,    -1,   199,   200,
-     201,   202,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,   214,   215,   216,     3,     4,     5,     6,
+      -1,    -1,    -1,   194,    -1,    -1,    -1,    -1,    -1,   200,
+     201,   202,   203,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   215,   216,     3,     4,     5,     6,
        7,     8,     9,    10,    11,    -1,    13,    14,    15,    16,
       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
       27,    28,    29,    30,    31,    32,    33,    34,    -1,    36,
@@ -1657,129 +1683,90 @@ static const yytype_int16 yycheck[] =
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,   103,   104,   105,   106,
       -1,   108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,   120,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   121,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   154,    -1,   156,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,    -1,
+     157,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   193,    -1,    -1,    -1,
-      -1,    -1,   199,   200,   201,   202,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   214,   215,     3,
-       4,     5,     6,     7,     8,     9,    10,    11,    -1,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
-      34,    -1,    36,    37,    38,    39,    40,    41,    42,    43,
-      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
-      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
-      74,    75,    76,    77,    78,    79,    80,    81,    -1,    -1,
-      84,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,
-     104,   105,   106,    -1,   108,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   120,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     154,    -1,   156,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   194,    -1,    -1,
+      -1,    -1,    -1,   200,   201,   202,   203,     3,     4,     5,
+       6,     7,     8,    -1,    -1,    -1,    -1,    -1,   215,   216,
+      -1,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    31,    32,    33,    34,    -1,
+      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
+      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    71,    72,    73,    74,    -1,
+      76,    77,    78,    79,    80,    81,    -1,    -1,    84,    85,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   193,
-      -1,    -1,    -1,    -1,    -1,   199,   200,   201,   202,     3,
-       4,     5,     6,     7,     8,    -1,    -1,    -1,    -1,    -1,
-     214,   215,    -1,    -1,    -1,    -1,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
-      34,    -1,    36,    37,    38,    39,    40,    41,    42,    43,
-      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
-      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
-      74,    -1,    76,    77,    78,    79,    80,    81,    -1,    -1,
-      84,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,
-     104,   105,   106,    -1,   108,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   120,     5,     6,     7,
-       8,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    20,    21,    22,    23,    24,    25,    26,    27,
-      28,    29,    30,    31,    -1,    -1,    -1,    -1,    -1,    -1,
-     154,    -1,   156,    41,    42,    43,    44,    45,    46,    47,
-      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
-      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    71,    72,    73,    74,    -1,    76,   193,
-      -1,    -1,    -1,    -1,    -1,   199,   200,   201,   202,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,   104,   105,
+     106,    -1,   108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   121,     5,     6,     7,     8,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     214,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,    -1,
+      -1,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,    31,    -1,    -1,    -1,    -1,    -1,    -1,   155,
+      -1,   157,    41,    42,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    71,    72,    73,    74,    -1,    76,   194,    -1,
+      -1,    -1,    -1,    -1,   200,   201,   202,   203,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   215,
+      -1,    -1,    -1,    -1,    -1,   104,   105,   106,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,     5,     6,     7,     8,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    20,    21,
       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
-      -1,    -1,    -1,    -1,    -1,    -1,   154,    -1,   156,    41,
+      -1,    -1,    -1,    -1,    -1,    -1,   155,    -1,   157,    41,
       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
       62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
       72,    73,    74,    -1,    76,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   216,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   217,    -1,
       -1,    -1,   104,   105,   106,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,
-       6,     7,     8,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    30,    31,    -1,    -1,    -1,    -1,
-      -1,    -1,   154,    -1,   156,    41,    42,    43,    44,    45,
-      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
-      66,    67,    68,    69,    70,    71,    72,    73,    74,    -1,
-      76,    77,    78,    79,    80,    81,    -1,    -1,    84,    85,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   216,    -1,    -1,    -1,   104,   105,
-     106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       5,     6,     7,     8,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    20,    21,    22,    23,    24,
+      25,    26,    27,    28,    29,    30,    31,    -1,    -1,    -1,
+      -1,    -1,    -1,   155,    -1,   157,    41,    42,    43,    44,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
+      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
+      -1,    76,    77,    78,    79,    80,    81,    -1,    -1,    84,
+      85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   217,    -1,    -1,    -1,   104,
+     105,   106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   154,    -1,
-     156,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     155,    -1,   157,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   193,    -1,    -1,
-      -1,    -1,    -1,   199,   200,   201,   202,     3,     4,     5,
-       6,     7,     8,    -1,    -1,    -1,    -1,    -1,   214,    -1,
-      -1,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
-      26,    27,    28,    29,    30,    31,    32,    33,    34,    -1,
-      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
-      66,    67,    68,    69,    70,    71,    72,    73,    74,    -1,
-      76,    77,    78,    79,    80,    81,    -1,    -1,    84,    85,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,   104,   105,
-     106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   120,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   154,    -1,
-     156,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,     5,     6,     7,     8,    -1,   193,    -1,    -1,
-      -1,    -1,    -1,   199,   200,   201,   202,    20,    21,    22,
-      23,    24,    25,    26,    27,    28,    29,    30,    31,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    41,    42,
-      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
-      63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
-      73,    74,    -1,    76,    77,    78,    79,    80,    81,    -1,
-      -1,    84,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,   104,   105,   106,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   194,
+      -1,    -1,    -1,    -1,    -1,   200,   201,   202,   203,     3,
+       4,     5,     6,     7,     8,    -1,    -1,    -1,    -1,    -1,
+     215,    -1,    -1,    -1,    -1,    -1,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    -1,    36,    37,    38,    39,    40,    41,    42,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
+      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
+      74,    -1,    76,    77,    78,    79,    80,    81,    -1,    -1,
+      84,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,
+     104,   105,   106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   121,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,   154,    -1,   156,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   155,    -1,   157,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,     5,     6,     7,     8,    -1,
-     193,    -1,    -1,   196,    -1,    -1,   199,   200,   201,   202,
+     194,    -1,    -1,    -1,    -1,    -1,   200,   201,   202,   203,
       20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
       30,    31,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    41,    42,    43,    44,    45,    46,    47,    48,    49,
@@ -1793,154 +1780,173 @@ static const yytype_int16 yycheck[] =
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   154,    -1,   156,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   155,    -1,   157,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,     6,
-       7,     8,    -1,   193,    -1,    -1,   196,    -1,    -1,   199,
-     200,   201,   202,    20,    21,    22,    23,    24,    25,    26,
-      27,    28,    29,    30,    31,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    41,    42,    43,    44,    45,    46,
-      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
-      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    71,    72,    73,    74,    -1,    76,
-      77,    78,    79,    80,    81,    -1,    -1,    84,    85,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,
+       6,     7,     8,    -1,   194,    -1,    -1,   197,    -1,    -1,
+     200,   201,   202,   203,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    31,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    41,    42,    43,    44,    45,
+      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    71,    72,    73,    74,    -1,
+      76,    77,    78,    79,    80,    81,    -1,    -1,    84,    85,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,   105,
+     106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,
+      -1,   157,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   154,    -1,   156,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,     5,     6,     7,     8,    -1,   194,    -1,
+      -1,   197,    -1,    -1,   200,   201,   202,   203,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    41,
+      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
+      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
+      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
+      72,    73,    74,    -1,    76,    77,    78,    79,    80,    81,
+      -1,    -1,    84,    85,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   104,   105,   106,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,     5,     6,     7,     8,    -1,   193,    -1,    -1,   196,
-      -1,    -1,   199,   200,   201,   202,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,    29,    30,    31,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    41,    42,    43,
-      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
-      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
-      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
-      74,    -1,    76,    77,    78,    79,    80,    81,    -1,    -1,
-      84,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     104,   105,   106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   155,    -1,   157,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     154,    -1,   156,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,     6,     7,
+       8,    -1,   194,    -1,    -1,   197,    -1,    -1,   200,   201,
+     202,   203,    20,    21,    22,    23,    24,    25,    26,    27,
+      28,    29,    30,    31,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    41,    42,    43,    44,    45,    46,    47,
+      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
+      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
+      68,    69,    70,    71,    72,    73,    74,    -1,    76,    77,
+      78,    79,    80,    81,    -1,    -1,    84,    85,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   104,   105,   106,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,     5,     6,     7,     8,    -1,   193,
-      -1,    -1,    -1,    -1,    -1,   199,   200,   201,   202,    20,
-      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
-      31,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
-      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
-      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
-      71,    72,    73,    74,    -1,    76,    77,    78,    79,    80,
-      81,    -1,    -1,    84,    85,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,   104,   105,   106,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,    -1,   157,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,     5,     6,     7,     8,    -1,   194,    -1,    -1,    -1,
+      -1,    -1,   200,   201,   202,   203,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    31,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    41,    42,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
+      64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
+      74,    -1,    76,    77,    78,    79,    80,    81,    -1,    -1,
+      84,    85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     104,   105,   106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,   154,    -1,   156,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,     3,     4,     5,     6,     7,
-       8,    -1,   193,    -1,    -1,    -1,    -1,    -1,   199,   200,
-     201,   202,    20,    21,    22,    23,    24,    25,    26,    27,
-      28,    29,    30,    31,    32,    33,    34,    -1,    36,    37,
-      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
-      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
-      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    71,    72,    73,    74,    -1,    76,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   155,    -1,   157,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   103,   104,   105,   106,    -1,
-     108,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   116,   117,
-     118,   119,   120,     5,     6,     7,     8,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    20,    21,
-      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
-      -1,    -1,    -1,    -1,    -1,    -1,   154,    -1,   156,    41,
-      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
-      62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
-      72,    73,    74,    -1,    76,     5,     6,     7,     8,    81,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,     3,     4,     5,     6,     7,     8,    -1,
+     194,    -1,    -1,    -1,    -1,    -1,   200,   201,   202,   203,
       20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
-      30,    31,   104,   105,   106,    -1,    -1,    -1,    -1,    -1,
-      -1,    41,    42,    43,    44,    45,    46,    47,    48,    49,
+      30,    31,    32,    33,    34,    -1,    36,    37,    38,    39,
+      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
       50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
       60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    71,    72,    73,    74,    -1,    76,     5,     6,     7,
-       8,    -1,   154,    -1,   156,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    20,    21,    22,    23,    24,    25,    26,    27,
-      28,    29,    30,    31,   104,   105,   106,    -1,    -1,    -1,
-      -1,    -1,    -1,    41,    42,    43,    44,    45,    46,    47,
-      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
-      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    71,    72,    73,    74,    -1,    76,    -1,
-      -1,    -1,    -1,    -1,   154,    -1,   156,    -1,    -1,    -1,
+      70,    71,    72,    73,    74,    -1,    76,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   103,   104,   105,   106,    -1,   108,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   116,   117,   118,   119,
+     120,   121,     5,     6,     7,     8,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,    29,    30,    31,    -1,
+      -1,    -1,    -1,    -1,    -1,   155,    -1,   157,    41,    42,
+      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
+      63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
+      73,    74,    -1,    76,     5,     6,     7,     8,    81,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,   104,   105,   106,    -1,    -1,    -1,    -1,    -1,    -1,
+      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      71,    72,    73,    74,    -1,    76,     5,     6,     7,     8,
+      -1,    -1,   155,    -1,   157,    -1,    -1,    -1,    -1,    -1,
+      -1,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,    31,   104,   105,   106,    -1,    -1,    -1,    -1,
+      -1,    -1,    41,    42,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    71,    72,    73,    74,    -1,    76,    -1,    -1,
+      -1,    -1,    -1,    -1,   155,    -1,   157,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   154,    -1,   156
+      -1,    -1,    -1,    -1,    -1,    -1,   155,    -1,   157
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint16 yystos[] =
 {
-       0,   109,   218,   220,    78,     0,   222,   113,   110,   219,
-     223,    76,     3,     4,     5,     6,     7,     8,    20,    21,
+       0,   109,   219,   221,    78,     0,   223,   113,   110,   220,
+     224,    76,     3,     4,     5,     6,     7,     8,    20,    21,
       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
       32,    33,    34,    36,    37,    38,    39,    40,    41,    42,
       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
       53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
       63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
       73,    74,    76,   103,   104,   105,   106,   108,   116,   117,
-     118,   119,   120,   154,   156,   221,   224,   254,   255,   256,
-     257,   258,   263,   264,   265,   266,   269,   271,   272,   273,
-     274,   275,   276,   277,   278,   302,   303,   112,    33,    34,
-      37,    76,   215,    76,   269,   272,   277,   113,   113,   113,
-     113,   193,   302,   214,   215,   289,   194,   198,     4,    33,
-      34,    35,   260,   261,   270,   198,   214,    76,   272,   272,
-     273,   195,   274,    76,   215,   273,   279,   280,   272,   274,
-      76,   267,   268,     9,    10,    11,    13,    14,    15,    16,
-      17,    18,    19,    75,    76,    77,    78,    79,    80,    81,
-      84,    85,   193,   199,   200,   201,   202,   214,   215,   216,
-     225,   226,   227,   229,   230,   231,   232,   233,   234,   235,
-     236,   237,   238,   239,   240,   241,   242,   243,   244,   245,
-     246,   247,   248,   249,   250,   252,   254,   255,   273,   284,
-     285,   286,   287,   290,   291,   292,   295,   296,   297,   301,
-     260,   259,   262,   273,   261,    76,   193,   195,   213,   196,
-     236,   249,   253,   273,   113,   279,    76,   281,   282,   216,
-     280,   214,   213,   194,   198,   214,   214,   285,   193,   193,
-     214,   214,   252,   193,   252,   212,   193,   236,   236,   252,
-     216,   290,    84,    85,   195,   197,   194,   194,   198,    74,
-     250,   193,    93,    94,    95,    96,    97,    98,    99,   100,
-     101,   102,   213,   251,   236,   203,   204,   205,   199,   200,
-      82,    83,    86,    87,   206,   207,    88,    89,   208,   209,
-     210,    90,    92,    91,   211,   198,   214,   216,   285,    76,
-     259,   262,   195,   213,   196,   253,   250,   283,   196,   216,
-     195,   198,   214,    78,   268,    75,   284,   291,   298,   252,
-     214,   252,   212,   103,   252,   265,   294,   194,   216,   228,
-     252,    76,   231,   250,   250,   236,   236,   236,   238,   238,
-     239,   239,   240,   240,   240,   240,   241,   241,   242,   243,
-     244,   245,   246,   247,   252,   250,   195,   196,   253,   283,
-     213,   196,   253,   282,   193,   294,   299,   300,   194,   194,
-      76,   194,   196,   212,   253,   213,   196,   283,   213,   196,
-     252,   214,   194,   285,   293,   287,   213,   286,   288,   289,
-     250,   196,   283,   213,   283,   194,   252,   288,    12,   283,
-     283,   214,   285
+     118,   119,   120,   121,   155,   157,   222,   225,   255,   256,
+     257,   258,   259,   264,   265,   266,   267,   270,   272,   273,
+     274,   275,   276,   277,   278,   279,   303,   304,   112,    33,
+      34,    37,    76,   216,    76,   270,   273,   278,   113,   113,
+     113,   113,   113,   194,   303,   215,   216,   290,   195,   199,
+       4,    33,    34,    35,   261,   262,   271,   199,   215,    76,
+     273,   273,   274,   196,   275,    76,   216,   274,   280,   281,
+     273,   275,    76,   268,   269,     9,    10,    11,    13,    14,
+      15,    16,    17,    18,    19,    75,    76,    77,    78,    79,
+      80,    81,    84,    85,   194,   200,   201,   202,   203,   215,
+     216,   217,   226,   227,   228,   230,   231,   232,   233,   234,
+     235,   236,   237,   238,   239,   240,   241,   242,   243,   244,
+     245,   246,   247,   248,   249,   250,   251,   253,   255,   256,
+     274,   285,   286,   287,   288,   291,   292,   293,   296,   297,
+     298,   302,   261,   260,   263,   274,   262,    76,   194,   196,
+     214,   197,   237,   250,   254,   274,   113,   280,    76,   282,
+     283,   217,   281,   215,   214,   195,   199,   215,   215,   286,
+     194,   194,   215,   215,   253,   194,   253,   213,   194,   237,
+     237,   253,   217,   291,    84,    85,   196,   198,   195,   195,
+     199,    74,   251,   194,    93,    94,    95,    96,    97,    98,
+      99,   100,   101,   102,   214,   252,   237,   204,   205,   206,
+     200,   201,    82,    83,    86,    87,   207,   208,    88,    89,
+     209,   210,   211,    90,    92,    91,   212,   199,   215,   217,
+     286,    76,   260,   263,   196,   214,   197,   254,   251,   284,
+     197,   217,   196,   199,   215,    78,   269,    75,   285,   292,
+     299,   253,   215,   253,   213,   103,   253,   266,   295,   195,
+     217,   229,   253,    76,   232,   251,   251,   237,   237,   237,
+     239,   239,   240,   240,   241,   241,   241,   241,   242,   242,
+     243,   244,   245,   246,   247,   248,   253,   251,   196,   197,
+     254,   284,   214,   197,   254,   283,   194,   295,   300,   301,
+     195,   195,    76,   195,   197,   213,   254,   214,   197,   284,
+     214,   197,   253,   215,   195,   286,   294,   288,   214,   287,
+     289,   290,   251,   197,   284,   214,   284,   195,   253,   289,
+      12,   284,   284,   215,   286
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -1955,18 +1961,9 @@ static const yytype_uint16 yystos[] =
 
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
+   Once GCC version 2 has supplanted version 1, this can go.  */
 
 #define YYFAIL         goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
@@ -2023,7 +2020,7 @@ while (YYID (0))
    we won't break user code: when these are the locations we know.  */
 
 #ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+# if YYLTYPE_IS_TRIVIAL
 #  define YY_LOCATION_PRINT(File, Loc)                 \
      fprintf (File, "%d.%d-%d.%d",                     \
              (Loc).first_line, (Loc).first_column,     \
@@ -2565,7 +2562,7 @@ YYLTYPE yylloc;
     YYLTYPE *yylsp;
 
     /* The locations where the error started and ended.  */
-    YYLTYPE yyerror_range[3];
+    YYLTYPE yyerror_range[2];
 
     YYSIZE_T yystacksize;
 
@@ -2612,7 +2609,7 @@ YYLTYPE yylloc;
   yyvsp = yyvs;
   yylsp = yyls;
 
-#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+#if YYLTYPE_IS_TRIVIAL
   /* Initialize the default location before parsing starts.  */
   yylloc.first_line   = yylloc.last_line   = 1;
   yylloc.first_column = yylloc.last_column = 1;
@@ -2620,7 +2617,7 @@ YYLTYPE yylloc;
 
 /* User initialization code.  */
 
-/* Line 1251 of yacc.c  */
+/* Line 1242 of yacc.c  */
 #line 41 "glsl_parser.ypp"
 {
    yylloc.first_line = 1;
@@ -2630,8 +2627,8 @@ YYLTYPE yylloc;
    yylloc.source = 0;
 }
 
-/* Line 1251 of yacc.c  */
-#line 2635 "glsl_parser.cpp"
+/* Line 1242 of yacc.c  */
+#line 2632 "glsl_parser.cpp"
   yylsp[0] = yylloc;
 
   goto yysetstate;
@@ -2818,8 +2815,8 @@ yyreduce:
     {
         case 2:
 
-/* Line 1464 of yacc.c  */
-#line 212 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 213 "glsl_parser.ypp"
     {
           _mesa_glsl_initialize_types(state);
        ;}
@@ -2827,8 +2824,8 @@ yyreduce:
 
   case 5:
 
-/* Line 1464 of yacc.c  */
-#line 221 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 222 "glsl_parser.ypp"
     {
           switch ((yyvsp[(2) - (3)].n)) {
           case 100:
@@ -2838,6 +2835,11 @@ yyreduce:
           case 130:
              /* FINISHME: Check against implementation support versions. */
              state->language_version = (yyvsp[(2) - (3)].n);
+             state->version_string =
+                talloc_asprintf(state, "GLSL%s %d.%02d",
+                                state->es_shader ? " ES" : "",
+                                state->language_version / 100,
+                                state->language_version % 100);
              break;
           default:
              _mesa_glsl_error(& (yylsp[(2) - (3)]), state, "Shading language version"
@@ -2847,10 +2849,25 @@ yyreduce:
        ;}
     break;
 
-  case 12:
+  case 10:
+
+/* Line 1455 of yacc.c  */
+#line 251 "glsl_parser.ypp"
+    {
+          if (state->language_version < 120) {
+             _mesa_glsl_warning(& (yylsp[(1) - (2)]), state,
+                                "pragma `invariant(all)' not supported in %s",
+                                state->version_string);
+          } else {
+             state->all_invariant = true;
+          }
+       ;}
+    break;
+
+  case 13:
 
-/* Line 1464 of yacc.c  */
-#line 253 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 269 "glsl_parser.ypp"
     {
           if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) {
              YYERROR;
@@ -2858,10 +2875,10 @@ yyreduce:
        ;}
     break;
 
-  case 13:
+  case 14:
 
-/* Line 1464 of yacc.c  */
-#line 262 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 278 "glsl_parser.ypp"
     {
           /* FINISHME: The NULL test is only required because 'precision'
            * FINISHME: statements are not yet supported.
@@ -2871,10 +2888,10 @@ yyreduce:
        ;}
     break;
 
-  case 14:
+  case 15:
 
-/* Line 1464 of yacc.c  */
-#line 270 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 286 "glsl_parser.ypp"
     {
           /* FINISHME: The NULL test is only required because 'precision'
            * FINISHME: statements are not yet supported.
@@ -2884,10 +2901,10 @@ yyreduce:
        ;}
     break;
 
-  case 16:
+  case 17:
 
-/* Line 1464 of yacc.c  */
-#line 285 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 301 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL);
@@ -2896,10 +2913,10 @@ yyreduce:
        ;}
     break;
 
-  case 17:
+  case 18:
 
-/* Line 1464 of yacc.c  */
-#line 292 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 308 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL);
@@ -2908,10 +2925,10 @@ yyreduce:
        ;}
     break;
 
-  case 18:
+  case 19:
 
-/* Line 1464 of yacc.c  */
-#line 299 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 315 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL);
@@ -2920,10 +2937,10 @@ yyreduce:
        ;}
     break;
 
-  case 19:
+  case 20:
 
-/* Line 1464 of yacc.c  */
-#line 306 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 322 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL);
@@ -2932,10 +2949,10 @@ yyreduce:
        ;}
     break;
 
-  case 20:
+  case 21:
 
-/* Line 1464 of yacc.c  */
-#line 313 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 329 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL);
@@ -2944,19 +2961,19 @@ yyreduce:
        ;}
     break;
 
-  case 21:
+  case 22:
 
-/* Line 1464 of yacc.c  */
-#line 320 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 336 "glsl_parser.ypp"
     {
           (yyval.expression) = (yyvsp[(2) - (3)].expression);
        ;}
     break;
 
-  case 23:
+  case 24:
 
-/* Line 1464 of yacc.c  */
-#line 328 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 344 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL);
@@ -2964,19 +2981,19 @@ yyreduce:
        ;}
     break;
 
-  case 24:
+  case 25:
 
-/* Line 1464 of yacc.c  */
-#line 334 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 350 "glsl_parser.ypp"
     {
           (yyval.expression) = (yyvsp[(1) - (1)].expression);
        ;}
     break;
 
-  case 25:
+  case 26:
 
-/* Line 1464 of yacc.c  */
-#line 338 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 354 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL);
@@ -2985,10 +3002,10 @@ yyreduce:
        ;}
     break;
 
-  case 26:
+  case 27:
 
-/* Line 1464 of yacc.c  */
-#line 345 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 361 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL);
@@ -2996,10 +3013,10 @@ yyreduce:
        ;}
     break;
 
-  case 27:
+  case 28:
 
-/* Line 1464 of yacc.c  */
-#line 351 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 367 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL);
@@ -3007,10 +3024,10 @@ yyreduce:
        ;}
     break;
 
-  case 31:
+  case 32:
 
-/* Line 1464 of yacc.c  */
-#line 369 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 385 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL);
@@ -3018,10 +3035,10 @@ yyreduce:
        ;}
     break;
 
-  case 36:
+  case 37:
 
-/* Line 1464 of yacc.c  */
-#line 388 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 404 "glsl_parser.ypp"
     {
           (yyval.expression) = (yyvsp[(1) - (2)].expression);
           (yyval.expression)->set_location(yylloc);
@@ -3029,10 +3046,10 @@ yyreduce:
        ;}
     break;
 
-  case 37:
+  case 38:
 
-/* Line 1464 of yacc.c  */
-#line 394 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 410 "glsl_parser.ypp"
     {
           (yyval.expression) = (yyvsp[(1) - (3)].expression);
           (yyval.expression)->set_location(yylloc);
@@ -3040,10 +3057,10 @@ yyreduce:
        ;}
     break;
 
-  case 39:
+  case 40:
 
-/* Line 1464 of yacc.c  */
-#line 410 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 426 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier));
@@ -3051,10 +3068,10 @@ yyreduce:
        ;}
     break;
 
-  case 40:
+  case 41:
 
-/* Line 1464 of yacc.c  */
-#line 416 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 432 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier));
@@ -3063,10 +3080,10 @@ yyreduce:
        ;}
     break;
 
-  case 41:
+  case 42:
 
-/* Line 1464 of yacc.c  */
-#line 423 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 439 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier));
@@ -3075,10 +3092,10 @@ yyreduce:
        ;}
     break;
 
-  case 43:
+  case 44:
 
-/* Line 1464 of yacc.c  */
-#line 435 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 451 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL);
@@ -3086,10 +3103,10 @@ yyreduce:
        ;}
     break;
 
-  case 44:
+  case 45:
 
-/* Line 1464 of yacc.c  */
-#line 441 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 457 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL);
@@ -3097,10 +3114,10 @@ yyreduce:
        ;}
     break;
 
-  case 45:
+  case 46:
 
-/* Line 1464 of yacc.c  */
-#line 447 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 463 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL);
@@ -3108,38 +3125,38 @@ yyreduce:
        ;}
     break;
 
-  case 46:
+  case 47:
 
-/* Line 1464 of yacc.c  */
-#line 456 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 472 "glsl_parser.ypp"
     { (yyval.n) = ast_plus; ;}
     break;
 
-  case 47:
+  case 48:
 
-/* Line 1464 of yacc.c  */
-#line 457 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 473 "glsl_parser.ypp"
     { (yyval.n) = ast_neg; ;}
     break;
 
-  case 48:
+  case 49:
 
-/* Line 1464 of yacc.c  */
-#line 458 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 474 "glsl_parser.ypp"
     { (yyval.n) = ast_logic_not; ;}
     break;
 
-  case 49:
+  case 50:
 
-/* Line 1464 of yacc.c  */
-#line 459 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 475 "glsl_parser.ypp"
     { (yyval.n) = ast_bit_not; ;}
     break;
 
-  case 51:
+  case 52:
 
-/* Line 1464 of yacc.c  */
-#line 465 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 481 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3147,10 +3164,10 @@ yyreduce:
        ;}
     break;
 
-  case 52:
+  case 53:
 
-/* Line 1464 of yacc.c  */
-#line 471 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 487 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3158,10 +3175,10 @@ yyreduce:
        ;}
     break;
 
-  case 53:
+  case 54:
 
-/* Line 1464 of yacc.c  */
-#line 477 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 493 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3169,10 +3186,10 @@ yyreduce:
        ;}
     break;
 
-  case 55:
+  case 56:
 
-/* Line 1464 of yacc.c  */
-#line 487 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 503 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3180,10 +3197,10 @@ yyreduce:
        ;}
     break;
 
-  case 56:
+  case 57:
 
-/* Line 1464 of yacc.c  */
-#line 493 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 509 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3191,10 +3208,10 @@ yyreduce:
        ;}
     break;
 
-  case 58:
+  case 59:
 
-/* Line 1464 of yacc.c  */
-#line 503 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 519 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3202,10 +3219,10 @@ yyreduce:
        ;}
     break;
 
-  case 59:
+  case 60:
 
-/* Line 1464 of yacc.c  */
-#line 509 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 525 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3213,10 +3230,10 @@ yyreduce:
        ;}
     break;
 
-  case 61:
+  case 62:
 
-/* Line 1464 of yacc.c  */
-#line 519 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 535 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3224,10 +3241,10 @@ yyreduce:
        ;}
     break;
 
-  case 62:
+  case 63:
 
-/* Line 1464 of yacc.c  */
-#line 525 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 541 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3235,10 +3252,10 @@ yyreduce:
        ;}
     break;
 
-  case 63:
+  case 64:
 
-/* Line 1464 of yacc.c  */
-#line 531 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 547 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3246,10 +3263,10 @@ yyreduce:
        ;}
     break;
 
-  case 64:
+  case 65:
 
-/* Line 1464 of yacc.c  */
-#line 537 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 553 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3257,10 +3274,10 @@ yyreduce:
        ;}
     break;
 
-  case 66:
+  case 67:
 
-/* Line 1464 of yacc.c  */
-#line 547 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 563 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3268,10 +3285,10 @@ yyreduce:
        ;}
     break;
 
-  case 67:
+  case 68:
 
-/* Line 1464 of yacc.c  */
-#line 553 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 569 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3279,10 +3296,10 @@ yyreduce:
        ;}
     break;
 
-  case 69:
+  case 70:
 
-/* Line 1464 of yacc.c  */
-#line 563 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 579 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3290,10 +3307,10 @@ yyreduce:
        ;}
     break;
 
-  case 71:
+  case 72:
 
-/* Line 1464 of yacc.c  */
-#line 573 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 589 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3301,10 +3318,10 @@ yyreduce:
        ;}
     break;
 
-  case 73:
+  case 74:
 
-/* Line 1464 of yacc.c  */
-#line 583 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 599 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3312,10 +3329,10 @@ yyreduce:
        ;}
     break;
 
-  case 75:
+  case 76:
 
-/* Line 1464 of yacc.c  */
-#line 593 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 609 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3323,10 +3340,10 @@ yyreduce:
        ;}
     break;
 
-  case 77:
+  case 78:
 
-/* Line 1464 of yacc.c  */
-#line 603 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 619 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3334,10 +3351,10 @@ yyreduce:
        ;}
     break;
 
-  case 79:
+  case 80:
 
-/* Line 1464 of yacc.c  */
-#line 613 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 629 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
@@ -3345,10 +3362,10 @@ yyreduce:
        ;}
     break;
 
-  case 81:
+  case 82:
 
-/* Line 1464 of yacc.c  */
-#line 623 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 639 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression));
@@ -3356,10 +3373,10 @@ yyreduce:
        ;}
     break;
 
-  case 83:
+  case 84:
 
-/* Line 1464 of yacc.c  */
-#line 633 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 649 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL);
@@ -3367,96 +3384,96 @@ yyreduce:
        ;}
     break;
 
-  case 84:
+  case 85:
 
-/* Line 1464 of yacc.c  */
-#line 641 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 657 "glsl_parser.ypp"
     { (yyval.n) = ast_assign; ;}
     break;
 
-  case 85:
+  case 86:
 
-/* Line 1464 of yacc.c  */
-#line 642 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 658 "glsl_parser.ypp"
     { (yyval.n) = ast_mul_assign; ;}
     break;
 
-  case 86:
+  case 87:
 
-/* Line 1464 of yacc.c  */
-#line 643 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 659 "glsl_parser.ypp"
     { (yyval.n) = ast_div_assign; ;}
     break;
 
-  case 87:
+  case 88:
 
-/* Line 1464 of yacc.c  */
-#line 644 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 660 "glsl_parser.ypp"
     { (yyval.n) = ast_mod_assign; ;}
     break;
 
-  case 88:
+  case 89:
 
-/* Line 1464 of yacc.c  */
-#line 645 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 661 "glsl_parser.ypp"
     { (yyval.n) = ast_add_assign; ;}
     break;
 
-  case 89:
+  case 90:
 
-/* Line 1464 of yacc.c  */
-#line 646 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 662 "glsl_parser.ypp"
     { (yyval.n) = ast_sub_assign; ;}
     break;
 
-  case 90:
+  case 91:
 
-/* Line 1464 of yacc.c  */
-#line 647 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 663 "glsl_parser.ypp"
     { (yyval.n) = ast_ls_assign; ;}
     break;
 
-  case 91:
+  case 92:
 
-/* Line 1464 of yacc.c  */
-#line 648 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 664 "glsl_parser.ypp"
     { (yyval.n) = ast_rs_assign; ;}
     break;
 
-  case 92:
+  case 93:
 
-/* Line 1464 of yacc.c  */
-#line 649 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 665 "glsl_parser.ypp"
     { (yyval.n) = ast_and_assign; ;}
     break;
 
-  case 93:
+  case 94:
 
-/* Line 1464 of yacc.c  */
-#line 650 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 666 "glsl_parser.ypp"
     { (yyval.n) = ast_xor_assign; ;}
     break;
 
-  case 94:
+  case 95:
 
-/* Line 1464 of yacc.c  */
-#line 651 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 667 "glsl_parser.ypp"
     { (yyval.n) = ast_or_assign; ;}
     break;
 
-  case 95:
+  case 96:
 
-/* Line 1464 of yacc.c  */
-#line 656 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 672 "glsl_parser.ypp"
     {
           (yyval.expression) = (yyvsp[(1) - (1)].expression);
        ;}
     break;
 
-  case 96:
+  case 97:
 
-/* Line 1464 of yacc.c  */
-#line 660 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 676 "glsl_parser.ypp"
     {
           void *ctx = state;
           if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) {
@@ -3471,28 +3488,28 @@ yyreduce:
        ;}
     break;
 
-  case 98:
+  case 99:
 
-/* Line 1464 of yacc.c  */
-#line 680 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 696 "glsl_parser.ypp"
     {
           (yyval.node) = (yyvsp[(1) - (2)].function);
        ;}
     break;
 
-  case 99:
+  case 100:
 
-/* Line 1464 of yacc.c  */
-#line 684 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 700 "glsl_parser.ypp"
     {
           (yyval.node) = (yyvsp[(1) - (2)].declarator_list);
        ;}
     break;
 
-  case 100:
+  case 101:
 
-/* Line 1464 of yacc.c  */
-#line 688 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 704 "glsl_parser.ypp"
     {
           if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float)
               && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) {
@@ -3505,30 +3522,30 @@ yyreduce:
        ;}
     break;
 
-  case 104:
+  case 105:
 
-/* Line 1464 of yacc.c  */
-#line 711 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 727 "glsl_parser.ypp"
     {
           (yyval.function) = (yyvsp[(1) - (2)].function);
           (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link);
        ;}
     break;
 
-  case 105:
+  case 106:
 
-/* Line 1464 of yacc.c  */
-#line 716 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 732 "glsl_parser.ypp"
     {
           (yyval.function) = (yyvsp[(1) - (3)].function);
           (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link);
        ;}
     break;
 
-  case 106:
+  case 107:
 
-/* Line 1464 of yacc.c  */
-#line 724 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 740 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.function) = new(ctx) ast_function();
@@ -3538,10 +3555,10 @@ yyreduce:
        ;}
     break;
 
-  case 107:
+  case 108:
 
-/* Line 1464 of yacc.c  */
-#line 735 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 751 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
@@ -3553,10 +3570,10 @@ yyreduce:
        ;}
     break;
 
-  case 108:
+  case 109:
 
-/* Line 1464 of yacc.c  */
-#line 745 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 761 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
@@ -3570,10 +3587,10 @@ yyreduce:
        ;}
     break;
 
-  case 109:
+  case 110:
 
-/* Line 1464 of yacc.c  */
-#line 760 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 776 "glsl_parser.ypp"
     {
           (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i;
 
@@ -3582,20 +3599,20 @@ yyreduce:
        ;}
     break;
 
-  case 110:
+  case 111:
 
-/* Line 1464 of yacc.c  */
-#line 767 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 783 "glsl_parser.ypp"
     {
           (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator);
           (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier);
        ;}
     break;
 
-  case 111:
+  case 112:
 
-/* Line 1464 of yacc.c  */
-#line 772 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 788 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i;
@@ -3608,10 +3625,10 @@ yyreduce:
        ;}
     break;
 
-  case 112:
+  case 113:
 
-/* Line 1464 of yacc.c  */
-#line 783 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 799 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
@@ -3622,39 +3639,39 @@ yyreduce:
        ;}
     break;
 
-  case 113:
+  case 114:
 
-/* Line 1464 of yacc.c  */
-#line 795 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 811 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
        ;}
     break;
 
-  case 114:
+  case 115:
 
-/* Line 1464 of yacc.c  */
-#line 799 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 815 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.in = 1;
        ;}
     break;
 
-  case 115:
+  case 116:
 
-/* Line 1464 of yacc.c  */
-#line 804 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 820 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.out = 1;
        ;}
     break;
 
-  case 116:
+  case 117:
 
-/* Line 1464 of yacc.c  */
-#line 809 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 825 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.in = 1;
@@ -3662,10 +3679,10 @@ yyreduce:
        ;}
     break;
 
-  case 119:
+  case 120:
 
-/* Line 1464 of yacc.c  */
-#line 823 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 839 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL);
@@ -3676,10 +3693,10 @@ yyreduce:
        ;}
     break;
 
-  case 120:
+  case 121:
 
-/* Line 1464 of yacc.c  */
-#line 832 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 848 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL);
@@ -3690,10 +3707,10 @@ yyreduce:
        ;}
     break;
 
-  case 121:
+  case 122:
 
-/* Line 1464 of yacc.c  */
-#line 841 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 857 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL);
@@ -3704,10 +3721,10 @@ yyreduce:
        ;}
     break;
 
-  case 122:
+  case 123:
 
-/* Line 1464 of yacc.c  */
-#line 850 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 866 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression));
@@ -3718,10 +3735,10 @@ yyreduce:
        ;}
     break;
 
-  case 123:
+  case 124:
 
-/* Line 1464 of yacc.c  */
-#line 859 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 875 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression));
@@ -3732,10 +3749,10 @@ yyreduce:
        ;}
     break;
 
-  case 124:
+  case 125:
 
-/* Line 1464 of yacc.c  */
-#line 868 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 884 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression));
@@ -3746,10 +3763,10 @@ yyreduce:
        ;}
     break;
 
-  case 125:
+  case 126:
 
-/* Line 1464 of yacc.c  */
-#line 881 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 897 "glsl_parser.ypp"
     {
           void *ctx = state;
           if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) {
@@ -3762,10 +3779,10 @@ yyreduce:
        ;}
     break;
 
-  case 126:
+  case 127:
 
-/* Line 1464 of yacc.c  */
-#line 892 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 908 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL);
@@ -3776,10 +3793,10 @@ yyreduce:
        ;}
     break;
 
-  case 127:
+  case 128:
 
-/* Line 1464 of yacc.c  */
-#line 901 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 917 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL);
@@ -3790,10 +3807,10 @@ yyreduce:
        ;}
     break;
 
-  case 128:
+  case 129:
 
-/* Line 1464 of yacc.c  */
-#line 910 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 926 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL);
@@ -3804,10 +3821,10 @@ yyreduce:
        ;}
     break;
 
-  case 129:
+  case 130:
 
-/* Line 1464 of yacc.c  */
-#line 919 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 935 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression));
@@ -3818,10 +3835,10 @@ yyreduce:
        ;}
     break;
 
-  case 130:
+  case 131:
 
-/* Line 1464 of yacc.c  */
-#line 928 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 944 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression));
@@ -3832,10 +3849,10 @@ yyreduce:
        ;}
     break;
 
-  case 131:
+  case 132:
 
-/* Line 1464 of yacc.c  */
-#line 937 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 953 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression));
@@ -3846,10 +3863,10 @@ yyreduce:
        ;}
     break;
 
-  case 132:
+  case 133:
 
-/* Line 1464 of yacc.c  */
-#line 946 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 962 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL);
@@ -3862,10 +3879,10 @@ yyreduce:
        ;}
     break;
 
-  case 133:
+  case 134:
 
-/* Line 1464 of yacc.c  */
-#line 960 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 976 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type();
@@ -3874,10 +3891,10 @@ yyreduce:
        ;}
     break;
 
-  case 134:
+  case 135:
 
-/* Line 1464 of yacc.c  */
-#line 967 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 983 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type();
@@ -3887,19 +3904,19 @@ yyreduce:
        ;}
     break;
 
-  case 135:
+  case 136:
 
-/* Line 1464 of yacc.c  */
-#line 978 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 994 "glsl_parser.ypp"
     {
          (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier);
        ;}
     break;
 
-  case 137:
+  case 138:
 
-/* Line 1464 of yacc.c  */
-#line 986 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1002 "glsl_parser.ypp"
     {
           if (((yyvsp[(1) - (3)].type_qualifier).flags.i & (yyvsp[(3) - (3)].type_qualifier).flags.i) != 0) {
              _mesa_glsl_error(& (yylsp[(3) - (3)]), state,
@@ -3917,10 +3934,10 @@ yyreduce:
        ;}
     break;
 
-  case 138:
+  case 139:
 
-/* Line 1464 of yacc.c  */
-#line 1005 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1021 "glsl_parser.ypp"
     {
           bool got_one = false;
 
@@ -3951,10 +3968,10 @@ yyreduce:
        ;}
     break;
 
-  case 139:
+  case 140:
 
-/* Line 1464 of yacc.c  */
-#line 1034 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1050 "glsl_parser.ypp"
     {
           bool got_one = false;
 
@@ -3994,80 +4011,80 @@ yyreduce:
        ;}
     break;
 
-  case 140:
+  case 141:
 
-/* Line 1464 of yacc.c  */
-#line 1075 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1091 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.smooth = 1;
        ;}
     break;
 
-  case 141:
+  case 142:
 
-/* Line 1464 of yacc.c  */
-#line 1080 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1096 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.flat = 1;
        ;}
     break;
 
-  case 142:
+  case 143:
 
-/* Line 1464 of yacc.c  */
-#line 1085 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1101 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.noperspective = 1;
        ;}
     break;
 
-  case 143:
+  case 144:
 
-/* Line 1464 of yacc.c  */
-#line 1093 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1109 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.constant = 1;
        ;}
     break;
 
-  case 146:
+  case 147:
 
-/* Line 1464 of yacc.c  */
-#line 1103 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1119 "glsl_parser.ypp"
     {
           (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier);
           (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i;
        ;}
     break;
 
-  case 148:
+  case 149:
 
-/* Line 1464 of yacc.c  */
-#line 1109 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1125 "glsl_parser.ypp"
     {
           (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier);
           (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i;
        ;}
     break;
 
-  case 149:
+  case 150:
 
-/* Line 1464 of yacc.c  */
-#line 1114 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1130 "glsl_parser.ypp"
     {
           (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier);
           (yyval.type_qualifier).flags.q.invariant = 1;
        ;}
     break;
 
-  case 150:
+  case 151:
 
-/* Line 1464 of yacc.c  */
-#line 1119 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1135 "glsl_parser.ypp"
     {
           (yyval.type_qualifier) = (yyvsp[(2) - (3)].type_qualifier);
           (yyval.type_qualifier).flags.i |= (yyvsp[(3) - (3)].type_qualifier).flags.i;
@@ -4075,50 +4092,50 @@ yyreduce:
        ;}
     break;
 
-  case 151:
+  case 152:
 
-/* Line 1464 of yacc.c  */
-#line 1125 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1141 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.invariant = 1;
        ;}
     break;
 
-  case 152:
+  case 153:
 
-/* Line 1464 of yacc.c  */
-#line 1133 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1149 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.constant = 1;
        ;}
     break;
 
-  case 153:
+  case 154:
 
-/* Line 1464 of yacc.c  */
-#line 1138 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1154 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.attribute = 1;
        ;}
     break;
 
-  case 154:
+  case 155:
 
-/* Line 1464 of yacc.c  */
-#line 1143 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1159 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.varying = 1;
        ;}
     break;
 
-  case 155:
+  case 156:
 
-/* Line 1464 of yacc.c  */
-#line 1148 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1164 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.centroid = 1;
@@ -4126,70 +4143,70 @@ yyreduce:
        ;}
     break;
 
-  case 156:
+  case 157:
 
-/* Line 1464 of yacc.c  */
-#line 1154 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1170 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.in = 1;
        ;}
     break;
 
-  case 157:
+  case 158:
 
-/* Line 1464 of yacc.c  */
-#line 1159 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1175 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.out = 1;
        ;}
     break;
 
-  case 158:
+  case 159:
 
-/* Line 1464 of yacc.c  */
-#line 1164 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1180 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.in = 1;
        ;}
     break;
 
-  case 159:
+  case 160:
 
-/* Line 1464 of yacc.c  */
-#line 1169 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1185 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.out = 1;
        ;}
     break;
 
-  case 160:
+  case 161:
 
-/* Line 1464 of yacc.c  */
-#line 1174 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1190 "glsl_parser.ypp"
     {
           memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
           (yyval.type_qualifier).flags.q.uniform = 1;
        ;}
     break;
 
-  case 162:
+  case 163:
 
-/* Line 1464 of yacc.c  */
-#line 1183 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1199 "glsl_parser.ypp"
     {
           (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier);
           (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n);
        ;}
     break;
 
-  case 164:
+  case 165:
 
-/* Line 1464 of yacc.c  */
-#line 1192 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1208 "glsl_parser.ypp"
     {
           (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier);
           (yyval.type_specifier)->is_array = true;
@@ -4197,10 +4214,10 @@ yyreduce:
        ;}
     break;
 
-  case 165:
+  case 166:
 
-/* Line 1464 of yacc.c  */
-#line 1198 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1214 "glsl_parser.ypp"
     {
           (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier);
           (yyval.type_specifier)->is_array = true;
@@ -4208,10 +4225,10 @@ yyreduce:
        ;}
     break;
 
-  case 166:
+  case 167:
 
-/* Line 1464 of yacc.c  */
-#line 1207 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1223 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n));
@@ -4219,10 +4236,10 @@ yyreduce:
        ;}
     break;
 
-  case 167:
+  case 168:
 
-/* Line 1464 of yacc.c  */
-#line 1213 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1229 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier));
@@ -4230,10 +4247,10 @@ yyreduce:
        ;}
     break;
 
-  case 168:
+  case 169:
 
-/* Line 1464 of yacc.c  */
-#line 1219 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1235 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier));
@@ -4241,418 +4258,415 @@ yyreduce:
        ;}
     break;
 
-  case 169:
+  case 170:
 
-/* Line 1464 of yacc.c  */
-#line 1227 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1243 "glsl_parser.ypp"
     { (yyval.n) = ast_void; ;}
     break;
 
-  case 170:
+  case 171:
 
-/* Line 1464 of yacc.c  */
-#line 1228 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1244 "glsl_parser.ypp"
     { (yyval.n) = ast_float; ;}
     break;
 
-  case 171:
+  case 172:
 
-/* Line 1464 of yacc.c  */
-#line 1229 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1245 "glsl_parser.ypp"
     { (yyval.n) = ast_int; ;}
     break;
 
-  case 172:
+  case 173:
 
-/* Line 1464 of yacc.c  */
-#line 1230 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1246 "glsl_parser.ypp"
     { (yyval.n) = ast_uint; ;}
     break;
 
-  case 173:
+  case 174:
 
-/* Line 1464 of yacc.c  */
-#line 1231 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1247 "glsl_parser.ypp"
     { (yyval.n) = ast_bool; ;}
     break;
 
-  case 174:
+  case 175:
 
-/* Line 1464 of yacc.c  */
-#line 1232 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1248 "glsl_parser.ypp"
     { (yyval.n) = ast_vec2; ;}
     break;
 
-  case 175:
+  case 176:
 
-/* Line 1464 of yacc.c  */
-#line 1233 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1249 "glsl_parser.ypp"
     { (yyval.n) = ast_vec3; ;}
     break;
 
-  case 176:
+  case 177:
 
-/* Line 1464 of yacc.c  */
-#line 1234 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1250 "glsl_parser.ypp"
     { (yyval.n) = ast_vec4; ;}
     break;
 
-  case 177:
+  case 178:
 
-/* Line 1464 of yacc.c  */
-#line 1235 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1251 "glsl_parser.ypp"
     { (yyval.n) = ast_bvec2; ;}
     break;
 
-  case 178:
+  case 179:
 
-/* Line 1464 of yacc.c  */
-#line 1236 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1252 "glsl_parser.ypp"
     { (yyval.n) = ast_bvec3; ;}
     break;
 
-  case 179:
+  case 180:
 
-/* Line 1464 of yacc.c  */
-#line 1237 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1253 "glsl_parser.ypp"
     { (yyval.n) = ast_bvec4; ;}
     break;
 
-  case 180:
+  case 181:
 
-/* Line 1464 of yacc.c  */
-#line 1238 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1254 "glsl_parser.ypp"
     { (yyval.n) = ast_ivec2; ;}
     break;
 
-  case 181:
+  case 182:
 
-/* Line 1464 of yacc.c  */
-#line 1239 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1255 "glsl_parser.ypp"
     { (yyval.n) = ast_ivec3; ;}
     break;
 
-  case 182:
+  case 183:
 
-/* Line 1464 of yacc.c  */
-#line 1240 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1256 "glsl_parser.ypp"
     { (yyval.n) = ast_ivec4; ;}
     break;
 
-  case 183:
+  case 184:
 
-/* Line 1464 of yacc.c  */
-#line 1241 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1257 "glsl_parser.ypp"
     { (yyval.n) = ast_uvec2; ;}
     break;
 
-  case 184:
+  case 185:
 
-/* Line 1464 of yacc.c  */
-#line 1242 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1258 "glsl_parser.ypp"
     { (yyval.n) = ast_uvec3; ;}
     break;
 
-  case 185:
+  case 186:
 
-/* Line 1464 of yacc.c  */
-#line 1243 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1259 "glsl_parser.ypp"
     { (yyval.n) = ast_uvec4; ;}
     break;
 
-  case 186:
+  case 187:
 
-/* Line 1464 of yacc.c  */
-#line 1244 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1260 "glsl_parser.ypp"
     { (yyval.n) = ast_mat2; ;}
     break;
 
-  case 187:
+  case 188:
 
-/* Line 1464 of yacc.c  */
-#line 1245 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1261 "glsl_parser.ypp"
     { (yyval.n) = ast_mat2x3; ;}
     break;
 
-  case 188:
+  case 189:
 
-/* Line 1464 of yacc.c  */
-#line 1246 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1262 "glsl_parser.ypp"
     { (yyval.n) = ast_mat2x4; ;}
     break;
 
-  case 189:
+  case 190:
 
-/* Line 1464 of yacc.c  */
-#line 1247 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1263 "glsl_parser.ypp"
     { (yyval.n) = ast_mat3x2; ;}
     break;
 
-  case 190:
+  case 191:
 
-/* Line 1464 of yacc.c  */
-#line 1248 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1264 "glsl_parser.ypp"
     { (yyval.n) = ast_mat3; ;}
     break;
 
-  case 191:
+  case 192:
 
-/* Line 1464 of yacc.c  */
-#line 1249 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1265 "glsl_parser.ypp"
     { (yyval.n) = ast_mat3x4; ;}
     break;
 
-  case 192:
+  case 193:
 
-/* Line 1464 of yacc.c  */
-#line 1250 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1266 "glsl_parser.ypp"
     { (yyval.n) = ast_mat4x2; ;}
     break;
 
-  case 193:
+  case 194:
 
-/* Line 1464 of yacc.c  */
-#line 1251 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1267 "glsl_parser.ypp"
     { (yyval.n) = ast_mat4x3; ;}
     break;
 
-  case 194:
+  case 195:
 
-/* Line 1464 of yacc.c  */
-#line 1252 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1268 "glsl_parser.ypp"
     { (yyval.n) = ast_mat4; ;}
     break;
 
-  case 195:
+  case 196:
 
-/* Line 1464 of yacc.c  */
-#line 1253 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1269 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler1d; ;}
     break;
 
-  case 196:
+  case 197:
 
-/* Line 1464 of yacc.c  */
-#line 1254 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1270 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler2d; ;}
     break;
 
-  case 197:
+  case 198:
 
-/* Line 1464 of yacc.c  */
-#line 1255 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1271 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler2drect; ;}
     break;
 
-  case 198:
+  case 199:
 
-/* Line 1464 of yacc.c  */
-#line 1256 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1272 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler3d; ;}
     break;
 
-  case 199:
+  case 200:
 
-/* Line 1464 of yacc.c  */
-#line 1257 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1273 "glsl_parser.ypp"
     { (yyval.n) = ast_samplercube; ;}
     break;
 
-  case 200:
+  case 201:
 
-/* Line 1464 of yacc.c  */
-#line 1258 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1274 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler1dshadow; ;}
     break;
 
-  case 201:
+  case 202:
 
-/* Line 1464 of yacc.c  */
-#line 1259 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1275 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler2dshadow; ;}
     break;
 
-  case 202:
+  case 203:
 
-/* Line 1464 of yacc.c  */
-#line 1260 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1276 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler2drectshadow; ;}
     break;
 
-  case 203:
+  case 204:
 
-/* Line 1464 of yacc.c  */
-#line 1261 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1277 "glsl_parser.ypp"
     { (yyval.n) = ast_samplercubeshadow; ;}
     break;
 
-  case 204:
+  case 205:
 
-/* Line 1464 of yacc.c  */
-#line 1262 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1278 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler1darray; ;}
     break;
 
-  case 205:
+  case 206:
 
-/* Line 1464 of yacc.c  */
-#line 1263 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1279 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler2darray; ;}
     break;
 
-  case 206:
+  case 207:
 
-/* Line 1464 of yacc.c  */
-#line 1264 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1280 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler1darrayshadow; ;}
     break;
 
-  case 207:
+  case 208:
 
-/* Line 1464 of yacc.c  */
-#line 1265 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1281 "glsl_parser.ypp"
     { (yyval.n) = ast_sampler2darrayshadow; ;}
     break;
 
-  case 208:
+  case 209:
 
-/* Line 1464 of yacc.c  */
-#line 1266 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1282 "glsl_parser.ypp"
     { (yyval.n) = ast_isampler1d; ;}
     break;
 
-  case 209:
+  case 210:
 
-/* Line 1464 of yacc.c  */
-#line 1267 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1283 "glsl_parser.ypp"
     { (yyval.n) = ast_isampler2d; ;}
     break;
 
-  case 210:
+  case 211:
 
-/* Line 1464 of yacc.c  */
-#line 1268 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1284 "glsl_parser.ypp"
     { (yyval.n) = ast_isampler3d; ;}
     break;
 
-  case 211:
+  case 212:
 
-/* Line 1464 of yacc.c  */
-#line 1269 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1285 "glsl_parser.ypp"
     { (yyval.n) = ast_isamplercube; ;}
     break;
 
-  case 212:
+  case 213:
 
-/* Line 1464 of yacc.c  */
-#line 1270 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1286 "glsl_parser.ypp"
     { (yyval.n) = ast_isampler1darray; ;}
     break;
 
-  case 213:
+  case 214:
 
-/* Line 1464 of yacc.c  */
-#line 1271 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1287 "glsl_parser.ypp"
     { (yyval.n) = ast_isampler2darray; ;}
     break;
 
-  case 214:
+  case 215:
 
-/* Line 1464 of yacc.c  */
-#line 1272 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1288 "glsl_parser.ypp"
     { (yyval.n) = ast_usampler1d; ;}
     break;
 
-  case 215:
+  case 216:
 
-/* Line 1464 of yacc.c  */
-#line 1273 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1289 "glsl_parser.ypp"
     { (yyval.n) = ast_usampler2d; ;}
     break;
 
-  case 216:
+  case 217:
 
-/* Line 1464 of yacc.c  */
-#line 1274 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1290 "glsl_parser.ypp"
     { (yyval.n) = ast_usampler3d; ;}
     break;
 
-  case 217:
+  case 218:
 
-/* Line 1464 of yacc.c  */
-#line 1275 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1291 "glsl_parser.ypp"
     { (yyval.n) = ast_usamplercube; ;}
     break;
 
-  case 218:
+  case 219:
 
-/* Line 1464 of yacc.c  */
-#line 1276 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1292 "glsl_parser.ypp"
     { (yyval.n) = ast_usampler1darray; ;}
     break;
 
-  case 219:
+  case 220:
 
-/* Line 1464 of yacc.c  */
-#line 1277 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1293 "glsl_parser.ypp"
     { (yyval.n) = ast_usampler2darray; ;}
     break;
 
-  case 220:
+  case 221:
 
-/* Line 1464 of yacc.c  */
-#line 1281 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1297 "glsl_parser.ypp"
     {
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     (yyval.n) = ast_precision_high;
                  ;}
     break;
 
-  case 221:
+  case 222:
 
-/* Line 1464 of yacc.c  */
-#line 1292 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1307 "glsl_parser.ypp"
     {
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     (yyval.n) = ast_precision_medium;
                  ;}
     break;
 
-  case 222:
+  case 223:
 
-/* Line 1464 of yacc.c  */
-#line 1303 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1317 "glsl_parser.ypp"
     {
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     (yyval.n) = ast_precision_low;
                  ;}
     break;
 
-  case 223:
+  case 224:
 
-/* Line 1464 of yacc.c  */
-#line 1318 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1331 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node));
@@ -4660,10 +4674,10 @@ yyreduce:
        ;}
     break;
 
-  case 224:
+  case 225:
 
-/* Line 1464 of yacc.c  */
-#line 1324 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1337 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node));
@@ -4671,30 +4685,30 @@ yyreduce:
        ;}
     break;
 
-  case 225:
+  case 226:
 
-/* Line 1464 of yacc.c  */
-#line 1333 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1346 "glsl_parser.ypp"
     {
           (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list);
           (yyvsp[(1) - (1)].declarator_list)->link.self_link();
        ;}
     break;
 
-  case 226:
+  case 227:
 
-/* Line 1464 of yacc.c  */
-#line 1338 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1351 "glsl_parser.ypp"
     {
           (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node);
           (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link);
        ;}
     break;
 
-  case 227:
+  case 228:
 
-/* Line 1464 of yacc.c  */
-#line 1346 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1359 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_fully_specified_type *type = new(ctx) ast_fully_specified_type();
@@ -4708,30 +4722,30 @@ yyreduce:
        ;}
     break;
 
-  case 228:
+  case 229:
 
-/* Line 1464 of yacc.c  */
-#line 1361 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1374 "glsl_parser.ypp"
     {
           (yyval.declaration) = (yyvsp[(1) - (1)].declaration);
           (yyvsp[(1) - (1)].declaration)->link.self_link();
        ;}
     break;
 
-  case 229:
+  case 230:
 
-/* Line 1464 of yacc.c  */
-#line 1366 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1379 "glsl_parser.ypp"
     {
           (yyval.declaration) = (yyvsp[(1) - (3)].declaration);
           (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link);
        ;}
     break;
 
-  case 230:
+  case 231:
 
-/* Line 1464 of yacc.c  */
-#line 1374 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1387 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL);
@@ -4739,10 +4753,10 @@ yyreduce:
        ;}
     break;
 
-  case 231:
+  case 232:
 
-/* Line 1464 of yacc.c  */
-#line 1380 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1393 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL);
@@ -4750,31 +4764,31 @@ yyreduce:
        ;}
     break;
 
-  case 234:
+  case 235:
 
-/* Line 1464 of yacc.c  */
-#line 1398 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1411 "glsl_parser.ypp"
     { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
     break;
 
-  case 239:
+  case 240:
 
-/* Line 1464 of yacc.c  */
-#line 1406 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1419 "glsl_parser.ypp"
     { (yyval.node) = NULL; ;}
     break;
 
-  case 240:
+  case 241:
 
-/* Line 1464 of yacc.c  */
-#line 1407 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1420 "glsl_parser.ypp"
     { (yyval.node) = NULL; ;}
     break;
 
-  case 243:
+  case 244:
 
-/* Line 1464 of yacc.c  */
-#line 1414 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1427 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL);
@@ -4782,10 +4796,10 @@ yyreduce:
        ;}
     break;
 
-  case 244:
+  case 245:
 
-/* Line 1464 of yacc.c  */
-#line 1420 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1433 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node));
@@ -4793,17 +4807,17 @@ yyreduce:
        ;}
     break;
 
-  case 245:
+  case 246:
 
-/* Line 1464 of yacc.c  */
-#line 1428 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1441 "glsl_parser.ypp"
     { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
     break;
 
-  case 247:
+  case 248:
 
-/* Line 1464 of yacc.c  */
-#line 1434 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1447 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL);
@@ -4811,10 +4825,10 @@ yyreduce:
        ;}
     break;
 
-  case 248:
+  case 249:
 
-/* Line 1464 of yacc.c  */
-#line 1440 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1453 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node));
@@ -4822,10 +4836,10 @@ yyreduce:
        ;}
     break;
 
-  case 249:
+  case 250:
 
-/* Line 1464 of yacc.c  */
-#line 1449 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1462 "glsl_parser.ypp"
     {
           if ((yyvsp[(1) - (1)].node) == NULL) {
              _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "<nil> statement\n");
@@ -4837,10 +4851,10 @@ yyreduce:
        ;}
     break;
 
-  case 250:
+  case 251:
 
-/* Line 1464 of yacc.c  */
-#line 1459 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1472 "glsl_parser.ypp"
     {
           if ((yyvsp[(2) - (2)].node) == NULL) {
              _mesa_glsl_error(& (yylsp[(2) - (2)]), state, "<nil> statement\n");
@@ -4851,10 +4865,10 @@ yyreduce:
        ;}
     break;
 
-  case 251:
+  case 252:
 
-/* Line 1464 of yacc.c  */
-#line 1471 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1484 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_expression_statement(NULL);
@@ -4862,10 +4876,10 @@ yyreduce:
        ;}
     break;
 
-  case 252:
+  case 253:
 
-/* Line 1464 of yacc.c  */
-#line 1477 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1490 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression));
@@ -4873,10 +4887,10 @@ yyreduce:
        ;}
     break;
 
-  case 253:
+  case 254:
 
-/* Line 1464 of yacc.c  */
-#line 1486 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1499 "glsl_parser.ypp"
     {
           (yyval.node) = new(state) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].selection_rest_statement).then_statement,
                                                   (yyvsp[(5) - (5)].selection_rest_statement).else_statement);
@@ -4884,39 +4898,39 @@ yyreduce:
        ;}
     break;
 
-  case 254:
+  case 255:
 
-/* Line 1464 of yacc.c  */
-#line 1495 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1508 "glsl_parser.ypp"
     {
           (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (3)].node);
           (yyval.selection_rest_statement).else_statement = (yyvsp[(3) - (3)].node);
        ;}
     break;
 
-  case 255:
+  case 256:
 
-/* Line 1464 of yacc.c  */
-#line 1500 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1513 "glsl_parser.ypp"
     {
           (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (1)].node);
           (yyval.selection_rest_statement).else_statement = NULL;
        ;}
     break;
 
-  case 256:
+  case 257:
 
-/* Line 1464 of yacc.c  */
-#line 1508 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1521 "glsl_parser.ypp"
     {
           (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression);
        ;}
     break;
 
-  case 257:
+  case 258:
 
-/* Line 1464 of yacc.c  */
-#line 1512 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1525 "glsl_parser.ypp"
     {
           void *ctx = state;
           ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression));
@@ -4929,10 +4943,10 @@ yyreduce:
        ;}
     break;
 
-  case 261:
+  case 262:
 
-/* Line 1464 of yacc.c  */
-#line 1535 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1548 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while,
@@ -4941,10 +4955,10 @@ yyreduce:
        ;}
     break;
 
-  case 262:
+  case 263:
 
-/* Line 1464 of yacc.c  */
-#line 1542 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1555 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while,
@@ -4953,10 +4967,10 @@ yyreduce:
        ;}
     break;
 
-  case 263:
+  case 264:
 
-/* Line 1464 of yacc.c  */
-#line 1549 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1562 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for,
@@ -4965,39 +4979,39 @@ yyreduce:
        ;}
     break;
 
-  case 267:
+  case 268:
 
-/* Line 1464 of yacc.c  */
-#line 1565 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1578 "glsl_parser.ypp"
     {
           (yyval.node) = NULL;
        ;}
     break;
 
-  case 268:
+  case 269:
 
-/* Line 1464 of yacc.c  */
-#line 1572 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1585 "glsl_parser.ypp"
     {
           (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node);
           (yyval.for_rest_statement).rest = NULL;
        ;}
     break;
 
-  case 269:
+  case 270:
 
-/* Line 1464 of yacc.c  */
-#line 1577 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1590 "glsl_parser.ypp"
     {
           (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node);
           (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression);
        ;}
     break;
 
-  case 270:
+  case 271:
 
-/* Line 1464 of yacc.c  */
-#line 1586 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1599 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL);
@@ -5005,10 +5019,10 @@ yyreduce:
        ;}
     break;
 
-  case 271:
+  case 272:
 
-/* Line 1464 of yacc.c  */
-#line 1592 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1605 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL);
@@ -5016,10 +5030,10 @@ yyreduce:
        ;}
     break;
 
-  case 272:
+  case 273:
 
-/* Line 1464 of yacc.c  */
-#line 1598 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1611 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL);
@@ -5027,10 +5041,10 @@ yyreduce:
        ;}
     break;
 
-  case 273:
+  case 274:
 
-/* Line 1464 of yacc.c  */
-#line 1604 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1617 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression));
@@ -5038,10 +5052,10 @@ yyreduce:
        ;}
     break;
 
-  case 274:
+  case 275:
 
-/* Line 1464 of yacc.c  */
-#line 1610 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1623 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL);
@@ -5049,31 +5063,31 @@ yyreduce:
        ;}
     break;
 
-  case 275:
+  case 276:
 
-/* Line 1464 of yacc.c  */
-#line 1618 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1631 "glsl_parser.ypp"
     { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;}
     break;
 
-  case 276:
+  case 277:
 
-/* Line 1464 of yacc.c  */
-#line 1619 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1632 "glsl_parser.ypp"
     { (yyval.node) = (yyvsp[(1) - (1)].node); ;}
     break;
 
-  case 277:
+  case 278:
 
-/* Line 1464 of yacc.c  */
-#line 1620 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1633 "glsl_parser.ypp"
     { (yyval.node) = NULL; ;}
     break;
 
-  case 278:
+  case 279:
 
-/* Line 1464 of yacc.c  */
-#line 1625 "glsl_parser.ypp"
+/* Line 1455 of yacc.c  */
+#line 1638 "glsl_parser.ypp"
     {
           void *ctx = state;
           (yyval.function_definition) = new(ctx) ast_function_definition();
@@ -5085,8 +5099,8 @@ yyreduce:
 
 
 
-/* Line 1464 of yacc.c  */
-#line 5090 "glsl_parser.cpp"
+/* Line 1455 of yacc.c  */
+#line 5104 "glsl_parser.cpp"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5158,7 +5172,7 @@ yyerrlab:
 #endif
     }
 
-  yyerror_range[1] = yylloc;
+  yyerror_range[0] = yylloc;
 
   if (yyerrstatus == 3)
     {
@@ -5195,7 +5209,7 @@ yyerrorlab:
   if (/*CONSTCOND*/ 0)
      goto yyerrorlab;
 
-  yyerror_range[1] = yylsp[1-yylen];
+  yyerror_range[0] = yylsp[1-yylen];
   /* Do not reclaim the symbols of the rule which action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
@@ -5229,7 +5243,7 @@ yyerrlab1:
       if (yyssp == yyss)
        YYABORT;
 
-      yyerror_range[1] = *yylsp;
+      yyerror_range[0] = *yylsp;
       yydestruct ("Error: popping",
                  yystos[yystate], yyvsp, yylsp, state);
       YYPOPSTACK (1);
@@ -5239,10 +5253,10 @@ yyerrlab1:
 
   *++yyvsp = yylval;
 
-  yyerror_range[2] = yylloc;
+  yyerror_range[1] = yylloc;
   /* Using YYLLOC is tempting, but would change the location of
      the lookahead.  YYLOC is available though.  */
-  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
   *++yylsp = yyloc;
 
   /* Shift the error token.  */
index 83aa56f7cbeb2a889accb6cbf4b410b3bc81c0d2..01b407d4dbeb1b15e446d912eddf27d2d5686eab 100644 (file)
@@ -1,9 +1,10 @@
-/* A Bison parser, made by GNU Bison 2.4.3.  */
+
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
 /* Skeleton interface for Bison's Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2009, 2010 Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
      PRAGMA_DEBUG_OFF = 372,
      PRAGMA_OPTIMIZE_ON = 373,
      PRAGMA_OPTIMIZE_OFF = 374,
-     LAYOUT_TOK = 375,
-     ASM = 376,
-     CLASS = 377,
-     UNION = 378,
-     ENUM = 379,
-     TYPEDEF = 380,
-     TEMPLATE = 381,
-     THIS = 382,
-     PACKED_TOK = 383,
-     GOTO = 384,
-     INLINE_TOK = 385,
-     NOINLINE = 386,
-     VOLATILE = 387,
-     PUBLIC_TOK = 388,
-     STATIC = 389,
-     EXTERN = 390,
-     EXTERNAL = 391,
-     LONG_TOK = 392,
-     SHORT_TOK = 393,
-     DOUBLE_TOK = 394,
-     HALF = 395,
-     FIXED_TOK = 396,
-     UNSIGNED = 397,
-     INPUT_TOK = 398,
-     OUPTUT = 399,
-     HVEC2 = 400,
-     HVEC3 = 401,
-     HVEC4 = 402,
-     DVEC2 = 403,
-     DVEC3 = 404,
-     DVEC4 = 405,
-     FVEC2 = 406,
-     FVEC3 = 407,
-     FVEC4 = 408,
-     SAMPLER2DRECT = 409,
-     SAMPLER3DRECT = 410,
-     SAMPLER2DRECTSHADOW = 411,
-     SIZEOF = 412,
-     CAST = 413,
-     NAMESPACE = 414,
-     USING = 415,
-     ERROR_TOK = 416,
-     COMMON = 417,
-     PARTITION = 418,
-     ACTIVE = 419,
-     SAMPLERBUFFER = 420,
-     FILTER = 421,
-     IMAGE1D = 422,
-     IMAGE2D = 423,
-     IMAGE3D = 424,
-     IMAGECUBE = 425,
-     IMAGE1DARRAY = 426,
-     IMAGE2DARRAY = 427,
-     IIMAGE1D = 428,
-     IIMAGE2D = 429,
-     IIMAGE3D = 430,
-     IIMAGECUBE = 431,
-     IIMAGE1DARRAY = 432,
-     IIMAGE2DARRAY = 433,
-     UIMAGE1D = 434,
-     UIMAGE2D = 435,
-     UIMAGE3D = 436,
-     UIMAGECUBE = 437,
-     UIMAGE1DARRAY = 438,
-     UIMAGE2DARRAY = 439,
-     IMAGE1DSHADOW = 440,
-     IMAGE2DSHADOW = 441,
-     IMAGEBUFFER = 442,
-     IIMAGEBUFFER = 443,
-     UIMAGEBUFFER = 444,
-     IMAGE1DARRAYSHADOW = 445,
-     IMAGE2DARRAYSHADOW = 446,
-     ROW_MAJOR = 447
+     PRAGMA_INVARIANT_ALL = 375,
+     LAYOUT_TOK = 376,
+     ASM = 377,
+     CLASS = 378,
+     UNION = 379,
+     ENUM = 380,
+     TYPEDEF = 381,
+     TEMPLATE = 382,
+     THIS = 383,
+     PACKED_TOK = 384,
+     GOTO = 385,
+     INLINE_TOK = 386,
+     NOINLINE = 387,
+     VOLATILE = 388,
+     PUBLIC_TOK = 389,
+     STATIC = 390,
+     EXTERN = 391,
+     EXTERNAL = 392,
+     LONG_TOK = 393,
+     SHORT_TOK = 394,
+     DOUBLE_TOK = 395,
+     HALF = 396,
+     FIXED_TOK = 397,
+     UNSIGNED = 398,
+     INPUT_TOK = 399,
+     OUPTUT = 400,
+     HVEC2 = 401,
+     HVEC3 = 402,
+     HVEC4 = 403,
+     DVEC2 = 404,
+     DVEC3 = 405,
+     DVEC4 = 406,
+     FVEC2 = 407,
+     FVEC3 = 408,
+     FVEC4 = 409,
+     SAMPLER2DRECT = 410,
+     SAMPLER3DRECT = 411,
+     SAMPLER2DRECTSHADOW = 412,
+     SIZEOF = 413,
+     CAST = 414,
+     NAMESPACE = 415,
+     USING = 416,
+     ERROR_TOK = 417,
+     COMMON = 418,
+     PARTITION = 419,
+     ACTIVE = 420,
+     SAMPLERBUFFER = 421,
+     FILTER = 422,
+     IMAGE1D = 423,
+     IMAGE2D = 424,
+     IMAGE3D = 425,
+     IMAGECUBE = 426,
+     IMAGE1DARRAY = 427,
+     IMAGE2DARRAY = 428,
+     IIMAGE1D = 429,
+     IIMAGE2D = 430,
+     IIMAGE3D = 431,
+     IIMAGECUBE = 432,
+     IIMAGE1DARRAY = 433,
+     IIMAGE2DARRAY = 434,
+     UIMAGE1D = 435,
+     UIMAGE2D = 436,
+     UIMAGE3D = 437,
+     UIMAGECUBE = 438,
+     UIMAGE1DARRAY = 439,
+     UIMAGE2DARRAY = 440,
+     IMAGE1DSHADOW = 441,
+     IMAGE2DSHADOW = 442,
+     IMAGEBUFFER = 443,
+     IIMAGEBUFFER = 444,
+     UIMAGEBUFFER = 445,
+     IMAGE1DARRAYSHADOW = 446,
+     IMAGE2DARRAYSHADOW = 447,
+     ROW_MAJOR = 448
    };
 #endif
 
 typedef union YYSTYPE
 {
 
-/* Line 1685 of yacc.c  */
+/* Line 1676 of yacc.c  */
 #line 52 "glsl_parser.ypp"
 
    int n;
@@ -270,8 +272,8 @@ typedef union YYSTYPE
 
 
 
-/* Line 1685 of yacc.c  */
-#line 275 "glsl_parser.h"
+/* Line 1676 of yacc.c  */
+#line 277 "glsl_parser.h"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
index 6d7d148eb04e4a4364f32571e9d04ccdf492d0d3..124ee18356db785892569ddf72a090bffdd11559 100644 (file)
 %token VERSION EXTENSION LINE COLON EOL INTERFACE OUTPUT
 %token PRAGMA_DEBUG_ON PRAGMA_DEBUG_OFF
 %token PRAGMA_OPTIMIZE_ON PRAGMA_OPTIMIZE_OFF
+%token PRAGMA_INVARIANT_ALL
 %token LAYOUT_TOK
 
    /* Reserved words that are not actually used in the grammar.
@@ -227,6 +228,11 @@ version_statement:
           case 130:
              /* FINISHME: Check against implementation support versions. */
              state->language_version = $2;
+             state->version_string =
+                talloc_asprintf(state, "GLSL%s %d.%02d",
+                                state->es_shader ? " ES" : "",
+                                state->language_version / 100,
+                                state->language_version % 100);
              break;
           default:
              _mesa_glsl_error(& @2, state, "Shading language version"
@@ -241,6 +247,16 @@ pragma_statement:
        | PRAGMA_DEBUG_OFF EOL
        | PRAGMA_OPTIMIZE_ON EOL
        | PRAGMA_OPTIMIZE_OFF EOL
+       | PRAGMA_INVARIANT_ALL EOL
+       {
+          if (state->language_version < 120) {
+             _mesa_glsl_warning(& @1, state,
+                                "pragma `invariant(all)' not supported in %s",
+                                state->version_string);
+          } else {
+             state->all_invariant = true;
+          }
+       }
        ;
 
 extension_statement_list:
@@ -1282,10 +1298,9 @@ precision_qualifier:
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& @1, state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     $$ = ast_precision_high;
                  }
@@ -1293,10 +1308,9 @@ precision_qualifier:
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& @1, state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     $$ = ast_precision_medium;
                  }
@@ -1304,10 +1318,9 @@ precision_qualifier:
                     if (!state->es_shader && state->language_version < 130)
                        _mesa_glsl_error(& @1, state,
                                         "precision qualifier forbidden "
-                                        "in GLSL %d.%d (1.30 or later "
+                                        "in %s (1.30 or later "
                                         "required)\n",
-                                        state->language_version / 100,
-                                        state->language_version % 100);
+                                        state->version_string);
 
                     $$ = ast_precision_low;
                  }
index f7df3011eabbd64ac9b7452c42e19c88323a7ad7..cbeacd5633fe72985b34bdf7ad1d211bd6159301 100644 (file)
@@ -725,6 +725,7 @@ do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iteration
    }
    progress = do_structure_splitting(ir) || progress;
    progress = do_if_simplification(ir) || progress;
+   progress = do_discard_simplification(ir) || progress;
    progress = do_copy_propagation(ir) || progress;
    if (linked)
       progress = do_dead_code(ir) || progress;
index 9b5f38a2bf1bc48f504ed60b27ee7db3e84707fd..030d27a2627f056c303b564c6fc24f6bb17836c8 100644 (file)
@@ -69,6 +69,7 @@ struct _mesa_glsl_parse_state {
 
    bool es_shader;
    unsigned language_version;
+   const char *version_string;
    enum _mesa_glsl_parser_targets target;
 
    /**
@@ -108,6 +109,13 @@ struct _mesa_glsl_parse_state {
    /** Was there an error during compilation? */
    bool error;
 
+   /**
+    * Are all shader inputs / outputs invariant?
+    *
+    * This is set when the 'STDGL invariant(all)' pragma is used.
+    */
+   bool all_invariant;
+
    /** Loop or switch statement containing the current instructions. */
    class ir_instruction *loop_or_switch_nesting;
    class ast_iteration_statement *loop_or_switch_nesting_ast;
index e9bf89b951df246cf312dbd9d75383f8290c0239..3dcd928016ac1b1c5c7af45d4a6e5e8b0ac26e63 100644 (file)
@@ -81,12 +81,12 @@ bool glsl_symbol_table::name_declared_this_scope(const char *name)
    return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
 }
 
-bool glsl_symbol_table::add_variable(const char *name, ir_variable *v)
+bool glsl_symbol_table::add_variable(ir_variable *v)
 {
    if (this->language_version == 110) {
       /* In 1.10, functions and variables have separate namespaces. */
-      symbol_table_entry *existing = get_entry(name);
-      if (name_declared_this_scope(name)) {
+      symbol_table_entry *existing = get_entry(v->name);
+      if (name_declared_this_scope(v->name)) {
         /* If there's already an existing function (not a constructor!) in
          * the current scope, just update the existing entry to include 'v'.
          */
@@ -102,7 +102,7 @@ bool glsl_symbol_table::add_variable(const char *name, ir_variable *v)
         symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
         if (existing != NULL)
            entry->f = existing->f;
-        int added = _mesa_symbol_table_add_symbol(table, -1, name, entry);
+        int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
         assert(added == 0);
         (void)added;
         return true;
@@ -112,7 +112,7 @@ bool glsl_symbol_table::add_variable(const char *name, ir_variable *v)
 
    /* 1.20+ rules: */
    symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
-   return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+   return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0;
 }
 
 bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
@@ -121,18 +121,25 @@ bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
    return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
 }
 
-bool glsl_symbol_table::add_function(const char *name, ir_function *f)
+bool glsl_symbol_table::add_function(ir_function *f)
 {
-   if (this->language_version == 110 && name_declared_this_scope(name)) {
+   if (this->language_version == 110 && name_declared_this_scope(f->name)) {
       /* In 1.10, functions and variables have separate namespaces. */
-      symbol_table_entry *existing = get_entry(name);
+      symbol_table_entry *existing = get_entry(f->name);
       if ((existing->f == NULL) && (existing->t == NULL)) {
         existing->f = f;
         return true;
       }
    }
    symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
-   return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+   return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
+}
+
+void glsl_symbol_table::add_global_function(ir_function *f)
+{
+   symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
+   int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry);
+   assert(added == 0);
 }
 
 ir_variable *glsl_symbol_table::get_variable(const char *name)
index f26de52432574e00d20e8642c535ebc1fd047964..28a44ebe91c24fa065755136f1bfd30d1efad338 100644 (file)
@@ -97,11 +97,16 @@ public:
     * reduces the clarity of the intention of code that uses these methods.
     */
    /*@{*/
-   bool add_variable(const char *name, ir_variable *v);
+   bool add_variable(ir_variable *v);
    bool add_type(const char *name, const glsl_type *t);
-   bool add_function(const char *name, ir_function *f);
+   bool add_function(ir_function *f);
    /*@}*/
 
+   /**
+    * Add an function at global scope without checking for scoping conflicts.
+    */
+   void add_global_function(ir_function *f);
+
    /**
     * \name Methods to get symbols from the table
     */
index 8c33cfa20d0143cd525c6b7ea37710444ee3c974..95b859264821b389a9654372f3d0ae2e401f760f 100644 (file)
@@ -120,7 +120,7 @@ glsl_type::generate_100ES_types(glsl_symbol_table *symtab)
    add_types_to_symbol_table(symtab, builtin_structure_types,
                             Elements(builtin_structure_types),
                             false);
-   add_types_to_symbol_table(symtab, &void_type, 1, false);
+   add_types_to_symbol_table(symtab, void_type, 1, false);
 }
 
 void
@@ -279,7 +279,7 @@ const glsl_type *
 glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns)
 {
    if (base_type == GLSL_TYPE_VOID)
-      return &void_type;
+      return void_type;
 
    if ((rows < 1) || (rows > 4) || (columns < 1) || (columns > 4))
       return error_type;
index d62d493c8e8f2f1b5b54e2a61c515494cf948209..57e7b09d98c57f7efe2464e11ce9e9ea56bc0eb1 100644 (file)
@@ -142,6 +142,7 @@ struct glsl_type {
     */
    /*@{*/
    static const glsl_type *const error_type;
+   static const glsl_type *const void_type;
    static const glsl_type *const int_type;
    static const glsl_type *const ivec4_type;
    static const glsl_type *const uint_type;
@@ -424,7 +425,7 @@ private:
     */
    /*@{*/
    static const glsl_type _error_type;
-   static const glsl_type void_type;
+   static const glsl_type _void_type;
    static const glsl_type builtin_core_types[];
    static const glsl_type builtin_structure_types[];
    static const glsl_type builtin_110_deprecated_structure_types[];
index 2abb95394fd04ef8d30e1e602d7d4653d1565102..460d43b02e1361f2532ea3db63ebdb794d0d54b4 100644 (file)
@@ -231,6 +231,156 @@ ir_expression::ir_expression(int op, const struct glsl_type *type,
    this->operands[3] = op3;
 }
 
+ir_expression::ir_expression(int op, ir_rvalue *op0)
+{
+   this->ir_type = ir_type_expression;
+
+   this->operation = ir_expression_operation(op);
+   this->operands[0] = op0;
+   this->operands[1] = NULL;
+   this->operands[2] = NULL;
+   this->operands[3] = NULL;
+
+   assert(op <= ir_last_unop);
+
+   switch (this->operation) {
+   case ir_unop_bit_not:
+   case ir_unop_logic_not:
+   case ir_unop_neg:
+   case ir_unop_abs:
+   case ir_unop_sign:
+   case ir_unop_rcp:
+   case ir_unop_rsq:
+   case ir_unop_sqrt:
+   case ir_unop_exp:
+   case ir_unop_log:
+   case ir_unop_exp2:
+   case ir_unop_log2:
+   case ir_unop_trunc:
+   case ir_unop_ceil:
+   case ir_unop_floor:
+   case ir_unop_fract:
+   case ir_unop_round_even:
+   case ir_unop_sin:
+   case ir_unop_cos:
+   case ir_unop_sin_reduced:
+   case ir_unop_cos_reduced:
+   case ir_unop_dFdx:
+   case ir_unop_dFdy:
+      this->type = op0->type;
+      break;
+
+   case ir_unop_f2i:
+   case ir_unop_b2i:
+      this->type = glsl_type::get_instance(GLSL_TYPE_INT,
+                                          op0->type->vector_elements, 1);
+      break;
+
+   case ir_unop_b2f:
+   case ir_unop_i2f:
+   case ir_unop_u2f:
+      this->type = glsl_type::get_instance(GLSL_TYPE_FLOAT,
+                                          op0->type->vector_elements, 1);
+      break;
+
+   case ir_unop_f2b:
+   case ir_unop_i2b:
+      this->type = glsl_type::get_instance(GLSL_TYPE_BOOL,
+                                          op0->type->vector_elements, 1);
+      break;
+
+   case ir_unop_noise:
+      this->type = glsl_type::float_type;
+      break;
+
+   case ir_unop_any:
+      this->type = glsl_type::bool_type;
+      break;
+
+   default:
+      assert(!"not reached: missing automatic type setup for ir_expression");
+      this->type = op0->type;
+      break;
+   }
+}
+
+ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1)
+{
+   this->ir_type = ir_type_expression;
+
+   this->operation = ir_expression_operation(op);
+   this->operands[0] = op0;
+   this->operands[1] = op1;
+   this->operands[2] = NULL;
+   this->operands[3] = NULL;
+
+   assert(op > ir_last_unop);
+
+   switch (this->operation) {
+   case ir_binop_all_equal:
+   case ir_binop_any_nequal:
+      this->type = glsl_type::bool_type;
+      break;
+
+   case ir_binop_add:
+   case ir_binop_sub:
+   case ir_binop_min:
+   case ir_binop_max:
+   case ir_binop_pow:
+   case ir_binop_mul:
+   case ir_binop_div:
+   case ir_binop_mod:
+      if (op0->type->is_scalar()) {
+        this->type = op1->type;
+      } else if (op1->type->is_scalar()) {
+        this->type = op0->type;
+      } else {
+        /* FINISHME: matrix types */
+        assert(!op0->type->is_matrix() && !op1->type->is_matrix());
+        assert(op0->type == op1->type);
+        this->type = op0->type;
+      }
+      break;
+
+   case ir_binop_logic_and:
+   case ir_binop_logic_xor:
+   case ir_binop_logic_or:
+   case ir_binop_bit_and:
+   case ir_binop_bit_xor:
+   case ir_binop_bit_or:
+      if (op0->type->is_scalar()) {
+        this->type = op1->type;
+      } else if (op1->type->is_scalar()) {
+        this->type = op0->type;
+      }
+      break;
+
+   case ir_binop_equal:
+   case ir_binop_nequal:
+   case ir_binop_lequal:
+   case ir_binop_gequal:
+   case ir_binop_less:
+   case ir_binop_greater:
+      assert(op0->type == op1->type);
+      this->type = glsl_type::get_instance(GLSL_TYPE_BOOL,
+                                          op0->type->vector_elements, 1);
+      break;
+
+   case ir_binop_dot:
+      this->type = glsl_type::float_type;
+      break;
+
+   case ir_binop_lshift:
+   case ir_binop_rshift:
+      this->type = op0->type;
+      break;
+
+   default:
+      assert(!"not reached: missing automatic type setup for ir_expression");
+      this->type = glsl_type::float_type;
+   }
+}
+
 unsigned int
 ir_expression::get_num_operands(ir_expression_operation op)
 {
@@ -676,7 +826,7 @@ ir_constant::has_value(const ir_constant *c) const
 
    if (this->type->is_array()) {
       for (unsigned i = 0; i < this->type->length; i++) {
-        if (this->array_elements[i]->has_value(c->array_elements[i]))
+        if (!this->array_elements[i]->has_value(c->array_elements[i]))
            return false;
       }
       return true;
@@ -1175,6 +1325,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
    this->constant_value = NULL;
    this->origin_upper_left = false;
    this->pixel_center_integer = false;
+   this->used = false;
 
    if (type && type->base_type == GLSL_TYPE_SAMPLER)
       this->read_only = true;
index 8023a78dc2769119393895a7af11da0efa453de7..7b83c2836ee92e257dbfc703e1c060a39985d437 100644 (file)
@@ -122,6 +122,7 @@ public:
    virtual class ir_if *                as_if()               { return NULL; }
    virtual class ir_swizzle *           as_swizzle()          { return NULL; }
    virtual class ir_constant *          as_constant()         { return NULL; }
+   virtual class ir_discard *           as_discard()          { return NULL; }
    /*@}*/
 
 protected:
@@ -294,6 +295,15 @@ public:
    unsigned centroid:1;
    unsigned invariant:1;
 
+   /**
+    * Has this variable been used for reading or writing?
+    *
+    * Several GLSL semantic checks require knowledge of whether or not a
+    * variable has been used.  For example, it is an error to redeclare a
+    * variable as invariant after it has been used.
+    */
+   unsigned used:1;
+
    /**
     * Storage class of the variable.
     *
@@ -376,6 +386,8 @@ public:
 
    virtual ir_function_signature *clone(void *mem_ctx,
                                        struct hash_table *ht) const;
+   ir_function_signature *clone_prototype(void *mem_ctx,
+                                         struct hash_table *ht) const;
 
    virtual void accept(ir_visitor *v)
    {
@@ -842,12 +854,14 @@ public:
     * Constructor for unary operation expressions
     */
    ir_expression(int op, const struct glsl_type *type, ir_rvalue *);
+   ir_expression(int op, ir_rvalue *);
 
    /**
     * Constructor for binary operation expressions
     */
    ir_expression(int op, const struct glsl_type *type,
                 ir_rvalue *, ir_rvalue *);
+   ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1);
 
    /**
     * Constructor for quad operator expressions
@@ -1123,6 +1137,11 @@ public:
 
    virtual ir_visitor_status accept(ir_hierarchical_visitor *);
 
+   virtual ir_discard *as_discard()
+   {
+      return this;
+   }
+
    ir_rvalue *condition;
 };
 /*@}*/
@@ -1573,8 +1592,7 @@ _mesa_glsl_initialize_variables(exec_list *instructions,
                                struct _mesa_glsl_parse_state *state);
 
 extern void
-_mesa_glsl_initialize_functions(exec_list *instructions,
-                               struct _mesa_glsl_parse_state *state);
+_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state);
 
 extern void
 _mesa_glsl_release_functions(void);
index 325f60661541b37b073169fdf262dd0cb4c256a1..1522af682bb5d46ad0f185eb90d8cb36a214ac65 100644 (file)
@@ -275,14 +275,33 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const
 
 ir_function_signature *
 ir_function_signature::clone(void *mem_ctx, struct hash_table *ht) const
+{
+   ir_function_signature *copy = this->clone_prototype(mem_ctx, ht);
+
+   copy->is_defined = this->is_defined;
+
+   /* Clone the instruction list.
+    */
+   foreach_list_const(node, &this->body) {
+      const ir_instruction *const inst = (const ir_instruction *) node;
+
+      ir_instruction *const inst_copy = inst->clone(mem_ctx, ht);
+      copy->body.push_tail(inst_copy);
+   }
+
+   return copy;
+}
+
+ir_function_signature *
+ir_function_signature::clone_prototype(void *mem_ctx, struct hash_table *ht) const
 {
    ir_function_signature *copy =
       new(mem_ctx) ir_function_signature(this->return_type);
 
-   copy->is_defined = this->is_defined;
+   copy->is_defined = false;
    copy->is_builtin = this->is_builtin;
 
-   /* Clone the parameter list.
+   /* Clone the parameter list, but NOT the body.
     */
    foreach_list_const(node, &this->parameters) {
       const ir_variable *const param = (const ir_variable *) node;
@@ -293,15 +312,6 @@ ir_function_signature::clone(void *mem_ctx, struct hash_table *ht) const
       copy->parameters.push_tail(param_copy);
    }
 
-   /* Clone the instruction list.
-    */
-   foreach_list_const(node, &this->body) {
-      const ir_instruction *const inst = (const ir_instruction *) node;
-
-      ir_instruction *const inst_copy = inst->clone(mem_ctx, ht);
-      copy->body.push_tail(inst_copy);
-   }
-
    return copy;
 }
 
index f29f277ef4b50683848e08d8c3960e5ba7f43860..c367c30e44f37a7453481784d1f96b370ea2047a 100644 (file)
@@ -60,6 +60,8 @@ can_inline(ir_call *call)
 {
    ir_function_can_inline_visitor v;
    const ir_function_signature *callee = call->get_callee();
+   if (!callee->is_defined)
+      return false;
 
    v.run((exec_list *) &callee->body);
 
index 066137e60aab5d9b372a64f9788050803231bbd8..4e0b30aa90e155ee4ee4bf4430bb23c7b69e47eb 100644 (file)
@@ -64,7 +64,7 @@ public:
 
         /* Add the new function to the symbol table.
          */
-        this->symbols->add_function(this->function->name, this->function);
+        this->symbols->add_function(this->function);
       }
       return visit_continue;
    }
@@ -82,22 +82,7 @@ public:
    {
       assert(this->function != NULL);
 
-      ir_function_signature *copy =
-        new(mem_ctx) ir_function_signature(ir->return_type);
-
-      copy->is_defined = false;
-      copy->is_builtin = ir->is_builtin;
-
-      /* Clone the parameter list, but NOT the body.
-       */
-      foreach_list_const(node, &ir->parameters) {
-        const ir_variable *const param = (const ir_variable *) node;
-
-        assert(const_cast<ir_variable *>(param)->as_variable() != NULL);
-
-        ir_variable *const param_copy = param->clone(mem_ctx, NULL);
-        copy->parameters.push_tail(param_copy);
-      }
+      ir_function_signature *copy = ir->clone_prototype(mem_ctx, NULL);
 
       this->function->add_signature(copy);
 
index fa497a45551419ac136c0ce04ba9c6d7dce6fc0d..dbc9f4ab975d462b4eb75884bd165ef0f9420aad 100644 (file)
@@ -32,8 +32,9 @@
 #define SUB_TO_ADD_NEG 0x01
 #define DIV_TO_MUL_RCP 0x02
 #define EXP_TO_EXP2    0x04
-#define LOG_TO_LOG2    0x08
-#define MOD_TO_FRACT   0x10
+#define POW_TO_EXP2    0x08
+#define LOG_TO_LOG2    0x10
+#define MOD_TO_FRACT   0x20
 
 bool do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations);
 
@@ -51,7 +52,8 @@ bool do_function_inlining(exec_list *instructions);
 bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false, bool lower_break = false);
 bool do_lower_texture_projection(exec_list *instructions);
 bool do_if_simplification(exec_list *instructions);
-bool do_if_to_cond_assign(exec_list *instructions);
+bool do_discard_simplification(exec_list *instructions);
+bool lower_if_to_cond_assign(exec_list *instructions, unsigned max_depth = 0);
 bool do_mat_op_to_vec(exec_list *instructions);
 bool do_mod_to_fract(exec_list *instructions);
 bool do_noop_swizzle(exec_list *instructions);
@@ -61,6 +63,7 @@ bool do_swizzle_swizzle(exec_list *instructions);
 bool do_tree_grafting(exec_list *instructions);
 bool do_vec_index_to_cond_assign(exec_list *instructions);
 bool do_vec_index_to_swizzle(exec_list *instructions);
+bool lower_discard(exec_list *instructions);
 bool lower_instructions(exec_list *instructions, unsigned what_to_lower);
 bool lower_noise(exec_list *instructions);
 bool lower_variable_index_to_cond_assign(exec_list *instructions,
index e5067bfdad03856ebfbc251cec5ee7b854ba8685..c56bafd00c5430fd019614d6267df9145d0ea3ef 100644 (file)
@@ -153,17 +153,10 @@ void ir_print_visitor::visit(ir_function_signature *ir)
 
 void ir_print_visitor::visit(ir_function *ir)
 {
-   if (!ir->has_user_signature())
-      return;
-
    printf("(function %s\n", ir->name);
    indentation++;
    foreach_iter(exec_list_iterator, iter, *ir) {
       ir_function_signature *const sig = (ir_function_signature *) iter.get();
-
-      if (sig->is_builtin)
-        continue;
-
       indent();
       sig->accept(this);
       printf("\n");
@@ -288,9 +281,6 @@ void ir_print_visitor::visit(ir_assignment *ir)
 
    if (ir->condition)
       ir->condition->accept(this);
-   else
-      printf("(constant bool (1))");
-
 
    char mask[5];
    unsigned j = 0;
@@ -325,6 +315,15 @@ void ir_print_visitor::visit(ir_constant *ir)
    if (ir->type->is_array()) {
       for (unsigned i = 0; i < ir->type->length; i++)
         ir->get_array_element(i)->accept(this);
+   } else if (ir->type->is_record()) {
+      ir_constant *value = (ir_constant *) ir->components.get_head();
+      for (unsigned i = 0; i < ir->type->length; i++) {
+        printf("(%s ", ir->type->fields.structure->name);
+        value->accept(this);
+        printf(")");
+
+        value = (ir_constant *) value->next;
+      }
    } else {
       for (unsigned i = 0; i < ir->type->components(); i++) {
         if (i != 0)
index 7a22a945ec5aa956cb278428b59ae5980a512cc4..40901dc6c92ea0cd16350dbd789aaf63f41d7644 100644 (file)
@@ -21,8 +21,6 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <cstdarg>
-
 extern "C" {
 #include <talloc.h>
 }
@@ -34,69 +32,78 @@ extern "C" {
 
 const static bool debug = false;
 
-static void ir_read_error(_mesa_glsl_parse_state *, s_expression *,
-                         const char *fmt, ...);
-static const glsl_type *read_type(_mesa_glsl_parse_state *, s_expression *);
-
-static void scan_for_prototypes(_mesa_glsl_parse_state *, exec_list *,
-                               s_expression *);
-static ir_function *read_function(_mesa_glsl_parse_state *, s_list *,
-                                 bool skip_body);
-static void read_function_sig(_mesa_glsl_parse_state *, ir_function *,
-                             s_list *, bool skip_body);
-
-static void read_instructions(_mesa_glsl_parse_state *, exec_list *,
-                             s_expression *, ir_loop *);
-static ir_instruction *read_instruction(_mesa_glsl_parse_state *,
-                                       s_expression *, ir_loop *);
-static ir_variable *read_declaration(_mesa_glsl_parse_state *, s_list *);
-static ir_if *read_if(_mesa_glsl_parse_state *, s_list *, ir_loop *);
-static ir_loop *read_loop(_mesa_glsl_parse_state *st, s_list *list);
-static ir_return *read_return(_mesa_glsl_parse_state *, s_list *);
-
-static ir_rvalue *read_rvalue(_mesa_glsl_parse_state *, s_expression *);
-static ir_assignment *read_assignment(_mesa_glsl_parse_state *, s_list *);
-static ir_expression *read_expression(_mesa_glsl_parse_state *, s_list *);
-static ir_call *read_call(_mesa_glsl_parse_state *, s_list *);
-static ir_swizzle *read_swizzle(_mesa_glsl_parse_state *, s_list *);
-static ir_constant *read_constant(_mesa_glsl_parse_state *, s_list *);
-static ir_texture *read_texture(_mesa_glsl_parse_state *, s_list *);
-
-static ir_dereference *read_dereference(_mesa_glsl_parse_state *,
-                                       s_expression *);
-static ir_dereference_variable *
-read_var_ref(_mesa_glsl_parse_state *, s_list *);
-static ir_dereference_array *
-read_array_ref(_mesa_glsl_parse_state *, s_list *);
-static ir_dereference_record *
-read_record_ref(_mesa_glsl_parse_state *, s_list *);
+class ir_reader {
+public:
+   ir_reader(_mesa_glsl_parse_state *);
+
+   void read(exec_list *instructions, const char *src, bool scan_for_protos);
+
+private:
+   void *mem_ctx;
+   _mesa_glsl_parse_state *state;
+
+   void ir_read_error(s_expression *, const char *fmt, ...);
+
+   const glsl_type *read_type(s_expression *);
+
+   void scan_for_prototypes(exec_list *, s_expression *);
+   ir_function *read_function(s_expression *, bool skip_body);
+   void read_function_sig(ir_function *, s_expression *, bool skip_body);
+
+   void read_instructions(exec_list *, s_expression *, ir_loop *);
+   ir_instruction *read_instruction(s_expression *, ir_loop *);
+   ir_variable *read_declaration(s_expression *);
+   ir_if *read_if(s_expression *, ir_loop *);
+   ir_loop *read_loop(s_expression *);
+   ir_return *read_return(s_expression *);
+   ir_rvalue *read_rvalue(s_expression *);
+   ir_assignment *read_assignment(s_expression *);
+   ir_expression *read_expression(s_expression *);
+   ir_call *read_call(s_expression *);
+   ir_swizzle *read_swizzle(s_expression *);
+   ir_constant *read_constant(s_expression *);
+   ir_texture *read_texture(s_expression *);
+
+   ir_dereference *read_dereference(s_expression *);
+};
+
+ir_reader::ir_reader(_mesa_glsl_parse_state *state) : state(state)
+{
+   this->mem_ctx = state;
+}
 
 void
 _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions,
                   const char *src, bool scan_for_protos)
 {
-   s_expression *expr = s_expression::read_expression(state, src);
+   ir_reader r(state);
+   r.read(instructions, src, scan_for_protos);
+}
+
+void
+ir_reader::read(exec_list *instructions, const char *src, bool scan_for_protos)
+{
+   s_expression *expr = s_expression::read_expression(mem_ctx, src);
    if (expr == NULL) {
-      ir_read_error(state, NULL, "couldn't parse S-Expression.");
+      ir_read_error(NULL, "couldn't parse S-Expression.");
       return;
    }
    
    if (scan_for_protos) {
-      scan_for_prototypes(state, instructions, expr);
+      scan_for_prototypes(instructions, expr);
       if (state->error)
         return;
    }
 
-   read_instructions(state, instructions, expr, NULL);
+   read_instructions(instructions, expr, NULL);
    talloc_free(expr);
 
    if (debug)
       validate_ir_tree(instructions);
 }
 
-static void
-ir_read_error(_mesa_glsl_parse_state *state, s_expression *expr,
-             const char *fmt, ...)
+void
+ir_reader::ir_read_error(s_expression *expr, const char *fmt, ...)
 {
    va_list ap;
 
@@ -121,68 +128,43 @@ ir_read_error(_mesa_glsl_parse_state *state, s_expression *expr,
    }
 }
 
-static const glsl_type *
-read_type(_mesa_glsl_parse_state *st, s_expression *expr)
+const glsl_type *
+ir_reader::read_type(s_expression *expr)
 {
-   s_list *list = SX_AS_LIST(expr);
-   if (list != NULL) {
-      s_symbol *type_sym = SX_AS_SYMBOL(list->subexpressions.get_head());
-      if (type_sym == NULL) {
-        ir_read_error(st, expr, "expected type (array ...) or (struct ...)");
+   s_expression *s_base_type;
+   s_int *s_size;
+
+   s_pattern pat[] = { "array", s_base_type, s_size };
+   if (MATCH(expr, pat)) {
+      const glsl_type *base_type = read_type(s_base_type);
+      if (base_type == NULL) {
+        ir_read_error(NULL, "when reading base type of array type");
         return NULL;
       }
-      if (strcmp(type_sym->value(), "array") == 0) {
-        if (list->length() != 3) {
-           ir_read_error(st, expr, "expected type (array <type> <int>)");
-           return NULL;
-        }
 
-        // Read base type
-        s_expression *base_expr = (s_expression*) type_sym->next;
-        const glsl_type *base_type = read_type(st, base_expr);
-        if (base_type == NULL) {
-           ir_read_error(st, NULL, "when reading base type of array");
-           return NULL;
-        }
-
-        // Read array size
-        s_int *size = SX_AS_INT(base_expr->next);
-        if (size == NULL) {
-           ir_read_error(st, expr, "found non-integer array size");
-           return NULL;
-        }
-
-        return glsl_type::get_array_instance(base_type, size->value());
-      } else if (strcmp(type_sym->value(), "struct") == 0) {
-        assert(false); // FINISHME
-      } else {
-        ir_read_error(st, expr, "expected (array ...) or (struct ...); "
-                                "found (%s ...)", type_sym->value());
-        return NULL;
-      }
+      return glsl_type::get_array_instance(base_type, s_size->value());
    }
    
    s_symbol *type_sym = SX_AS_SYMBOL(expr);
    if (type_sym == NULL) {
-      ir_read_error(st, expr, "expected <type> (symbol or list)");
+      ir_read_error(expr, "expected <type>");
       return NULL;
    }
 
-   const glsl_type *type = st->symbols->get_type(type_sym->value());
+   const glsl_type *type = state->symbols->get_type(type_sym->value());
    if (type == NULL)
-      ir_read_error(st, expr, "invalid type: %s", type_sym->value());
+      ir_read_error(expr, "invalid type: %s", type_sym->value());
 
    return type;
 }
 
 
-static void
-scan_for_prototypes(_mesa_glsl_parse_state *st, exec_list *instructions,
-                   s_expression *expr)
+void
+ir_reader::scan_for_prototypes(exec_list *instructions, s_expression *expr)
 {
    s_list *list = SX_AS_LIST(expr);
    if (list == NULL) {
-      ir_read_error(st, expr, "Expected (<instruction> ...); found an atom.");
+      ir_read_error(expr, "Expected (<instruction> ...); found an atom.");
       return;
    }
 
@@ -195,94 +177,73 @@ scan_for_prototypes(_mesa_glsl_parse_state *st, exec_list *instructions,
       if (tag == NULL || strcmp(tag->value(), "function") != 0)
         continue; // not a (function ...); ignore it.
 
-      ir_function *f = read_function(st, sub, true);
+      ir_function *f = read_function(sub, true);
       if (f == NULL)
         return;
       instructions->push_tail(f);
    }
 }
 
-static ir_function *
-read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body)
+ir_function *
+ir_reader::read_function(s_expression *expr, bool skip_body)
 {
-   void *ctx = st;
    bool added = false;
-   if (list->length() < 3) {
-      ir_read_error(st, list, "Expected (function <name> (signature ...) ...)");
-      return NULL;
-   }
+   s_symbol *name;
 
-   s_symbol *name = SX_AS_SYMBOL(list->subexpressions.head->next);
-   if (name == NULL) {
-      ir_read_error(st, list, "Expected (function <name> ...)");
+   s_pattern pat[] = { "function", name };
+   if (!PARTIAL_MATCH(expr, pat)) {
+      ir_read_error(expr, "Expected (function <name> (signature ...) ...)");
       return NULL;
    }
 
-   ir_function *f = st->symbols->get_function(name->value());
+   ir_function *f = state->symbols->get_function(name->value());
    if (f == NULL) {
-      f = new(ctx) ir_function(name->value());
-      added = st->symbols->add_function(f->name, f);
+      f = new(mem_ctx) ir_function(name->value());
+      added = state->symbols->add_function(f);
       assert(added);
    }
 
-   exec_list_iterator it = list->subexpressions.iterator();
+   exec_list_iterator it = ((s_list *) expr)->subexpressions.iterator();
    it.next(); // skip "function" tag
    it.next(); // skip function name
    for (/* nothing */; it.has_next(); it.next()) {
-      s_list *siglist = SX_AS_LIST(it.get());
-      if (siglist == NULL) {
-        ir_read_error(st, list, "Expected (function (signature ...) ...)");
-        return NULL;
-      }
-
-      s_symbol *tag = SX_AS_SYMBOL(siglist->subexpressions.get_head());
-      if (tag == NULL || strcmp(tag->value(), "signature") != 0) {
-        ir_read_error(st, siglist, "Expected (signature ...)");
-        return NULL;
-      }
-
-      read_function_sig(st, f, siglist, skip_body);
+      s_expression *s_sig = (s_expression *) it.get();
+      read_function_sig(f, s_sig, skip_body);
    }
    return added ? f : NULL;
 }
 
-static void
-read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list,
-                 bool skip_body)
+void
+ir_reader::read_function_sig(ir_function *f, s_expression *expr, bool skip_body)
 {
-   void *ctx = st;
-   if (list->length() != 4) {
-      ir_read_error(st, list, "Expected (signature <type> (parameters ...) "
-                             "(<instruction> ...))");
+   s_expression *type_expr;
+   s_list *paramlist;
+   s_list *body_list;
+
+   s_pattern pat[] = { "signature", type_expr, paramlist, body_list };
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "Expected (signature <type> (parameters ...) "
+                         "(<instruction> ...))");
       return;
    }
 
-   s_expression *type_expr = (s_expression*) list->subexpressions.head->next;
-   const glsl_type *return_type = read_type(st, type_expr);
+   const glsl_type *return_type = read_type(type_expr);
    if (return_type == NULL)
       return;
 
-   s_list *paramlist = SX_AS_LIST(type_expr->next);
-   s_list *body_list = SX_AS_LIST(type_expr->next->next);
-   if (paramlist == NULL || body_list == NULL) {
-      ir_read_error(st, list, "Expected (signature <type> (parameters ...) "
-                             "(<instruction> ...))");
-      return;
-   }
    s_symbol *paramtag = SX_AS_SYMBOL(paramlist->subexpressions.get_head());
    if (paramtag == NULL || strcmp(paramtag->value(), "parameters") != 0) {
-      ir_read_error(st, paramlist, "Expected (parameters ...)");
+      ir_read_error(paramlist, "Expected (parameters ...)");
       return;
    }
 
    // Read the parameters list into a temporary place.
    exec_list hir_parameters;
-   st->symbols->push_scope();
+   state->symbols->push_scope();
 
    exec_list_iterator it = paramlist->subexpressions.iterator();
    for (it.next() /* skip "parameters" */; it.has_next(); it.next()) {
-      s_list *decl = SX_AS_LIST(it.get());
-      ir_variable *var = read_declaration(st, decl);
+      ir_variable *var = read_declaration((s_expression *) it.get());
       if (var == NULL)
         return;
 
@@ -292,25 +253,25 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list,
    ir_function_signature *sig = f->exact_matching_signature(&hir_parameters);
    if (sig == NULL && skip_body) {
       /* If scanning for prototypes, generate a new signature. */
-      sig = new(ctx) ir_function_signature(return_type);
+      sig = new(mem_ctx) ir_function_signature(return_type);
       sig->is_builtin = true;
       f->add_signature(sig);
    } else if (sig != NULL) {
       const char *badvar = sig->qualifiers_match(&hir_parameters);
       if (badvar != NULL) {
-        ir_read_error(st, list, "function `%s' parameter `%s' qualifiers "
+        ir_read_error(expr, "function `%s' parameter `%s' qualifiers "
                       "don't match prototype", f->name, badvar);
         return;
       }
 
       if (sig->return_type != return_type) {
-        ir_read_error(st, list, "function `%s' return type doesn't "
+        ir_read_error(expr, "function `%s' return type doesn't "
                       "match prototype", f->name);
         return;
       }
    } else {
       /* No prototype for this body exists - skip it. */
-      st->symbols->pop_scope();
+      state->symbols->pop_scope();
       return;
    }
    assert(sig != NULL);
@@ -319,39 +280,39 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list,
 
    if (!skip_body && !body_list->subexpressions.is_empty()) {
       if (sig->is_defined) {
-        ir_read_error(st, list, "function %s redefined", f->name);
+        ir_read_error(expr, "function %s redefined", f->name);
         return;
       }
-      st->current_function = sig;
-      read_instructions(st, &sig->body, body_list, NULL);
-      st->current_function = NULL;
+      state->current_function = sig;
+      read_instructions(&sig->body, body_list, NULL);
+      state->current_function = NULL;
       sig->is_defined = true;
    }
 
-   st->symbols->pop_scope();
+   state->symbols->pop_scope();
 }
 
-static void
-read_instructions(_mesa_glsl_parse_state *st, exec_list *instructions,
-                 s_expression *expr, ir_loop *loop_ctx)
+void
+ir_reader::read_instructions(exec_list *instructions, s_expression *expr,
+                            ir_loop *loop_ctx)
 {
    // Read in a list of instructions
    s_list *list = SX_AS_LIST(expr);
    if (list == NULL) {
-      ir_read_error(st, expr, "Expected (<instruction> ...); found an atom.");
+      ir_read_error(expr, "Expected (<instruction> ...); found an atom.");
       return;
    }
 
    foreach_iter(exec_list_iterator, it, list->subexpressions) {
       s_expression *sub = (s_expression*) it.get();
-      ir_instruction *ir = read_instruction(st, sub, loop_ctx);
+      ir_instruction *ir = read_instruction(sub, loop_ctx);
       if (ir != NULL) {
         /* Global variable declarations should be moved to the top, before
          * any functions that might use them.  Functions are added to the
          * instruction stream when scanning for prototypes, so without this
          * hack, they always appear before variable declarations.
          */
-        if (st->current_function == NULL && ir->as_variable() != NULL)
+        if (state->current_function == NULL && ir->as_variable() != NULL)
            instructions->push_head(ir);
         else
            instructions->push_tail(ir);
@@ -360,88 +321,74 @@ read_instructions(_mesa_glsl_parse_state *st, exec_list *instructions,
 }
 
 
-static ir_instruction *
-read_instruction(_mesa_glsl_parse_state *st, s_expression *expr,
-                ir_loop *loop_ctx)
+ir_instruction *
+ir_reader::read_instruction(s_expression *expr, ir_loop *loop_ctx)
 {
-   void *ctx = st;
    s_symbol *symbol = SX_AS_SYMBOL(expr);
    if (symbol != NULL) {
       if (strcmp(symbol->value(), "break") == 0 && loop_ctx != NULL)
-        return new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
+        return new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break);
       if (strcmp(symbol->value(), "continue") == 0 && loop_ctx != NULL)
-        return new(ctx) ir_loop_jump(ir_loop_jump::jump_continue);
+        return new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_continue);
    }
 
    s_list *list = SX_AS_LIST(expr);
    if (list == NULL || list->subexpressions.is_empty()) {
-      ir_read_error(st, expr, "Invalid instruction.\n");
+      ir_read_error(expr, "Invalid instruction.\n");
       return NULL;
    }
 
    s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.get_head());
    if (tag == NULL) {
-      ir_read_error(st, expr, "expected instruction tag");
+      ir_read_error(expr, "expected instruction tag");
       return NULL;
    }
 
    ir_instruction *inst = NULL;
    if (strcmp(tag->value(), "declare") == 0) {
-      inst = read_declaration(st, list);
+      inst = read_declaration(list);
    } else if (strcmp(tag->value(), "assign") == 0) {
-      inst = read_assignment(st, list);
+      inst = read_assignment(list);
    } else if (strcmp(tag->value(), "if") == 0) {
-      inst = read_if(st, list, loop_ctx);
+      inst = read_if(list, loop_ctx);
    } else if (strcmp(tag->value(), "loop") == 0) {
-      inst = read_loop(st, list);
+      inst = read_loop(list);
    } else if (strcmp(tag->value(), "return") == 0) {
-      inst = read_return(st, list);
+      inst = read_return(list);
    } else if (strcmp(tag->value(), "function") == 0) {
-      inst = read_function(st, list, false);
+      inst = read_function(list, false);
    } else {
-      inst = read_rvalue(st, list);
+      inst = read_rvalue(list);
       if (inst == NULL)
-        ir_read_error(st, NULL, "when reading instruction");
+        ir_read_error(NULL, "when reading instruction");
    }
    return inst;
 }
 
-
-static ir_variable *
-read_declaration(_mesa_glsl_parse_state *st, s_list *list)
+ir_variable *
+ir_reader::read_declaration(s_expression *expr)
 {
-   void *ctx = st;
-   if (list->length() != 4) {
-      ir_read_error(st, list, "expected (declare (<qualifiers>) <type> "
-                             "<name>)");
-      return NULL;
-   }
+   s_list *s_quals;
+   s_expression *s_type;
+   s_symbol *s_name;
 
-   s_list *quals = SX_AS_LIST(list->subexpressions.head->next);
-   if (quals == NULL) {
-      ir_read_error(st, list, "expected a list of variable qualifiers");
+   s_pattern pat[] = { "declare", s_quals, s_type, s_name };
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (declare (<qualifiers>) <type> <name>)");
       return NULL;
    }
 
-   s_expression *type_expr = (s_expression*) quals->next;
-   const glsl_type *type = read_type(st, type_expr);
+   const glsl_type *type = read_type(s_type);
    if (type == NULL)
       return NULL;
 
-   s_symbol *var_name = SX_AS_SYMBOL(type_expr->next);
-   if (var_name == NULL) {
-      ir_read_error(st, list, "expected variable name, found non-symbol");
-      return NULL;
-   }
-
-   ir_variable *var = new(ctx) ir_variable(type, var_name->value(),
-                                          ir_var_auto);
+   ir_variable *var = new(mem_ctx) ir_variable(type, s_name->value(),
+                                              ir_var_auto);
 
-   foreach_iter(exec_list_iterator, it, quals->subexpressions) {
+   foreach_iter(exec_list_iterator, it, s_quals->subexpressions) {
       s_symbol *qualifier = SX_AS_SYMBOL(it.get());
       if (qualifier == NULL) {
-        ir_read_error(st, list, "qualifier list must contain only symbols");
-        delete var;
+        ir_read_error(expr, "qualifier list must contain only symbols");
         return NULL;
       }
 
@@ -467,44 +414,42 @@ read_declaration(_mesa_glsl_parse_state *st, s_list *list)
       } else if (strcmp(qualifier->value(), "noperspective") == 0) {
         var->interpolation = ir_var_noperspective;
       } else {
-        ir_read_error(st, list, "unknown qualifier: %s", qualifier->value());
-        delete var;
+        ir_read_error(expr, "unknown qualifier: %s", qualifier->value());
         return NULL;
       }
    }
 
    // Add the variable to the symbol table
-   st->symbols->add_variable(var->name, var);
+   state->symbols->add_variable(var);
 
    return var;
 }
 
 
-static ir_if *
-read_if(_mesa_glsl_parse_state *st, s_list *list, ir_loop *loop_ctx)
+ir_if *
+ir_reader::read_if(s_expression *expr, ir_loop *loop_ctx)
 {
-   void *ctx = st;
-   if (list->length() != 4) {
-      ir_read_error(st, list, "expected (if <condition> (<then> ...) "
-                          "(<else> ...))");
+   s_expression *s_cond;
+   s_expression *s_then;
+   s_expression *s_else;
+
+   s_pattern pat[] = { "if", s_cond, s_then, s_else };
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (if <condition> (<then>...) (<else>...))");
       return NULL;
    }
 
-   s_expression *cond_expr = (s_expression*) list->subexpressions.head->next;
-   ir_rvalue *condition = read_rvalue(st, cond_expr);
+   ir_rvalue *condition = read_rvalue(s_cond);
    if (condition == NULL) {
-      ir_read_error(st, NULL, "when reading condition of (if ...)");
+      ir_read_error(NULL, "when reading condition of (if ...)");
       return NULL;
    }
 
-   s_expression *then_expr = (s_expression*) cond_expr->next;
-   s_expression *else_expr = (s_expression*) then_expr->next;
+   ir_if *iff = new(mem_ctx) ir_if(condition);
 
-   ir_if *iff = new(ctx) ir_if(condition);
-
-   read_instructions(st, &iff->then_instructions, then_expr, loop_ctx);
-   read_instructions(st, &iff->else_instructions, else_expr, loop_ctx);
-   if (st->error) {
+   read_instructions(&iff->then_instructions, s_then, loop_ctx);
+   read_instructions(&iff->else_instructions, s_else, loop_ctx);
+   if (state->error) {
       delete iff;
       iff = NULL;
    }
@@ -512,27 +457,23 @@ read_if(_mesa_glsl_parse_state *st, s_list *list, ir_loop *loop_ctx)
 }
 
 
-static ir_loop *
-read_loop(_mesa_glsl_parse_state *st, s_list *list)
+ir_loop *
+ir_reader::read_loop(s_expression *expr)
 {
-   void *ctx = st;
-   if (list->length() != 6) {
-      ir_read_error(st, list, "expected (loop <counter> <from> <to> "
-                             "<increment> <body>)");
+   s_expression *s_counter, *s_from, *s_to, *s_inc, *s_body;
+
+   s_pattern pat[] = { "loop", s_counter, s_from, s_to, s_inc, s_body };
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (loop <counter> <from> <to> "
+                         "<increment> <body>)");
       return NULL;
    }
 
-   s_expression *count_expr = (s_expression*) list->subexpressions.head->next;
-   s_expression *from_expr  = (s_expression*) count_expr->next;
-   s_expression *to_expr    = (s_expression*) from_expr->next;
-   s_expression *inc_expr   = (s_expression*) to_expr->next;
-   s_expression *body_expr  = (s_expression*) inc_expr->next;
-
    // FINISHME: actually read the count/from/to fields.
 
-   ir_loop *loop = new(ctx) ir_loop;
-   read_instructions(st, &loop->body_instructions, body_expr, loop);
-   if (st->error) {
+   ir_loop *loop = new(mem_ctx) ir_loop;
+   read_instructions(&loop->body_instructions, s_body, loop);
+   if (state->error) {
       delete loop;
       loop = NULL;
    }
@@ -540,29 +481,29 @@ read_loop(_mesa_glsl_parse_state *st, s_list *list)
 }
 
 
-static ir_return *
-read_return(_mesa_glsl_parse_state *st, s_list *list)
+ir_return *
+ir_reader::read_return(s_expression *expr)
 {
-   void *ctx = st;
-   if (list->length() != 2) {
-      ir_read_error(st, list, "expected (return <rvalue>)");
+   s_expression *s_retval;
+
+   s_pattern pat[] = { "return", s_retval};
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (return <rvalue>)");
       return NULL;
    }
 
-   s_expression *expr = (s_expression*) list->subexpressions.head->next;
-
-   ir_rvalue *retval = read_rvalue(st, expr);
+   ir_rvalue *retval = read_rvalue(s_retval);
    if (retval == NULL) {
-      ir_read_error(st, NULL, "when reading return value");
+      ir_read_error(NULL, "when reading return value");
       return NULL;
    }
 
-   return new(ctx) ir_return(retval);
+   return new(mem_ctx) ir_return(retval);
 }
 
 
-static ir_rvalue *
-read_rvalue(_mesa_glsl_parse_state *st, s_expression *expr)
+ir_rvalue *
+ir_reader::read_rvalue(s_expression *expr)
 {
    s_list *list = SX_AS_LIST(expr);
    if (list == NULL || list->subexpressions.is_empty())
@@ -570,68 +511,63 @@ read_rvalue(_mesa_glsl_parse_state *st, s_expression *expr)
 
    s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.get_head());
    if (tag == NULL) {
-      ir_read_error(st, expr, "expected rvalue tag");
+      ir_read_error(expr, "expected rvalue tag");
       return NULL;
    }
 
-   ir_rvalue *rvalue = read_dereference(st, list);
-   if (rvalue != NULL || st->error)
+   ir_rvalue *rvalue = read_dereference(list);
+   if (rvalue != NULL || state->error)
       return rvalue;
    else if (strcmp(tag->value(), "swiz") == 0) {
-      rvalue = read_swizzle(st, list);
+      rvalue = read_swizzle(list);
    } else if (strcmp(tag->value(), "expression") == 0) {
-      rvalue = read_expression(st, list);
+      rvalue = read_expression(list);
    } else if (strcmp(tag->value(), "call") == 0) {
-      rvalue = read_call(st, list);
+      rvalue = read_call(list);
    } else if (strcmp(tag->value(), "constant") == 0) {
-      rvalue = read_constant(st, list);
+      rvalue = read_constant(list);
    } else {
-      rvalue = read_texture(st, list);
-      if (rvalue == NULL && !st->error)
-        ir_read_error(st, expr, "unrecognized rvalue tag: %s", tag->value());
+      rvalue = read_texture(list);
+      if (rvalue == NULL && !state->error)
+        ir_read_error(expr, "unrecognized rvalue tag: %s", tag->value());
    }
 
    return rvalue;
 }
 
-static ir_assignment *
-read_assignment(_mesa_glsl_parse_state *st, s_list *list)
+ir_assignment *
+ir_reader::read_assignment(s_expression *expr)
 {
-   void *ctx = st;
-   if (list->length() != 5) {
-      ir_read_error(st, list, "expected (assign <condition> (<write mask>) "
-                             "<lhs> <rhs>)");
-      return NULL;
-   }
-
-   s_expression *cond_expr = (s_expression*) list->subexpressions.head->next;
-   s_list       *mask_list = SX_AS_LIST(cond_expr->next);
-   s_expression *lhs_expr  = (s_expression*) cond_expr->next->next;
-   s_expression *rhs_expr  = (s_expression*) lhs_expr->next;
+   s_expression *cond_expr = NULL;
+   s_expression *lhs_expr, *rhs_expr;
+   s_list       *mask_list;
 
-   ir_rvalue *condition = read_rvalue(st, cond_expr);
-   if (condition == NULL) {
-      ir_read_error(st, NULL, "when reading condition of assignment");
+   s_pattern pat4[] = { "assign",            mask_list, lhs_expr, rhs_expr };
+   s_pattern pat5[] = { "assign", cond_expr, mask_list, lhs_expr, rhs_expr };
+   if (!MATCH(expr, pat4) && !MATCH(expr, pat5)) {
+      ir_read_error(expr, "expected (assign [<condition>] (<write mask>) "
+                         "<lhs> <rhs>)");
       return NULL;
    }
 
-   if (mask_list == NULL || mask_list->length() > 1) {
-      ir_read_error(st, mask_list, "expected () or (<write mask>)");
-      return NULL;
+   ir_rvalue *condition = NULL;
+   if (cond_expr != NULL) {
+      condition = read_rvalue(cond_expr);
+      if (condition == NULL) {
+        ir_read_error(NULL, "when reading condition of assignment");
+        return NULL;
+      }
    }
 
    unsigned mask = 0;
-   if (mask_list->length() == 1) {
-      s_symbol *mask_symbol = SX_AS_SYMBOL(mask_list->subexpressions.head);
-      if (mask_symbol == NULL) {
-        ir_read_error(st, list, "expected a write mask; found non-symbol");
-        return NULL;
-      }
 
+   s_symbol *mask_symbol;
+   s_pattern mask_pat[] = { mask_symbol };
+   if (MATCH(mask_list, mask_pat)) {
       const char *mask_str = mask_symbol->value();
       unsigned mask_length = strlen(mask_str);
       if (mask_length > 4) {
-        ir_read_error(st, list, "invalid write mask: %s", mask_str);
+        ir_read_error(expr, "invalid write mask: %s", mask_str);
         return NULL;
       }
 
@@ -639,47 +575,46 @@ read_assignment(_mesa_glsl_parse_state *st, s_list *list)
 
       for (unsigned i = 0; i < mask_length; i++) {
         if (mask_str[i] < 'w' || mask_str[i] > 'z') {
-           ir_read_error(st, list, "write mask contains invalid character: %c",
+           ir_read_error(expr, "write mask contains invalid character: %c",
                          mask_str[i]);
            return NULL;
         }
         mask |= 1 << idx_map[mask_str[i] - 'w'];
       }
+   } else if (!mask_list->subexpressions.is_empty()) {
+      ir_read_error(mask_list, "expected () or (<write mask>)");
+      return NULL;
    }
 
-   ir_dereference *lhs = read_dereference(st, lhs_expr);
+   ir_dereference *lhs = read_dereference(lhs_expr);
    if (lhs == NULL) {
-      ir_read_error(st, NULL, "when reading left-hand side of assignment");
+      ir_read_error(NULL, "when reading left-hand side of assignment");
       return NULL;
    }
 
-   ir_rvalue *rhs = read_rvalue(st, rhs_expr);
+   ir_rvalue *rhs = read_rvalue(rhs_expr);
    if (rhs == NULL) {
-      ir_read_error(st, NULL, "when reading right-hand side of assignment");
+      ir_read_error(NULL, "when reading right-hand side of assignment");
       return NULL;
    }
 
    if (mask == 0 && (lhs->type->is_vector() || lhs->type->is_scalar())) {
-      ir_read_error(st, list, "non-zero write mask required.");
+      ir_read_error(expr, "non-zero write mask required.");
       return NULL;
    }
 
-   return new(ctx) ir_assignment(lhs, rhs, condition, mask);
+   return new(mem_ctx) ir_assignment(lhs, rhs, condition, mask);
 }
 
-static ir_call *
-read_call(_mesa_glsl_parse_state *st, s_list *list)
+ir_call *
+ir_reader::read_call(s_expression *expr)
 {
-   void *ctx = st;
-   if (list->length() != 3) {
-      ir_read_error(st, list, "expected (call <name> (<param> ...))");
-      return NULL;
-   }
+   s_symbol *name;
+   s_list *params;
 
-   s_symbol *name = SX_AS_SYMBOL(list->subexpressions.head->next);
-   s_list *params = SX_AS_LIST(list->subexpressions.head->next->next);
-   if (name == NULL || params == NULL) {
-      ir_read_error(st, list, "expected (call <name> (<param> ...))");
+   s_pattern pat[] = { "call", name, params };
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (call <name> (<param> ...))");
       return NULL;
    }
 
@@ -687,173 +622,156 @@ read_call(_mesa_glsl_parse_state *st, s_list *list)
 
    foreach_iter(exec_list_iterator, it, params->subexpressions) {
       s_expression *expr = (s_expression*) it.get();
-      ir_rvalue *param = read_rvalue(st, expr);
+      ir_rvalue *param = read_rvalue(expr);
       if (param == NULL) {
-        ir_read_error(st, list, "when reading parameter to function call");
+        ir_read_error(expr, "when reading parameter to function call");
         return NULL;
       }
       parameters.push_tail(param);
    }
 
-   ir_function *f = st->symbols->get_function(name->value());
+   ir_function *f = state->symbols->get_function(name->value());
    if (f == NULL) {
-      ir_read_error(st, list, "found call to undefined function %s",
+      ir_read_error(expr, "found call to undefined function %s",
                    name->value());
       return NULL;
    }
 
    ir_function_signature *callee = f->matching_signature(&parameters);
    if (callee == NULL) {
-      ir_read_error(st, list, "couldn't find matching signature for function "
+      ir_read_error(expr, "couldn't find matching signature for function "
                     "%s", name->value());
       return NULL;
    }
 
-   return new(ctx) ir_call(callee, &parameters);
+   return new(mem_ctx) ir_call(callee, &parameters);
 }
 
-static ir_expression *
-read_expression(_mesa_glsl_parse_state *st, s_list *list)
+ir_expression *
+ir_reader::read_expression(s_expression *expr)
 {
-   void *ctx = st;
-   const unsigned list_length = list->length();
-   if (list_length < 4) {
-      ir_read_error(st, list, "expected (expression <type> <operator> "
-                             "<operand> [<operand>])");
+   s_expression *s_type;
+   s_symbol *s_op;
+   s_expression *s_arg1;
+
+   s_pattern pat[] = { "expression", s_type, s_op, s_arg1 };
+   if (!PARTIAL_MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (expression <type> <operator> "
+                         "<operand> [<operand>])");
       return NULL;
    }
+   s_expression *s_arg2 = (s_expression *) s_arg1->next; // may be tail sentinel
 
-   s_expression *type_expr = (s_expression*) list->subexpressions.head->next;
-   const glsl_type *type = read_type(st, type_expr);
+   const glsl_type *type = read_type(s_type);
    if (type == NULL)
       return NULL;
 
    /* Read the operator */
-   s_symbol *op_sym = SX_AS_SYMBOL(type_expr->next);
-   if (op_sym == NULL) {
-      ir_read_error(st, list, "expected operator, found non-symbol");
-      return NULL;
-   }
-
-   ir_expression_operation op = ir_expression::get_operator(op_sym->value());
+   ir_expression_operation op = ir_expression::get_operator(s_op->value());
    if (op == (ir_expression_operation) -1) {
-      ir_read_error(st, list, "invalid operator: %s", op_sym->value());
+      ir_read_error(expr, "invalid operator: %s", s_op->value());
       return NULL;
    }
     
-   /* Now that we know the operator, check for the right number of operands */ 
-   if (ir_expression::get_num_operands(op) == 2) {
-      if (list_length != 5) {
-        ir_read_error(st, list, "expected (expression <type> %s <operand> "
-                                " <operand>)", op_sym->value());
-        return NULL;
-      }
-   } else {
-      if (list_length != 4) {
-        ir_read_error(st, list, "expected (expression <type> %s <operand>)",
-                      op_sym->value());
-        return NULL;
-      }
+   unsigned num_operands = ir_expression::get_num_operands(op);
+   if (num_operands == 1 && !s_arg1->next->is_tail_sentinel()) {
+      ir_read_error(expr, "expected (expression <type> %s <operand>)",
+                   s_op->value());
+      return NULL;
    }
 
-   s_expression *exp1 = (s_expression*) (op_sym->next);
-   ir_rvalue *arg1 = read_rvalue(st, exp1);
+   ir_rvalue *arg1 = read_rvalue(s_arg1);
+   ir_rvalue *arg2 = NULL;
    if (arg1 == NULL) {
-      ir_read_error(st, NULL, "when reading first operand of %s",
-                   op_sym->value());
+      ir_read_error(NULL, "when reading first operand of %s", s_op->value());
       return NULL;
    }
 
-   ir_rvalue *arg2 = NULL;
-   if (ir_expression::get_num_operands(op) == 2) {
-      s_expression *exp2 = (s_expression*) (exp1->next);
-      arg2 = read_rvalue(st, exp2);
+   if (num_operands == 2) {
+      if (s_arg2->is_tail_sentinel() || !s_arg2->next->is_tail_sentinel()) {
+        ir_read_error(expr, "expected (expression <type> %s <operand> "
+                            "<operand>)", s_op->value());
+        return NULL;
+      }
+      arg2 = read_rvalue(s_arg2);
       if (arg2 == NULL) {
-        ir_read_error(st, NULL, "when reading second operand of %s",
-                      op_sym->value());
+        ir_read_error(NULL, "when reading second operand of %s",
+                      s_op->value());
         return NULL;
       }
    }
 
-   return new(ctx) ir_expression(op, type, arg1, arg2);
+   return new(mem_ctx) ir_expression(op, type, arg1, arg2);
 }
 
-static ir_swizzle *
-read_swizzle(_mesa_glsl_parse_state *st, s_list *list)
+ir_swizzle *
+ir_reader::read_swizzle(s_expression *expr)
 {
-   if (list->length() != 3) {
-      ir_read_error(st, list, "expected (swiz <swizzle> <rvalue>)");
-      return NULL;
-   }
+   s_symbol *swiz;
+   s_expression *sub;
 
-   s_symbol *swiz = SX_AS_SYMBOL(list->subexpressions.head->next);
-   if (swiz == NULL) {
-      ir_read_error(st, list, "expected a valid swizzle; found non-symbol");
+   s_pattern pat[] = { "swiz", swiz, sub };
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (swiz <swizzle> <rvalue>)");
       return NULL;
    }
 
    if (strlen(swiz->value()) > 4) {
-      ir_read_error(st, list, "expected a valid swizzle; found %s",
-                   swiz->value());
+      ir_read_error(expr, "expected a valid swizzle; found %s", swiz->value());
       return NULL;
    }
 
-   s_expression *sub = (s_expression*) swiz->next;
-   ir_rvalue *rvalue = read_rvalue(st, sub);
+   ir_rvalue *rvalue = read_rvalue(sub);
    if (rvalue == NULL)
       return NULL;
 
    ir_swizzle *ir = ir_swizzle::create(rvalue, swiz->value(),
                                       rvalue->type->vector_elements);
    if (ir == NULL)
-      ir_read_error(st, list, "invalid swizzle");
+      ir_read_error(expr, "invalid swizzle");
 
    return ir;
 }
 
-static ir_constant *
-read_constant(_mesa_glsl_parse_state *st, s_list *list)
+ir_constant *
+ir_reader::read_constant(s_expression *expr)
 {
-   void *ctx = st;
-   if (list->length() != 3) {
-      ir_read_error(st, list, "expected (constant <type> (...))");
+   s_expression *type_expr;
+   s_list *values;
+
+   s_pattern pat[] = { "constant", type_expr, values };
+   if (!MATCH(expr, pat)) {
+      ir_read_error(expr, "expected (constant <type> (...))");
       return NULL;
    }
 
-   s_expression *type_expr = (s_expression*) list->subexpressions.head->next;
-   const glsl_type *type = read_type(st, type_expr);
+   const glsl_type *type = read_type(type_expr);
    if (type == NULL)
       return NULL;
 
-   s_list *values = SX_AS_LIST(type_expr->next);
    if (values == NULL) {
-      ir_read_error(st, list, "expected (constant <type> (...))");
+      ir_read_error(expr, "expected (constant <type> (...))");
       return NULL;
    }
 
    if (type->is_array()) {
-      const unsigned elements_supplied = values->length();
-      if (elements_supplied != type->length) {
-        ir_read_error(st, values, "expected exactly %u array elements, "
-                      "given %u", type->length, elements_supplied);
-        return NULL;
-      }
-
+      unsigned elements_supplied = 0;
       exec_list elements;
       foreach_iter(exec_list_iterator, it, values->subexpressions) {
-        s_expression *expr = (s_expression *) it.get();
-        s_list *elt = SX_AS_LIST(expr);
-        if (elt == NULL) {
-           ir_read_error(st, expr, "expected (constant ...) array element");
-           return NULL;
-        }
-
-        ir_constant *ir_elt = read_constant(st, elt);
+        s_expression *elt = (s_expression *) it.get();
+        ir_constant *ir_elt = read_constant(elt);
         if (ir_elt == NULL)
            return NULL;
         elements.push_tail(ir_elt);
+        elements_supplied++;
+      }
+
+      if (elements_supplied != type->length) {
+        ir_read_error(values, "expected exactly %u array elements, "
+                      "given %u", type->length, elements_supplied);
+        return NULL;
       }
-      return new(ctx) ir_constant(type, &elements);
+      return new(mem_ctx) ir_constant(type, &elements);
    }
 
    const glsl_type *const base_type = type->get_base_type();
@@ -864,7 +782,7 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list)
    int k = 0;
    foreach_iter(exec_list_iterator, it, values->subexpressions) {
       if (k >= 16) {
-        ir_read_error(st, values, "expected at most 16 numbers");
+        ir_read_error(values, "expected at most 16 numbers");
         return NULL;
       }
 
@@ -873,14 +791,14 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list)
       if (base_type->base_type == GLSL_TYPE_FLOAT) {
         s_number *value = SX_AS_NUMBER(expr);
         if (value == NULL) {
-           ir_read_error(st, values, "expected numbers");
+           ir_read_error(values, "expected numbers");
            return NULL;
         }
         data.f[k] = value->fvalue();
       } else {
         s_int *value = SX_AS_INT(expr);
         if (value == NULL) {
-           ir_read_error(st, values, "expected integers");
+           ir_read_error(values, "expected integers");
            return NULL;
         }
 
@@ -898,246 +816,185 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list)
            break;
         }
         default:
-           ir_read_error(st, values, "unsupported constant type");
+           ir_read_error(values, "unsupported constant type");
            return NULL;
         }
       }
       ++k;
    }
 
-   return new(ctx) ir_constant(type, &data);
+   return new(mem_ctx) ir_constant(type, &data);
 }
 
-static ir_dereference *
-read_dereference(_mesa_glsl_parse_state *st, s_expression *expr)
+ir_dereference *
+ir_reader::read_dereference(s_expression *expr)
 {
-   s_list *list = SX_AS_LIST(expr);
-   if (list == NULL || list->subexpressions.is_empty())
-      return NULL;
-
-   s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head);
-   assert(tag != NULL);
-
-   if (strcmp(tag->value(), "var_ref") == 0)
-      return read_var_ref(st, list);
-   if (strcmp(tag->value(), "array_ref") == 0)
-      return read_array_ref(st, list);
-   if (strcmp(tag->value(), "record_ref") == 0)
-      return read_record_ref(st, list);
-   return NULL;
-}
-
-static ir_dereference_variable *
-read_var_ref(_mesa_glsl_parse_state *st, s_list *list)
-{
-   void *ctx = st;
-   if (list->length() != 2) {
-      ir_read_error(st, list, "expected (var_ref <variable name>)");
-      return NULL;
-   }
-   s_symbol *var_name = SX_AS_SYMBOL(list->subexpressions.head->next);
-   if (var_name == NULL) {
-      ir_read_error(st, list, "expected (var_ref <variable name>)");
-      return NULL;
-   }
-
-   ir_variable *var = st->symbols->get_variable(var_name->value());
-   if (var == NULL) {
-      ir_read_error(st, list, "undeclared variable: %s", var_name->value());
-      return NULL;
-   }
-
-   return new(ctx) ir_dereference_variable(var);
-}
-
-static ir_dereference_array *
-read_array_ref(_mesa_glsl_parse_state *st, s_list *list)
-{
-   void *ctx = st;
-   if (list->length() != 3) {
-      ir_read_error(st, list, "expected (array_ref <rvalue> <index>)");
-      return NULL;
-   }
-
-   s_expression *subj_expr = (s_expression*) list->subexpressions.head->next;
-   ir_rvalue *subject = read_rvalue(st, subj_expr);
-   if (subject == NULL) {
-      ir_read_error(st, NULL, "when reading the subject of an array_ref");
-      return NULL;
-   }
-
-   s_expression *idx_expr = (s_expression*) subj_expr->next;
-   ir_rvalue *idx = read_rvalue(st, idx_expr);
-   return new(ctx) ir_dereference_array(subject, idx);
-}
-
-static ir_dereference_record *
-read_record_ref(_mesa_glsl_parse_state *st, s_list *list)
-{
-   void *ctx = st;
-   if (list->length() != 3) {
-      ir_read_error(st, list, "expected (record_ref <rvalue> <field>)");
-      return NULL;
-   }
-
-   s_expression *subj_expr = (s_expression*) list->subexpressions.head->next;
-   ir_rvalue *subject = read_rvalue(st, subj_expr);
-   if (subject == NULL) {
-      ir_read_error(st, NULL, "when reading the subject of a record_ref");
-      return NULL;
-   }
+   s_symbol *s_var;
+   s_expression *s_subject;
+   s_expression *s_index;
+   s_symbol *s_field;
+
+   s_pattern var_pat[] = { "var_ref", s_var };
+   s_pattern array_pat[] = { "array_ref", s_subject, s_index };
+   s_pattern record_pat[] = { "record_ref", s_subject, s_field };
+
+   if (MATCH(expr, var_pat)) {
+      ir_variable *var = state->symbols->get_variable(s_var->value());
+      if (var == NULL) {
+        ir_read_error(expr, "undeclared variable: %s", s_var->value());
+        return NULL;
+      }
+      return new(mem_ctx) ir_dereference_variable(var);
+   } else if (MATCH(expr, array_pat)) {
+      ir_rvalue *subject = read_rvalue(s_subject);
+      if (subject == NULL) {
+        ir_read_error(NULL, "when reading the subject of an array_ref");
+        return NULL;
+      }
 
-   s_symbol *field = SX_AS_SYMBOL(subj_expr->next);
-   if (field == NULL) {
-      ir_read_error(st, list, "expected (record_ref ... <field name>)");
-      return NULL;
+      ir_rvalue *idx = read_rvalue(s_index);
+      if (subject == NULL) {
+        ir_read_error(NULL, "when reading the index of an array_ref");
+        return NULL;
+      }
+      return new(mem_ctx) ir_dereference_array(subject, idx);
+   } else if (MATCH(expr, record_pat)) {
+      ir_rvalue *subject = read_rvalue(s_subject);
+      if (subject == NULL) {
+        ir_read_error(NULL, "when reading the subject of a record_ref");
+        return NULL;
+      }
+      return new(mem_ctx) ir_dereference_record(subject, s_field->value());
    }
-   return new(ctx) ir_dereference_record(subject, field->value());
-}
-
-static bool
-valid_texture_list_length(ir_texture_opcode op, s_list *list)
-{
-   unsigned required_length = 7;
-   if (op == ir_txf)
-      required_length = 5;
-   else if (op == ir_tex)
-      required_length = 6;
-
-   return list->length() == required_length;
+   return NULL;
 }
 
-static ir_texture *
-read_texture(_mesa_glsl_parse_state *st, s_list *list)
+ir_texture *
+ir_reader::read_texture(s_expression *expr)
 {
-   void *ctx = st;
-   s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head);
-   assert(tag != NULL);
-
-   ir_texture_opcode op = ir_texture::get_opcode(tag->value());
-   if (op == (ir_texture_opcode) -1)
-      return NULL;
-
-   if (!valid_texture_list_length(op, list)) {
-      ir_read_error(st, NULL, "invalid list size in (%s ...)", tag->value());
-      return NULL;
+   s_symbol *tag = NULL;
+   s_expression *s_sampler = NULL;
+   s_expression *s_coord = NULL;
+   s_list *s_offset = NULL;
+   s_expression *s_proj = NULL;
+   s_list *s_shadow = NULL;
+   s_expression *s_lod = NULL;
+
+   ir_texture_opcode op;
+
+   s_pattern tex_pattern[] =
+      { "tex", s_sampler, s_coord, s_offset, s_proj, s_shadow };
+   s_pattern txf_pattern[] =
+      { "txf", s_sampler, s_coord, s_offset, s_lod };
+   s_pattern other_pattern[] =
+      { tag, s_sampler, s_coord, s_offset, s_proj, s_shadow, s_lod };
+
+   if (MATCH(expr, tex_pattern)) {
+      op = ir_tex;
+   } else if (MATCH(expr, txf_pattern)) {
+      op = ir_txf;
+   } else if (MATCH(expr, other_pattern)) {
+      op = ir_texture::get_opcode(tag->value());
+      if (op == -1)
+        return NULL;
    }
 
-   ir_texture *tex = new(ctx) ir_texture(op);
+   ir_texture *tex = new(mem_ctx) ir_texture(op);
 
    // Read sampler (must be a deref)
-   s_expression *sampler_expr = (s_expression *) tag->next;
-   ir_dereference *sampler = read_dereference(st, sampler_expr);
+   ir_dereference *sampler = read_dereference(s_sampler);
    if (sampler == NULL) {
-      ir_read_error(st, NULL, "when reading sampler in (%s ...)", tag->value());
+      ir_read_error(NULL, "when reading sampler in (%s ...)",
+                   tex->opcode_string());
       return NULL;
    }
    tex->set_sampler(sampler);
 
    // Read coordinate (any rvalue)
-   s_expression *coordinate_expr = (s_expression *) sampler_expr->next;
-   tex->coordinate = read_rvalue(st, coordinate_expr);
+   tex->coordinate = read_rvalue(s_coord);
    if (tex->coordinate == NULL) {
-      ir_read_error(st, NULL, "when reading coordinate in (%s ...)",
-                   tag->value());
+      ir_read_error(NULL, "when reading coordinate in (%s ...)",
+                   tex->opcode_string());
       return NULL;
    }
 
    // Read texel offset, i.e. (0 0 0)
-   s_list *offset_list = SX_AS_LIST(coordinate_expr->next);
-   if (offset_list == NULL || offset_list->length() != 3) {
-      ir_read_error(st, offset_list, "expected (<int> <int> <int>)");
-      return NULL;
-   }
-   s_int *offset_x = SX_AS_INT(offset_list->subexpressions.head);
-   s_int *offset_y = SX_AS_INT(offset_list->subexpressions.head->next);
-   s_int *offset_z = SX_AS_INT(offset_list->subexpressions.head->next->next);
-   if (offset_x == NULL || offset_y == NULL || offset_z == NULL) {
-      ir_read_error(st, offset_list, "expected (<int> <int> <int>)");
+   s_int *offset_x;
+   s_int *offset_y;
+   s_int *offset_z;
+   s_pattern offset_pat[] = { offset_x, offset_y, offset_z };
+   if (!MATCH(s_offset, offset_pat)) {
+      ir_read_error(s_offset, "expected (<int> <int> <int>)");
       return NULL;
    }
    tex->offsets[0] = offset_x->value();
    tex->offsets[1] = offset_y->value();
    tex->offsets[2] = offset_z->value();
 
-   if (op == ir_txf) {
-      s_expression *lod_expr = (s_expression *) offset_list->next;
-      tex->lod_info.lod = read_rvalue(st, lod_expr);
-      if (tex->lod_info.lod == NULL) {
-        ir_read_error(st, NULL, "when reading LOD in (txf ...)");
-        return NULL;
-      }
-   } else {
-      s_expression *proj_expr = (s_expression *) offset_list->next;
-      s_int *proj_as_int = SX_AS_INT(proj_expr);
+   if (op != ir_txf) {
+      s_int *proj_as_int = SX_AS_INT(s_proj);
       if (proj_as_int && proj_as_int->value() == 1) {
         tex->projector = NULL;
       } else {
-        tex->projector = read_rvalue(st, proj_expr);
+        tex->projector = read_rvalue(s_proj);
         if (tex->projector == NULL) {
-           ir_read_error(st, NULL, "when reading projective divide in (%s ..)",
-                         tag->value());
+           ir_read_error(NULL, "when reading projective divide in (%s ..)",
+                         tex->opcode_string());
            return NULL;
         }
       }
 
-      s_list *shadow_list = SX_AS_LIST(proj_expr->next);
-      if (shadow_list == NULL) {
-        ir_read_error(st, NULL, "shadow comparitor must be a list");
-        return NULL;
-      }
-      if (shadow_list->subexpressions.is_empty()) {
-        tex->shadow_comparitor= NULL;
+      if (s_shadow->subexpressions.is_empty()) {
+        tex->shadow_comparitor = NULL;
       } else {
-        tex->shadow_comparitor = read_rvalue(st, shadow_list);
+        tex->shadow_comparitor = read_rvalue(s_shadow);
         if (tex->shadow_comparitor == NULL) {
-           ir_read_error(st, NULL, "when reading shadow comparitor in (%s ..)",
-                         tag->value());
+           ir_read_error(NULL, "when reading shadow comparitor in (%s ..)",
+                         tex->opcode_string());
            return NULL;
         }
       }
-      s_expression *lod_expr = (s_expression *) shadow_list->next;
-
-      switch (op) {
-      case ir_txb:
-        tex->lod_info.bias = read_rvalue(st, lod_expr);
-        if (tex->lod_info.bias == NULL) {
-           ir_read_error(st, NULL, "when reading LOD bias in (txb ...)");
-           return NULL;
-        }
-        break;
-      case ir_txl:
-        tex->lod_info.lod = read_rvalue(st, lod_expr);
-        if (tex->lod_info.lod == NULL) {
-           ir_read_error(st, NULL, "when reading LOD in (txl ...)");
-           return NULL;
-        }
-        break;
-      case ir_txd: {
-        s_list *lod_list = SX_AS_LIST(lod_expr);
-        if (lod_list->length() != 2) {
-           ir_read_error(st, lod_expr, "expected (dPdx dPdy) in (txd ...)");
-           return NULL;
-        }
-        s_expression *dx_expr = (s_expression *) lod_list->subexpressions.head;
-        s_expression *dy_expr = (s_expression *) dx_expr->next;
+   }
 
-        tex->lod_info.grad.dPdx = read_rvalue(st, dx_expr);
-        if (tex->lod_info.grad.dPdx == NULL) {
-           ir_read_error(st, NULL, "when reading dPdx in (txd ...)");
-           return NULL;
-        }
-        tex->lod_info.grad.dPdy = read_rvalue(st, dy_expr);
-        if (tex->lod_info.grad.dPdy == NULL) {
-           ir_read_error(st, NULL, "when reading dPdy in (txd ...)");
-           return NULL;
-        }
-        break;
+   switch (op) {
+   case ir_txb:
+      tex->lod_info.bias = read_rvalue(s_lod);
+      if (tex->lod_info.bias == NULL) {
+        ir_read_error(NULL, "when reading LOD bias in (txb ...)");
+        return NULL;
+      }
+      break;
+   case ir_txl:
+   case ir_txf:
+      tex->lod_info.lod = read_rvalue(s_lod);
+      if (tex->lod_info.lod == NULL) {
+        ir_read_error(NULL, "when reading LOD in (%s ...)",
+                      tex->opcode_string());
+        return NULL;
+      }
+      break;
+   case ir_txd: {
+      s_expression *s_dx, *s_dy;
+      s_pattern dxdy_pat[] = { s_dx, s_dy };
+      if (!MATCH(s_lod, dxdy_pat)) {
+        ir_read_error(s_lod, "expected (dPdx dPdy) in (txd ...)");
+        return NULL;
+      }
+      tex->lod_info.grad.dPdx = read_rvalue(s_dx);
+      if (tex->lod_info.grad.dPdx == NULL) {
+        ir_read_error(NULL, "when reading dPdx in (txd ...)");
+        return NULL;
+      }
+      tex->lod_info.grad.dPdy = read_rvalue(s_dy);
+      if (tex->lod_info.grad.dPdy == NULL) {
+        ir_read_error(NULL, "when reading dPdy in (txd ...)");
+        return NULL;
       }
-      default:
-        // tex doesn't have any extra parameters and txf was handled earlier.
-        break;
-      };
+      break;
    }
+   default:
+      // tex doesn't have any extra parameters.
+      break;
+   };
    return tex;
 }
index 31a122c6bb950984017a2c47ae14744bbe6fa3f0..085456533c5970a9b4c52e96ee63383e973b0c75 100644 (file)
@@ -66,7 +66,7 @@ public:
 };
 
 static void
-mark(struct gl_program *prog, ir_variable *var, int index)
+mark(struct gl_program *prog, ir_variable *var, int offset, int len)
 {
    /* As of GLSL 1.20, varyings can only be floats, floating-point
     * vectors or matrices, or arrays of them.  For Mesa programs using
@@ -75,28 +75,14 @@ mark(struct gl_program *prog, ir_variable *var, int index)
     * something doing a more clever packing would use something other
     * than InputsRead/OutputsWritten.
     */
-   const glsl_type *element_type;
-   int element_size;
-
-   if (var->type->is_array())
-      element_type = var->type->fields.array;
-   else
-      element_type = var->type;
-
-   if (element_type->is_matrix())
-      element_size = element_type->matrix_columns;
-   else
-      element_size = 1;
-
-   index *= element_size;
-   for (int i = 0; i < element_size; i++) {
-      if (var->mode == ir_var_system_value) {
-         prog->SystemValuesRead |= (1 << (var->location + index + i));
-      }
-      else if (var->mode == ir_var_in)
-        prog->InputsRead |= BITFIELD64_BIT(var->location + index + i);
+
+   for (int i = 0; i < len; i++) {
+      if (var->mode == ir_var_in)
+        prog->InputsRead |= BITFIELD64_BIT(var->location + offset + i);
+      else if (var->mode == ir_var_system_value)
+         prog->SystemValuesRead |= (1 << (var->location + offset + i));
       else
-        prog->OutputsWritten |= BITFIELD64_BIT(var->location + index + i);
+        prog->OutputsWritten |= BITFIELD64_BIT(var->location + offset + i);
    }
 }
 
@@ -109,10 +95,11 @@ ir_set_program_inouts_visitor::visit(ir_dereference_variable *ir)
 
    if (ir->type->is_array()) {
       for (unsigned int i = 0; i < ir->type->length; i++) {
-        mark(this->prog, ir->var, i);
+        mark(this->prog, ir->var, i,
+             ir->type->length * ir->type->fields.array->matrix_columns);
       }
    } else {
-      mark(this->prog, ir->var, 0);
+      mark(this->prog, ir->var, 0, ir->type->matrix_columns);
    }
 
    return visit_continue;
@@ -131,7 +118,14 @@ ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir)
       var = (ir_variable *)hash_table_find(this->ht, deref_var->var);
 
    if (index && var) {
-      mark(this->prog, var, index->value.i[0]);
+      int width = 1;
+
+      if (deref_var->type->is_array() &&
+         deref_var->type->fields.array->is_matrix()) {
+        width = deref_var->type->fields.array->matrix_columns;
+      }
+
+      mark(this->prog, var, index->value.i[0] * width, width);
       return visit_continue_with_parent;
    }
 
index 4d105400dd9382e95a06271bae7160f79276117f..73da28faf4f8e664e64699590b410fdc0a95728f 100644 (file)
@@ -65,7 +65,7 @@ add_variable(const char *name, enum ir_variable_mode mode, int slot,
     */
    instructions->push_tail(var);
 
-   symtab->add_variable(var->name, var);
+   symtab->add_variable(var);
    return var;
 }
 
index 78c8b48cf179c4060caa13c2a3cc91644eeaccb5..05930edb80e93241dda5509e4e4e7b41292a8e4c 100644 (file)
@@ -183,7 +183,7 @@ public:
             * it to the linked shader.
             */
            var = ir->var->clone(linked, NULL);
-           linked->symbols->add_variable(var->name, var);
+           linked->symbols->add_variable(var);
            linked->ir->push_head(var);
         }
 
index 616ec7800713c481db160d8c18a878b6a20f65a6..c906d7442127dadb9c2f073134ea01a09aeab042 100644 (file)
@@ -360,8 +360,12 @@ cross_validate_globals(struct gl_shader_program *prog,
                   && (var->type->fields.array == existing->type->fields.array)
                   && ((var->type->length == 0)
                       || (existing->type->length == 0))) {
-                 if (existing->type->length == 0)
+                 if (existing->type->length == 0) {
                     existing->type = var->type;
+                    existing->max_array_access =
+                       MAX2(existing->max_array_access,
+                            var->max_array_access);
+                 }
               } else {
                  linker_error_printf(prog, "%s `%s' declared as type "
                                      "`%s' and type `%s'\n",
@@ -411,8 +415,21 @@ cross_validate_globals(struct gl_shader_program *prog,
                  existing->constant_value =
                     var->constant_value->clone(talloc_parent(existing), NULL);
            }
+
+           if (existing->invariant != var->invariant) {
+              linker_error_printf(prog, "declarations for %s `%s' have "
+                                  "mismatching invariant qualifiers\n",
+                                  mode_string(var), var->name);
+              return false;
+           }
+            if (existing->centroid != var->centroid) {
+               linker_error_printf(prog, "declarations for %s `%s' have "
+                                   "mismatching centroid qualifiers\n",
+                                   mode_string(var), var->name);
+               return false;
+            }
         } else
-           variables.add_variable(var->name, var);
+           variables.add_variable(var);
       }
    }
 
@@ -454,7 +471,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
       if ((var == NULL) || (var->mode != ir_var_out))
         continue;
 
-      parameters.add_variable(var->name, var);
+      parameters.add_variable(var);
    }
 
 
@@ -476,14 +493,35 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
         /* Check that the types match between stages.
          */
         if (input->type != output->type) {
-           linker_error_printf(prog,
-                               "%s shader output `%s' declared as "
-                               "type `%s', but %s shader input declared "
-                               "as type `%s'\n",
-                               producer_stage, output->name,
-                               output->type->name,
-                               consumer_stage, input->type->name);
-           return false;
+           /* There is a bit of a special case for gl_TexCoord.  This
+            * built-in is unsized by default.  Appliations that variable
+            * access it must redeclare it with a size.  There is some
+            * language in the GLSL spec that implies the fragment shader
+            * and vertex shader do not have to agree on this size.  Other
+            * driver behave this way, and one or two applications seem to
+            * rely on it.
+            *
+            * Neither declaration needs to be modified here because the array
+            * sizes are fixed later when update_array_sizes is called.
+            *
+            * From page 48 (page 54 of the PDF) of the GLSL 1.10 spec:
+            *
+            *     "Unlike user-defined varying variables, the built-in
+            *     varying variables don't have a strict one-to-one
+            *     correspondence between the vertex language and the
+            *     fragment language."
+            */
+           if (!output->type->is_array()
+               || (strncmp("gl_", output->name, 3) != 0)) {
+              linker_error_printf(prog,
+                                  "%s shader output `%s' declared as "
+                                  "type `%s', but %s shader input declared "
+                                  "as type `%s'\n",
+                                  producer_stage, output->name,
+                                  output->type->name,
+                                  consumer_stage, input->type->name);
+              return false;
+           }
         }
 
         /* Check that all of the qualifiers match between stages.
@@ -546,9 +584,9 @@ populate_symbol_table(gl_shader *sh)
       ir_function *func;
 
       if ((func = inst->as_function()) != NULL) {
-        sh->symbols->add_function(func->name, func);
+        sh->symbols->add_function(func);
       } else if ((var = inst->as_variable()) != NULL) {
-        sh->symbols->add_variable(var->name, var);
+        sh->symbols->add_variable(var);
       }
    }
 }
@@ -605,7 +643,7 @@ remap_variables(ir_instruction *inst, struct gl_shader *target,
         else {
            ir_variable *copy = ir->var->clone(this->target, NULL);
 
-           this->symbols->add_variable(copy->name, copy);
+           this->symbols->add_variable(copy);
            this->instructions->push_head(copy);
            ir->var = copy;
         }
@@ -726,7 +764,8 @@ get_main_function_signature(gl_shader *sh)
  * shader is returned.
  */
 static struct gl_shader *
-link_intrastage_shaders(struct gl_context *ctx,
+link_intrastage_shaders(void *mem_ctx,
+                       struct gl_context *ctx,
                        struct gl_shader_program *prog,
                        struct gl_shader **shader_list,
                        unsigned num_shaders)
@@ -802,7 +841,7 @@ link_intrastage_shaders(struct gl_context *ctx,
 
    gl_shader *linked = ctx->Driver.NewShader(NULL, 0, main->Type);
    linked->ir = new(linked) exec_list;
-   clone_ir_list(linked, linked->ir, main->ir);
+   clone_ir_list(mem_ctx, linked->ir, main->ir);
 
    populate_symbol_table(linked);
 
@@ -855,6 +894,32 @@ link_intrastage_shaders(struct gl_context *ctx,
 
    free(linking_shaders);
 
+   /* Make a pass over all global variables to ensure that arrays with
+    * unspecified sizes have a size specified.  The size is inferred from the
+    * max_array_access field.
+    */
+   if (linked != NULL) {
+      foreach_list(node, linked->ir) {
+        ir_variable *const var = ((ir_instruction *) node)->as_variable();
+
+        if (var == NULL)
+           continue;
+
+        if ((var->mode != ir_var_auto) && (var->mode != ir_var_temporary))
+           continue;
+
+        if (!var->type->is_array() || (var->type->length != 0))
+           continue;
+
+        const glsl_type *type =
+           glsl_type::get_array_instance(var->type->fields.array,
+                                         var->max_array_access);
+
+        assert(type != NULL);
+        var->type = type;
+      }
+   }
+
    return linked;
 }
 
@@ -1407,6 +1472,8 @@ assign_varying_locations(struct gl_shader_program *prog,
 void
 link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
 {
+   void *mem_ctx = talloc_init("temporary linker context");
+
    prog->LinkStatus = false;
    prog->Validated = false;
    prog->_Used = false;
@@ -1475,7 +1542,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
     */
    if (num_vert_shaders > 0) {
       gl_shader *const sh =
-        link_intrastage_shaders(ctx, prog, vert_shader_list, num_vert_shaders);
+        link_intrastage_shaders(mem_ctx, ctx, prog, vert_shader_list,
+                                num_vert_shaders);
 
       if (sh == NULL)
         goto done;
@@ -1489,7 +1557,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
 
    if (num_frag_shaders > 0) {
       gl_shader *const sh =
-        link_intrastage_shaders(ctx, prog, frag_shader_list, num_frag_shaders);
+        link_intrastage_shaders(mem_ctx, ctx, prog, frag_shader_list,
+                                num_frag_shaders);
 
       if (sh == NULL)
         goto done;
@@ -1598,4 +1667,14 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
 
 done:
    free(vert_shader_list);
+
+   for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+      if (prog->_LinkedShaders[i] == NULL)
+        continue;
+
+      /* Retain any live IR, but trash the rest. */
+      reparent_ir(prog->_LinkedShaders[i]->ir, prog->_LinkedShaders[i]->ir);
+   }
+
+   talloc_free(mem_ctx);
 }
index 11709587e24e57ce3c2adf43c2bb7d0463f4a68e..46000524ba105fdc56358d32261b44dc952711d5 100644 (file)
@@ -43,6 +43,14 @@ public:
 };
 
 
+static bool
+is_break(ir_instruction *ir)
+{
+   return ir != NULL && ir->ir_type == ir_type_loop_jump
+                    && ((ir_loop_jump *) ir)->is_break();
+}
+
+
 ir_visitor_status
 loop_unroll_visitor::visit_leave(ir_loop *ir)
 {
@@ -73,44 +81,74 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
    if (ls->num_loop_jumps > 1)
       return visit_continue;
    else if (ls->num_loop_jumps) {
-      /* recognize loops in the form produced by ir_lower_jumps */
-      ir_instruction *last_ir =
-        ((ir_instruction*)ir->body_instructions.get_tail());
-
+      ir_instruction *last_ir = (ir_instruction *) ir->body_instructions.get_tail();
       assert(last_ir != NULL);
 
-      ir_if *last_if = last_ir->as_if();
-      if (last_if) {
-        bool continue_from_then_branch;
-
-        /* Determine which if-statement branch, if any, ends with a break.
-         * The branch that did *not* have the break will get a temporary
-         * continue inserted in each iteration of the loop unroll.
-         *
-         * Note that since ls->num_loop_jumps is <= 1, it is impossible for
-         * both branches to end with a break.
-         */
-        ir_instruction *last =
-           (ir_instruction *) last_if->then_instructions.get_tail();
-
-        if (last && last->ir_type == ir_type_loop_jump
-            && ((ir_loop_jump*) last)->is_break()) {
-           continue_from_then_branch = false;
-        } else {
-           last = (ir_instruction *) last_if->then_instructions.get_tail();
-
-           if (last && last->ir_type == ir_type_loop_jump
-               && ((ir_loop_jump*) last)->is_break())
-              continue_from_then_branch = true;
-           else
-              /* Bail out if neither if-statement branch ends with a break.
+      if (is_break(last_ir)) {
+         /* If the only loop-jump is a break at the end of the loop, the loop
+          * will execute exactly once.  Remove the break, set the iteration
+          * count, and fall through to the normal unroller.
+          */
+         last_ir->remove();
+         iterations = 1;
+
+         this->progress = true;
+      } else {
+         ir_if *ir_if = NULL;
+         ir_instruction *break_ir = NULL;
+         bool continue_from_then_branch = false;
+
+         foreach_list(node, &ir->body_instructions) {
+            /* recognize loops in the form produced by ir_lower_jumps */
+            ir_instruction *cur_ir = (ir_instruction *) node;
+
+            ir_if = cur_ir->as_if();
+            if (ir_if != NULL) {
+              /* Determine which if-statement branch, if any, ends with a
+               * break.  The branch that did *not* have the break will get a
+               * temporary continue inserted in each iteration of the loop
+               * unroll.
+               *
+               * Note that since ls->num_loop_jumps is <= 1, it is impossible
+               * for both branches to end with a break.
                */
-              return visit_continue;
-        }
+               ir_instruction *ir_if_last =
+                  (ir_instruction *) ir_if->then_instructions.get_tail();
+
+               if (is_break(ir_if_last)) {
+                  continue_from_then_branch = false;
+                  break_ir = ir_if_last;
+                  break;
+               } else {
+                  ir_if_last =
+                    (ir_instruction *) ir_if->else_instructions.get_tail();
+
+                  if (is_break(ir_if_last)) {
+                     break_ir = ir_if_last;
+                     continue_from_then_branch = true;
+                     break;
+                  }
+               }
+            }
+         }
+
+         if (break_ir == NULL)
+            return visit_continue;
+
+         /* move instructions after then if in the continue branch */
+         while (!ir_if->get_next()->is_tail_sentinel()) {
+            ir_instruction *move_ir = (ir_instruction *) ir_if->get_next();
+
+            move_ir->remove();
+            if (continue_from_then_branch)
+               ir_if->then_instructions.push_tail(move_ir);
+            else
+               ir_if->else_instructions.push_tail(move_ir);
+         }
 
-        /* Remove the break from the if-statement.
-         */
-        last->remove();
+         /* Remove the break from the if-statement.
+          */
+         break_ir->remove();
 
          void *const mem_ctx = talloc_parent(ir);
          ir_instruction *ir_to_replace = ir;
@@ -121,8 +159,8 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
             copy_list.make_empty();
             clone_ir_list(mem_ctx, &copy_list, &ir->body_instructions);
 
-            last_if = ((ir_instruction*)copy_list.get_tail())->as_if();
-            assert(last_if);
+            ir_if = ((ir_instruction *) copy_list.get_tail())->as_if();
+            assert(ir_if != NULL);
 
             ir_to_replace->insert_before(&copy_list);
             ir_to_replace->remove();
@@ -132,7 +170,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
               new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_continue);
 
             exec_list *const list = (continue_from_then_branch)
-              ? &last_if->then_instructions : &last_if->else_instructions;
+               ? &ir_if->then_instructions : &ir_if->else_instructions;
 
             list->push_tail(ir_to_replace);
          }
@@ -141,18 +179,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
 
          this->progress = true;
          return visit_continue;
-      } else if (last_ir->ir_type == ir_type_loop_jump
-                && ((ir_loop_jump *)last_ir)->is_break()) {
-        /* If the only loop-jump is a break at the end of the loop, the loop
-         * will execute exactly once.  Remove the break, set the iteration
-         * count, and fall through to the normal unroller.
-         */
-         last_ir->remove();
-        iterations = 1;
-
-        this->progress = true;
-      } else
-         return visit_continue;
+      }
    }
 
    void *const mem_ctx = talloc_parent(ir);
diff --git a/src/glsl/lower_discard.cpp b/src/glsl/lower_discard.cpp
new file mode 100644 (file)
index 0000000..b95313d
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * Copyright Â© 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file lower_discard.cpp
+ *
+ * This pass moves discards out of if-statements.
+ *
+ * Case 1: The "then" branch contains a conditional discard:
+ * ---------------------------------------------------------
+ *
+ *    if (cond1) {
+ *      s1;
+ *      discard cond2;
+ *      s2;
+ *    } else {
+ *      s3;
+ *    }
+ *
+ * becomes:
+ *
+ *    temp = false;
+ *    if (cond1) {
+ *      s1;
+ *      temp = cond2;
+ *      s2;
+ *    } else {
+ *      s3;
+ *    }
+ *    discard temp;
+ *
+ * Case 2: The "else" branch contains a conditional discard:
+ * ---------------------------------------------------------
+ *
+ *    if (cond1) {
+ *      s1;
+ *    } else {
+ *      s2;
+ *      discard cond2;
+ *      s3;
+ *    }
+ *
+ * becomes:
+ *
+ *    temp = false;
+ *    if (cond1) {
+ *      s1;
+ *    } else {
+ *      s2;
+ *      temp = cond2;
+ *      s3;
+ *    }
+ *    discard temp;
+ *
+ * Case 3: Both branches contain a conditional discard:
+ * ----------------------------------------------------
+ *
+ *    if (cond1) {
+ *      s1;
+ *      discard cond2;
+ *      s2;
+ *    } else {
+ *      s3;
+ *      discard cond3;
+ *      s4;
+ *    }
+ *
+ * becomes:
+ *
+ *    temp = false;
+ *    if (cond1) {
+ *      s1;
+ *      temp = cond2;
+ *      s2;
+ *    } else {
+ *      s3;
+ *      temp = cond3;
+ *      s4;
+ *    }
+ *    discard temp;
+ *
+ * If there are multiple conditional discards, we need only deal with one of
+ * them.  Repeatedly applying this pass will take care of the others.
+ *
+ * Unconditional discards are treated as having a condition of "true".
+ */
+
+#include "glsl_types.h"
+#include "ir.h"
+
+class lower_discard_visitor : public ir_hierarchical_visitor {
+public:
+   lower_discard_visitor()
+   {
+      this->progress = false;
+   }
+
+   ir_visitor_status visit_leave(ir_if *);
+
+   bool progress;
+};
+
+
+bool
+lower_discard(exec_list *instructions)
+{
+   lower_discard_visitor v;
+
+   visit_list_elements(&v, instructions);
+
+   return v.progress;
+}
+
+
+static ir_discard *
+find_discard(exec_list &instructions)
+{
+   foreach_list(n, &instructions) {
+      ir_discard *ir = ((ir_instruction *) n)->as_discard();
+      if (ir != NULL)
+        return ir;
+   }
+   return NULL;
+}
+
+
+static void
+replace_discard(void *mem_ctx, ir_variable *var, ir_discard *ir)
+{
+   ir_rvalue *condition = ir->condition;
+
+   /* For unconditional discards, use "true" as the condition. */
+   if (condition == NULL)
+      condition = new(mem_ctx) ir_constant(true);
+
+   ir_assignment *assignment =
+      new(mem_ctx) ir_assignment(new(mem_ctx) ir_dereference_variable(var),
+                                condition, NULL);
+
+   ir->replace_with(assignment);
+}
+
+
+ir_visitor_status
+lower_discard_visitor::visit_leave(ir_if *ir)
+{
+   ir_discard *then_discard = find_discard(ir->then_instructions);
+   ir_discard *else_discard = find_discard(ir->else_instructions);
+
+   if (then_discard == NULL && else_discard == NULL)
+      return visit_continue;
+
+   void *mem_ctx = talloc_parent(ir);
+
+   ir_variable *temp = new(mem_ctx) ir_variable(glsl_type::bool_type,
+                                               "discard_cond_temp",
+                                               ir_var_temporary);
+   ir_assignment *temp_initializer =
+      new(mem_ctx) ir_assignment(new(mem_ctx) ir_dereference_variable(temp),
+                                new(mem_ctx) ir_constant(false), NULL);
+
+   ir->insert_before(temp);
+   ir->insert_before(temp_initializer);
+
+   if (then_discard != NULL)
+      replace_discard(mem_ctx, temp, then_discard);
+
+   if (else_discard != NULL)
+      replace_discard(mem_ctx, temp, else_discard);
+
+   ir_discard *discard = then_discard != NULL ? then_discard : else_discard;
+   discard->condition = new(mem_ctx) ir_dereference_variable(temp);
+   ir->insert_after(discard);
+
+   this->progress = true;
+
+   return visit_continue;
+}
index cf48cfb8d611f92a786e64d17581415693824c4f..40ffc45c86c0575743dc43c5f5d68ba7f4a6b950 100644 (file)
 /**
  * \file lower_if_to_cond_assign.cpp
  *
- * This attempts to flatten all if statements to conditional
- * assignments for GPUs that don't do control flow.
+ * This attempts to flatten if-statements to conditional assignments for
+ * GPUs with limited or no flow control support.
  *
  * It can't handle other control flow being inside of its block, such
  * as calls or loops.  Hopefully loop unrolling and inlining will take
  * care of those.
+ *
+ * Drivers for GPUs with no control flow support should simply call
+ *
+ *    lower_if_to_cond_assign(instructions)
+ *
+ * to attempt to flatten all if-statements.
+ *
+ * Some GPUs (such as i965 prior to gen6) do support control flow, but have a
+ * maximum nesting depth N.  Drivers for such hardware can call
+ *
+ *    lower_if_to_cond_assign(instructions, N)
+ *
+ * to attempt to flatten any if-statements appearing at depth > N.
  */
 
 #include "glsl_types.h"
 
 class ir_if_to_cond_assign_visitor : public ir_hierarchical_visitor {
 public:
-   ir_if_to_cond_assign_visitor()
+   ir_if_to_cond_assign_visitor(unsigned max_depth)
    {
       this->progress = false;
+      this->max_depth = max_depth;
+      this->depth = 0;
    }
 
+   ir_visitor_status visit_enter(ir_if *);
    ir_visitor_status visit_leave(ir_if *);
 
    bool progress;
+   unsigned max_depth;
+   unsigned depth;
 };
 
 bool
-do_if_to_cond_assign(exec_list *instructions)
+lower_if_to_cond_assign(exec_list *instructions, unsigned max_depth)
 {
-   ir_if_to_cond_assign_visitor v;
+   ir_if_to_cond_assign_visitor v(max_depth);
 
    visit_list_elements(&v, instructions);
 
@@ -119,9 +137,23 @@ move_block_to_cond_assign(void *mem_ctx,
    }
 }
 
+ir_visitor_status
+ir_if_to_cond_assign_visitor::visit_enter(ir_if *ir)
+{
+   (void) ir;
+   this->depth++;
+   return visit_continue;
+}
+
 ir_visitor_status
 ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir)
 {
+   /* Only flatten when beyond the GPU's maximum supported nesting depth. */
+   if (this->depth <= this->max_depth)
+      return visit_continue;
+
+   this->depth--;
+
    bool found_control_flow = false;
    ir_variable *cond_var;
    ir_assignment *assign;
index d460ba1a97abd2d3fe00f368c2ef5eba4f0e7d55..a5f61f213d056d8098083bdd2a479c292861b1e7 100644 (file)
@@ -33,6 +33,7 @@
  * - SUB_TO_ADD_NEG
  * - DIV_TO_MUL_RCP
  * - EXP_TO_EXP2
+ * - POW_TO_EXP2
  * - LOG_TO_LOG2
  * - MOD_TO_FRACT
  *
  * do have base 2 versions, so this pass converts exp and log to exp2
  * and log2 operations.
  *
+ * POW_TO_EXP2:
+ * -----------
+ * Many older GPUs don't have an x**y instruction.  For these GPUs, convert
+ * x**y to 2**(y * log2(x)).
+ *
  * MOD_TO_FRACT:
  * -------------
  * Breaks an ir_unop_mod expression down to (op1 * fract(op0 / op1))
@@ -70,7 +76,7 @@
  * opportunity to do things like constant fold the (1.0 / op1) easily.
  */
 
-#include "main/core.h" /* for M_E */
+#include "main/core.h" /* for M_LOG2E */
 #include "glsl_types.h"
 #include "ir.h"
 #include "ir_optimization.h"
@@ -91,6 +97,7 @@ private:
    void div_to_mul_rcp(ir_expression *);
    void mod_to_fract(ir_expression *);
    void exp_to_exp2(ir_expression *);
+   void pow_to_exp2(ir_expression *);
    void log_to_log2(ir_expression *);
 };
 
@@ -172,7 +179,7 @@ lower_instructions_visitor::div_to_mul_rcp(ir_expression *ir)
 void
 lower_instructions_visitor::exp_to_exp2(ir_expression *ir)
 {
-   ir_constant *log2_e = new(ir) ir_constant(log2f(M_E));
+   ir_constant *log2_e = new(ir) ir_constant(float(M_LOG2E));
 
    ir->operation = ir_unop_exp2;
    ir->operands[0] = new(ir) ir_expression(ir_binop_mul, ir->operands[0]->type,
@@ -180,13 +187,27 @@ lower_instructions_visitor::exp_to_exp2(ir_expression *ir)
    this->progress = true;
 }
 
+void
+lower_instructions_visitor::pow_to_exp2(ir_expression *ir)
+{
+   ir_expression *const log2_x =
+      new(ir) ir_expression(ir_unop_log2, ir->operands[0]->type,
+                           ir->operands[0]);
+
+   ir->operation = ir_unop_exp2;
+   ir->operands[0] = new(ir) ir_expression(ir_binop_mul, ir->operands[1]->type,
+                                          ir->operands[1], log2_x);
+   ir->operands[1] = NULL;
+   this->progress = true;
+}
+
 void
 lower_instructions_visitor::log_to_log2(ir_expression *ir)
 {
    ir->operation = ir_binop_mul;
    ir->operands[0] = new(ir) ir_expression(ir_unop_log2, ir->operands[0]->type,
                                           ir->operands[0], NULL);
-   ir->operands[1] = new(ir) ir_constant(1.0f / log2f(M_E));
+   ir->operands[1] = new(ir) ir_constant(float(1.0 / M_LOG2E));
    this->progress = true;
 }
 
@@ -254,6 +275,11 @@ lower_instructions_visitor::visit_leave(ir_expression *ir)
         mod_to_fract(ir);
       break;
 
+   case ir_binop_pow:
+      if (lowering(POW_TO_EXP2))
+        pow_to_exp2(ir);
+      break;
+
    default:
       return visit_continue;
    }
index e1e7a5b0073dea95d7b7f9e6242639493928b86b..dd2601d1aad5b1b76c859d881ca95ba09145cc7d 100644 (file)
 
 /**
  * \file lower_jumps.cpp
+ *
+ * This pass lowers jumps (break, continue, and return) to if/else structures.
+ *
+ * It can be asked to:
+ * 1. Pull jumps out of ifs where possible
+ * 2. Remove all "continue"s, replacing them with an "execute flag"
+ * 3. Replace all "break" with a single conditional one at the end of the loop
+ * 4. Replace all "return"s with a single return at the end of the function,
+ *    for the main function and/or other functions
+ *
+ * Applying this pass gives several benefits:
+ * 1. All functions can be inlined.
+ * 2. nv40 and other pre-DX10 chips without "continue" can be supported
+ * 3. nv30 and other pre-DX10 chips with no control flow at all are better
+ *    supported
+ *
+ * Continues are lowered by adding a per-loop "execute flag", initialized to
+ * true, that when cleared inhibits all execution until the end of the loop.
+ *
+ * Breaks are lowered to continues, plus setting a "break flag" that is checked
+ * at the end of the loop, and trigger the unique "break".
+ *
+ * Returns are lowered to breaks/continues, plus adding a "return flag" that
+ * causes loops to break again out of their enclosing loops until all the
+ * loops are exited: then the "execute flag" logic will ignore everything
+ * until the end of the function.
+ *
+ * Note that "continue" and "return" can also be implemented by adding
+ * a dummy loop and using break.
+ * However, this is bad for hardware with limited nesting depth, and
+ * prevents further optimization, and thus is not currently performed.
  */
 
 #include "glsl_types.h"
@@ -35,8 +66,7 @@ enum jump_strength
    strength_always_clears_execute_flag,
    strength_continue,
    strength_break,
-   strength_return,
-   strength_discard
+   strength_return
 };
 
 struct block_record
@@ -202,8 +232,6 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
 
    virtual void visit(class ir_discard * ir)
    {
-      truncate_after_instruction(ir);
-      this->block.min_strength = strength_discard;
    }
 
    enum jump_strength get_jump_strength(ir_instruction* ir)
@@ -217,8 +245,6 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
             return strength_continue;
       } else if(ir->ir_type == ir_type_return)
          return strength_return;
-      else if(ir->ir_type == ir_type_discard)
-         return strength_discard;
       else
          return strength_none;
    }
@@ -253,9 +279,6 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
          else
             lower = lower_sub_return;
          break;
-      case strength_discard:
-         lower = false; /* probably nothing needs this lowered */
-         break;
       }
       return lower;
    }
@@ -313,9 +336,8 @@ retry: /* we get here if we put code after the if inside a branch */
             /* FINISHME: unify returns with identical expressions */
             else if(jump_strengths[0] == strength_return && this->function.signature->return_type->is_void())
                ir->insert_after(new(ir) ir_return(NULL));
-            /* FINISHME: unify discards */
-            else
-               unify = false;
+           else
+              unify = false;
 
             if(unify) {
                jumps[0]->remove();
@@ -490,7 +512,11 @@ lower_continue:
       if(this->loop.may_set_return_flag) {
          assert(this->function.return_flag);
          ir_if* return_if = new(ir) ir_if(new(ir) ir_dereference_variable(this->function.return_flag));
-         return_if->then_instructions.push_tail(new(ir) ir_loop_jump(saved_loop.loop ? ir_loop_jump::jump_break : ir_loop_jump::jump_continue));
+         saved_loop.may_set_return_flag = true;
+         if(saved_loop.loop)
+            return_if->then_instructions.push_tail(new(ir) ir_loop_jump(ir_loop_jump::jump_break));
+         else
+            move_outer_block_inside(ir, &return_if->else_instructions);
          ir->insert_after(return_if);
       }
 
index 5f0dd7311351e0b21482d6f4150f59d29dc70f5e..7b4e4ad07cbf496b6f5469d5620c4c6a6bd0de24 100644 (file)
@@ -42,6 +42,7 @@ struct assignment_generator
    ir_instruction* base_ir;
    ir_rvalue* array;
    bool is_write;
+   unsigned int write_mask;
    ir_variable* var;
 
    assignment_generator()
@@ -54,14 +55,18 @@ struct assignment_generator
        * underlying variable.
        */
       void *mem_ctx = talloc_parent(base_ir);
-      ir_rvalue *element =
+      ir_dereference *element =
         new(mem_ctx) ir_dereference_array(this->array->clone(mem_ctx, NULL),
                                           new(mem_ctx) ir_constant(i));
       ir_rvalue *variable = new(mem_ctx) ir_dereference_variable(this->var);
 
-      ir_assignment *assignment = (is_write)
-        ? new(mem_ctx) ir_assignment(element, variable, condition)
-        : new(mem_ctx) ir_assignment(variable, element, condition);
+      ir_assignment *assignment;
+      if (is_write) {
+        assignment = new(mem_ctx) ir_assignment(element, variable, condition,
+                                                write_mask);
+      } else {
+        assignment = new(mem_ctx) ir_assignment(variable, element, condition);
+      }
 
       list->push_tail(assignment);
    }
@@ -262,7 +267,7 @@ public:
    }
 
    ir_variable *convert_dereference_array(ir_dereference_array *orig_deref,
-                                         ir_rvalue* value)
+                                         ir_assignment* orig_assign)
    {
       assert(is_array_or_matrix(orig_deref->array));
 
@@ -271,16 +276,30 @@ public:
          : orig_deref->array->type->matrix_columns;
 
       void *const mem_ctx = talloc_parent(base_ir);
-      ir_variable *var =
-        new(mem_ctx) ir_variable(orig_deref->type, "dereference_array_value",
-                                 ir_var_temporary);
-      base_ir->insert_before(var);
 
-      if (value) {
+      /* Temporary storage for either the result of the dereference of
+       * the array, or the RHS that's being assigned into the
+       * dereference of the array.
+       */
+      ir_variable *var;
+
+      if (orig_assign) {
+        var = new(mem_ctx) ir_variable(orig_assign->rhs->type,
+                                       "dereference_array_value",
+                                       ir_var_temporary);
+        base_ir->insert_before(var);
+
         ir_dereference *lhs = new(mem_ctx) ir_dereference_variable(var);
-        ir_assignment *assign = new(mem_ctx) ir_assignment(lhs, value, NULL);
+        ir_assignment *assign = new(mem_ctx) ir_assignment(lhs,
+                                                           orig_assign->rhs,
+                                                           NULL);
 
          base_ir->insert_before(assign);
+      } else {
+        var = new(mem_ctx) ir_variable(orig_deref->type,
+                                       "dereference_array_value",
+                                       ir_var_temporary);
+        base_ir->insert_before(var);
       }
 
       /* Store the index to a temporary to avoid reusing its tree. */
@@ -298,7 +317,12 @@ public:
       ag.array = orig_deref->array;
       ag.base_ir = base_ir;
       ag.var = var;
-      ag.is_write = !!value;
+      if (orig_assign) {
+        ag.is_write = true;
+        ag.write_mask = orig_assign->write_mask;
+      } else {
+        ag.is_write = false;
+      }
 
       switch_generator sg(ag, index, 4, 4);
 
@@ -331,7 +355,7 @@ public:
       ir_dereference_array *orig_deref = ir->lhs->as_dereference_array();
 
       if (needs_lowering(orig_deref)) {
-         convert_dereference_array(orig_deref, ir->rhs);
+         convert_dereference_array(orig_deref, ir);
          ir->remove();
          this->progress = true;
       }
index 36597d0bcd0dbfb14af0dd5668b977ac85fd58be..9b041aafe42caa7112d99321432705241d4ae04b 100644 (file)
 #include <cstdio>
 #include <getopt.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
 #include "ast.h"
 #include "glsl_parser_extras.h"
 #include "glsl_parser.h"
@@ -111,38 +106,40 @@ static char *
 load_text_file(void *ctx, const char *file_name)
 {
        char *text = NULL;
-       struct stat st;
-       ssize_t total_read = 0;
-       int fd = open(file_name, O_RDONLY);
+       size_t size;
+       size_t total_read = 0;
+       FILE *fp = fopen(file_name, "rb");
 
-       if (fd < 0) {
+       if (!fp) {
                return NULL;
        }
 
-       if (fstat(fd, & st) == 0) {
-          text = (char *) talloc_size(ctx, st.st_size + 1);
-               if (text != NULL) {
-                       do {
-                               ssize_t bytes = read(fd, text + total_read,
-                                                    st.st_size - total_read);
-                               if (bytes < 0) {
-                                       free(text);
-                                       text = NULL;
-                                       break;
-                               }
-
-                               if (bytes == 0) {
-                                       break;
-                               }
-
-                               total_read += bytes;
-                       } while (total_read < st.st_size);
-
-                       text[total_read] = '\0';
-               }
+       fseek(fp, 0L, SEEK_END);
+       size = ftell(fp);
+       fseek(fp, 0L, SEEK_SET);
+
+       text = (char *) talloc_size(ctx, size + 1);
+       if (text != NULL) {
+               do {
+                       size_t bytes = fread(text + total_read,
+                                            1, size - total_read, fp);
+                       if (bytes < size - total_read) {
+                               free(text);
+                               text = NULL;
+                               break;
+                       }
+
+                       if (bytes == 0) {
+                               break;
+                       }
+
+                       total_read += bytes;
+               } while (total_read < size);
+
+               text[total_read] = '\0';
        }
 
-       close(fd);
+       fclose(fp);
 
        return text;
 }
@@ -189,7 +186,7 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader)
 
    const char *source = shader->Source;
    state->error = preprocess(state, &source, &state->info_log,
-                            state->extensions, ctx->API);
+                            state->extensions, ctx->API) != 0;
 
    if (!state->error) {
       _mesa_glsl_lexer_ctor(state, source);
@@ -219,26 +216,7 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader)
    if (!state->error && !shader->ir->is_empty()) {
       bool progress;
       do {
-        progress = false;
-
-        progress = do_function_inlining(shader->ir) || progress;
-        progress = do_if_simplification(shader->ir) || progress;
-        progress = do_copy_propagation(shader->ir) || progress;
-        progress = do_dead_code_local(shader->ir) || progress;
-        progress = do_dead_code_unlinked(shader->ir) || progress;
-        progress = do_tree_grafting(shader->ir) || progress;
-        progress = do_constant_propagation(shader->ir) || progress;
-        progress = do_constant_variable_unlinked(shader->ir) || progress;
-        progress = do_constant_folding(shader->ir) || progress;
-        progress = do_algebraic(shader->ir) || progress;
-        progress = do_vec_index_to_swizzle(shader->ir) || progress;
-        progress = do_vec_index_to_cond_assign(shader->ir) || progress;
-        progress = do_swizzle_swizzle(shader->ir) || progress;
-
-        loop_state *ls = analyze_loop_variables(shader->ir);
-        progress = set_loop_controls(shader->ir, ls) || progress;
-        progress = unroll_loops(shader->ir, ls, 32) || progress;
-        delete ls;
+        progress = do_common_optimization(shader->ir, false, 32);
       } while (progress);
 
       validate_ir_tree(shader->ir);
index 3c9af85f312bd17b2ab3143d7dee4c9f9dbf8251..20f6159f0e689449352917e311224e5696a51e4e 100644 (file)
@@ -123,8 +123,8 @@ ir_algebraic_visitor::reassociate_constant(ir_expression *ir1, int const_index,
 
    /* Don't want to even think about matrices. */
    if (ir1->operands[0]->type->is_matrix() ||
-       ir1->operands[0]->type->is_matrix() ||
-       ir2->operands[1]->type->is_matrix() ||
+       ir1->operands[1]->type->is_matrix() ||
+       ir2->operands[0]->type->is_matrix() ||
        ir2->operands[1]->type->is_matrix())
       return false;
 
diff --git a/src/glsl/opt_discard_simplification.cpp b/src/glsl/opt_discard_simplification.cpp
new file mode 100644 (file)
index 0000000..0e577c4
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright Â© 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file opt_discard_simplification.cpp
+ *
+ * This pass simplifies if-statements and loops containing unconditional
+ * discards.
+ *
+ * Case 1: Both branches contain unconditional discards:
+ * -----------------------------------------------------
+ *
+ *    if (cond) {
+ *      s1;
+ *      discard;
+ *      s2;
+ *    } else {
+ *      s3;
+ *      discard;
+ *      s4;
+ *    }
+ *
+ * becomes:
+ *
+ *    discard
+ *
+ * Case 2: The "then" clause contains an unconditional discard:
+ * ------------------------------------------------------------
+ *
+ *    if (cond) {
+ *       s1;
+ *       discard;
+ *       s2;
+ *    } else {
+ *      s3;
+ *    }
+ *
+ * becomes:
+ *
+ *    if (cond) {
+ *      discard;
+ *    } else {
+ *      s3;
+ *    }
+ *
+ * Case 3: The "else" clause contains an unconditional discard:
+ * ------------------------------------------------------------
+ *
+ *    if (cond) {
+ *       s1;
+ *    } else {
+ *       s2;
+ *       discard;
+ *      s3;
+ *    }
+ *
+ * becomes:
+ *
+ *    if (cond) {
+ *      s1;
+ *    } else {
+ *      discard;
+ *    }
+ */
+
+#include "glsl_types.h"
+#include "ir.h"
+
+class discard_simplifier : public ir_hierarchical_visitor {
+public:
+   discard_simplifier()
+   {
+      this->progress = false;
+   }
+
+   ir_visitor_status visit_enter(ir_if *);
+   ir_visitor_status visit_enter(ir_loop *);
+
+   bool progress;
+};
+
+static ir_discard *
+find_unconditional_discard(exec_list &instructions)
+{
+   foreach_list(n, &instructions) {
+      ir_discard *ir = ((ir_instruction *) n)->as_discard();
+      if (ir != NULL && ir->condition == NULL)
+        return ir;
+   }
+   return NULL;
+}
+
+static bool
+is_only_instruction(ir_discard *discard)
+{
+   return (discard->prev->is_head_sentinel() &&
+          discard->next->is_tail_sentinel());
+}
+
+ir_visitor_status
+discard_simplifier::visit_enter(ir_if *ir)
+{
+   ir_discard *then_discard = find_unconditional_discard(ir->then_instructions);
+   ir_discard *else_discard = find_unconditional_discard(ir->else_instructions);
+
+   if (then_discard == NULL && else_discard == NULL)
+      return visit_continue;
+
+   /* If both branches result in discard, replace whole if with discard. */
+   if (then_discard != NULL && else_discard != NULL) {
+      this->progress = true;
+      ir->replace_with(then_discard);
+      return visit_continue_with_parent;
+   }
+
+   /* Otherwise, one branch has a discard. */
+   if (then_discard != NULL && !is_only_instruction(then_discard)) {
+      this->progress = true;
+      ir->then_instructions.make_empty();
+      ir->then_instructions.push_tail(then_discard);
+   } else if (else_discard != NULL && !is_only_instruction(else_discard)) {
+      this->progress = true;
+      ir->else_instructions.make_empty();
+      ir->else_instructions.push_tail(else_discard);
+   }
+
+   visit_list_elements(this, &ir->then_instructions);
+   return visit_continue_with_parent;
+}
+
+ir_visitor_status
+discard_simplifier::visit_enter(ir_loop *ir)
+{
+   ir_discard *discard = find_unconditional_discard(ir->body_instructions);
+
+   if (discard) {
+      ir->replace_with(discard);
+      return visit_continue_with_parent;
+   }
+
+   return visit_continue;
+}
+
+bool
+do_discard_simplification(exec_list *instructions)
+{
+   /* Look for a top-level unconditional discard */
+   ir_discard *discard = find_unconditional_discard(*instructions);
+   if (discard != NULL) {
+      instructions->make_empty();
+      instructions->push_tail(discard);
+      return true;
+   }
+
+   discard_simplifier v;
+
+   visit_list_elements(&v, instructions);
+
+   return v.progress;
+}
index 4c8829fea9ac62e90d617c01feb81387bb2a1f13..6edbf62e488bc64731ba364240d1ef9eb7bfa785 100644 (file)
@@ -38,14 +38,15 @@ s_list::s_list()
 {
 }
 
-unsigned
-s_list::length() const
+static void
+skip_whitespace(const char *& src)
 {
-   unsigned i = 0;
-   foreach_iter(exec_list_iterator, it, this->subexpressions) {
-      i++;
+   src += strspn(src, " \v\t\r\n");
+   /* Also skip Scheme-style comments: semi-colon 'til end of line */
+   if (src[0] == ';') {
+      src += strcspn(src, "\n");
+      skip_whitespace(src);
    }
-   return i;
 }
 
 static s_expression *
@@ -53,16 +54,15 @@ read_atom(void *ctx, const char *& src)
 {
    s_expression *expr = NULL;
 
-   // Skip leading spaces.
-   src += strspn(src, " \v\t\r\n");
+   skip_whitespace(src);
 
-   size_t n = strcspn(src, "( \v\t\r\n)");
+   size_t n = strcspn(src, "( \v\t\r\n);");
    if (n == 0)
       return NULL; // no atom
 
    // Check if the atom is a number.
    char *float_end = NULL;
-   double f = strtod(src, &float_end);
+   double f = glsl_strtod(src, &float_end);
    if (float_end != src) {
       char *int_end = NULL;
       int i = strtol(src, &int_end, 10);
@@ -90,8 +90,7 @@ s_expression::read_expression(void *ctx, const char *&src)
    if (atom != NULL)
       return atom;
 
-   // Skip leading spaces.
-   src += strspn(src, " \v\t\r\n");
+   skip_whitespace(src);
    if (src[0] == '(') {
       ++src;
 
@@ -101,7 +100,7 @@ s_expression::read_expression(void *ctx, const char *&src)
       while ((expr = read_expression(ctx, src)) != NULL) {
         list->subexpressions.push_tail(expr);
       }
-      src += strspn(src, " \v\t\r\n");
+      skip_whitespace(src);
       if (src[0] != ')') {
         printf("Unclosed expression (check your parenthesis).\n");
         return NULL;
@@ -139,3 +138,49 @@ void s_list::print()
    printf(")");
 }
 
+// --------------------------------------------------
+
+bool
+s_pattern::match(s_expression *expr)
+{
+   switch (type)
+   {
+   case EXPR:   *p_expr = expr; break;
+   case LIST:   if (expr->is_list())   *p_list   = (s_list *)   expr; break;
+   case SYMBOL: if (expr->is_symbol()) *p_symbol = (s_symbol *) expr; break;
+   case NUMBER: if (expr->is_number()) *p_number = (s_number *) expr; break;
+   case INT:    if (expr->is_int())    *p_int    = (s_int *)    expr; break;
+   case STRING:
+      s_symbol *sym = SX_AS_SYMBOL(expr);
+      if (sym != NULL && strcmp(sym->value(), literal) == 0)
+        return true;
+      return false;
+   };
+
+   return *p_expr == expr;
+}
+
+bool
+s_match(s_expression *top, unsigned n, s_pattern *pattern, bool partial)
+{
+   s_list *list = SX_AS_LIST(top);
+   if (list == NULL)
+      return false;
+
+   unsigned i = 0;
+   foreach_iter(exec_list_iterator, it, list->subexpressions) {
+      if (i >= n)
+        return partial; /* More actual items than the pattern expected */
+
+      s_expression *expr = (s_expression *) it.get();
+      if (expr == NULL || !pattern[i].match(expr))
+        return false;
+
+      i++;
+   }
+
+   if (i < n)
+      return false; /* Less actual items than the pattern expected */
+
+   return true;
+}
index aa22475a1bf87f9e3c0c13193f042e583ed9f19a..795f3fccea78a4f0b7b416add8061a5fc0dbc3d6 100644 (file)
 #ifndef S_EXPRESSION_H
 #define S_EXPRESSION_H
 
+#include "main/core.h" /* for Elements */
+#include "strtod.h"
 #include "list.h"
 
+/* Type-safe downcasting macros (also safe to pass NULL) */
 #define SX_AS_(t,x) ((x) && ((s_expression*) x)->is_##t()) ? ((s_##t*) (x)) \
                                                            : NULL
 #define SX_AS_LIST(x)   SX_AS_(list, x)
 #define SX_AS_NUMBER(x) SX_AS_(number, x)
 #define SX_AS_INT(x)    SX_AS_(int, x)
 
+/* Pattern matching macros */
+#define MATCH(list, pat) s_match(list, Elements(pat), pat, false)
+#define PARTIAL_MATCH(list, pat) s_match(list, Elements(pat), pat, true)
+
 /* For our purposes, S-Expressions are:
  * - <int>
  * - <float>
@@ -132,11 +139,42 @@ public:
    s_list();
 
    virtual bool is_list() const { return true; }
-   unsigned length() const;
 
    void print();
 
    exec_list subexpressions;
 };
 
+// ------------------------------------------------------------
+
+/**
+ * Part of a pattern to match - essentially a record holding a pointer to the
+ * storage for the component to match, along with the appropriate type.
+ */
+class s_pattern {
+public:
+   s_pattern(s_expression *&s) : p_expr(&s),   type(EXPR)   { }
+   s_pattern(s_list       *&s) : p_list(&s),   type(LIST)   { }
+   s_pattern(s_symbol     *&s) : p_symbol(&s), type(SYMBOL) { }
+   s_pattern(s_number     *&s) : p_number(&s), type(NUMBER) { }
+   s_pattern(s_int        *&s) : p_int(&s),    type(INT)    { }
+   s_pattern(const char *str)  : literal(str), type(STRING) { }
+
+   bool match(s_expression *expr);
+
+private:
+   union {
+      s_expression **p_expr;
+      s_list       **p_list;
+      s_symbol     **p_symbol;
+      s_number     **p_number;
+      s_int        **p_int;
+      const char *literal;
+   };
+   enum { EXPR, LIST, SYMBOL, NUMBER, INT, STRING } type;
+};
+
+bool
+s_match(s_expression *top, unsigned n, s_pattern *pattern, bool partial);
+
 #endif /* S_EXPRESSION_H */
diff --git a/src/glsl/strtod.c b/src/glsl/strtod.c
new file mode 100644 (file)
index 0000000..ff34591
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include <stdlib.h>
+
+#ifdef _GNU_SOURCE
+#include <locale.h>
+#ifdef __APPLE__
+#include <xlocale.h>
+#endif
+#endif
+
+#include "strtod.h"
+
+
+
+/**
+ * Wrapper around strtod which uses the "C" locale so the decimal
+ * point is always '.'
+ */
+double
+glsl_strtod(const char *s, char **end)
+{
+#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__)
+   static locale_t loc = NULL;
+   if (!loc) {
+      loc = newlocale(LC_CTYPE_MASK, "C", NULL);
+   }
+   return strtod_l(s, end, loc);
+#else
+   return strtod(s, end);
+#endif
+}
diff --git a/src/glsl/strtod.h b/src/glsl/strtod.h
new file mode 100644 (file)
index 0000000..0cf6409
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef STRTOD_H
+#define STRTOD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern double
+glsl_strtod(const char *s, char **end);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
index b0559b24d72d4300c580a98e0d81fb61c2229322..75b1a103f0145b9c1af51ea842e1e9774a0cec83 100644 (file)
@@ -719,6 +719,27 @@ dri2_bind_tex_image(Display * dpy,
 static void
 dri2_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
 {
+#if __DRI_TEX_BUFFER_VERSION >= 3
+   struct glx_context *gc = __glXGetCurrentContext();
+   struct dri2_context *pcp = (struct dri2_context *) gc;
+   __GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable);
+   struct glx_display *dpyPriv = __glXInitialize(dpy);
+   struct dri2_drawable *pdraw = (struct dri2_drawable *) base;
+   struct dri2_display *pdp =
+      (struct dri2_display *) dpyPriv->dri2Display;
+   struct dri2_screen *psc;
+
+   if (pdraw != NULL) {
+      psc = (struct dri2_screen *) base->psc;
+
+      if (psc->texBuffer->base.version >= 3 &&
+          psc->texBuffer->releaseTexBuffer != NULL) {
+         (*psc->texBuffer->releaseTexBuffer) (pcp->driContext,
+                                           pdraw->base.textureTarget,
+                                           pdraw->driDrawable);
+      }
+   }
+#endif
 }
 
 static const struct glx_context_vtable dri2_context_vtable = {
index 49938a167a518b8bce7e2b4249e80901bac3217f..6d3c42c5f3b382b9f5941c326e90f0b703861256 100644 (file)
 
 #define __GLX_PAD(n) (((n) + 3) & ~3)
 
-#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#    define FASTCALL __attribute__((fastcall))
-#  else
-#    define FASTCALL
-#  endif
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define NOINLINE __attribute__((noinline))
-#  else
-#    define NOINLINE
-#  endif
+#if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#define FASTCALL __attribute__((fastcall))
+#else
+#define FASTCALL
+#endif
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#define NOINLINE __attribute__((noinline))
+#else
+#define NOINLINE
+#endif
 
 #ifndef __GNUC__
-#  define __builtin_expect(x, y) x
+#define __builtin_expect(x, y) x
 #endif
 
 /* If the size and opcode values are known at compile-time, this will, on
@@ -10657,5 +10657,5 @@ __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment,
 }
 
 
-#  undef FASTCALL
-#  undef NOINLINE
+#undef FASTCALL
+#undef NOINLINE
index 411a0e42c55e3fa96254657e2c942571f2f62c51..137e69cb044a89b12a0998e8e0ba5936c6ef65a8 100644 (file)
 #include <GL/gl.h>
 #include "indirect_size.h"
 
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define PURE __attribute__((pure))
-#  else
-#    define PURE
-#  endif
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#define PURE __attribute__((pure))
+#else
+#define PURE
+#endif
 
-#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#    define FASTCALL __attribute__((fastcall))
-#  else
-#    define FASTCALL
-#  endif
+#if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#define FASTCALL __attribute__((fastcall))
+#else
+#define FASTCALL
+#endif
 
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
-#    define INTERNAL  __attribute__((visibility("internal")))
-#  else
-#    define INTERNAL
-#  endif
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
+#define INTERNAL  __attribute__((visibility("internal")))
+#else
+#define INTERNAL
+#endif
 
 
 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL)
-#  undef HAVE_ALIAS
+#undef HAVE_ALIAS
 #endif
 #ifdef HAVE_ALIAS
-#  define ALIAS2(from,to) \
+#define ALIAS2(from,to) \
     INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \
         __attribute__ ((alias( # to )));
-#  define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )
+#define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )
 #else
-#  define ALIAS(from,to) \
+#define ALIAS(from,to) \
     INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \
     { return __gl ## to ## _size( e ); }
 #endif
@@ -383,6 +383,6 @@ ALIAS(Fogiv, Fogfv)
     ALIAS(ColorTableParameteriv, ColorTableParameterfv)
     ALIAS(ConvolutionParameteriv, ConvolutionParameterfv)
     ALIAS(PointParameterivNV, PointParameterfvEXT)
-#  undef PURE
-#  undef FASTCALL
-#  undef INTERNAL
+#undef PURE
+#undef FASTCALL
+#undef INTERNAL
index 79b849b6839fac811a0ef26793b3015860dd187d..9857b6c75e6fa52f3f15e60b72b8aaa81e6dcda7 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #if !defined( _INDIRECT_SIZE_H_ )
-#  define _INDIRECT_SIZE_H_
+#define _INDIRECT_SIZE_H_
 
 /**
  * \file
  * \author Ian Romanick <idr@us.ibm.com>
  */
 
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define PURE __attribute__((pure))
-#  else
-#    define PURE
-#  endif
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#define PURE __attribute__((pure))
+#else
+#define PURE
+#endif
 
-#  if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#    define FASTCALL __attribute__((fastcall))
-#  else
-#    define FASTCALL
-#  endif
+#if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#define FASTCALL __attribute__((fastcall))
+#else
+#define FASTCALL
+#endif
 
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
-#    define INTERNAL  __attribute__((visibility("internal")))
-#  else
-#    define INTERNAL
-#  endif
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) && defined(__ELF__)
+#define INTERNAL  __attribute__((visibility("internal")))
+#else
+#define INTERNAL
+#endif
 
 extern INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum);
 extern INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum);
@@ -81,8 +81,8 @@ extern INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum);
 extern INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size(GLenum);
 extern INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum);
 
-#  undef PURE
-#  undef FASTCALL
-#  undef INTERNAL
+#undef PURE
+#undef FASTCALL
+#undef INTERNAL
 
 #endif /* !defined( _INDIRECT_SIZE_H_ ) */
index 576ac5afdc30d463cd09bc13560601b953729890..3659d6486a8135d11c4dbc18de011f5fc5a2d057 100644 (file)
@@ -44,10 +44,10 @@ GLAPI_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o)
 GLAPI_ASM_SOURCES := $(addprefix $(GEN)/, $(GLAPI_ASM_SOURCES))
 
 include $(MAPI)/sources.mak
-MAPI_GLAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o)
-MAPI_GLAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES))
+MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o)
+MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES))
 
-ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_GLAPI_OBJECTS)
+ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS)
 
 INCLUDE_DIRS = \
        -I$(TOP)/include \
@@ -72,13 +72,13 @@ lib$(ESAPI).a: $(ESAPI_OBJECTS)
        @$(MKLIB) -o $(ESAPI) -static $(ESAPI_OBJECTS)
 
 $(GLAPI_OBJECTS): %.o: $(GLAPI)/%.c
-       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
 
 $(GLAPI_ASM_OBJECTS): %.o: $(GEN)/%.S
        $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
 
-$(MAPI_GLAPI_OBJECTS): %.o: $(MAPI)/%.c
-       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@
+$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c
+       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
 
 $(GLAPI_SOURCES) $(GLAPI_ASM_SOURCES): | glapi-stamp
 
@@ -135,10 +135,10 @@ install: default install-headers install-pc
        $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLES_LIB_GLOB) \
                $(DESTDIR)$(INSTALL_LIB_DIR)
 
-depend: $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES)
+depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES)
        @echo "running $(MKDEP)"
        @touch depend
        @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \
-               -DMAPI_GLAPI_CURRENT $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) \
+               -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \
                2>/dev/null | sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' \
                > depend
index ca9381d425330623eb723ef3cd5c7694552b7c9c..a9ab07903c121db08a3d79b1f223088bf29547b8 100644 (file)
@@ -12,10 +12,10 @@ GLAPI_OBJECTS = $(GLAPI_SOURCES:.c=.o)
 GLAPI_ASM_OBJECTS = $(GLAPI_ASM_SOURCES:.S=.o)
 
 include $(MAPI)/sources.mak
-MAPI_GLAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o)
-MAPI_GLAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES))
+MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o)
+MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES))
 
-TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_GLAPI_OBJECTS)
+TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS)
 
 INCLUDE_DIRS = \
        -I$(TOP)/include \
@@ -28,13 +28,13 @@ lib$(TARGET).a: $(TARGET_OBJECTS)
        @$(MKLIB) -o $(TARGET) -static $(TARGET_OBJECTS)
 
 $(GLAPI_OBJECTS): %.o: %.c
-       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
 
 $(GLAPI_ASM_OBJECTS): %.o: %.S
        $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
 
-$(MAPI_GLAPI_OBJECTS): %.o: $(MAPI)/%.c
-       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@
+$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c
+       $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@
 
 install:
 
@@ -43,11 +43,11 @@ clean:
        -rm -f lib$(TARGET).a
        -rm -f depend depend.bak
 
-depend: $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES)
+depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES)
        @ echo "running $(MKDEP)"
        @ touch depend
        @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \
-               -DMAPI_GLAPI_CURRENT $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) \
+               -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \
                2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend
 
 -include depend
index 77a5f9bd2e32f774e81bbf92e4d46d364b14314d..4057991ec8da935d1b0b7f3a5810c561a36978fa 100644 (file)
@@ -9,14 +9,13 @@ if env['platform'] != 'winddk':
     env = env.Clone()
     
     env.Append(CPPDEFINES = [
-        'MAPI_GLAPI_CURRENT',
+        'MAPI_MODE_UTIL',
     ])
 
     if env['platform'] == 'windows':
         env.Append(CPPDEFINES = [
             '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
             'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
-            'WIN32_THREADS', # use Win32 thread API
         ])
 
     env.Append(CPPPATH = [
@@ -30,6 +29,7 @@ if env['platform'] != 'winddk':
         'glapi_getproc.c',
         'glapi_nop.c',
         'glthread.c',
+        'glapi.c',
     ]
     
     mapi_sources = [
diff --git a/src/mapi/glapi/gen/ARB_ES2_compatibility.xml b/src/mapi/glapi/gen/ARB_ES2_compatibility.xml
new file mode 100644 (file)
index 0000000..d52a88c
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_ARB_ES2_compatibility" number="95">
+    <enum name="FIXED" count="1"  value="0x140C"/>
+    <enum name="LOW_FLOAT"                                    value="0x8DF0"/>
+    <enum name="MEDIUM_FLOAT"                                 value="0x8DF1"/>
+    <enum name="HIGH_FLOAT"                                   value="0x8DF2"/>
+    <enum name="LOW_INT"                                      value="0x8DF3"/>
+    <enum name="MEDIUM_INT"                                   value="0x8DF4"/>
+    <enum name="HIGH_INT"                                     value="0x8DF5"/>
+    <enum name="SHADER_BINARY_FORMATS"                        value="0x8DF8"/>
+    <enum name="NUM_SHADER_BINARY_FORMATS"                    value="0x8DF9"/>
+    <enum name="SHADER_COMPILER"                              value="0x8DFA"/>
+    <enum name="MAX_VERTEX_UNIFORM_VECTORS"                   value="0x8DFB"/>
+    <enum name="MAX_VARYING_VECTORS"                          value="0x8DFC"/>
+    <enum name="MAX_FRAGMENT_UNIFORM_VECTORS"                 value="0x8DFD"/>
+
+    <function name="GetShaderPrecisionFormat" offset="assign">
+        <param name="shadertype" type="GLenum"/>
+        <param name="precisiontype" type="GLenum"/>
+        <param name="range" type="GLint *"/>
+        <param name="precision" type="GLint *"/>
+    </function>
+
+    <function name="ReleaseShaderCompiler" offset="assign">
+    </function>
+
+    <function name="ShaderBinary" offset="assign">
+        <param name="n" type="GLsizei"/>
+        <param name="shaders" type="const GLuint *"/>
+        <param name="binaryformat" type="GLenum"/>
+        <param name="binary" type="const GLvoid *"/>
+        <param name="length" type="GLsizei"/>
+    </function>
+
+    <!-- from GL_OES_fixed_point -->
+    <enum name="FIXED"                                    value="0x140C"/>
+    <type name="fixed"   size="4"                                    />
+
+    <!-- from GL_OES_read_format -->
+    <enum name="IMPLEMENTATION_COLOR_READ_TYPE"           value="0x8B9A"/>
+    <enum name="IMPLEMENTATION_COLOR_READ_FORMAT"         value="0x8B9B"/>
+
+    <!-- from GL_OES_single_precision -->
+    <function name="ClearDepthf" offset="assign">
+        <param name="depth" type="GLclampf"/>
+    </function>
+
+    <function name="DepthRangef" offset="assign">
+        <param name="zNear" type="GLclampf"/>
+        <param name="zFar" type="GLclampf"/>
+    </function>
+</category>
+
+</OpenGLAPI>
index 5a9b6ac4a875496c005001b6a79460a339814d71..c08be387f3f8935b00cc64cb5a182c65b69c4fea 100644 (file)
@@ -74,6 +74,7 @@ API_XML = \
        ARB_depth_clamp.xml \
        ARB_draw_elements_base_vertex.xml \
        ARB_draw_instanced.xml \
+       ARB_ES2_compatibility.xml \
        ARB_framebuffer_object.xml \
        ARB_geometry_shader4.xml \
        ARB_map_buffer_range.xml \
index 2004647954c8d4a57146f163476d1a5f320597a5..0fc44b5a83d3adc7a622832c49847df145b9b967 100644 (file)
     </enum>
 </category>
 
+<xi:include href="ARB_ES2_compatibility.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
 <xi:include href="ARB_framebuffer_object.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <xi:include href="ARB_copy_buffer.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
index e6e78c42f3b24b45cc5625826c6c071bde52e35e..2fa140dc308c3de7b6517226db6c9be4bfad806e 100644 (file)
@@ -138,7 +138,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
                print '#  define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
                print '# endif'
                print ''
-               print '#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+               print '#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)'
                print '#  define THREADS'
                print '#endif'
                print ''
index 3b1d035f04aac9d28799fece86a453efbc4d3fde..21996a394214d758efb0ac1b9ec7e66ee2f4093e 100644 (file)
@@ -78,7 +78,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
                print '#define GLOBL_FN(x) GLOBL x'
                print '#endif'
                print ''
-               print '#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+               print '#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)'
                print '#  define THREADS'
                print '#endif'
                print ''
diff --git a/src/mapi/glapi/glapi.c b/src/mapi/glapi/glapi.c
new file mode 100644 (file)
index 0000000..f7655c5
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "glapi/glapi.h"
+#include "mapi/u_current.h"
+
+/*
+ * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in
+ * u_current.c.
+ */
+
+#ifdef GLX_USE_TLS
+/* not used, but defined for compatibility */
+const struct _glapi_table *_glapi_Dispatch;
+const void *_glapi_Context;
+#endif /* GLX_USE_TLS */
+
+void
+_glapi_destroy_multithread(void)
+{
+   u_current_destroy();
+}
+
+void
+_glapi_check_multithread(void)
+{
+   u_current_init();
+}
+
+void
+_glapi_set_context(void *context)
+{
+   u_current_set_user((const void *) context);
+}
+
+void
+_glapi_set_dispatch(struct _glapi_table *dispatch)
+{
+   u_current_set((const struct mapi_table *) dispatch);
+}
index 47a01176d5a242a2162dbe98d35c6409ba148260..0a6ff7795fbd6b82389ee838bf156bfbf47596fd 100644 (file)
@@ -42,7 +42,7 @@
  */
 
 
-#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server)
+#if !defined(DISPATCH_FUNCTION_SIZE) 
 # define NEED_FUNCTION_POINTER
 #endif
 #include "glapi/glprocs.h"
@@ -88,7 +88,6 @@ get_static_proc_offset(const char *funcName)
 }
 
 
-#if !defined(XFree86Server)
 
 /**
  * Return dispatch function address for the named static (built-in) function.
@@ -113,16 +112,6 @@ get_static_proc_address(const char *funcName)
 #endif
 }
 
-#else
-
-static _glapi_proc
-get_static_proc_address(const char *funcName)
-{
-   (void) funcName;
-   return NULL;
-}
-
-#endif /* !defined(XFree86Server) */
 
 
 /**
index 969769a310c1f81d5596dd047e08bff3185e1fe4..b919c2890848b7260ca3125436a67f0262adc708 100644 (file)
@@ -795,110 +795,105 @@ gl_dispatch_functions_start:
        GL_STUB(glIsTransformFeedback, 597)
        GL_STUB(glPauseTransformFeedback, 598)
        GL_STUB(glResumeTransformFeedback, 599)
-       GL_STUB(glPolygonOffsetEXT, 600)
-       GL_STUB(gl_dispatch_stub_601, 601)
-       HIDDEN(gl_dispatch_stub_601)
-       GL_STUB(gl_dispatch_stub_602, 602)
-       HIDDEN(gl_dispatch_stub_602)
-       GL_STUB(gl_dispatch_stub_603, 603)
-       HIDDEN(gl_dispatch_stub_603)
-       GL_STUB(gl_dispatch_stub_604, 604)
-       HIDDEN(gl_dispatch_stub_604)
-       GL_STUB(gl_dispatch_stub_605, 605)
-       HIDDEN(gl_dispatch_stub_605)
+       GL_STUB(glClearDepthf, 600)
+       GL_STUB(glDepthRangef, 601)
+       GL_STUB(glGetShaderPrecisionFormat, 602)
+       GL_STUB(glReleaseShaderCompiler, 603)
+       GL_STUB(glShaderBinary, 604)
+       GL_STUB(glPolygonOffsetEXT, 605)
        GL_STUB(gl_dispatch_stub_606, 606)
        HIDDEN(gl_dispatch_stub_606)
        GL_STUB(gl_dispatch_stub_607, 607)
        HIDDEN(gl_dispatch_stub_607)
        GL_STUB(gl_dispatch_stub_608, 608)
        HIDDEN(gl_dispatch_stub_608)
-       GL_STUB(glColorPointerEXT, 609)
-       GL_STUB(glEdgeFlagPointerEXT, 610)
-       GL_STUB(glIndexPointerEXT, 611)
-       GL_STUB(glNormalPointerEXT, 612)
-       GL_STUB(glTexCoordPointerEXT, 613)
-       GL_STUB(glVertexPointerEXT, 614)
-       GL_STUB(glPointParameterfEXT, 615)
-       GL_STUB(glPointParameterfvEXT, 616)
-       GL_STUB(glLockArraysEXT, 617)
-       GL_STUB(glUnlockArraysEXT, 618)
-       GL_STUB(glSecondaryColor3bEXT, 619)
-       GL_STUB(glSecondaryColor3bvEXT, 620)
-       GL_STUB(glSecondaryColor3dEXT, 621)
-       GL_STUB(glSecondaryColor3dvEXT, 622)
-       GL_STUB(glSecondaryColor3fEXT, 623)
-       GL_STUB(glSecondaryColor3fvEXT, 624)
-       GL_STUB(glSecondaryColor3iEXT, 625)
-       GL_STUB(glSecondaryColor3ivEXT, 626)
-       GL_STUB(glSecondaryColor3sEXT, 627)
-       GL_STUB(glSecondaryColor3svEXT, 628)
-       GL_STUB(glSecondaryColor3ubEXT, 629)
-       GL_STUB(glSecondaryColor3ubvEXT, 630)
-       GL_STUB(glSecondaryColor3uiEXT, 631)
-       GL_STUB(glSecondaryColor3uivEXT, 632)
-       GL_STUB(glSecondaryColor3usEXT, 633)
-       GL_STUB(glSecondaryColor3usvEXT, 634)
-       GL_STUB(glSecondaryColorPointerEXT, 635)
-       GL_STUB(glMultiDrawArraysEXT, 636)
-       GL_STUB(glMultiDrawElementsEXT, 637)
-       GL_STUB(glFogCoordPointerEXT, 638)
-       GL_STUB(glFogCoorddEXT, 639)
-       GL_STUB(glFogCoorddvEXT, 640)
-       GL_STUB(glFogCoordfEXT, 641)
-       GL_STUB(glFogCoordfvEXT, 642)
-       GL_STUB(gl_dispatch_stub_643, 643)
-       HIDDEN(gl_dispatch_stub_643)
-       GL_STUB(glBlendFuncSeparateEXT, 644)
-       GL_STUB(glFlushVertexArrayRangeNV, 645)
-       GL_STUB(glVertexArrayRangeNV, 646)
-       GL_STUB(glCombinerInputNV, 647)
-       GL_STUB(glCombinerOutputNV, 648)
-       GL_STUB(glCombinerParameterfNV, 649)
-       GL_STUB(glCombinerParameterfvNV, 650)
-       GL_STUB(glCombinerParameteriNV, 651)
-       GL_STUB(glCombinerParameterivNV, 652)
-       GL_STUB(glFinalCombinerInputNV, 653)
-       GL_STUB(glGetCombinerInputParameterfvNV, 654)
-       GL_STUB(glGetCombinerInputParameterivNV, 655)
-       GL_STUB(glGetCombinerOutputParameterfvNV, 656)
-       GL_STUB(glGetCombinerOutputParameterivNV, 657)
-       GL_STUB(glGetFinalCombinerInputParameterfvNV, 658)
-       GL_STUB(glGetFinalCombinerInputParameterivNV, 659)
-       GL_STUB(glResizeBuffersMESA, 660)
-       GL_STUB(glWindowPos2dMESA, 661)
-       GL_STUB(glWindowPos2dvMESA, 662)
-       GL_STUB(glWindowPos2fMESA, 663)
-       GL_STUB(glWindowPos2fvMESA, 664)
-       GL_STUB(glWindowPos2iMESA, 665)
-       GL_STUB(glWindowPos2ivMESA, 666)
-       GL_STUB(glWindowPos2sMESA, 667)
-       GL_STUB(glWindowPos2svMESA, 668)
-       GL_STUB(glWindowPos3dMESA, 669)
-       GL_STUB(glWindowPos3dvMESA, 670)
-       GL_STUB(glWindowPos3fMESA, 671)
-       GL_STUB(glWindowPos3fvMESA, 672)
-       GL_STUB(glWindowPos3iMESA, 673)
-       GL_STUB(glWindowPos3ivMESA, 674)
-       GL_STUB(glWindowPos3sMESA, 675)
-       GL_STUB(glWindowPos3svMESA, 676)
-       GL_STUB(glWindowPos4dMESA, 677)
-       GL_STUB(glWindowPos4dvMESA, 678)
-       GL_STUB(glWindowPos4fMESA, 679)
-       GL_STUB(glWindowPos4fvMESA, 680)
-       GL_STUB(glWindowPos4iMESA, 681)
-       GL_STUB(glWindowPos4ivMESA, 682)
-       GL_STUB(glWindowPos4sMESA, 683)
-       GL_STUB(glWindowPos4svMESA, 684)
-       GL_STUB(gl_dispatch_stub_685, 685)
-       HIDDEN(gl_dispatch_stub_685)
-       GL_STUB(gl_dispatch_stub_686, 686)
-       HIDDEN(gl_dispatch_stub_686)
-       GL_STUB(gl_dispatch_stub_687, 687)
-       HIDDEN(gl_dispatch_stub_687)
-       GL_STUB(gl_dispatch_stub_688, 688)
-       HIDDEN(gl_dispatch_stub_688)
-       GL_STUB(gl_dispatch_stub_689, 689)
-       HIDDEN(gl_dispatch_stub_689)
+       GL_STUB(gl_dispatch_stub_609, 609)
+       HIDDEN(gl_dispatch_stub_609)
+       GL_STUB(gl_dispatch_stub_610, 610)
+       HIDDEN(gl_dispatch_stub_610)
+       GL_STUB(gl_dispatch_stub_611, 611)
+       HIDDEN(gl_dispatch_stub_611)
+       GL_STUB(gl_dispatch_stub_612, 612)
+       HIDDEN(gl_dispatch_stub_612)
+       GL_STUB(gl_dispatch_stub_613, 613)
+       HIDDEN(gl_dispatch_stub_613)
+       GL_STUB(glColorPointerEXT, 614)
+       GL_STUB(glEdgeFlagPointerEXT, 615)
+       GL_STUB(glIndexPointerEXT, 616)
+       GL_STUB(glNormalPointerEXT, 617)
+       GL_STUB(glTexCoordPointerEXT, 618)
+       GL_STUB(glVertexPointerEXT, 619)
+       GL_STUB(glPointParameterfEXT, 620)
+       GL_STUB(glPointParameterfvEXT, 621)
+       GL_STUB(glLockArraysEXT, 622)
+       GL_STUB(glUnlockArraysEXT, 623)
+       GL_STUB(glSecondaryColor3bEXT, 624)
+       GL_STUB(glSecondaryColor3bvEXT, 625)
+       GL_STUB(glSecondaryColor3dEXT, 626)
+       GL_STUB(glSecondaryColor3dvEXT, 627)
+       GL_STUB(glSecondaryColor3fEXT, 628)
+       GL_STUB(glSecondaryColor3fvEXT, 629)
+       GL_STUB(glSecondaryColor3iEXT, 630)
+       GL_STUB(glSecondaryColor3ivEXT, 631)
+       GL_STUB(glSecondaryColor3sEXT, 632)
+       GL_STUB(glSecondaryColor3svEXT, 633)
+       GL_STUB(glSecondaryColor3ubEXT, 634)
+       GL_STUB(glSecondaryColor3ubvEXT, 635)
+       GL_STUB(glSecondaryColor3uiEXT, 636)
+       GL_STUB(glSecondaryColor3uivEXT, 637)
+       GL_STUB(glSecondaryColor3usEXT, 638)
+       GL_STUB(glSecondaryColor3usvEXT, 639)
+       GL_STUB(glSecondaryColorPointerEXT, 640)
+       GL_STUB(glMultiDrawArraysEXT, 641)
+       GL_STUB(glMultiDrawElementsEXT, 642)
+       GL_STUB(glFogCoordPointerEXT, 643)
+       GL_STUB(glFogCoorddEXT, 644)
+       GL_STUB(glFogCoorddvEXT, 645)
+       GL_STUB(glFogCoordfEXT, 646)
+       GL_STUB(glFogCoordfvEXT, 647)
+       GL_STUB(gl_dispatch_stub_648, 648)
+       HIDDEN(gl_dispatch_stub_648)
+       GL_STUB(glBlendFuncSeparateEXT, 649)
+       GL_STUB(glFlushVertexArrayRangeNV, 650)
+       GL_STUB(glVertexArrayRangeNV, 651)
+       GL_STUB(glCombinerInputNV, 652)
+       GL_STUB(glCombinerOutputNV, 653)
+       GL_STUB(glCombinerParameterfNV, 654)
+       GL_STUB(glCombinerParameterfvNV, 655)
+       GL_STUB(glCombinerParameteriNV, 656)
+       GL_STUB(glCombinerParameterivNV, 657)
+       GL_STUB(glFinalCombinerInputNV, 658)
+       GL_STUB(glGetCombinerInputParameterfvNV, 659)
+       GL_STUB(glGetCombinerInputParameterivNV, 660)
+       GL_STUB(glGetCombinerOutputParameterfvNV, 661)
+       GL_STUB(glGetCombinerOutputParameterivNV, 662)
+       GL_STUB(glGetFinalCombinerInputParameterfvNV, 663)
+       GL_STUB(glGetFinalCombinerInputParameterivNV, 664)
+       GL_STUB(glResizeBuffersMESA, 665)
+       GL_STUB(glWindowPos2dMESA, 666)
+       GL_STUB(glWindowPos2dvMESA, 667)
+       GL_STUB(glWindowPos2fMESA, 668)
+       GL_STUB(glWindowPos2fvMESA, 669)
+       GL_STUB(glWindowPos2iMESA, 670)
+       GL_STUB(glWindowPos2ivMESA, 671)
+       GL_STUB(glWindowPos2sMESA, 672)
+       GL_STUB(glWindowPos2svMESA, 673)
+       GL_STUB(glWindowPos3dMESA, 674)
+       GL_STUB(glWindowPos3dvMESA, 675)
+       GL_STUB(glWindowPos3fMESA, 676)
+       GL_STUB(glWindowPos3fvMESA, 677)
+       GL_STUB(glWindowPos3iMESA, 678)
+       GL_STUB(glWindowPos3ivMESA, 679)
+       GL_STUB(glWindowPos3sMESA, 680)
+       GL_STUB(glWindowPos3svMESA, 681)
+       GL_STUB(glWindowPos4dMESA, 682)
+       GL_STUB(glWindowPos4dvMESA, 683)
+       GL_STUB(glWindowPos4fMESA, 684)
+       GL_STUB(glWindowPos4fvMESA, 685)
+       GL_STUB(glWindowPos4iMESA, 686)
+       GL_STUB(glWindowPos4ivMESA, 687)
+       GL_STUB(glWindowPos4sMESA, 688)
+       GL_STUB(glWindowPos4svMESA, 689)
        GL_STUB(gl_dispatch_stub_690, 690)
        HIDDEN(gl_dispatch_stub_690)
        GL_STUB(gl_dispatch_stub_691, 691)
@@ -907,210 +902,220 @@ gl_dispatch_functions_start:
        HIDDEN(gl_dispatch_stub_692)
        GL_STUB(gl_dispatch_stub_693, 693)
        HIDDEN(gl_dispatch_stub_693)
-       GL_STUB(glAreProgramsResidentNV, 694)
-       GL_STUB(glBindProgramNV, 695)
-       GL_STUB(glDeleteProgramsNV, 696)
-       GL_STUB(glExecuteProgramNV, 697)
-       GL_STUB(glGenProgramsNV, 698)
-       GL_STUB(glGetProgramParameterdvNV, 699)
-       GL_STUB(glGetProgramParameterfvNV, 700)
-       GL_STUB(glGetProgramStringNV, 701)
-       GL_STUB(glGetProgramivNV, 702)
-       GL_STUB(glGetTrackMatrixivNV, 703)
-       GL_STUB(glGetVertexAttribPointervNV, 704)
-       GL_STUB(glGetVertexAttribdvNV, 705)
-       GL_STUB(glGetVertexAttribfvNV, 706)
-       GL_STUB(glGetVertexAttribivNV, 707)
-       GL_STUB(glIsProgramNV, 708)
-       GL_STUB(glLoadProgramNV, 709)
-       GL_STUB(glProgramParameters4dvNV, 710)
-       GL_STUB(glProgramParameters4fvNV, 711)
-       GL_STUB(glRequestResidentProgramsNV, 712)
-       GL_STUB(glTrackMatrixNV, 713)
-       GL_STUB(glVertexAttrib1dNV, 714)
-       GL_STUB(glVertexAttrib1dvNV, 715)
-       GL_STUB(glVertexAttrib1fNV, 716)
-       GL_STUB(glVertexAttrib1fvNV, 717)
-       GL_STUB(glVertexAttrib1sNV, 718)
-       GL_STUB(glVertexAttrib1svNV, 719)
-       GL_STUB(glVertexAttrib2dNV, 720)
-       GL_STUB(glVertexAttrib2dvNV, 721)
-       GL_STUB(glVertexAttrib2fNV, 722)
-       GL_STUB(glVertexAttrib2fvNV, 723)
-       GL_STUB(glVertexAttrib2sNV, 724)
-       GL_STUB(glVertexAttrib2svNV, 725)
-       GL_STUB(glVertexAttrib3dNV, 726)
-       GL_STUB(glVertexAttrib3dvNV, 727)
-       GL_STUB(glVertexAttrib3fNV, 728)
-       GL_STUB(glVertexAttrib3fvNV, 729)
-       GL_STUB(glVertexAttrib3sNV, 730)
-       GL_STUB(glVertexAttrib3svNV, 731)
-       GL_STUB(glVertexAttrib4dNV, 732)
-       GL_STUB(glVertexAttrib4dvNV, 733)
-       GL_STUB(glVertexAttrib4fNV, 734)
-       GL_STUB(glVertexAttrib4fvNV, 735)
-       GL_STUB(glVertexAttrib4sNV, 736)
-       GL_STUB(glVertexAttrib4svNV, 737)
-       GL_STUB(glVertexAttrib4ubNV, 738)
-       GL_STUB(glVertexAttrib4ubvNV, 739)
-       GL_STUB(glVertexAttribPointerNV, 740)
-       GL_STUB(glVertexAttribs1dvNV, 741)
-       GL_STUB(glVertexAttribs1fvNV, 742)
-       GL_STUB(glVertexAttribs1svNV, 743)
-       GL_STUB(glVertexAttribs2dvNV, 744)
-       GL_STUB(glVertexAttribs2fvNV, 745)
-       GL_STUB(glVertexAttribs2svNV, 746)
-       GL_STUB(glVertexAttribs3dvNV, 747)
-       GL_STUB(glVertexAttribs3fvNV, 748)
-       GL_STUB(glVertexAttribs3svNV, 749)
-       GL_STUB(glVertexAttribs4dvNV, 750)
-       GL_STUB(glVertexAttribs4fvNV, 751)
-       GL_STUB(glVertexAttribs4svNV, 752)
-       GL_STUB(glVertexAttribs4ubvNV, 753)
-       GL_STUB(glGetTexBumpParameterfvATI, 754)
-       GL_STUB(glGetTexBumpParameterivATI, 755)
-       GL_STUB(glTexBumpParameterfvATI, 756)
-       GL_STUB(glTexBumpParameterivATI, 757)
-       GL_STUB(glAlphaFragmentOp1ATI, 758)
-       GL_STUB(glAlphaFragmentOp2ATI, 759)
-       GL_STUB(glAlphaFragmentOp3ATI, 760)
-       GL_STUB(glBeginFragmentShaderATI, 761)
-       GL_STUB(glBindFragmentShaderATI, 762)
-       GL_STUB(glColorFragmentOp1ATI, 763)
-       GL_STUB(glColorFragmentOp2ATI, 764)
-       GL_STUB(glColorFragmentOp3ATI, 765)
-       GL_STUB(glDeleteFragmentShaderATI, 766)
-       GL_STUB(glEndFragmentShaderATI, 767)
-       GL_STUB(glGenFragmentShadersATI, 768)
-       GL_STUB(glPassTexCoordATI, 769)
-       GL_STUB(glSampleMapATI, 770)
-       GL_STUB(glSetFragmentShaderConstantATI, 771)
-       GL_STUB(glPointParameteriNV, 772)
-       GL_STUB(glPointParameterivNV, 773)
-       GL_STUB(gl_dispatch_stub_774, 774)
-       HIDDEN(gl_dispatch_stub_774)
-       GL_STUB(gl_dispatch_stub_775, 775)
-       HIDDEN(gl_dispatch_stub_775)
-       GL_STUB(gl_dispatch_stub_776, 776)
-       HIDDEN(gl_dispatch_stub_776)
-       GL_STUB(gl_dispatch_stub_777, 777)
-       HIDDEN(gl_dispatch_stub_777)
-       GL_STUB(gl_dispatch_stub_778, 778)
-       HIDDEN(gl_dispatch_stub_778)
-       GL_STUB(glGetProgramNamedParameterdvNV, 779)
-       GL_STUB(glGetProgramNamedParameterfvNV, 780)
-       GL_STUB(glProgramNamedParameter4dNV, 781)
-       GL_STUB(glProgramNamedParameter4dvNV, 782)
-       GL_STUB(glProgramNamedParameter4fNV, 783)
-       GL_STUB(glProgramNamedParameter4fvNV, 784)
-       GL_STUB(glPrimitiveRestartIndexNV, 785)
-       GL_STUB(glPrimitiveRestartNV, 786)
-       GL_STUB(gl_dispatch_stub_787, 787)
-       HIDDEN(gl_dispatch_stub_787)
-       GL_STUB(gl_dispatch_stub_788, 788)
-       HIDDEN(gl_dispatch_stub_788)
-       GL_STUB(glBindFramebufferEXT, 789)
-       GL_STUB(glBindRenderbufferEXT, 790)
-       GL_STUB(glCheckFramebufferStatusEXT, 791)
-       GL_STUB(glDeleteFramebuffersEXT, 792)
-       GL_STUB(glDeleteRenderbuffersEXT, 793)
-       GL_STUB(glFramebufferRenderbufferEXT, 794)
-       GL_STUB(glFramebufferTexture1DEXT, 795)
-       GL_STUB(glFramebufferTexture2DEXT, 796)
-       GL_STUB(glFramebufferTexture3DEXT, 797)
-       GL_STUB(glGenFramebuffersEXT, 798)
-       GL_STUB(glGenRenderbuffersEXT, 799)
-       GL_STUB(glGenerateMipmapEXT, 800)
-       GL_STUB(glGetFramebufferAttachmentParameterivEXT, 801)
-       GL_STUB(glGetRenderbufferParameterivEXT, 802)
-       GL_STUB(glIsFramebufferEXT, 803)
-       GL_STUB(glIsRenderbufferEXT, 804)
-       GL_STUB(glRenderbufferStorageEXT, 805)
-       GL_STUB(gl_dispatch_stub_806, 806)
-       HIDDEN(gl_dispatch_stub_806)
-       GL_STUB(gl_dispatch_stub_807, 807)
-       HIDDEN(gl_dispatch_stub_807)
-       GL_STUB(gl_dispatch_stub_808, 808)
-       HIDDEN(gl_dispatch_stub_808)
-       GL_STUB(glBindFragDataLocationEXT, 809)
-       GL_STUB(glGetFragDataLocationEXT, 810)
-       GL_STUB(glGetUniformuivEXT, 811)
-       GL_STUB(glGetVertexAttribIivEXT, 812)
-       GL_STUB(glGetVertexAttribIuivEXT, 813)
-       GL_STUB(glUniform1uiEXT, 814)
-       GL_STUB(glUniform1uivEXT, 815)
-       GL_STUB(glUniform2uiEXT, 816)
-       GL_STUB(glUniform2uivEXT, 817)
-       GL_STUB(glUniform3uiEXT, 818)
-       GL_STUB(glUniform3uivEXT, 819)
-       GL_STUB(glUniform4uiEXT, 820)
-       GL_STUB(glUniform4uivEXT, 821)
-       GL_STUB(glVertexAttribI1iEXT, 822)
-       GL_STUB(glVertexAttribI1ivEXT, 823)
-       GL_STUB(glVertexAttribI1uiEXT, 824)
-       GL_STUB(glVertexAttribI1uivEXT, 825)
-       GL_STUB(glVertexAttribI2iEXT, 826)
-       GL_STUB(glVertexAttribI2ivEXT, 827)
-       GL_STUB(glVertexAttribI2uiEXT, 828)
-       GL_STUB(glVertexAttribI2uivEXT, 829)
-       GL_STUB(glVertexAttribI3iEXT, 830)
-       GL_STUB(glVertexAttribI3ivEXT, 831)
-       GL_STUB(glVertexAttribI3uiEXT, 832)
-       GL_STUB(glVertexAttribI3uivEXT, 833)
-       GL_STUB(glVertexAttribI4bvEXT, 834)
-       GL_STUB(glVertexAttribI4iEXT, 835)
-       GL_STUB(glVertexAttribI4ivEXT, 836)
-       GL_STUB(glVertexAttribI4svEXT, 837)
-       GL_STUB(glVertexAttribI4ubvEXT, 838)
-       GL_STUB(glVertexAttribI4uiEXT, 839)
-       GL_STUB(glVertexAttribI4uivEXT, 840)
-       GL_STUB(glVertexAttribI4usvEXT, 841)
-       GL_STUB(glVertexAttribIPointerEXT, 842)
-       GL_STUB(glFramebufferTextureLayerEXT, 843)
-       GL_STUB(glColorMaskIndexedEXT, 844)
-       GL_STUB(glDisableIndexedEXT, 845)
-       GL_STUB(glEnableIndexedEXT, 846)
-       GL_STUB(glGetBooleanIndexedvEXT, 847)
-       GL_STUB(glGetIntegerIndexedvEXT, 848)
-       GL_STUB(glIsEnabledIndexedEXT, 849)
-       GL_STUB(glClearColorIiEXT, 850)
-       GL_STUB(glClearColorIuiEXT, 851)
-       GL_STUB(glGetTexParameterIivEXT, 852)
-       GL_STUB(glGetTexParameterIuivEXT, 853)
-       GL_STUB(glTexParameterIivEXT, 854)
-       GL_STUB(glTexParameterIuivEXT, 855)
-       GL_STUB(glBeginConditionalRenderNV, 856)
-       GL_STUB(glEndConditionalRenderNV, 857)
-       GL_STUB(glBeginTransformFeedbackEXT, 858)
-       GL_STUB(glBindBufferBaseEXT, 859)
-       GL_STUB(glBindBufferOffsetEXT, 860)
-       GL_STUB(glBindBufferRangeEXT, 861)
-       GL_STUB(glEndTransformFeedbackEXT, 862)
-       GL_STUB(glGetTransformFeedbackVaryingEXT, 863)
-       GL_STUB(glTransformFeedbackVaryingsEXT, 864)
-       GL_STUB(glProvokingVertexEXT, 865)
-       GL_STUB(gl_dispatch_stub_866, 866)
-       HIDDEN(gl_dispatch_stub_866)
-       GL_STUB(gl_dispatch_stub_867, 867)
-       HIDDEN(gl_dispatch_stub_867)
-       GL_STUB(glGetObjectParameterivAPPLE, 868)
-       GL_STUB(glObjectPurgeableAPPLE, 869)
-       GL_STUB(glObjectUnpurgeableAPPLE, 870)
-       GL_STUB(glActiveProgramEXT, 871)
-       GL_STUB(glCreateShaderProgramEXT, 872)
-       GL_STUB(glUseShaderProgramEXT, 873)
-       GL_STUB(gl_dispatch_stub_874, 874)
-       HIDDEN(gl_dispatch_stub_874)
-       GL_STUB(gl_dispatch_stub_875, 875)
-       HIDDEN(gl_dispatch_stub_875)
-       GL_STUB(gl_dispatch_stub_876, 876)
-       HIDDEN(gl_dispatch_stub_876)
-       GL_STUB(gl_dispatch_stub_877, 877)
-       HIDDEN(gl_dispatch_stub_877)
-       GL_STUB(gl_dispatch_stub_878, 878)
-       HIDDEN(gl_dispatch_stub_878)
-       GL_STUB(glEGLImageTargetRenderbufferStorageOES, 879)
-       GL_STUB(glEGLImageTargetTexture2DOES, 880)
+       GL_STUB(gl_dispatch_stub_694, 694)
+       HIDDEN(gl_dispatch_stub_694)
+       GL_STUB(gl_dispatch_stub_695, 695)
+       HIDDEN(gl_dispatch_stub_695)
+       GL_STUB(gl_dispatch_stub_696, 696)
+       HIDDEN(gl_dispatch_stub_696)
+       GL_STUB(gl_dispatch_stub_697, 697)
+       HIDDEN(gl_dispatch_stub_697)
+       GL_STUB(gl_dispatch_stub_698, 698)
+       HIDDEN(gl_dispatch_stub_698)
+       GL_STUB(glAreProgramsResidentNV, 699)
+       GL_STUB(glBindProgramNV, 700)
+       GL_STUB(glDeleteProgramsNV, 701)
+       GL_STUB(glExecuteProgramNV, 702)
+       GL_STUB(glGenProgramsNV, 703)
+       GL_STUB(glGetProgramParameterdvNV, 704)
+       GL_STUB(glGetProgramParameterfvNV, 705)
+       GL_STUB(glGetProgramStringNV, 706)
+       GL_STUB(glGetProgramivNV, 707)
+       GL_STUB(glGetTrackMatrixivNV, 708)
+       GL_STUB(glGetVertexAttribPointervNV, 709)
+       GL_STUB(glGetVertexAttribdvNV, 710)
+       GL_STUB(glGetVertexAttribfvNV, 711)
+       GL_STUB(glGetVertexAttribivNV, 712)
+       GL_STUB(glIsProgramNV, 713)
+       GL_STUB(glLoadProgramNV, 714)
+       GL_STUB(glProgramParameters4dvNV, 715)
+       GL_STUB(glProgramParameters4fvNV, 716)
+       GL_STUB(glRequestResidentProgramsNV, 717)
+       GL_STUB(glTrackMatrixNV, 718)
+       GL_STUB(glVertexAttrib1dNV, 719)
+       GL_STUB(glVertexAttrib1dvNV, 720)
+       GL_STUB(glVertexAttrib1fNV, 721)
+       GL_STUB(glVertexAttrib1fvNV, 722)
+       GL_STUB(glVertexAttrib1sNV, 723)
+       GL_STUB(glVertexAttrib1svNV, 724)
+       GL_STUB(glVertexAttrib2dNV, 725)
+       GL_STUB(glVertexAttrib2dvNV, 726)
+       GL_STUB(glVertexAttrib2fNV, 727)
+       GL_STUB(glVertexAttrib2fvNV, 728)
+       GL_STUB(glVertexAttrib2sNV, 729)
+       GL_STUB(glVertexAttrib2svNV, 730)
+       GL_STUB(glVertexAttrib3dNV, 731)
+       GL_STUB(glVertexAttrib3dvNV, 732)
+       GL_STUB(glVertexAttrib3fNV, 733)
+       GL_STUB(glVertexAttrib3fvNV, 734)
+       GL_STUB(glVertexAttrib3sNV, 735)
+       GL_STUB(glVertexAttrib3svNV, 736)
+       GL_STUB(glVertexAttrib4dNV, 737)
+       GL_STUB(glVertexAttrib4dvNV, 738)
+       GL_STUB(glVertexAttrib4fNV, 739)
+       GL_STUB(glVertexAttrib4fvNV, 740)
+       GL_STUB(glVertexAttrib4sNV, 741)
+       GL_STUB(glVertexAttrib4svNV, 742)
+       GL_STUB(glVertexAttrib4ubNV, 743)
+       GL_STUB(glVertexAttrib4ubvNV, 744)
+       GL_STUB(glVertexAttribPointerNV, 745)
+       GL_STUB(glVertexAttribs1dvNV, 746)
+       GL_STUB(glVertexAttribs1fvNV, 747)
+       GL_STUB(glVertexAttribs1svNV, 748)
+       GL_STUB(glVertexAttribs2dvNV, 749)
+       GL_STUB(glVertexAttribs2fvNV, 750)
+       GL_STUB(glVertexAttribs2svNV, 751)
+       GL_STUB(glVertexAttribs3dvNV, 752)
+       GL_STUB(glVertexAttribs3fvNV, 753)
+       GL_STUB(glVertexAttribs3svNV, 754)
+       GL_STUB(glVertexAttribs4dvNV, 755)
+       GL_STUB(glVertexAttribs4fvNV, 756)
+       GL_STUB(glVertexAttribs4svNV, 757)
+       GL_STUB(glVertexAttribs4ubvNV, 758)
+       GL_STUB(glGetTexBumpParameterfvATI, 759)
+       GL_STUB(glGetTexBumpParameterivATI, 760)
+       GL_STUB(glTexBumpParameterfvATI, 761)
+       GL_STUB(glTexBumpParameterivATI, 762)
+       GL_STUB(glAlphaFragmentOp1ATI, 763)
+       GL_STUB(glAlphaFragmentOp2ATI, 764)
+       GL_STUB(glAlphaFragmentOp3ATI, 765)
+       GL_STUB(glBeginFragmentShaderATI, 766)
+       GL_STUB(glBindFragmentShaderATI, 767)
+       GL_STUB(glColorFragmentOp1ATI, 768)
+       GL_STUB(glColorFragmentOp2ATI, 769)
+       GL_STUB(glColorFragmentOp3ATI, 770)
+       GL_STUB(glDeleteFragmentShaderATI, 771)
+       GL_STUB(glEndFragmentShaderATI, 772)
+       GL_STUB(glGenFragmentShadersATI, 773)
+       GL_STUB(glPassTexCoordATI, 774)
+       GL_STUB(glSampleMapATI, 775)
+       GL_STUB(glSetFragmentShaderConstantATI, 776)
+       GL_STUB(glPointParameteriNV, 777)
+       GL_STUB(glPointParameterivNV, 778)
+       GL_STUB(gl_dispatch_stub_779, 779)
+       HIDDEN(gl_dispatch_stub_779)
+       GL_STUB(gl_dispatch_stub_780, 780)
+       HIDDEN(gl_dispatch_stub_780)
+       GL_STUB(gl_dispatch_stub_781, 781)
+       HIDDEN(gl_dispatch_stub_781)
+       GL_STUB(gl_dispatch_stub_782, 782)
+       HIDDEN(gl_dispatch_stub_782)
+       GL_STUB(gl_dispatch_stub_783, 783)
+       HIDDEN(gl_dispatch_stub_783)
+       GL_STUB(glGetProgramNamedParameterdvNV, 784)
+       GL_STUB(glGetProgramNamedParameterfvNV, 785)
+       GL_STUB(glProgramNamedParameter4dNV, 786)
+       GL_STUB(glProgramNamedParameter4dvNV, 787)
+       GL_STUB(glProgramNamedParameter4fNV, 788)
+       GL_STUB(glProgramNamedParameter4fvNV, 789)
+       GL_STUB(glPrimitiveRestartIndexNV, 790)
+       GL_STUB(glPrimitiveRestartNV, 791)
+       GL_STUB(gl_dispatch_stub_792, 792)
+       HIDDEN(gl_dispatch_stub_792)
+       GL_STUB(gl_dispatch_stub_793, 793)
+       HIDDEN(gl_dispatch_stub_793)
+       GL_STUB(glBindFramebufferEXT, 794)
+       GL_STUB(glBindRenderbufferEXT, 795)
+       GL_STUB(glCheckFramebufferStatusEXT, 796)
+       GL_STUB(glDeleteFramebuffersEXT, 797)
+       GL_STUB(glDeleteRenderbuffersEXT, 798)
+       GL_STUB(glFramebufferRenderbufferEXT, 799)
+       GL_STUB(glFramebufferTexture1DEXT, 800)
+       GL_STUB(glFramebufferTexture2DEXT, 801)
+       GL_STUB(glFramebufferTexture3DEXT, 802)
+       GL_STUB(glGenFramebuffersEXT, 803)
+       GL_STUB(glGenRenderbuffersEXT, 804)
+       GL_STUB(glGenerateMipmapEXT, 805)
+       GL_STUB(glGetFramebufferAttachmentParameterivEXT, 806)
+       GL_STUB(glGetRenderbufferParameterivEXT, 807)
+       GL_STUB(glIsFramebufferEXT, 808)
+       GL_STUB(glIsRenderbufferEXT, 809)
+       GL_STUB(glRenderbufferStorageEXT, 810)
+       GL_STUB(gl_dispatch_stub_811, 811)
+       HIDDEN(gl_dispatch_stub_811)
+       GL_STUB(gl_dispatch_stub_812, 812)
+       HIDDEN(gl_dispatch_stub_812)
+       GL_STUB(gl_dispatch_stub_813, 813)
+       HIDDEN(gl_dispatch_stub_813)
+       GL_STUB(glBindFragDataLocationEXT, 814)
+       GL_STUB(glGetFragDataLocationEXT, 815)
+       GL_STUB(glGetUniformuivEXT, 816)
+       GL_STUB(glGetVertexAttribIivEXT, 817)
+       GL_STUB(glGetVertexAttribIuivEXT, 818)
+       GL_STUB(glUniform1uiEXT, 819)
+       GL_STUB(glUniform1uivEXT, 820)
+       GL_STUB(glUniform2uiEXT, 821)
+       GL_STUB(glUniform2uivEXT, 822)
+       GL_STUB(glUniform3uiEXT, 823)
+       GL_STUB(glUniform3uivEXT, 824)
+       GL_STUB(glUniform4uiEXT, 825)
+       GL_STUB(glUniform4uivEXT, 826)
+       GL_STUB(glVertexAttribI1iEXT, 827)
+       GL_STUB(glVertexAttribI1ivEXT, 828)
+       GL_STUB(glVertexAttribI1uiEXT, 829)
+       GL_STUB(glVertexAttribI1uivEXT, 830)
+       GL_STUB(glVertexAttribI2iEXT, 831)
+       GL_STUB(glVertexAttribI2ivEXT, 832)
+       GL_STUB(glVertexAttribI2uiEXT, 833)
+       GL_STUB(glVertexAttribI2uivEXT, 834)
+       GL_STUB(glVertexAttribI3iEXT, 835)
+       GL_STUB(glVertexAttribI3ivEXT, 836)
+       GL_STUB(glVertexAttribI3uiEXT, 837)
+       GL_STUB(glVertexAttribI3uivEXT, 838)
+       GL_STUB(glVertexAttribI4bvEXT, 839)
+       GL_STUB(glVertexAttribI4iEXT, 840)
+       GL_STUB(glVertexAttribI4ivEXT, 841)
+       GL_STUB(glVertexAttribI4svEXT, 842)
+       GL_STUB(glVertexAttribI4ubvEXT, 843)
+       GL_STUB(glVertexAttribI4uiEXT, 844)
+       GL_STUB(glVertexAttribI4uivEXT, 845)
+       GL_STUB(glVertexAttribI4usvEXT, 846)
+       GL_STUB(glVertexAttribIPointerEXT, 847)
+       GL_STUB(glFramebufferTextureLayerEXT, 848)
+       GL_STUB(glColorMaskIndexedEXT, 849)
+       GL_STUB(glDisableIndexedEXT, 850)
+       GL_STUB(glEnableIndexedEXT, 851)
+       GL_STUB(glGetBooleanIndexedvEXT, 852)
+       GL_STUB(glGetIntegerIndexedvEXT, 853)
+       GL_STUB(glIsEnabledIndexedEXT, 854)
+       GL_STUB(glClearColorIiEXT, 855)
+       GL_STUB(glClearColorIuiEXT, 856)
+       GL_STUB(glGetTexParameterIivEXT, 857)
+       GL_STUB(glGetTexParameterIuivEXT, 858)
+       GL_STUB(glTexParameterIivEXT, 859)
+       GL_STUB(glTexParameterIuivEXT, 860)
+       GL_STUB(glBeginConditionalRenderNV, 861)
+       GL_STUB(glEndConditionalRenderNV, 862)
+       GL_STUB(glBeginTransformFeedbackEXT, 863)
+       GL_STUB(glBindBufferBaseEXT, 864)
+       GL_STUB(glBindBufferOffsetEXT, 865)
+       GL_STUB(glBindBufferRangeEXT, 866)
+       GL_STUB(glEndTransformFeedbackEXT, 867)
+       GL_STUB(glGetTransformFeedbackVaryingEXT, 868)
+       GL_STUB(glTransformFeedbackVaryingsEXT, 869)
+       GL_STUB(glProvokingVertexEXT, 870)
+       GL_STUB(gl_dispatch_stub_871, 871)
+       HIDDEN(gl_dispatch_stub_871)
+       GL_STUB(gl_dispatch_stub_872, 872)
+       HIDDEN(gl_dispatch_stub_872)
+       GL_STUB(glGetObjectParameterivAPPLE, 873)
+       GL_STUB(glObjectPurgeableAPPLE, 874)
+       GL_STUB(glObjectUnpurgeableAPPLE, 875)
+       GL_STUB(glActiveProgramEXT, 876)
+       GL_STUB(glCreateShaderProgramEXT, 877)
+       GL_STUB(glUseShaderProgramEXT, 878)
+       GL_STUB(gl_dispatch_stub_879, 879)
+       HIDDEN(gl_dispatch_stub_879)
+       GL_STUB(gl_dispatch_stub_880, 880)
+       HIDDEN(gl_dispatch_stub_880)
+       GL_STUB(gl_dispatch_stub_881, 881)
+       HIDDEN(gl_dispatch_stub_881)
+       GL_STUB(gl_dispatch_stub_882, 882)
+       HIDDEN(gl_dispatch_stub_882)
+       GL_STUB(gl_dispatch_stub_883, 883)
+       HIDDEN(gl_dispatch_stub_883)
+       GL_STUB(glEGLImageTargetRenderbufferStorageOES, 884)
+       GL_STUB(glEGLImageTargetTexture2DOES, 885)
        GL_STUB_ALIAS(glArrayElementEXT, glArrayElement)
        GL_STUB_ALIAS(glBindTextureEXT, glBindTexture)
        GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays)
index ce0cf680b1ddcbee2a6dad076eaa36e773aff546..5474e04f53a9dd18ab05a96217d35ab7f40a529e 100644 (file)
@@ -45,7 +45,7 @@
 #  define GL_PREFIX(n) GLNAME(CONCAT(gl,n))
 # endif
 
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)
 #  define THREADS
 #endif
 
@@ -22627,21 +22627,17 @@ GL_PREFIX(ResumeTransformFeedback):
        .size   GL_PREFIX(ResumeTransformFeedback), .-GL_PREFIX(ResumeTransformFeedback)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(PolygonOffsetEXT)
-       .type   GL_PREFIX(PolygonOffsetEXT), @function
-GL_PREFIX(PolygonOffsetEXT):
+       .globl  GL_PREFIX(ClearDepthf)
+       .type   GL_PREFIX(ClearDepthf), @function
+GL_PREFIX(ClearDepthf):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    4800(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
-       subq    $24, %rsp
-       movq    %xmm0, (%rsp)
-       movq    %xmm1, 8(%rsp)
+       pushq   %rdi
        call    _x86_64_get_dispatch@PLT
-       movq    8(%rsp), %xmm1
-       movq    (%rsp), %xmm0
-       addq    $24, %rsp
+       popq    %rdi
        movq    4800(%rax), %r11
        jmp     *%r11
 #else
@@ -22651,23 +22647,18 @@ GL_PREFIX(PolygonOffsetEXT):
        movq    4800(%rax), %r11
        jmp     *%r11
 1:
-       subq    $24, %rsp
-       movq    %xmm0, (%rsp)
-       movq    %xmm1, 8(%rsp)
+       pushq   %rdi
        call    _glapi_get_dispatch
-       movq    8(%rsp), %xmm1
-       movq    (%rsp), %xmm0
-       addq    $24, %rsp
+       popq    %rdi
        movq    4800(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(PolygonOffsetEXT), .-GL_PREFIX(PolygonOffsetEXT)
+       .size   GL_PREFIX(ClearDepthf), .-GL_PREFIX(ClearDepthf)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_601)
-       .type   GL_PREFIX(_dispatch_stub_601), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_601))
-GL_PREFIX(_dispatch_stub_601):
+       .globl  GL_PREFIX(DepthRangef)
+       .type   GL_PREFIX(DepthRangef), @function
+GL_PREFIX(DepthRangef):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    4808(%rax), %r11
@@ -22699,13 +22690,12 @@ GL_PREFIX(_dispatch_stub_601):
        movq    4808(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_601), .-GL_PREFIX(_dispatch_stub_601)
+       .size   GL_PREFIX(DepthRangef), .-GL_PREFIX(DepthRangef)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_602)
-       .type   GL_PREFIX(_dispatch_stub_602), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_602))
-GL_PREFIX(_dispatch_stub_602):
+       .globl  GL_PREFIX(GetShaderPrecisionFormat)
+       .type   GL_PREFIX(GetShaderPrecisionFormat), @function
+GL_PREFIX(GetShaderPrecisionFormat):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    4816(%rax), %r11
@@ -22713,9 +22703,13 @@ GL_PREFIX(_dispatch_stub_602):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    4816(%rax), %r11
@@ -22729,33 +22723,32 @@ GL_PREFIX(_dispatch_stub_602):
 1:
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    4816(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_602), .-GL_PREFIX(_dispatch_stub_602)
+       .size   GL_PREFIX(GetShaderPrecisionFormat), .-GL_PREFIX(GetShaderPrecisionFormat)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_603)
-       .type   GL_PREFIX(_dispatch_stub_603), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_603))
-GL_PREFIX(_dispatch_stub_603):
+       .globl  GL_PREFIX(ReleaseShaderCompiler)
+       .type   GL_PREFIX(ReleaseShaderCompiler), @function
+GL_PREFIX(ReleaseShaderCompiler):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    4824(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
-       subq    $24, %rsp
-       movq    %rdi, (%rsp)
-       movq    %xmm0, 8(%rsp)
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       movq    8(%rsp), %xmm0
-       movq    (%rsp), %rdi
-       addq    $24, %rsp
+       popq    %rbp
        movq    4824(%rax), %r11
        jmp     *%r11
 #else
@@ -22765,23 +22758,18 @@ GL_PREFIX(_dispatch_stub_603):
        movq    4824(%rax), %r11
        jmp     *%r11
 1:
-       subq    $24, %rsp
-       movq    %rdi, (%rsp)
-       movq    %xmm0, 8(%rsp)
+       pushq   %rbp
        call    _glapi_get_dispatch
-       movq    8(%rsp), %xmm0
-       movq    (%rsp), %rdi
-       addq    $24, %rsp
+       popq    %rbp
        movq    4824(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_603), .-GL_PREFIX(_dispatch_stub_603)
+       .size   GL_PREFIX(ReleaseShaderCompiler), .-GL_PREFIX(ReleaseShaderCompiler)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_604)
-       .type   GL_PREFIX(_dispatch_stub_604), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_604))
-GL_PREFIX(_dispatch_stub_604):
+       .globl  GL_PREFIX(ShaderBinary)
+       .type   GL_PREFIX(ShaderBinary), @function
+GL_PREFIX(ShaderBinary):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    4832(%rax), %r11
@@ -22789,9 +22777,13 @@ GL_PREFIX(_dispatch_stub_604):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    4832(%rax), %r11
@@ -22805,33 +22797,36 @@ GL_PREFIX(_dispatch_stub_604):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    4832(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_604), .-GL_PREFIX(_dispatch_stub_604)
+       .size   GL_PREFIX(ShaderBinary), .-GL_PREFIX(ShaderBinary)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_605)
-       .type   GL_PREFIX(_dispatch_stub_605), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_605))
-GL_PREFIX(_dispatch_stub_605):
+       .globl  GL_PREFIX(PolygonOffsetEXT)
+       .type   GL_PREFIX(PolygonOffsetEXT), @function
+GL_PREFIX(PolygonOffsetEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    4840(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
+       subq    $24, %rsp
+       movq    %xmm0, (%rsp)
+       movq    %xmm1, 8(%rsp)
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
+       movq    8(%rsp), %xmm1
+       movq    (%rsp), %xmm0
+       addq    $24, %rsp
        movq    4840(%rax), %r11
        jmp     *%r11
 #else
@@ -22841,17 +22836,17 @@ GL_PREFIX(_dispatch_stub_605):
        movq    4840(%rax), %r11
        jmp     *%r11
 1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
+       subq    $24, %rsp
+       movq    %xmm0, (%rsp)
+       movq    %xmm1, 8(%rsp)
        call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
+       movq    8(%rsp), %xmm1
+       movq    (%rsp), %xmm0
+       addq    $24, %rsp
        movq    4840(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_605), .-GL_PREFIX(_dispatch_stub_605)
+       .size   GL_PREFIX(PolygonOffsetEXT), .-GL_PREFIX(PolygonOffsetEXT)
 
        .p2align        4,,15
        .globl  GL_PREFIX(_dispatch_stub_606)
@@ -22939,9 +22934,13 @@ GL_PREFIX(_dispatch_stub_608):
        movq    4864(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
-       pushq   %rdi
+       subq    $24, %rsp
+       movq    %rdi, (%rsp)
+       movq    %xmm0, 8(%rsp)
        call    _x86_64_get_dispatch@PLT
-       popq    %rdi
+       movq    8(%rsp), %xmm0
+       movq    (%rsp), %rdi
+       addq    $24, %rsp
        movq    4864(%rax), %r11
        jmp     *%r11
 #else
@@ -22951,21 +22950,207 @@ GL_PREFIX(_dispatch_stub_608):
        movq    4864(%rax), %r11
        jmp     *%r11
 1:
-       pushq   %rdi
+       subq    $24, %rsp
+       movq    %rdi, (%rsp)
+       movq    %xmm0, 8(%rsp)
        call    _glapi_get_dispatch
-       popq    %rdi
+       movq    8(%rsp), %xmm0
+       movq    (%rsp), %rdi
+       addq    $24, %rsp
        movq    4864(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(_dispatch_stub_608), .-GL_PREFIX(_dispatch_stub_608)
 
+       .p2align        4,,15
+       .globl  GL_PREFIX(_dispatch_stub_609)
+       .type   GL_PREFIX(_dispatch_stub_609), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_609))
+GL_PREFIX(_dispatch_stub_609):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    4872(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4872(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    4872(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4872(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(_dispatch_stub_609), .-GL_PREFIX(_dispatch_stub_609)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(_dispatch_stub_610)
+       .type   GL_PREFIX(_dispatch_stub_610), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_610))
+GL_PREFIX(_dispatch_stub_610):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    4880(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4880(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    4880(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4880(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(_dispatch_stub_610), .-GL_PREFIX(_dispatch_stub_610)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(_dispatch_stub_611)
+       .type   GL_PREFIX(_dispatch_stub_611), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_611))
+GL_PREFIX(_dispatch_stub_611):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    4888(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4888(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    4888(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4888(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(_dispatch_stub_611), .-GL_PREFIX(_dispatch_stub_611)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(_dispatch_stub_612)
+       .type   GL_PREFIX(_dispatch_stub_612), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_612))
+GL_PREFIX(_dispatch_stub_612):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    4896(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4896(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    4896(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    4896(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(_dispatch_stub_612), .-GL_PREFIX(_dispatch_stub_612)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(_dispatch_stub_613)
+       .type   GL_PREFIX(_dispatch_stub_613), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_613))
+GL_PREFIX(_dispatch_stub_613):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    4904(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       call    _x86_64_get_dispatch@PLT
+       popq    %rdi
+       movq    4904(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    4904(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       call    _glapi_get_dispatch
+       popq    %rdi
+       movq    4904(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(_dispatch_stub_613), .-GL_PREFIX(_dispatch_stub_613)
+
        .p2align        4,,15
        .globl  GL_PREFIX(ColorPointerEXT)
        .type   GL_PREFIX(ColorPointerEXT), @function
 GL_PREFIX(ColorPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4872(%rax), %r11
+       movq    4912(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -22979,13 +23164,13 @@ GL_PREFIX(ColorPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4872(%rax), %r11
+       movq    4912(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4872(%rax), %r11
+       movq    4912(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -22999,7 +23184,7 @@ GL_PREFIX(ColorPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4872(%rax), %r11
+       movq    4912(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ColorPointerEXT), .-GL_PREFIX(ColorPointerEXT)
@@ -23010,7 +23195,7 @@ GL_PREFIX(ColorPointerEXT):
 GL_PREFIX(EdgeFlagPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4880(%rax), %r11
+       movq    4920(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23020,13 +23205,13 @@ GL_PREFIX(EdgeFlagPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4880(%rax), %r11
+       movq    4920(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4880(%rax), %r11
+       movq    4920(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23036,7 +23221,7 @@ GL_PREFIX(EdgeFlagPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4880(%rax), %r11
+       movq    4920(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(EdgeFlagPointerEXT), .-GL_PREFIX(EdgeFlagPointerEXT)
@@ -23047,7 +23232,7 @@ GL_PREFIX(EdgeFlagPointerEXT):
 GL_PREFIX(IndexPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4888(%rax), %r11
+       movq    4928(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23061,13 +23246,13 @@ GL_PREFIX(IndexPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4888(%rax), %r11
+       movq    4928(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4888(%rax), %r11
+       movq    4928(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23081,7 +23266,7 @@ GL_PREFIX(IndexPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4888(%rax), %r11
+       movq    4928(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(IndexPointerEXT), .-GL_PREFIX(IndexPointerEXT)
@@ -23092,7 +23277,7 @@ GL_PREFIX(IndexPointerEXT):
 GL_PREFIX(NormalPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4896(%rax), %r11
+       movq    4936(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23106,13 +23291,13 @@ GL_PREFIX(NormalPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4896(%rax), %r11
+       movq    4936(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4896(%rax), %r11
+       movq    4936(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23126,7 +23311,7 @@ GL_PREFIX(NormalPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4896(%rax), %r11
+       movq    4936(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(NormalPointerEXT), .-GL_PREFIX(NormalPointerEXT)
@@ -23137,7 +23322,7 @@ GL_PREFIX(NormalPointerEXT):
 GL_PREFIX(TexCoordPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4904(%rax), %r11
+       movq    4944(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23151,13 +23336,13 @@ GL_PREFIX(TexCoordPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4904(%rax), %r11
+       movq    4944(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4904(%rax), %r11
+       movq    4944(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23171,7 +23356,7 @@ GL_PREFIX(TexCoordPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4904(%rax), %r11
+       movq    4944(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(TexCoordPointerEXT), .-GL_PREFIX(TexCoordPointerEXT)
@@ -23182,7 +23367,7 @@ GL_PREFIX(TexCoordPointerEXT):
 GL_PREFIX(VertexPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4912(%rax), %r11
+       movq    4952(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23196,13 +23381,13 @@ GL_PREFIX(VertexPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4912(%rax), %r11
+       movq    4952(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4912(%rax), %r11
+       movq    4952(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23216,7 +23401,7 @@ GL_PREFIX(VertexPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4912(%rax), %r11
+       movq    4952(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexPointerEXT), .-GL_PREFIX(VertexPointerEXT)
@@ -23227,7 +23412,7 @@ GL_PREFIX(VertexPointerEXT):
 GL_PREFIX(PointParameterfEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4920(%rax), %r11
+       movq    4960(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -23237,13 +23422,13 @@ GL_PREFIX(PointParameterfEXT):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    4920(%rax), %r11
+       movq    4960(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4920(%rax), %r11
+       movq    4960(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -23253,7 +23438,7 @@ GL_PREFIX(PointParameterfEXT):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    4920(%rax), %r11
+       movq    4960(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PointParameterfEXT), .-GL_PREFIX(PointParameterfEXT)
@@ -23264,7 +23449,7 @@ GL_PREFIX(PointParameterfEXT):
 GL_PREFIX(PointParameterfvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4928(%rax), %r11
+       movq    4968(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23274,13 +23459,13 @@ GL_PREFIX(PointParameterfvEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    4928(%rax), %r11
+       movq    4968(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4928(%rax), %r11
+       movq    4968(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23290,7 +23475,7 @@ GL_PREFIX(PointParameterfvEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    4928(%rax), %r11
+       movq    4968(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PointParameterfvEXT), .-GL_PREFIX(PointParameterfvEXT)
@@ -23301,7 +23486,7 @@ GL_PREFIX(PointParameterfvEXT):
 GL_PREFIX(LockArraysEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4936(%rax), %r11
+       movq    4976(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23311,13 +23496,13 @@ GL_PREFIX(LockArraysEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    4936(%rax), %r11
+       movq    4976(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4936(%rax), %r11
+       movq    4976(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23327,7 +23512,7 @@ GL_PREFIX(LockArraysEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    4936(%rax), %r11
+       movq    4976(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(LockArraysEXT), .-GL_PREFIX(LockArraysEXT)
@@ -23338,25 +23523,25 @@ GL_PREFIX(LockArraysEXT):
 GL_PREFIX(UnlockArraysEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4944(%rax), %r11
+       movq    4984(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       movq    4944(%rax), %r11
+       movq    4984(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4944(%rax), %r11
+       movq    4984(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       movq    4944(%rax), %r11
+       movq    4984(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(UnlockArraysEXT), .-GL_PREFIX(UnlockArraysEXT)
@@ -23367,7 +23552,7 @@ GL_PREFIX(UnlockArraysEXT):
 GL_PREFIX(SecondaryColor3bEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4952(%rax), %r11
+       movq    4992(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23377,13 +23562,13 @@ GL_PREFIX(SecondaryColor3bEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4952(%rax), %r11
+       movq    4992(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4952(%rax), %r11
+       movq    4992(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23393,7 +23578,7 @@ GL_PREFIX(SecondaryColor3bEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    4952(%rax), %r11
+       movq    4992(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3bEXT), .-GL_PREFIX(SecondaryColor3bEXT)
@@ -23404,25 +23589,25 @@ GL_PREFIX(SecondaryColor3bEXT):
 GL_PREFIX(SecondaryColor3bvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4960(%rax), %r11
+       movq    5000(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    4960(%rax), %r11
+       movq    5000(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4960(%rax), %r11
+       movq    5000(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    4960(%rax), %r11
+       movq    5000(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3bvEXT), .-GL_PREFIX(SecondaryColor3bvEXT)
@@ -23433,7 +23618,7 @@ GL_PREFIX(SecondaryColor3bvEXT):
 GL_PREFIX(SecondaryColor3dEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4968(%rax), %r11
+       movq    5008(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -23445,13 +23630,13 @@ GL_PREFIX(SecondaryColor3dEXT):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    4968(%rax), %r11
+       movq    5008(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4968(%rax), %r11
+       movq    5008(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -23463,7 +23648,7 @@ GL_PREFIX(SecondaryColor3dEXT):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    4968(%rax), %r11
+       movq    5008(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3dEXT), .-GL_PREFIX(SecondaryColor3dEXT)
@@ -23474,25 +23659,25 @@ GL_PREFIX(SecondaryColor3dEXT):
 GL_PREFIX(SecondaryColor3dvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4976(%rax), %r11
+       movq    5016(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    4976(%rax), %r11
+       movq    5016(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4976(%rax), %r11
+       movq    5016(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    4976(%rax), %r11
+       movq    5016(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3dvEXT), .-GL_PREFIX(SecondaryColor3dvEXT)
@@ -23503,7 +23688,7 @@ GL_PREFIX(SecondaryColor3dvEXT):
 GL_PREFIX(SecondaryColor3fEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4984(%rax), %r11
+       movq    5024(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -23515,13 +23700,13 @@ GL_PREFIX(SecondaryColor3fEXT):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    4984(%rax), %r11
+       movq    5024(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4984(%rax), %r11
+       movq    5024(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -23533,7 +23718,7 @@ GL_PREFIX(SecondaryColor3fEXT):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    4984(%rax), %r11
+       movq    5024(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3fEXT), .-GL_PREFIX(SecondaryColor3fEXT)
@@ -23544,25 +23729,25 @@ GL_PREFIX(SecondaryColor3fEXT):
 GL_PREFIX(SecondaryColor3fvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    4992(%rax), %r11
+       movq    5032(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    4992(%rax), %r11
+       movq    5032(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    4992(%rax), %r11
+       movq    5032(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    4992(%rax), %r11
+       movq    5032(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3fvEXT), .-GL_PREFIX(SecondaryColor3fvEXT)
@@ -23573,7 +23758,7 @@ GL_PREFIX(SecondaryColor3fvEXT):
 GL_PREFIX(SecondaryColor3iEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5000(%rax), %r11
+       movq    5040(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23583,13 +23768,13 @@ GL_PREFIX(SecondaryColor3iEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5000(%rax), %r11
+       movq    5040(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5000(%rax), %r11
+       movq    5040(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23599,7 +23784,7 @@ GL_PREFIX(SecondaryColor3iEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5000(%rax), %r11
+       movq    5040(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3iEXT), .-GL_PREFIX(SecondaryColor3iEXT)
@@ -23610,25 +23795,25 @@ GL_PREFIX(SecondaryColor3iEXT):
 GL_PREFIX(SecondaryColor3ivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5008(%rax), %r11
+       movq    5048(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5008(%rax), %r11
+       movq    5048(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5008(%rax), %r11
+       movq    5048(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5008(%rax), %r11
+       movq    5048(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3ivEXT), .-GL_PREFIX(SecondaryColor3ivEXT)
@@ -23639,7 +23824,7 @@ GL_PREFIX(SecondaryColor3ivEXT):
 GL_PREFIX(SecondaryColor3sEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5016(%rax), %r11
+       movq    5056(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23649,13 +23834,13 @@ GL_PREFIX(SecondaryColor3sEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5016(%rax), %r11
+       movq    5056(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5016(%rax), %r11
+       movq    5056(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23665,7 +23850,7 @@ GL_PREFIX(SecondaryColor3sEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5016(%rax), %r11
+       movq    5056(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3sEXT), .-GL_PREFIX(SecondaryColor3sEXT)
@@ -23676,25 +23861,25 @@ GL_PREFIX(SecondaryColor3sEXT):
 GL_PREFIX(SecondaryColor3svEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5024(%rax), %r11
+       movq    5064(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5024(%rax), %r11
+       movq    5064(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5024(%rax), %r11
+       movq    5064(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5024(%rax), %r11
+       movq    5064(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3svEXT), .-GL_PREFIX(SecondaryColor3svEXT)
@@ -23705,7 +23890,7 @@ GL_PREFIX(SecondaryColor3svEXT):
 GL_PREFIX(SecondaryColor3ubEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5032(%rax), %r11
+       movq    5072(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23715,13 +23900,13 @@ GL_PREFIX(SecondaryColor3ubEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5032(%rax), %r11
+       movq    5072(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5032(%rax), %r11
+       movq    5072(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23731,7 +23916,7 @@ GL_PREFIX(SecondaryColor3ubEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5032(%rax), %r11
+       movq    5072(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3ubEXT), .-GL_PREFIX(SecondaryColor3ubEXT)
@@ -23742,25 +23927,25 @@ GL_PREFIX(SecondaryColor3ubEXT):
 GL_PREFIX(SecondaryColor3ubvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5040(%rax), %r11
+       movq    5080(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5040(%rax), %r11
+       movq    5080(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5040(%rax), %r11
+       movq    5080(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5040(%rax), %r11
+       movq    5080(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3ubvEXT), .-GL_PREFIX(SecondaryColor3ubvEXT)
@@ -23771,7 +23956,7 @@ GL_PREFIX(SecondaryColor3ubvEXT):
 GL_PREFIX(SecondaryColor3uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5048(%rax), %r11
+       movq    5088(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23781,13 +23966,13 @@ GL_PREFIX(SecondaryColor3uiEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5048(%rax), %r11
+       movq    5088(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5048(%rax), %r11
+       movq    5088(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23797,7 +23982,7 @@ GL_PREFIX(SecondaryColor3uiEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5048(%rax), %r11
+       movq    5088(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3uiEXT), .-GL_PREFIX(SecondaryColor3uiEXT)
@@ -23808,25 +23993,25 @@ GL_PREFIX(SecondaryColor3uiEXT):
 GL_PREFIX(SecondaryColor3uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5056(%rax), %r11
+       movq    5096(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5056(%rax), %r11
+       movq    5096(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5056(%rax), %r11
+       movq    5096(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5056(%rax), %r11
+       movq    5096(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3uivEXT), .-GL_PREFIX(SecondaryColor3uivEXT)
@@ -23837,7 +24022,7 @@ GL_PREFIX(SecondaryColor3uivEXT):
 GL_PREFIX(SecondaryColor3usEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5064(%rax), %r11
+       movq    5104(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23847,13 +24032,13 @@ GL_PREFIX(SecondaryColor3usEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5064(%rax), %r11
+       movq    5104(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5064(%rax), %r11
+       movq    5104(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23863,7 +24048,7 @@ GL_PREFIX(SecondaryColor3usEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5064(%rax), %r11
+       movq    5104(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3usEXT), .-GL_PREFIX(SecondaryColor3usEXT)
@@ -23874,25 +24059,25 @@ GL_PREFIX(SecondaryColor3usEXT):
 GL_PREFIX(SecondaryColor3usvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5072(%rax), %r11
+       movq    5112(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5072(%rax), %r11
+       movq    5112(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5072(%rax), %r11
+       movq    5112(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5072(%rax), %r11
+       movq    5112(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColor3usvEXT), .-GL_PREFIX(SecondaryColor3usvEXT)
@@ -23903,7 +24088,7 @@ GL_PREFIX(SecondaryColor3usvEXT):
 GL_PREFIX(SecondaryColorPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5080(%rax), %r11
+       movq    5120(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23917,13 +24102,13 @@ GL_PREFIX(SecondaryColorPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5080(%rax), %r11
+       movq    5120(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5080(%rax), %r11
+       movq    5120(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23937,7 +24122,7 @@ GL_PREFIX(SecondaryColorPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5080(%rax), %r11
+       movq    5120(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SecondaryColorPointerEXT), .-GL_PREFIX(SecondaryColorPointerEXT)
@@ -23948,7 +24133,7 @@ GL_PREFIX(SecondaryColorPointerEXT):
 GL_PREFIX(MultiDrawArraysEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5088(%rax), %r11
+       movq    5128(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -23962,13 +24147,13 @@ GL_PREFIX(MultiDrawArraysEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5088(%rax), %r11
+       movq    5128(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5088(%rax), %r11
+       movq    5128(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -23982,7 +24167,7 @@ GL_PREFIX(MultiDrawArraysEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5088(%rax), %r11
+       movq    5128(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(MultiDrawArraysEXT), .-GL_PREFIX(MultiDrawArraysEXT)
@@ -23993,7 +24178,7 @@ GL_PREFIX(MultiDrawArraysEXT):
 GL_PREFIX(MultiDrawElementsEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5096(%rax), %r11
+       movq    5136(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24007,13 +24192,13 @@ GL_PREFIX(MultiDrawElementsEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5096(%rax), %r11
+       movq    5136(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5096(%rax), %r11
+       movq    5136(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24027,7 +24212,7 @@ GL_PREFIX(MultiDrawElementsEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5096(%rax), %r11
+       movq    5136(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(MultiDrawElementsEXT), .-GL_PREFIX(MultiDrawElementsEXT)
@@ -24038,7 +24223,7 @@ GL_PREFIX(MultiDrawElementsEXT):
 GL_PREFIX(FogCoordPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5104(%rax), %r11
+       movq    5144(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24048,13 +24233,13 @@ GL_PREFIX(FogCoordPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5104(%rax), %r11
+       movq    5144(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5104(%rax), %r11
+       movq    5144(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24064,7 +24249,7 @@ GL_PREFIX(FogCoordPointerEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5104(%rax), %r11
+       movq    5144(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FogCoordPointerEXT), .-GL_PREFIX(FogCoordPointerEXT)
@@ -24075,7 +24260,7 @@ GL_PREFIX(FogCoordPointerEXT):
 GL_PREFIX(FogCoorddEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5112(%rax), %r11
+       movq    5152(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $8, %rsp
@@ -24083,13 +24268,13 @@ GL_PREFIX(FogCoorddEXT):
        call    _x86_64_get_dispatch@PLT
        movq    (%rsp), %xmm0
        addq    $8, %rsp
-       movq    5112(%rax), %r11
+       movq    5152(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5112(%rax), %r11
+       movq    5152(%rax), %r11
        jmp     *%r11
 1:
        subq    $8, %rsp
@@ -24097,7 +24282,7 @@ GL_PREFIX(FogCoorddEXT):
        call    _glapi_get_dispatch
        movq    (%rsp), %xmm0
        addq    $8, %rsp
-       movq    5112(%rax), %r11
+       movq    5152(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FogCoorddEXT), .-GL_PREFIX(FogCoorddEXT)
@@ -24108,25 +24293,25 @@ GL_PREFIX(FogCoorddEXT):
 GL_PREFIX(FogCoorddvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5120(%rax), %r11
+       movq    5160(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5120(%rax), %r11
+       movq    5160(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5120(%rax), %r11
+       movq    5160(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5120(%rax), %r11
+       movq    5160(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FogCoorddvEXT), .-GL_PREFIX(FogCoorddvEXT)
@@ -24137,7 +24322,7 @@ GL_PREFIX(FogCoorddvEXT):
 GL_PREFIX(FogCoordfEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5128(%rax), %r11
+       movq    5168(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $8, %rsp
@@ -24145,13 +24330,13 @@ GL_PREFIX(FogCoordfEXT):
        call    _x86_64_get_dispatch@PLT
        movq    (%rsp), %xmm0
        addq    $8, %rsp
-       movq    5128(%rax), %r11
+       movq    5168(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5128(%rax), %r11
+       movq    5168(%rax), %r11
        jmp     *%r11
 1:
        subq    $8, %rsp
@@ -24159,7 +24344,7 @@ GL_PREFIX(FogCoordfEXT):
        call    _glapi_get_dispatch
        movq    (%rsp), %xmm0
        addq    $8, %rsp
-       movq    5128(%rax), %r11
+       movq    5168(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FogCoordfEXT), .-GL_PREFIX(FogCoordfEXT)
@@ -24170,58 +24355,58 @@ GL_PREFIX(FogCoordfEXT):
 GL_PREFIX(FogCoordfvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5136(%rax), %r11
+       movq    5176(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5136(%rax), %r11
+       movq    5176(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5136(%rax), %r11
+       movq    5176(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5136(%rax), %r11
+       movq    5176(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FogCoordfvEXT), .-GL_PREFIX(FogCoordfvEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_643)
-       .type   GL_PREFIX(_dispatch_stub_643), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_643))
-GL_PREFIX(_dispatch_stub_643):
+       .globl  GL_PREFIX(_dispatch_stub_648)
+       .type   GL_PREFIX(_dispatch_stub_648), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_648))
+GL_PREFIX(_dispatch_stub_648):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5144(%rax), %r11
+       movq    5184(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5144(%rax), %r11
+       movq    5184(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5144(%rax), %r11
+       movq    5184(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5144(%rax), %r11
+       movq    5184(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_643), .-GL_PREFIX(_dispatch_stub_643)
+       .size   GL_PREFIX(_dispatch_stub_648), .-GL_PREFIX(_dispatch_stub_648)
 
        .p2align        4,,15
        .globl  GL_PREFIX(BlendFuncSeparateEXT)
@@ -24229,7 +24414,7 @@ GL_PREFIX(_dispatch_stub_643):
 GL_PREFIX(BlendFuncSeparateEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5152(%rax), %r11
+       movq    5192(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24243,13 +24428,13 @@ GL_PREFIX(BlendFuncSeparateEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5152(%rax), %r11
+       movq    5192(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5152(%rax), %r11
+       movq    5192(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24263,7 +24448,7 @@ GL_PREFIX(BlendFuncSeparateEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5152(%rax), %r11
+       movq    5192(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BlendFuncSeparateEXT), .-GL_PREFIX(BlendFuncSeparateEXT)
@@ -24274,25 +24459,25 @@ GL_PREFIX(BlendFuncSeparateEXT):
 GL_PREFIX(FlushVertexArrayRangeNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5160(%rax), %r11
+       movq    5200(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       movq    5160(%rax), %r11
+       movq    5200(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5160(%rax), %r11
+       movq    5200(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       movq    5160(%rax), %r11
+       movq    5200(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FlushVertexArrayRangeNV), .-GL_PREFIX(FlushVertexArrayRangeNV)
@@ -24303,7 +24488,7 @@ GL_PREFIX(FlushVertexArrayRangeNV):
 GL_PREFIX(VertexArrayRangeNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5168(%rax), %r11
+       movq    5208(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24313,13 +24498,13 @@ GL_PREFIX(VertexArrayRangeNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5168(%rax), %r11
+       movq    5208(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5168(%rax), %r11
+       movq    5208(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24329,7 +24514,7 @@ GL_PREFIX(VertexArrayRangeNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5168(%rax), %r11
+       movq    5208(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexArrayRangeNV), .-GL_PREFIX(VertexArrayRangeNV)
@@ -24340,7 +24525,7 @@ GL_PREFIX(VertexArrayRangeNV):
 GL_PREFIX(CombinerInputNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5176(%rax), %r11
+       movq    5216(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24358,13 +24543,13 @@ GL_PREFIX(CombinerInputNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5176(%rax), %r11
+       movq    5216(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5176(%rax), %r11
+       movq    5216(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24382,7 +24567,7 @@ GL_PREFIX(CombinerInputNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5176(%rax), %r11
+       movq    5216(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CombinerInputNV), .-GL_PREFIX(CombinerInputNV)
@@ -24393,7 +24578,7 @@ GL_PREFIX(CombinerInputNV):
 GL_PREFIX(CombinerOutputNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5184(%rax), %r11
+       movq    5224(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24411,13 +24596,13 @@ GL_PREFIX(CombinerOutputNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5184(%rax), %r11
+       movq    5224(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5184(%rax), %r11
+       movq    5224(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24435,7 +24620,7 @@ GL_PREFIX(CombinerOutputNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5184(%rax), %r11
+       movq    5224(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CombinerOutputNV), .-GL_PREFIX(CombinerOutputNV)
@@ -24446,7 +24631,7 @@ GL_PREFIX(CombinerOutputNV):
 GL_PREFIX(CombinerParameterfNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5192(%rax), %r11
+       movq    5232(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -24456,13 +24641,13 @@ GL_PREFIX(CombinerParameterfNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    5192(%rax), %r11
+       movq    5232(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5192(%rax), %r11
+       movq    5232(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -24472,7 +24657,7 @@ GL_PREFIX(CombinerParameterfNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    5192(%rax), %r11
+       movq    5232(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CombinerParameterfNV), .-GL_PREFIX(CombinerParameterfNV)
@@ -24483,7 +24668,7 @@ GL_PREFIX(CombinerParameterfNV):
 GL_PREFIX(CombinerParameterfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5200(%rax), %r11
+       movq    5240(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24493,13 +24678,13 @@ GL_PREFIX(CombinerParameterfvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5200(%rax), %r11
+       movq    5240(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5200(%rax), %r11
+       movq    5240(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24509,7 +24694,7 @@ GL_PREFIX(CombinerParameterfvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5200(%rax), %r11
+       movq    5240(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CombinerParameterfvNV), .-GL_PREFIX(CombinerParameterfvNV)
@@ -24520,7 +24705,7 @@ GL_PREFIX(CombinerParameterfvNV):
 GL_PREFIX(CombinerParameteriNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5208(%rax), %r11
+       movq    5248(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24530,13 +24715,13 @@ GL_PREFIX(CombinerParameteriNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5208(%rax), %r11
+       movq    5248(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5208(%rax), %r11
+       movq    5248(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24546,7 +24731,7 @@ GL_PREFIX(CombinerParameteriNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5208(%rax), %r11
+       movq    5248(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CombinerParameteriNV), .-GL_PREFIX(CombinerParameteriNV)
@@ -24557,7 +24742,7 @@ GL_PREFIX(CombinerParameteriNV):
 GL_PREFIX(CombinerParameterivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5216(%rax), %r11
+       movq    5256(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24567,13 +24752,13 @@ GL_PREFIX(CombinerParameterivNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5216(%rax), %r11
+       movq    5256(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5216(%rax), %r11
+       movq    5256(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24583,7 +24768,7 @@ GL_PREFIX(CombinerParameterivNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5216(%rax), %r11
+       movq    5256(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CombinerParameterivNV), .-GL_PREFIX(CombinerParameterivNV)
@@ -24594,7 +24779,7 @@ GL_PREFIX(CombinerParameterivNV):
 GL_PREFIX(FinalCombinerInputNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5224(%rax), %r11
+       movq    5264(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24608,13 +24793,13 @@ GL_PREFIX(FinalCombinerInputNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5224(%rax), %r11
+       movq    5264(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5224(%rax), %r11
+       movq    5264(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24628,7 +24813,7 @@ GL_PREFIX(FinalCombinerInputNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5224(%rax), %r11
+       movq    5264(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(FinalCombinerInputNV), .-GL_PREFIX(FinalCombinerInputNV)
@@ -24639,7 +24824,7 @@ GL_PREFIX(FinalCombinerInputNV):
 GL_PREFIX(GetCombinerInputParameterfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5232(%rax), %r11
+       movq    5272(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24653,13 +24838,13 @@ GL_PREFIX(GetCombinerInputParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5232(%rax), %r11
+       movq    5272(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5232(%rax), %r11
+       movq    5272(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24673,7 +24858,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5232(%rax), %r11
+       movq    5272(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetCombinerInputParameterfvNV), .-GL_PREFIX(GetCombinerInputParameterfvNV)
@@ -24684,7 +24869,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV):
 GL_PREFIX(GetCombinerInputParameterivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5240(%rax), %r11
+       movq    5280(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24698,13 +24883,13 @@ GL_PREFIX(GetCombinerInputParameterivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5240(%rax), %r11
+       movq    5280(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5240(%rax), %r11
+       movq    5280(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24718,7 +24903,7 @@ GL_PREFIX(GetCombinerInputParameterivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5240(%rax), %r11
+       movq    5280(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetCombinerInputParameterivNV), .-GL_PREFIX(GetCombinerInputParameterivNV)
@@ -24729,7 +24914,7 @@ GL_PREFIX(GetCombinerInputParameterivNV):
 GL_PREFIX(GetCombinerOutputParameterfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5248(%rax), %r11
+       movq    5288(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24743,13 +24928,13 @@ GL_PREFIX(GetCombinerOutputParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5248(%rax), %r11
+       movq    5288(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5248(%rax), %r11
+       movq    5288(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24763,7 +24948,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5248(%rax), %r11
+       movq    5288(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetCombinerOutputParameterfvNV), .-GL_PREFIX(GetCombinerOutputParameterfvNV)
@@ -24774,7 +24959,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV):
 GL_PREFIX(GetCombinerOutputParameterivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5256(%rax), %r11
+       movq    5296(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24788,13 +24973,13 @@ GL_PREFIX(GetCombinerOutputParameterivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5256(%rax), %r11
+       movq    5296(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5256(%rax), %r11
+       movq    5296(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24808,7 +24993,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5256(%rax), %r11
+       movq    5296(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetCombinerOutputParameterivNV), .-GL_PREFIX(GetCombinerOutputParameterivNV)
@@ -24819,7 +25004,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV):
 GL_PREFIX(GetFinalCombinerInputParameterfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5264(%rax), %r11
+       movq    5304(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24829,13 +25014,13 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5264(%rax), %r11
+       movq    5304(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5264(%rax), %r11
+       movq    5304(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24845,7 +25030,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5264(%rax), %r11
+       movq    5304(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetFinalCombinerInputParameterfvNV), .-GL_PREFIX(GetFinalCombinerInputParameterfvNV)
@@ -24856,7 +25041,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV):
 GL_PREFIX(GetFinalCombinerInputParameterivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5272(%rax), %r11
+       movq    5312(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -24866,13 +25051,13 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5272(%rax), %r11
+       movq    5312(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5272(%rax), %r11
+       movq    5312(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -24882,7 +25067,7 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5272(%rax), %r11
+       movq    5312(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetFinalCombinerInputParameterivNV), .-GL_PREFIX(GetFinalCombinerInputParameterivNV)
@@ -24893,25 +25078,25 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV):
 GL_PREFIX(ResizeBuffersMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5280(%rax), %r11
+       movq    5320(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       movq    5280(%rax), %r11
+       movq    5320(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5280(%rax), %r11
+       movq    5320(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       movq    5280(%rax), %r11
+       movq    5320(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ResizeBuffersMESA), .-GL_PREFIX(ResizeBuffersMESA)
@@ -24922,7 +25107,7 @@ GL_PREFIX(ResizeBuffersMESA):
 GL_PREFIX(WindowPos2dMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5288(%rax), %r11
+       movq    5328(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -24932,13 +25117,13 @@ GL_PREFIX(WindowPos2dMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5288(%rax), %r11
+       movq    5328(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5288(%rax), %r11
+       movq    5328(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -24948,7 +25133,7 @@ GL_PREFIX(WindowPos2dMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5288(%rax), %r11
+       movq    5328(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2dMESA), .-GL_PREFIX(WindowPos2dMESA)
@@ -24959,25 +25144,25 @@ GL_PREFIX(WindowPos2dMESA):
 GL_PREFIX(WindowPos2dvMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5296(%rax), %r11
+       movq    5336(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5296(%rax), %r11
+       movq    5336(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5296(%rax), %r11
+       movq    5336(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5296(%rax), %r11
+       movq    5336(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2dvMESA), .-GL_PREFIX(WindowPos2dvMESA)
@@ -24988,7 +25173,7 @@ GL_PREFIX(WindowPos2dvMESA):
 GL_PREFIX(WindowPos2fMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5304(%rax), %r11
+       movq    5344(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -24998,13 +25183,13 @@ GL_PREFIX(WindowPos2fMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5304(%rax), %r11
+       movq    5344(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5304(%rax), %r11
+       movq    5344(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -25014,7 +25199,7 @@ GL_PREFIX(WindowPos2fMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5304(%rax), %r11
+       movq    5344(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2fMESA), .-GL_PREFIX(WindowPos2fMESA)
@@ -25025,25 +25210,25 @@ GL_PREFIX(WindowPos2fMESA):
 GL_PREFIX(WindowPos2fvMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5312(%rax), %r11
+       movq    5352(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5312(%rax), %r11
+       movq    5352(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5312(%rax), %r11
+       movq    5352(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5312(%rax), %r11
+       movq    5352(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2fvMESA), .-GL_PREFIX(WindowPos2fvMESA)
@@ -25054,7 +25239,7 @@ GL_PREFIX(WindowPos2fvMESA):
 GL_PREFIX(WindowPos2iMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5320(%rax), %r11
+       movq    5360(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25064,13 +25249,13 @@ GL_PREFIX(WindowPos2iMESA):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5320(%rax), %r11
+       movq    5360(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5320(%rax), %r11
+       movq    5360(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25080,7 +25265,7 @@ GL_PREFIX(WindowPos2iMESA):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5320(%rax), %r11
+       movq    5360(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2iMESA), .-GL_PREFIX(WindowPos2iMESA)
@@ -25091,25 +25276,25 @@ GL_PREFIX(WindowPos2iMESA):
 GL_PREFIX(WindowPos2ivMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5328(%rax), %r11
+       movq    5368(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5328(%rax), %r11
+       movq    5368(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5328(%rax), %r11
+       movq    5368(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5328(%rax), %r11
+       movq    5368(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2ivMESA), .-GL_PREFIX(WindowPos2ivMESA)
@@ -25120,7 +25305,7 @@ GL_PREFIX(WindowPos2ivMESA):
 GL_PREFIX(WindowPos2sMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5336(%rax), %r11
+       movq    5376(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25130,13 +25315,13 @@ GL_PREFIX(WindowPos2sMESA):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5336(%rax), %r11
+       movq    5376(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5336(%rax), %r11
+       movq    5376(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25146,7 +25331,7 @@ GL_PREFIX(WindowPos2sMESA):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5336(%rax), %r11
+       movq    5376(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2sMESA), .-GL_PREFIX(WindowPos2sMESA)
@@ -25157,25 +25342,25 @@ GL_PREFIX(WindowPos2sMESA):
 GL_PREFIX(WindowPos2svMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5344(%rax), %r11
+       movq    5384(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5344(%rax), %r11
+       movq    5384(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5344(%rax), %r11
+       movq    5384(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5344(%rax), %r11
+       movq    5384(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos2svMESA), .-GL_PREFIX(WindowPos2svMESA)
@@ -25186,7 +25371,7 @@ GL_PREFIX(WindowPos2svMESA):
 GL_PREFIX(WindowPos3dMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5352(%rax), %r11
+       movq    5392(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -25198,13 +25383,13 @@ GL_PREFIX(WindowPos3dMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5352(%rax), %r11
+       movq    5392(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5352(%rax), %r11
+       movq    5392(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -25216,7 +25401,7 @@ GL_PREFIX(WindowPos3dMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5352(%rax), %r11
+       movq    5392(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3dMESA), .-GL_PREFIX(WindowPos3dMESA)
@@ -25227,25 +25412,25 @@ GL_PREFIX(WindowPos3dMESA):
 GL_PREFIX(WindowPos3dvMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5360(%rax), %r11
+       movq    5400(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5360(%rax), %r11
+       movq    5400(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5360(%rax), %r11
+       movq    5400(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5360(%rax), %r11
+       movq    5400(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3dvMESA), .-GL_PREFIX(WindowPos3dvMESA)
@@ -25256,7 +25441,7 @@ GL_PREFIX(WindowPos3dvMESA):
 GL_PREFIX(WindowPos3fMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5368(%rax), %r11
+       movq    5408(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -25268,13 +25453,13 @@ GL_PREFIX(WindowPos3fMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5368(%rax), %r11
+       movq    5408(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5368(%rax), %r11
+       movq    5408(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -25286,7 +25471,7 @@ GL_PREFIX(WindowPos3fMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $24, %rsp
-       movq    5368(%rax), %r11
+       movq    5408(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3fMESA), .-GL_PREFIX(WindowPos3fMESA)
@@ -25297,25 +25482,25 @@ GL_PREFIX(WindowPos3fMESA):
 GL_PREFIX(WindowPos3fvMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5376(%rax), %r11
+       movq    5416(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5376(%rax), %r11
+       movq    5416(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5376(%rax), %r11
+       movq    5416(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5376(%rax), %r11
+       movq    5416(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3fvMESA), .-GL_PREFIX(WindowPos3fvMESA)
@@ -25326,7 +25511,7 @@ GL_PREFIX(WindowPos3fvMESA):
 GL_PREFIX(WindowPos3iMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5384(%rax), %r11
+       movq    5424(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25336,13 +25521,13 @@ GL_PREFIX(WindowPos3iMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5384(%rax), %r11
+       movq    5424(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5384(%rax), %r11
+       movq    5424(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25352,7 +25537,7 @@ GL_PREFIX(WindowPos3iMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5384(%rax), %r11
+       movq    5424(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3iMESA), .-GL_PREFIX(WindowPos3iMESA)
@@ -25363,25 +25548,25 @@ GL_PREFIX(WindowPos3iMESA):
 GL_PREFIX(WindowPos3ivMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5392(%rax), %r11
+       movq    5432(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5392(%rax), %r11
+       movq    5432(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5392(%rax), %r11
+       movq    5432(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5392(%rax), %r11
+       movq    5432(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3ivMESA), .-GL_PREFIX(WindowPos3ivMESA)
@@ -25392,7 +25577,7 @@ GL_PREFIX(WindowPos3ivMESA):
 GL_PREFIX(WindowPos3sMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5400(%rax), %r11
+       movq    5440(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25402,13 +25587,13 @@ GL_PREFIX(WindowPos3sMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5400(%rax), %r11
+       movq    5440(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5400(%rax), %r11
+       movq    5440(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25418,7 +25603,7 @@ GL_PREFIX(WindowPos3sMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5400(%rax), %r11
+       movq    5440(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3sMESA), .-GL_PREFIX(WindowPos3sMESA)
@@ -25429,25 +25614,25 @@ GL_PREFIX(WindowPos3sMESA):
 GL_PREFIX(WindowPos3svMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5408(%rax), %r11
+       movq    5448(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5408(%rax), %r11
+       movq    5448(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5408(%rax), %r11
+       movq    5448(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5408(%rax), %r11
+       movq    5448(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos3svMESA), .-GL_PREFIX(WindowPos3svMESA)
@@ -25458,7 +25643,7 @@ GL_PREFIX(WindowPos3svMESA):
 GL_PREFIX(WindowPos4dMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5416(%rax), %r11
+       movq    5456(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $40, %rsp
@@ -25472,13 +25657,13 @@ GL_PREFIX(WindowPos4dMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $40, %rsp
-       movq    5416(%rax), %r11
+       movq    5456(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5416(%rax), %r11
+       movq    5456(%rax), %r11
        jmp     *%r11
 1:
        subq    $40, %rsp
@@ -25492,7 +25677,7 @@ GL_PREFIX(WindowPos4dMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $40, %rsp
-       movq    5416(%rax), %r11
+       movq    5456(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4dMESA), .-GL_PREFIX(WindowPos4dMESA)
@@ -25503,25 +25688,25 @@ GL_PREFIX(WindowPos4dMESA):
 GL_PREFIX(WindowPos4dvMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5424(%rax), %r11
+       movq    5464(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5424(%rax), %r11
+       movq    5464(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5424(%rax), %r11
+       movq    5464(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5424(%rax), %r11
+       movq    5464(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4dvMESA), .-GL_PREFIX(WindowPos4dvMESA)
@@ -25532,7 +25717,7 @@ GL_PREFIX(WindowPos4dvMESA):
 GL_PREFIX(WindowPos4fMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5432(%rax), %r11
+       movq    5472(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $40, %rsp
@@ -25546,13 +25731,13 @@ GL_PREFIX(WindowPos4fMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $40, %rsp
-       movq    5432(%rax), %r11
+       movq    5472(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5432(%rax), %r11
+       movq    5472(%rax), %r11
        jmp     *%r11
 1:
        subq    $40, %rsp
@@ -25566,7 +25751,7 @@ GL_PREFIX(WindowPos4fMESA):
        movq    8(%rsp), %xmm1
        movq    (%rsp), %xmm0
        addq    $40, %rsp
-       movq    5432(%rax), %r11
+       movq    5472(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4fMESA), .-GL_PREFIX(WindowPos4fMESA)
@@ -25577,25 +25762,25 @@ GL_PREFIX(WindowPos4fMESA):
 GL_PREFIX(WindowPos4fvMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5440(%rax), %r11
+       movq    5480(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5440(%rax), %r11
+       movq    5480(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5440(%rax), %r11
+       movq    5480(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5440(%rax), %r11
+       movq    5480(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4fvMESA), .-GL_PREFIX(WindowPos4fvMESA)
@@ -25606,7 +25791,7 @@ GL_PREFIX(WindowPos4fvMESA):
 GL_PREFIX(WindowPos4iMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5448(%rax), %r11
+       movq    5488(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25620,13 +25805,13 @@ GL_PREFIX(WindowPos4iMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5448(%rax), %r11
+       movq    5488(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5448(%rax), %r11
+       movq    5488(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25640,7 +25825,7 @@ GL_PREFIX(WindowPos4iMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5448(%rax), %r11
+       movq    5488(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4iMESA), .-GL_PREFIX(WindowPos4iMESA)
@@ -25651,25 +25836,25 @@ GL_PREFIX(WindowPos4iMESA):
 GL_PREFIX(WindowPos4ivMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5456(%rax), %r11
+       movq    5496(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5456(%rax), %r11
+       movq    5496(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5456(%rax), %r11
+       movq    5496(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5456(%rax), %r11
+       movq    5496(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4ivMESA), .-GL_PREFIX(WindowPos4ivMESA)
@@ -25680,7 +25865,7 @@ GL_PREFIX(WindowPos4ivMESA):
 GL_PREFIX(WindowPos4sMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5464(%rax), %r11
+       movq    5504(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25694,13 +25879,13 @@ GL_PREFIX(WindowPos4sMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5464(%rax), %r11
+       movq    5504(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5464(%rax), %r11
+       movq    5504(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25714,7 +25899,7 @@ GL_PREFIX(WindowPos4sMESA):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5464(%rax), %r11
+       movq    5504(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4sMESA), .-GL_PREFIX(WindowPos4sMESA)
@@ -25725,37 +25910,37 @@ GL_PREFIX(WindowPos4sMESA):
 GL_PREFIX(WindowPos4svMESA):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5472(%rax), %r11
+       movq    5512(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5472(%rax), %r11
+       movq    5512(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5472(%rax), %r11
+       movq    5512(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5472(%rax), %r11
+       movq    5512(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(WindowPos4svMESA), .-GL_PREFIX(WindowPos4svMESA)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_685)
-       .type   GL_PREFIX(_dispatch_stub_685), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_685))
-GL_PREFIX(_dispatch_stub_685):
+       .globl  GL_PREFIX(_dispatch_stub_690)
+       .type   GL_PREFIX(_dispatch_stub_690), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_690))
+GL_PREFIX(_dispatch_stub_690):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5480(%rax), %r11
+       movq    5520(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25769,13 +25954,13 @@ GL_PREFIX(_dispatch_stub_685):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5480(%rax), %r11
+       movq    5520(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5480(%rax), %r11
+       movq    5520(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25789,19 +25974,19 @@ GL_PREFIX(_dispatch_stub_685):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5480(%rax), %r11
+       movq    5520(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_685), .-GL_PREFIX(_dispatch_stub_685)
+       .size   GL_PREFIX(_dispatch_stub_690), .-GL_PREFIX(_dispatch_stub_690)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_686)
-       .type   GL_PREFIX(_dispatch_stub_686), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_686))
-GL_PREFIX(_dispatch_stub_686):
+       .globl  GL_PREFIX(_dispatch_stub_691)
+       .type   GL_PREFIX(_dispatch_stub_691), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_691))
+GL_PREFIX(_dispatch_stub_691):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5488(%rax), %r11
+       movq    5528(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25819,13 +26004,13 @@ GL_PREFIX(_dispatch_stub_686):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5488(%rax), %r11
+       movq    5528(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5488(%rax), %r11
+       movq    5528(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25843,19 +26028,19 @@ GL_PREFIX(_dispatch_stub_686):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5488(%rax), %r11
+       movq    5528(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_686), .-GL_PREFIX(_dispatch_stub_686)
+       .size   GL_PREFIX(_dispatch_stub_691), .-GL_PREFIX(_dispatch_stub_691)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_687)
-       .type   GL_PREFIX(_dispatch_stub_687), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_687))
-GL_PREFIX(_dispatch_stub_687):
+       .globl  GL_PREFIX(_dispatch_stub_692)
+       .type   GL_PREFIX(_dispatch_stub_692), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_692))
+GL_PREFIX(_dispatch_stub_692):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5496(%rax), %r11
+       movq    5536(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25865,13 +26050,13 @@ GL_PREFIX(_dispatch_stub_687):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5496(%rax), %r11
+       movq    5536(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5496(%rax), %r11
+       movq    5536(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25881,49 +26066,49 @@ GL_PREFIX(_dispatch_stub_687):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5496(%rax), %r11
+       movq    5536(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_687), .-GL_PREFIX(_dispatch_stub_687)
+       .size   GL_PREFIX(_dispatch_stub_692), .-GL_PREFIX(_dispatch_stub_692)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_688)
-       .type   GL_PREFIX(_dispatch_stub_688), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_688))
-GL_PREFIX(_dispatch_stub_688):
+       .globl  GL_PREFIX(_dispatch_stub_693)
+       .type   GL_PREFIX(_dispatch_stub_693), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_693))
+GL_PREFIX(_dispatch_stub_693):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5504(%rax), %r11
+       movq    5544(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5504(%rax), %r11
+       movq    5544(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5504(%rax), %r11
+       movq    5544(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5504(%rax), %r11
+       movq    5544(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_688), .-GL_PREFIX(_dispatch_stub_688)
+       .size   GL_PREFIX(_dispatch_stub_693), .-GL_PREFIX(_dispatch_stub_693)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_689)
-       .type   GL_PREFIX(_dispatch_stub_689), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_689))
-GL_PREFIX(_dispatch_stub_689):
+       .globl  GL_PREFIX(_dispatch_stub_694)
+       .type   GL_PREFIX(_dispatch_stub_694), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_694))
+GL_PREFIX(_dispatch_stub_694):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5512(%rax), %r11
+       movq    5552(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25933,13 +26118,13 @@ GL_PREFIX(_dispatch_stub_689):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5512(%rax), %r11
+       movq    5552(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5512(%rax), %r11
+       movq    5552(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25949,19 +26134,19 @@ GL_PREFIX(_dispatch_stub_689):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5512(%rax), %r11
+       movq    5552(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_689), .-GL_PREFIX(_dispatch_stub_689)
+       .size   GL_PREFIX(_dispatch_stub_694), .-GL_PREFIX(_dispatch_stub_694)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_690)
-       .type   GL_PREFIX(_dispatch_stub_690), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_690))
-GL_PREFIX(_dispatch_stub_690):
+       .globl  GL_PREFIX(_dispatch_stub_695)
+       .type   GL_PREFIX(_dispatch_stub_695), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_695))
+GL_PREFIX(_dispatch_stub_695):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5520(%rax), %r11
+       movq    5560(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -25971,13 +26156,13 @@ GL_PREFIX(_dispatch_stub_690):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5520(%rax), %r11
+       movq    5560(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5520(%rax), %r11
+       movq    5560(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -25987,49 +26172,49 @@ GL_PREFIX(_dispatch_stub_690):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5520(%rax), %r11
+       movq    5560(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_690), .-GL_PREFIX(_dispatch_stub_690)
+       .size   GL_PREFIX(_dispatch_stub_695), .-GL_PREFIX(_dispatch_stub_695)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_691)
-       .type   GL_PREFIX(_dispatch_stub_691), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_691))
-GL_PREFIX(_dispatch_stub_691):
+       .globl  GL_PREFIX(_dispatch_stub_696)
+       .type   GL_PREFIX(_dispatch_stub_696), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_696))
+GL_PREFIX(_dispatch_stub_696):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5528(%rax), %r11
+       movq    5568(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5528(%rax), %r11
+       movq    5568(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5528(%rax), %r11
+       movq    5568(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5528(%rax), %r11
+       movq    5568(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_691), .-GL_PREFIX(_dispatch_stub_691)
+       .size   GL_PREFIX(_dispatch_stub_696), .-GL_PREFIX(_dispatch_stub_696)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_692)
-       .type   GL_PREFIX(_dispatch_stub_692), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_692))
-GL_PREFIX(_dispatch_stub_692):
+       .globl  GL_PREFIX(_dispatch_stub_697)
+       .type   GL_PREFIX(_dispatch_stub_697), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_697))
+GL_PREFIX(_dispatch_stub_697):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5536(%rax), %r11
+       movq    5576(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26039,13 +26224,13 @@ GL_PREFIX(_dispatch_stub_692):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5536(%rax), %r11
+       movq    5576(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5536(%rax), %r11
+       movq    5576(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26055,40 +26240,40 @@ GL_PREFIX(_dispatch_stub_692):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5536(%rax), %r11
+       movq    5576(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_692), .-GL_PREFIX(_dispatch_stub_692)
+       .size   GL_PREFIX(_dispatch_stub_697), .-GL_PREFIX(_dispatch_stub_697)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_693)
-       .type   GL_PREFIX(_dispatch_stub_693), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_693))
-GL_PREFIX(_dispatch_stub_693):
+       .globl  GL_PREFIX(_dispatch_stub_698)
+       .type   GL_PREFIX(_dispatch_stub_698), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_698))
+GL_PREFIX(_dispatch_stub_698):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5544(%rax), %r11
+       movq    5584(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5544(%rax), %r11
+       movq    5584(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5544(%rax), %r11
+       movq    5584(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5544(%rax), %r11
+       movq    5584(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_693), .-GL_PREFIX(_dispatch_stub_693)
+       .size   GL_PREFIX(_dispatch_stub_698), .-GL_PREFIX(_dispatch_stub_698)
 
        .p2align        4,,15
        .globl  GL_PREFIX(AreProgramsResidentNV)
@@ -26096,7 +26281,7 @@ GL_PREFIX(_dispatch_stub_693):
 GL_PREFIX(AreProgramsResidentNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5552(%rax), %r11
+       movq    5592(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26106,13 +26291,13 @@ GL_PREFIX(AreProgramsResidentNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5552(%rax), %r11
+       movq    5592(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5552(%rax), %r11
+       movq    5592(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26122,7 +26307,7 @@ GL_PREFIX(AreProgramsResidentNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5552(%rax), %r11
+       movq    5592(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(AreProgramsResidentNV), .-GL_PREFIX(AreProgramsResidentNV)
@@ -26133,7 +26318,7 @@ GL_PREFIX(AreProgramsResidentNV):
 GL_PREFIX(BindProgramNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5560(%rax), %r11
+       movq    5600(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26143,13 +26328,13 @@ GL_PREFIX(BindProgramNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5560(%rax), %r11
+       movq    5600(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5560(%rax), %r11
+       movq    5600(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26159,7 +26344,7 @@ GL_PREFIX(BindProgramNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5560(%rax), %r11
+       movq    5600(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BindProgramNV), .-GL_PREFIX(BindProgramNV)
@@ -26170,7 +26355,7 @@ GL_PREFIX(BindProgramNV):
 GL_PREFIX(DeleteProgramsNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5568(%rax), %r11
+       movq    5608(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26180,13 +26365,13 @@ GL_PREFIX(DeleteProgramsNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5568(%rax), %r11
+       movq    5608(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5568(%rax), %r11
+       movq    5608(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26196,7 +26381,7 @@ GL_PREFIX(DeleteProgramsNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5568(%rax), %r11
+       movq    5608(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(DeleteProgramsNV), .-GL_PREFIX(DeleteProgramsNV)
@@ -26207,7 +26392,7 @@ GL_PREFIX(DeleteProgramsNV):
 GL_PREFIX(ExecuteProgramNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5576(%rax), %r11
+       movq    5616(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26217,13 +26402,13 @@ GL_PREFIX(ExecuteProgramNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5576(%rax), %r11
+       movq    5616(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5576(%rax), %r11
+       movq    5616(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26233,7 +26418,7 @@ GL_PREFIX(ExecuteProgramNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5576(%rax), %r11
+       movq    5616(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ExecuteProgramNV), .-GL_PREFIX(ExecuteProgramNV)
@@ -26244,7 +26429,7 @@ GL_PREFIX(ExecuteProgramNV):
 GL_PREFIX(GenProgramsNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5584(%rax), %r11
+       movq    5624(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26254,13 +26439,13 @@ GL_PREFIX(GenProgramsNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5584(%rax), %r11
+       movq    5624(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5584(%rax), %r11
+       movq    5624(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26270,7 +26455,7 @@ GL_PREFIX(GenProgramsNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5584(%rax), %r11
+       movq    5624(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GenProgramsNV), .-GL_PREFIX(GenProgramsNV)
@@ -26281,7 +26466,7 @@ GL_PREFIX(GenProgramsNV):
 GL_PREFIX(GetProgramParameterdvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5592(%rax), %r11
+       movq    5632(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26295,13 +26480,13 @@ GL_PREFIX(GetProgramParameterdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5592(%rax), %r11
+       movq    5632(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5592(%rax), %r11
+       movq    5632(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26315,7 +26500,7 @@ GL_PREFIX(GetProgramParameterdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5592(%rax), %r11
+       movq    5632(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramParameterdvNV), .-GL_PREFIX(GetProgramParameterdvNV)
@@ -26326,7 +26511,7 @@ GL_PREFIX(GetProgramParameterdvNV):
 GL_PREFIX(GetProgramParameterfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5600(%rax), %r11
+       movq    5640(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26340,13 +26525,13 @@ GL_PREFIX(GetProgramParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5600(%rax), %r11
+       movq    5640(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5600(%rax), %r11
+       movq    5640(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26360,7 +26545,7 @@ GL_PREFIX(GetProgramParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5600(%rax), %r11
+       movq    5640(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramParameterfvNV), .-GL_PREFIX(GetProgramParameterfvNV)
@@ -26371,7 +26556,7 @@ GL_PREFIX(GetProgramParameterfvNV):
 GL_PREFIX(GetProgramStringNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5608(%rax), %r11
+       movq    5648(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26381,13 +26566,13 @@ GL_PREFIX(GetProgramStringNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5608(%rax), %r11
+       movq    5648(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5608(%rax), %r11
+       movq    5648(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26397,7 +26582,7 @@ GL_PREFIX(GetProgramStringNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5608(%rax), %r11
+       movq    5648(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramStringNV), .-GL_PREFIX(GetProgramStringNV)
@@ -26408,7 +26593,7 @@ GL_PREFIX(GetProgramStringNV):
 GL_PREFIX(GetProgramivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5616(%rax), %r11
+       movq    5656(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26418,13 +26603,13 @@ GL_PREFIX(GetProgramivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5616(%rax), %r11
+       movq    5656(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5616(%rax), %r11
+       movq    5656(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26434,7 +26619,7 @@ GL_PREFIX(GetProgramivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5616(%rax), %r11
+       movq    5656(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramivNV), .-GL_PREFIX(GetProgramivNV)
@@ -26445,7 +26630,7 @@ GL_PREFIX(GetProgramivNV):
 GL_PREFIX(GetTrackMatrixivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5624(%rax), %r11
+       movq    5664(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26459,13 +26644,13 @@ GL_PREFIX(GetTrackMatrixivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5624(%rax), %r11
+       movq    5664(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5624(%rax), %r11
+       movq    5664(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26479,7 +26664,7 @@ GL_PREFIX(GetTrackMatrixivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5624(%rax), %r11
+       movq    5664(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetTrackMatrixivNV), .-GL_PREFIX(GetTrackMatrixivNV)
@@ -26490,7 +26675,7 @@ GL_PREFIX(GetTrackMatrixivNV):
 GL_PREFIX(GetVertexAttribPointervNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5632(%rax), %r11
+       movq    5672(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26500,13 +26685,13 @@ GL_PREFIX(GetVertexAttribPointervNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5632(%rax), %r11
+       movq    5672(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5632(%rax), %r11
+       movq    5672(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26516,7 +26701,7 @@ GL_PREFIX(GetVertexAttribPointervNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5632(%rax), %r11
+       movq    5672(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetVertexAttribPointervNV), .-GL_PREFIX(GetVertexAttribPointervNV)
@@ -26527,7 +26712,7 @@ GL_PREFIX(GetVertexAttribPointervNV):
 GL_PREFIX(GetVertexAttribdvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5640(%rax), %r11
+       movq    5680(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26537,13 +26722,13 @@ GL_PREFIX(GetVertexAttribdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5640(%rax), %r11
+       movq    5680(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5640(%rax), %r11
+       movq    5680(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26553,7 +26738,7 @@ GL_PREFIX(GetVertexAttribdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5640(%rax), %r11
+       movq    5680(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetVertexAttribdvNV), .-GL_PREFIX(GetVertexAttribdvNV)
@@ -26564,7 +26749,7 @@ GL_PREFIX(GetVertexAttribdvNV):
 GL_PREFIX(GetVertexAttribfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5648(%rax), %r11
+       movq    5688(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26574,13 +26759,13 @@ GL_PREFIX(GetVertexAttribfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5648(%rax), %r11
+       movq    5688(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5648(%rax), %r11
+       movq    5688(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26590,7 +26775,7 @@ GL_PREFIX(GetVertexAttribfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5648(%rax), %r11
+       movq    5688(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetVertexAttribfvNV), .-GL_PREFIX(GetVertexAttribfvNV)
@@ -26601,7 +26786,7 @@ GL_PREFIX(GetVertexAttribfvNV):
 GL_PREFIX(GetVertexAttribivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5656(%rax), %r11
+       movq    5696(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26611,13 +26796,13 @@ GL_PREFIX(GetVertexAttribivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5656(%rax), %r11
+       movq    5696(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5656(%rax), %r11
+       movq    5696(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26627,7 +26812,7 @@ GL_PREFIX(GetVertexAttribivNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5656(%rax), %r11
+       movq    5696(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetVertexAttribivNV), .-GL_PREFIX(GetVertexAttribivNV)
@@ -26638,25 +26823,25 @@ GL_PREFIX(GetVertexAttribivNV):
 GL_PREFIX(IsProgramNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5664(%rax), %r11
+       movq    5704(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    5664(%rax), %r11
+       movq    5704(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5664(%rax), %r11
+       movq    5704(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    5664(%rax), %r11
+       movq    5704(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(IsProgramNV), .-GL_PREFIX(IsProgramNV)
@@ -26667,7 +26852,7 @@ GL_PREFIX(IsProgramNV):
 GL_PREFIX(LoadProgramNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5672(%rax), %r11
+       movq    5712(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26681,13 +26866,13 @@ GL_PREFIX(LoadProgramNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5672(%rax), %r11
+       movq    5712(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5672(%rax), %r11
+       movq    5712(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26701,7 +26886,7 @@ GL_PREFIX(LoadProgramNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5672(%rax), %r11
+       movq    5712(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(LoadProgramNV), .-GL_PREFIX(LoadProgramNV)
@@ -26712,7 +26897,7 @@ GL_PREFIX(LoadProgramNV):
 GL_PREFIX(ProgramParameters4dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5680(%rax), %r11
+       movq    5720(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26726,13 +26911,13 @@ GL_PREFIX(ProgramParameters4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5680(%rax), %r11
+       movq    5720(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5680(%rax), %r11
+       movq    5720(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26746,7 +26931,7 @@ GL_PREFIX(ProgramParameters4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5680(%rax), %r11
+       movq    5720(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramParameters4dvNV), .-GL_PREFIX(ProgramParameters4dvNV)
@@ -26757,7 +26942,7 @@ GL_PREFIX(ProgramParameters4dvNV):
 GL_PREFIX(ProgramParameters4fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5688(%rax), %r11
+       movq    5728(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26771,13 +26956,13 @@ GL_PREFIX(ProgramParameters4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5688(%rax), %r11
+       movq    5728(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5688(%rax), %r11
+       movq    5728(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26791,7 +26976,7 @@ GL_PREFIX(ProgramParameters4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5688(%rax), %r11
+       movq    5728(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramParameters4fvNV), .-GL_PREFIX(ProgramParameters4fvNV)
@@ -26802,7 +26987,7 @@ GL_PREFIX(ProgramParameters4fvNV):
 GL_PREFIX(RequestResidentProgramsNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5696(%rax), %r11
+       movq    5736(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26812,13 +26997,13 @@ GL_PREFIX(RequestResidentProgramsNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5696(%rax), %r11
+       movq    5736(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5696(%rax), %r11
+       movq    5736(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26828,7 +27013,7 @@ GL_PREFIX(RequestResidentProgramsNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5696(%rax), %r11
+       movq    5736(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(RequestResidentProgramsNV), .-GL_PREFIX(RequestResidentProgramsNV)
@@ -26839,7 +27024,7 @@ GL_PREFIX(RequestResidentProgramsNV):
 GL_PREFIX(TrackMatrixNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5704(%rax), %r11
+       movq    5744(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26853,13 +27038,13 @@ GL_PREFIX(TrackMatrixNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5704(%rax), %r11
+       movq    5744(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5704(%rax), %r11
+       movq    5744(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26873,7 +27058,7 @@ GL_PREFIX(TrackMatrixNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5704(%rax), %r11
+       movq    5744(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(TrackMatrixNV), .-GL_PREFIX(TrackMatrixNV)
@@ -26884,7 +27069,7 @@ GL_PREFIX(TrackMatrixNV):
 GL_PREFIX(VertexAttrib1dNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5712(%rax), %r11
+       movq    5752(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -26894,13 +27079,13 @@ GL_PREFIX(VertexAttrib1dNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    5712(%rax), %r11
+       movq    5752(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5712(%rax), %r11
+       movq    5752(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -26910,7 +27095,7 @@ GL_PREFIX(VertexAttrib1dNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    5712(%rax), %r11
+       movq    5752(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib1dNV), .-GL_PREFIX(VertexAttrib1dNV)
@@ -26921,7 +27106,7 @@ GL_PREFIX(VertexAttrib1dNV):
 GL_PREFIX(VertexAttrib1dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5720(%rax), %r11
+       movq    5760(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -26931,13 +27116,13 @@ GL_PREFIX(VertexAttrib1dvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5720(%rax), %r11
+       movq    5760(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5720(%rax), %r11
+       movq    5760(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -26947,7 +27132,7 @@ GL_PREFIX(VertexAttrib1dvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5720(%rax), %r11
+       movq    5760(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib1dvNV), .-GL_PREFIX(VertexAttrib1dvNV)
@@ -26958,7 +27143,7 @@ GL_PREFIX(VertexAttrib1dvNV):
 GL_PREFIX(VertexAttrib1fNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5728(%rax), %r11
+       movq    5768(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $24, %rsp
@@ -26968,13 +27153,13 @@ GL_PREFIX(VertexAttrib1fNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    5728(%rax), %r11
+       movq    5768(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5728(%rax), %r11
+       movq    5768(%rax), %r11
        jmp     *%r11
 1:
        subq    $24, %rsp
@@ -26984,7 +27169,7 @@ GL_PREFIX(VertexAttrib1fNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $24, %rsp
-       movq    5728(%rax), %r11
+       movq    5768(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib1fNV), .-GL_PREFIX(VertexAttrib1fNV)
@@ -26995,7 +27180,7 @@ GL_PREFIX(VertexAttrib1fNV):
 GL_PREFIX(VertexAttrib1fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5736(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27005,13 +27190,13 @@ GL_PREFIX(VertexAttrib1fvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5736(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5736(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27021,7 +27206,7 @@ GL_PREFIX(VertexAttrib1fvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5736(%rax), %r11
+       movq    5776(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib1fvNV), .-GL_PREFIX(VertexAttrib1fvNV)
@@ -27030,199 +27215,6 @@ GL_PREFIX(VertexAttrib1fvNV):
        .globl  GL_PREFIX(VertexAttrib1sNV)
        .type   GL_PREFIX(VertexAttrib1sNV), @function
 GL_PREFIX(VertexAttrib1sNV):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    5744(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    5744(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    5744(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    5744(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttrib1sNV), .-GL_PREFIX(VertexAttrib1sNV)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttrib1svNV)
-       .type   GL_PREFIX(VertexAttrib1svNV), @function
-GL_PREFIX(VertexAttrib1svNV):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    5752(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    5752(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    5752(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    5752(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttrib1svNV), .-GL_PREFIX(VertexAttrib1svNV)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttrib2dNV)
-       .type   GL_PREFIX(VertexAttrib2dNV), @function
-GL_PREFIX(VertexAttrib2dNV):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    5760(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       subq    $24, %rsp
-       movq    %rdi, (%rsp)
-       movq    %xmm0, 8(%rsp)
-       movq    %xmm1, 16(%rsp)
-       call    _x86_64_get_dispatch@PLT
-       movq    16(%rsp), %xmm1
-       movq    8(%rsp), %xmm0
-       movq    (%rsp), %rdi
-       addq    $24, %rsp
-       movq    5760(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    5760(%rax), %r11
-       jmp     *%r11
-1:
-       subq    $24, %rsp
-       movq    %rdi, (%rsp)
-       movq    %xmm0, 8(%rsp)
-       movq    %xmm1, 16(%rsp)
-       call    _glapi_get_dispatch
-       movq    16(%rsp), %xmm1
-       movq    8(%rsp), %xmm0
-       movq    (%rsp), %rdi
-       addq    $24, %rsp
-       movq    5760(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttrib2dNV), .-GL_PREFIX(VertexAttrib2dNV)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttrib2dvNV)
-       .type   GL_PREFIX(VertexAttrib2dvNV), @function
-GL_PREFIX(VertexAttrib2dvNV):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    5768(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    5768(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    5768(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    5768(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttrib2dvNV), .-GL_PREFIX(VertexAttrib2dvNV)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttrib2fNV)
-       .type   GL_PREFIX(VertexAttrib2fNV), @function
-GL_PREFIX(VertexAttrib2fNV):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    5776(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       subq    $24, %rsp
-       movq    %rdi, (%rsp)
-       movq    %xmm0, 8(%rsp)
-       movq    %xmm1, 16(%rsp)
-       call    _x86_64_get_dispatch@PLT
-       movq    16(%rsp), %xmm1
-       movq    8(%rsp), %xmm0
-       movq    (%rsp), %rdi
-       addq    $24, %rsp
-       movq    5776(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    5776(%rax), %r11
-       jmp     *%r11
-1:
-       subq    $24, %rsp
-       movq    %rdi, (%rsp)
-       movq    %xmm0, 8(%rsp)
-       movq    %xmm1, 16(%rsp)
-       call    _glapi_get_dispatch
-       movq    16(%rsp), %xmm1
-       movq    8(%rsp), %xmm0
-       movq    (%rsp), %rdi
-       addq    $24, %rsp
-       movq    5776(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttrib2fNV), .-GL_PREFIX(VertexAttrib2fNV)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttrib2fvNV)
-       .type   GL_PREFIX(VertexAttrib2fvNV), @function
-GL_PREFIX(VertexAttrib2fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    5784(%rax), %r11
@@ -27253,6 +27245,199 @@ GL_PREFIX(VertexAttrib2fvNV):
        popq    %rdi
        movq    5784(%rax), %r11
        jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(VertexAttrib1sNV), .-GL_PREFIX(VertexAttrib1sNV)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(VertexAttrib1svNV)
+       .type   GL_PREFIX(VertexAttrib1svNV), @function
+GL_PREFIX(VertexAttrib1svNV):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    5792(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    5792(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    5792(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    5792(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(VertexAttrib1svNV), .-GL_PREFIX(VertexAttrib1svNV)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(VertexAttrib2dNV)
+       .type   GL_PREFIX(VertexAttrib2dNV), @function
+GL_PREFIX(VertexAttrib2dNV):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    5800(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       subq    $24, %rsp
+       movq    %rdi, (%rsp)
+       movq    %xmm0, 8(%rsp)
+       movq    %xmm1, 16(%rsp)
+       call    _x86_64_get_dispatch@PLT
+       movq    16(%rsp), %xmm1
+       movq    8(%rsp), %xmm0
+       movq    (%rsp), %rdi
+       addq    $24, %rsp
+       movq    5800(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    5800(%rax), %r11
+       jmp     *%r11
+1:
+       subq    $24, %rsp
+       movq    %rdi, (%rsp)
+       movq    %xmm0, 8(%rsp)
+       movq    %xmm1, 16(%rsp)
+       call    _glapi_get_dispatch
+       movq    16(%rsp), %xmm1
+       movq    8(%rsp), %xmm0
+       movq    (%rsp), %rdi
+       addq    $24, %rsp
+       movq    5800(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(VertexAttrib2dNV), .-GL_PREFIX(VertexAttrib2dNV)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(VertexAttrib2dvNV)
+       .type   GL_PREFIX(VertexAttrib2dvNV), @function
+GL_PREFIX(VertexAttrib2dvNV):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    5808(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    5808(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    5808(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    5808(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(VertexAttrib2dvNV), .-GL_PREFIX(VertexAttrib2dvNV)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(VertexAttrib2fNV)
+       .type   GL_PREFIX(VertexAttrib2fNV), @function
+GL_PREFIX(VertexAttrib2fNV):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    5816(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       subq    $24, %rsp
+       movq    %rdi, (%rsp)
+       movq    %xmm0, 8(%rsp)
+       movq    %xmm1, 16(%rsp)
+       call    _x86_64_get_dispatch@PLT
+       movq    16(%rsp), %xmm1
+       movq    8(%rsp), %xmm0
+       movq    (%rsp), %rdi
+       addq    $24, %rsp
+       movq    5816(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    5816(%rax), %r11
+       jmp     *%r11
+1:
+       subq    $24, %rsp
+       movq    %rdi, (%rsp)
+       movq    %xmm0, 8(%rsp)
+       movq    %xmm1, 16(%rsp)
+       call    _glapi_get_dispatch
+       movq    16(%rsp), %xmm1
+       movq    8(%rsp), %xmm0
+       movq    (%rsp), %rdi
+       addq    $24, %rsp
+       movq    5816(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(VertexAttrib2fNV), .-GL_PREFIX(VertexAttrib2fNV)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(VertexAttrib2fvNV)
+       .type   GL_PREFIX(VertexAttrib2fvNV), @function
+GL_PREFIX(VertexAttrib2fvNV):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    5824(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    5824(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    5824(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
+       popq    %rdi
+       movq    5824(%rax), %r11
+       jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib2fvNV), .-GL_PREFIX(VertexAttrib2fvNV)
 
@@ -27262,7 +27447,7 @@ GL_PREFIX(VertexAttrib2fvNV):
 GL_PREFIX(VertexAttrib2sNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5792(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27272,13 +27457,13 @@ GL_PREFIX(VertexAttrib2sNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5792(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5792(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27288,7 +27473,7 @@ GL_PREFIX(VertexAttrib2sNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5792(%rax), %r11
+       movq    5832(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib2sNV), .-GL_PREFIX(VertexAttrib2sNV)
@@ -27299,7 +27484,7 @@ GL_PREFIX(VertexAttrib2sNV):
 GL_PREFIX(VertexAttrib2svNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5800(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27309,13 +27494,13 @@ GL_PREFIX(VertexAttrib2svNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5800(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5800(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27325,7 +27510,7 @@ GL_PREFIX(VertexAttrib2svNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5800(%rax), %r11
+       movq    5840(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib2svNV), .-GL_PREFIX(VertexAttrib2svNV)
@@ -27336,7 +27521,7 @@ GL_PREFIX(VertexAttrib2svNV):
 GL_PREFIX(VertexAttrib3dNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5808(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $40, %rsp
@@ -27350,13 +27535,13 @@ GL_PREFIX(VertexAttrib3dNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5808(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5808(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 1:
        subq    $40, %rsp
@@ -27370,7 +27555,7 @@ GL_PREFIX(VertexAttrib3dNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5808(%rax), %r11
+       movq    5848(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib3dNV), .-GL_PREFIX(VertexAttrib3dNV)
@@ -27381,7 +27566,7 @@ GL_PREFIX(VertexAttrib3dNV):
 GL_PREFIX(VertexAttrib3dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5816(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27391,13 +27576,13 @@ GL_PREFIX(VertexAttrib3dvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5816(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5816(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27407,7 +27592,7 @@ GL_PREFIX(VertexAttrib3dvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5816(%rax), %r11
+       movq    5856(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib3dvNV), .-GL_PREFIX(VertexAttrib3dvNV)
@@ -27418,7 +27603,7 @@ GL_PREFIX(VertexAttrib3dvNV):
 GL_PREFIX(VertexAttrib3fNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5824(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $40, %rsp
@@ -27432,13 +27617,13 @@ GL_PREFIX(VertexAttrib3fNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5824(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5824(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 1:
        subq    $40, %rsp
@@ -27452,7 +27637,7 @@ GL_PREFIX(VertexAttrib3fNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5824(%rax), %r11
+       movq    5864(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib3fNV), .-GL_PREFIX(VertexAttrib3fNV)
@@ -27463,7 +27648,7 @@ GL_PREFIX(VertexAttrib3fNV):
 GL_PREFIX(VertexAttrib3fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5832(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27473,13 +27658,13 @@ GL_PREFIX(VertexAttrib3fvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5832(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5832(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27489,7 +27674,7 @@ GL_PREFIX(VertexAttrib3fvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5832(%rax), %r11
+       movq    5872(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib3fvNV), .-GL_PREFIX(VertexAttrib3fvNV)
@@ -27500,7 +27685,7 @@ GL_PREFIX(VertexAttrib3fvNV):
 GL_PREFIX(VertexAttrib3sNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5840(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27514,13 +27699,13 @@ GL_PREFIX(VertexAttrib3sNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5840(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5840(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27534,7 +27719,7 @@ GL_PREFIX(VertexAttrib3sNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5840(%rax), %r11
+       movq    5880(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib3sNV), .-GL_PREFIX(VertexAttrib3sNV)
@@ -27545,7 +27730,7 @@ GL_PREFIX(VertexAttrib3sNV):
 GL_PREFIX(VertexAttrib3svNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5848(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27555,13 +27740,13 @@ GL_PREFIX(VertexAttrib3svNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5848(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5848(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27571,7 +27756,7 @@ GL_PREFIX(VertexAttrib3svNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5848(%rax), %r11
+       movq    5888(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib3svNV), .-GL_PREFIX(VertexAttrib3svNV)
@@ -27582,7 +27767,7 @@ GL_PREFIX(VertexAttrib3svNV):
 GL_PREFIX(VertexAttrib4dNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5856(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $40, %rsp
@@ -27598,13 +27783,13 @@ GL_PREFIX(VertexAttrib4dNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5856(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5856(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 1:
        subq    $40, %rsp
@@ -27620,7 +27805,7 @@ GL_PREFIX(VertexAttrib4dNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5856(%rax), %r11
+       movq    5896(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4dNV), .-GL_PREFIX(VertexAttrib4dNV)
@@ -27631,7 +27816,7 @@ GL_PREFIX(VertexAttrib4dNV):
 GL_PREFIX(VertexAttrib4dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5864(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27641,13 +27826,13 @@ GL_PREFIX(VertexAttrib4dvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5864(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5864(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27657,7 +27842,7 @@ GL_PREFIX(VertexAttrib4dvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5864(%rax), %r11
+       movq    5904(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4dvNV), .-GL_PREFIX(VertexAttrib4dvNV)
@@ -27668,7 +27853,7 @@ GL_PREFIX(VertexAttrib4dvNV):
 GL_PREFIX(VertexAttrib4fNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5872(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $40, %rsp
@@ -27684,13 +27869,13 @@ GL_PREFIX(VertexAttrib4fNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5872(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5872(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 1:
        subq    $40, %rsp
@@ -27706,7 +27891,7 @@ GL_PREFIX(VertexAttrib4fNV):
        movq    8(%rsp), %xmm0
        movq    (%rsp), %rdi
        addq    $40, %rsp
-       movq    5872(%rax), %r11
+       movq    5912(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4fNV), .-GL_PREFIX(VertexAttrib4fNV)
@@ -27717,7 +27902,7 @@ GL_PREFIX(VertexAttrib4fNV):
 GL_PREFIX(VertexAttrib4fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5880(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27727,13 +27912,13 @@ GL_PREFIX(VertexAttrib4fvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5880(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5880(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27743,7 +27928,7 @@ GL_PREFIX(VertexAttrib4fvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5880(%rax), %r11
+       movq    5920(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4fvNV), .-GL_PREFIX(VertexAttrib4fvNV)
@@ -27754,7 +27939,7 @@ GL_PREFIX(VertexAttrib4fvNV):
 GL_PREFIX(VertexAttrib4sNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5888(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27768,13 +27953,13 @@ GL_PREFIX(VertexAttrib4sNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5888(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5888(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27788,7 +27973,7 @@ GL_PREFIX(VertexAttrib4sNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5888(%rax), %r11
+       movq    5928(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4sNV), .-GL_PREFIX(VertexAttrib4sNV)
@@ -27799,7 +27984,7 @@ GL_PREFIX(VertexAttrib4sNV):
 GL_PREFIX(VertexAttrib4svNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5896(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27809,13 +27994,13 @@ GL_PREFIX(VertexAttrib4svNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5896(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5896(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27825,7 +28010,7 @@ GL_PREFIX(VertexAttrib4svNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5896(%rax), %r11
+       movq    5936(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4svNV), .-GL_PREFIX(VertexAttrib4svNV)
@@ -27836,7 +28021,7 @@ GL_PREFIX(VertexAttrib4svNV):
 GL_PREFIX(VertexAttrib4ubNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5904(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27850,13 +28035,13 @@ GL_PREFIX(VertexAttrib4ubNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5904(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5904(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27870,7 +28055,7 @@ GL_PREFIX(VertexAttrib4ubNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5904(%rax), %r11
+       movq    5944(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4ubNV), .-GL_PREFIX(VertexAttrib4ubNV)
@@ -27881,7 +28066,7 @@ GL_PREFIX(VertexAttrib4ubNV):
 GL_PREFIX(VertexAttrib4ubvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5912(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27891,13 +28076,13 @@ GL_PREFIX(VertexAttrib4ubvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5912(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5912(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27907,7 +28092,7 @@ GL_PREFIX(VertexAttrib4ubvNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    5912(%rax), %r11
+       movq    5952(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttrib4ubvNV), .-GL_PREFIX(VertexAttrib4ubvNV)
@@ -27918,7 +28103,7 @@ GL_PREFIX(VertexAttrib4ubvNV):
 GL_PREFIX(VertexAttribPointerNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5920(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27932,13 +28117,13 @@ GL_PREFIX(VertexAttribPointerNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5920(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5920(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27952,7 +28137,7 @@ GL_PREFIX(VertexAttribPointerNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5920(%rax), %r11
+       movq    5960(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribPointerNV), .-GL_PREFIX(VertexAttribPointerNV)
@@ -27963,7 +28148,7 @@ GL_PREFIX(VertexAttribPointerNV):
 GL_PREFIX(VertexAttribs1dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5928(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -27973,13 +28158,13 @@ GL_PREFIX(VertexAttribs1dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5928(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5928(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -27989,7 +28174,7 @@ GL_PREFIX(VertexAttribs1dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5928(%rax), %r11
+       movq    5968(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs1dvNV), .-GL_PREFIX(VertexAttribs1dvNV)
@@ -28000,7 +28185,7 @@ GL_PREFIX(VertexAttribs1dvNV):
 GL_PREFIX(VertexAttribs1fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5936(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28010,13 +28195,13 @@ GL_PREFIX(VertexAttribs1fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5936(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5936(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28026,7 +28211,7 @@ GL_PREFIX(VertexAttribs1fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5936(%rax), %r11
+       movq    5976(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs1fvNV), .-GL_PREFIX(VertexAttribs1fvNV)
@@ -28037,7 +28222,7 @@ GL_PREFIX(VertexAttribs1fvNV):
 GL_PREFIX(VertexAttribs1svNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5944(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28047,13 +28232,13 @@ GL_PREFIX(VertexAttribs1svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5944(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5944(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28063,7 +28248,7 @@ GL_PREFIX(VertexAttribs1svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5944(%rax), %r11
+       movq    5984(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs1svNV), .-GL_PREFIX(VertexAttribs1svNV)
@@ -28074,7 +28259,7 @@ GL_PREFIX(VertexAttribs1svNV):
 GL_PREFIX(VertexAttribs2dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5952(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28084,13 +28269,13 @@ GL_PREFIX(VertexAttribs2dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5952(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5952(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28100,7 +28285,7 @@ GL_PREFIX(VertexAttribs2dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5952(%rax), %r11
+       movq    5992(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs2dvNV), .-GL_PREFIX(VertexAttribs2dvNV)
@@ -28111,7 +28296,7 @@ GL_PREFIX(VertexAttribs2dvNV):
 GL_PREFIX(VertexAttribs2fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5960(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28121,13 +28306,13 @@ GL_PREFIX(VertexAttribs2fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5960(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5960(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28137,7 +28322,7 @@ GL_PREFIX(VertexAttribs2fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5960(%rax), %r11
+       movq    6000(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs2fvNV), .-GL_PREFIX(VertexAttribs2fvNV)
@@ -28148,7 +28333,7 @@ GL_PREFIX(VertexAttribs2fvNV):
 GL_PREFIX(VertexAttribs2svNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5968(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28158,13 +28343,13 @@ GL_PREFIX(VertexAttribs2svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5968(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5968(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28174,7 +28359,7 @@ GL_PREFIX(VertexAttribs2svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5968(%rax), %r11
+       movq    6008(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs2svNV), .-GL_PREFIX(VertexAttribs2svNV)
@@ -28185,7 +28370,7 @@ GL_PREFIX(VertexAttribs2svNV):
 GL_PREFIX(VertexAttribs3dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5976(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28195,13 +28380,13 @@ GL_PREFIX(VertexAttribs3dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5976(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5976(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28211,7 +28396,7 @@ GL_PREFIX(VertexAttribs3dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5976(%rax), %r11
+       movq    6016(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs3dvNV), .-GL_PREFIX(VertexAttribs3dvNV)
@@ -28222,7 +28407,7 @@ GL_PREFIX(VertexAttribs3dvNV):
 GL_PREFIX(VertexAttribs3fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5984(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28232,13 +28417,13 @@ GL_PREFIX(VertexAttribs3fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5984(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5984(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28248,7 +28433,7 @@ GL_PREFIX(VertexAttribs3fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5984(%rax), %r11
+       movq    6024(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs3fvNV), .-GL_PREFIX(VertexAttribs3fvNV)
@@ -28259,7 +28444,7 @@ GL_PREFIX(VertexAttribs3fvNV):
 GL_PREFIX(VertexAttribs3svNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    5992(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28269,13 +28454,13 @@ GL_PREFIX(VertexAttribs3svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5992(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    5992(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28285,7 +28470,7 @@ GL_PREFIX(VertexAttribs3svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    5992(%rax), %r11
+       movq    6032(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs3svNV), .-GL_PREFIX(VertexAttribs3svNV)
@@ -28296,7 +28481,7 @@ GL_PREFIX(VertexAttribs3svNV):
 GL_PREFIX(VertexAttribs4dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6000(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28306,13 +28491,13 @@ GL_PREFIX(VertexAttribs4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6000(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6000(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28322,7 +28507,7 @@ GL_PREFIX(VertexAttribs4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6000(%rax), %r11
+       movq    6040(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs4dvNV), .-GL_PREFIX(VertexAttribs4dvNV)
@@ -28333,7 +28518,7 @@ GL_PREFIX(VertexAttribs4dvNV):
 GL_PREFIX(VertexAttribs4fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6008(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28343,13 +28528,13 @@ GL_PREFIX(VertexAttribs4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6008(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6008(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28359,7 +28544,7 @@ GL_PREFIX(VertexAttribs4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6008(%rax), %r11
+       movq    6048(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs4fvNV), .-GL_PREFIX(VertexAttribs4fvNV)
@@ -28370,7 +28555,7 @@ GL_PREFIX(VertexAttribs4fvNV):
 GL_PREFIX(VertexAttribs4svNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6016(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28380,13 +28565,13 @@ GL_PREFIX(VertexAttribs4svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6016(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6016(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28396,7 +28581,7 @@ GL_PREFIX(VertexAttribs4svNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6016(%rax), %r11
+       movq    6056(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs4svNV), .-GL_PREFIX(VertexAttribs4svNV)
@@ -28407,7 +28592,7 @@ GL_PREFIX(VertexAttribs4svNV):
 GL_PREFIX(VertexAttribs4ubvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6024(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28417,13 +28602,13 @@ GL_PREFIX(VertexAttribs4ubvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6024(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6024(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28433,7 +28618,7 @@ GL_PREFIX(VertexAttribs4ubvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6024(%rax), %r11
+       movq    6064(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(VertexAttribs4ubvNV), .-GL_PREFIX(VertexAttribs4ubvNV)
@@ -28444,7 +28629,7 @@ GL_PREFIX(VertexAttribs4ubvNV):
 GL_PREFIX(GetTexBumpParameterfvATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6032(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28454,13 +28639,13 @@ GL_PREFIX(GetTexBumpParameterfvATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6032(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6032(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28470,7 +28655,7 @@ GL_PREFIX(GetTexBumpParameterfvATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6032(%rax), %r11
+       movq    6072(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetTexBumpParameterfvATI), .-GL_PREFIX(GetTexBumpParameterfvATI)
@@ -28481,7 +28666,7 @@ GL_PREFIX(GetTexBumpParameterfvATI):
 GL_PREFIX(GetTexBumpParameterivATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6040(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28491,13 +28676,13 @@ GL_PREFIX(GetTexBumpParameterivATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6040(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6040(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28507,7 +28692,7 @@ GL_PREFIX(GetTexBumpParameterivATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6040(%rax), %r11
+       movq    6080(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetTexBumpParameterivATI), .-GL_PREFIX(GetTexBumpParameterivATI)
@@ -28518,7 +28703,7 @@ GL_PREFIX(GetTexBumpParameterivATI):
 GL_PREFIX(TexBumpParameterfvATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6048(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28528,13 +28713,13 @@ GL_PREFIX(TexBumpParameterfvATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6048(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6048(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28544,7 +28729,7 @@ GL_PREFIX(TexBumpParameterfvATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6048(%rax), %r11
+       movq    6088(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(TexBumpParameterfvATI), .-GL_PREFIX(TexBumpParameterfvATI)
@@ -28555,7 +28740,7 @@ GL_PREFIX(TexBumpParameterfvATI):
 GL_PREFIX(TexBumpParameterivATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6056(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28565,13 +28750,13 @@ GL_PREFIX(TexBumpParameterivATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6056(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6056(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28581,7 +28766,7 @@ GL_PREFIX(TexBumpParameterivATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6056(%rax), %r11
+       movq    6096(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(TexBumpParameterivATI), .-GL_PREFIX(TexBumpParameterivATI)
@@ -28592,7 +28777,7 @@ GL_PREFIX(TexBumpParameterivATI):
 GL_PREFIX(AlphaFragmentOp1ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6064(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28610,13 +28795,13 @@ GL_PREFIX(AlphaFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6064(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6064(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28634,7 +28819,7 @@ GL_PREFIX(AlphaFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6064(%rax), %r11
+       movq    6104(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(AlphaFragmentOp1ATI), .-GL_PREFIX(AlphaFragmentOp1ATI)
@@ -28645,7 +28830,7 @@ GL_PREFIX(AlphaFragmentOp1ATI):
 GL_PREFIX(AlphaFragmentOp2ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6072(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28663,13 +28848,13 @@ GL_PREFIX(AlphaFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6072(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6072(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28687,7 +28872,7 @@ GL_PREFIX(AlphaFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6072(%rax), %r11
+       movq    6112(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(AlphaFragmentOp2ATI), .-GL_PREFIX(AlphaFragmentOp2ATI)
@@ -28698,7 +28883,7 @@ GL_PREFIX(AlphaFragmentOp2ATI):
 GL_PREFIX(AlphaFragmentOp3ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6080(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28716,13 +28901,13 @@ GL_PREFIX(AlphaFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6080(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6080(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28740,7 +28925,7 @@ GL_PREFIX(AlphaFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6080(%rax), %r11
+       movq    6120(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(AlphaFragmentOp3ATI), .-GL_PREFIX(AlphaFragmentOp3ATI)
@@ -28751,25 +28936,25 @@ GL_PREFIX(AlphaFragmentOp3ATI):
 GL_PREFIX(BeginFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6088(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       movq    6088(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6088(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       movq    6088(%rax), %r11
+       movq    6128(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BeginFragmentShaderATI), .-GL_PREFIX(BeginFragmentShaderATI)
@@ -28780,25 +28965,25 @@ GL_PREFIX(BeginFragmentShaderATI):
 GL_PREFIX(BindFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6096(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6096(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6096(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6096(%rax), %r11
+       movq    6136(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(BindFragmentShaderATI), .-GL_PREFIX(BindFragmentShaderATI)
@@ -28809,7 +28994,7 @@ GL_PREFIX(BindFragmentShaderATI):
 GL_PREFIX(ColorFragmentOp1ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6104(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28827,13 +29012,13 @@ GL_PREFIX(ColorFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6104(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6104(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28851,7 +29036,7 @@ GL_PREFIX(ColorFragmentOp1ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6104(%rax), %r11
+       movq    6144(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ColorFragmentOp1ATI), .-GL_PREFIX(ColorFragmentOp1ATI)
@@ -28862,7 +29047,7 @@ GL_PREFIX(ColorFragmentOp1ATI):
 GL_PREFIX(ColorFragmentOp2ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6112(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28880,13 +29065,13 @@ GL_PREFIX(ColorFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6112(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6112(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28904,7 +29089,7 @@ GL_PREFIX(ColorFragmentOp2ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6112(%rax), %r11
+       movq    6152(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ColorFragmentOp2ATI), .-GL_PREFIX(ColorFragmentOp2ATI)
@@ -28915,7 +29100,7 @@ GL_PREFIX(ColorFragmentOp2ATI):
 GL_PREFIX(ColorFragmentOp3ATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6120(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -28933,13 +29118,13 @@ GL_PREFIX(ColorFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6120(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6120(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -28957,7 +29142,7 @@ GL_PREFIX(ColorFragmentOp3ATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6120(%rax), %r11
+       movq    6160(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ColorFragmentOp3ATI), .-GL_PREFIX(ColorFragmentOp3ATI)
@@ -28968,25 +29153,25 @@ GL_PREFIX(ColorFragmentOp3ATI):
 GL_PREFIX(DeleteFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6128(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6128(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6128(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6128(%rax), %r11
+       movq    6168(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(DeleteFragmentShaderATI), .-GL_PREFIX(DeleteFragmentShaderATI)
@@ -28997,25 +29182,25 @@ GL_PREFIX(DeleteFragmentShaderATI):
 GL_PREFIX(EndFragmentShaderATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6136(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       movq    6136(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6136(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       movq    6136(%rax), %r11
+       movq    6176(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(EndFragmentShaderATI), .-GL_PREFIX(EndFragmentShaderATI)
@@ -29026,25 +29211,25 @@ GL_PREFIX(EndFragmentShaderATI):
 GL_PREFIX(GenFragmentShadersATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6144(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6144(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6144(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6144(%rax), %r11
+       movq    6184(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GenFragmentShadersATI), .-GL_PREFIX(GenFragmentShadersATI)
@@ -29055,7 +29240,7 @@ GL_PREFIX(GenFragmentShadersATI):
 GL_PREFIX(PassTexCoordATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6152(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29065,13 +29250,13 @@ GL_PREFIX(PassTexCoordATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6152(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6152(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29081,7 +29266,7 @@ GL_PREFIX(PassTexCoordATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6152(%rax), %r11
+       movq    6192(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PassTexCoordATI), .-GL_PREFIX(PassTexCoordATI)
@@ -29092,7 +29277,7 @@ GL_PREFIX(PassTexCoordATI):
 GL_PREFIX(SampleMapATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6160(%rax), %r11
+       movq    6200(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29102,13 +29287,13 @@ GL_PREFIX(SampleMapATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6160(%rax), %r11
+       movq    6200(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6160(%rax), %r11
+       movq    6200(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29118,7 +29303,7 @@ GL_PREFIX(SampleMapATI):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6160(%rax), %r11
+       movq    6200(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SampleMapATI), .-GL_PREFIX(SampleMapATI)
@@ -29129,7 +29314,7 @@ GL_PREFIX(SampleMapATI):
 GL_PREFIX(SetFragmentShaderConstantATI):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6168(%rax), %r11
+       movq    6208(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29139,13 +29324,13 @@ GL_PREFIX(SetFragmentShaderConstantATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6168(%rax), %r11
+       movq    6208(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6168(%rax), %r11
+       movq    6208(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29155,7 +29340,7 @@ GL_PREFIX(SetFragmentShaderConstantATI):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6168(%rax), %r11
+       movq    6208(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(SetFragmentShaderConstantATI), .-GL_PREFIX(SetFragmentShaderConstantATI)
@@ -29166,7 +29351,7 @@ GL_PREFIX(SetFragmentShaderConstantATI):
 GL_PREFIX(PointParameteriNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6176(%rax), %r11
+       movq    6216(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29176,13 +29361,13 @@ GL_PREFIX(PointParameteriNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6176(%rax), %r11
+       movq    6216(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6176(%rax), %r11
+       movq    6216(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29192,7 +29377,7 @@ GL_PREFIX(PointParameteriNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6176(%rax), %r11
+       movq    6216(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PointParameteriNV), .-GL_PREFIX(PointParameteriNV)
@@ -29203,7 +29388,7 @@ GL_PREFIX(PointParameteriNV):
 GL_PREFIX(PointParameterivNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6184(%rax), %r11
+       movq    6224(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29213,13 +29398,13 @@ GL_PREFIX(PointParameterivNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6184(%rax), %r11
+       movq    6224(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6184(%rax), %r11
+       movq    6224(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29229,79 +29414,79 @@ GL_PREFIX(PointParameterivNV):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6184(%rax), %r11
+       movq    6224(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_774)
-       .type   GL_PREFIX(_dispatch_stub_774), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_774))
-GL_PREFIX(_dispatch_stub_774):
+       .globl  GL_PREFIX(_dispatch_stub_779)
+       .type   GL_PREFIX(_dispatch_stub_779), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_779))
+GL_PREFIX(_dispatch_stub_779):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6192(%rax), %r11
+       movq    6232(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6192(%rax), %r11
+       movq    6232(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6192(%rax), %r11
+       movq    6232(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6192(%rax), %r11
+       movq    6232(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774)
+       .size   GL_PREFIX(_dispatch_stub_779), .-GL_PREFIX(_dispatch_stub_779)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_775)
-       .type   GL_PREFIX(_dispatch_stub_775), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_775))
-GL_PREFIX(_dispatch_stub_775):
+       .globl  GL_PREFIX(_dispatch_stub_780)
+       .type   GL_PREFIX(_dispatch_stub_780), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_780))
+GL_PREFIX(_dispatch_stub_780):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6200(%rax), %r11
+       movq    6240(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6200(%rax), %r11
+       movq    6240(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6200(%rax), %r11
+       movq    6240(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6200(%rax), %r11
+       movq    6240(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_775), .-GL_PREFIX(_dispatch_stub_775)
+       .size   GL_PREFIX(_dispatch_stub_780), .-GL_PREFIX(_dispatch_stub_780)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_776)
-       .type   GL_PREFIX(_dispatch_stub_776), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_776))
-GL_PREFIX(_dispatch_stub_776):
+       .globl  GL_PREFIX(_dispatch_stub_781)
+       .type   GL_PREFIX(_dispatch_stub_781), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_781))
+GL_PREFIX(_dispatch_stub_781):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6208(%rax), %r11
+       movq    6248(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29311,13 +29496,13 @@ GL_PREFIX(_dispatch_stub_776):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6208(%rax), %r11
+       movq    6248(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6208(%rax), %r11
+       movq    6248(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29327,19 +29512,19 @@ GL_PREFIX(_dispatch_stub_776):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6208(%rax), %r11
+       movq    6248(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_776), .-GL_PREFIX(_dispatch_stub_776)
+       .size   GL_PREFIX(_dispatch_stub_781), .-GL_PREFIX(_dispatch_stub_781)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_777)
-       .type   GL_PREFIX(_dispatch_stub_777), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_777))
-GL_PREFIX(_dispatch_stub_777):
+       .globl  GL_PREFIX(_dispatch_stub_782)
+       .type   GL_PREFIX(_dispatch_stub_782), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_782))
+GL_PREFIX(_dispatch_stub_782):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6216(%rax), %r11
+       movq    6256(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29349,13 +29534,13 @@ GL_PREFIX(_dispatch_stub_777):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6216(%rax), %r11
+       movq    6256(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6216(%rax), %r11
+       movq    6256(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29365,40 +29550,40 @@ GL_PREFIX(_dispatch_stub_777):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6216(%rax), %r11
+       movq    6256(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_777), .-GL_PREFIX(_dispatch_stub_777)
+       .size   GL_PREFIX(_dispatch_stub_782), .-GL_PREFIX(_dispatch_stub_782)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_778)
-       .type   GL_PREFIX(_dispatch_stub_778), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_778))
-GL_PREFIX(_dispatch_stub_778):
+       .globl  GL_PREFIX(_dispatch_stub_783)
+       .type   GL_PREFIX(_dispatch_stub_783), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_783))
+GL_PREFIX(_dispatch_stub_783):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6224(%rax), %r11
+       movq    6264(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6224(%rax), %r11
+       movq    6264(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6224(%rax), %r11
+       movq    6264(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6224(%rax), %r11
+       movq    6264(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_778), .-GL_PREFIX(_dispatch_stub_778)
+       .size   GL_PREFIX(_dispatch_stub_783), .-GL_PREFIX(_dispatch_stub_783)
 
        .p2align        4,,15
        .globl  GL_PREFIX(GetProgramNamedParameterdvNV)
@@ -29406,7 +29591,7 @@ GL_PREFIX(_dispatch_stub_778):
 GL_PREFIX(GetProgramNamedParameterdvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6232(%rax), %r11
+       movq    6272(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29420,13 +29605,13 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6232(%rax), %r11
+       movq    6272(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6232(%rax), %r11
+       movq    6272(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29440,7 +29625,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6232(%rax), %r11
+       movq    6272(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramNamedParameterdvNV), .-GL_PREFIX(GetProgramNamedParameterdvNV)
@@ -29451,7 +29636,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV):
 GL_PREFIX(GetProgramNamedParameterfvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6240(%rax), %r11
+       movq    6280(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29465,13 +29650,13 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6240(%rax), %r11
+       movq    6280(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6240(%rax), %r11
+       movq    6280(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29485,7 +29670,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6240(%rax), %r11
+       movq    6280(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetProgramNamedParameterfvNV), .-GL_PREFIX(GetProgramNamedParameterfvNV)
@@ -29496,7 +29681,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV):
 GL_PREFIX(ProgramNamedParameter4dNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6248(%rax), %r11
+       movq    6288(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $56, %rsp
@@ -29516,13 +29701,13 @@ GL_PREFIX(ProgramNamedParameter4dNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    6248(%rax), %r11
+       movq    6288(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6248(%rax), %r11
+       movq    6288(%rax), %r11
        jmp     *%r11
 1:
        subq    $56, %rsp
@@ -29542,7 +29727,7 @@ GL_PREFIX(ProgramNamedParameter4dNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    6248(%rax), %r11
+       movq    6288(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4dNV), .-GL_PREFIX(ProgramNamedParameter4dNV)
@@ -29553,7 +29738,7 @@ GL_PREFIX(ProgramNamedParameter4dNV):
 GL_PREFIX(ProgramNamedParameter4dvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6256(%rax), %r11
+       movq    6296(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29567,13 +29752,13 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6256(%rax), %r11
+       movq    6296(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6256(%rax), %r11
+       movq    6296(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29587,7 +29772,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6256(%rax), %r11
+       movq    6296(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4dvNV), .-GL_PREFIX(ProgramNamedParameter4dvNV)
@@ -29598,7 +29783,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV):
 GL_PREFIX(ProgramNamedParameter4fNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6264(%rax), %r11
+       movq    6304(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        subq    $56, %rsp
@@ -29618,13 +29803,13 @@ GL_PREFIX(ProgramNamedParameter4fNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    6264(%rax), %r11
+       movq    6304(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6264(%rax), %r11
+       movq    6304(%rax), %r11
        jmp     *%r11
 1:
        subq    $56, %rsp
@@ -29644,7 +29829,7 @@ GL_PREFIX(ProgramNamedParameter4fNV):
        movq    8(%rsp), %rsi
        movq    (%rsp), %rdi
        addq    $56, %rsp
-       movq    6264(%rax), %r11
+       movq    6304(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4fNV), .-GL_PREFIX(ProgramNamedParameter4fNV)
@@ -29655,7 +29840,7 @@ GL_PREFIX(ProgramNamedParameter4fNV):
 GL_PREFIX(ProgramNamedParameter4fvNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6272(%rax), %r11
+       movq    6312(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -29669,13 +29854,13 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6272(%rax), %r11
+       movq    6312(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6272(%rax), %r11
+       movq    6312(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -29689,7 +29874,7 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6272(%rax), %r11
+       movq    6312(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProgramNamedParameter4fvNV), .-GL_PREFIX(ProgramNamedParameter4fvNV)
@@ -29700,25 +29885,25 @@ GL_PREFIX(ProgramNamedParameter4fvNV):
 GL_PREFIX(PrimitiveRestartIndexNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6280(%rax), %r11
+       movq    6320(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6280(%rax), %r11
+       movq    6320(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6280(%rax), %r11
+       movq    6320(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6280(%rax), %r11
+       movq    6320(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(PrimitiveRestartIndexNV), .-GL_PREFIX(PrimitiveRestartIndexNV)
@@ -29729,191 +29914,12 @@ GL_PREFIX(PrimitiveRestartIndexNV):
 GL_PREFIX(PrimitiveRestartNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6288(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rbp
-       call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       movq    6288(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    6288(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       movq    6288(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(PrimitiveRestartNV), .-GL_PREFIX(PrimitiveRestartNV)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_787)
-       .type   GL_PREFIX(_dispatch_stub_787), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_787))
-GL_PREFIX(_dispatch_stub_787):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    6296(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6296(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    6296(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6296(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_787), .-GL_PREFIX(_dispatch_stub_787)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_788)
-       .type   GL_PREFIX(_dispatch_stub_788), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_788))
-GL_PREFIX(_dispatch_stub_788):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    6304(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6304(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    6304(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6304(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_788), .-GL_PREFIX(_dispatch_stub_788)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(BindFramebufferEXT)
-       .type   GL_PREFIX(BindFramebufferEXT), @function
-GL_PREFIX(BindFramebufferEXT):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    6312(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6312(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    6312(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6312(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(BindRenderbufferEXT)
-       .type   GL_PREFIX(BindRenderbufferEXT), @function
-GL_PREFIX(BindRenderbufferEXT):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    6320(%rax), %r11
+       movq    6328(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
-       pushq   %rdi
-       pushq   %rsi
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6320(%rax), %r11
-       jmp     *%r11
-#else
-       movq    _glapi_Dispatch(%rip), %rax
-       testq   %rax, %rax
-       je      1f
-       movq    6320(%rax), %r11
-       jmp     *%r11
-1:
-       pushq   %rdi
-       pushq   %rsi
-       pushq   %rbp
-       call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rsi
-       popq    %rdi
-       movq    6320(%rax), %r11
-       jmp     *%r11
-#endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT)
-
-       .p2align        4,,15
-       .globl  GL_PREFIX(CheckFramebufferStatusEXT)
-       .type   GL_PREFIX(CheckFramebufferStatusEXT), @function
-GL_PREFIX(CheckFramebufferStatusEXT):
-#if defined(GLX_USE_TLS)
-       call    _x86_64_get_dispatch@PLT
-       movq    6328(%rax), %r11
-       jmp     *%r11
-#elif defined(PTHREADS)
-       pushq   %rdi
-       call    _x86_64_get_dispatch@PLT
-       popq    %rdi
        movq    6328(%rax), %r11
        jmp     *%r11
 #else
@@ -29923,18 +29929,19 @@ GL_PREFIX(CheckFramebufferStatusEXT):
        movq    6328(%rax), %r11
        jmp     *%r11
 1:
-       pushq   %rdi
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rdi
+       popq    %rbp
        movq    6328(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT)
+       .size   GL_PREFIX(PrimitiveRestartNV), .-GL_PREFIX(PrimitiveRestartNV)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(DeleteFramebuffersEXT)
-       .type   GL_PREFIX(DeleteFramebuffersEXT), @function
-GL_PREFIX(DeleteFramebuffersEXT):
+       .globl  GL_PREFIX(_dispatch_stub_792)
+       .type   GL_PREFIX(_dispatch_stub_792), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_792))
+GL_PREFIX(_dispatch_stub_792):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6336(%rax), %r11
@@ -29966,12 +29973,13 @@ GL_PREFIX(DeleteFramebuffersEXT):
        movq    6336(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT)
+       .size   GL_PREFIX(_dispatch_stub_792), .-GL_PREFIX(_dispatch_stub_792)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(DeleteRenderbuffersEXT)
-       .type   GL_PREFIX(DeleteRenderbuffersEXT), @function
-GL_PREFIX(DeleteRenderbuffersEXT):
+       .globl  GL_PREFIX(_dispatch_stub_793)
+       .type   GL_PREFIX(_dispatch_stub_793), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_793))
+GL_PREFIX(_dispatch_stub_793):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6344(%rax), %r11
@@ -30003,12 +30011,12 @@ GL_PREFIX(DeleteRenderbuffersEXT):
        movq    6344(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT)
+       .size   GL_PREFIX(_dispatch_stub_793), .-GL_PREFIX(_dispatch_stub_793)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(FramebufferRenderbufferEXT)
-       .type   GL_PREFIX(FramebufferRenderbufferEXT), @function
-GL_PREFIX(FramebufferRenderbufferEXT):
+       .globl  GL_PREFIX(BindFramebufferEXT)
+       .type   GL_PREFIX(BindFramebufferEXT), @function
+GL_PREFIX(BindFramebufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6352(%rax), %r11
@@ -30016,13 +30024,9 @@ GL_PREFIX(FramebufferRenderbufferEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6352(%rax), %r11
@@ -30036,24 +30040,20 @@ GL_PREFIX(FramebufferRenderbufferEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6352(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT)
+       .size   GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(FramebufferTexture1DEXT)
-       .type   GL_PREFIX(FramebufferTexture1DEXT), @function
-GL_PREFIX(FramebufferTexture1DEXT):
+       .globl  GL_PREFIX(BindRenderbufferEXT)
+       .type   GL_PREFIX(BindRenderbufferEXT), @function
+GL_PREFIX(BindRenderbufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6360(%rax), %r11
@@ -30061,13 +30061,9 @@ GL_PREFIX(FramebufferTexture1DEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6360(%rax), %r11
@@ -30081,39 +30077,27 @@ GL_PREFIX(FramebufferTexture1DEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6360(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT)
+       .size   GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(FramebufferTexture2DEXT)
-       .type   GL_PREFIX(FramebufferTexture2DEXT), @function
-GL_PREFIX(FramebufferTexture2DEXT):
+       .globl  GL_PREFIX(CheckFramebufferStatusEXT)
+       .type   GL_PREFIX(CheckFramebufferStatusEXT), @function
+GL_PREFIX(CheckFramebufferStatusEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6368(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6368(%rax), %r11
        jmp     *%r11
@@ -30125,25 +30109,17 @@ GL_PREFIX(FramebufferTexture2DEXT):
        jmp     *%r11
 1:
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
        call    _glapi_get_dispatch
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6368(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT)
+       .size   GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(FramebufferTexture3DEXT)
-       .type   GL_PREFIX(FramebufferTexture3DEXT), @function
-GL_PREFIX(FramebufferTexture3DEXT):
+       .globl  GL_PREFIX(DeleteFramebuffersEXT)
+       .type   GL_PREFIX(DeleteFramebuffersEXT), @function
+GL_PREFIX(DeleteFramebuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6376(%rax), %r11
@@ -30151,17 +30127,9 @@ GL_PREFIX(FramebufferTexture3DEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
-       pushq   %r9
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %r9
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6376(%rax), %r11
@@ -30175,28 +30143,20 @@ GL_PREFIX(FramebufferTexture3DEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
-       pushq   %r9
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       popq    %r9
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6376(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT)
+       .size   GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GenFramebuffersEXT)
-       .type   GL_PREFIX(GenFramebuffersEXT), @function
-GL_PREFIX(GenFramebuffersEXT):
+       .globl  GL_PREFIX(DeleteRenderbuffersEXT)
+       .type   GL_PREFIX(DeleteRenderbuffersEXT), @function
+GL_PREFIX(DeleteRenderbuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6384(%rax), %r11
@@ -30228,12 +30188,12 @@ GL_PREFIX(GenFramebuffersEXT):
        movq    6384(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT)
+       .size   GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GenRenderbuffersEXT)
-       .type   GL_PREFIX(GenRenderbuffersEXT), @function
-GL_PREFIX(GenRenderbuffersEXT):
+       .globl  GL_PREFIX(FramebufferRenderbufferEXT)
+       .type   GL_PREFIX(FramebufferRenderbufferEXT), @function
+GL_PREFIX(FramebufferRenderbufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6392(%rax), %r11
@@ -30241,9 +30201,13 @@ GL_PREFIX(GenRenderbuffersEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6392(%rax), %r11
@@ -30257,27 +30221,39 @@ GL_PREFIX(GenRenderbuffersEXT):
 1:
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6392(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT)
+       .size   GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GenerateMipmapEXT)
-       .type   GL_PREFIX(GenerateMipmapEXT), @function
-GL_PREFIX(GenerateMipmapEXT):
+       .globl  GL_PREFIX(FramebufferTexture1DEXT)
+       .type   GL_PREFIX(FramebufferTexture1DEXT), @function
+GL_PREFIX(FramebufferTexture1DEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6400(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
+       popq    %rsi
        popq    %rdi
        movq    6400(%rax), %r11
        jmp     *%r11
@@ -30289,17 +30265,25 @@ GL_PREFIX(GenerateMipmapEXT):
        jmp     *%r11
 1:
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _glapi_get_dispatch
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
+       popq    %rsi
        popq    %rdi
        movq    6400(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT)
+       .size   GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetFramebufferAttachmentParameterivEXT)
-       .type   GL_PREFIX(GetFramebufferAttachmentParameterivEXT), @function
-GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
+       .globl  GL_PREFIX(FramebufferTexture2DEXT)
+       .type   GL_PREFIX(FramebufferTexture2DEXT), @function
+GL_PREFIX(FramebufferTexture2DEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6408(%rax), %r11
@@ -30309,9 +30293,9 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
        pushq   %rsi
        pushq   %rdx
        pushq   %rcx
-       pushq   %rbp
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %r8
        popq    %rcx
        popq    %rdx
        popq    %rsi
@@ -30329,9 +30313,9 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
        pushq   %rsi
        pushq   %rdx
        pushq   %rcx
-       pushq   %rbp
+       pushq   %r8
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %r8
        popq    %rcx
        popq    %rdx
        popq    %rsi
@@ -30339,12 +30323,12 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
        movq    6408(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT)
+       .size   GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetRenderbufferParameterivEXT)
-       .type   GL_PREFIX(GetRenderbufferParameterivEXT), @function
-GL_PREFIX(GetRenderbufferParameterivEXT):
+       .globl  GL_PREFIX(FramebufferTexture3DEXT)
+       .type   GL_PREFIX(FramebufferTexture3DEXT), @function
+GL_PREFIX(FramebufferTexture3DEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6416(%rax), %r11
@@ -30353,7 +30337,15 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
+       pushq   %r9
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %r9
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -30369,26 +30361,38 @@ GL_PREFIX(GetRenderbufferParameterivEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
+       pushq   %r9
+       pushq   %rbp
        call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %r9
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6416(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT)
+       .size   GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(IsFramebufferEXT)
-       .type   GL_PREFIX(IsFramebufferEXT), @function
-GL_PREFIX(IsFramebufferEXT):
+       .globl  GL_PREFIX(GenFramebuffersEXT)
+       .type   GL_PREFIX(GenFramebuffersEXT), @function
+GL_PREFIX(GenFramebuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6424(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
        popq    %rdi
        movq    6424(%rax), %r11
        jmp     *%r11
@@ -30400,24 +30404,32 @@ GL_PREFIX(IsFramebufferEXT):
        jmp     *%r11
 1:
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
        call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
        popq    %rdi
        movq    6424(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT)
+       .size   GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(IsRenderbufferEXT)
-       .type   GL_PREFIX(IsRenderbufferEXT), @function
-GL_PREFIX(IsRenderbufferEXT):
+       .globl  GL_PREFIX(GenRenderbuffersEXT)
+       .type   GL_PREFIX(GenRenderbuffersEXT), @function
+GL_PREFIX(GenRenderbuffersEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6432(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rsi
        popq    %rdi
        movq    6432(%rax), %r11
        jmp     *%r11
@@ -30429,32 +30441,28 @@ GL_PREFIX(IsRenderbufferEXT):
        jmp     *%r11
 1:
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rbp
        call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rsi
        popq    %rdi
        movq    6432(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT)
+       .size   GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(RenderbufferStorageEXT)
-       .type   GL_PREFIX(RenderbufferStorageEXT), @function
-GL_PREFIX(RenderbufferStorageEXT):
+       .globl  GL_PREFIX(GenerateMipmapEXT)
+       .type   GL_PREFIX(GenerateMipmapEXT), @function
+GL_PREFIX(GenerateMipmapEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6440(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rcx
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6440(%rax), %r11
        jmp     *%r11
@@ -30466,26 +30474,17 @@ GL_PREFIX(RenderbufferStorageEXT):
        jmp     *%r11
 1:
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rcx
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6440(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT)
+       .size   GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_806)
-       .type   GL_PREFIX(_dispatch_stub_806), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_806))
-GL_PREFIX(_dispatch_stub_806):
+       .globl  GL_PREFIX(GetFramebufferAttachmentParameterivEXT)
+       .type   GL_PREFIX(GetFramebufferAttachmentParameterivEXT), @function
+GL_PREFIX(GetFramebufferAttachmentParameterivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6448(%rax), %r11
@@ -30495,13 +30494,9 @@ GL_PREFIX(_dispatch_stub_806):
        pushq   %rsi
        pushq   %rdx
        pushq   %rcx
-       pushq   %r8
-       pushq   %r9
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %r9
-       popq    %r8
        popq    %rcx
        popq    %rdx
        popq    %rsi
@@ -30519,13 +30514,9 @@ GL_PREFIX(_dispatch_stub_806):
        pushq   %rsi
        pushq   %rdx
        pushq   %rcx
-       pushq   %r8
-       pushq   %r9
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       popq    %r9
-       popq    %r8
        popq    %rcx
        popq    %rdx
        popq    %rsi
@@ -30533,13 +30524,12 @@ GL_PREFIX(_dispatch_stub_806):
        movq    6448(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_806), .-GL_PREFIX(_dispatch_stub_806)
+       .size   GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_807)
-       .type   GL_PREFIX(_dispatch_stub_807), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_807))
-GL_PREFIX(_dispatch_stub_807):
+       .globl  GL_PREFIX(GetRenderbufferParameterivEXT)
+       .type   GL_PREFIX(GetRenderbufferParameterivEXT), @function
+GL_PREFIX(GetRenderbufferParameterivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6456(%rax), %r11
@@ -30571,24 +30561,19 @@ GL_PREFIX(_dispatch_stub_807):
        movq    6456(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_807), .-GL_PREFIX(_dispatch_stub_807)
+       .size   GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_808)
-       .type   GL_PREFIX(_dispatch_stub_808), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_808))
-GL_PREFIX(_dispatch_stub_808):
+       .globl  GL_PREFIX(IsFramebufferEXT)
+       .type   GL_PREFIX(IsFramebufferEXT), @function
+GL_PREFIX(IsFramebufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6464(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6464(%rax), %r11
        jmp     *%r11
@@ -30600,32 +30585,24 @@ GL_PREFIX(_dispatch_stub_808):
        jmp     *%r11
 1:
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6464(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_808), .-GL_PREFIX(_dispatch_stub_808)
+       .size   GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(BindFragDataLocationEXT)
-       .type   GL_PREFIX(BindFragDataLocationEXT), @function
-GL_PREFIX(BindFragDataLocationEXT):
+       .globl  GL_PREFIX(IsRenderbufferEXT)
+       .type   GL_PREFIX(IsRenderbufferEXT), @function
+GL_PREFIX(IsRenderbufferEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6472(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6472(%rax), %r11
        jmp     *%r11
@@ -30637,21 +30614,17 @@ GL_PREFIX(BindFragDataLocationEXT):
        jmp     *%r11
 1:
        pushq   %rdi
-       pushq   %rsi
-       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rdx
-       popq    %rsi
        popq    %rdi
        movq    6472(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BindFragDataLocationEXT), .-GL_PREFIX(BindFragDataLocationEXT)
+       .size   GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetFragDataLocationEXT)
-       .type   GL_PREFIX(GetFragDataLocationEXT), @function
-GL_PREFIX(GetFragDataLocationEXT):
+       .globl  GL_PREFIX(RenderbufferStorageEXT)
+       .type   GL_PREFIX(RenderbufferStorageEXT), @function
+GL_PREFIX(RenderbufferStorageEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6480(%rax), %r11
@@ -30659,9 +30632,13 @@ GL_PREFIX(GetFragDataLocationEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6480(%rax), %r11
@@ -30675,20 +30652,25 @@ GL_PREFIX(GetFragDataLocationEXT):
 1:
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6480(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetFragDataLocationEXT), .-GL_PREFIX(GetFragDataLocationEXT)
+       .size   GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetUniformuivEXT)
-       .type   GL_PREFIX(GetUniformuivEXT), @function
-GL_PREFIX(GetUniformuivEXT):
+       .globl  GL_PREFIX(_dispatch_stub_811)
+       .type   GL_PREFIX(_dispatch_stub_811), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_811))
+GL_PREFIX(_dispatch_stub_811):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6488(%rax), %r11
@@ -30697,7 +30679,15 @@ GL_PREFIX(GetUniformuivEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
+       pushq   %r9
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %r9
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -30713,19 +30703,28 @@ GL_PREFIX(GetUniformuivEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
+       pushq   %r9
+       pushq   %rbp
        call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %r9
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6488(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetUniformuivEXT), .-GL_PREFIX(GetUniformuivEXT)
+       .size   GL_PREFIX(_dispatch_stub_811), .-GL_PREFIX(_dispatch_stub_811)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetVertexAttribIivEXT)
-       .type   GL_PREFIX(GetVertexAttribIivEXT), @function
-GL_PREFIX(GetVertexAttribIivEXT):
+       .globl  GL_PREFIX(_dispatch_stub_812)
+       .type   GL_PREFIX(_dispatch_stub_812), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_812))
+GL_PREFIX(_dispatch_stub_812):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6496(%rax), %r11
@@ -30757,12 +30756,13 @@ GL_PREFIX(GetVertexAttribIivEXT):
        movq    6496(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetVertexAttribIivEXT), .-GL_PREFIX(GetVertexAttribIivEXT)
+       .size   GL_PREFIX(_dispatch_stub_812), .-GL_PREFIX(_dispatch_stub_812)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetVertexAttribIuivEXT)
-       .type   GL_PREFIX(GetVertexAttribIuivEXT), @function
-GL_PREFIX(GetVertexAttribIuivEXT):
+       .globl  GL_PREFIX(_dispatch_stub_813)
+       .type   GL_PREFIX(_dispatch_stub_813), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_813))
+GL_PREFIX(_dispatch_stub_813):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6504(%rax), %r11
@@ -30794,12 +30794,12 @@ GL_PREFIX(GetVertexAttribIuivEXT):
        movq    6504(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetVertexAttribIuivEXT), .-GL_PREFIX(GetVertexAttribIuivEXT)
+       .size   GL_PREFIX(_dispatch_stub_813), .-GL_PREFIX(_dispatch_stub_813)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform1uiEXT)
-       .type   GL_PREFIX(Uniform1uiEXT), @function
-GL_PREFIX(Uniform1uiEXT):
+       .globl  GL_PREFIX(BindFragDataLocationEXT)
+       .type   GL_PREFIX(BindFragDataLocationEXT), @function
+GL_PREFIX(BindFragDataLocationEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6512(%rax), %r11
@@ -30807,9 +30807,9 @@ GL_PREFIX(Uniform1uiEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6512(%rax), %r11
@@ -30823,20 +30823,20 @@ GL_PREFIX(Uniform1uiEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6512(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform1uiEXT), .-GL_PREFIX(Uniform1uiEXT)
+       .size   GL_PREFIX(BindFragDataLocationEXT), .-GL_PREFIX(BindFragDataLocationEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform1uivEXT)
-       .type   GL_PREFIX(Uniform1uivEXT), @function
-GL_PREFIX(Uniform1uivEXT):
+       .globl  GL_PREFIX(GetFragDataLocationEXT)
+       .type   GL_PREFIX(GetFragDataLocationEXT), @function
+GL_PREFIX(GetFragDataLocationEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6520(%rax), %r11
@@ -30844,9 +30844,9 @@ GL_PREFIX(Uniform1uivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6520(%rax), %r11
@@ -30860,20 +30860,20 @@ GL_PREFIX(Uniform1uivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6520(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform1uivEXT), .-GL_PREFIX(Uniform1uivEXT)
+       .size   GL_PREFIX(GetFragDataLocationEXT), .-GL_PREFIX(GetFragDataLocationEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform2uiEXT)
-       .type   GL_PREFIX(Uniform2uiEXT), @function
-GL_PREFIX(Uniform2uiEXT):
+       .globl  GL_PREFIX(GetUniformuivEXT)
+       .type   GL_PREFIX(GetUniformuivEXT), @function
+GL_PREFIX(GetUniformuivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6528(%rax), %r11
@@ -30905,12 +30905,12 @@ GL_PREFIX(Uniform2uiEXT):
        movq    6528(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform2uiEXT), .-GL_PREFIX(Uniform2uiEXT)
+       .size   GL_PREFIX(GetUniformuivEXT), .-GL_PREFIX(GetUniformuivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform2uivEXT)
-       .type   GL_PREFIX(Uniform2uivEXT), @function
-GL_PREFIX(Uniform2uivEXT):
+       .globl  GL_PREFIX(GetVertexAttribIivEXT)
+       .type   GL_PREFIX(GetVertexAttribIivEXT), @function
+GL_PREFIX(GetVertexAttribIivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6536(%rax), %r11
@@ -30942,12 +30942,12 @@ GL_PREFIX(Uniform2uivEXT):
        movq    6536(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform2uivEXT), .-GL_PREFIX(Uniform2uivEXT)
+       .size   GL_PREFIX(GetVertexAttribIivEXT), .-GL_PREFIX(GetVertexAttribIivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform3uiEXT)
-       .type   GL_PREFIX(Uniform3uiEXT), @function
-GL_PREFIX(Uniform3uiEXT):
+       .globl  GL_PREFIX(GetVertexAttribIuivEXT)
+       .type   GL_PREFIX(GetVertexAttribIuivEXT), @function
+GL_PREFIX(GetVertexAttribIuivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6544(%rax), %r11
@@ -30956,11 +30956,7 @@ GL_PREFIX(Uniform3uiEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
-       pushq   %rcx
-       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -30976,23 +30972,19 @@ GL_PREFIX(Uniform3uiEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
-       pushq   %rcx
-       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6544(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform3uiEXT), .-GL_PREFIX(Uniform3uiEXT)
+       .size   GL_PREFIX(GetVertexAttribIuivEXT), .-GL_PREFIX(GetVertexAttribIuivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform3uivEXT)
-       .type   GL_PREFIX(Uniform3uivEXT), @function
-GL_PREFIX(Uniform3uivEXT):
+       .globl  GL_PREFIX(Uniform1uiEXT)
+       .type   GL_PREFIX(Uniform1uiEXT), @function
+GL_PREFIX(Uniform1uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6552(%rax), %r11
@@ -31000,9 +30992,9 @@ GL_PREFIX(Uniform3uivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6552(%rax), %r11
@@ -31016,20 +31008,20 @@ GL_PREFIX(Uniform3uivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6552(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform3uivEXT), .-GL_PREFIX(Uniform3uivEXT)
+       .size   GL_PREFIX(Uniform1uiEXT), .-GL_PREFIX(Uniform1uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform4uiEXT)
-       .type   GL_PREFIX(Uniform4uiEXT), @function
-GL_PREFIX(Uniform4uiEXT):
+       .globl  GL_PREFIX(Uniform1uivEXT)
+       .type   GL_PREFIX(Uniform1uivEXT), @function
+GL_PREFIX(Uniform1uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6560(%rax), %r11
@@ -31038,11 +31030,7 @@ GL_PREFIX(Uniform4uiEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
-       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -31058,23 +31046,19 @@ GL_PREFIX(Uniform4uiEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
        call    _glapi_get_dispatch
-       popq    %r8
-       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6560(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform4uiEXT), .-GL_PREFIX(Uniform4uiEXT)
+       .size   GL_PREFIX(Uniform1uivEXT), .-GL_PREFIX(Uniform1uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(Uniform4uivEXT)
-       .type   GL_PREFIX(Uniform4uivEXT), @function
-GL_PREFIX(Uniform4uivEXT):
+       .globl  GL_PREFIX(Uniform2uiEXT)
+       .type   GL_PREFIX(Uniform2uiEXT), @function
+GL_PREFIX(Uniform2uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6568(%rax), %r11
@@ -31106,12 +31090,12 @@ GL_PREFIX(Uniform4uivEXT):
        movq    6568(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(Uniform4uivEXT), .-GL_PREFIX(Uniform4uivEXT)
+       .size   GL_PREFIX(Uniform2uiEXT), .-GL_PREFIX(Uniform2uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI1iEXT)
-       .type   GL_PREFIX(VertexAttribI1iEXT), @function
-GL_PREFIX(VertexAttribI1iEXT):
+       .globl  GL_PREFIX(Uniform2uivEXT)
+       .type   GL_PREFIX(Uniform2uivEXT), @function
+GL_PREFIX(Uniform2uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6576(%rax), %r11
@@ -31119,9 +31103,9 @@ GL_PREFIX(VertexAttribI1iEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6576(%rax), %r11
@@ -31135,20 +31119,20 @@ GL_PREFIX(VertexAttribI1iEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6576(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI1iEXT), .-GL_PREFIX(VertexAttribI1iEXT)
+       .size   GL_PREFIX(Uniform2uivEXT), .-GL_PREFIX(Uniform2uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI1ivEXT)
-       .type   GL_PREFIX(VertexAttribI1ivEXT), @function
-GL_PREFIX(VertexAttribI1ivEXT):
+       .globl  GL_PREFIX(Uniform3uiEXT)
+       .type   GL_PREFIX(Uniform3uiEXT), @function
+GL_PREFIX(Uniform3uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6584(%rax), %r11
@@ -31156,9 +31140,13 @@ GL_PREFIX(VertexAttribI1ivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6584(%rax), %r11
@@ -31172,20 +31160,24 @@ GL_PREFIX(VertexAttribI1ivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6584(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI1ivEXT), .-GL_PREFIX(VertexAttribI1ivEXT)
+       .size   GL_PREFIX(Uniform3uiEXT), .-GL_PREFIX(Uniform3uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI1uiEXT)
-       .type   GL_PREFIX(VertexAttribI1uiEXT), @function
-GL_PREFIX(VertexAttribI1uiEXT):
+       .globl  GL_PREFIX(Uniform3uivEXT)
+       .type   GL_PREFIX(Uniform3uivEXT), @function
+GL_PREFIX(Uniform3uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6592(%rax), %r11
@@ -31193,9 +31185,9 @@ GL_PREFIX(VertexAttribI1uiEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6592(%rax), %r11
@@ -31209,20 +31201,20 @@ GL_PREFIX(VertexAttribI1uiEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6592(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI1uiEXT), .-GL_PREFIX(VertexAttribI1uiEXT)
+       .size   GL_PREFIX(Uniform3uivEXT), .-GL_PREFIX(Uniform3uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI1uivEXT)
-       .type   GL_PREFIX(VertexAttribI1uivEXT), @function
-GL_PREFIX(VertexAttribI1uivEXT):
+       .globl  GL_PREFIX(Uniform4uiEXT)
+       .type   GL_PREFIX(Uniform4uiEXT), @function
+GL_PREFIX(Uniform4uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6600(%rax), %r11
@@ -31230,9 +31222,13 @@ GL_PREFIX(VertexAttribI1uivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6600(%rax), %r11
@@ -31246,20 +31242,24 @@ GL_PREFIX(VertexAttribI1uivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6600(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI1uivEXT), .-GL_PREFIX(VertexAttribI1uivEXT)
+       .size   GL_PREFIX(Uniform4uiEXT), .-GL_PREFIX(Uniform4uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI2iEXT)
-       .type   GL_PREFIX(VertexAttribI2iEXT), @function
-GL_PREFIX(VertexAttribI2iEXT):
+       .globl  GL_PREFIX(Uniform4uivEXT)
+       .type   GL_PREFIX(Uniform4uivEXT), @function
+GL_PREFIX(Uniform4uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6608(%rax), %r11
@@ -31291,12 +31291,12 @@ GL_PREFIX(VertexAttribI2iEXT):
        movq    6608(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI2iEXT), .-GL_PREFIX(VertexAttribI2iEXT)
+       .size   GL_PREFIX(Uniform4uivEXT), .-GL_PREFIX(Uniform4uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI2ivEXT)
-       .type   GL_PREFIX(VertexAttribI2ivEXT), @function
-GL_PREFIX(VertexAttribI2ivEXT):
+       .globl  GL_PREFIX(VertexAttribI1iEXT)
+       .type   GL_PREFIX(VertexAttribI1iEXT), @function
+GL_PREFIX(VertexAttribI1iEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6616(%rax), %r11
@@ -31328,12 +31328,12 @@ GL_PREFIX(VertexAttribI2ivEXT):
        movq    6616(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI2ivEXT), .-GL_PREFIX(VertexAttribI2ivEXT)
+       .size   GL_PREFIX(VertexAttribI1iEXT), .-GL_PREFIX(VertexAttribI1iEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI2uiEXT)
-       .type   GL_PREFIX(VertexAttribI2uiEXT), @function
-GL_PREFIX(VertexAttribI2uiEXT):
+       .globl  GL_PREFIX(VertexAttribI1ivEXT)
+       .type   GL_PREFIX(VertexAttribI1ivEXT), @function
+GL_PREFIX(VertexAttribI1ivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6624(%rax), %r11
@@ -31341,9 +31341,9 @@ GL_PREFIX(VertexAttribI2uiEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6624(%rax), %r11
@@ -31357,20 +31357,20 @@ GL_PREFIX(VertexAttribI2uiEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6624(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI2uiEXT), .-GL_PREFIX(VertexAttribI2uiEXT)
+       .size   GL_PREFIX(VertexAttribI1ivEXT), .-GL_PREFIX(VertexAttribI1ivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI2uivEXT)
-       .type   GL_PREFIX(VertexAttribI2uivEXT), @function
-GL_PREFIX(VertexAttribI2uivEXT):
+       .globl  GL_PREFIX(VertexAttribI1uiEXT)
+       .type   GL_PREFIX(VertexAttribI1uiEXT), @function
+GL_PREFIX(VertexAttribI1uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6632(%rax), %r11
@@ -31402,12 +31402,12 @@ GL_PREFIX(VertexAttribI2uivEXT):
        movq    6632(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI2uivEXT), .-GL_PREFIX(VertexAttribI2uivEXT)
+       .size   GL_PREFIX(VertexAttribI1uiEXT), .-GL_PREFIX(VertexAttribI1uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI3iEXT)
-       .type   GL_PREFIX(VertexAttribI3iEXT), @function
-GL_PREFIX(VertexAttribI3iEXT):
+       .globl  GL_PREFIX(VertexAttribI1uivEXT)
+       .type   GL_PREFIX(VertexAttribI1uivEXT), @function
+GL_PREFIX(VertexAttribI1uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6640(%rax), %r11
@@ -31415,13 +31415,9 @@ GL_PREFIX(VertexAttribI3iEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6640(%rax), %r11
@@ -31435,24 +31431,20 @@ GL_PREFIX(VertexAttribI3iEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6640(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI3iEXT), .-GL_PREFIX(VertexAttribI3iEXT)
+       .size   GL_PREFIX(VertexAttribI1uivEXT), .-GL_PREFIX(VertexAttribI1uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI3ivEXT)
-       .type   GL_PREFIX(VertexAttribI3ivEXT), @function
-GL_PREFIX(VertexAttribI3ivEXT):
+       .globl  GL_PREFIX(VertexAttribI2iEXT)
+       .type   GL_PREFIX(VertexAttribI2iEXT), @function
+GL_PREFIX(VertexAttribI2iEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6648(%rax), %r11
@@ -31460,9 +31452,9 @@ GL_PREFIX(VertexAttribI3ivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6648(%rax), %r11
@@ -31476,20 +31468,20 @@ GL_PREFIX(VertexAttribI3ivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6648(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI3ivEXT), .-GL_PREFIX(VertexAttribI3ivEXT)
+       .size   GL_PREFIX(VertexAttribI2iEXT), .-GL_PREFIX(VertexAttribI2iEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI3uiEXT)
-       .type   GL_PREFIX(VertexAttribI3uiEXT), @function
-GL_PREFIX(VertexAttribI3uiEXT):
+       .globl  GL_PREFIX(VertexAttribI2ivEXT)
+       .type   GL_PREFIX(VertexAttribI2ivEXT), @function
+GL_PREFIX(VertexAttribI2ivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6656(%rax), %r11
@@ -31497,13 +31489,9 @@ GL_PREFIX(VertexAttribI3uiEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6656(%rax), %r11
@@ -31517,24 +31505,20 @@ GL_PREFIX(VertexAttribI3uiEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6656(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI3uiEXT), .-GL_PREFIX(VertexAttribI3uiEXT)
+       .size   GL_PREFIX(VertexAttribI2ivEXT), .-GL_PREFIX(VertexAttribI2ivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI3uivEXT)
-       .type   GL_PREFIX(VertexAttribI3uivEXT), @function
-GL_PREFIX(VertexAttribI3uivEXT):
+       .globl  GL_PREFIX(VertexAttribI2uiEXT)
+       .type   GL_PREFIX(VertexAttribI2uiEXT), @function
+GL_PREFIX(VertexAttribI2uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6664(%rax), %r11
@@ -31542,9 +31526,9 @@ GL_PREFIX(VertexAttribI3uivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6664(%rax), %r11
@@ -31558,20 +31542,20 @@ GL_PREFIX(VertexAttribI3uivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6664(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI3uivEXT), .-GL_PREFIX(VertexAttribI3uivEXT)
+       .size   GL_PREFIX(VertexAttribI2uiEXT), .-GL_PREFIX(VertexAttribI2uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4bvEXT)
-       .type   GL_PREFIX(VertexAttribI4bvEXT), @function
-GL_PREFIX(VertexAttribI4bvEXT):
+       .globl  GL_PREFIX(VertexAttribI2uivEXT)
+       .type   GL_PREFIX(VertexAttribI2uivEXT), @function
+GL_PREFIX(VertexAttribI2uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6672(%rax), %r11
@@ -31603,12 +31587,12 @@ GL_PREFIX(VertexAttribI4bvEXT):
        movq    6672(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4bvEXT), .-GL_PREFIX(VertexAttribI4bvEXT)
+       .size   GL_PREFIX(VertexAttribI2uivEXT), .-GL_PREFIX(VertexAttribI2uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4iEXT)
-       .type   GL_PREFIX(VertexAttribI4iEXT), @function
-GL_PREFIX(VertexAttribI4iEXT):
+       .globl  GL_PREFIX(VertexAttribI3iEXT)
+       .type   GL_PREFIX(VertexAttribI3iEXT), @function
+GL_PREFIX(VertexAttribI3iEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6680(%rax), %r11
@@ -31618,9 +31602,9 @@ GL_PREFIX(VertexAttribI4iEXT):
        pushq   %rsi
        pushq   %rdx
        pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
+       popq    %rbp
        popq    %rcx
        popq    %rdx
        popq    %rsi
@@ -31638,9 +31622,9 @@ GL_PREFIX(VertexAttribI4iEXT):
        pushq   %rsi
        pushq   %rdx
        pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %r8
+       popq    %rbp
        popq    %rcx
        popq    %rdx
        popq    %rsi
@@ -31648,12 +31632,12 @@ GL_PREFIX(VertexAttribI4iEXT):
        movq    6680(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4iEXT), .-GL_PREFIX(VertexAttribI4iEXT)
+       .size   GL_PREFIX(VertexAttribI3iEXT), .-GL_PREFIX(VertexAttribI3iEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4ivEXT)
-       .type   GL_PREFIX(VertexAttribI4ivEXT), @function
-GL_PREFIX(VertexAttribI4ivEXT):
+       .globl  GL_PREFIX(VertexAttribI3ivEXT)
+       .type   GL_PREFIX(VertexAttribI3ivEXT), @function
+GL_PREFIX(VertexAttribI3ivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6688(%rax), %r11
@@ -31685,12 +31669,12 @@ GL_PREFIX(VertexAttribI4ivEXT):
        movq    6688(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4ivEXT), .-GL_PREFIX(VertexAttribI4ivEXT)
+       .size   GL_PREFIX(VertexAttribI3ivEXT), .-GL_PREFIX(VertexAttribI3ivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4svEXT)
-       .type   GL_PREFIX(VertexAttribI4svEXT), @function
-GL_PREFIX(VertexAttribI4svEXT):
+       .globl  GL_PREFIX(VertexAttribI3uiEXT)
+       .type   GL_PREFIX(VertexAttribI3uiEXT), @function
+GL_PREFIX(VertexAttribI3uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6696(%rax), %r11
@@ -31698,9 +31682,13 @@ GL_PREFIX(VertexAttribI4svEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6696(%rax), %r11
@@ -31714,20 +31702,24 @@ GL_PREFIX(VertexAttribI4svEXT):
 1:
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6696(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4svEXT), .-GL_PREFIX(VertexAttribI4svEXT)
+       .size   GL_PREFIX(VertexAttribI3uiEXT), .-GL_PREFIX(VertexAttribI3uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4ubvEXT)
-       .type   GL_PREFIX(VertexAttribI4ubvEXT), @function
-GL_PREFIX(VertexAttribI4ubvEXT):
+       .globl  GL_PREFIX(VertexAttribI3uivEXT)
+       .type   GL_PREFIX(VertexAttribI3uivEXT), @function
+GL_PREFIX(VertexAttribI3uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6704(%rax), %r11
@@ -31759,12 +31751,12 @@ GL_PREFIX(VertexAttribI4ubvEXT):
        movq    6704(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4ubvEXT), .-GL_PREFIX(VertexAttribI4ubvEXT)
+       .size   GL_PREFIX(VertexAttribI3uivEXT), .-GL_PREFIX(VertexAttribI3uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4uiEXT)
-       .type   GL_PREFIX(VertexAttribI4uiEXT), @function
-GL_PREFIX(VertexAttribI4uiEXT):
+       .globl  GL_PREFIX(VertexAttribI4bvEXT)
+       .type   GL_PREFIX(VertexAttribI4bvEXT), @function
+GL_PREFIX(VertexAttribI4bvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6712(%rax), %r11
@@ -31772,13 +31764,9 @@ GL_PREFIX(VertexAttribI4uiEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6712(%rax), %r11
@@ -31792,24 +31780,20 @@ GL_PREFIX(VertexAttribI4uiEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6712(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4uiEXT), .-GL_PREFIX(VertexAttribI4uiEXT)
+       .size   GL_PREFIX(VertexAttribI4bvEXT), .-GL_PREFIX(VertexAttribI4bvEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4uivEXT)
-       .type   GL_PREFIX(VertexAttribI4uivEXT), @function
-GL_PREFIX(VertexAttribI4uivEXT):
+       .globl  GL_PREFIX(VertexAttribI4iEXT)
+       .type   GL_PREFIX(VertexAttribI4iEXT), @function
+GL_PREFIX(VertexAttribI4iEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6720(%rax), %r11
@@ -31817,9 +31801,13 @@ GL_PREFIX(VertexAttribI4uivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6720(%rax), %r11
@@ -31833,20 +31821,24 @@ GL_PREFIX(VertexAttribI4uivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6720(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4uivEXT), .-GL_PREFIX(VertexAttribI4uivEXT)
+       .size   GL_PREFIX(VertexAttribI4iEXT), .-GL_PREFIX(VertexAttribI4iEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribI4usvEXT)
-       .type   GL_PREFIX(VertexAttribI4usvEXT), @function
-GL_PREFIX(VertexAttribI4usvEXT):
+       .globl  GL_PREFIX(VertexAttribI4ivEXT)
+       .type   GL_PREFIX(VertexAttribI4ivEXT), @function
+GL_PREFIX(VertexAttribI4ivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6728(%rax), %r11
@@ -31878,12 +31870,12 @@ GL_PREFIX(VertexAttribI4usvEXT):
        movq    6728(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribI4usvEXT), .-GL_PREFIX(VertexAttribI4usvEXT)
+       .size   GL_PREFIX(VertexAttribI4ivEXT), .-GL_PREFIX(VertexAttribI4ivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(VertexAttribIPointerEXT)
-       .type   GL_PREFIX(VertexAttribIPointerEXT), @function
-GL_PREFIX(VertexAttribIPointerEXT):
+       .globl  GL_PREFIX(VertexAttribI4svEXT)
+       .type   GL_PREFIX(VertexAttribI4svEXT), @function
+GL_PREFIX(VertexAttribI4svEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6736(%rax), %r11
@@ -31891,13 +31883,9 @@ GL_PREFIX(VertexAttribIPointerEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6736(%rax), %r11
@@ -31911,24 +31899,20 @@ GL_PREFIX(VertexAttribIPointerEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6736(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(VertexAttribIPointerEXT), .-GL_PREFIX(VertexAttribIPointerEXT)
+       .size   GL_PREFIX(VertexAttribI4svEXT), .-GL_PREFIX(VertexAttribI4svEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(FramebufferTextureLayerEXT)
-       .type   GL_PREFIX(FramebufferTextureLayerEXT), @function
-GL_PREFIX(FramebufferTextureLayerEXT):
+       .globl  GL_PREFIX(VertexAttribI4ubvEXT)
+       .type   GL_PREFIX(VertexAttribI4ubvEXT), @function
+GL_PREFIX(VertexAttribI4ubvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6744(%rax), %r11
@@ -31936,13 +31920,9 @@ GL_PREFIX(FramebufferTextureLayerEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6744(%rax), %r11
@@ -31956,24 +31936,20 @@ GL_PREFIX(FramebufferTextureLayerEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6744(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT)
+       .size   GL_PREFIX(VertexAttribI4ubvEXT), .-GL_PREFIX(VertexAttribI4ubvEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(ColorMaskIndexedEXT)
-       .type   GL_PREFIX(ColorMaskIndexedEXT), @function
-GL_PREFIX(ColorMaskIndexedEXT):
+       .globl  GL_PREFIX(VertexAttribI4uiEXT)
+       .type   GL_PREFIX(VertexAttribI4uiEXT), @function
+GL_PREFIX(VertexAttribI4uiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6752(%rax), %r11
@@ -32013,12 +31989,12 @@ GL_PREFIX(ColorMaskIndexedEXT):
        movq    6752(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(ColorMaskIndexedEXT), .-GL_PREFIX(ColorMaskIndexedEXT)
+       .size   GL_PREFIX(VertexAttribI4uiEXT), .-GL_PREFIX(VertexAttribI4uiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(DisableIndexedEXT)
-       .type   GL_PREFIX(DisableIndexedEXT), @function
-GL_PREFIX(DisableIndexedEXT):
+       .globl  GL_PREFIX(VertexAttribI4uivEXT)
+       .type   GL_PREFIX(VertexAttribI4uivEXT), @function
+GL_PREFIX(VertexAttribI4uivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6760(%rax), %r11
@@ -32050,12 +32026,12 @@ GL_PREFIX(DisableIndexedEXT):
        movq    6760(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(DisableIndexedEXT), .-GL_PREFIX(DisableIndexedEXT)
+       .size   GL_PREFIX(VertexAttribI4uivEXT), .-GL_PREFIX(VertexAttribI4uivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(EnableIndexedEXT)
-       .type   GL_PREFIX(EnableIndexedEXT), @function
-GL_PREFIX(EnableIndexedEXT):
+       .globl  GL_PREFIX(VertexAttribI4usvEXT)
+       .type   GL_PREFIX(VertexAttribI4usvEXT), @function
+GL_PREFIX(VertexAttribI4usvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6768(%rax), %r11
@@ -32087,12 +32063,12 @@ GL_PREFIX(EnableIndexedEXT):
        movq    6768(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(EnableIndexedEXT), .-GL_PREFIX(EnableIndexedEXT)
+       .size   GL_PREFIX(VertexAttribI4usvEXT), .-GL_PREFIX(VertexAttribI4usvEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetBooleanIndexedvEXT)
-       .type   GL_PREFIX(GetBooleanIndexedvEXT), @function
-GL_PREFIX(GetBooleanIndexedvEXT):
+       .globl  GL_PREFIX(VertexAttribIPointerEXT)
+       .type   GL_PREFIX(VertexAttribIPointerEXT), @function
+GL_PREFIX(VertexAttribIPointerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6776(%rax), %r11
@@ -32101,7 +32077,11 @@ GL_PREFIX(GetBooleanIndexedvEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -32117,19 +32097,23 @@ GL_PREFIX(GetBooleanIndexedvEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _glapi_get_dispatch
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6776(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetBooleanIndexedvEXT), .-GL_PREFIX(GetBooleanIndexedvEXT)
+       .size   GL_PREFIX(VertexAttribIPointerEXT), .-GL_PREFIX(VertexAttribIPointerEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetIntegerIndexedvEXT)
-       .type   GL_PREFIX(GetIntegerIndexedvEXT), @function
-GL_PREFIX(GetIntegerIndexedvEXT):
+       .globl  GL_PREFIX(FramebufferTextureLayerEXT)
+       .type   GL_PREFIX(FramebufferTextureLayerEXT), @function
+GL_PREFIX(FramebufferTextureLayerEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6784(%rax), %r11
@@ -32138,7 +32122,11 @@ GL_PREFIX(GetIntegerIndexedvEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -32154,19 +32142,23 @@ GL_PREFIX(GetIntegerIndexedvEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _glapi_get_dispatch
+       popq    %r8
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6784(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetIntegerIndexedvEXT), .-GL_PREFIX(GetIntegerIndexedvEXT)
+       .size   GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(IsEnabledIndexedEXT)
-       .type   GL_PREFIX(IsEnabledIndexedEXT), @function
-GL_PREFIX(IsEnabledIndexedEXT):
+       .globl  GL_PREFIX(ColorMaskIndexedEXT)
+       .type   GL_PREFIX(ColorMaskIndexedEXT), @function
+GL_PREFIX(ColorMaskIndexedEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6792(%rax), %r11
@@ -32174,9 +32166,13 @@ GL_PREFIX(IsEnabledIndexedEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6792(%rax), %r11
@@ -32190,20 +32186,24 @@ GL_PREFIX(IsEnabledIndexedEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rbp
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6792(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(IsEnabledIndexedEXT), .-GL_PREFIX(IsEnabledIndexedEXT)
+       .size   GL_PREFIX(ColorMaskIndexedEXT), .-GL_PREFIX(ColorMaskIndexedEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(ClearColorIiEXT)
-       .type   GL_PREFIX(ClearColorIiEXT), @function
-GL_PREFIX(ClearColorIiEXT):
+       .globl  GL_PREFIX(DisableIndexedEXT)
+       .type   GL_PREFIX(DisableIndexedEXT), @function
+GL_PREFIX(DisableIndexedEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6800(%rax), %r11
@@ -32211,13 +32211,9 @@ GL_PREFIX(ClearColorIiEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6800(%rax), %r11
@@ -32231,24 +32227,20 @@ GL_PREFIX(ClearColorIiEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6800(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(ClearColorIiEXT), .-GL_PREFIX(ClearColorIiEXT)
+       .size   GL_PREFIX(DisableIndexedEXT), .-GL_PREFIX(DisableIndexedEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(ClearColorIuiEXT)
-       .type   GL_PREFIX(ClearColorIuiEXT), @function
-GL_PREFIX(ClearColorIuiEXT):
+       .globl  GL_PREFIX(EnableIndexedEXT)
+       .type   GL_PREFIX(EnableIndexedEXT), @function
+GL_PREFIX(EnableIndexedEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6808(%rax), %r11
@@ -32256,13 +32248,9 @@ GL_PREFIX(ClearColorIuiEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6808(%rax), %r11
@@ -32276,24 +32264,20 @@ GL_PREFIX(ClearColorIuiEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
-       popq    %rcx
-       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6808(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(ClearColorIuiEXT), .-GL_PREFIX(ClearColorIuiEXT)
+       .size   GL_PREFIX(EnableIndexedEXT), .-GL_PREFIX(EnableIndexedEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetTexParameterIivEXT)
-       .type   GL_PREFIX(GetTexParameterIivEXT), @function
-GL_PREFIX(GetTexParameterIivEXT):
+       .globl  GL_PREFIX(GetBooleanIndexedvEXT)
+       .type   GL_PREFIX(GetBooleanIndexedvEXT), @function
+GL_PREFIX(GetBooleanIndexedvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6816(%rax), %r11
@@ -32325,12 +32309,12 @@ GL_PREFIX(GetTexParameterIivEXT):
        movq    6816(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetTexParameterIivEXT), .-GL_PREFIX(GetTexParameterIivEXT)
+       .size   GL_PREFIX(GetBooleanIndexedvEXT), .-GL_PREFIX(GetBooleanIndexedvEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(GetTexParameterIuivEXT)
-       .type   GL_PREFIX(GetTexParameterIuivEXT), @function
-GL_PREFIX(GetTexParameterIuivEXT):
+       .globl  GL_PREFIX(GetIntegerIndexedvEXT)
+       .type   GL_PREFIX(GetIntegerIndexedvEXT), @function
+GL_PREFIX(GetIntegerIndexedvEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6824(%rax), %r11
@@ -32362,12 +32346,12 @@ GL_PREFIX(GetTexParameterIuivEXT):
        movq    6824(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(GetTexParameterIuivEXT), .-GL_PREFIX(GetTexParameterIuivEXT)
+       .size   GL_PREFIX(GetIntegerIndexedvEXT), .-GL_PREFIX(GetIntegerIndexedvEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(TexParameterIivEXT)
-       .type   GL_PREFIX(TexParameterIivEXT), @function
-GL_PREFIX(TexParameterIivEXT):
+       .globl  GL_PREFIX(IsEnabledIndexedEXT)
+       .type   GL_PREFIX(IsEnabledIndexedEXT), @function
+GL_PREFIX(IsEnabledIndexedEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6832(%rax), %r11
@@ -32375,9 +32359,9 @@ GL_PREFIX(TexParameterIivEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6832(%rax), %r11
@@ -32391,20 +32375,20 @@ GL_PREFIX(TexParameterIivEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6832(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(TexParameterIivEXT), .-GL_PREFIX(TexParameterIivEXT)
+       .size   GL_PREFIX(IsEnabledIndexedEXT), .-GL_PREFIX(IsEnabledIndexedEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(TexParameterIuivEXT)
-       .type   GL_PREFIX(TexParameterIuivEXT), @function
-GL_PREFIX(TexParameterIuivEXT):
+       .globl  GL_PREFIX(ClearColorIiEXT)
+       .type   GL_PREFIX(ClearColorIiEXT), @function
+GL_PREFIX(ClearColorIiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6840(%rax), %r11
@@ -32413,7 +32397,11 @@ GL_PREFIX(TexParameterIuivEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -32429,19 +32417,23 @@ GL_PREFIX(TexParameterIuivEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
+       pushq   %rcx
+       pushq   %rbp
        call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6840(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(TexParameterIuivEXT), .-GL_PREFIX(TexParameterIuivEXT)
+       .size   GL_PREFIX(ClearColorIiEXT), .-GL_PREFIX(ClearColorIiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(BeginConditionalRenderNV)
-       .type   GL_PREFIX(BeginConditionalRenderNV), @function
-GL_PREFIX(BeginConditionalRenderNV):
+       .globl  GL_PREFIX(ClearColorIuiEXT)
+       .type   GL_PREFIX(ClearColorIuiEXT), @function
+GL_PREFIX(ClearColorIuiEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6848(%rax), %r11
@@ -32449,9 +32441,13 @@ GL_PREFIX(BeginConditionalRenderNV):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _x86_64_get_dispatch@PLT
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6848(%rax), %r11
@@ -32465,28 +32461,36 @@ GL_PREFIX(BeginConditionalRenderNV):
 1:
        pushq   %rdi
        pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
        pushq   %rbp
        call    _glapi_get_dispatch
        popq    %rbp
+       popq    %rcx
+       popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6848(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BeginConditionalRenderNV), .-GL_PREFIX(BeginConditionalRenderNV)
+       .size   GL_PREFIX(ClearColorIuiEXT), .-GL_PREFIX(ClearColorIuiEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(EndConditionalRenderNV)
-       .type   GL_PREFIX(EndConditionalRenderNV), @function
-GL_PREFIX(EndConditionalRenderNV):
+       .globl  GL_PREFIX(GetTexParameterIivEXT)
+       .type   GL_PREFIX(GetTexParameterIivEXT), @function
+GL_PREFIX(GetTexParameterIivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6856(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
-       pushq   %rbp
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
        movq    6856(%rax), %r11
        jmp     *%r11
 #else
@@ -32496,25 +32500,33 @@ GL_PREFIX(EndConditionalRenderNV):
        movq    6856(%rax), %r11
        jmp     *%r11
 1:
-       pushq   %rbp
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
        call    _glapi_get_dispatch
-       popq    %rbp
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
        movq    6856(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(EndConditionalRenderNV), .-GL_PREFIX(EndConditionalRenderNV)
+       .size   GL_PREFIX(GetTexParameterIivEXT), .-GL_PREFIX(GetTexParameterIivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(BeginTransformFeedbackEXT)
-       .type   GL_PREFIX(BeginTransformFeedbackEXT), @function
-GL_PREFIX(BeginTransformFeedbackEXT):
+       .globl  GL_PREFIX(GetTexParameterIuivEXT)
+       .type   GL_PREFIX(GetTexParameterIuivEXT), @function
+GL_PREFIX(GetTexParameterIuivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6864(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
        call    _x86_64_get_dispatch@PLT
+       popq    %rdx
+       popq    %rsi
        popq    %rdi
        movq    6864(%rax), %r11
        jmp     *%r11
@@ -32526,17 +32538,21 @@ GL_PREFIX(BeginTransformFeedbackEXT):
        jmp     *%r11
 1:
        pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
        call    _glapi_get_dispatch
+       popq    %rdx
+       popq    %rsi
        popq    %rdi
        movq    6864(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BeginTransformFeedbackEXT), .-GL_PREFIX(BeginTransformFeedbackEXT)
+       .size   GL_PREFIX(GetTexParameterIuivEXT), .-GL_PREFIX(GetTexParameterIuivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(BindBufferBaseEXT)
-       .type   GL_PREFIX(BindBufferBaseEXT), @function
-GL_PREFIX(BindBufferBaseEXT):
+       .globl  GL_PREFIX(TexParameterIivEXT)
+       .type   GL_PREFIX(TexParameterIivEXT), @function
+GL_PREFIX(TexParameterIivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6872(%rax), %r11
@@ -32568,12 +32584,12 @@ GL_PREFIX(BindBufferBaseEXT):
        movq    6872(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BindBufferBaseEXT), .-GL_PREFIX(BindBufferBaseEXT)
+       .size   GL_PREFIX(TexParameterIivEXT), .-GL_PREFIX(TexParameterIivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(BindBufferOffsetEXT)
-       .type   GL_PREFIX(BindBufferOffsetEXT), @function
-GL_PREFIX(BindBufferOffsetEXT):
+       .globl  GL_PREFIX(TexParameterIuivEXT)
+       .type   GL_PREFIX(TexParameterIuivEXT), @function
+GL_PREFIX(TexParameterIuivEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6880(%rax), %r11
@@ -32582,11 +32598,7 @@ GL_PREFIX(BindBufferOffsetEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
-       pushq   %rcx
-       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %rbp
-       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
@@ -32602,23 +32614,19 @@ GL_PREFIX(BindBufferOffsetEXT):
        pushq   %rdi
        pushq   %rsi
        pushq   %rdx
-       pushq   %rcx
-       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %rbp
-       popq    %rcx
        popq    %rdx
        popq    %rsi
        popq    %rdi
        movq    6880(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BindBufferOffsetEXT), .-GL_PREFIX(BindBufferOffsetEXT)
+       .size   GL_PREFIX(TexParameterIuivEXT), .-GL_PREFIX(TexParameterIuivEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(BindBufferRangeEXT)
-       .type   GL_PREFIX(BindBufferRangeEXT), @function
-GL_PREFIX(BindBufferRangeEXT):
+       .globl  GL_PREFIX(BeginConditionalRenderNV)
+       .type   GL_PREFIX(BeginConditionalRenderNV), @function
+GL_PREFIX(BeginConditionalRenderNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6888(%rax), %r11
@@ -32626,13 +32634,9 @@ GL_PREFIX(BindBufferRangeEXT):
 #elif defined(PTHREADS)
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _x86_64_get_dispatch@PLT
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6888(%rax), %r11
@@ -32646,24 +32650,20 @@ GL_PREFIX(BindBufferRangeEXT):
 1:
        pushq   %rdi
        pushq   %rsi
-       pushq   %rdx
-       pushq   %rcx
-       pushq   %r8
+       pushq   %rbp
        call    _glapi_get_dispatch
-       popq    %r8
-       popq    %rcx
-       popq    %rdx
+       popq    %rbp
        popq    %rsi
        popq    %rdi
        movq    6888(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(BindBufferRangeEXT), .-GL_PREFIX(BindBufferRangeEXT)
+       .size   GL_PREFIX(BeginConditionalRenderNV), .-GL_PREFIX(BeginConditionalRenderNV)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(EndTransformFeedbackEXT)
-       .type   GL_PREFIX(EndTransformFeedbackEXT), @function
-GL_PREFIX(EndTransformFeedbackEXT):
+       .globl  GL_PREFIX(EndConditionalRenderNV)
+       .type   GL_PREFIX(EndConditionalRenderNV), @function
+GL_PREFIX(EndConditionalRenderNV):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
        movq    6896(%rax), %r11
@@ -32686,6 +32686,191 @@ GL_PREFIX(EndTransformFeedbackEXT):
        popq    %rbp
        movq    6896(%rax), %r11
        jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(EndConditionalRenderNV), .-GL_PREFIX(EndConditionalRenderNV)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(BeginTransformFeedbackEXT)
+       .type   GL_PREFIX(BeginTransformFeedbackEXT), @function
+GL_PREFIX(BeginTransformFeedbackEXT):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    6904(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       call    _x86_64_get_dispatch@PLT
+       popq    %rdi
+       movq    6904(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    6904(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       call    _glapi_get_dispatch
+       popq    %rdi
+       movq    6904(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(BeginTransformFeedbackEXT), .-GL_PREFIX(BeginTransformFeedbackEXT)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(BindBufferBaseEXT)
+       .type   GL_PREFIX(BindBufferBaseEXT), @function
+GL_PREFIX(BindBufferBaseEXT):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    6912(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       call    _x86_64_get_dispatch@PLT
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
+       movq    6912(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    6912(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       call    _glapi_get_dispatch
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
+       movq    6912(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(BindBufferBaseEXT), .-GL_PREFIX(BindBufferBaseEXT)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(BindBufferOffsetEXT)
+       .type   GL_PREFIX(BindBufferOffsetEXT), @function
+GL_PREFIX(BindBufferOffsetEXT):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    6920(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       popq    %rcx
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
+       movq    6920(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    6920(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       popq    %rcx
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
+       movq    6920(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(BindBufferOffsetEXT), .-GL_PREFIX(BindBufferOffsetEXT)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(BindBufferRangeEXT)
+       .type   GL_PREFIX(BindBufferRangeEXT), @function
+GL_PREFIX(BindBufferRangeEXT):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    6928(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
+       call    _x86_64_get_dispatch@PLT
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
+       movq    6928(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    6928(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rdi
+       pushq   %rsi
+       pushq   %rdx
+       pushq   %rcx
+       pushq   %r8
+       call    _glapi_get_dispatch
+       popq    %r8
+       popq    %rcx
+       popq    %rdx
+       popq    %rsi
+       popq    %rdi
+       movq    6928(%rax), %r11
+       jmp     *%r11
+#endif /* defined(GLX_USE_TLS) */
+       .size   GL_PREFIX(BindBufferRangeEXT), .-GL_PREFIX(BindBufferRangeEXT)
+
+       .p2align        4,,15
+       .globl  GL_PREFIX(EndTransformFeedbackEXT)
+       .type   GL_PREFIX(EndTransformFeedbackEXT), @function
+GL_PREFIX(EndTransformFeedbackEXT):
+#if defined(GLX_USE_TLS)
+       call    _x86_64_get_dispatch@PLT
+       movq    6936(%rax), %r11
+       jmp     *%r11
+#elif defined(PTHREADS)
+       pushq   %rbp
+       call    _x86_64_get_dispatch@PLT
+       popq    %rbp
+       movq    6936(%rax), %r11
+       jmp     *%r11
+#else
+       movq    _glapi_Dispatch(%rip), %rax
+       testq   %rax, %rax
+       je      1f
+       movq    6936(%rax), %r11
+       jmp     *%r11
+1:
+       pushq   %rbp
+       call    _glapi_get_dispatch
+       popq    %rbp
+       movq    6936(%rax), %r11
+       jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(EndTransformFeedbackEXT), .-GL_PREFIX(EndTransformFeedbackEXT)
 
@@ -32695,7 +32880,7 @@ GL_PREFIX(EndTransformFeedbackEXT):
 GL_PREFIX(GetTransformFeedbackVaryingEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6904(%rax), %r11
+       movq    6944(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -32713,13 +32898,13 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6904(%rax), %r11
+       movq    6944(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6904(%rax), %r11
+       movq    6944(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -32737,7 +32922,7 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6904(%rax), %r11
+       movq    6944(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetTransformFeedbackVaryingEXT), .-GL_PREFIX(GetTransformFeedbackVaryingEXT)
@@ -32748,7 +32933,7 @@ GL_PREFIX(GetTransformFeedbackVaryingEXT):
 GL_PREFIX(TransformFeedbackVaryingsEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6912(%rax), %r11
+       movq    6952(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -32762,13 +32947,13 @@ GL_PREFIX(TransformFeedbackVaryingsEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6912(%rax), %r11
+       movq    6952(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6912(%rax), %r11
+       movq    6952(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -32782,7 +32967,7 @@ GL_PREFIX(TransformFeedbackVaryingsEXT):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6912(%rax), %r11
+       movq    6952(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(TransformFeedbackVaryingsEXT), .-GL_PREFIX(TransformFeedbackVaryingsEXT)
@@ -32793,37 +32978,37 @@ GL_PREFIX(TransformFeedbackVaryingsEXT):
 GL_PREFIX(ProvokingVertexEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6920(%rax), %r11
+       movq    6960(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6920(%rax), %r11
+       movq    6960(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6920(%rax), %r11
+       movq    6960(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6920(%rax), %r11
+       movq    6960(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ProvokingVertexEXT), .-GL_PREFIX(ProvokingVertexEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_866)
-       .type   GL_PREFIX(_dispatch_stub_866), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_866))
-GL_PREFIX(_dispatch_stub_866):
+       .globl  GL_PREFIX(_dispatch_stub_871)
+       .type   GL_PREFIX(_dispatch_stub_871), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_871))
+GL_PREFIX(_dispatch_stub_871):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6928(%rax), %r11
+       movq    6968(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -32833,13 +33018,13 @@ GL_PREFIX(_dispatch_stub_866):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6928(%rax), %r11
+       movq    6968(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6928(%rax), %r11
+       movq    6968(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -32849,19 +33034,19 @@ GL_PREFIX(_dispatch_stub_866):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6928(%rax), %r11
+       movq    6968(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_866), .-GL_PREFIX(_dispatch_stub_866)
+       .size   GL_PREFIX(_dispatch_stub_871), .-GL_PREFIX(_dispatch_stub_871)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_867)
-       .type   GL_PREFIX(_dispatch_stub_867), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_867))
-GL_PREFIX(_dispatch_stub_867):
+       .globl  GL_PREFIX(_dispatch_stub_872)
+       .type   GL_PREFIX(_dispatch_stub_872), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_872))
+GL_PREFIX(_dispatch_stub_872):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6936(%rax), %r11
+       movq    6976(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -32871,13 +33056,13 @@ GL_PREFIX(_dispatch_stub_867):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6936(%rax), %r11
+       movq    6976(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6936(%rax), %r11
+       movq    6976(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -32887,10 +33072,10 @@ GL_PREFIX(_dispatch_stub_867):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6936(%rax), %r11
+       movq    6976(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_867), .-GL_PREFIX(_dispatch_stub_867)
+       .size   GL_PREFIX(_dispatch_stub_872), .-GL_PREFIX(_dispatch_stub_872)
 
        .p2align        4,,15
        .globl  GL_PREFIX(GetObjectParameterivAPPLE)
@@ -32898,7 +33083,7 @@ GL_PREFIX(_dispatch_stub_867):
 GL_PREFIX(GetObjectParameterivAPPLE):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6944(%rax), %r11
+       movq    6984(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -32912,13 +33097,13 @@ GL_PREFIX(GetObjectParameterivAPPLE):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6944(%rax), %r11
+       movq    6984(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6944(%rax), %r11
+       movq    6984(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -32932,7 +33117,7 @@ GL_PREFIX(GetObjectParameterivAPPLE):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6944(%rax), %r11
+       movq    6984(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(GetObjectParameterivAPPLE), .-GL_PREFIX(GetObjectParameterivAPPLE)
@@ -32943,7 +33128,7 @@ GL_PREFIX(GetObjectParameterivAPPLE):
 GL_PREFIX(ObjectPurgeableAPPLE):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6952(%rax), %r11
+       movq    6992(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -32953,13 +33138,13 @@ GL_PREFIX(ObjectPurgeableAPPLE):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6952(%rax), %r11
+       movq    6992(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6952(%rax), %r11
+       movq    6992(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -32969,7 +33154,7 @@ GL_PREFIX(ObjectPurgeableAPPLE):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6952(%rax), %r11
+       movq    6992(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ObjectPurgeableAPPLE), .-GL_PREFIX(ObjectPurgeableAPPLE)
@@ -32980,7 +33165,7 @@ GL_PREFIX(ObjectPurgeableAPPLE):
 GL_PREFIX(ObjectUnpurgeableAPPLE):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6960(%rax), %r11
+       movq    7000(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -32990,13 +33175,13 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6960(%rax), %r11
+       movq    7000(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6960(%rax), %r11
+       movq    7000(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33006,7 +33191,7 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6960(%rax), %r11
+       movq    7000(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ObjectUnpurgeableAPPLE), .-GL_PREFIX(ObjectUnpurgeableAPPLE)
@@ -33017,25 +33202,25 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
 GL_PREFIX(ActiveProgramEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6968(%rax), %r11
+       movq    7008(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
        call    _x86_64_get_dispatch@PLT
        popq    %rdi
-       movq    6968(%rax), %r11
+       movq    7008(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6968(%rax), %r11
+       movq    7008(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
        call    _glapi_get_dispatch
        popq    %rdi
-       movq    6968(%rax), %r11
+       movq    7008(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(ActiveProgramEXT), .-GL_PREFIX(ActiveProgramEXT)
@@ -33046,7 +33231,7 @@ GL_PREFIX(ActiveProgramEXT):
 GL_PREFIX(CreateShaderProgramEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6976(%rax), %r11
+       movq    7016(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33056,13 +33241,13 @@ GL_PREFIX(CreateShaderProgramEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6976(%rax), %r11
+       movq    7016(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6976(%rax), %r11
+       movq    7016(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33072,7 +33257,7 @@ GL_PREFIX(CreateShaderProgramEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6976(%rax), %r11
+       movq    7016(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(CreateShaderProgramEXT), .-GL_PREFIX(CreateShaderProgramEXT)
@@ -33083,7 +33268,7 @@ GL_PREFIX(CreateShaderProgramEXT):
 GL_PREFIX(UseShaderProgramEXT):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6984(%rax), %r11
+       movq    7024(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33093,13 +33278,13 @@ GL_PREFIX(UseShaderProgramEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6984(%rax), %r11
+       movq    7024(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6984(%rax), %r11
+       movq    7024(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33109,19 +33294,19 @@ GL_PREFIX(UseShaderProgramEXT):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    6984(%rax), %r11
+       movq    7024(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(UseShaderProgramEXT), .-GL_PREFIX(UseShaderProgramEXT)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_874)
-       .type   GL_PREFIX(_dispatch_stub_874), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_874))
-GL_PREFIX(_dispatch_stub_874):
+       .globl  GL_PREFIX(_dispatch_stub_879)
+       .type   GL_PREFIX(_dispatch_stub_879), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_879))
+GL_PREFIX(_dispatch_stub_879):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    6992(%rax), %r11
+       movq    7032(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33135,13 +33320,13 @@ GL_PREFIX(_dispatch_stub_874):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6992(%rax), %r11
+       movq    7032(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    6992(%rax), %r11
+       movq    7032(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33155,19 +33340,19 @@ GL_PREFIX(_dispatch_stub_874):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    6992(%rax), %r11
+       movq    7032(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_874), .-GL_PREFIX(_dispatch_stub_874)
+       .size   GL_PREFIX(_dispatch_stub_879), .-GL_PREFIX(_dispatch_stub_879)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_875)
-       .type   GL_PREFIX(_dispatch_stub_875), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_875))
-GL_PREFIX(_dispatch_stub_875):
+       .globl  GL_PREFIX(_dispatch_stub_880)
+       .type   GL_PREFIX(_dispatch_stub_880), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_880))
+GL_PREFIX(_dispatch_stub_880):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    7000(%rax), %r11
+       movq    7040(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33181,13 +33366,13 @@ GL_PREFIX(_dispatch_stub_875):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7000(%rax), %r11
+       movq    7040(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    7000(%rax), %r11
+       movq    7040(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33201,19 +33386,19 @@ GL_PREFIX(_dispatch_stub_875):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7000(%rax), %r11
+       movq    7040(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_875), .-GL_PREFIX(_dispatch_stub_875)
+       .size   GL_PREFIX(_dispatch_stub_880), .-GL_PREFIX(_dispatch_stub_880)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_876)
-       .type   GL_PREFIX(_dispatch_stub_876), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_876))
-GL_PREFIX(_dispatch_stub_876):
+       .globl  GL_PREFIX(_dispatch_stub_881)
+       .type   GL_PREFIX(_dispatch_stub_881), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_881))
+GL_PREFIX(_dispatch_stub_881):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    7008(%rax), %r11
+       movq    7048(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33227,13 +33412,13 @@ GL_PREFIX(_dispatch_stub_876):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7008(%rax), %r11
+       movq    7048(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    7008(%rax), %r11
+       movq    7048(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33247,19 +33432,19 @@ GL_PREFIX(_dispatch_stub_876):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7008(%rax), %r11
+       movq    7048(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_876), .-GL_PREFIX(_dispatch_stub_876)
+       .size   GL_PREFIX(_dispatch_stub_881), .-GL_PREFIX(_dispatch_stub_881)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_877)
-       .type   GL_PREFIX(_dispatch_stub_877), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_877))
-GL_PREFIX(_dispatch_stub_877):
+       .globl  GL_PREFIX(_dispatch_stub_882)
+       .type   GL_PREFIX(_dispatch_stub_882), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_882))
+GL_PREFIX(_dispatch_stub_882):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    7016(%rax), %r11
+       movq    7056(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33269,13 +33454,13 @@ GL_PREFIX(_dispatch_stub_877):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7016(%rax), %r11
+       movq    7056(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    7016(%rax), %r11
+       movq    7056(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33285,19 +33470,19 @@ GL_PREFIX(_dispatch_stub_877):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7016(%rax), %r11
+       movq    7056(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_877), .-GL_PREFIX(_dispatch_stub_877)
+       .size   GL_PREFIX(_dispatch_stub_882), .-GL_PREFIX(_dispatch_stub_882)
 
        .p2align        4,,15
-       .globl  GL_PREFIX(_dispatch_stub_878)
-       .type   GL_PREFIX(_dispatch_stub_878), @function
-       HIDDEN(GL_PREFIX(_dispatch_stub_878))
-GL_PREFIX(_dispatch_stub_878):
+       .globl  GL_PREFIX(_dispatch_stub_883)
+       .type   GL_PREFIX(_dispatch_stub_883), @function
+       HIDDEN(GL_PREFIX(_dispatch_stub_883))
+GL_PREFIX(_dispatch_stub_883):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    7024(%rax), %r11
+       movq    7064(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33307,13 +33492,13 @@ GL_PREFIX(_dispatch_stub_878):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7024(%rax), %r11
+       movq    7064(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    7024(%rax), %r11
+       movq    7064(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33323,10 +33508,10 @@ GL_PREFIX(_dispatch_stub_878):
        popq    %rdx
        popq    %rsi
        popq    %rdi
-       movq    7024(%rax), %r11
+       movq    7064(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
-       .size   GL_PREFIX(_dispatch_stub_878), .-GL_PREFIX(_dispatch_stub_878)
+       .size   GL_PREFIX(_dispatch_stub_883), .-GL_PREFIX(_dispatch_stub_883)
 
        .p2align        4,,15
        .globl  GL_PREFIX(EGLImageTargetRenderbufferStorageOES)
@@ -33334,7 +33519,7 @@ GL_PREFIX(_dispatch_stub_878):
 GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    7032(%rax), %r11
+       movq    7072(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33344,13 +33529,13 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    7032(%rax), %r11
+       movq    7072(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    7032(%rax), %r11
+       movq    7072(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33360,7 +33545,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    7032(%rax), %r11
+       movq    7072(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(EGLImageTargetRenderbufferStorageOES), .-GL_PREFIX(EGLImageTargetRenderbufferStorageOES)
@@ -33371,7 +33556,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
 GL_PREFIX(EGLImageTargetTexture2DOES):
 #if defined(GLX_USE_TLS)
        call    _x86_64_get_dispatch@PLT
-       movq    7040(%rax), %r11
+       movq    7080(%rax), %r11
        jmp     *%r11
 #elif defined(PTHREADS)
        pushq   %rdi
@@ -33381,13 +33566,13 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    7040(%rax), %r11
+       movq    7080(%rax), %r11
        jmp     *%r11
 #else
        movq    _glapi_Dispatch(%rip), %rax
        testq   %rax, %rax
        je      1f
-       movq    7040(%rax), %r11
+       movq    7080(%rax), %r11
        jmp     *%r11
 1:
        pushq   %rdi
@@ -33397,7 +33582,7 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
        popq    %rbp
        popq    %rsi
        popq    %rdi
-       movq    7040(%rax), %r11
+       movq    7080(%rax), %r11
        jmp     *%r11
 #endif /* defined(GLX_USE_TLS) */
        .size   GL_PREFIX(EGLImageTargetTexture2DOES), .-GL_PREFIX(EGLImageTargetTexture2DOES)
@@ -33660,10 +33845,10 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
        .globl GL_PREFIX(IsProgramARB) ; .set GL_PREFIX(IsProgramARB), GL_PREFIX(IsProgramNV)
        .globl GL_PREFIX(PointParameteri) ; .set GL_PREFIX(PointParameteri), GL_PREFIX(PointParameteriNV)
        .globl GL_PREFIX(PointParameteriv) ; .set GL_PREFIX(PointParameteriv), GL_PREFIX(PointParameterivNV)
-       .globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_776)
-       .globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_778)
+       .globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_781)
+       .globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_783)
        .globl GL_PREFIX(PrimitiveRestartIndex) ; .set GL_PREFIX(PrimitiveRestartIndex), GL_PREFIX(PrimitiveRestartIndexNV)
-       .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_788)
+       .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_793)
        .globl GL_PREFIX(BindFramebuffer) ; .set GL_PREFIX(BindFramebuffer), GL_PREFIX(BindFramebufferEXT)
        .globl GL_PREFIX(BindRenderbuffer) ; .set GL_PREFIX(BindRenderbuffer), GL_PREFIX(BindRenderbufferEXT)
        .globl GL_PREFIX(CheckFramebufferStatus) ; .set GL_PREFIX(CheckFramebufferStatus), GL_PREFIX(CheckFramebufferStatusEXT)
@@ -33681,7 +33866,7 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
        .globl GL_PREFIX(IsFramebuffer) ; .set GL_PREFIX(IsFramebuffer), GL_PREFIX(IsFramebufferEXT)
        .globl GL_PREFIX(IsRenderbuffer) ; .set GL_PREFIX(IsRenderbuffer), GL_PREFIX(IsRenderbufferEXT)
        .globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT)
-       .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_806)
+       .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_811)
        .globl GL_PREFIX(BindFragDataLocation) ; .set GL_PREFIX(BindFragDataLocation), GL_PREFIX(BindFragDataLocationEXT)
        .globl GL_PREFIX(GetFragDataLocation) ; .set GL_PREFIX(GetFragDataLocation), GL_PREFIX(GetFragDataLocationEXT)
        .globl GL_PREFIX(GetUniformuiv) ; .set GL_PREFIX(GetUniformuiv), GL_PREFIX(GetUniformuivEXT)
index 72729f2f091c9a1eb7a6944d49061dc75f240968..e087b3339bb1330b510737ef30567d14ea6dec26 100644 (file)
@@ -51,7 +51,7 @@
 #define GLOBL_FN(x) GLOBL x
 #endif
 
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)
 #  define THREADS
 #endif
 
@@ -750,322 +750,327 @@ GLNAME(gl_dispatch_functions_start):
        GL_STUB(IsTransformFeedback, 597, IsTransformFeedback@4)
        GL_STUB(PauseTransformFeedback, 598, PauseTransformFeedback@0)
        GL_STUB(ResumeTransformFeedback, 599, ResumeTransformFeedback@0)
-       GL_STUB(PolygonOffsetEXT, 600, PolygonOffsetEXT@8)
-       GL_STUB(_dispatch_stub_601, 601, _dispatch_stub_601@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_601, _dispatch_stub_601@8))
-       GL_STUB(_dispatch_stub_602, 602, _dispatch_stub_602@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_602, _dispatch_stub_602@8))
-       GL_STUB(_dispatch_stub_603, 603, _dispatch_stub_603@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_603, _dispatch_stub_603@8))
-       GL_STUB(_dispatch_stub_604, 604, _dispatch_stub_604@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_604, _dispatch_stub_604@8))
-       GL_STUB(_dispatch_stub_605, 605, _dispatch_stub_605@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_605, _dispatch_stub_605@8))
+       GL_STUB(ClearDepthf, 600, ClearDepthf@4)
+       GL_STUB(DepthRangef, 601, DepthRangef@8)
+       GL_STUB(GetShaderPrecisionFormat, 602, GetShaderPrecisionFormat@16)
+       GL_STUB(ReleaseShaderCompiler, 603, ReleaseShaderCompiler@0)
+       GL_STUB(ShaderBinary, 604, ShaderBinary@20)
+       GL_STUB(PolygonOffsetEXT, 605, PolygonOffsetEXT@8)
        GL_STUB(_dispatch_stub_606, 606, _dispatch_stub_606@8)
        HIDDEN(GL_PREFIX(_dispatch_stub_606, _dispatch_stub_606@8))
        GL_STUB(_dispatch_stub_607, 607, _dispatch_stub_607@8)
        HIDDEN(GL_PREFIX(_dispatch_stub_607, _dispatch_stub_607@8))
-       GL_STUB(_dispatch_stub_608, 608, _dispatch_stub_608@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_608, _dispatch_stub_608@4))
-       GL_STUB(ColorPointerEXT, 609, ColorPointerEXT@20)
-       GL_STUB(EdgeFlagPointerEXT, 610, EdgeFlagPointerEXT@12)
-       GL_STUB(IndexPointerEXT, 611, IndexPointerEXT@16)
-       GL_STUB(NormalPointerEXT, 612, NormalPointerEXT@16)
-       GL_STUB(TexCoordPointerEXT, 613, TexCoordPointerEXT@20)
-       GL_STUB(VertexPointerEXT, 614, VertexPointerEXT@20)
-       GL_STUB(PointParameterfEXT, 615, PointParameterfEXT@8)
-       GL_STUB(PointParameterfvEXT, 616, PointParameterfvEXT@8)
-       GL_STUB(LockArraysEXT, 617, LockArraysEXT@8)
-       GL_STUB(UnlockArraysEXT, 618, UnlockArraysEXT@0)
-       GL_STUB(SecondaryColor3bEXT, 619, SecondaryColor3bEXT@12)
-       GL_STUB(SecondaryColor3bvEXT, 620, SecondaryColor3bvEXT@4)
-       GL_STUB(SecondaryColor3dEXT, 621, SecondaryColor3dEXT@24)
-       GL_STUB(SecondaryColor3dvEXT, 622, SecondaryColor3dvEXT@4)
-       GL_STUB(SecondaryColor3fEXT, 623, SecondaryColor3fEXT@12)
-       GL_STUB(SecondaryColor3fvEXT, 624, SecondaryColor3fvEXT@4)
-       GL_STUB(SecondaryColor3iEXT, 625, SecondaryColor3iEXT@12)
-       GL_STUB(SecondaryColor3ivEXT, 626, SecondaryColor3ivEXT@4)
-       GL_STUB(SecondaryColor3sEXT, 627, SecondaryColor3sEXT@12)
-       GL_STUB(SecondaryColor3svEXT, 628, SecondaryColor3svEXT@4)
-       GL_STUB(SecondaryColor3ubEXT, 629, SecondaryColor3ubEXT@12)
-       GL_STUB(SecondaryColor3ubvEXT, 630, SecondaryColor3ubvEXT@4)
-       GL_STUB(SecondaryColor3uiEXT, 631, SecondaryColor3uiEXT@12)
-       GL_STUB(SecondaryColor3uivEXT, 632, SecondaryColor3uivEXT@4)
-       GL_STUB(SecondaryColor3usEXT, 633, SecondaryColor3usEXT@12)
-       GL_STUB(SecondaryColor3usvEXT, 634, SecondaryColor3usvEXT@4)
-       GL_STUB(SecondaryColorPointerEXT, 635, SecondaryColorPointerEXT@16)
-       GL_STUB(MultiDrawArraysEXT, 636, MultiDrawArraysEXT@16)
-       GL_STUB(MultiDrawElementsEXT, 637, MultiDrawElementsEXT@20)
-       GL_STUB(FogCoordPointerEXT, 638, FogCoordPointerEXT@12)
-       GL_STUB(FogCoorddEXT, 639, FogCoorddEXT@8)
-       GL_STUB(FogCoorddvEXT, 640, FogCoorddvEXT@4)
-       GL_STUB(FogCoordfEXT, 641, FogCoordfEXT@4)
-       GL_STUB(FogCoordfvEXT, 642, FogCoordfvEXT@4)
-       GL_STUB(_dispatch_stub_643, 643, _dispatch_stub_643@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_643, _dispatch_stub_643@4))
-       GL_STUB(BlendFuncSeparateEXT, 644, BlendFuncSeparateEXT@16)
-       GL_STUB(FlushVertexArrayRangeNV, 645, FlushVertexArrayRangeNV@0)
-       GL_STUB(VertexArrayRangeNV, 646, VertexArrayRangeNV@8)
-       GL_STUB(CombinerInputNV, 647, CombinerInputNV@24)
-       GL_STUB(CombinerOutputNV, 648, CombinerOutputNV@40)
-       GL_STUB(CombinerParameterfNV, 649, CombinerParameterfNV@8)
-       GL_STUB(CombinerParameterfvNV, 650, CombinerParameterfvNV@8)
-       GL_STUB(CombinerParameteriNV, 651, CombinerParameteriNV@8)
-       GL_STUB(CombinerParameterivNV, 652, CombinerParameterivNV@8)
-       GL_STUB(FinalCombinerInputNV, 653, FinalCombinerInputNV@16)
-       GL_STUB(GetCombinerInputParameterfvNV, 654, GetCombinerInputParameterfvNV@20)
-       GL_STUB(GetCombinerInputParameterivNV, 655, GetCombinerInputParameterivNV@20)
-       GL_STUB(GetCombinerOutputParameterfvNV, 656, GetCombinerOutputParameterfvNV@16)
-       GL_STUB(GetCombinerOutputParameterivNV, 657, GetCombinerOutputParameterivNV@16)
-       GL_STUB(GetFinalCombinerInputParameterfvNV, 658, GetFinalCombinerInputParameterfvNV@12)
-       GL_STUB(GetFinalCombinerInputParameterivNV, 659, GetFinalCombinerInputParameterivNV@12)
-       GL_STUB(ResizeBuffersMESA, 660, ResizeBuffersMESA@0)
-       GL_STUB(WindowPos2dMESA, 661, WindowPos2dMESA@16)
-       GL_STUB(WindowPos2dvMESA, 662, WindowPos2dvMESA@4)
-       GL_STUB(WindowPos2fMESA, 663, WindowPos2fMESA@8)
-       GL_STUB(WindowPos2fvMESA, 664, WindowPos2fvMESA@4)
-       GL_STUB(WindowPos2iMESA, 665, WindowPos2iMESA@8)
-       GL_STUB(WindowPos2ivMESA, 666, WindowPos2ivMESA@4)
-       GL_STUB(WindowPos2sMESA, 667, WindowPos2sMESA@8)
-       GL_STUB(WindowPos2svMESA, 668, WindowPos2svMESA@4)
-       GL_STUB(WindowPos3dMESA, 669, WindowPos3dMESA@24)
-       GL_STUB(WindowPos3dvMESA, 670, WindowPos3dvMESA@4)
-       GL_STUB(WindowPos3fMESA, 671, WindowPos3fMESA@12)
-       GL_STUB(WindowPos3fvMESA, 672, WindowPos3fvMESA@4)
-       GL_STUB(WindowPos3iMESA, 673, WindowPos3iMESA@12)
-       GL_STUB(WindowPos3ivMESA, 674, WindowPos3ivMESA@4)
-       GL_STUB(WindowPos3sMESA, 675, WindowPos3sMESA@12)
-       GL_STUB(WindowPos3svMESA, 676, WindowPos3svMESA@4)
-       GL_STUB(WindowPos4dMESA, 677, WindowPos4dMESA@32)
-       GL_STUB(WindowPos4dvMESA, 678, WindowPos4dvMESA@4)
-       GL_STUB(WindowPos4fMESA, 679, WindowPos4fMESA@16)
-       GL_STUB(WindowPos4fvMESA, 680, WindowPos4fvMESA@4)
-       GL_STUB(WindowPos4iMESA, 681, WindowPos4iMESA@16)
-       GL_STUB(WindowPos4ivMESA, 682, WindowPos4ivMESA@4)
-       GL_STUB(WindowPos4sMESA, 683, WindowPos4sMESA@16)
-       GL_STUB(WindowPos4svMESA, 684, WindowPos4svMESA@4)
-       GL_STUB(_dispatch_stub_685, 685, _dispatch_stub_685@20)
-       HIDDEN(GL_PREFIX(_dispatch_stub_685, _dispatch_stub_685@20))
-       GL_STUB(_dispatch_stub_686, 686, _dispatch_stub_686@24)
-       HIDDEN(GL_PREFIX(_dispatch_stub_686, _dispatch_stub_686@24))
-       GL_STUB(_dispatch_stub_687, 687, _dispatch_stub_687@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_687, _dispatch_stub_687@8))
-       GL_STUB(_dispatch_stub_688, 688, _dispatch_stub_688@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_688, _dispatch_stub_688@4))
-       GL_STUB(_dispatch_stub_689, 689, _dispatch_stub_689@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_689, _dispatch_stub_689@8))
-       GL_STUB(_dispatch_stub_690, 690, _dispatch_stub_690@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_690, _dispatch_stub_690@12))
-       GL_STUB(_dispatch_stub_691, 691, _dispatch_stub_691@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_691, _dispatch_stub_691@4))
+       GL_STUB(_dispatch_stub_608, 608, _dispatch_stub_608@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_608, _dispatch_stub_608@8))
+       GL_STUB(_dispatch_stub_609, 609, _dispatch_stub_609@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_609, _dispatch_stub_609@8))
+       GL_STUB(_dispatch_stub_610, 610, _dispatch_stub_610@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_610, _dispatch_stub_610@8))
+       GL_STUB(_dispatch_stub_611, 611, _dispatch_stub_611@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_611, _dispatch_stub_611@8))
+       GL_STUB(_dispatch_stub_612, 612, _dispatch_stub_612@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_612, _dispatch_stub_612@8))
+       GL_STUB(_dispatch_stub_613, 613, _dispatch_stub_613@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_613, _dispatch_stub_613@4))
+       GL_STUB(ColorPointerEXT, 614, ColorPointerEXT@20)
+       GL_STUB(EdgeFlagPointerEXT, 615, EdgeFlagPointerEXT@12)
+       GL_STUB(IndexPointerEXT, 616, IndexPointerEXT@16)
+       GL_STUB(NormalPointerEXT, 617, NormalPointerEXT@16)
+       GL_STUB(TexCoordPointerEXT, 618, TexCoordPointerEXT@20)
+       GL_STUB(VertexPointerEXT, 619, VertexPointerEXT@20)
+       GL_STUB(PointParameterfEXT, 620, PointParameterfEXT@8)
+       GL_STUB(PointParameterfvEXT, 621, PointParameterfvEXT@8)
+       GL_STUB(LockArraysEXT, 622, LockArraysEXT@8)
+       GL_STUB(UnlockArraysEXT, 623, UnlockArraysEXT@0)
+       GL_STUB(SecondaryColor3bEXT, 624, SecondaryColor3bEXT@12)
+       GL_STUB(SecondaryColor3bvEXT, 625, SecondaryColor3bvEXT@4)
+       GL_STUB(SecondaryColor3dEXT, 626, SecondaryColor3dEXT@24)
+       GL_STUB(SecondaryColor3dvEXT, 627, SecondaryColor3dvEXT@4)
+       GL_STUB(SecondaryColor3fEXT, 628, SecondaryColor3fEXT@12)
+       GL_STUB(SecondaryColor3fvEXT, 629, SecondaryColor3fvEXT@4)
+       GL_STUB(SecondaryColor3iEXT, 630, SecondaryColor3iEXT@12)
+       GL_STUB(SecondaryColor3ivEXT, 631, SecondaryColor3ivEXT@4)
+       GL_STUB(SecondaryColor3sEXT, 632, SecondaryColor3sEXT@12)
+       GL_STUB(SecondaryColor3svEXT, 633, SecondaryColor3svEXT@4)
+       GL_STUB(SecondaryColor3ubEXT, 634, SecondaryColor3ubEXT@12)
+       GL_STUB(SecondaryColor3ubvEXT, 635, SecondaryColor3ubvEXT@4)
+       GL_STUB(SecondaryColor3uiEXT, 636, SecondaryColor3uiEXT@12)
+       GL_STUB(SecondaryColor3uivEXT, 637, SecondaryColor3uivEXT@4)
+       GL_STUB(SecondaryColor3usEXT, 638, SecondaryColor3usEXT@12)
+       GL_STUB(SecondaryColor3usvEXT, 639, SecondaryColor3usvEXT@4)
+       GL_STUB(SecondaryColorPointerEXT, 640, SecondaryColorPointerEXT@16)
+       GL_STUB(MultiDrawArraysEXT, 641, MultiDrawArraysEXT@16)
+       GL_STUB(MultiDrawElementsEXT, 642, MultiDrawElementsEXT@20)
+       GL_STUB(FogCoordPointerEXT, 643, FogCoordPointerEXT@12)
+       GL_STUB(FogCoorddEXT, 644, FogCoorddEXT@8)
+       GL_STUB(FogCoorddvEXT, 645, FogCoorddvEXT@4)
+       GL_STUB(FogCoordfEXT, 646, FogCoordfEXT@4)
+       GL_STUB(FogCoordfvEXT, 647, FogCoordfvEXT@4)
+       GL_STUB(_dispatch_stub_648, 648, _dispatch_stub_648@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_648, _dispatch_stub_648@4))
+       GL_STUB(BlendFuncSeparateEXT, 649, BlendFuncSeparateEXT@16)
+       GL_STUB(FlushVertexArrayRangeNV, 650, FlushVertexArrayRangeNV@0)
+       GL_STUB(VertexArrayRangeNV, 651, VertexArrayRangeNV@8)
+       GL_STUB(CombinerInputNV, 652, CombinerInputNV@24)
+       GL_STUB(CombinerOutputNV, 653, CombinerOutputNV@40)
+       GL_STUB(CombinerParameterfNV, 654, CombinerParameterfNV@8)
+       GL_STUB(CombinerParameterfvNV, 655, CombinerParameterfvNV@8)
+       GL_STUB(CombinerParameteriNV, 656, CombinerParameteriNV@8)
+       GL_STUB(CombinerParameterivNV, 657, CombinerParameterivNV@8)
+       GL_STUB(FinalCombinerInputNV, 658, FinalCombinerInputNV@16)
+       GL_STUB(GetCombinerInputParameterfvNV, 659, GetCombinerInputParameterfvNV@20)
+       GL_STUB(GetCombinerInputParameterivNV, 660, GetCombinerInputParameterivNV@20)
+       GL_STUB(GetCombinerOutputParameterfvNV, 661, GetCombinerOutputParameterfvNV@16)
+       GL_STUB(GetCombinerOutputParameterivNV, 662, GetCombinerOutputParameterivNV@16)
+       GL_STUB(GetFinalCombinerInputParameterfvNV, 663, GetFinalCombinerInputParameterfvNV@12)
+       GL_STUB(GetFinalCombinerInputParameterivNV, 664, GetFinalCombinerInputParameterivNV@12)
+       GL_STUB(ResizeBuffersMESA, 665, ResizeBuffersMESA@0)
+       GL_STUB(WindowPos2dMESA, 666, WindowPos2dMESA@16)
+       GL_STUB(WindowPos2dvMESA, 667, WindowPos2dvMESA@4)
+       GL_STUB(WindowPos2fMESA, 668, WindowPos2fMESA@8)
+       GL_STUB(WindowPos2fvMESA, 669, WindowPos2fvMESA@4)
+       GL_STUB(WindowPos2iMESA, 670, WindowPos2iMESA@8)
+       GL_STUB(WindowPos2ivMESA, 671, WindowPos2ivMESA@4)
+       GL_STUB(WindowPos2sMESA, 672, WindowPos2sMESA@8)
+       GL_STUB(WindowPos2svMESA, 673, WindowPos2svMESA@4)
+       GL_STUB(WindowPos3dMESA, 674, WindowPos3dMESA@24)
+       GL_STUB(WindowPos3dvMESA, 675, WindowPos3dvMESA@4)
+       GL_STUB(WindowPos3fMESA, 676, WindowPos3fMESA@12)
+       GL_STUB(WindowPos3fvMESA, 677, WindowPos3fvMESA@4)
+       GL_STUB(WindowPos3iMESA, 678, WindowPos3iMESA@12)
+       GL_STUB(WindowPos3ivMESA, 679, WindowPos3ivMESA@4)
+       GL_STUB(WindowPos3sMESA, 680, WindowPos3sMESA@12)
+       GL_STUB(WindowPos3svMESA, 681, WindowPos3svMESA@4)
+       GL_STUB(WindowPos4dMESA, 682, WindowPos4dMESA@32)
+       GL_STUB(WindowPos4dvMESA, 683, WindowPos4dvMESA@4)
+       GL_STUB(WindowPos4fMESA, 684, WindowPos4fMESA@16)
+       GL_STUB(WindowPos4fvMESA, 685, WindowPos4fvMESA@4)
+       GL_STUB(WindowPos4iMESA, 686, WindowPos4iMESA@16)
+       GL_STUB(WindowPos4ivMESA, 687, WindowPos4ivMESA@4)
+       GL_STUB(WindowPos4sMESA, 688, WindowPos4sMESA@16)
+       GL_STUB(WindowPos4svMESA, 689, WindowPos4svMESA@4)
+       GL_STUB(_dispatch_stub_690, 690, _dispatch_stub_690@20)
+       HIDDEN(GL_PREFIX(_dispatch_stub_690, _dispatch_stub_690@20))
+       GL_STUB(_dispatch_stub_691, 691, _dispatch_stub_691@24)
+       HIDDEN(GL_PREFIX(_dispatch_stub_691, _dispatch_stub_691@24))
        GL_STUB(_dispatch_stub_692, 692, _dispatch_stub_692@8)
        HIDDEN(GL_PREFIX(_dispatch_stub_692, _dispatch_stub_692@8))
        GL_STUB(_dispatch_stub_693, 693, _dispatch_stub_693@4)
        HIDDEN(GL_PREFIX(_dispatch_stub_693, _dispatch_stub_693@4))
-       GL_STUB(AreProgramsResidentNV, 694, AreProgramsResidentNV@12)
-       GL_STUB(BindProgramNV, 695, BindProgramNV@8)
-       GL_STUB(DeleteProgramsNV, 696, DeleteProgramsNV@8)
-       GL_STUB(ExecuteProgramNV, 697, ExecuteProgramNV@12)
-       GL_STUB(GenProgramsNV, 698, GenProgramsNV@8)
-       GL_STUB(GetProgramParameterdvNV, 699, GetProgramParameterdvNV@16)
-       GL_STUB(GetProgramParameterfvNV, 700, GetProgramParameterfvNV@16)
-       GL_STUB(GetProgramStringNV, 701, GetProgramStringNV@12)
-       GL_STUB(GetProgramivNV, 702, GetProgramivNV@12)
-       GL_STUB(GetTrackMatrixivNV, 703, GetTrackMatrixivNV@16)
-       GL_STUB(GetVertexAttribPointervNV, 704, GetVertexAttribPointervNV@12)
-       GL_STUB(GetVertexAttribdvNV, 705, GetVertexAttribdvNV@12)
-       GL_STUB(GetVertexAttribfvNV, 706, GetVertexAttribfvNV@12)
-       GL_STUB(GetVertexAttribivNV, 707, GetVertexAttribivNV@12)
-       GL_STUB(IsProgramNV, 708, IsProgramNV@4)
-       GL_STUB(LoadProgramNV, 709, LoadProgramNV@16)
-       GL_STUB(ProgramParameters4dvNV, 710, ProgramParameters4dvNV@16)
-       GL_STUB(ProgramParameters4fvNV, 711, ProgramParameters4fvNV@16)
-       GL_STUB(RequestResidentProgramsNV, 712, RequestResidentProgramsNV@8)
-       GL_STUB(TrackMatrixNV, 713, TrackMatrixNV@16)
-       GL_STUB(VertexAttrib1dNV, 714, VertexAttrib1dNV@12)
-       GL_STUB(VertexAttrib1dvNV, 715, VertexAttrib1dvNV@8)
-       GL_STUB(VertexAttrib1fNV, 716, VertexAttrib1fNV@8)
-       GL_STUB(VertexAttrib1fvNV, 717, VertexAttrib1fvNV@8)
-       GL_STUB(VertexAttrib1sNV, 718, VertexAttrib1sNV@8)
-       GL_STUB(VertexAttrib1svNV, 719, VertexAttrib1svNV@8)
-       GL_STUB(VertexAttrib2dNV, 720, VertexAttrib2dNV@20)
-       GL_STUB(VertexAttrib2dvNV, 721, VertexAttrib2dvNV@8)
-       GL_STUB(VertexAttrib2fNV, 722, VertexAttrib2fNV@12)
-       GL_STUB(VertexAttrib2fvNV, 723, VertexAttrib2fvNV@8)
-       GL_STUB(VertexAttrib2sNV, 724, VertexAttrib2sNV@12)
-       GL_STUB(VertexAttrib2svNV, 725, VertexAttrib2svNV@8)
-       GL_STUB(VertexAttrib3dNV, 726, VertexAttrib3dNV@28)
-       GL_STUB(VertexAttrib3dvNV, 727, VertexAttrib3dvNV@8)
-       GL_STUB(VertexAttrib3fNV, 728, VertexAttrib3fNV@16)
-       GL_STUB(VertexAttrib3fvNV, 729, VertexAttrib3fvNV@8)
-       GL_STUB(VertexAttrib3sNV, 730, VertexAttrib3sNV@16)
-       GL_STUB(VertexAttrib3svNV, 731, VertexAttrib3svNV@8)
-       GL_STUB(VertexAttrib4dNV, 732, VertexAttrib4dNV@36)
-       GL_STUB(VertexAttrib4dvNV, 733, VertexAttrib4dvNV@8)
-       GL_STUB(VertexAttrib4fNV, 734, VertexAttrib4fNV@20)
-       GL_STUB(VertexAttrib4fvNV, 735, VertexAttrib4fvNV@8)
-       GL_STUB(VertexAttrib4sNV, 736, VertexAttrib4sNV@20)
-       GL_STUB(VertexAttrib4svNV, 737, VertexAttrib4svNV@8)
-       GL_STUB(VertexAttrib4ubNV, 738, VertexAttrib4ubNV@20)
-       GL_STUB(VertexAttrib4ubvNV, 739, VertexAttrib4ubvNV@8)
-       GL_STUB(VertexAttribPointerNV, 740, VertexAttribPointerNV@20)
-       GL_STUB(VertexAttribs1dvNV, 741, VertexAttribs1dvNV@12)
-       GL_STUB(VertexAttribs1fvNV, 742, VertexAttribs1fvNV@12)
-       GL_STUB(VertexAttribs1svNV, 743, VertexAttribs1svNV@12)
-       GL_STUB(VertexAttribs2dvNV, 744, VertexAttribs2dvNV@12)
-       GL_STUB(VertexAttribs2fvNV, 745, VertexAttribs2fvNV@12)
-       GL_STUB(VertexAttribs2svNV, 746, VertexAttribs2svNV@12)
-       GL_STUB(VertexAttribs3dvNV, 747, VertexAttribs3dvNV@12)
-       GL_STUB(VertexAttribs3fvNV, 748, VertexAttribs3fvNV@12)
-       GL_STUB(VertexAttribs3svNV, 749, VertexAttribs3svNV@12)
-       GL_STUB(VertexAttribs4dvNV, 750, VertexAttribs4dvNV@12)
-       GL_STUB(VertexAttribs4fvNV, 751, VertexAttribs4fvNV@12)
-       GL_STUB(VertexAttribs4svNV, 752, VertexAttribs4svNV@12)
-       GL_STUB(VertexAttribs4ubvNV, 753, VertexAttribs4ubvNV@12)
-       GL_STUB(GetTexBumpParameterfvATI, 754, GetTexBumpParameterfvATI@8)
-       GL_STUB(GetTexBumpParameterivATI, 755, GetTexBumpParameterivATI@8)
-       GL_STUB(TexBumpParameterfvATI, 756, TexBumpParameterfvATI@8)
-       GL_STUB(TexBumpParameterivATI, 757, TexBumpParameterivATI@8)
-       GL_STUB(AlphaFragmentOp1ATI, 758, AlphaFragmentOp1ATI@24)
-       GL_STUB(AlphaFragmentOp2ATI, 759, AlphaFragmentOp2ATI@36)
-       GL_STUB(AlphaFragmentOp3ATI, 760, AlphaFragmentOp3ATI@48)
-       GL_STUB(BeginFragmentShaderATI, 761, BeginFragmentShaderATI@0)
-       GL_STUB(BindFragmentShaderATI, 762, BindFragmentShaderATI@4)
-       GL_STUB(ColorFragmentOp1ATI, 763, ColorFragmentOp1ATI@28)
-       GL_STUB(ColorFragmentOp2ATI, 764, ColorFragmentOp2ATI@40)
-       GL_STUB(ColorFragmentOp3ATI, 765, ColorFragmentOp3ATI@52)
-       GL_STUB(DeleteFragmentShaderATI, 766, DeleteFragmentShaderATI@4)
-       GL_STUB(EndFragmentShaderATI, 767, EndFragmentShaderATI@0)
-       GL_STUB(GenFragmentShadersATI, 768, GenFragmentShadersATI@4)
-       GL_STUB(PassTexCoordATI, 769, PassTexCoordATI@12)
-       GL_STUB(SampleMapATI, 770, SampleMapATI@12)
-       GL_STUB(SetFragmentShaderConstantATI, 771, SetFragmentShaderConstantATI@8)
-       GL_STUB(PointParameteriNV, 772, PointParameteriNV@8)
-       GL_STUB(PointParameterivNV, 773, PointParameterivNV@8)
-       GL_STUB(_dispatch_stub_774, 774, _dispatch_stub_774@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@4))
-       GL_STUB(_dispatch_stub_775, 775, _dispatch_stub_775@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_775, _dispatch_stub_775@4))
-       GL_STUB(_dispatch_stub_776, 776, _dispatch_stub_776@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_776, _dispatch_stub_776@8))
-       GL_STUB(_dispatch_stub_777, 777, _dispatch_stub_777@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_777, _dispatch_stub_777@8))
-       GL_STUB(_dispatch_stub_778, 778, _dispatch_stub_778@4)
-       HIDDEN(GL_PREFIX(_dispatch_stub_778, _dispatch_stub_778@4))
-       GL_STUB(GetProgramNamedParameterdvNV, 779, GetProgramNamedParameterdvNV@16)
-       GL_STUB(GetProgramNamedParameterfvNV, 780, GetProgramNamedParameterfvNV@16)
-       GL_STUB(ProgramNamedParameter4dNV, 781, ProgramNamedParameter4dNV@44)
-       GL_STUB(ProgramNamedParameter4dvNV, 782, ProgramNamedParameter4dvNV@16)
-       GL_STUB(ProgramNamedParameter4fNV, 783, ProgramNamedParameter4fNV@28)
-       GL_STUB(ProgramNamedParameter4fvNV, 784, ProgramNamedParameter4fvNV@16)
-       GL_STUB(PrimitiveRestartIndexNV, 785, PrimitiveRestartIndexNV@4)
-       GL_STUB(PrimitiveRestartNV, 786, PrimitiveRestartNV@0)
-       GL_STUB(_dispatch_stub_787, 787, _dispatch_stub_787@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_787, _dispatch_stub_787@16))
-       GL_STUB(_dispatch_stub_788, 788, _dispatch_stub_788@8)
-       HIDDEN(GL_PREFIX(_dispatch_stub_788, _dispatch_stub_788@8))
-       GL_STUB(BindFramebufferEXT, 789, BindFramebufferEXT@8)
-       GL_STUB(BindRenderbufferEXT, 790, BindRenderbufferEXT@8)
-       GL_STUB(CheckFramebufferStatusEXT, 791, CheckFramebufferStatusEXT@4)
-       GL_STUB(DeleteFramebuffersEXT, 792, DeleteFramebuffersEXT@8)
-       GL_STUB(DeleteRenderbuffersEXT, 793, DeleteRenderbuffersEXT@8)
-       GL_STUB(FramebufferRenderbufferEXT, 794, FramebufferRenderbufferEXT@16)
-       GL_STUB(FramebufferTexture1DEXT, 795, FramebufferTexture1DEXT@20)
-       GL_STUB(FramebufferTexture2DEXT, 796, FramebufferTexture2DEXT@20)
-       GL_STUB(FramebufferTexture3DEXT, 797, FramebufferTexture3DEXT@24)
-       GL_STUB(GenFramebuffersEXT, 798, GenFramebuffersEXT@8)
-       GL_STUB(GenRenderbuffersEXT, 799, GenRenderbuffersEXT@8)
-       GL_STUB(GenerateMipmapEXT, 800, GenerateMipmapEXT@4)
-       GL_STUB(GetFramebufferAttachmentParameterivEXT, 801, GetFramebufferAttachmentParameterivEXT@16)
-       GL_STUB(GetRenderbufferParameterivEXT, 802, GetRenderbufferParameterivEXT@12)
-       GL_STUB(IsFramebufferEXT, 803, IsFramebufferEXT@4)
-       GL_STUB(IsRenderbufferEXT, 804, IsRenderbufferEXT@4)
-       GL_STUB(RenderbufferStorageEXT, 805, RenderbufferStorageEXT@16)
-       GL_STUB(_dispatch_stub_806, 806, _dispatch_stub_806@40)
-       HIDDEN(GL_PREFIX(_dispatch_stub_806, _dispatch_stub_806@40))
-       GL_STUB(_dispatch_stub_807, 807, _dispatch_stub_807@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_807, _dispatch_stub_807@12))
-       GL_STUB(_dispatch_stub_808, 808, _dispatch_stub_808@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_808, _dispatch_stub_808@12))
-       GL_STUB(BindFragDataLocationEXT, 809, BindFragDataLocationEXT@12)
-       GL_STUB(GetFragDataLocationEXT, 810, GetFragDataLocationEXT@8)
-       GL_STUB(GetUniformuivEXT, 811, GetUniformuivEXT@12)
-       GL_STUB(GetVertexAttribIivEXT, 812, GetVertexAttribIivEXT@12)
-       GL_STUB(GetVertexAttribIuivEXT, 813, GetVertexAttribIuivEXT@12)
-       GL_STUB(Uniform1uiEXT, 814, Uniform1uiEXT@8)
-       GL_STUB(Uniform1uivEXT, 815, Uniform1uivEXT@12)
-       GL_STUB(Uniform2uiEXT, 816, Uniform2uiEXT@12)
-       GL_STUB(Uniform2uivEXT, 817, Uniform2uivEXT@12)
-       GL_STUB(Uniform3uiEXT, 818, Uniform3uiEXT@16)
-       GL_STUB(Uniform3uivEXT, 819, Uniform3uivEXT@12)
-       GL_STUB(Uniform4uiEXT, 820, Uniform4uiEXT@20)
-       GL_STUB(Uniform4uivEXT, 821, Uniform4uivEXT@12)
-       GL_STUB(VertexAttribI1iEXT, 822, VertexAttribI1iEXT@8)
-       GL_STUB(VertexAttribI1ivEXT, 823, VertexAttribI1ivEXT@8)
-       GL_STUB(VertexAttribI1uiEXT, 824, VertexAttribI1uiEXT@8)
-       GL_STUB(VertexAttribI1uivEXT, 825, VertexAttribI1uivEXT@8)
-       GL_STUB(VertexAttribI2iEXT, 826, VertexAttribI2iEXT@12)
-       GL_STUB(VertexAttribI2ivEXT, 827, VertexAttribI2ivEXT@8)
-       GL_STUB(VertexAttribI2uiEXT, 828, VertexAttribI2uiEXT@12)
-       GL_STUB(VertexAttribI2uivEXT, 829, VertexAttribI2uivEXT@8)
-       GL_STUB(VertexAttribI3iEXT, 830, VertexAttribI3iEXT@16)
-       GL_STUB(VertexAttribI3ivEXT, 831, VertexAttribI3ivEXT@8)
-       GL_STUB(VertexAttribI3uiEXT, 832, VertexAttribI3uiEXT@16)
-       GL_STUB(VertexAttribI3uivEXT, 833, VertexAttribI3uivEXT@8)
-       GL_STUB(VertexAttribI4bvEXT, 834, VertexAttribI4bvEXT@8)
-       GL_STUB(VertexAttribI4iEXT, 835, VertexAttribI4iEXT@20)
-       GL_STUB(VertexAttribI4ivEXT, 836, VertexAttribI4ivEXT@8)
-       GL_STUB(VertexAttribI4svEXT, 837, VertexAttribI4svEXT@8)
-       GL_STUB(VertexAttribI4ubvEXT, 838, VertexAttribI4ubvEXT@8)
-       GL_STUB(VertexAttribI4uiEXT, 839, VertexAttribI4uiEXT@20)
-       GL_STUB(VertexAttribI4uivEXT, 840, VertexAttribI4uivEXT@8)
-       GL_STUB(VertexAttribI4usvEXT, 841, VertexAttribI4usvEXT@8)
-       GL_STUB(VertexAttribIPointerEXT, 842, VertexAttribIPointerEXT@20)
-       GL_STUB(FramebufferTextureLayerEXT, 843, FramebufferTextureLayerEXT@20)
-       GL_STUB(ColorMaskIndexedEXT, 844, ColorMaskIndexedEXT@20)
-       GL_STUB(DisableIndexedEXT, 845, DisableIndexedEXT@8)
-       GL_STUB(EnableIndexedEXT, 846, EnableIndexedEXT@8)
-       GL_STUB(GetBooleanIndexedvEXT, 847, GetBooleanIndexedvEXT@12)
-       GL_STUB(GetIntegerIndexedvEXT, 848, GetIntegerIndexedvEXT@12)
-       GL_STUB(IsEnabledIndexedEXT, 849, IsEnabledIndexedEXT@8)
-       GL_STUB(ClearColorIiEXT, 850, ClearColorIiEXT@16)
-       GL_STUB(ClearColorIuiEXT, 851, ClearColorIuiEXT@16)
-       GL_STUB(GetTexParameterIivEXT, 852, GetTexParameterIivEXT@12)
-       GL_STUB(GetTexParameterIuivEXT, 853, GetTexParameterIuivEXT@12)
-       GL_STUB(TexParameterIivEXT, 854, TexParameterIivEXT@12)
-       GL_STUB(TexParameterIuivEXT, 855, TexParameterIuivEXT@12)
-       GL_STUB(BeginConditionalRenderNV, 856, BeginConditionalRenderNV@8)
-       GL_STUB(EndConditionalRenderNV, 857, EndConditionalRenderNV@0)
-       GL_STUB(BeginTransformFeedbackEXT, 858, BeginTransformFeedbackEXT@4)
-       GL_STUB(BindBufferBaseEXT, 859, BindBufferBaseEXT@12)
-       GL_STUB(BindBufferOffsetEXT, 860, BindBufferOffsetEXT@16)
-       GL_STUB(BindBufferRangeEXT, 861, BindBufferRangeEXT@20)
-       GL_STUB(EndTransformFeedbackEXT, 862, EndTransformFeedbackEXT@0)
-       GL_STUB(GetTransformFeedbackVaryingEXT, 863, GetTransformFeedbackVaryingEXT@28)
-       GL_STUB(TransformFeedbackVaryingsEXT, 864, TransformFeedbackVaryingsEXT@16)
-       GL_STUB(ProvokingVertexEXT, 865, ProvokingVertexEXT@4)
-       GL_STUB(_dispatch_stub_866, 866, _dispatch_stub_866@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_866, _dispatch_stub_866@12))
-       GL_STUB(_dispatch_stub_867, 867, _dispatch_stub_867@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_867, _dispatch_stub_867@12))
-       GL_STUB(GetObjectParameterivAPPLE, 868, GetObjectParameterivAPPLE@16)
-       GL_STUB(ObjectPurgeableAPPLE, 869, ObjectPurgeableAPPLE@12)
-       GL_STUB(ObjectUnpurgeableAPPLE, 870, ObjectUnpurgeableAPPLE@12)
-       GL_STUB(ActiveProgramEXT, 871, ActiveProgramEXT@4)
-       GL_STUB(CreateShaderProgramEXT, 872, CreateShaderProgramEXT@8)
-       GL_STUB(UseShaderProgramEXT, 873, UseShaderProgramEXT@8)
-       GL_STUB(_dispatch_stub_874, 874, _dispatch_stub_874@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_874, _dispatch_stub_874@16))
-       GL_STUB(_dispatch_stub_875, 875, _dispatch_stub_875@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_875, _dispatch_stub_875@16))
-       GL_STUB(_dispatch_stub_876, 876, _dispatch_stub_876@16)
-       HIDDEN(GL_PREFIX(_dispatch_stub_876, _dispatch_stub_876@16))
-       GL_STUB(_dispatch_stub_877, 877, _dispatch_stub_877@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_877, _dispatch_stub_877@12))
-       GL_STUB(_dispatch_stub_878, 878, _dispatch_stub_878@12)
-       HIDDEN(GL_PREFIX(_dispatch_stub_878, _dispatch_stub_878@12))
-       GL_STUB(EGLImageTargetRenderbufferStorageOES, 879, EGLImageTargetRenderbufferStorageOES@8)
-       GL_STUB(EGLImageTargetTexture2DOES, 880, EGLImageTargetTexture2DOES@8)
+       GL_STUB(_dispatch_stub_694, 694, _dispatch_stub_694@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_694, _dispatch_stub_694@8))
+       GL_STUB(_dispatch_stub_695, 695, _dispatch_stub_695@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_695, _dispatch_stub_695@12))
+       GL_STUB(_dispatch_stub_696, 696, _dispatch_stub_696@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_696, _dispatch_stub_696@4))
+       GL_STUB(_dispatch_stub_697, 697, _dispatch_stub_697@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_697, _dispatch_stub_697@8))
+       GL_STUB(_dispatch_stub_698, 698, _dispatch_stub_698@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_698, _dispatch_stub_698@4))
+       GL_STUB(AreProgramsResidentNV, 699, AreProgramsResidentNV@12)
+       GL_STUB(BindProgramNV, 700, BindProgramNV@8)
+       GL_STUB(DeleteProgramsNV, 701, DeleteProgramsNV@8)
+       GL_STUB(ExecuteProgramNV, 702, ExecuteProgramNV@12)
+       GL_STUB(GenProgramsNV, 703, GenProgramsNV@8)
+       GL_STUB(GetProgramParameterdvNV, 704, GetProgramParameterdvNV@16)
+       GL_STUB(GetProgramParameterfvNV, 705, GetProgramParameterfvNV@16)
+       GL_STUB(GetProgramStringNV, 706, GetProgramStringNV@12)
+       GL_STUB(GetProgramivNV, 707, GetProgramivNV@12)
+       GL_STUB(GetTrackMatrixivNV, 708, GetTrackMatrixivNV@16)
+       GL_STUB(GetVertexAttribPointervNV, 709, GetVertexAttribPointervNV@12)
+       GL_STUB(GetVertexAttribdvNV, 710, GetVertexAttribdvNV@12)
+       GL_STUB(GetVertexAttribfvNV, 711, GetVertexAttribfvNV@12)
+       GL_STUB(GetVertexAttribivNV, 712, GetVertexAttribivNV@12)
+       GL_STUB(IsProgramNV, 713, IsProgramNV@4)
+       GL_STUB(LoadProgramNV, 714, LoadProgramNV@16)
+       GL_STUB(ProgramParameters4dvNV, 715, ProgramParameters4dvNV@16)
+       GL_STUB(ProgramParameters4fvNV, 716, ProgramParameters4fvNV@16)
+       GL_STUB(RequestResidentProgramsNV, 717, RequestResidentProgramsNV@8)
+       GL_STUB(TrackMatrixNV, 718, TrackMatrixNV@16)
+       GL_STUB(VertexAttrib1dNV, 719, VertexAttrib1dNV@12)
+       GL_STUB(VertexAttrib1dvNV, 720, VertexAttrib1dvNV@8)
+       GL_STUB(VertexAttrib1fNV, 721, VertexAttrib1fNV@8)
+       GL_STUB(VertexAttrib1fvNV, 722, VertexAttrib1fvNV@8)
+       GL_STUB(VertexAttrib1sNV, 723, VertexAttrib1sNV@8)
+       GL_STUB(VertexAttrib1svNV, 724, VertexAttrib1svNV@8)
+       GL_STUB(VertexAttrib2dNV, 725, VertexAttrib2dNV@20)
+       GL_STUB(VertexAttrib2dvNV, 726, VertexAttrib2dvNV@8)
+       GL_STUB(VertexAttrib2fNV, 727, VertexAttrib2fNV@12)
+       GL_STUB(VertexAttrib2fvNV, 728, VertexAttrib2fvNV@8)
+       GL_STUB(VertexAttrib2sNV, 729, VertexAttrib2sNV@12)
+       GL_STUB(VertexAttrib2svNV, 730, VertexAttrib2svNV@8)
+       GL_STUB(VertexAttrib3dNV, 731, VertexAttrib3dNV@28)
+       GL_STUB(VertexAttrib3dvNV, 732, VertexAttrib3dvNV@8)
+       GL_STUB(VertexAttrib3fNV, 733, VertexAttrib3fNV@16)
+       GL_STUB(VertexAttrib3fvNV, 734, VertexAttrib3fvNV@8)
+       GL_STUB(VertexAttrib3sNV, 735, VertexAttrib3sNV@16)
+       GL_STUB(VertexAttrib3svNV, 736, VertexAttrib3svNV@8)
+       GL_STUB(VertexAttrib4dNV, 737, VertexAttrib4dNV@36)
+       GL_STUB(VertexAttrib4dvNV, 738, VertexAttrib4dvNV@8)
+       GL_STUB(VertexAttrib4fNV, 739, VertexAttrib4fNV@20)
+       GL_STUB(VertexAttrib4fvNV, 740, VertexAttrib4fvNV@8)
+       GL_STUB(VertexAttrib4sNV, 741, VertexAttrib4sNV@20)
+       GL_STUB(VertexAttrib4svNV, 742, VertexAttrib4svNV@8)
+       GL_STUB(VertexAttrib4ubNV, 743, VertexAttrib4ubNV@20)
+       GL_STUB(VertexAttrib4ubvNV, 744, VertexAttrib4ubvNV@8)
+       GL_STUB(VertexAttribPointerNV, 745, VertexAttribPointerNV@20)
+       GL_STUB(VertexAttribs1dvNV, 746, VertexAttribs1dvNV@12)
+       GL_STUB(VertexAttribs1fvNV, 747, VertexAttribs1fvNV@12)
+       GL_STUB(VertexAttribs1svNV, 748, VertexAttribs1svNV@12)
+       GL_STUB(VertexAttribs2dvNV, 749, VertexAttribs2dvNV@12)
+       GL_STUB(VertexAttribs2fvNV, 750, VertexAttribs2fvNV@12)
+       GL_STUB(VertexAttribs2svNV, 751, VertexAttribs2svNV@12)
+       GL_STUB(VertexAttribs3dvNV, 752, VertexAttribs3dvNV@12)
+       GL_STUB(VertexAttribs3fvNV, 753, VertexAttribs3fvNV@12)
+       GL_STUB(VertexAttribs3svNV, 754, VertexAttribs3svNV@12)
+       GL_STUB(VertexAttribs4dvNV, 755, VertexAttribs4dvNV@12)
+       GL_STUB(VertexAttribs4fvNV, 756, VertexAttribs4fvNV@12)
+       GL_STUB(VertexAttribs4svNV, 757, VertexAttribs4svNV@12)
+       GL_STUB(VertexAttribs4ubvNV, 758, VertexAttribs4ubvNV@12)
+       GL_STUB(GetTexBumpParameterfvATI, 759, GetTexBumpParameterfvATI@8)
+       GL_STUB(GetTexBumpParameterivATI, 760, GetTexBumpParameterivATI@8)
+       GL_STUB(TexBumpParameterfvATI, 761, TexBumpParameterfvATI@8)
+       GL_STUB(TexBumpParameterivATI, 762, TexBumpParameterivATI@8)
+       GL_STUB(AlphaFragmentOp1ATI, 763, AlphaFragmentOp1ATI@24)
+       GL_STUB(AlphaFragmentOp2ATI, 764, AlphaFragmentOp2ATI@36)
+       GL_STUB(AlphaFragmentOp3ATI, 765, AlphaFragmentOp3ATI@48)
+       GL_STUB(BeginFragmentShaderATI, 766, BeginFragmentShaderATI@0)
+       GL_STUB(BindFragmentShaderATI, 767, BindFragmentShaderATI@4)
+       GL_STUB(ColorFragmentOp1ATI, 768, ColorFragmentOp1ATI@28)
+       GL_STUB(ColorFragmentOp2ATI, 769, ColorFragmentOp2ATI@40)
+       GL_STUB(ColorFragmentOp3ATI, 770, ColorFragmentOp3ATI@52)
+       GL_STUB(DeleteFragmentShaderATI, 771, DeleteFragmentShaderATI@4)
+       GL_STUB(EndFragmentShaderATI, 772, EndFragmentShaderATI@0)
+       GL_STUB(GenFragmentShadersATI, 773, GenFragmentShadersATI@4)
+       GL_STUB(PassTexCoordATI, 774, PassTexCoordATI@12)
+       GL_STUB(SampleMapATI, 775, SampleMapATI@12)
+       GL_STUB(SetFragmentShaderConstantATI, 776, SetFragmentShaderConstantATI@8)
+       GL_STUB(PointParameteriNV, 777, PointParameteriNV@8)
+       GL_STUB(PointParameterivNV, 778, PointParameterivNV@8)
+       GL_STUB(_dispatch_stub_779, 779, _dispatch_stub_779@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_779, _dispatch_stub_779@4))
+       GL_STUB(_dispatch_stub_780, 780, _dispatch_stub_780@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_780, _dispatch_stub_780@4))
+       GL_STUB(_dispatch_stub_781, 781, _dispatch_stub_781@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_781, _dispatch_stub_781@8))
+       GL_STUB(_dispatch_stub_782, 782, _dispatch_stub_782@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_782, _dispatch_stub_782@8))
+       GL_STUB(_dispatch_stub_783, 783, _dispatch_stub_783@4)
+       HIDDEN(GL_PREFIX(_dispatch_stub_783, _dispatch_stub_783@4))
+       GL_STUB(GetProgramNamedParameterdvNV, 784, GetProgramNamedParameterdvNV@16)
+       GL_STUB(GetProgramNamedParameterfvNV, 785, GetProgramNamedParameterfvNV@16)
+       GL_STUB(ProgramNamedParameter4dNV, 786, ProgramNamedParameter4dNV@44)
+       GL_STUB(ProgramNamedParameter4dvNV, 787, ProgramNamedParameter4dvNV@16)
+       GL_STUB(ProgramNamedParameter4fNV, 788, ProgramNamedParameter4fNV@28)
+       GL_STUB(ProgramNamedParameter4fvNV, 789, ProgramNamedParameter4fvNV@16)
+       GL_STUB(PrimitiveRestartIndexNV, 790, PrimitiveRestartIndexNV@4)
+       GL_STUB(PrimitiveRestartNV, 791, PrimitiveRestartNV@0)
+       GL_STUB(_dispatch_stub_792, 792, _dispatch_stub_792@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_792, _dispatch_stub_792@16))
+       GL_STUB(_dispatch_stub_793, 793, _dispatch_stub_793@8)
+       HIDDEN(GL_PREFIX(_dispatch_stub_793, _dispatch_stub_793@8))
+       GL_STUB(BindFramebufferEXT, 794, BindFramebufferEXT@8)
+       GL_STUB(BindRenderbufferEXT, 795, BindRenderbufferEXT@8)
+       GL_STUB(CheckFramebufferStatusEXT, 796, CheckFramebufferStatusEXT@4)
+       GL_STUB(DeleteFramebuffersEXT, 797, DeleteFramebuffersEXT@8)
+       GL_STUB(DeleteRenderbuffersEXT, 798, DeleteRenderbuffersEXT@8)
+       GL_STUB(FramebufferRenderbufferEXT, 799, FramebufferRenderbufferEXT@16)
+       GL_STUB(FramebufferTexture1DEXT, 800, FramebufferTexture1DEXT@20)
+       GL_STUB(FramebufferTexture2DEXT, 801, FramebufferTexture2DEXT@20)
+       GL_STUB(FramebufferTexture3DEXT, 802, FramebufferTexture3DEXT@24)
+       GL_STUB(GenFramebuffersEXT, 803, GenFramebuffersEXT@8)
+       GL_STUB(GenRenderbuffersEXT, 804, GenRenderbuffersEXT@8)
+       GL_STUB(GenerateMipmapEXT, 805, GenerateMipmapEXT@4)
+       GL_STUB(GetFramebufferAttachmentParameterivEXT, 806, GetFramebufferAttachmentParameterivEXT@16)
+       GL_STUB(GetRenderbufferParameterivEXT, 807, GetRenderbufferParameterivEXT@12)
+       GL_STUB(IsFramebufferEXT, 808, IsFramebufferEXT@4)
+       GL_STUB(IsRenderbufferEXT, 809, IsRenderbufferEXT@4)
+       GL_STUB(RenderbufferStorageEXT, 810, RenderbufferStorageEXT@16)
+       GL_STUB(_dispatch_stub_811, 811, _dispatch_stub_811@40)
+       HIDDEN(GL_PREFIX(_dispatch_stub_811, _dispatch_stub_811@40))
+       GL_STUB(_dispatch_stub_812, 812, _dispatch_stub_812@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_812, _dispatch_stub_812@12))
+       GL_STUB(_dispatch_stub_813, 813, _dispatch_stub_813@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_813, _dispatch_stub_813@12))
+       GL_STUB(BindFragDataLocationEXT, 814, BindFragDataLocationEXT@12)
+       GL_STUB(GetFragDataLocationEXT, 815, GetFragDataLocationEXT@8)
+       GL_STUB(GetUniformuivEXT, 816, GetUniformuivEXT@12)
+       GL_STUB(GetVertexAttribIivEXT, 817, GetVertexAttribIivEXT@12)
+       GL_STUB(GetVertexAttribIuivEXT, 818, GetVertexAttribIuivEXT@12)
+       GL_STUB(Uniform1uiEXT, 819, Uniform1uiEXT@8)
+       GL_STUB(Uniform1uivEXT, 820, Uniform1uivEXT@12)
+       GL_STUB(Uniform2uiEXT, 821, Uniform2uiEXT@12)
+       GL_STUB(Uniform2uivEXT, 822, Uniform2uivEXT@12)
+       GL_STUB(Uniform3uiEXT, 823, Uniform3uiEXT@16)
+       GL_STUB(Uniform3uivEXT, 824, Uniform3uivEXT@12)
+       GL_STUB(Uniform4uiEXT, 825, Uniform4uiEXT@20)
+       GL_STUB(Uniform4uivEXT, 826, Uniform4uivEXT@12)
+       GL_STUB(VertexAttribI1iEXT, 827, VertexAttribI1iEXT@8)
+       GL_STUB(VertexAttribI1ivEXT, 828, VertexAttribI1ivEXT@8)
+       GL_STUB(VertexAttribI1uiEXT, 829, VertexAttribI1uiEXT@8)
+       GL_STUB(VertexAttribI1uivEXT, 830, VertexAttribI1uivEXT@8)
+       GL_STUB(VertexAttribI2iEXT, 831, VertexAttribI2iEXT@12)
+       GL_STUB(VertexAttribI2ivEXT, 832, VertexAttribI2ivEXT@8)
+       GL_STUB(VertexAttribI2uiEXT, 833, VertexAttribI2uiEXT@12)
+       GL_STUB(VertexAttribI2uivEXT, 834, VertexAttribI2uivEXT@8)
+       GL_STUB(VertexAttribI3iEXT, 835, VertexAttribI3iEXT@16)
+       GL_STUB(VertexAttribI3ivEXT, 836, VertexAttribI3ivEXT@8)
+       GL_STUB(VertexAttribI3uiEXT, 837, VertexAttribI3uiEXT@16)
+       GL_STUB(VertexAttribI3uivEXT, 838, VertexAttribI3uivEXT@8)
+       GL_STUB(VertexAttribI4bvEXT, 839, VertexAttribI4bvEXT@8)
+       GL_STUB(VertexAttribI4iEXT, 840, VertexAttribI4iEXT@20)
+       GL_STUB(VertexAttribI4ivEXT, 841, VertexAttribI4ivEXT@8)
+       GL_STUB(VertexAttribI4svEXT, 842, VertexAttribI4svEXT@8)
+       GL_STUB(VertexAttribI4ubvEXT, 843, VertexAttribI4ubvEXT@8)
+       GL_STUB(VertexAttribI4uiEXT, 844, VertexAttribI4uiEXT@20)
+       GL_STUB(VertexAttribI4uivEXT, 845, VertexAttribI4uivEXT@8)
+       GL_STUB(VertexAttribI4usvEXT, 846, VertexAttribI4usvEXT@8)
+       GL_STUB(VertexAttribIPointerEXT, 847, VertexAttribIPointerEXT@20)
+       GL_STUB(FramebufferTextureLayerEXT, 848, FramebufferTextureLayerEXT@20)
+       GL_STUB(ColorMaskIndexedEXT, 849, ColorMaskIndexedEXT@20)
+       GL_STUB(DisableIndexedEXT, 850, DisableIndexedEXT@8)
+       GL_STUB(EnableIndexedEXT, 851, EnableIndexedEXT@8)
+       GL_STUB(GetBooleanIndexedvEXT, 852, GetBooleanIndexedvEXT@12)
+       GL_STUB(GetIntegerIndexedvEXT, 853, GetIntegerIndexedvEXT@12)
+       GL_STUB(IsEnabledIndexedEXT, 854, IsEnabledIndexedEXT@8)
+       GL_STUB(ClearColorIiEXT, 855, ClearColorIiEXT@16)
+       GL_STUB(ClearColorIuiEXT, 856, ClearColorIuiEXT@16)
+       GL_STUB(GetTexParameterIivEXT, 857, GetTexParameterIivEXT@12)
+       GL_STUB(GetTexParameterIuivEXT, 858, GetTexParameterIuivEXT@12)
+       GL_STUB(TexParameterIivEXT, 859, TexParameterIivEXT@12)
+       GL_STUB(TexParameterIuivEXT, 860, TexParameterIuivEXT@12)
+       GL_STUB(BeginConditionalRenderNV, 861, BeginConditionalRenderNV@8)
+       GL_STUB(EndConditionalRenderNV, 862, EndConditionalRenderNV@0)
+       GL_STUB(BeginTransformFeedbackEXT, 863, BeginTransformFeedbackEXT@4)
+       GL_STUB(BindBufferBaseEXT, 864, BindBufferBaseEXT@12)
+       GL_STUB(BindBufferOffsetEXT, 865, BindBufferOffsetEXT@16)
+       GL_STUB(BindBufferRangeEXT, 866, BindBufferRangeEXT@20)
+       GL_STUB(EndTransformFeedbackEXT, 867, EndTransformFeedbackEXT@0)
+       GL_STUB(GetTransformFeedbackVaryingEXT, 868, GetTransformFeedbackVaryingEXT@28)
+       GL_STUB(TransformFeedbackVaryingsEXT, 869, TransformFeedbackVaryingsEXT@16)
+       GL_STUB(ProvokingVertexEXT, 870, ProvokingVertexEXT@4)
+       GL_STUB(_dispatch_stub_871, 871, _dispatch_stub_871@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_871, _dispatch_stub_871@12))
+       GL_STUB(_dispatch_stub_872, 872, _dispatch_stub_872@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_872, _dispatch_stub_872@12))
+       GL_STUB(GetObjectParameterivAPPLE, 873, GetObjectParameterivAPPLE@16)
+       GL_STUB(ObjectPurgeableAPPLE, 874, ObjectPurgeableAPPLE@12)
+       GL_STUB(ObjectUnpurgeableAPPLE, 875, ObjectUnpurgeableAPPLE@12)
+       GL_STUB(ActiveProgramEXT, 876, ActiveProgramEXT@4)
+       GL_STUB(CreateShaderProgramEXT, 877, CreateShaderProgramEXT@8)
+       GL_STUB(UseShaderProgramEXT, 878, UseShaderProgramEXT@8)
+       GL_STUB(_dispatch_stub_879, 879, _dispatch_stub_879@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_879, _dispatch_stub_879@16))
+       GL_STUB(_dispatch_stub_880, 880, _dispatch_stub_880@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_880, _dispatch_stub_880@16))
+       GL_STUB(_dispatch_stub_881, 881, _dispatch_stub_881@16)
+       HIDDEN(GL_PREFIX(_dispatch_stub_881, _dispatch_stub_881@16))
+       GL_STUB(_dispatch_stub_882, 882, _dispatch_stub_882@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_882, _dispatch_stub_882@12))
+       GL_STUB(_dispatch_stub_883, 883, _dispatch_stub_883@12)
+       HIDDEN(GL_PREFIX(_dispatch_stub_883, _dispatch_stub_883@12))
+       GL_STUB(EGLImageTargetRenderbufferStorageOES, 884, EGLImageTargetRenderbufferStorageOES@8)
+       GL_STUB(EGLImageTargetTexture2DOES, 885, EGLImageTargetTexture2DOES@8)
        GL_STUB_ALIAS(ArrayElementEXT, 306, ArrayElementEXT@4, ArrayElement, ArrayElement@4)
        GL_STUB_ALIAS(BindTextureEXT, 307, BindTextureEXT@8, BindTexture, BindTexture@8)
        GL_STUB_ALIAS(DrawArraysEXT, 310, DrawArraysEXT@12, DrawArrays, DrawArrays@12)
@@ -1255,151 +1260,151 @@ GLNAME(gl_dispatch_functions_start):
        GL_STUB_ALIAS(DrawElementsInstancedEXT, 573, DrawElementsInstancedEXT@20, DrawElementsInstancedARB, DrawElementsInstancedARB@20)
        GL_STUB_ALIAS(DrawElementsInstanced, 573, DrawElementsInstanced@20, DrawElementsInstancedARB, DrawElementsInstancedARB@20)
        GL_STUB_ALIAS(RenderbufferStorageMultisampleEXT, 574, RenderbufferStorageMultisampleEXT@20, RenderbufferStorageMultisample, RenderbufferStorageMultisample@20)
-       GL_STUB_ALIAS(PointParameterf, 615, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8)
-       GL_STUB_ALIAS(PointParameterfARB, 615, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8)
-       GL_STUB_ALIAS(PointParameterfv, 616, PointParameterfv@8, PointParameterfvEXT, PointParameterfvEXT@8)
-       GL_STUB_ALIAS(PointParameterfvARB, 616, PointParameterfvARB@8, PointParameterfvEXT, PointParameterfvEXT@8)
-       GL_STUB_ALIAS(SecondaryColor3b, 619, SecondaryColor3b@12, SecondaryColor3bEXT, SecondaryColor3bEXT@12)
-       GL_STUB_ALIAS(SecondaryColor3bv, 620, SecondaryColor3bv@4, SecondaryColor3bvEXT, SecondaryColor3bvEXT@4)
-       GL_STUB_ALIAS(SecondaryColor3d, 621, SecondaryColor3d@24, SecondaryColor3dEXT, SecondaryColor3dEXT@24)
-       GL_STUB_ALIAS(SecondaryColor3dv, 622, SecondaryColor3dv@4, SecondaryColor3dvEXT, SecondaryColor3dvEXT@4)
-       GL_STUB_ALIAS(SecondaryColor3f, 623, SecondaryColor3f@12, SecondaryColor3fEXT, SecondaryColor3fEXT@12)
-       GL_STUB_ALIAS(SecondaryColor3fv, 624, SecondaryColor3fv@4, SecondaryColor3fvEXT, SecondaryColor3fvEXT@4)
-       GL_STUB_ALIAS(SecondaryColor3i, 625, SecondaryColor3i@12, SecondaryColor3iEXT, SecondaryColor3iEXT@12)
-       GL_STUB_ALIAS(SecondaryColor3iv, 626, SecondaryColor3iv@4, SecondaryColor3ivEXT, SecondaryColor3ivEXT@4)
-       GL_STUB_ALIAS(SecondaryColor3s, 627, SecondaryColor3s@12, SecondaryColor3sEXT, SecondaryColor3sEXT@12)
-       GL_STUB_ALIAS(SecondaryColor3sv, 628, SecondaryColor3sv@4, SecondaryColor3svEXT, SecondaryColor3svEXT@4)
-       GL_STUB_ALIAS(SecondaryColor3ub, 629, SecondaryColor3ub@12, SecondaryColor3ubEXT, SecondaryColor3ubEXT@12)
-       GL_STUB_ALIAS(SecondaryColor3ubv, 630, SecondaryColor3ubv@4, SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4)
-       GL_STUB_ALIAS(SecondaryColor3ui, 631, SecondaryColor3ui@12, SecondaryColor3uiEXT, SecondaryColor3uiEXT@12)
-       GL_STUB_ALIAS(SecondaryColor3uiv, 632, SecondaryColor3uiv@4, SecondaryColor3uivEXT, SecondaryColor3uivEXT@4)
-       GL_STUB_ALIAS(SecondaryColor3us, 633, SecondaryColor3us@12, SecondaryColor3usEXT, SecondaryColor3usEXT@12)
-       GL_STUB_ALIAS(SecondaryColor3usv, 634, SecondaryColor3usv@4, SecondaryColor3usvEXT, SecondaryColor3usvEXT@4)
-       GL_STUB_ALIAS(SecondaryColorPointer, 635, SecondaryColorPointer@16, SecondaryColorPointerEXT, SecondaryColorPointerEXT@16)
-       GL_STUB_ALIAS(MultiDrawArrays, 636, MultiDrawArrays@16, MultiDrawArraysEXT, MultiDrawArraysEXT@16)
-       GL_STUB_ALIAS(MultiDrawElements, 637, MultiDrawElements@20, MultiDrawElementsEXT, MultiDrawElementsEXT@20)
-       GL_STUB_ALIAS(FogCoordPointer, 638, FogCoordPointer@12, FogCoordPointerEXT, FogCoordPointerEXT@12)
-       GL_STUB_ALIAS(FogCoordd, 639, FogCoordd@8, FogCoorddEXT, FogCoorddEXT@8)
-       GL_STUB_ALIAS(FogCoorddv, 640, FogCoorddv@4, FogCoorddvEXT, FogCoorddvEXT@4)
-       GL_STUB_ALIAS(FogCoordf, 641, FogCoordf@4, FogCoordfEXT, FogCoordfEXT@4)
-       GL_STUB_ALIAS(FogCoordfv, 642, FogCoordfv@4, FogCoordfvEXT, FogCoordfvEXT@4)
-       GL_STUB_ALIAS(BlendFuncSeparate, 644, BlendFuncSeparate@16, BlendFuncSeparateEXT, BlendFuncSeparateEXT@16)
-       GL_STUB_ALIAS(WindowPos2d, 661, WindowPos2d@16, WindowPos2dMESA, WindowPos2dMESA@16)
-       GL_STUB_ALIAS(WindowPos2dARB, 661, WindowPos2dARB@16, WindowPos2dMESA, WindowPos2dMESA@16)
-       GL_STUB_ALIAS(WindowPos2dv, 662, WindowPos2dv@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
-       GL_STUB_ALIAS(WindowPos2dvARB, 662, WindowPos2dvARB@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
-       GL_STUB_ALIAS(WindowPos2f, 663, WindowPos2f@8, WindowPos2fMESA, WindowPos2fMESA@8)
-       GL_STUB_ALIAS(WindowPos2fARB, 663, WindowPos2fARB@8, WindowPos2fMESA, WindowPos2fMESA@8)
-       GL_STUB_ALIAS(WindowPos2fv, 664, WindowPos2fv@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
-       GL_STUB_ALIAS(WindowPos2fvARB, 664, WindowPos2fvARB@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
-       GL_STUB_ALIAS(WindowPos2i, 665, WindowPos2i@8, WindowPos2iMESA, WindowPos2iMESA@8)
-       GL_STUB_ALIAS(WindowPos2iARB, 665, WindowPos2iARB@8, WindowPos2iMESA, WindowPos2iMESA@8)
-       GL_STUB_ALIAS(WindowPos2iv, 666, WindowPos2iv@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
-       GL_STUB_ALIAS(WindowPos2ivARB, 666, WindowPos2ivARB@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
-       GL_STUB_ALIAS(WindowPos2s, 667, WindowPos2s@8, WindowPos2sMESA, WindowPos2sMESA@8)
-       GL_STUB_ALIAS(WindowPos2sARB, 667, WindowPos2sARB@8, WindowPos2sMESA, WindowPos2sMESA@8)
-       GL_STUB_ALIAS(WindowPos2sv, 668, WindowPos2sv@4, WindowPos2svMESA, WindowPos2svMESA@4)
-       GL_STUB_ALIAS(WindowPos2svARB, 668, WindowPos2svARB@4, WindowPos2svMESA, WindowPos2svMESA@4)
-       GL_STUB_ALIAS(WindowPos3d, 669, WindowPos3d@24, WindowPos3dMESA, WindowPos3dMESA@24)
-       GL_STUB_ALIAS(WindowPos3dARB, 669, WindowPos3dARB@24, WindowPos3dMESA, WindowPos3dMESA@24)
-       GL_STUB_ALIAS(WindowPos3dv, 670, WindowPos3dv@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
-       GL_STUB_ALIAS(WindowPos3dvARB, 670, WindowPos3dvARB@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
-       GL_STUB_ALIAS(WindowPos3f, 671, WindowPos3f@12, WindowPos3fMESA, WindowPos3fMESA@12)
-       GL_STUB_ALIAS(WindowPos3fARB, 671, WindowPos3fARB@12, WindowPos3fMESA, WindowPos3fMESA@12)
-       GL_STUB_ALIAS(WindowPos3fv, 672, WindowPos3fv@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
-       GL_STUB_ALIAS(WindowPos3fvARB, 672, WindowPos3fvARB@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
-       GL_STUB_ALIAS(WindowPos3i, 673, WindowPos3i@12, WindowPos3iMESA, WindowPos3iMESA@12)
-       GL_STUB_ALIAS(WindowPos3iARB, 673, WindowPos3iARB@12, WindowPos3iMESA, WindowPos3iMESA@12)
-       GL_STUB_ALIAS(WindowPos3iv, 674, WindowPos3iv@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
-       GL_STUB_ALIAS(WindowPos3ivARB, 674, WindowPos3ivARB@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
-       GL_STUB_ALIAS(WindowPos3s, 675, WindowPos3s@12, WindowPos3sMESA, WindowPos3sMESA@12)
-       GL_STUB_ALIAS(WindowPos3sARB, 675, WindowPos3sARB@12, WindowPos3sMESA, WindowPos3sMESA@12)
-       GL_STUB_ALIAS(WindowPos3sv, 676, WindowPos3sv@4, WindowPos3svMESA, WindowPos3svMESA@4)
-       GL_STUB_ALIAS(WindowPos3svARB, 676, WindowPos3svARB@4, WindowPos3svMESA, WindowPos3svMESA@4)
-       GL_STUB_ALIAS(BindProgramARB, 695, BindProgramARB@8, BindProgramNV, BindProgramNV@8)
-       GL_STUB_ALIAS(DeleteProgramsARB, 696, DeleteProgramsARB@8, DeleteProgramsNV, DeleteProgramsNV@8)
-       GL_STUB_ALIAS(GenProgramsARB, 698, GenProgramsARB@8, GenProgramsNV, GenProgramsNV@8)
-       GL_STUB_ALIAS(GetVertexAttribPointerv, 704, GetVertexAttribPointerv@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
-       GL_STUB_ALIAS(GetVertexAttribPointervARB, 704, GetVertexAttribPointervARB@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
-       GL_STUB_ALIAS(IsProgramARB, 708, IsProgramARB@4, IsProgramNV, IsProgramNV@4)
-       GL_STUB_ALIAS(PointParameteri, 772, PointParameteri@8, PointParameteriNV, PointParameteriNV@8)
-       GL_STUB_ALIAS(PointParameteriv, 773, PointParameteriv@8, PointParameterivNV, PointParameterivNV@8)
-       GL_STUB_ALIAS(DeleteVertexArrays, 776, DeleteVertexArrays@8, _dispatch_stub_776, _dispatch_stub_776@8)
-       GL_STUB_ALIAS(IsVertexArray, 778, IsVertexArray@4, _dispatch_stub_778, _dispatch_stub_778@4)
-       GL_STUB_ALIAS(PrimitiveRestartIndex, 785, PrimitiveRestartIndex@4, PrimitiveRestartIndexNV, PrimitiveRestartIndexNV@4)
-       GL_STUB_ALIAS(BlendEquationSeparate, 788, BlendEquationSeparate@8, _dispatch_stub_788, _dispatch_stub_788@8)
-       GL_STUB_ALIAS(BindFramebuffer, 789, BindFramebuffer@8, BindFramebufferEXT, BindFramebufferEXT@8)
-       GL_STUB_ALIAS(BindRenderbuffer, 790, BindRenderbuffer@8, BindRenderbufferEXT, BindRenderbufferEXT@8)
-       GL_STUB_ALIAS(CheckFramebufferStatus, 791, CheckFramebufferStatus@4, CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4)
-       GL_STUB_ALIAS(DeleteFramebuffers, 792, DeleteFramebuffers@8, DeleteFramebuffersEXT, DeleteFramebuffersEXT@8)
-       GL_STUB_ALIAS(DeleteRenderbuffers, 793, DeleteRenderbuffers@8, DeleteRenderbuffersEXT, DeleteRenderbuffersEXT@8)
-       GL_STUB_ALIAS(FramebufferRenderbuffer, 794, FramebufferRenderbuffer@16, FramebufferRenderbufferEXT, FramebufferRenderbufferEXT@16)
-       GL_STUB_ALIAS(FramebufferTexture1D, 795, FramebufferTexture1D@20, FramebufferTexture1DEXT, FramebufferTexture1DEXT@20)
-       GL_STUB_ALIAS(FramebufferTexture2D, 796, FramebufferTexture2D@20, FramebufferTexture2DEXT, FramebufferTexture2DEXT@20)
-       GL_STUB_ALIAS(FramebufferTexture3D, 797, FramebufferTexture3D@24, FramebufferTexture3DEXT, FramebufferTexture3DEXT@24)
-       GL_STUB_ALIAS(GenFramebuffers, 798, GenFramebuffers@8, GenFramebuffersEXT, GenFramebuffersEXT@8)
-       GL_STUB_ALIAS(GenRenderbuffers, 799, GenRenderbuffers@8, GenRenderbuffersEXT, GenRenderbuffersEXT@8)
-       GL_STUB_ALIAS(GenerateMipmap, 800, GenerateMipmap@4, GenerateMipmapEXT, GenerateMipmapEXT@4)
-       GL_STUB_ALIAS(GetFramebufferAttachmentParameteriv, 801, GetFramebufferAttachmentParameteriv@16, GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameterivEXT@16)
-       GL_STUB_ALIAS(GetRenderbufferParameteriv, 802, GetRenderbufferParameteriv@12, GetRenderbufferParameterivEXT, GetRenderbufferParameterivEXT@12)
-       GL_STUB_ALIAS(IsFramebuffer, 803, IsFramebuffer@4, IsFramebufferEXT, IsFramebufferEXT@4)
-       GL_STUB_ALIAS(IsRenderbuffer, 804, IsRenderbuffer@4, IsRenderbufferEXT, IsRenderbufferEXT@4)
-       GL_STUB_ALIAS(RenderbufferStorage, 805, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16)
-       GL_STUB_ALIAS(BlitFramebuffer, 806, BlitFramebuffer@40, _dispatch_stub_806, _dispatch_stub_806@40)
-       GL_STUB_ALIAS(BindFragDataLocation, 809, BindFragDataLocation@12, BindFragDataLocationEXT, BindFragDataLocationEXT@12)
-       GL_STUB_ALIAS(GetFragDataLocation, 810, GetFragDataLocation@8, GetFragDataLocationEXT, GetFragDataLocationEXT@8)
-       GL_STUB_ALIAS(GetUniformuiv, 811, GetUniformuiv@12, GetUniformuivEXT, GetUniformuivEXT@12)
-       GL_STUB_ALIAS(GetVertexAttribIiv, 812, GetVertexAttribIiv@12, GetVertexAttribIivEXT, GetVertexAttribIivEXT@12)
-       GL_STUB_ALIAS(GetVertexAttribIuiv, 813, GetVertexAttribIuiv@12, GetVertexAttribIuivEXT, GetVertexAttribIuivEXT@12)
-       GL_STUB_ALIAS(Uniform1ui, 814, Uniform1ui@8, Uniform1uiEXT, Uniform1uiEXT@8)
-       GL_STUB_ALIAS(Uniform1uiv, 815, Uniform1uiv@12, Uniform1uivEXT, Uniform1uivEXT@12)
-       GL_STUB_ALIAS(Uniform2ui, 816, Uniform2ui@12, Uniform2uiEXT, Uniform2uiEXT@12)
-       GL_STUB_ALIAS(Uniform2uiv, 817, Uniform2uiv@12, Uniform2uivEXT, Uniform2uivEXT@12)
-       GL_STUB_ALIAS(Uniform3ui, 818, Uniform3ui@16, Uniform3uiEXT, Uniform3uiEXT@16)
-       GL_STUB_ALIAS(Uniform3uiv, 819, Uniform3uiv@12, Uniform3uivEXT, Uniform3uivEXT@12)
-       GL_STUB_ALIAS(Uniform4ui, 820, Uniform4ui@20, Uniform4uiEXT, Uniform4uiEXT@20)
-       GL_STUB_ALIAS(Uniform4uiv, 821, Uniform4uiv@12, Uniform4uivEXT, Uniform4uivEXT@12)
-       GL_STUB_ALIAS(VertexAttribI1i, 822, VertexAttribI1i@8, VertexAttribI1iEXT, VertexAttribI1iEXT@8)
-       GL_STUB_ALIAS(VertexAttribI1iv, 823, VertexAttribI1iv@8, VertexAttribI1ivEXT, VertexAttribI1ivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI1ui, 824, VertexAttribI1ui@8, VertexAttribI1uiEXT, VertexAttribI1uiEXT@8)
-       GL_STUB_ALIAS(VertexAttribI1uiv, 825, VertexAttribI1uiv@8, VertexAttribI1uivEXT, VertexAttribI1uivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI2i, 826, VertexAttribI2i@12, VertexAttribI2iEXT, VertexAttribI2iEXT@12)
-       GL_STUB_ALIAS(VertexAttribI2iv, 827, VertexAttribI2iv@8, VertexAttribI2ivEXT, VertexAttribI2ivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI2ui, 828, VertexAttribI2ui@12, VertexAttribI2uiEXT, VertexAttribI2uiEXT@12)
-       GL_STUB_ALIAS(VertexAttribI2uiv, 829, VertexAttribI2uiv@8, VertexAttribI2uivEXT, VertexAttribI2uivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI3i, 830, VertexAttribI3i@16, VertexAttribI3iEXT, VertexAttribI3iEXT@16)
-       GL_STUB_ALIAS(VertexAttribI3iv, 831, VertexAttribI3iv@8, VertexAttribI3ivEXT, VertexAttribI3ivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI3ui, 832, VertexAttribI3ui@16, VertexAttribI3uiEXT, VertexAttribI3uiEXT@16)
-       GL_STUB_ALIAS(VertexAttribI3uiv, 833, VertexAttribI3uiv@8, VertexAttribI3uivEXT, VertexAttribI3uivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI4bv, 834, VertexAttribI4bv@8, VertexAttribI4bvEXT, VertexAttribI4bvEXT@8)
-       GL_STUB_ALIAS(VertexAttribI4i, 835, VertexAttribI4i@20, VertexAttribI4iEXT, VertexAttribI4iEXT@20)
-       GL_STUB_ALIAS(VertexAttribI4iv, 836, VertexAttribI4iv@8, VertexAttribI4ivEXT, VertexAttribI4ivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI4sv, 837, VertexAttribI4sv@8, VertexAttribI4svEXT, VertexAttribI4svEXT@8)
-       GL_STUB_ALIAS(VertexAttribI4ubv, 838, VertexAttribI4ubv@8, VertexAttribI4ubvEXT, VertexAttribI4ubvEXT@8)
-       GL_STUB_ALIAS(VertexAttribI4ui, 839, VertexAttribI4ui@20, VertexAttribI4uiEXT, VertexAttribI4uiEXT@20)
-       GL_STUB_ALIAS(VertexAttribI4uiv, 840, VertexAttribI4uiv@8, VertexAttribI4uivEXT, VertexAttribI4uivEXT@8)
-       GL_STUB_ALIAS(VertexAttribI4usv, 841, VertexAttribI4usv@8, VertexAttribI4usvEXT, VertexAttribI4usvEXT@8)
-       GL_STUB_ALIAS(VertexAttribIPointer, 842, VertexAttribIPointer@20, VertexAttribIPointerEXT, VertexAttribIPointerEXT@20)
-       GL_STUB_ALIAS(FramebufferTextureLayer, 843, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20)
-       GL_STUB_ALIAS(ColorMaski, 844, ColorMaski@20, ColorMaskIndexedEXT, ColorMaskIndexedEXT@20)
-       GL_STUB_ALIAS(Disablei, 845, Disablei@8, DisableIndexedEXT, DisableIndexedEXT@8)
-       GL_STUB_ALIAS(Enablei, 846, Enablei@8, EnableIndexedEXT, EnableIndexedEXT@8)
-       GL_STUB_ALIAS(GetBooleani_v, 847, GetBooleani_v@12, GetBooleanIndexedvEXT, GetBooleanIndexedvEXT@12)
-       GL_STUB_ALIAS(GetIntegeri_v, 848, GetIntegeri_v@12, GetIntegerIndexedvEXT, GetIntegerIndexedvEXT@12)
-       GL_STUB_ALIAS(IsEnabledi, 849, IsEnabledi@8, IsEnabledIndexedEXT, IsEnabledIndexedEXT@8)
-       GL_STUB_ALIAS(GetTexParameterIiv, 852, GetTexParameterIiv@12, GetTexParameterIivEXT, GetTexParameterIivEXT@12)
-       GL_STUB_ALIAS(GetTexParameterIuiv, 853, GetTexParameterIuiv@12, GetTexParameterIuivEXT, GetTexParameterIuivEXT@12)
-       GL_STUB_ALIAS(TexParameterIiv, 854, TexParameterIiv@12, TexParameterIivEXT, TexParameterIivEXT@12)
-       GL_STUB_ALIAS(TexParameterIuiv, 855, TexParameterIuiv@12, TexParameterIuivEXT, TexParameterIuivEXT@12)
-       GL_STUB_ALIAS(BeginConditionalRender, 856, BeginConditionalRender@8, BeginConditionalRenderNV, BeginConditionalRenderNV@8)
-       GL_STUB_ALIAS(EndConditionalRender, 857, EndConditionalRender@0, EndConditionalRenderNV, EndConditionalRenderNV@0)
-       GL_STUB_ALIAS(BeginTransformFeedback, 858, BeginTransformFeedback@4, BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4)
-       GL_STUB_ALIAS(BindBufferBase, 859, BindBufferBase@12, BindBufferBaseEXT, BindBufferBaseEXT@12)
-       GL_STUB_ALIAS(BindBufferRange, 861, BindBufferRange@20, BindBufferRangeEXT, BindBufferRangeEXT@20)
-       GL_STUB_ALIAS(EndTransformFeedback, 862, EndTransformFeedback@0, EndTransformFeedbackEXT, EndTransformFeedbackEXT@0)
-       GL_STUB_ALIAS(GetTransformFeedbackVarying, 863, GetTransformFeedbackVarying@28, GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28)
-       GL_STUB_ALIAS(TransformFeedbackVaryings, 864, TransformFeedbackVaryings@16, TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16)
-       GL_STUB_ALIAS(ProvokingVertex, 865, ProvokingVertex@4, ProvokingVertexEXT, ProvokingVertexEXT@4)
+       GL_STUB_ALIAS(PointParameterf, 620, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8)
+       GL_STUB_ALIAS(PointParameterfARB, 620, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8)
+       GL_STUB_ALIAS(PointParameterfv, 621, PointParameterfv@8, PointParameterfvEXT, PointParameterfvEXT@8)
+       GL_STUB_ALIAS(PointParameterfvARB, 621, PointParameterfvARB@8, PointParameterfvEXT, PointParameterfvEXT@8)
+       GL_STUB_ALIAS(SecondaryColor3b, 624, SecondaryColor3b@12, SecondaryColor3bEXT, SecondaryColor3bEXT@12)
+       GL_STUB_ALIAS(SecondaryColor3bv, 625, SecondaryColor3bv@4, SecondaryColor3bvEXT, SecondaryColor3bvEXT@4)
+       GL_STUB_ALIAS(SecondaryColor3d, 626, SecondaryColor3d@24, SecondaryColor3dEXT, SecondaryColor3dEXT@24)
+       GL_STUB_ALIAS(SecondaryColor3dv, 627, SecondaryColor3dv@4, SecondaryColor3dvEXT, SecondaryColor3dvEXT@4)
+       GL_STUB_ALIAS(SecondaryColor3f, 628, SecondaryColor3f@12, SecondaryColor3fEXT, SecondaryColor3fEXT@12)
+       GL_STUB_ALIAS(SecondaryColor3fv, 629, SecondaryColor3fv@4, SecondaryColor3fvEXT, SecondaryColor3fvEXT@4)
+       GL_STUB_ALIAS(SecondaryColor3i, 630, SecondaryColor3i@12, SecondaryColor3iEXT, SecondaryColor3iEXT@12)
+       GL_STUB_ALIAS(SecondaryColor3iv, 631, SecondaryColor3iv@4, SecondaryColor3ivEXT, SecondaryColor3ivEXT@4)
+       GL_STUB_ALIAS(SecondaryColor3s, 632, SecondaryColor3s@12, SecondaryColor3sEXT, SecondaryColor3sEXT@12)
+       GL_STUB_ALIAS(SecondaryColor3sv, 633, SecondaryColor3sv@4, SecondaryColor3svEXT, SecondaryColor3svEXT@4)
+       GL_STUB_ALIAS(SecondaryColor3ub, 634, SecondaryColor3ub@12, SecondaryColor3ubEXT, SecondaryColor3ubEXT@12)
+       GL_STUB_ALIAS(SecondaryColor3ubv, 635, SecondaryColor3ubv@4, SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4)
+       GL_STUB_ALIAS(SecondaryColor3ui, 636, SecondaryColor3ui@12, SecondaryColor3uiEXT, SecondaryColor3uiEXT@12)
+       GL_STUB_ALIAS(SecondaryColor3uiv, 637, SecondaryColor3uiv@4, SecondaryColor3uivEXT, SecondaryColor3uivEXT@4)
+       GL_STUB_ALIAS(SecondaryColor3us, 638, SecondaryColor3us@12, SecondaryColor3usEXT, SecondaryColor3usEXT@12)
+       GL_STUB_ALIAS(SecondaryColor3usv, 639, SecondaryColor3usv@4, SecondaryColor3usvEXT, SecondaryColor3usvEXT@4)
+       GL_STUB_ALIAS(SecondaryColorPointer, 640, SecondaryColorPointer@16, SecondaryColorPointerEXT, SecondaryColorPointerEXT@16)
+       GL_STUB_ALIAS(MultiDrawArrays, 641, MultiDrawArrays@16, MultiDrawArraysEXT, MultiDrawArraysEXT@16)
+       GL_STUB_ALIAS(MultiDrawElements, 642, MultiDrawElements@20, MultiDrawElementsEXT, MultiDrawElementsEXT@20)
+       GL_STUB_ALIAS(FogCoordPointer, 643, FogCoordPointer@12, FogCoordPointerEXT, FogCoordPointerEXT@12)
+       GL_STUB_ALIAS(FogCoordd, 644, FogCoordd@8, FogCoorddEXT, FogCoorddEXT@8)
+       GL_STUB_ALIAS(FogCoorddv, 645, FogCoorddv@4, FogCoorddvEXT, FogCoorddvEXT@4)
+       GL_STUB_ALIAS(FogCoordf, 646, FogCoordf@4, FogCoordfEXT, FogCoordfEXT@4)
+       GL_STUB_ALIAS(FogCoordfv, 647, FogCoordfv@4, FogCoordfvEXT, FogCoordfvEXT@4)
+       GL_STUB_ALIAS(BlendFuncSeparate, 649, BlendFuncSeparate@16, BlendFuncSeparateEXT, BlendFuncSeparateEXT@16)
+       GL_STUB_ALIAS(WindowPos2d, 666, WindowPos2d@16, WindowPos2dMESA, WindowPos2dMESA@16)
+       GL_STUB_ALIAS(WindowPos2dARB, 666, WindowPos2dARB@16, WindowPos2dMESA, WindowPos2dMESA@16)
+       GL_STUB_ALIAS(WindowPos2dv, 667, WindowPos2dv@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
+       GL_STUB_ALIAS(WindowPos2dvARB, 667, WindowPos2dvARB@4, WindowPos2dvMESA, WindowPos2dvMESA@4)
+       GL_STUB_ALIAS(WindowPos2f, 668, WindowPos2f@8, WindowPos2fMESA, WindowPos2fMESA@8)
+       GL_STUB_ALIAS(WindowPos2fARB, 668, WindowPos2fARB@8, WindowPos2fMESA, WindowPos2fMESA@8)
+       GL_STUB_ALIAS(WindowPos2fv, 669, WindowPos2fv@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
+       GL_STUB_ALIAS(WindowPos2fvARB, 669, WindowPos2fvARB@4, WindowPos2fvMESA, WindowPos2fvMESA@4)
+       GL_STUB_ALIAS(WindowPos2i, 670, WindowPos2i@8, WindowPos2iMESA, WindowPos2iMESA@8)
+       GL_STUB_ALIAS(WindowPos2iARB, 670, WindowPos2iARB@8, WindowPos2iMESA, WindowPos2iMESA@8)
+       GL_STUB_ALIAS(WindowPos2iv, 671, WindowPos2iv@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
+       GL_STUB_ALIAS(WindowPos2ivARB, 671, WindowPos2ivARB@4, WindowPos2ivMESA, WindowPos2ivMESA@4)
+       GL_STUB_ALIAS(WindowPos2s, 672, WindowPos2s@8, WindowPos2sMESA, WindowPos2sMESA@8)
+       GL_STUB_ALIAS(WindowPos2sARB, 672, WindowPos2sARB@8, WindowPos2sMESA, WindowPos2sMESA@8)
+       GL_STUB_ALIAS(WindowPos2sv, 673, WindowPos2sv@4, WindowPos2svMESA, WindowPos2svMESA@4)
+       GL_STUB_ALIAS(WindowPos2svARB, 673, WindowPos2svARB@4, WindowPos2svMESA, WindowPos2svMESA@4)
+       GL_STUB_ALIAS(WindowPos3d, 674, WindowPos3d@24, WindowPos3dMESA, WindowPos3dMESA@24)
+       GL_STUB_ALIAS(WindowPos3dARB, 674, WindowPos3dARB@24, WindowPos3dMESA, WindowPos3dMESA@24)
+       GL_STUB_ALIAS(WindowPos3dv, 675, WindowPos3dv@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
+       GL_STUB_ALIAS(WindowPos3dvARB, 675, WindowPos3dvARB@4, WindowPos3dvMESA, WindowPos3dvMESA@4)
+       GL_STUB_ALIAS(WindowPos3f, 676, WindowPos3f@12, WindowPos3fMESA, WindowPos3fMESA@12)
+       GL_STUB_ALIAS(WindowPos3fARB, 676, WindowPos3fARB@12, WindowPos3fMESA, WindowPos3fMESA@12)
+       GL_STUB_ALIAS(WindowPos3fv, 677, WindowPos3fv@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
+       GL_STUB_ALIAS(WindowPos3fvARB, 677, WindowPos3fvARB@4, WindowPos3fvMESA, WindowPos3fvMESA@4)
+       GL_STUB_ALIAS(WindowPos3i, 678, WindowPos3i@12, WindowPos3iMESA, WindowPos3iMESA@12)
+       GL_STUB_ALIAS(WindowPos3iARB, 678, WindowPos3iARB@12, WindowPos3iMESA, WindowPos3iMESA@12)
+       GL_STUB_ALIAS(WindowPos3iv, 679, WindowPos3iv@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
+       GL_STUB_ALIAS(WindowPos3ivARB, 679, WindowPos3ivARB@4, WindowPos3ivMESA, WindowPos3ivMESA@4)
+       GL_STUB_ALIAS(WindowPos3s, 680, WindowPos3s@12, WindowPos3sMESA, WindowPos3sMESA@12)
+       GL_STUB_ALIAS(WindowPos3sARB, 680, WindowPos3sARB@12, WindowPos3sMESA, WindowPos3sMESA@12)
+       GL_STUB_ALIAS(WindowPos3sv, 681, WindowPos3sv@4, WindowPos3svMESA, WindowPos3svMESA@4)
+       GL_STUB_ALIAS(WindowPos3svARB, 681, WindowPos3svARB@4, WindowPos3svMESA, WindowPos3svMESA@4)
+       GL_STUB_ALIAS(BindProgramARB, 700, BindProgramARB@8, BindProgramNV, BindProgramNV@8)
+       GL_STUB_ALIAS(DeleteProgramsARB, 701, DeleteProgramsARB@8, DeleteProgramsNV, DeleteProgramsNV@8)
+       GL_STUB_ALIAS(GenProgramsARB, 703, GenProgramsARB@8, GenProgramsNV, GenProgramsNV@8)
+       GL_STUB_ALIAS(GetVertexAttribPointerv, 709, GetVertexAttribPointerv@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
+       GL_STUB_ALIAS(GetVertexAttribPointervARB, 709, GetVertexAttribPointervARB@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12)
+       GL_STUB_ALIAS(IsProgramARB, 713, IsProgramARB@4, IsProgramNV, IsProgramNV@4)
+       GL_STUB_ALIAS(PointParameteri, 777, PointParameteri@8, PointParameteriNV, PointParameteriNV@8)
+       GL_STUB_ALIAS(PointParameteriv, 778, PointParameteriv@8, PointParameterivNV, PointParameterivNV@8)
+       GL_STUB_ALIAS(DeleteVertexArrays, 781, DeleteVertexArrays@8, _dispatch_stub_781, _dispatch_stub_781@8)
+       GL_STUB_ALIAS(IsVertexArray, 783, IsVertexArray@4, _dispatch_stub_783, _dispatch_stub_783@4)
+       GL_STUB_ALIAS(PrimitiveRestartIndex, 790, PrimitiveRestartIndex@4, PrimitiveRestartIndexNV, PrimitiveRestartIndexNV@4)
+       GL_STUB_ALIAS(BlendEquationSeparate, 793, BlendEquationSeparate@8, _dispatch_stub_793, _dispatch_stub_793@8)
+       GL_STUB_ALIAS(BindFramebuffer, 794, BindFramebuffer@8, BindFramebufferEXT, BindFramebufferEXT@8)
+       GL_STUB_ALIAS(BindRenderbuffer, 795, BindRenderbuffer@8, BindRenderbufferEXT, BindRenderbufferEXT@8)
+       GL_STUB_ALIAS(CheckFramebufferStatus, 796, CheckFramebufferStatus@4, CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4)
+       GL_STUB_ALIAS(DeleteFramebuffers, 797, DeleteFramebuffers@8, DeleteFramebuffersEXT, DeleteFramebuffersEXT@8)
+       GL_STUB_ALIAS(DeleteRenderbuffers, 798, DeleteRenderbuffers@8, DeleteRenderbuffersEXT, DeleteRenderbuffersEXT@8)
+       GL_STUB_ALIAS(FramebufferRenderbuffer, 799, FramebufferRenderbuffer@16, FramebufferRenderbufferEXT, FramebufferRenderbufferEXT@16)
+       GL_STUB_ALIAS(FramebufferTexture1D, 800, FramebufferTexture1D@20, FramebufferTexture1DEXT, FramebufferTexture1DEXT@20)
+       GL_STUB_ALIAS(FramebufferTexture2D, 801, FramebufferTexture2D@20, FramebufferTexture2DEXT, FramebufferTexture2DEXT@20)
+       GL_STUB_ALIAS(FramebufferTexture3D, 802, FramebufferTexture3D@24, FramebufferTexture3DEXT, FramebufferTexture3DEXT@24)
+       GL_STUB_ALIAS(GenFramebuffers, 803, GenFramebuffers@8, GenFramebuffersEXT, GenFramebuffersEXT@8)
+       GL_STUB_ALIAS(GenRenderbuffers, 804, GenRenderbuffers@8, GenRenderbuffersEXT, GenRenderbuffersEXT@8)
+       GL_STUB_ALIAS(GenerateMipmap, 805, GenerateMipmap@4, GenerateMipmapEXT, GenerateMipmapEXT@4)
+       GL_STUB_ALIAS(GetFramebufferAttachmentParameteriv, 806, GetFramebufferAttachmentParameteriv@16, GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameterivEXT@16)
+       GL_STUB_ALIAS(GetRenderbufferParameteriv, 807, GetRenderbufferParameteriv@12, GetRenderbufferParameterivEXT, GetRenderbufferParameterivEXT@12)
+       GL_STUB_ALIAS(IsFramebuffer, 808, IsFramebuffer@4, IsFramebufferEXT, IsFramebufferEXT@4)
+       GL_STUB_ALIAS(IsRenderbuffer, 809, IsRenderbuffer@4, IsRenderbufferEXT, IsRenderbufferEXT@4)
+       GL_STUB_ALIAS(RenderbufferStorage, 810, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16)
+       GL_STUB_ALIAS(BlitFramebuffer, 811, BlitFramebuffer@40, _dispatch_stub_811, _dispatch_stub_811@40)
+       GL_STUB_ALIAS(BindFragDataLocation, 814, BindFragDataLocation@12, BindFragDataLocationEXT, BindFragDataLocationEXT@12)
+       GL_STUB_ALIAS(GetFragDataLocation, 815, GetFragDataLocation@8, GetFragDataLocationEXT, GetFragDataLocationEXT@8)
+       GL_STUB_ALIAS(GetUniformuiv, 816, GetUniformuiv@12, GetUniformuivEXT, GetUniformuivEXT@12)
+       GL_STUB_ALIAS(GetVertexAttribIiv, 817, GetVertexAttribIiv@12, GetVertexAttribIivEXT, GetVertexAttribIivEXT@12)
+       GL_STUB_ALIAS(GetVertexAttribIuiv, 818, GetVertexAttribIuiv@12, GetVertexAttribIuivEXT, GetVertexAttribIuivEXT@12)
+       GL_STUB_ALIAS(Uniform1ui, 819, Uniform1ui@8, Uniform1uiEXT, Uniform1uiEXT@8)
+       GL_STUB_ALIAS(Uniform1uiv, 820, Uniform1uiv@12, Uniform1uivEXT, Uniform1uivEXT@12)
+       GL_STUB_ALIAS(Uniform2ui, 821, Uniform2ui@12, Uniform2uiEXT, Uniform2uiEXT@12)
+       GL_STUB_ALIAS(Uniform2uiv, 822, Uniform2uiv@12, Uniform2uivEXT, Uniform2uivEXT@12)
+       GL_STUB_ALIAS(Uniform3ui, 823, Uniform3ui@16, Uniform3uiEXT, Uniform3uiEXT@16)
+       GL_STUB_ALIAS(Uniform3uiv, 824, Uniform3uiv@12, Uniform3uivEXT, Uniform3uivEXT@12)
+       GL_STUB_ALIAS(Uniform4ui, 825, Uniform4ui@20, Uniform4uiEXT, Uniform4uiEXT@20)
+       GL_STUB_ALIAS(Uniform4uiv, 826, Uniform4uiv@12, Uniform4uivEXT, Uniform4uivEXT@12)
+       GL_STUB_ALIAS(VertexAttribI1i, 827, VertexAttribI1i@8, VertexAttribI1iEXT, VertexAttribI1iEXT@8)
+       GL_STUB_ALIAS(VertexAttribI1iv, 828, VertexAttribI1iv@8, VertexAttribI1ivEXT, VertexAttribI1ivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI1ui, 829, VertexAttribI1ui@8, VertexAttribI1uiEXT, VertexAttribI1uiEXT@8)
+       GL_STUB_ALIAS(VertexAttribI1uiv, 830, VertexAttribI1uiv@8, VertexAttribI1uivEXT, VertexAttribI1uivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI2i, 831, VertexAttribI2i@12, VertexAttribI2iEXT, VertexAttribI2iEXT@12)
+       GL_STUB_ALIAS(VertexAttribI2iv, 832, VertexAttribI2iv@8, VertexAttribI2ivEXT, VertexAttribI2ivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI2ui, 833, VertexAttribI2ui@12, VertexAttribI2uiEXT, VertexAttribI2uiEXT@12)
+       GL_STUB_ALIAS(VertexAttribI2uiv, 834, VertexAttribI2uiv@8, VertexAttribI2uivEXT, VertexAttribI2uivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI3i, 835, VertexAttribI3i@16, VertexAttribI3iEXT, VertexAttribI3iEXT@16)
+       GL_STUB_ALIAS(VertexAttribI3iv, 836, VertexAttribI3iv@8, VertexAttribI3ivEXT, VertexAttribI3ivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI3ui, 837, VertexAttribI3ui@16, VertexAttribI3uiEXT, VertexAttribI3uiEXT@16)
+       GL_STUB_ALIAS(VertexAttribI3uiv, 838, VertexAttribI3uiv@8, VertexAttribI3uivEXT, VertexAttribI3uivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI4bv, 839, VertexAttribI4bv@8, VertexAttribI4bvEXT, VertexAttribI4bvEXT@8)
+       GL_STUB_ALIAS(VertexAttribI4i, 840, VertexAttribI4i@20, VertexAttribI4iEXT, VertexAttribI4iEXT@20)
+       GL_STUB_ALIAS(VertexAttribI4iv, 841, VertexAttribI4iv@8, VertexAttribI4ivEXT, VertexAttribI4ivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI4sv, 842, VertexAttribI4sv@8, VertexAttribI4svEXT, VertexAttribI4svEXT@8)
+       GL_STUB_ALIAS(VertexAttribI4ubv, 843, VertexAttribI4ubv@8, VertexAttribI4ubvEXT, VertexAttribI4ubvEXT@8)
+       GL_STUB_ALIAS(VertexAttribI4ui, 844, VertexAttribI4ui@20, VertexAttribI4uiEXT, VertexAttribI4uiEXT@20)
+       GL_STUB_ALIAS(VertexAttribI4uiv, 845, VertexAttribI4uiv@8, VertexAttribI4uivEXT, VertexAttribI4uivEXT@8)
+       GL_STUB_ALIAS(VertexAttribI4usv, 846, VertexAttribI4usv@8, VertexAttribI4usvEXT, VertexAttribI4usvEXT@8)
+       GL_STUB_ALIAS(VertexAttribIPointer, 847, VertexAttribIPointer@20, VertexAttribIPointerEXT, VertexAttribIPointerEXT@20)
+       GL_STUB_ALIAS(FramebufferTextureLayer, 848, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20)
+       GL_STUB_ALIAS(ColorMaski, 849, ColorMaski@20, ColorMaskIndexedEXT, ColorMaskIndexedEXT@20)
+       GL_STUB_ALIAS(Disablei, 850, Disablei@8, DisableIndexedEXT, DisableIndexedEXT@8)
+       GL_STUB_ALIAS(Enablei, 851, Enablei@8, EnableIndexedEXT, EnableIndexedEXT@8)
+       GL_STUB_ALIAS(GetBooleani_v, 852, GetBooleani_v@12, GetBooleanIndexedvEXT, GetBooleanIndexedvEXT@12)
+       GL_STUB_ALIAS(GetIntegeri_v, 853, GetIntegeri_v@12, GetIntegerIndexedvEXT, GetIntegerIndexedvEXT@12)
+       GL_STUB_ALIAS(IsEnabledi, 854, IsEnabledi@8, IsEnabledIndexedEXT, IsEnabledIndexedEXT@8)
+       GL_STUB_ALIAS(GetTexParameterIiv, 857, GetTexParameterIiv@12, GetTexParameterIivEXT, GetTexParameterIivEXT@12)
+       GL_STUB_ALIAS(GetTexParameterIuiv, 858, GetTexParameterIuiv@12, GetTexParameterIuivEXT, GetTexParameterIuivEXT@12)
+       GL_STUB_ALIAS(TexParameterIiv, 859, TexParameterIiv@12, TexParameterIivEXT, TexParameterIivEXT@12)
+       GL_STUB_ALIAS(TexParameterIuiv, 860, TexParameterIuiv@12, TexParameterIuivEXT, TexParameterIuivEXT@12)
+       GL_STUB_ALIAS(BeginConditionalRender, 861, BeginConditionalRender@8, BeginConditionalRenderNV, BeginConditionalRenderNV@8)
+       GL_STUB_ALIAS(EndConditionalRender, 862, EndConditionalRender@0, EndConditionalRenderNV, EndConditionalRenderNV@0)
+       GL_STUB_ALIAS(BeginTransformFeedback, 863, BeginTransformFeedback@4, BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4)
+       GL_STUB_ALIAS(BindBufferBase, 864, BindBufferBase@12, BindBufferBaseEXT, BindBufferBaseEXT@12)
+       GL_STUB_ALIAS(BindBufferRange, 866, BindBufferRange@20, BindBufferRangeEXT, BindBufferRangeEXT@20)
+       GL_STUB_ALIAS(EndTransformFeedback, 867, EndTransformFeedback@0, EndTransformFeedbackEXT, EndTransformFeedbackEXT@0)
+       GL_STUB_ALIAS(GetTransformFeedbackVarying, 868, GetTransformFeedbackVarying@28, GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28)
+       GL_STUB_ALIAS(TransformFeedbackVaryings, 869, TransformFeedbackVaryings@16, TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16)
+       GL_STUB_ALIAS(ProvokingVertex, 870, ProvokingVertex@4, ProvokingVertexEXT, ProvokingVertexEXT@4)
 
                GLOBL   GLNAME(gl_dispatch_functions_end)
                HIDDEN(GLNAME(gl_dispatch_functions_end))
index af6b3461740d5d1e903377570f56d958356ccb90..ff662dc7ecad32a1409890417b2bf010ff37657e 100644 (file)
@@ -640,287 +640,292 @@ struct _glapi_table
    GLboolean (GLAPIENTRYP IsTransformFeedback)(GLuint id); /* 597 */
    void (GLAPIENTRYP PauseTransformFeedback)(void); /* 598 */
    void (GLAPIENTRYP ResumeTransformFeedback)(void); /* 599 */
-   void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 600 */
-   void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 601 */
-   void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 602 */
-   void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 603 */
-   void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 604 */
-   void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 605 */
-   void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 606 */
-   void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 607 */
-   void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 608 */
-   void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 609 */
-   void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 610 */
-   void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 611 */
-   void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 612 */
-   void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 613 */
-   void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 614 */
-   void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 615 */
-   void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 616 */
-   void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 617 */
-   void (GLAPIENTRYP UnlockArraysEXT)(void); /* 618 */
-   void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 619 */
-   void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 620 */
-   void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 621 */
-   void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 622 */
-   void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 623 */
-   void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 624 */
-   void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 625 */
-   void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 626 */
-   void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 627 */
-   void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 628 */
-   void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 629 */
-   void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 630 */
-   void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 631 */
-   void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 632 */
-   void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 633 */
-   void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 634 */
-   void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 635 */
-   void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 636 */
-   void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 637 */
-   void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 638 */
-   void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 639 */
-   void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 640 */
-   void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 641 */
-   void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 642 */
-   void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 643 */
-   void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 644 */
-   void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 645 */
-   void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 646 */
-   void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 647 */
-   void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 648 */
-   void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 649 */
-   void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 650 */
-   void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 651 */
-   void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 652 */
-   void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 653 */
-   void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 654 */
-   void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 655 */
-   void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 656 */
-   void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 657 */
-   void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 658 */
-   void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 659 */
-   void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 660 */
-   void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 661 */
-   void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 662 */
-   void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 663 */
-   void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 664 */
-   void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 665 */
-   void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 666 */
-   void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 667 */
-   void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 668 */
-   void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 669 */
-   void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 670 */
-   void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 671 */
-   void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 672 */
-   void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 673 */
-   void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 674 */
-   void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 675 */
-   void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 676 */
-   void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 677 */
-   void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 678 */
-   void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 679 */
-   void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 680 */
-   void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 681 */
-   void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 682 */
-   void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 683 */
-   void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 684 */
-   void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 685 */
-   void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 686 */
-   void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 687 */
-   void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 688 */
-   void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 689 */
-   void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 690 */
-   GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 691 */
-   void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 692 */
-   GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 693 */
-   GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 694 */
-   void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 695 */
-   void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 696 */
-   void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 697 */
-   void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 698 */
-   void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 699 */
-   void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 700 */
-   void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 701 */
-   void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 702 */
-   void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 703 */
-   void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 704 */
-   void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 705 */
-   void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 706 */
-   void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 707 */
-   GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 708 */
-   void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 709 */
-   void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble * params); /* 710 */
-   void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat * params); /* 711 */
-   void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 712 */
-   void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 713 */
-   void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 714 */
-   void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 715 */
-   void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 716 */
-   void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 717 */
-   void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 718 */
-   void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 719 */
-   void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 720 */
-   void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 721 */
-   void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 722 */
-   void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 723 */
-   void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 724 */
-   void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 725 */
-   void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 726 */
-   void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 727 */
-   void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 728 */
-   void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 729 */
-   void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 730 */
-   void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 731 */
-   void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 732 */
-   void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 733 */
-   void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 734 */
-   void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 735 */
-   void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 736 */
-   void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 737 */
-   void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 738 */
-   void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 739 */
-   void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 740 */
-   void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 741 */
-   void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 742 */
-   void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 743 */
-   void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 744 */
-   void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 745 */
-   void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 746 */
-   void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 747 */
-   void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 748 */
-   void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 749 */
-   void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 750 */
-   void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 751 */
-   void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 752 */
-   void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 753 */
-   void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 754 */
-   void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 755 */
-   void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 756 */
-   void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 757 */
-   void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 758 */
-   void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 759 */
-   void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 760 */
-   void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 761 */
-   void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 762 */
-   void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 763 */
-   void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 764 */
-   void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 765 */
-   void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 766 */
-   void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 767 */
-   GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 768 */
-   void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 769 */
-   void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 770 */
-   void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 771 */
-   void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 772 */
-   void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 773 */
-   void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 774 */
-   void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 775 */
-   void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 776 */
-   void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 777 */
-   GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 778 */
-   void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 779 */
-   void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 780 */
-   void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 781 */
-   void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 782 */
-   void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 783 */
-   void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 784 */
-   void (GLAPIENTRYP PrimitiveRestartIndexNV)(GLuint index); /* 785 */
-   void (GLAPIENTRYP PrimitiveRestartNV)(void); /* 786 */
-   void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 787 */
-   void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 788 */
-   void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 789 */
-   void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 790 */
-   GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 791 */
-   void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 792 */
-   void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 793 */
-   void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 794 */
-   void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 795 */
-   void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 796 */
-   void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 797 */
-   void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 798 */
-   void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 799 */
-   void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 800 */
-   void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 801 */
-   void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 802 */
-   GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 803 */
-   GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 804 */
-   void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 805 */
-   void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 806 */
-   void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 807 */
-   void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 808 */
-   void (GLAPIENTRYP BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar * name); /* 809 */
-   GLint (GLAPIENTRYP GetFragDataLocationEXT)(GLuint program, const GLchar * name); /* 810 */
-   void (GLAPIENTRYP GetUniformuivEXT)(GLuint program, GLint location, GLuint * params); /* 811 */
-   void (GLAPIENTRYP GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint * params); /* 812 */
-   void (GLAPIENTRYP GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint * params); /* 813 */
-   void (GLAPIENTRYP Uniform1uiEXT)(GLint location, GLuint x); /* 814 */
-   void (GLAPIENTRYP Uniform1uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 815 */
-   void (GLAPIENTRYP Uniform2uiEXT)(GLint location, GLuint x, GLuint y); /* 816 */
-   void (GLAPIENTRYP Uniform2uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 817 */
-   void (GLAPIENTRYP Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z); /* 818 */
-   void (GLAPIENTRYP Uniform3uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 819 */
-   void (GLAPIENTRYP Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); /* 820 */
-   void (GLAPIENTRYP Uniform4uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 821 */
-   void (GLAPIENTRYP VertexAttribI1iEXT)(GLuint index, GLint x); /* 822 */
-   void (GLAPIENTRYP VertexAttribI1ivEXT)(GLuint index, const GLint * v); /* 823 */
-   void (GLAPIENTRYP VertexAttribI1uiEXT)(GLuint index, GLuint x); /* 824 */
-   void (GLAPIENTRYP VertexAttribI1uivEXT)(GLuint index, const GLuint * v); /* 825 */
-   void (GLAPIENTRYP VertexAttribI2iEXT)(GLuint index, GLint x, GLint y); /* 826 */
-   void (GLAPIENTRYP VertexAttribI2ivEXT)(GLuint index, const GLint * v); /* 827 */
-   void (GLAPIENTRYP VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y); /* 828 */
-   void (GLAPIENTRYP VertexAttribI2uivEXT)(GLuint index, const GLuint * v); /* 829 */
-   void (GLAPIENTRYP VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z); /* 830 */
-   void (GLAPIENTRYP VertexAttribI3ivEXT)(GLuint index, const GLint * v); /* 831 */
-   void (GLAPIENTRYP VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z); /* 832 */
-   void (GLAPIENTRYP VertexAttribI3uivEXT)(GLuint index, const GLuint * v); /* 833 */
-   void (GLAPIENTRYP VertexAttribI4bvEXT)(GLuint index, const GLbyte * v); /* 834 */
-   void (GLAPIENTRYP VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w); /* 835 */
-   void (GLAPIENTRYP VertexAttribI4ivEXT)(GLuint index, const GLint * v); /* 836 */
-   void (GLAPIENTRYP VertexAttribI4svEXT)(GLuint index, const GLshort * v); /* 837 */
-   void (GLAPIENTRYP VertexAttribI4ubvEXT)(GLuint index, const GLubyte * v); /* 838 */
-   void (GLAPIENTRYP VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); /* 839 */
-   void (GLAPIENTRYP VertexAttribI4uivEXT)(GLuint index, const GLuint * v); /* 840 */
-   void (GLAPIENTRYP VertexAttribI4usvEXT)(GLuint index, const GLushort * v); /* 841 */
-   void (GLAPIENTRYP VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 842 */
-   void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 843 */
-   void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 844 */
-   void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 845 */
-   void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 846 */
-   void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 847 */
-   void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 848 */
-   GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 849 */
-   void (GLAPIENTRYP ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a); /* 850 */
-   void (GLAPIENTRYP ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a); /* 851 */
-   void (GLAPIENTRYP GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint * params); /* 852 */
-   void (GLAPIENTRYP GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint * params); /* 853 */
-   void (GLAPIENTRYP TexParameterIivEXT)(GLenum target, GLenum pname, const GLint * params); /* 854 */
-   void (GLAPIENTRYP TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint * params); /* 855 */
-   void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 856 */
-   void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 857 */
-   void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 858 */
-   void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 859 */
-   void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 860 */
-   void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 861 */
-   void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 862 */
-   void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 863 */
-   void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 864 */
-   void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 865 */
-   void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 866 */
-   void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 867 */
-   void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 868 */
-   GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 869 */
-   GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 870 */
-   void (GLAPIENTRYP ActiveProgramEXT)(GLuint program); /* 871 */
-   GLuint (GLAPIENTRYP CreateShaderProgramEXT)(GLenum type, const GLchar * string); /* 872 */
-   void (GLAPIENTRYP UseShaderProgramEXT)(GLenum type, GLuint program); /* 873 */
-   void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 874 */
-   void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 875 */
-   void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 876 */
-   void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 877 */
-   void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 878 */
-   void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 879 */
-   void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 880 */
+   void (GLAPIENTRYP ClearDepthf)(GLclampf depth); /* 600 */
+   void (GLAPIENTRYP DepthRangef)(GLclampf zNear, GLclampf zFar); /* 601 */
+   void (GLAPIENTRYP GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); /* 602 */
+   void (GLAPIENTRYP ReleaseShaderCompiler)(void); /* 603 */
+   void (GLAPIENTRYP ShaderBinary)(GLsizei n, const GLuint * shaders, GLenum binaryformat, const GLvoid * binary, GLsizei length); /* 604 */
+   void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 605 */
+   void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 606 */
+   void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 607 */
+   void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 608 */
+   void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 609 */
+   void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 610 */
+   void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 611 */
+   void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 612 */
+   void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 613 */
+   void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 614 */
+   void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 615 */
+   void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 616 */
+   void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 617 */
+   void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 618 */
+   void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 619 */
+   void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 620 */
+   void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 621 */
+   void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 622 */
+   void (GLAPIENTRYP UnlockArraysEXT)(void); /* 623 */
+   void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 624 */
+   void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 625 */
+   void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 626 */
+   void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 627 */
+   void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 628 */
+   void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 629 */
+   void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 630 */
+   void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 631 */
+   void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 632 */
+   void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 633 */
+   void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 634 */
+   void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 635 */
+   void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 636 */
+   void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 637 */
+   void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 638 */
+   void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 639 */
+   void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 640 */
+   void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 641 */
+   void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 642 */
+   void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 643 */
+   void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 644 */
+   void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 645 */
+   void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 646 */
+   void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 647 */
+   void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 648 */
+   void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 649 */
+   void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 650 */
+   void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 651 */
+   void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 652 */
+   void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 653 */
+   void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 654 */
+   void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 655 */
+   void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 656 */
+   void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 657 */
+   void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 658 */
+   void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 659 */
+   void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 660 */
+   void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 661 */
+   void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 662 */
+   void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 663 */
+   void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 664 */
+   void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 665 */
+   void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 666 */
+   void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 667 */
+   void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 668 */
+   void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 669 */
+   void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 670 */
+   void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 671 */
+   void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 672 */
+   void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 673 */
+   void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 674 */
+   void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 675 */
+   void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 676 */
+   void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 677 */
+   void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 678 */
+   void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 679 */
+   void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 680 */
+   void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 681 */
+   void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 682 */
+   void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 683 */
+   void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 684 */
+   void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 685 */
+   void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 686 */
+   void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 687 */
+   void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 688 */
+   void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 689 */
+   void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 690 */
+   void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 691 */
+   void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 692 */
+   void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 693 */
+   void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 694 */
+   void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 695 */
+   GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 696 */
+   void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 697 */
+   GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 698 */
+   GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 699 */
+   void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 700 */
+   void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 701 */
+   void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 702 */
+   void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 703 */
+   void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 704 */
+   void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 705 */
+   void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 706 */
+   void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 707 */
+   void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 708 */
+   void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 709 */
+   void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 710 */
+   void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 711 */
+   void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 712 */
+   GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 713 */
+   void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 714 */
+   void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLsizei num, const GLdouble * params); /* 715 */
+   void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLsizei num, const GLfloat * params); /* 716 */
+   void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 717 */
+   void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 718 */
+   void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 719 */
+   void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 720 */
+   void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 721 */
+   void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 722 */
+   void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 723 */
+   void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 724 */
+   void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 725 */
+   void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 726 */
+   void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 727 */
+   void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 728 */
+   void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 729 */
+   void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 730 */
+   void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 731 */
+   void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 732 */
+   void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 733 */
+   void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 734 */
+   void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 735 */
+   void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 736 */
+   void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 737 */
+   void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 738 */
+   void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 739 */
+   void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 740 */
+   void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 741 */
+   void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 742 */
+   void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 743 */
+   void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 744 */
+   void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 745 */
+   void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 746 */
+   void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 747 */
+   void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 748 */
+   void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 749 */
+   void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 750 */
+   void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 751 */
+   void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 752 */
+   void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 753 */
+   void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 754 */
+   void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 755 */
+   void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 756 */
+   void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 757 */
+   void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 758 */
+   void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 759 */
+   void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 760 */
+   void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 761 */
+   void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 762 */
+   void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 763 */
+   void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 764 */
+   void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 765 */
+   void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 766 */
+   void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 767 */
+   void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 768 */
+   void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 769 */
+   void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 770 */
+   void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 771 */
+   void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 772 */
+   GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 773 */
+   void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 774 */
+   void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 775 */
+   void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 776 */
+   void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 777 */
+   void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 778 */
+   void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 779 */
+   void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 780 */
+   void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 781 */
+   void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 782 */
+   GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 783 */
+   void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 784 */
+   void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 785 */
+   void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 786 */
+   void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 787 */
+   void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 788 */
+   void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 789 */
+   void (GLAPIENTRYP PrimitiveRestartIndexNV)(GLuint index); /* 790 */
+   void (GLAPIENTRYP PrimitiveRestartNV)(void); /* 791 */
+   void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 792 */
+   void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 793 */
+   void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 794 */
+   void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 795 */
+   GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 796 */
+   void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 797 */
+   void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 798 */
+   void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 799 */
+   void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 800 */
+   void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 801 */
+   void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 802 */
+   void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 803 */
+   void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 804 */
+   void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 805 */
+   void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 806 */
+   void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 807 */
+   GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 808 */
+   GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 809 */
+   void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 810 */
+   void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 811 */
+   void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 812 */
+   void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 813 */
+   void (GLAPIENTRYP BindFragDataLocationEXT)(GLuint program, GLuint colorNumber, const GLchar * name); /* 814 */
+   GLint (GLAPIENTRYP GetFragDataLocationEXT)(GLuint program, const GLchar * name); /* 815 */
+   void (GLAPIENTRYP GetUniformuivEXT)(GLuint program, GLint location, GLuint * params); /* 816 */
+   void (GLAPIENTRYP GetVertexAttribIivEXT)(GLuint index, GLenum pname, GLint * params); /* 817 */
+   void (GLAPIENTRYP GetVertexAttribIuivEXT)(GLuint index, GLenum pname, GLuint * params); /* 818 */
+   void (GLAPIENTRYP Uniform1uiEXT)(GLint location, GLuint x); /* 819 */
+   void (GLAPIENTRYP Uniform1uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 820 */
+   void (GLAPIENTRYP Uniform2uiEXT)(GLint location, GLuint x, GLuint y); /* 821 */
+   void (GLAPIENTRYP Uniform2uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 822 */
+   void (GLAPIENTRYP Uniform3uiEXT)(GLint location, GLuint x, GLuint y, GLuint z); /* 823 */
+   void (GLAPIENTRYP Uniform3uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 824 */
+   void (GLAPIENTRYP Uniform4uiEXT)(GLint location, GLuint x, GLuint y, GLuint z, GLuint w); /* 825 */
+   void (GLAPIENTRYP Uniform4uivEXT)(GLint location, GLsizei count, const GLuint * value); /* 826 */
+   void (GLAPIENTRYP VertexAttribI1iEXT)(GLuint index, GLint x); /* 827 */
+   void (GLAPIENTRYP VertexAttribI1ivEXT)(GLuint index, const GLint * v); /* 828 */
+   void (GLAPIENTRYP VertexAttribI1uiEXT)(GLuint index, GLuint x); /* 829 */
+   void (GLAPIENTRYP VertexAttribI1uivEXT)(GLuint index, const GLuint * v); /* 830 */
+   void (GLAPIENTRYP VertexAttribI2iEXT)(GLuint index, GLint x, GLint y); /* 831 */
+   void (GLAPIENTRYP VertexAttribI2ivEXT)(GLuint index, const GLint * v); /* 832 */
+   void (GLAPIENTRYP VertexAttribI2uiEXT)(GLuint index, GLuint x, GLuint y); /* 833 */
+   void (GLAPIENTRYP VertexAttribI2uivEXT)(GLuint index, const GLuint * v); /* 834 */
+   void (GLAPIENTRYP VertexAttribI3iEXT)(GLuint index, GLint x, GLint y, GLint z); /* 835 */
+   void (GLAPIENTRYP VertexAttribI3ivEXT)(GLuint index, const GLint * v); /* 836 */
+   void (GLAPIENTRYP VertexAttribI3uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z); /* 837 */
+   void (GLAPIENTRYP VertexAttribI3uivEXT)(GLuint index, const GLuint * v); /* 838 */
+   void (GLAPIENTRYP VertexAttribI4bvEXT)(GLuint index, const GLbyte * v); /* 839 */
+   void (GLAPIENTRYP VertexAttribI4iEXT)(GLuint index, GLint x, GLint y, GLint z, GLint w); /* 840 */
+   void (GLAPIENTRYP VertexAttribI4ivEXT)(GLuint index, const GLint * v); /* 841 */
+   void (GLAPIENTRYP VertexAttribI4svEXT)(GLuint index, const GLshort * v); /* 842 */
+   void (GLAPIENTRYP VertexAttribI4ubvEXT)(GLuint index, const GLubyte * v); /* 843 */
+   void (GLAPIENTRYP VertexAttribI4uiEXT)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); /* 844 */
+   void (GLAPIENTRYP VertexAttribI4uivEXT)(GLuint index, const GLuint * v); /* 845 */
+   void (GLAPIENTRYP VertexAttribI4usvEXT)(GLuint index, const GLushort * v); /* 846 */
+   void (GLAPIENTRYP VertexAttribIPointerEXT)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 847 */
+   void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 848 */
+   void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 849 */
+   void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 850 */
+   void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 851 */
+   void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 852 */
+   void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 853 */
+   GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 854 */
+   void (GLAPIENTRYP ClearColorIiEXT)(GLint r, GLint g, GLint b, GLint a); /* 855 */
+   void (GLAPIENTRYP ClearColorIuiEXT)(GLuint r, GLuint g, GLuint b, GLuint a); /* 856 */
+   void (GLAPIENTRYP GetTexParameterIivEXT)(GLenum target, GLenum pname, GLint * params); /* 857 */
+   void (GLAPIENTRYP GetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint * params); /* 858 */
+   void (GLAPIENTRYP TexParameterIivEXT)(GLenum target, GLenum pname, const GLint * params); /* 859 */
+   void (GLAPIENTRYP TexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint * params); /* 860 */
+   void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 861 */
+   void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 862 */
+   void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 863 */
+   void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 864 */
+   void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 865 */
+   void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 866 */
+   void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 867 */
+   void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 868 */
+   void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 869 */
+   void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 870 */
+   void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 871 */
+   void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 872 */
+   void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 873 */
+   GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 874 */
+   GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 875 */
+   void (GLAPIENTRYP ActiveProgramEXT)(GLuint program); /* 876 */
+   GLuint (GLAPIENTRYP CreateShaderProgramEXT)(GLenum type, const GLchar * string); /* 877 */
+   void (GLAPIENTRYP UseShaderProgramEXT)(GLenum type, GLuint program); /* 878 */
+   void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 879 */
+   void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 880 */
+   void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 881 */
+   void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 882 */
+   void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 883 */
+   void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 884 */
+   void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 885 */
 };
 
 #endif /* !defined( _GLAPI_TABLE_H_ ) */
index cf844dc90c5343fca8e276cb8e5c57d3dd018bbc..2ccb29978ba8597345ff1ac5c75445d7a9ebf918 100644 (file)
@@ -4062,63 +4062,88 @@ KEYWORD1 void KEYWORD2 NAME(ResumeTransformFeedback)(void)
    DISPATCH(ResumeTransformFeedback, (), (F, "glResumeTransformFeedback();\n"));
 }
 
+KEYWORD1 void KEYWORD2 NAME(ClearDepthf)(GLclampf depth)
+{
+   DISPATCH(ClearDepthf, (depth), (F, "glClearDepthf(%f);\n", depth));
+}
+
+KEYWORD1 void KEYWORD2 NAME(DepthRangef)(GLclampf zNear, GLclampf zFar)
+{
+   DISPATCH(DepthRangef, (zNear, zFar), (F, "glDepthRangef(%f, %f);\n", zNear, zFar));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision)
+{
+   DISPATCH(GetShaderPrecisionFormat, (shadertype, precisiontype, range, precision), (F, "glGetShaderPrecisionFormat(0x%x, 0x%x, %p, %p);\n", shadertype, precisiontype, (const void *) range, (const void *) precision));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ReleaseShaderCompiler)(void)
+{
+   DISPATCH(ReleaseShaderCompiler, (), (F, "glReleaseShaderCompiler();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(ShaderBinary)(GLsizei n, const GLuint * shaders, GLenum binaryformat, const GLvoid * binary, GLsizei length)
+{
+   DISPATCH(ShaderBinary, (n, shaders, binaryformat, binary, length), (F, "glShaderBinary(%d, %p, 0x%x, %p, %d);\n", n, (const void *) shaders, binaryformat, (const void *) binary, length));
+}
+
 KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias)
 {
    DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_601)(GLenum pname, GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_606)(GLenum pname, GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_601)(GLenum pname, GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_606)(GLenum pname, GLfloat * params)
 {
    DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_602)(GLenum pname, GLint * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_607)(GLenum pname, GLint * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_602)(GLenum pname, GLint * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_607)(GLenum pname, GLint * params)
 {
    DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_603)(GLenum pname, GLfloat param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pname, GLfloat param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_603)(GLenum pname, GLfloat param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pname, GLfloat param)
 {
    DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_604)(GLenum pname, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum pname, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_604)(GLenum pname, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum pname, const GLfloat * params)
 {
    DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_605)(GLenum pname, GLint param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_610)(GLenum pname, GLint param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_605)(GLenum pname, GLint param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_610)(GLenum pname, GLint param)
 {
    DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_606)(GLenum pname, const GLint * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_611)(GLenum pname, const GLint * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_606)(GLenum pname, const GLint * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_611)(GLenum pname, const GLint * params)
 {
    DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_607)(GLclampf value, GLboolean invert);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_612)(GLclampf value, GLboolean invert);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_607)(GLclampf value, GLboolean invert)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_612)(GLclampf value, GLboolean invert)
 {
    DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pattern);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_613)(GLenum pattern);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pattern)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_613)(GLenum pattern)
 {
    DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern));
 }
@@ -4168,9 +4193,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param)
    DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_615)(GLenum pname, GLfloat param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_620)(GLenum pname, GLfloat param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_615)(GLenum pname, GLfloat param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_620)(GLenum pname, GLfloat param)
 {
    DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param));
 }
@@ -4190,9 +4215,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * p
    DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_616)(GLenum pname, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_621)(GLenum pname, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_616)(GLenum pname, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_621)(GLenum pname, const GLfloat * params)
 {
    DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params));
 }
@@ -4447,9 +4472,9 @@ KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord)
    DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_643)(GLenum mode);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_648)(GLenum mode);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_643)(GLenum mode)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_648)(GLenum mode)
 {
    DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode));
 }
@@ -4464,9 +4489,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfac
    DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_644)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_649)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_644)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_649)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
 {
    DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha));
 }
@@ -4831,65 +4856,65 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v)
    DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_685)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_690)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_685)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_690)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride)
 {
    DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_686)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_691)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_686)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_691)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride)
 {
    DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_687)(GLsizei n, const GLuint * fences);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_692)(GLsizei n, const GLuint * fences);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_687)(GLsizei n, const GLuint * fences)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_692)(GLsizei n, const GLuint * fences)
 {
    DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_688)(GLuint fence);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_693)(GLuint fence);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_688)(GLuint fence)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_693)(GLuint fence)
 {
    DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_689)(GLsizei n, GLuint * fences);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_694)(GLsizei n, GLuint * fences);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_689)(GLsizei n, GLuint * fences)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_694)(GLsizei n, GLuint * fences)
 {
    DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_690)(GLuint fence, GLenum pname, GLint * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_695)(GLuint fence, GLenum pname, GLint * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_690)(GLuint fence, GLenum pname, GLint * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_695)(GLuint fence, GLenum pname, GLint * params)
 {
    DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params));
 }
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_691)(GLuint fence);
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_696)(GLuint fence);
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_691)(GLuint fence)
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_696)(GLuint fence)
 {
    RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_692)(GLuint fence, GLenum condition);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_697)(GLuint fence, GLenum condition);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_692)(GLuint fence, GLenum condition)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_697)(GLuint fence, GLenum condition)
 {
    DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition));
 }
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_693)(GLuint fence);
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_698)(GLuint fence);
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_693)(GLuint fence)
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_698)(GLuint fence)
 {
    RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence));
 }
@@ -5334,16 +5359,16 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * para
    DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLenum face);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_779)(GLenum face);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLenum face)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_779)(GLenum face)
 {
    DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLuint array);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_780)(GLuint array);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLuint array)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_780)(GLuint array)
 {
    DISPATCH(BindVertexArrayAPPLE, (array), (F, "glBindVertexArrayAPPLE(%d);\n", array));
 }
@@ -5353,16 +5378,16 @@ KEYWORD1 void KEYWORD2 NAME(DeleteVertexArrays)(GLsizei n, const GLuint * arrays
    DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArrays(%d, %p);\n", n, (const void *) arrays));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLsizei n, const GLuint * arrays);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_781)(GLsizei n, const GLuint * arrays);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLsizei n, const GLuint * arrays)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_781)(GLsizei n, const GLuint * arrays)
 {
    DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLsizei n, GLuint * arrays);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_782)(GLsizei n, GLuint * arrays);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLsizei n, GLuint * arrays)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_782)(GLsizei n, GLuint * arrays)
 {
    DISPATCH(GenVertexArraysAPPLE, (n, arrays), (F, "glGenVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays));
 }
@@ -5372,9 +5397,9 @@ KEYWORD1 GLboolean KEYWORD2 NAME(IsVertexArray)(GLuint array)
    RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArray(%d);\n", array));
 }
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_778)(GLuint array);
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_783)(GLuint array);
 
-KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_778)(GLuint array)
+KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_783)(GLuint array)
 {
    RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArrayAPPLE(%d);\n", array));
 }
@@ -5424,9 +5449,9 @@ KEYWORD1 void KEYWORD2 NAME(PrimitiveRestartNV)(void)
    DISPATCH(PrimitiveRestartNV, (), (F, "glPrimitiveRestartNV();\n"));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_787)(GLclampd zmin, GLclampd zmax);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_792)(GLclampd zmin, GLclampd zmax);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_787)(GLclampd zmin, GLclampd zmax)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_792)(GLclampd zmin, GLclampd zmax)
 {
    DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax));
 }
@@ -5436,9 +5461,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA)
    DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparate(0x%x, 0x%x);\n", modeRGB, modeA));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_788)(GLenum modeRGB, GLenum modeA);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_793)(GLenum modeRGB, GLenum modeA);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_788)(GLenum modeRGB, GLenum modeA)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_793)(GLenum modeRGB, GLenum modeA)
 {
    DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA));
 }
@@ -5618,23 +5643,23 @@ KEYWORD1 void KEYWORD2 NAME(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint src
    DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_806)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_811)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_806)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_811)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
 {
    DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_807)(GLenum target, GLenum pname, GLint param);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_812)(GLenum target, GLenum pname, GLint param);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_807)(GLenum target, GLenum pname, GLint param)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_812)(GLenum target, GLenum pname, GLint param)
 {
    DISPATCH(BufferParameteriAPPLE, (target, pname, param), (F, "glBufferParameteriAPPLE(0x%x, 0x%x, %d);\n", target, pname, param));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_808)(GLenum target, GLintptr offset, GLsizeiptr size);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_813)(GLenum target, GLintptr offset, GLsizeiptr size);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_808)(GLenum target, GLintptr offset, GLsizeiptr size)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_813)(GLenum target, GLintptr offset, GLsizeiptr size)
 {
    DISPATCH(FlushMappedBufferRangeAPPLE, (target, offset, size), (F, "glFlushMappedBufferRangeAPPLE(0x%x, %d, %d);\n", target, offset, size));
 }
@@ -6194,16 +6219,16 @@ KEYWORD1 void KEYWORD2 NAME(ProvokingVertex)(GLenum mode)
    DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertex(0x%x);\n", mode));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_866)(GLenum target, GLenum pname, GLvoid ** params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_871)(GLenum target, GLenum pname, GLvoid ** params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_866)(GLenum target, GLenum pname, GLvoid ** params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_871)(GLenum target, GLenum pname, GLvoid ** params)
 {
    DISPATCH(GetTexParameterPointervAPPLE, (target, pname, params), (F, "glGetTexParameterPointervAPPLE(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_867)(GLenum target, GLsizei length, GLvoid * pointer);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_872)(GLenum target, GLsizei length, GLvoid * pointer);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_867)(GLenum target, GLsizei length, GLvoid * pointer)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_872)(GLenum target, GLsizei length, GLvoid * pointer)
 {
    DISPATCH(TextureRangeAPPLE, (target, length, pointer), (F, "glTextureRangeAPPLE(0x%x, %d, %p);\n", target, length, (const void *) pointer));
 }
@@ -6238,37 +6263,37 @@ KEYWORD1 void KEYWORD2 NAME(UseShaderProgramEXT)(GLenum type, GLuint program)
    DISPATCH(UseShaderProgramEXT, (type, program), (F, "glUseShaderProgramEXT(0x%x, %d);\n", type, program));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_874)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_879)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_874)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_879)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)
 {
    DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_875)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_880)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_875)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_880)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
 {
    DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_876)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_881)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_876)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_881)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
 {
    DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_877)(GLuint id, GLenum pname, GLint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_882)(GLuint id, GLenum pname, GLint64EXT * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_877)(GLuint id, GLenum pname, GLint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_882)(GLuint id, GLenum pname, GLint64EXT * params)
 {
    DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params));
 }
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_878)(GLuint id, GLenum pname, GLuint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_883)(GLuint id, GLenum pname, GLuint64EXT * params);
 
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_878)(GLuint id, GLenum pname, GLuint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_883)(GLuint id, GLenum pname, GLuint64EXT * params)
 {
    DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params));
 }
@@ -7036,15 +7061,20 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(IsTransformFeedback),
    TABLE_ENTRY(PauseTransformFeedback),
    TABLE_ENTRY(ResumeTransformFeedback),
+   TABLE_ENTRY(ClearDepthf),
+   TABLE_ENTRY(DepthRangef),
+   TABLE_ENTRY(GetShaderPrecisionFormat),
+   TABLE_ENTRY(ReleaseShaderCompiler),
+   TABLE_ENTRY(ShaderBinary),
    TABLE_ENTRY(PolygonOffsetEXT),
-   TABLE_ENTRY(_dispatch_stub_601),
-   TABLE_ENTRY(_dispatch_stub_602),
-   TABLE_ENTRY(_dispatch_stub_603),
-   TABLE_ENTRY(_dispatch_stub_604),
-   TABLE_ENTRY(_dispatch_stub_605),
    TABLE_ENTRY(_dispatch_stub_606),
    TABLE_ENTRY(_dispatch_stub_607),
    TABLE_ENTRY(_dispatch_stub_608),
+   TABLE_ENTRY(_dispatch_stub_609),
+   TABLE_ENTRY(_dispatch_stub_610),
+   TABLE_ENTRY(_dispatch_stub_611),
+   TABLE_ENTRY(_dispatch_stub_612),
+   TABLE_ENTRY(_dispatch_stub_613),
    TABLE_ENTRY(ColorPointerEXT),
    TABLE_ENTRY(EdgeFlagPointerEXT),
    TABLE_ENTRY(IndexPointerEXT),
@@ -7079,7 +7109,7 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(FogCoorddvEXT),
    TABLE_ENTRY(FogCoordfEXT),
    TABLE_ENTRY(FogCoordfvEXT),
-   TABLE_ENTRY(_dispatch_stub_643),
+   TABLE_ENTRY(_dispatch_stub_648),
    TABLE_ENTRY(BlendFuncSeparateEXT),
    TABLE_ENTRY(FlushVertexArrayRangeNV),
    TABLE_ENTRY(VertexArrayRangeNV),
@@ -7121,15 +7151,15 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(WindowPos4ivMESA),
    TABLE_ENTRY(WindowPos4sMESA),
    TABLE_ENTRY(WindowPos4svMESA),
-   TABLE_ENTRY(_dispatch_stub_685),
-   TABLE_ENTRY(_dispatch_stub_686),
-   TABLE_ENTRY(_dispatch_stub_687),
-   TABLE_ENTRY(_dispatch_stub_688),
-   TABLE_ENTRY(_dispatch_stub_689),
    TABLE_ENTRY(_dispatch_stub_690),
    TABLE_ENTRY(_dispatch_stub_691),
    TABLE_ENTRY(_dispatch_stub_692),
    TABLE_ENTRY(_dispatch_stub_693),
+   TABLE_ENTRY(_dispatch_stub_694),
+   TABLE_ENTRY(_dispatch_stub_695),
+   TABLE_ENTRY(_dispatch_stub_696),
+   TABLE_ENTRY(_dispatch_stub_697),
+   TABLE_ENTRY(_dispatch_stub_698),
    TABLE_ENTRY(AreProgramsResidentNV),
    TABLE_ENTRY(BindProgramNV),
    TABLE_ENTRY(DeleteProgramsNV),
@@ -7210,11 +7240,11 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(SetFragmentShaderConstantATI),
    TABLE_ENTRY(PointParameteriNV),
    TABLE_ENTRY(PointParameterivNV),
-   TABLE_ENTRY(_dispatch_stub_774),
-   TABLE_ENTRY(_dispatch_stub_775),
-   TABLE_ENTRY(_dispatch_stub_776),
-   TABLE_ENTRY(_dispatch_stub_777),
-   TABLE_ENTRY(_dispatch_stub_778),
+   TABLE_ENTRY(_dispatch_stub_779),
+   TABLE_ENTRY(_dispatch_stub_780),
+   TABLE_ENTRY(_dispatch_stub_781),
+   TABLE_ENTRY(_dispatch_stub_782),
+   TABLE_ENTRY(_dispatch_stub_783),
    TABLE_ENTRY(GetProgramNamedParameterdvNV),
    TABLE_ENTRY(GetProgramNamedParameterfvNV),
    TABLE_ENTRY(ProgramNamedParameter4dNV),
@@ -7223,8 +7253,8 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(ProgramNamedParameter4fvNV),
    TABLE_ENTRY(PrimitiveRestartIndexNV),
    TABLE_ENTRY(PrimitiveRestartNV),
-   TABLE_ENTRY(_dispatch_stub_787),
-   TABLE_ENTRY(_dispatch_stub_788),
+   TABLE_ENTRY(_dispatch_stub_792),
+   TABLE_ENTRY(_dispatch_stub_793),
    TABLE_ENTRY(BindFramebufferEXT),
    TABLE_ENTRY(BindRenderbufferEXT),
    TABLE_ENTRY(CheckFramebufferStatusEXT),
@@ -7242,9 +7272,9 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(IsFramebufferEXT),
    TABLE_ENTRY(IsRenderbufferEXT),
    TABLE_ENTRY(RenderbufferStorageEXT),
-   TABLE_ENTRY(_dispatch_stub_806),
-   TABLE_ENTRY(_dispatch_stub_807),
-   TABLE_ENTRY(_dispatch_stub_808),
+   TABLE_ENTRY(_dispatch_stub_811),
+   TABLE_ENTRY(_dispatch_stub_812),
+   TABLE_ENTRY(_dispatch_stub_813),
    TABLE_ENTRY(BindFragDataLocationEXT),
    TABLE_ENTRY(GetFragDataLocationEXT),
    TABLE_ENTRY(GetUniformuivEXT),
@@ -7302,19 +7332,19 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
    TABLE_ENTRY(GetTransformFeedbackVaryingEXT),
    TABLE_ENTRY(TransformFeedbackVaryingsEXT),
    TABLE_ENTRY(ProvokingVertexEXT),
-   TABLE_ENTRY(_dispatch_stub_866),
-   TABLE_ENTRY(_dispatch_stub_867),
+   TABLE_ENTRY(_dispatch_stub_871),
+   TABLE_ENTRY(_dispatch_stub_872),
    TABLE_ENTRY(GetObjectParameterivAPPLE),
    TABLE_ENTRY(ObjectPurgeableAPPLE),
    TABLE_ENTRY(ObjectUnpurgeableAPPLE),
    TABLE_ENTRY(ActiveProgramEXT),
    TABLE_ENTRY(CreateShaderProgramEXT),
    TABLE_ENTRY(UseShaderProgramEXT),
-   TABLE_ENTRY(_dispatch_stub_874),
-   TABLE_ENTRY(_dispatch_stub_875),
-   TABLE_ENTRY(_dispatch_stub_876),
-   TABLE_ENTRY(_dispatch_stub_877),
-   TABLE_ENTRY(_dispatch_stub_878),
+   TABLE_ENTRY(_dispatch_stub_879),
+   TABLE_ENTRY(_dispatch_stub_880),
+   TABLE_ENTRY(_dispatch_stub_881),
+   TABLE_ENTRY(_dispatch_stub_882),
+   TABLE_ENTRY(_dispatch_stub_883),
    TABLE_ENTRY(EGLImageTargetRenderbufferStorageOES),
    TABLE_ENTRY(EGLImageTargetTexture2DOES),
    /* A whole bunch of no-op functions.  These might be called
@@ -7621,10 +7651,10 @@ _glapi_proc UNUSED_TABLE_NAME[] = {
    TABLE_ENTRY(RenderbufferStorageMultisampleEXT),
    TABLE_ENTRY(PointParameterf),
    TABLE_ENTRY(PointParameterfARB),
-   TABLE_ENTRY(_dispatch_stub_615),
+   TABLE_ENTRY(_dispatch_stub_620),
    TABLE_ENTRY(PointParameterfv),
    TABLE_ENTRY(PointParameterfvARB),
-   TABLE_ENTRY(_dispatch_stub_616),
+   TABLE_ENTRY(_dispatch_stub_621),
    TABLE_ENTRY(SecondaryColor3b),
    TABLE_ENTRY(SecondaryColor3bv),
    TABLE_ENTRY(SecondaryColor3d),
@@ -7650,7 +7680,7 @@ _glapi_proc UNUSED_TABLE_NAME[] = {
    TABLE_ENTRY(FogCoordf),
    TABLE_ENTRY(FogCoordfv),
    TABLE_ENTRY(BlendFuncSeparate),
-   TABLE_ENTRY(_dispatch_stub_644),
+   TABLE_ENTRY(_dispatch_stub_649),
    TABLE_ENTRY(WindowPos2d),
    TABLE_ENTRY(WindowPos2dARB),
    TABLE_ENTRY(WindowPos2dv),
index c0a98e622a29aef4cb71a3b52609dbda41c6104a..315847e7573691bf56758c1543bc310566b45143 100644 (file)
@@ -652,6 +652,11 @@ static const char gl_string_table[] =
     "glIsTransformFeedback\0"
     "glPauseTransformFeedback\0"
     "glResumeTransformFeedback\0"
+    "glClearDepthf\0"
+    "glDepthRangef\0"
+    "glGetShaderPrecisionFormat\0"
+    "glReleaseShaderCompiler\0"
+    "glShaderBinary\0"
     "glPolygonOffsetEXT\0"
     "glGetPixelTexGenParameterfvSGIS\0"
     "glGetPixelTexGenParameterivSGIS\0"
@@ -1309,41 +1314,41 @@ static const char gl_string_table[] =
 #define gl_dispatch_stub_364 mgl_dispatch_stub_364
 #define gl_dispatch_stub_365 mgl_dispatch_stub_365
 #define gl_dispatch_stub_366 mgl_dispatch_stub_366
-#define gl_dispatch_stub_601 mgl_dispatch_stub_601
-#define gl_dispatch_stub_602 mgl_dispatch_stub_602
-#define gl_dispatch_stub_603 mgl_dispatch_stub_603
-#define gl_dispatch_stub_604 mgl_dispatch_stub_604
-#define gl_dispatch_stub_605 mgl_dispatch_stub_605
 #define gl_dispatch_stub_606 mgl_dispatch_stub_606
 #define gl_dispatch_stub_607 mgl_dispatch_stub_607
 #define gl_dispatch_stub_608 mgl_dispatch_stub_608
-#define gl_dispatch_stub_643 mgl_dispatch_stub_643
-#define gl_dispatch_stub_685 mgl_dispatch_stub_685
-#define gl_dispatch_stub_686 mgl_dispatch_stub_686
-#define gl_dispatch_stub_687 mgl_dispatch_stub_687
-#define gl_dispatch_stub_688 mgl_dispatch_stub_688
-#define gl_dispatch_stub_689 mgl_dispatch_stub_689
+#define gl_dispatch_stub_609 mgl_dispatch_stub_609
+#define gl_dispatch_stub_610 mgl_dispatch_stub_610
+#define gl_dispatch_stub_611 mgl_dispatch_stub_611
+#define gl_dispatch_stub_612 mgl_dispatch_stub_612
+#define gl_dispatch_stub_613 mgl_dispatch_stub_613
+#define gl_dispatch_stub_648 mgl_dispatch_stub_648
 #define gl_dispatch_stub_690 mgl_dispatch_stub_690
 #define gl_dispatch_stub_691 mgl_dispatch_stub_691
 #define gl_dispatch_stub_692 mgl_dispatch_stub_692
 #define gl_dispatch_stub_693 mgl_dispatch_stub_693
-#define gl_dispatch_stub_774 mgl_dispatch_stub_774
-#define gl_dispatch_stub_775 mgl_dispatch_stub_775
-#define gl_dispatch_stub_776 mgl_dispatch_stub_776
-#define gl_dispatch_stub_777 mgl_dispatch_stub_777
-#define gl_dispatch_stub_778 mgl_dispatch_stub_778
-#define gl_dispatch_stub_787 mgl_dispatch_stub_787
-#define gl_dispatch_stub_788 mgl_dispatch_stub_788
-#define gl_dispatch_stub_806 mgl_dispatch_stub_806
-#define gl_dispatch_stub_807 mgl_dispatch_stub_807
-#define gl_dispatch_stub_808 mgl_dispatch_stub_808
-#define gl_dispatch_stub_866 mgl_dispatch_stub_866
-#define gl_dispatch_stub_867 mgl_dispatch_stub_867
-#define gl_dispatch_stub_874 mgl_dispatch_stub_874
-#define gl_dispatch_stub_875 mgl_dispatch_stub_875
-#define gl_dispatch_stub_876 mgl_dispatch_stub_876
-#define gl_dispatch_stub_877 mgl_dispatch_stub_877
-#define gl_dispatch_stub_878 mgl_dispatch_stub_878
+#define gl_dispatch_stub_694 mgl_dispatch_stub_694
+#define gl_dispatch_stub_695 mgl_dispatch_stub_695
+#define gl_dispatch_stub_696 mgl_dispatch_stub_696
+#define gl_dispatch_stub_697 mgl_dispatch_stub_697
+#define gl_dispatch_stub_698 mgl_dispatch_stub_698
+#define gl_dispatch_stub_779 mgl_dispatch_stub_779
+#define gl_dispatch_stub_780 mgl_dispatch_stub_780
+#define gl_dispatch_stub_781 mgl_dispatch_stub_781
+#define gl_dispatch_stub_782 mgl_dispatch_stub_782
+#define gl_dispatch_stub_783 mgl_dispatch_stub_783
+#define gl_dispatch_stub_792 mgl_dispatch_stub_792
+#define gl_dispatch_stub_793 mgl_dispatch_stub_793
+#define gl_dispatch_stub_811 mgl_dispatch_stub_811
+#define gl_dispatch_stub_812 mgl_dispatch_stub_812
+#define gl_dispatch_stub_813 mgl_dispatch_stub_813
+#define gl_dispatch_stub_871 mgl_dispatch_stub_871
+#define gl_dispatch_stub_872 mgl_dispatch_stub_872
+#define gl_dispatch_stub_879 mgl_dispatch_stub_879
+#define gl_dispatch_stub_880 mgl_dispatch_stub_880
+#define gl_dispatch_stub_881 mgl_dispatch_stub_881
+#define gl_dispatch_stub_882 mgl_dispatch_stub_882
+#define gl_dispatch_stub_883 mgl_dispatch_stub_883
 #endif /* USE_MGL_NAMESPACE */
 
 
@@ -1361,41 +1366,41 @@ void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params
 void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);
 void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params);
 void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_601(GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_602(GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_603(GLenum pname, GLfloat param);
-void GLAPIENTRY gl_dispatch_stub_604(GLenum pname, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_605(GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_606(GLenum pname, const GLint * params);
-void GLAPIENTRY gl_dispatch_stub_607(GLclampf value, GLboolean invert);
-void GLAPIENTRY gl_dispatch_stub_608(GLenum pattern);
-void GLAPIENTRY gl_dispatch_stub_643(GLenum mode);
-void GLAPIENTRY gl_dispatch_stub_685(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_686(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_687(GLsizei n, const GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_688(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_689(GLsizei n, GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_690(GLuint fence, GLenum pname, GLint * params);
-GLboolean GLAPIENTRY gl_dispatch_stub_691(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_692(GLuint fence, GLenum condition);
-GLboolean GLAPIENTRY gl_dispatch_stub_693(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_774(GLenum face);
-void GLAPIENTRY gl_dispatch_stub_775(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_776(GLsizei n, const GLuint * arrays);
-void GLAPIENTRY gl_dispatch_stub_777(GLsizei n, GLuint * arrays);
-GLboolean GLAPIENTRY gl_dispatch_stub_778(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_787(GLclampd zmin, GLclampd zmax);
-void GLAPIENTRY gl_dispatch_stub_788(GLenum modeRGB, GLenum modeA);
-void GLAPIENTRY gl_dispatch_stub_806(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-void GLAPIENTRY gl_dispatch_stub_807(GLenum target, GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_808(GLenum target, GLintptr offset, GLsizeiptr size);
-void GLAPIENTRY gl_dispatch_stub_866(GLenum target, GLenum pname, GLvoid ** params);
-void GLAPIENTRY gl_dispatch_stub_867(GLenum target, GLsizei length, GLvoid * pointer);
-void GLAPIENTRY gl_dispatch_stub_874(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-void GLAPIENTRY gl_dispatch_stub_875(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_876(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_877(GLuint id, GLenum pname, GLint64EXT * params);
-void GLAPIENTRY gl_dispatch_stub_878(GLuint id, GLenum pname, GLuint64EXT * params);
+void GLAPIENTRY gl_dispatch_stub_606(GLenum pname, GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_607(GLenum pname, GLint * params);
+void GLAPIENTRY gl_dispatch_stub_608(GLenum pname, GLfloat param);
+void GLAPIENTRY gl_dispatch_stub_609(GLenum pname, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_610(GLenum pname, GLint param);
+void GLAPIENTRY gl_dispatch_stub_611(GLenum pname, const GLint * params);
+void GLAPIENTRY gl_dispatch_stub_612(GLclampf value, GLboolean invert);
+void GLAPIENTRY gl_dispatch_stub_613(GLenum pattern);
+void GLAPIENTRY gl_dispatch_stub_648(GLenum mode);
+void GLAPIENTRY gl_dispatch_stub_690(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);
+void GLAPIENTRY gl_dispatch_stub_691(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride);
+void GLAPIENTRY gl_dispatch_stub_692(GLsizei n, const GLuint * fences);
+void GLAPIENTRY gl_dispatch_stub_693(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_694(GLsizei n, GLuint * fences);
+void GLAPIENTRY gl_dispatch_stub_695(GLuint fence, GLenum pname, GLint * params);
+GLboolean GLAPIENTRY gl_dispatch_stub_696(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_697(GLuint fence, GLenum condition);
+GLboolean GLAPIENTRY gl_dispatch_stub_698(GLuint fence);
+void GLAPIENTRY gl_dispatch_stub_779(GLenum face);
+void GLAPIENTRY gl_dispatch_stub_780(GLuint array);
+void GLAPIENTRY gl_dispatch_stub_781(GLsizei n, const GLuint * arrays);
+void GLAPIENTRY gl_dispatch_stub_782(GLsizei n, GLuint * arrays);
+GLboolean GLAPIENTRY gl_dispatch_stub_783(GLuint array);
+void GLAPIENTRY gl_dispatch_stub_792(GLclampd zmin, GLclampd zmax);
+void GLAPIENTRY gl_dispatch_stub_793(GLenum modeRGB, GLenum modeA);
+void GLAPIENTRY gl_dispatch_stub_811(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+void GLAPIENTRY gl_dispatch_stub_812(GLenum target, GLenum pname, GLint param);
+void GLAPIENTRY gl_dispatch_stub_813(GLenum target, GLintptr offset, GLsizeiptr size);
+void GLAPIENTRY gl_dispatch_stub_871(GLenum target, GLenum pname, GLvoid ** params);
+void GLAPIENTRY gl_dispatch_stub_872(GLenum target, GLsizei length, GLvoid * pointer);
+void GLAPIENTRY gl_dispatch_stub_879(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+void GLAPIENTRY gl_dispatch_stub_880(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_881(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_882(GLuint id, GLenum pname, GLint64EXT * params);
+void GLAPIENTRY gl_dispatch_stub_883(GLuint id, GLenum pname, GLuint64EXT * params);
 #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
 
 static const glprocs_table_t static_functions[] = {
@@ -1999,646 +2004,651 @@ static const glprocs_table_t static_functions[] = {
     NAME_FUNC_OFFSET( 9672, glIsTransformFeedback, glIsTransformFeedback, NULL, 597),
     NAME_FUNC_OFFSET( 9694, glPauseTransformFeedback, glPauseTransformFeedback, NULL, 598),
     NAME_FUNC_OFFSET( 9719, glResumeTransformFeedback, glResumeTransformFeedback, NULL, 599),
-    NAME_FUNC_OFFSET( 9745, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 600),
-    NAME_FUNC_OFFSET( 9764, gl_dispatch_stub_601, gl_dispatch_stub_601, NULL, 601),
-    NAME_FUNC_OFFSET( 9796, gl_dispatch_stub_602, gl_dispatch_stub_602, NULL, 602),
-    NAME_FUNC_OFFSET( 9828, gl_dispatch_stub_603, gl_dispatch_stub_603, NULL, 603),
-    NAME_FUNC_OFFSET( 9856, gl_dispatch_stub_604, gl_dispatch_stub_604, NULL, 604),
-    NAME_FUNC_OFFSET( 9885, gl_dispatch_stub_605, gl_dispatch_stub_605, NULL, 605),
-    NAME_FUNC_OFFSET( 9913, gl_dispatch_stub_606, gl_dispatch_stub_606, NULL, 606),
-    NAME_FUNC_OFFSET( 9942, gl_dispatch_stub_607, gl_dispatch_stub_607, NULL, 607),
-    NAME_FUNC_OFFSET( 9959, gl_dispatch_stub_608, gl_dispatch_stub_608, NULL, 608),
-    NAME_FUNC_OFFSET( 9979, glColorPointerEXT, glColorPointerEXT, NULL, 609),
-    NAME_FUNC_OFFSET( 9997, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, 610),
-    NAME_FUNC_OFFSET(10018, glIndexPointerEXT, glIndexPointerEXT, NULL, 611),
-    NAME_FUNC_OFFSET(10036, glNormalPointerEXT, glNormalPointerEXT, NULL, 612),
-    NAME_FUNC_OFFSET(10055, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, 613),
-    NAME_FUNC_OFFSET(10076, glVertexPointerEXT, glVertexPointerEXT, NULL, 614),
-    NAME_FUNC_OFFSET(10095, glPointParameterfEXT, glPointParameterfEXT, NULL, 615),
-    NAME_FUNC_OFFSET(10116, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 616),
-    NAME_FUNC_OFFSET(10138, glLockArraysEXT, glLockArraysEXT, NULL, 617),
-    NAME_FUNC_OFFSET(10154, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 618),
-    NAME_FUNC_OFFSET(10172, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 619),
-    NAME_FUNC_OFFSET(10194, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 620),
-    NAME_FUNC_OFFSET(10217, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 621),
-    NAME_FUNC_OFFSET(10239, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 622),
-    NAME_FUNC_OFFSET(10262, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 623),
-    NAME_FUNC_OFFSET(10284, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 624),
-    NAME_FUNC_OFFSET(10307, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 625),
-    NAME_FUNC_OFFSET(10329, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 626),
-    NAME_FUNC_OFFSET(10352, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 627),
-    NAME_FUNC_OFFSET(10374, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 628),
-    NAME_FUNC_OFFSET(10397, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 629),
-    NAME_FUNC_OFFSET(10420, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 630),
-    NAME_FUNC_OFFSET(10444, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 631),
-    NAME_FUNC_OFFSET(10467, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 632),
-    NAME_FUNC_OFFSET(10491, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 633),
-    NAME_FUNC_OFFSET(10514, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 634),
-    NAME_FUNC_OFFSET(10538, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 635),
-    NAME_FUNC_OFFSET(10565, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 636),
-    NAME_FUNC_OFFSET(10586, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 637),
-    NAME_FUNC_OFFSET(10609, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 638),
-    NAME_FUNC_OFFSET(10630, glFogCoorddEXT, glFogCoorddEXT, NULL, 639),
-    NAME_FUNC_OFFSET(10645, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 640),
-    NAME_FUNC_OFFSET(10661, glFogCoordfEXT, glFogCoordfEXT, NULL, 641),
-    NAME_FUNC_OFFSET(10676, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 642),
-    NAME_FUNC_OFFSET(10692, gl_dispatch_stub_643, gl_dispatch_stub_643, NULL, 643),
-    NAME_FUNC_OFFSET(10710, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 644),
-    NAME_FUNC_OFFSET(10733, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, 645),
-    NAME_FUNC_OFFSET(10759, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, 646),
-    NAME_FUNC_OFFSET(10780, glCombinerInputNV, glCombinerInputNV, NULL, 647),
-    NAME_FUNC_OFFSET(10798, glCombinerOutputNV, glCombinerOutputNV, NULL, 648),
-    NAME_FUNC_OFFSET(10817, glCombinerParameterfNV, glCombinerParameterfNV, NULL, 649),
-    NAME_FUNC_OFFSET(10840, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, 650),
-    NAME_FUNC_OFFSET(10864, glCombinerParameteriNV, glCombinerParameteriNV, NULL, 651),
-    NAME_FUNC_OFFSET(10887, glCombinerParameterivNV, glCombinerParameterivNV, NULL, 652),
-    NAME_FUNC_OFFSET(10911, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, 653),
-    NAME_FUNC_OFFSET(10934, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, 654),
-    NAME_FUNC_OFFSET(10966, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, 655),
-    NAME_FUNC_OFFSET(10998, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, 656),
-    NAME_FUNC_OFFSET(11031, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, 657),
-    NAME_FUNC_OFFSET(11064, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, 658),
-    NAME_FUNC_OFFSET(11101, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, 659),
-    NAME_FUNC_OFFSET(11138, glResizeBuffersMESA, glResizeBuffersMESA, NULL, 660),
-    NAME_FUNC_OFFSET(11158, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 661),
-    NAME_FUNC_OFFSET(11176, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 662),
-    NAME_FUNC_OFFSET(11195, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 663),
-    NAME_FUNC_OFFSET(11213, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 664),
-    NAME_FUNC_OFFSET(11232, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 665),
-    NAME_FUNC_OFFSET(11250, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 666),
-    NAME_FUNC_OFFSET(11269, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 667),
-    NAME_FUNC_OFFSET(11287, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 668),
-    NAME_FUNC_OFFSET(11306, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 669),
-    NAME_FUNC_OFFSET(11324, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 670),
-    NAME_FUNC_OFFSET(11343, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 671),
-    NAME_FUNC_OFFSET(11361, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 672),
-    NAME_FUNC_OFFSET(11380, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 673),
-    NAME_FUNC_OFFSET(11398, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 674),
-    NAME_FUNC_OFFSET(11417, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 675),
-    NAME_FUNC_OFFSET(11435, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 676),
-    NAME_FUNC_OFFSET(11454, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 677),
-    NAME_FUNC_OFFSET(11472, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 678),
-    NAME_FUNC_OFFSET(11491, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 679),
-    NAME_FUNC_OFFSET(11509, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 680),
-    NAME_FUNC_OFFSET(11528, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 681),
-    NAME_FUNC_OFFSET(11546, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 682),
-    NAME_FUNC_OFFSET(11565, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 683),
-    NAME_FUNC_OFFSET(11583, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 684),
-    NAME_FUNC_OFFSET(11602, gl_dispatch_stub_685, gl_dispatch_stub_685, NULL, 685),
-    NAME_FUNC_OFFSET(11627, gl_dispatch_stub_686, gl_dispatch_stub_686, NULL, 686),
-    NAME_FUNC_OFFSET(11654, gl_dispatch_stub_687, gl_dispatch_stub_687, NULL, 687),
-    NAME_FUNC_OFFSET(11671, gl_dispatch_stub_688, gl_dispatch_stub_688, NULL, 688),
-    NAME_FUNC_OFFSET(11687, gl_dispatch_stub_689, gl_dispatch_stub_689, NULL, 689),
-    NAME_FUNC_OFFSET(11701, gl_dispatch_stub_690, gl_dispatch_stub_690, NULL, 690),
-    NAME_FUNC_OFFSET(11716, gl_dispatch_stub_691, gl_dispatch_stub_691, NULL, 691),
-    NAME_FUNC_OFFSET(11728, gl_dispatch_stub_692, gl_dispatch_stub_692, NULL, 692),
-    NAME_FUNC_OFFSET(11741, gl_dispatch_stub_693, gl_dispatch_stub_693, NULL, 693),
-    NAME_FUNC_OFFSET(11755, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, 694),
-    NAME_FUNC_OFFSET(11779, glBindProgramNV, glBindProgramNV, NULL, 695),
-    NAME_FUNC_OFFSET(11795, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 696),
-    NAME_FUNC_OFFSET(11814, glExecuteProgramNV, glExecuteProgramNV, NULL, 697),
-    NAME_FUNC_OFFSET(11833, glGenProgramsNV, glGenProgramsNV, NULL, 698),
-    NAME_FUNC_OFFSET(11849, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, 699),
-    NAME_FUNC_OFFSET(11875, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, 700),
-    NAME_FUNC_OFFSET(11901, glGetProgramStringNV, glGetProgramStringNV, NULL, 701),
-    NAME_FUNC_OFFSET(11922, glGetProgramivNV, glGetProgramivNV, NULL, 702),
-    NAME_FUNC_OFFSET(11939, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, 703),
-    NAME_FUNC_OFFSET(11960, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 704),
-    NAME_FUNC_OFFSET(11988, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, 705),
-    NAME_FUNC_OFFSET(12010, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, 706),
-    NAME_FUNC_OFFSET(12032, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, 707),
-    NAME_FUNC_OFFSET(12054, glIsProgramNV, glIsProgramNV, NULL, 708),
-    NAME_FUNC_OFFSET(12068, glLoadProgramNV, glLoadProgramNV, NULL, 709),
-    NAME_FUNC_OFFSET(12084, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, 710),
-    NAME_FUNC_OFFSET(12109, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, 711),
-    NAME_FUNC_OFFSET(12134, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, 712),
-    NAME_FUNC_OFFSET(12162, glTrackMatrixNV, glTrackMatrixNV, NULL, 713),
-    NAME_FUNC_OFFSET(12178, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 714),
-    NAME_FUNC_OFFSET(12197, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, 715),
-    NAME_FUNC_OFFSET(12217, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 716),
-    NAME_FUNC_OFFSET(12236, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, 717),
-    NAME_FUNC_OFFSET(12256, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 718),
-    NAME_FUNC_OFFSET(12275, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, 719),
-    NAME_FUNC_OFFSET(12295, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 720),
-    NAME_FUNC_OFFSET(12314, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, 721),
-    NAME_FUNC_OFFSET(12334, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 722),
-    NAME_FUNC_OFFSET(12353, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, 723),
-    NAME_FUNC_OFFSET(12373, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 724),
-    NAME_FUNC_OFFSET(12392, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, 725),
-    NAME_FUNC_OFFSET(12412, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 726),
-    NAME_FUNC_OFFSET(12431, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, 727),
-    NAME_FUNC_OFFSET(12451, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 728),
-    NAME_FUNC_OFFSET(12470, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, 729),
-    NAME_FUNC_OFFSET(12490, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 730),
-    NAME_FUNC_OFFSET(12509, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, 731),
-    NAME_FUNC_OFFSET(12529, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 732),
-    NAME_FUNC_OFFSET(12548, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, 733),
-    NAME_FUNC_OFFSET(12568, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 734),
-    NAME_FUNC_OFFSET(12587, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, 735),
-    NAME_FUNC_OFFSET(12607, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 736),
-    NAME_FUNC_OFFSET(12626, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, 737),
-    NAME_FUNC_OFFSET(12646, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, 738),
-    NAME_FUNC_OFFSET(12666, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, 739),
-    NAME_FUNC_OFFSET(12687, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, 740),
-    NAME_FUNC_OFFSET(12711, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, 741),
-    NAME_FUNC_OFFSET(12732, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, 742),
-    NAME_FUNC_OFFSET(12753, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, 743),
-    NAME_FUNC_OFFSET(12774, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, 744),
-    NAME_FUNC_OFFSET(12795, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, 745),
-    NAME_FUNC_OFFSET(12816, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, 746),
-    NAME_FUNC_OFFSET(12837, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, 747),
-    NAME_FUNC_OFFSET(12858, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, 748),
-    NAME_FUNC_OFFSET(12879, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, 749),
-    NAME_FUNC_OFFSET(12900, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, 750),
-    NAME_FUNC_OFFSET(12921, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, 751),
-    NAME_FUNC_OFFSET(12942, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, 752),
-    NAME_FUNC_OFFSET(12963, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, 753),
-    NAME_FUNC_OFFSET(12985, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, 754),
-    NAME_FUNC_OFFSET(13012, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, 755),
-    NAME_FUNC_OFFSET(13039, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, 756),
-    NAME_FUNC_OFFSET(13063, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, 757),
-    NAME_FUNC_OFFSET(13087, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, 758),
-    NAME_FUNC_OFFSET(13109, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, 759),
-    NAME_FUNC_OFFSET(13131, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, 760),
-    NAME_FUNC_OFFSET(13153, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, 761),
-    NAME_FUNC_OFFSET(13178, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, 762),
-    NAME_FUNC_OFFSET(13202, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, 763),
-    NAME_FUNC_OFFSET(13224, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, 764),
-    NAME_FUNC_OFFSET(13246, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, 765),
-    NAME_FUNC_OFFSET(13268, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, 766),
-    NAME_FUNC_OFFSET(13294, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, 767),
-    NAME_FUNC_OFFSET(13317, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, 768),
-    NAME_FUNC_OFFSET(13341, glPassTexCoordATI, glPassTexCoordATI, NULL, 769),
-    NAME_FUNC_OFFSET(13359, glSampleMapATI, glSampleMapATI, NULL, 770),
-    NAME_FUNC_OFFSET(13374, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, 771),
-    NAME_FUNC_OFFSET(13405, glPointParameteriNV, glPointParameteriNV, NULL, 772),
-    NAME_FUNC_OFFSET(13425, glPointParameterivNV, glPointParameterivNV, NULL, 773),
-    NAME_FUNC_OFFSET(13446, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, 774),
-    NAME_FUNC_OFFSET(13469, gl_dispatch_stub_775, gl_dispatch_stub_775, NULL, 775),
-    NAME_FUNC_OFFSET(13492, gl_dispatch_stub_776, gl_dispatch_stub_776, NULL, 776),
-    NAME_FUNC_OFFSET(13518, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, 777),
-    NAME_FUNC_OFFSET(13541, gl_dispatch_stub_778, gl_dispatch_stub_778, NULL, 778),
-    NAME_FUNC_OFFSET(13562, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, 779),
-    NAME_FUNC_OFFSET(13593, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, 780),
-    NAME_FUNC_OFFSET(13624, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, 781),
-    NAME_FUNC_OFFSET(13652, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, 782),
-    NAME_FUNC_OFFSET(13681, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, 783),
-    NAME_FUNC_OFFSET(13709, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, 784),
-    NAME_FUNC_OFFSET(13738, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 785),
-    NAME_FUNC_OFFSET(13764, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL, 786),
-    NAME_FUNC_OFFSET(13785, gl_dispatch_stub_787, gl_dispatch_stub_787, NULL, 787),
-    NAME_FUNC_OFFSET(13802, gl_dispatch_stub_788, gl_dispatch_stub_788, NULL, 788),
-    NAME_FUNC_OFFSET(13829, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 789),
-    NAME_FUNC_OFFSET(13850, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 790),
-    NAME_FUNC_OFFSET(13872, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 791),
-    NAME_FUNC_OFFSET(13900, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 792),
-    NAME_FUNC_OFFSET(13924, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 793),
-    NAME_FUNC_OFFSET(13949, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 794),
-    NAME_FUNC_OFFSET(13978, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 795),
-    NAME_FUNC_OFFSET(14004, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 796),
-    NAME_FUNC_OFFSET(14030, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 797),
-    NAME_FUNC_OFFSET(14056, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 798),
-    NAME_FUNC_OFFSET(14077, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 799),
-    NAME_FUNC_OFFSET(14099, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 800),
-    NAME_FUNC_OFFSET(14119, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 801),
-    NAME_FUNC_OFFSET(14160, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 802),
-    NAME_FUNC_OFFSET(14192, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 803),
-    NAME_FUNC_OFFSET(14211, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 804),
-    NAME_FUNC_OFFSET(14231, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 805),
-    NAME_FUNC_OFFSET(14256, gl_dispatch_stub_806, gl_dispatch_stub_806, NULL, 806),
-    NAME_FUNC_OFFSET(14277, gl_dispatch_stub_807, gl_dispatch_stub_807, NULL, 807),
-    NAME_FUNC_OFFSET(14301, gl_dispatch_stub_808, gl_dispatch_stub_808, NULL, 808),
-    NAME_FUNC_OFFSET(14331, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 809),
-    NAME_FUNC_OFFSET(14357, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 810),
-    NAME_FUNC_OFFSET(14382, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 811),
-    NAME_FUNC_OFFSET(14401, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 812),
-    NAME_FUNC_OFFSET(14425, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 813),
-    NAME_FUNC_OFFSET(14450, glUniform1uiEXT, glUniform1uiEXT, NULL, 814),
-    NAME_FUNC_OFFSET(14466, glUniform1uivEXT, glUniform1uivEXT, NULL, 815),
-    NAME_FUNC_OFFSET(14483, glUniform2uiEXT, glUniform2uiEXT, NULL, 816),
-    NAME_FUNC_OFFSET(14499, glUniform2uivEXT, glUniform2uivEXT, NULL, 817),
-    NAME_FUNC_OFFSET(14516, glUniform3uiEXT, glUniform3uiEXT, NULL, 818),
-    NAME_FUNC_OFFSET(14532, glUniform3uivEXT, glUniform3uivEXT, NULL, 819),
-    NAME_FUNC_OFFSET(14549, glUniform4uiEXT, glUniform4uiEXT, NULL, 820),
-    NAME_FUNC_OFFSET(14565, glUniform4uivEXT, glUniform4uivEXT, NULL, 821),
-    NAME_FUNC_OFFSET(14582, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 822),
-    NAME_FUNC_OFFSET(14603, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 823),
-    NAME_FUNC_OFFSET(14625, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 824),
-    NAME_FUNC_OFFSET(14647, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 825),
-    NAME_FUNC_OFFSET(14670, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 826),
-    NAME_FUNC_OFFSET(14691, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 827),
-    NAME_FUNC_OFFSET(14713, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 828),
-    NAME_FUNC_OFFSET(14735, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 829),
-    NAME_FUNC_OFFSET(14758, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 830),
-    NAME_FUNC_OFFSET(14779, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 831),
-    NAME_FUNC_OFFSET(14801, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 832),
-    NAME_FUNC_OFFSET(14823, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 833),
-    NAME_FUNC_OFFSET(14846, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 834),
-    NAME_FUNC_OFFSET(14868, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 835),
-    NAME_FUNC_OFFSET(14889, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 836),
-    NAME_FUNC_OFFSET(14911, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 837),
-    NAME_FUNC_OFFSET(14933, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 838),
-    NAME_FUNC_OFFSET(14956, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 839),
-    NAME_FUNC_OFFSET(14978, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 840),
-    NAME_FUNC_OFFSET(15001, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 841),
-    NAME_FUNC_OFFSET(15024, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 842),
-    NAME_FUNC_OFFSET(15050, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 843),
-    NAME_FUNC_OFFSET(15079, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 844),
-    NAME_FUNC_OFFSET(15101, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 845),
-    NAME_FUNC_OFFSET(15121, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 846),
-    NAME_FUNC_OFFSET(15140, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 847),
-    NAME_FUNC_OFFSET(15164, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 848),
-    NAME_FUNC_OFFSET(15188, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 849),
-    NAME_FUNC_OFFSET(15210, glClearColorIiEXT, glClearColorIiEXT, NULL, 850),
-    NAME_FUNC_OFFSET(15228, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 851),
-    NAME_FUNC_OFFSET(15247, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 852),
-    NAME_FUNC_OFFSET(15271, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 853),
-    NAME_FUNC_OFFSET(15296, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 854),
-    NAME_FUNC_OFFSET(15317, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 855),
-    NAME_FUNC_OFFSET(15339, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 856),
-    NAME_FUNC_OFFSET(15366, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 857),
-    NAME_FUNC_OFFSET(15391, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 858),
-    NAME_FUNC_OFFSET(15419, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 859),
-    NAME_FUNC_OFFSET(15439, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, 860),
-    NAME_FUNC_OFFSET(15461, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 861),
-    NAME_FUNC_OFFSET(15482, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 862),
-    NAME_FUNC_OFFSET(15508, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 863),
-    NAME_FUNC_OFFSET(15541, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 864),
-    NAME_FUNC_OFFSET(15572, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 865),
-    NAME_FUNC_OFFSET(15593, gl_dispatch_stub_866, gl_dispatch_stub_866, NULL, 866),
-    NAME_FUNC_OFFSET(15624, gl_dispatch_stub_867, gl_dispatch_stub_867, NULL, 867),
-    NAME_FUNC_OFFSET(15644, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, 868),
-    NAME_FUNC_OFFSET(15672, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, 869),
-    NAME_FUNC_OFFSET(15695, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, 870),
-    NAME_FUNC_OFFSET(15720, glActiveProgramEXT, glActiveProgramEXT, NULL, 871),
-    NAME_FUNC_OFFSET(15739, glCreateShaderProgramEXT, glCreateShaderProgramEXT, NULL, 872),
-    NAME_FUNC_OFFSET(15764, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL, 873),
-    NAME_FUNC_OFFSET(15786, gl_dispatch_stub_874, gl_dispatch_stub_874, NULL, 874),
-    NAME_FUNC_OFFSET(15811, gl_dispatch_stub_875, gl_dispatch_stub_875, NULL, 875),
-    NAME_FUNC_OFFSET(15840, gl_dispatch_stub_876, gl_dispatch_stub_876, NULL, 876),
-    NAME_FUNC_OFFSET(15871, gl_dispatch_stub_877, gl_dispatch_stub_877, NULL, 877),
-    NAME_FUNC_OFFSET(15895, gl_dispatch_stub_878, gl_dispatch_stub_878, NULL, 878),
-    NAME_FUNC_OFFSET(15920, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, 879),
-    NAME_FUNC_OFFSET(15959, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, 880),
-    NAME_FUNC_OFFSET(15988, glArrayElement, glArrayElement, NULL, 306),
-    NAME_FUNC_OFFSET(16006, glBindTexture, glBindTexture, NULL, 307),
-    NAME_FUNC_OFFSET(16023, glDrawArrays, glDrawArrays, NULL, 310),
-    NAME_FUNC_OFFSET(16039, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, 322),
-    NAME_FUNC_OFFSET(16064, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
-    NAME_FUNC_OFFSET(16084, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
-    NAME_FUNC_OFFSET(16104, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
-    NAME_FUNC_OFFSET(16127, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
-    NAME_FUNC_OFFSET(16150, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, 327),
-    NAME_FUNC_OFFSET(16170, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, 328),
-    NAME_FUNC_OFFSET(16187, glGetPointerv, glGetPointerv, NULL, 329),
-    NAME_FUNC_OFFSET(16204, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
-    NAME_FUNC_OFFSET(16219, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
-    NAME_FUNC_OFFSET(16243, glTexSubImage1D, glTexSubImage1D, NULL, 332),
-    NAME_FUNC_OFFSET(16262, glTexSubImage2D, glTexSubImage2D, NULL, 333),
-    NAME_FUNC_OFFSET(16281, glBlendColor, glBlendColor, NULL, 336),
-    NAME_FUNC_OFFSET(16297, glBlendEquation, glBlendEquation, NULL, 337),
-    NAME_FUNC_OFFSET(16316, glDrawRangeElements, glDrawRangeElements, NULL, 338),
-    NAME_FUNC_OFFSET(16339, glColorTable, glColorTable, NULL, 339),
-    NAME_FUNC_OFFSET(16355, glColorTable, glColorTable, NULL, 339),
-    NAME_FUNC_OFFSET(16371, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
-    NAME_FUNC_OFFSET(16398, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
-    NAME_FUNC_OFFSET(16425, glCopyColorTable, glCopyColorTable, NULL, 342),
-    NAME_FUNC_OFFSET(16445, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
-    NAME_FUNC_OFFSET(16464, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
-    NAME_FUNC_OFFSET(16483, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
-    NAME_FUNC_OFFSET(16513, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
-    NAME_FUNC_OFFSET(16543, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
-    NAME_FUNC_OFFSET(16573, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
-    NAME_FUNC_OFFSET(16603, glColorSubTable, glColorSubTable, NULL, 346),
-    NAME_FUNC_OFFSET(16622, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
-    NAME_FUNC_OFFSET(16645, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
-    NAME_FUNC_OFFSET(16670, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
-    NAME_FUNC_OFFSET(16695, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
-    NAME_FUNC_OFFSET(16722, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
-    NAME_FUNC_OFFSET(16750, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
-    NAME_FUNC_OFFSET(16777, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
-    NAME_FUNC_OFFSET(16805, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
-    NAME_FUNC_OFFSET(16834, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
-    NAME_FUNC_OFFSET(16863, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, 356),
-    NAME_FUNC_OFFSET(16889, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, 357),
-    NAME_FUNC_OFFSET(16920, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, 358),
-    NAME_FUNC_OFFSET(16951, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, 359),
-    NAME_FUNC_OFFSET(16975, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
-    NAME_FUNC_OFFSET(16998, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, 361),
-    NAME_FUNC_OFFSET(17016, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, 362),
-    NAME_FUNC_OFFSET(17045, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, 363),
-    NAME_FUNC_OFFSET(17074, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, 364),
-    NAME_FUNC_OFFSET(17089, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, 365),
-    NAME_FUNC_OFFSET(17115, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, 366),
-    NAME_FUNC_OFFSET(17141, glHistogram, glHistogram, NULL, 367),
-    NAME_FUNC_OFFSET(17156, glMinmax, glMinmax, NULL, 368),
-    NAME_FUNC_OFFSET(17168, glResetHistogram, glResetHistogram, NULL, 369),
-    NAME_FUNC_OFFSET(17188, glResetMinmax, glResetMinmax, NULL, 370),
-    NAME_FUNC_OFFSET(17205, glTexImage3D, glTexImage3D, NULL, 371),
-    NAME_FUNC_OFFSET(17221, glTexSubImage3D, glTexSubImage3D, NULL, 372),
-    NAME_FUNC_OFFSET(17240, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
-    NAME_FUNC_OFFSET(17263, glActiveTextureARB, glActiveTextureARB, NULL, 374),
-    NAME_FUNC_OFFSET(17279, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
-    NAME_FUNC_OFFSET(17301, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
-    NAME_FUNC_OFFSET(17319, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
-    NAME_FUNC_OFFSET(17338, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
-    NAME_FUNC_OFFSET(17356, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
-    NAME_FUNC_OFFSET(17375, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
-    NAME_FUNC_OFFSET(17393, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
-    NAME_FUNC_OFFSET(17412, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
-    NAME_FUNC_OFFSET(17430, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
-    NAME_FUNC_OFFSET(17449, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
-    NAME_FUNC_OFFSET(17467, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
-    NAME_FUNC_OFFSET(17486, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
-    NAME_FUNC_OFFSET(17504, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
-    NAME_FUNC_OFFSET(17523, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
-    NAME_FUNC_OFFSET(17541, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
-    NAME_FUNC_OFFSET(17560, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
-    NAME_FUNC_OFFSET(17578, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
-    NAME_FUNC_OFFSET(17597, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
-    NAME_FUNC_OFFSET(17615, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
-    NAME_FUNC_OFFSET(17634, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
-    NAME_FUNC_OFFSET(17652, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
-    NAME_FUNC_OFFSET(17671, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
-    NAME_FUNC_OFFSET(17689, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
-    NAME_FUNC_OFFSET(17708, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
-    NAME_FUNC_OFFSET(17726, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
-    NAME_FUNC_OFFSET(17745, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
-    NAME_FUNC_OFFSET(17763, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
-    NAME_FUNC_OFFSET(17782, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
-    NAME_FUNC_OFFSET(17800, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
-    NAME_FUNC_OFFSET(17819, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
-    NAME_FUNC_OFFSET(17837, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
-    NAME_FUNC_OFFSET(17856, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
-    NAME_FUNC_OFFSET(17874, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
-    NAME_FUNC_OFFSET(17893, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
-    NAME_FUNC_OFFSET(17916, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
-    NAME_FUNC_OFFSET(17939, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
-    NAME_FUNC_OFFSET(17962, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
-    NAME_FUNC_OFFSET(17985, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
-    NAME_FUNC_OFFSET(18008, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
-    NAME_FUNC_OFFSET(18025, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
-    NAME_FUNC_OFFSET(18048, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
-    NAME_FUNC_OFFSET(18071, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
-    NAME_FUNC_OFFSET(18094, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
-    NAME_FUNC_OFFSET(18120, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
-    NAME_FUNC_OFFSET(18146, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
-    NAME_FUNC_OFFSET(18172, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
-    NAME_FUNC_OFFSET(18196, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
-    NAME_FUNC_OFFSET(18223, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
-    NAME_FUNC_OFFSET(18249, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
-    NAME_FUNC_OFFSET(18269, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
-    NAME_FUNC_OFFSET(18289, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
-    NAME_FUNC_OFFSET(18309, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
-    NAME_FUNC_OFFSET(18332, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
-    NAME_FUNC_OFFSET(18356, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
-    NAME_FUNC_OFFSET(18379, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
-    NAME_FUNC_OFFSET(18403, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
-    NAME_FUNC_OFFSET(18420, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
-    NAME_FUNC_OFFSET(18438, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
-    NAME_FUNC_OFFSET(18455, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
-    NAME_FUNC_OFFSET(18473, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
-    NAME_FUNC_OFFSET(18490, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
-    NAME_FUNC_OFFSET(18508, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
-    NAME_FUNC_OFFSET(18525, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
-    NAME_FUNC_OFFSET(18543, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
-    NAME_FUNC_OFFSET(18560, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
-    NAME_FUNC_OFFSET(18578, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
-    NAME_FUNC_OFFSET(18595, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
-    NAME_FUNC_OFFSET(18613, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
-    NAME_FUNC_OFFSET(18630, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
-    NAME_FUNC_OFFSET(18648, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
-    NAME_FUNC_OFFSET(18665, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
-    NAME_FUNC_OFFSET(18683, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
-    NAME_FUNC_OFFSET(18700, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
-    NAME_FUNC_OFFSET(18718, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
-    NAME_FUNC_OFFSET(18737, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
-    NAME_FUNC_OFFSET(18756, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
-    NAME_FUNC_OFFSET(18775, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
-    NAME_FUNC_OFFSET(18794, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
-    NAME_FUNC_OFFSET(18814, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
-    NAME_FUNC_OFFSET(18834, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
-    NAME_FUNC_OFFSET(18854, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
-    NAME_FUNC_OFFSET(18872, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
-    NAME_FUNC_OFFSET(18889, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
-    NAME_FUNC_OFFSET(18907, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
-    NAME_FUNC_OFFSET(18924, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
-    NAME_FUNC_OFFSET(18942, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
-    NAME_FUNC_OFFSET(18960, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
-    NAME_FUNC_OFFSET(18977, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
-    NAME_FUNC_OFFSET(18995, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
-    NAME_FUNC_OFFSET(19014, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
-    NAME_FUNC_OFFSET(19033, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
-    NAME_FUNC_OFFSET(19052, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
-    NAME_FUNC_OFFSET(19074, glBindBufferARB, glBindBufferARB, NULL, 510),
-    NAME_FUNC_OFFSET(19087, glBufferDataARB, glBufferDataARB, NULL, 511),
-    NAME_FUNC_OFFSET(19100, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
-    NAME_FUNC_OFFSET(19116, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
-    NAME_FUNC_OFFSET(19132, glGenBuffersARB, glGenBuffersARB, NULL, 514),
-    NAME_FUNC_OFFSET(19145, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
-    NAME_FUNC_OFFSET(19168, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
-    NAME_FUNC_OFFSET(19188, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
-    NAME_FUNC_OFFSET(19207, glIsBufferARB, glIsBufferARB, NULL, 518),
-    NAME_FUNC_OFFSET(19218, glMapBufferARB, glMapBufferARB, NULL, 519),
-    NAME_FUNC_OFFSET(19230, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
-    NAME_FUNC_OFFSET(19244, glBeginQueryARB, glBeginQueryARB, NULL, 521),
-    NAME_FUNC_OFFSET(19257, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
-    NAME_FUNC_OFFSET(19273, glEndQueryARB, glEndQueryARB, NULL, 523),
-    NAME_FUNC_OFFSET(19284, glGenQueriesARB, glGenQueriesARB, NULL, 524),
-    NAME_FUNC_OFFSET(19297, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
-    NAME_FUNC_OFFSET(19316, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
-    NAME_FUNC_OFFSET(19336, glGetQueryivARB, glGetQueryivARB, NULL, 527),
-    NAME_FUNC_OFFSET(19349, glIsQueryARB, glIsQueryARB, NULL, 528),
-    NAME_FUNC_OFFSET(19359, glCompileShaderARB, glCompileShaderARB, NULL, 530),
-    NAME_FUNC_OFFSET(19375, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
-    NAME_FUNC_OFFSET(19394, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
-    NAME_FUNC_OFFSET(19412, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
-    NAME_FUNC_OFFSET(19433, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
-    NAME_FUNC_OFFSET(19448, glGetUniformivARB, glGetUniformivARB, NULL, 544),
-    NAME_FUNC_OFFSET(19463, glLinkProgramARB, glLinkProgramARB, NULL, 545),
-    NAME_FUNC_OFFSET(19477, glShaderSourceARB, glShaderSourceARB, NULL, 546),
-    NAME_FUNC_OFFSET(19492, glUniform1fARB, glUniform1fARB, NULL, 547),
-    NAME_FUNC_OFFSET(19504, glUniform1fvARB, glUniform1fvARB, NULL, 548),
-    NAME_FUNC_OFFSET(19517, glUniform1iARB, glUniform1iARB, NULL, 549),
-    NAME_FUNC_OFFSET(19529, glUniform1ivARB, glUniform1ivARB, NULL, 550),
-    NAME_FUNC_OFFSET(19542, glUniform2fARB, glUniform2fARB, NULL, 551),
-    NAME_FUNC_OFFSET(19554, glUniform2fvARB, glUniform2fvARB, NULL, 552),
-    NAME_FUNC_OFFSET(19567, glUniform2iARB, glUniform2iARB, NULL, 553),
-    NAME_FUNC_OFFSET(19579, glUniform2ivARB, glUniform2ivARB, NULL, 554),
-    NAME_FUNC_OFFSET(19592, glUniform3fARB, glUniform3fARB, NULL, 555),
-    NAME_FUNC_OFFSET(19604, glUniform3fvARB, glUniform3fvARB, NULL, 556),
-    NAME_FUNC_OFFSET(19617, glUniform3iARB, glUniform3iARB, NULL, 557),
-    NAME_FUNC_OFFSET(19629, glUniform3ivARB, glUniform3ivARB, NULL, 558),
-    NAME_FUNC_OFFSET(19642, glUniform4fARB, glUniform4fARB, NULL, 559),
-    NAME_FUNC_OFFSET(19654, glUniform4fvARB, glUniform4fvARB, NULL, 560),
-    NAME_FUNC_OFFSET(19667, glUniform4iARB, glUniform4iARB, NULL, 561),
-    NAME_FUNC_OFFSET(19679, glUniform4ivARB, glUniform4ivARB, NULL, 562),
-    NAME_FUNC_OFFSET(19692, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
-    NAME_FUNC_OFFSET(19711, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
-    NAME_FUNC_OFFSET(19730, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
-    NAME_FUNC_OFFSET(19749, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
-    NAME_FUNC_OFFSET(19762, glValidateProgramARB, glValidateProgramARB, NULL, 567),
-    NAME_FUNC_OFFSET(19780, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
-    NAME_FUNC_OFFSET(19801, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
-    NAME_FUNC_OFFSET(19819, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
-    NAME_FUNC_OFFSET(19839, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(19853, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(19870, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 572),
-    NAME_FUNC_OFFSET(19895, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 572),
-    NAME_FUNC_OFFSET(19917, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 573),
-    NAME_FUNC_OFFSET(19944, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 573),
-    NAME_FUNC_OFFSET(19968, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 574),
-    NAME_FUNC_OFFSET(20004, gl_dispatch_stub_607, gl_dispatch_stub_607, NULL, 607),
-    NAME_FUNC_OFFSET(20020, gl_dispatch_stub_608, gl_dispatch_stub_608, NULL, 608),
-    NAME_FUNC_OFFSET(20039, glPointParameterfEXT, glPointParameterfEXT, NULL, 615),
-    NAME_FUNC_OFFSET(20057, glPointParameterfEXT, glPointParameterfEXT, NULL, 615),
-    NAME_FUNC_OFFSET(20078, glPointParameterfEXT, glPointParameterfEXT, NULL, 615),
-    NAME_FUNC_OFFSET(20100, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 616),
-    NAME_FUNC_OFFSET(20119, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 616),
-    NAME_FUNC_OFFSET(20141, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 616),
-    NAME_FUNC_OFFSET(20164, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 619),
-    NAME_FUNC_OFFSET(20183, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 620),
-    NAME_FUNC_OFFSET(20203, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 621),
-    NAME_FUNC_OFFSET(20222, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 622),
-    NAME_FUNC_OFFSET(20242, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 623),
-    NAME_FUNC_OFFSET(20261, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 624),
-    NAME_FUNC_OFFSET(20281, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 625),
-    NAME_FUNC_OFFSET(20300, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 626),
-    NAME_FUNC_OFFSET(20320, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 627),
-    NAME_FUNC_OFFSET(20339, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 628),
-    NAME_FUNC_OFFSET(20359, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 629),
-    NAME_FUNC_OFFSET(20379, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 630),
-    NAME_FUNC_OFFSET(20400, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 631),
-    NAME_FUNC_OFFSET(20420, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 632),
-    NAME_FUNC_OFFSET(20441, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 633),
-    NAME_FUNC_OFFSET(20461, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 634),
-    NAME_FUNC_OFFSET(20482, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 635),
-    NAME_FUNC_OFFSET(20506, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 636),
-    NAME_FUNC_OFFSET(20524, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 637),
-    NAME_FUNC_OFFSET(20544, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 638),
-    NAME_FUNC_OFFSET(20562, glFogCoorddEXT, glFogCoorddEXT, NULL, 639),
-    NAME_FUNC_OFFSET(20574, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 640),
-    NAME_FUNC_OFFSET(20587, glFogCoordfEXT, glFogCoordfEXT, NULL, 641),
-    NAME_FUNC_OFFSET(20599, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 642),
-    NAME_FUNC_OFFSET(20612, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 644),
-    NAME_FUNC_OFFSET(20632, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 644),
-    NAME_FUNC_OFFSET(20656, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 661),
-    NAME_FUNC_OFFSET(20670, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 661),
-    NAME_FUNC_OFFSET(20687, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 662),
-    NAME_FUNC_OFFSET(20702, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 662),
-    NAME_FUNC_OFFSET(20720, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 663),
-    NAME_FUNC_OFFSET(20734, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 663),
-    NAME_FUNC_OFFSET(20751, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 664),
-    NAME_FUNC_OFFSET(20766, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 664),
-    NAME_FUNC_OFFSET(20784, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 665),
-    NAME_FUNC_OFFSET(20798, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 665),
-    NAME_FUNC_OFFSET(20815, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 666),
-    NAME_FUNC_OFFSET(20830, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 666),
-    NAME_FUNC_OFFSET(20848, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 667),
-    NAME_FUNC_OFFSET(20862, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 667),
-    NAME_FUNC_OFFSET(20879, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 668),
-    NAME_FUNC_OFFSET(20894, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 668),
-    NAME_FUNC_OFFSET(20912, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 669),
-    NAME_FUNC_OFFSET(20926, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 669),
-    NAME_FUNC_OFFSET(20943, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 670),
-    NAME_FUNC_OFFSET(20958, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 670),
-    NAME_FUNC_OFFSET(20976, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 671),
-    NAME_FUNC_OFFSET(20990, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 671),
-    NAME_FUNC_OFFSET(21007, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 672),
-    NAME_FUNC_OFFSET(21022, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 672),
-    NAME_FUNC_OFFSET(21040, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 673),
-    NAME_FUNC_OFFSET(21054, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 673),
-    NAME_FUNC_OFFSET(21071, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 674),
-    NAME_FUNC_OFFSET(21086, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 674),
-    NAME_FUNC_OFFSET(21104, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 675),
-    NAME_FUNC_OFFSET(21118, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 675),
-    NAME_FUNC_OFFSET(21135, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 676),
-    NAME_FUNC_OFFSET(21150, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 676),
-    NAME_FUNC_OFFSET(21168, glBindProgramNV, glBindProgramNV, NULL, 695),
-    NAME_FUNC_OFFSET(21185, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 696),
-    NAME_FUNC_OFFSET(21205, glGenProgramsNV, glGenProgramsNV, NULL, 698),
-    NAME_FUNC_OFFSET(21222, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 704),
-    NAME_FUNC_OFFSET(21248, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 704),
-    NAME_FUNC_OFFSET(21277, glIsProgramNV, glIsProgramNV, NULL, 708),
-    NAME_FUNC_OFFSET(21292, glPointParameteriNV, glPointParameteriNV, NULL, 772),
-    NAME_FUNC_OFFSET(21310, glPointParameterivNV, glPointParameterivNV, NULL, 773),
-    NAME_FUNC_OFFSET(21329, gl_dispatch_stub_776, gl_dispatch_stub_776, NULL, 776),
-    NAME_FUNC_OFFSET(21350, gl_dispatch_stub_778, gl_dispatch_stub_778, NULL, 778),
-    NAME_FUNC_OFFSET(21366, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 785),
-    NAME_FUNC_OFFSET(21390, gl_dispatch_stub_788, gl_dispatch_stub_788, NULL, 788),
-    NAME_FUNC_OFFSET(21414, gl_dispatch_stub_788, gl_dispatch_stub_788, NULL, 788),
-    NAME_FUNC_OFFSET(21441, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 789),
-    NAME_FUNC_OFFSET(21459, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 790),
-    NAME_FUNC_OFFSET(21478, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 791),
-    NAME_FUNC_OFFSET(21503, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 792),
-    NAME_FUNC_OFFSET(21524, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 793),
-    NAME_FUNC_OFFSET(21546, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 794),
-    NAME_FUNC_OFFSET(21572, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 795),
-    NAME_FUNC_OFFSET(21595, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 796),
-    NAME_FUNC_OFFSET(21618, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 797),
-    NAME_FUNC_OFFSET(21641, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 798),
-    NAME_FUNC_OFFSET(21659, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 799),
-    NAME_FUNC_OFFSET(21678, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 800),
-    NAME_FUNC_OFFSET(21695, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 801),
-    NAME_FUNC_OFFSET(21733, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 802),
-    NAME_FUNC_OFFSET(21762, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 803),
-    NAME_FUNC_OFFSET(21778, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 804),
-    NAME_FUNC_OFFSET(21795, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 805),
-    NAME_FUNC_OFFSET(21817, gl_dispatch_stub_806, gl_dispatch_stub_806, NULL, 806),
-    NAME_FUNC_OFFSET(21835, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 809),
-    NAME_FUNC_OFFSET(21858, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 810),
-    NAME_FUNC_OFFSET(21880, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 811),
-    NAME_FUNC_OFFSET(21896, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 812),
-    NAME_FUNC_OFFSET(21917, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 813),
-    NAME_FUNC_OFFSET(21939, glUniform1uiEXT, glUniform1uiEXT, NULL, 814),
-    NAME_FUNC_OFFSET(21952, glUniform1uivEXT, glUniform1uivEXT, NULL, 815),
-    NAME_FUNC_OFFSET(21966, glUniform2uiEXT, glUniform2uiEXT, NULL, 816),
-    NAME_FUNC_OFFSET(21979, glUniform2uivEXT, glUniform2uivEXT, NULL, 817),
-    NAME_FUNC_OFFSET(21993, glUniform3uiEXT, glUniform3uiEXT, NULL, 818),
-    NAME_FUNC_OFFSET(22006, glUniform3uivEXT, glUniform3uivEXT, NULL, 819),
-    NAME_FUNC_OFFSET(22020, glUniform4uiEXT, glUniform4uiEXT, NULL, 820),
-    NAME_FUNC_OFFSET(22033, glUniform4uivEXT, glUniform4uivEXT, NULL, 821),
-    NAME_FUNC_OFFSET(22047, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 822),
-    NAME_FUNC_OFFSET(22065, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 823),
-    NAME_FUNC_OFFSET(22084, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 824),
-    NAME_FUNC_OFFSET(22103, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 825),
-    NAME_FUNC_OFFSET(22123, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 826),
-    NAME_FUNC_OFFSET(22141, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 827),
-    NAME_FUNC_OFFSET(22160, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 828),
-    NAME_FUNC_OFFSET(22179, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 829),
-    NAME_FUNC_OFFSET(22199, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 830),
-    NAME_FUNC_OFFSET(22217, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 831),
-    NAME_FUNC_OFFSET(22236, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 832),
-    NAME_FUNC_OFFSET(22255, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 833),
-    NAME_FUNC_OFFSET(22275, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 834),
-    NAME_FUNC_OFFSET(22294, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 835),
-    NAME_FUNC_OFFSET(22312, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 836),
-    NAME_FUNC_OFFSET(22331, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 837),
-    NAME_FUNC_OFFSET(22350, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 838),
-    NAME_FUNC_OFFSET(22370, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 839),
-    NAME_FUNC_OFFSET(22389, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 840),
-    NAME_FUNC_OFFSET(22409, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 841),
-    NAME_FUNC_OFFSET(22429, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 842),
-    NAME_FUNC_OFFSET(22452, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 843),
-    NAME_FUNC_OFFSET(22478, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 844),
-    NAME_FUNC_OFFSET(22491, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 845),
-    NAME_FUNC_OFFSET(22502, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 846),
-    NAME_FUNC_OFFSET(22512, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 847),
-    NAME_FUNC_OFFSET(22528, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 848),
-    NAME_FUNC_OFFSET(22544, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 849),
-    NAME_FUNC_OFFSET(22557, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 852),
-    NAME_FUNC_OFFSET(22578, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 853),
-    NAME_FUNC_OFFSET(22600, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 854),
-    NAME_FUNC_OFFSET(22618, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 855),
-    NAME_FUNC_OFFSET(22637, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 856),
-    NAME_FUNC_OFFSET(22662, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 857),
-    NAME_FUNC_OFFSET(22685, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 858),
-    NAME_FUNC_OFFSET(22710, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 859),
-    NAME_FUNC_OFFSET(22727, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 861),
-    NAME_FUNC_OFFSET(22745, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 862),
-    NAME_FUNC_OFFSET(22768, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 863),
-    NAME_FUNC_OFFSET(22798, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 864),
-    NAME_FUNC_OFFSET(22826, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 865),
+    NAME_FUNC_OFFSET( 9745, glClearDepthf, glClearDepthf, NULL, 600),
+    NAME_FUNC_OFFSET( 9759, glDepthRangef, glDepthRangef, NULL, 601),
+    NAME_FUNC_OFFSET( 9773, glGetShaderPrecisionFormat, glGetShaderPrecisionFormat, NULL, 602),
+    NAME_FUNC_OFFSET( 9800, glReleaseShaderCompiler, glReleaseShaderCompiler, NULL, 603),
+    NAME_FUNC_OFFSET( 9824, glShaderBinary, glShaderBinary, NULL, 604),
+    NAME_FUNC_OFFSET( 9839, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 605),
+    NAME_FUNC_OFFSET( 9858, gl_dispatch_stub_606, gl_dispatch_stub_606, NULL, 606),
+    NAME_FUNC_OFFSET( 9890, gl_dispatch_stub_607, gl_dispatch_stub_607, NULL, 607),
+    NAME_FUNC_OFFSET( 9922, gl_dispatch_stub_608, gl_dispatch_stub_608, NULL, 608),
+    NAME_FUNC_OFFSET( 9950, gl_dispatch_stub_609, gl_dispatch_stub_609, NULL, 609),
+    NAME_FUNC_OFFSET( 9979, gl_dispatch_stub_610, gl_dispatch_stub_610, NULL, 610),
+    NAME_FUNC_OFFSET(10007, gl_dispatch_stub_611, gl_dispatch_stub_611, NULL, 611),
+    NAME_FUNC_OFFSET(10036, gl_dispatch_stub_612, gl_dispatch_stub_612, NULL, 612),
+    NAME_FUNC_OFFSET(10053, gl_dispatch_stub_613, gl_dispatch_stub_613, NULL, 613),
+    NAME_FUNC_OFFSET(10073, glColorPointerEXT, glColorPointerEXT, NULL, 614),
+    NAME_FUNC_OFFSET(10091, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, 615),
+    NAME_FUNC_OFFSET(10112, glIndexPointerEXT, glIndexPointerEXT, NULL, 616),
+    NAME_FUNC_OFFSET(10130, glNormalPointerEXT, glNormalPointerEXT, NULL, 617),
+    NAME_FUNC_OFFSET(10149, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, 618),
+    NAME_FUNC_OFFSET(10170, glVertexPointerEXT, glVertexPointerEXT, NULL, 619),
+    NAME_FUNC_OFFSET(10189, glPointParameterfEXT, glPointParameterfEXT, NULL, 620),
+    NAME_FUNC_OFFSET(10210, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 621),
+    NAME_FUNC_OFFSET(10232, glLockArraysEXT, glLockArraysEXT, NULL, 622),
+    NAME_FUNC_OFFSET(10248, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 623),
+    NAME_FUNC_OFFSET(10266, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 624),
+    NAME_FUNC_OFFSET(10288, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 625),
+    NAME_FUNC_OFFSET(10311, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 626),
+    NAME_FUNC_OFFSET(10333, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 627),
+    NAME_FUNC_OFFSET(10356, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 628),
+    NAME_FUNC_OFFSET(10378, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 629),
+    NAME_FUNC_OFFSET(10401, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 630),
+    NAME_FUNC_OFFSET(10423, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 631),
+    NAME_FUNC_OFFSET(10446, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 632),
+    NAME_FUNC_OFFSET(10468, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 633),
+    NAME_FUNC_OFFSET(10491, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 634),
+    NAME_FUNC_OFFSET(10514, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 635),
+    NAME_FUNC_OFFSET(10538, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 636),
+    NAME_FUNC_OFFSET(10561, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 637),
+    NAME_FUNC_OFFSET(10585, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 638),
+    NAME_FUNC_OFFSET(10608, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 639),
+    NAME_FUNC_OFFSET(10632, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 640),
+    NAME_FUNC_OFFSET(10659, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 641),
+    NAME_FUNC_OFFSET(10680, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 642),
+    NAME_FUNC_OFFSET(10703, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 643),
+    NAME_FUNC_OFFSET(10724, glFogCoorddEXT, glFogCoorddEXT, NULL, 644),
+    NAME_FUNC_OFFSET(10739, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 645),
+    NAME_FUNC_OFFSET(10755, glFogCoordfEXT, glFogCoordfEXT, NULL, 646),
+    NAME_FUNC_OFFSET(10770, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 647),
+    NAME_FUNC_OFFSET(10786, gl_dispatch_stub_648, gl_dispatch_stub_648, NULL, 648),
+    NAME_FUNC_OFFSET(10804, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 649),
+    NAME_FUNC_OFFSET(10827, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, 650),
+    NAME_FUNC_OFFSET(10853, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, 651),
+    NAME_FUNC_OFFSET(10874, glCombinerInputNV, glCombinerInputNV, NULL, 652),
+    NAME_FUNC_OFFSET(10892, glCombinerOutputNV, glCombinerOutputNV, NULL, 653),
+    NAME_FUNC_OFFSET(10911, glCombinerParameterfNV, glCombinerParameterfNV, NULL, 654),
+    NAME_FUNC_OFFSET(10934, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, 655),
+    NAME_FUNC_OFFSET(10958, glCombinerParameteriNV, glCombinerParameteriNV, NULL, 656),
+    NAME_FUNC_OFFSET(10981, glCombinerParameterivNV, glCombinerParameterivNV, NULL, 657),
+    NAME_FUNC_OFFSET(11005, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, 658),
+    NAME_FUNC_OFFSET(11028, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, 659),
+    NAME_FUNC_OFFSET(11060, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, 660),
+    NAME_FUNC_OFFSET(11092, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, 661),
+    NAME_FUNC_OFFSET(11125, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, 662),
+    NAME_FUNC_OFFSET(11158, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, 663),
+    NAME_FUNC_OFFSET(11195, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, 664),
+    NAME_FUNC_OFFSET(11232, glResizeBuffersMESA, glResizeBuffersMESA, NULL, 665),
+    NAME_FUNC_OFFSET(11252, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 666),
+    NAME_FUNC_OFFSET(11270, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 667),
+    NAME_FUNC_OFFSET(11289, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 668),
+    NAME_FUNC_OFFSET(11307, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 669),
+    NAME_FUNC_OFFSET(11326, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 670),
+    NAME_FUNC_OFFSET(11344, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 671),
+    NAME_FUNC_OFFSET(11363, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 672),
+    NAME_FUNC_OFFSET(11381, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 673),
+    NAME_FUNC_OFFSET(11400, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 674),
+    NAME_FUNC_OFFSET(11418, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 675),
+    NAME_FUNC_OFFSET(11437, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 676),
+    NAME_FUNC_OFFSET(11455, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 677),
+    NAME_FUNC_OFFSET(11474, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 678),
+    NAME_FUNC_OFFSET(11492, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 679),
+    NAME_FUNC_OFFSET(11511, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 680),
+    NAME_FUNC_OFFSET(11529, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 681),
+    NAME_FUNC_OFFSET(11548, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 682),
+    NAME_FUNC_OFFSET(11566, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 683),
+    NAME_FUNC_OFFSET(11585, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 684),
+    NAME_FUNC_OFFSET(11603, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 685),
+    NAME_FUNC_OFFSET(11622, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 686),
+    NAME_FUNC_OFFSET(11640, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 687),
+    NAME_FUNC_OFFSET(11659, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 688),
+    NAME_FUNC_OFFSET(11677, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 689),
+    NAME_FUNC_OFFSET(11696, gl_dispatch_stub_690, gl_dispatch_stub_690, NULL, 690),
+    NAME_FUNC_OFFSET(11721, gl_dispatch_stub_691, gl_dispatch_stub_691, NULL, 691),
+    NAME_FUNC_OFFSET(11748, gl_dispatch_stub_692, gl_dispatch_stub_692, NULL, 692),
+    NAME_FUNC_OFFSET(11765, gl_dispatch_stub_693, gl_dispatch_stub_693, NULL, 693),
+    NAME_FUNC_OFFSET(11781, gl_dispatch_stub_694, gl_dispatch_stub_694, NULL, 694),
+    NAME_FUNC_OFFSET(11795, gl_dispatch_stub_695, gl_dispatch_stub_695, NULL, 695),
+    NAME_FUNC_OFFSET(11810, gl_dispatch_stub_696, gl_dispatch_stub_696, NULL, 696),
+    NAME_FUNC_OFFSET(11822, gl_dispatch_stub_697, gl_dispatch_stub_697, NULL, 697),
+    NAME_FUNC_OFFSET(11835, gl_dispatch_stub_698, gl_dispatch_stub_698, NULL, 698),
+    NAME_FUNC_OFFSET(11849, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, 699),
+    NAME_FUNC_OFFSET(11873, glBindProgramNV, glBindProgramNV, NULL, 700),
+    NAME_FUNC_OFFSET(11889, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 701),
+    NAME_FUNC_OFFSET(11908, glExecuteProgramNV, glExecuteProgramNV, NULL, 702),
+    NAME_FUNC_OFFSET(11927, glGenProgramsNV, glGenProgramsNV, NULL, 703),
+    NAME_FUNC_OFFSET(11943, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, 704),
+    NAME_FUNC_OFFSET(11969, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, 705),
+    NAME_FUNC_OFFSET(11995, glGetProgramStringNV, glGetProgramStringNV, NULL, 706),
+    NAME_FUNC_OFFSET(12016, glGetProgramivNV, glGetProgramivNV, NULL, 707),
+    NAME_FUNC_OFFSET(12033, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, 708),
+    NAME_FUNC_OFFSET(12054, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 709),
+    NAME_FUNC_OFFSET(12082, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, 710),
+    NAME_FUNC_OFFSET(12104, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, 711),
+    NAME_FUNC_OFFSET(12126, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, 712),
+    NAME_FUNC_OFFSET(12148, glIsProgramNV, glIsProgramNV, NULL, 713),
+    NAME_FUNC_OFFSET(12162, glLoadProgramNV, glLoadProgramNV, NULL, 714),
+    NAME_FUNC_OFFSET(12178, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, 715),
+    NAME_FUNC_OFFSET(12203, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, 716),
+    NAME_FUNC_OFFSET(12228, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, 717),
+    NAME_FUNC_OFFSET(12256, glTrackMatrixNV, glTrackMatrixNV, NULL, 718),
+    NAME_FUNC_OFFSET(12272, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 719),
+    NAME_FUNC_OFFSET(12291, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, 720),
+    NAME_FUNC_OFFSET(12311, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 721),
+    NAME_FUNC_OFFSET(12330, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, 722),
+    NAME_FUNC_OFFSET(12350, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 723),
+    NAME_FUNC_OFFSET(12369, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, 724),
+    NAME_FUNC_OFFSET(12389, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 725),
+    NAME_FUNC_OFFSET(12408, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, 726),
+    NAME_FUNC_OFFSET(12428, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 727),
+    NAME_FUNC_OFFSET(12447, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, 728),
+    NAME_FUNC_OFFSET(12467, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 729),
+    NAME_FUNC_OFFSET(12486, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, 730),
+    NAME_FUNC_OFFSET(12506, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 731),
+    NAME_FUNC_OFFSET(12525, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, 732),
+    NAME_FUNC_OFFSET(12545, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 733),
+    NAME_FUNC_OFFSET(12564, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, 734),
+    NAME_FUNC_OFFSET(12584, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 735),
+    NAME_FUNC_OFFSET(12603, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, 736),
+    NAME_FUNC_OFFSET(12623, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 737),
+    NAME_FUNC_OFFSET(12642, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, 738),
+    NAME_FUNC_OFFSET(12662, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 739),
+    NAME_FUNC_OFFSET(12681, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, 740),
+    NAME_FUNC_OFFSET(12701, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 741),
+    NAME_FUNC_OFFSET(12720, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, 742),
+    NAME_FUNC_OFFSET(12740, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, 743),
+    NAME_FUNC_OFFSET(12760, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, 744),
+    NAME_FUNC_OFFSET(12781, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, 745),
+    NAME_FUNC_OFFSET(12805, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, 746),
+    NAME_FUNC_OFFSET(12826, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, 747),
+    NAME_FUNC_OFFSET(12847, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, 748),
+    NAME_FUNC_OFFSET(12868, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, 749),
+    NAME_FUNC_OFFSET(12889, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, 750),
+    NAME_FUNC_OFFSET(12910, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, 751),
+    NAME_FUNC_OFFSET(12931, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, 752),
+    NAME_FUNC_OFFSET(12952, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, 753),
+    NAME_FUNC_OFFSET(12973, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, 754),
+    NAME_FUNC_OFFSET(12994, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, 755),
+    NAME_FUNC_OFFSET(13015, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, 756),
+    NAME_FUNC_OFFSET(13036, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, 757),
+    NAME_FUNC_OFFSET(13057, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, 758),
+    NAME_FUNC_OFFSET(13079, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, 759),
+    NAME_FUNC_OFFSET(13106, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, 760),
+    NAME_FUNC_OFFSET(13133, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, 761),
+    NAME_FUNC_OFFSET(13157, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, 762),
+    NAME_FUNC_OFFSET(13181, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, 763),
+    NAME_FUNC_OFFSET(13203, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, 764),
+    NAME_FUNC_OFFSET(13225, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, 765),
+    NAME_FUNC_OFFSET(13247, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, 766),
+    NAME_FUNC_OFFSET(13272, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, 767),
+    NAME_FUNC_OFFSET(13296, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, 768),
+    NAME_FUNC_OFFSET(13318, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, 769),
+    NAME_FUNC_OFFSET(13340, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, 770),
+    NAME_FUNC_OFFSET(13362, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, 771),
+    NAME_FUNC_OFFSET(13388, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, 772),
+    NAME_FUNC_OFFSET(13411, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, 773),
+    NAME_FUNC_OFFSET(13435, glPassTexCoordATI, glPassTexCoordATI, NULL, 774),
+    NAME_FUNC_OFFSET(13453, glSampleMapATI, glSampleMapATI, NULL, 775),
+    NAME_FUNC_OFFSET(13468, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, 776),
+    NAME_FUNC_OFFSET(13499, glPointParameteriNV, glPointParameteriNV, NULL, 777),
+    NAME_FUNC_OFFSET(13519, glPointParameterivNV, glPointParameterivNV, NULL, 778),
+    NAME_FUNC_OFFSET(13540, gl_dispatch_stub_779, gl_dispatch_stub_779, NULL, 779),
+    NAME_FUNC_OFFSET(13563, gl_dispatch_stub_780, gl_dispatch_stub_780, NULL, 780),
+    NAME_FUNC_OFFSET(13586, gl_dispatch_stub_781, gl_dispatch_stub_781, NULL, 781),
+    NAME_FUNC_OFFSET(13612, gl_dispatch_stub_782, gl_dispatch_stub_782, NULL, 782),
+    NAME_FUNC_OFFSET(13635, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, 783),
+    NAME_FUNC_OFFSET(13656, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, 784),
+    NAME_FUNC_OFFSET(13687, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, 785),
+    NAME_FUNC_OFFSET(13718, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, 786),
+    NAME_FUNC_OFFSET(13746, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, 787),
+    NAME_FUNC_OFFSET(13775, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, 788),
+    NAME_FUNC_OFFSET(13803, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, 789),
+    NAME_FUNC_OFFSET(13832, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 790),
+    NAME_FUNC_OFFSET(13858, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL, 791),
+    NAME_FUNC_OFFSET(13879, gl_dispatch_stub_792, gl_dispatch_stub_792, NULL, 792),
+    NAME_FUNC_OFFSET(13896, gl_dispatch_stub_793, gl_dispatch_stub_793, NULL, 793),
+    NAME_FUNC_OFFSET(13923, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 794),
+    NAME_FUNC_OFFSET(13944, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 795),
+    NAME_FUNC_OFFSET(13966, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 796),
+    NAME_FUNC_OFFSET(13994, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 797),
+    NAME_FUNC_OFFSET(14018, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 798),
+    NAME_FUNC_OFFSET(14043, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 799),
+    NAME_FUNC_OFFSET(14072, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 800),
+    NAME_FUNC_OFFSET(14098, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 801),
+    NAME_FUNC_OFFSET(14124, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 802),
+    NAME_FUNC_OFFSET(14150, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 803),
+    NAME_FUNC_OFFSET(14171, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 804),
+    NAME_FUNC_OFFSET(14193, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 805),
+    NAME_FUNC_OFFSET(14213, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 806),
+    NAME_FUNC_OFFSET(14254, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 807),
+    NAME_FUNC_OFFSET(14286, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 808),
+    NAME_FUNC_OFFSET(14305, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 809),
+    NAME_FUNC_OFFSET(14325, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 810),
+    NAME_FUNC_OFFSET(14350, gl_dispatch_stub_811, gl_dispatch_stub_811, NULL, 811),
+    NAME_FUNC_OFFSET(14371, gl_dispatch_stub_812, gl_dispatch_stub_812, NULL, 812),
+    NAME_FUNC_OFFSET(14395, gl_dispatch_stub_813, gl_dispatch_stub_813, NULL, 813),
+    NAME_FUNC_OFFSET(14425, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 814),
+    NAME_FUNC_OFFSET(14451, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 815),
+    NAME_FUNC_OFFSET(14476, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 816),
+    NAME_FUNC_OFFSET(14495, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 817),
+    NAME_FUNC_OFFSET(14519, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 818),
+    NAME_FUNC_OFFSET(14544, glUniform1uiEXT, glUniform1uiEXT, NULL, 819),
+    NAME_FUNC_OFFSET(14560, glUniform1uivEXT, glUniform1uivEXT, NULL, 820),
+    NAME_FUNC_OFFSET(14577, glUniform2uiEXT, glUniform2uiEXT, NULL, 821),
+    NAME_FUNC_OFFSET(14593, glUniform2uivEXT, glUniform2uivEXT, NULL, 822),
+    NAME_FUNC_OFFSET(14610, glUniform3uiEXT, glUniform3uiEXT, NULL, 823),
+    NAME_FUNC_OFFSET(14626, glUniform3uivEXT, glUniform3uivEXT, NULL, 824),
+    NAME_FUNC_OFFSET(14643, glUniform4uiEXT, glUniform4uiEXT, NULL, 825),
+    NAME_FUNC_OFFSET(14659, glUniform4uivEXT, glUniform4uivEXT, NULL, 826),
+    NAME_FUNC_OFFSET(14676, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 827),
+    NAME_FUNC_OFFSET(14697, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 828),
+    NAME_FUNC_OFFSET(14719, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 829),
+    NAME_FUNC_OFFSET(14741, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 830),
+    NAME_FUNC_OFFSET(14764, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 831),
+    NAME_FUNC_OFFSET(14785, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 832),
+    NAME_FUNC_OFFSET(14807, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 833),
+    NAME_FUNC_OFFSET(14829, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 834),
+    NAME_FUNC_OFFSET(14852, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 835),
+    NAME_FUNC_OFFSET(14873, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 836),
+    NAME_FUNC_OFFSET(14895, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 837),
+    NAME_FUNC_OFFSET(14917, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 838),
+    NAME_FUNC_OFFSET(14940, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 839),
+    NAME_FUNC_OFFSET(14962, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 840),
+    NAME_FUNC_OFFSET(14983, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 841),
+    NAME_FUNC_OFFSET(15005, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 842),
+    NAME_FUNC_OFFSET(15027, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 843),
+    NAME_FUNC_OFFSET(15050, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 844),
+    NAME_FUNC_OFFSET(15072, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 845),
+    NAME_FUNC_OFFSET(15095, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 846),
+    NAME_FUNC_OFFSET(15118, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 847),
+    NAME_FUNC_OFFSET(15144, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 848),
+    NAME_FUNC_OFFSET(15173, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 849),
+    NAME_FUNC_OFFSET(15195, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 850),
+    NAME_FUNC_OFFSET(15215, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 851),
+    NAME_FUNC_OFFSET(15234, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 852),
+    NAME_FUNC_OFFSET(15258, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 853),
+    NAME_FUNC_OFFSET(15282, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 854),
+    NAME_FUNC_OFFSET(15304, glClearColorIiEXT, glClearColorIiEXT, NULL, 855),
+    NAME_FUNC_OFFSET(15322, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 856),
+    NAME_FUNC_OFFSET(15341, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 857),
+    NAME_FUNC_OFFSET(15365, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 858),
+    NAME_FUNC_OFFSET(15390, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 859),
+    NAME_FUNC_OFFSET(15411, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 860),
+    NAME_FUNC_OFFSET(15433, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 861),
+    NAME_FUNC_OFFSET(15460, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 862),
+    NAME_FUNC_OFFSET(15485, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 863),
+    NAME_FUNC_OFFSET(15513, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 864),
+    NAME_FUNC_OFFSET(15533, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, 865),
+    NAME_FUNC_OFFSET(15555, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 866),
+    NAME_FUNC_OFFSET(15576, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 867),
+    NAME_FUNC_OFFSET(15602, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 868),
+    NAME_FUNC_OFFSET(15635, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 869),
+    NAME_FUNC_OFFSET(15666, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 870),
+    NAME_FUNC_OFFSET(15687, gl_dispatch_stub_871, gl_dispatch_stub_871, NULL, 871),
+    NAME_FUNC_OFFSET(15718, gl_dispatch_stub_872, gl_dispatch_stub_872, NULL, 872),
+    NAME_FUNC_OFFSET(15738, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, 873),
+    NAME_FUNC_OFFSET(15766, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, 874),
+    NAME_FUNC_OFFSET(15789, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, 875),
+    NAME_FUNC_OFFSET(15814, glActiveProgramEXT, glActiveProgramEXT, NULL, 876),
+    NAME_FUNC_OFFSET(15833, glCreateShaderProgramEXT, glCreateShaderProgramEXT, NULL, 877),
+    NAME_FUNC_OFFSET(15858, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL, 878),
+    NAME_FUNC_OFFSET(15880, gl_dispatch_stub_879, gl_dispatch_stub_879, NULL, 879),
+    NAME_FUNC_OFFSET(15905, gl_dispatch_stub_880, gl_dispatch_stub_880, NULL, 880),
+    NAME_FUNC_OFFSET(15934, gl_dispatch_stub_881, gl_dispatch_stub_881, NULL, 881),
+    NAME_FUNC_OFFSET(15965, gl_dispatch_stub_882, gl_dispatch_stub_882, NULL, 882),
+    NAME_FUNC_OFFSET(15989, gl_dispatch_stub_883, gl_dispatch_stub_883, NULL, 883),
+    NAME_FUNC_OFFSET(16014, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, 884),
+    NAME_FUNC_OFFSET(16053, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, 885),
+    NAME_FUNC_OFFSET(16082, glArrayElement, glArrayElement, NULL, 306),
+    NAME_FUNC_OFFSET(16100, glBindTexture, glBindTexture, NULL, 307),
+    NAME_FUNC_OFFSET(16117, glDrawArrays, glDrawArrays, NULL, 310),
+    NAME_FUNC_OFFSET(16133, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, 322),
+    NAME_FUNC_OFFSET(16158, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
+    NAME_FUNC_OFFSET(16178, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
+    NAME_FUNC_OFFSET(16198, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
+    NAME_FUNC_OFFSET(16221, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
+    NAME_FUNC_OFFSET(16244, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, 327),
+    NAME_FUNC_OFFSET(16264, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, 328),
+    NAME_FUNC_OFFSET(16281, glGetPointerv, glGetPointerv, NULL, 329),
+    NAME_FUNC_OFFSET(16298, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
+    NAME_FUNC_OFFSET(16313, glPrioritizeTextures, glPrioritizeTextures, NULL, 331),
+    NAME_FUNC_OFFSET(16337, glTexSubImage1D, glTexSubImage1D, NULL, 332),
+    NAME_FUNC_OFFSET(16356, glTexSubImage2D, glTexSubImage2D, NULL, 333),
+    NAME_FUNC_OFFSET(16375, glBlendColor, glBlendColor, NULL, 336),
+    NAME_FUNC_OFFSET(16391, glBlendEquation, glBlendEquation, NULL, 337),
+    NAME_FUNC_OFFSET(16410, glDrawRangeElements, glDrawRangeElements, NULL, 338),
+    NAME_FUNC_OFFSET(16433, glColorTable, glColorTable, NULL, 339),
+    NAME_FUNC_OFFSET(16449, glColorTable, glColorTable, NULL, 339),
+    NAME_FUNC_OFFSET(16465, glColorTableParameterfv, glColorTableParameterfv, NULL, 340),
+    NAME_FUNC_OFFSET(16492, glColorTableParameteriv, glColorTableParameteriv, NULL, 341),
+    NAME_FUNC_OFFSET(16519, glCopyColorTable, glCopyColorTable, NULL, 342),
+    NAME_FUNC_OFFSET(16539, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
+    NAME_FUNC_OFFSET(16558, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, 343),
+    NAME_FUNC_OFFSET(16577, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
+    NAME_FUNC_OFFSET(16607, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, 344),
+    NAME_FUNC_OFFSET(16637, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
+    NAME_FUNC_OFFSET(16667, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, 345),
+    NAME_FUNC_OFFSET(16697, glColorSubTable, glColorSubTable, NULL, 346),
+    NAME_FUNC_OFFSET(16716, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
+    NAME_FUNC_OFFSET(16739, glConvolutionFilter1D, glConvolutionFilter1D, NULL, 348),
+    NAME_FUNC_OFFSET(16764, glConvolutionFilter2D, glConvolutionFilter2D, NULL, 349),
+    NAME_FUNC_OFFSET(16789, glConvolutionParameterf, glConvolutionParameterf, NULL, 350),
+    NAME_FUNC_OFFSET(16816, glConvolutionParameterfv, glConvolutionParameterfv, NULL, 351),
+    NAME_FUNC_OFFSET(16844, glConvolutionParameteri, glConvolutionParameteri, NULL, 352),
+    NAME_FUNC_OFFSET(16871, glConvolutionParameteriv, glConvolutionParameteriv, NULL, 353),
+    NAME_FUNC_OFFSET(16899, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, 354),
+    NAME_FUNC_OFFSET(16928, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, 355),
+    NAME_FUNC_OFFSET(16957, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, 356),
+    NAME_FUNC_OFFSET(16983, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, 357),
+    NAME_FUNC_OFFSET(17014, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, 358),
+    NAME_FUNC_OFFSET(17045, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, 359),
+    NAME_FUNC_OFFSET(17069, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
+    NAME_FUNC_OFFSET(17092, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, 361),
+    NAME_FUNC_OFFSET(17110, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, 362),
+    NAME_FUNC_OFFSET(17139, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, 363),
+    NAME_FUNC_OFFSET(17168, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, 364),
+    NAME_FUNC_OFFSET(17183, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, 365),
+    NAME_FUNC_OFFSET(17209, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, 366),
+    NAME_FUNC_OFFSET(17235, glHistogram, glHistogram, NULL, 367),
+    NAME_FUNC_OFFSET(17250, glMinmax, glMinmax, NULL, 368),
+    NAME_FUNC_OFFSET(17262, glResetHistogram, glResetHistogram, NULL, 369),
+    NAME_FUNC_OFFSET(17282, glResetMinmax, glResetMinmax, NULL, 370),
+    NAME_FUNC_OFFSET(17299, glTexImage3D, glTexImage3D, NULL, 371),
+    NAME_FUNC_OFFSET(17315, glTexSubImage3D, glTexSubImage3D, NULL, 372),
+    NAME_FUNC_OFFSET(17334, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
+    NAME_FUNC_OFFSET(17357, glActiveTextureARB, glActiveTextureARB, NULL, 374),
+    NAME_FUNC_OFFSET(17373, glClientActiveTextureARB, glClientActiveTextureARB, NULL, 375),
+    NAME_FUNC_OFFSET(17395, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, 376),
+    NAME_FUNC_OFFSET(17413, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, 377),
+    NAME_FUNC_OFFSET(17432, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, 378),
+    NAME_FUNC_OFFSET(17450, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, 379),
+    NAME_FUNC_OFFSET(17469, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, 380),
+    NAME_FUNC_OFFSET(17487, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, 381),
+    NAME_FUNC_OFFSET(17506, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, 382),
+    NAME_FUNC_OFFSET(17524, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, 383),
+    NAME_FUNC_OFFSET(17543, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, 384),
+    NAME_FUNC_OFFSET(17561, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, 385),
+    NAME_FUNC_OFFSET(17580, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, 386),
+    NAME_FUNC_OFFSET(17598, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, 387),
+    NAME_FUNC_OFFSET(17617, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, 388),
+    NAME_FUNC_OFFSET(17635, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, 389),
+    NAME_FUNC_OFFSET(17654, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, 390),
+    NAME_FUNC_OFFSET(17672, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, 391),
+    NAME_FUNC_OFFSET(17691, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, 392),
+    NAME_FUNC_OFFSET(17709, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, 393),
+    NAME_FUNC_OFFSET(17728, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, 394),
+    NAME_FUNC_OFFSET(17746, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, 395),
+    NAME_FUNC_OFFSET(17765, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, 396),
+    NAME_FUNC_OFFSET(17783, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, 397),
+    NAME_FUNC_OFFSET(17802, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, 398),
+    NAME_FUNC_OFFSET(17820, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, 399),
+    NAME_FUNC_OFFSET(17839, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, 400),
+    NAME_FUNC_OFFSET(17857, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, 401),
+    NAME_FUNC_OFFSET(17876, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, 402),
+    NAME_FUNC_OFFSET(17894, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, 403),
+    NAME_FUNC_OFFSET(17913, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, 404),
+    NAME_FUNC_OFFSET(17931, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, 405),
+    NAME_FUNC_OFFSET(17950, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, 406),
+    NAME_FUNC_OFFSET(17968, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, 407),
+    NAME_FUNC_OFFSET(17987, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
+    NAME_FUNC_OFFSET(18010, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, 441),
+    NAME_FUNC_OFFSET(18033, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, 442),
+    NAME_FUNC_OFFSET(18056, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, 443),
+    NAME_FUNC_OFFSET(18079, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, 444),
+    NAME_FUNC_OFFSET(18102, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
+    NAME_FUNC_OFFSET(18119, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, 446),
+    NAME_FUNC_OFFSET(18142, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, 447),
+    NAME_FUNC_OFFSET(18165, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, 448),
+    NAME_FUNC_OFFSET(18188, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, 449),
+    NAME_FUNC_OFFSET(18214, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, 450),
+    NAME_FUNC_OFFSET(18240, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, 451),
+    NAME_FUNC_OFFSET(18266, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, 452),
+    NAME_FUNC_OFFSET(18290, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, 453),
+    NAME_FUNC_OFFSET(18317, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, 454),
+    NAME_FUNC_OFFSET(18343, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, 461),
+    NAME_FUNC_OFFSET(18363, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, 462),
+    NAME_FUNC_OFFSET(18383, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, 463),
+    NAME_FUNC_OFFSET(18403, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, 464),
+    NAME_FUNC_OFFSET(18426, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, 465),
+    NAME_FUNC_OFFSET(18450, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, 466),
+    NAME_FUNC_OFFSET(18473, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, 467),
+    NAME_FUNC_OFFSET(18497, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
+    NAME_FUNC_OFFSET(18514, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, 474),
+    NAME_FUNC_OFFSET(18532, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
+    NAME_FUNC_OFFSET(18549, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, 476),
+    NAME_FUNC_OFFSET(18567, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
+    NAME_FUNC_OFFSET(18584, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, 478),
+    NAME_FUNC_OFFSET(18602, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
+    NAME_FUNC_OFFSET(18619, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, 480),
+    NAME_FUNC_OFFSET(18637, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
+    NAME_FUNC_OFFSET(18654, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, 482),
+    NAME_FUNC_OFFSET(18672, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
+    NAME_FUNC_OFFSET(18689, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, 484),
+    NAME_FUNC_OFFSET(18707, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
+    NAME_FUNC_OFFSET(18724, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, 486),
+    NAME_FUNC_OFFSET(18742, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
+    NAME_FUNC_OFFSET(18759, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, 488),
+    NAME_FUNC_OFFSET(18777, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
+    NAME_FUNC_OFFSET(18794, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, 490),
+    NAME_FUNC_OFFSET(18812, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, 491),
+    NAME_FUNC_OFFSET(18831, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, 492),
+    NAME_FUNC_OFFSET(18850, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, 493),
+    NAME_FUNC_OFFSET(18869, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, 494),
+    NAME_FUNC_OFFSET(18888, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, 495),
+    NAME_FUNC_OFFSET(18908, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, 496),
+    NAME_FUNC_OFFSET(18928, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, 497),
+    NAME_FUNC_OFFSET(18948, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, 498),
+    NAME_FUNC_OFFSET(18966, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
+    NAME_FUNC_OFFSET(18983, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, 500),
+    NAME_FUNC_OFFSET(19001, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
+    NAME_FUNC_OFFSET(19018, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, 502),
+    NAME_FUNC_OFFSET(19036, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, 503),
+    NAME_FUNC_OFFSET(19054, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
+    NAME_FUNC_OFFSET(19071, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, 505),
+    NAME_FUNC_OFFSET(19089, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, 506),
+    NAME_FUNC_OFFSET(19108, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, 507),
+    NAME_FUNC_OFFSET(19127, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, 508),
+    NAME_FUNC_OFFSET(19146, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, 509),
+    NAME_FUNC_OFFSET(19168, glBindBufferARB, glBindBufferARB, NULL, 510),
+    NAME_FUNC_OFFSET(19181, glBufferDataARB, glBufferDataARB, NULL, 511),
+    NAME_FUNC_OFFSET(19194, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
+    NAME_FUNC_OFFSET(19210, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
+    NAME_FUNC_OFFSET(19226, glGenBuffersARB, glGenBuffersARB, NULL, 514),
+    NAME_FUNC_OFFSET(19239, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, 515),
+    NAME_FUNC_OFFSET(19262, glGetBufferPointervARB, glGetBufferPointervARB, NULL, 516),
+    NAME_FUNC_OFFSET(19282, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, 517),
+    NAME_FUNC_OFFSET(19301, glIsBufferARB, glIsBufferARB, NULL, 518),
+    NAME_FUNC_OFFSET(19312, glMapBufferARB, glMapBufferARB, NULL, 519),
+    NAME_FUNC_OFFSET(19324, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
+    NAME_FUNC_OFFSET(19338, glBeginQueryARB, glBeginQueryARB, NULL, 521),
+    NAME_FUNC_OFFSET(19351, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
+    NAME_FUNC_OFFSET(19367, glEndQueryARB, glEndQueryARB, NULL, 523),
+    NAME_FUNC_OFFSET(19378, glGenQueriesARB, glGenQueriesARB, NULL, 524),
+    NAME_FUNC_OFFSET(19391, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, 525),
+    NAME_FUNC_OFFSET(19410, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, 526),
+    NAME_FUNC_OFFSET(19430, glGetQueryivARB, glGetQueryivARB, NULL, 527),
+    NAME_FUNC_OFFSET(19443, glIsQueryARB, glIsQueryARB, NULL, 528),
+    NAME_FUNC_OFFSET(19453, glCompileShaderARB, glCompileShaderARB, NULL, 530),
+    NAME_FUNC_OFFSET(19469, glGetActiveUniformARB, glGetActiveUniformARB, NULL, 535),
+    NAME_FUNC_OFFSET(19488, glGetShaderSourceARB, glGetShaderSourceARB, NULL, 541),
+    NAME_FUNC_OFFSET(19506, glGetUniformLocationARB, glGetUniformLocationARB, NULL, 542),
+    NAME_FUNC_OFFSET(19527, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
+    NAME_FUNC_OFFSET(19542, glGetUniformivARB, glGetUniformivARB, NULL, 544),
+    NAME_FUNC_OFFSET(19557, glLinkProgramARB, glLinkProgramARB, NULL, 545),
+    NAME_FUNC_OFFSET(19571, glShaderSourceARB, glShaderSourceARB, NULL, 546),
+    NAME_FUNC_OFFSET(19586, glUniform1fARB, glUniform1fARB, NULL, 547),
+    NAME_FUNC_OFFSET(19598, glUniform1fvARB, glUniform1fvARB, NULL, 548),
+    NAME_FUNC_OFFSET(19611, glUniform1iARB, glUniform1iARB, NULL, 549),
+    NAME_FUNC_OFFSET(19623, glUniform1ivARB, glUniform1ivARB, NULL, 550),
+    NAME_FUNC_OFFSET(19636, glUniform2fARB, glUniform2fARB, NULL, 551),
+    NAME_FUNC_OFFSET(19648, glUniform2fvARB, glUniform2fvARB, NULL, 552),
+    NAME_FUNC_OFFSET(19661, glUniform2iARB, glUniform2iARB, NULL, 553),
+    NAME_FUNC_OFFSET(19673, glUniform2ivARB, glUniform2ivARB, NULL, 554),
+    NAME_FUNC_OFFSET(19686, glUniform3fARB, glUniform3fARB, NULL, 555),
+    NAME_FUNC_OFFSET(19698, glUniform3fvARB, glUniform3fvARB, NULL, 556),
+    NAME_FUNC_OFFSET(19711, glUniform3iARB, glUniform3iARB, NULL, 557),
+    NAME_FUNC_OFFSET(19723, glUniform3ivARB, glUniform3ivARB, NULL, 558),
+    NAME_FUNC_OFFSET(19736, glUniform4fARB, glUniform4fARB, NULL, 559),
+    NAME_FUNC_OFFSET(19748, glUniform4fvARB, glUniform4fvARB, NULL, 560),
+    NAME_FUNC_OFFSET(19761, glUniform4iARB, glUniform4iARB, NULL, 561),
+    NAME_FUNC_OFFSET(19773, glUniform4ivARB, glUniform4ivARB, NULL, 562),
+    NAME_FUNC_OFFSET(19786, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, 563),
+    NAME_FUNC_OFFSET(19805, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, 564),
+    NAME_FUNC_OFFSET(19824, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, 565),
+    NAME_FUNC_OFFSET(19843, glUseProgramObjectARB, glUseProgramObjectARB, NULL, 566),
+    NAME_FUNC_OFFSET(19856, glValidateProgramARB, glValidateProgramARB, NULL, 567),
+    NAME_FUNC_OFFSET(19874, glBindAttribLocationARB, glBindAttribLocationARB, NULL, 568),
+    NAME_FUNC_OFFSET(19895, glGetActiveAttribARB, glGetActiveAttribARB, NULL, 569),
+    NAME_FUNC_OFFSET(19913, glGetAttribLocationARB, glGetAttribLocationARB, NULL, 570),
+    NAME_FUNC_OFFSET(19933, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+    NAME_FUNC_OFFSET(19947, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
+    NAME_FUNC_OFFSET(19964, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 572),
+    NAME_FUNC_OFFSET(19989, glDrawArraysInstancedARB, glDrawArraysInstancedARB, NULL, 572),
+    NAME_FUNC_OFFSET(20011, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 573),
+    NAME_FUNC_OFFSET(20038, glDrawElementsInstancedARB, glDrawElementsInstancedARB, NULL, 573),
+    NAME_FUNC_OFFSET(20062, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, 574),
+    NAME_FUNC_OFFSET(20098, gl_dispatch_stub_612, gl_dispatch_stub_612, NULL, 612),
+    NAME_FUNC_OFFSET(20114, gl_dispatch_stub_613, gl_dispatch_stub_613, NULL, 613),
+    NAME_FUNC_OFFSET(20133, glPointParameterfEXT, glPointParameterfEXT, NULL, 620),
+    NAME_FUNC_OFFSET(20151, glPointParameterfEXT, glPointParameterfEXT, NULL, 620),
+    NAME_FUNC_OFFSET(20172, glPointParameterfEXT, glPointParameterfEXT, NULL, 620),
+    NAME_FUNC_OFFSET(20194, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 621),
+    NAME_FUNC_OFFSET(20213, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 621),
+    NAME_FUNC_OFFSET(20235, glPointParameterfvEXT, glPointParameterfvEXT, NULL, 621),
+    NAME_FUNC_OFFSET(20258, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, 624),
+    NAME_FUNC_OFFSET(20277, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, 625),
+    NAME_FUNC_OFFSET(20297, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, 626),
+    NAME_FUNC_OFFSET(20316, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, 627),
+    NAME_FUNC_OFFSET(20336, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, 628),
+    NAME_FUNC_OFFSET(20355, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, 629),
+    NAME_FUNC_OFFSET(20375, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, 630),
+    NAME_FUNC_OFFSET(20394, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, 631),
+    NAME_FUNC_OFFSET(20414, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, 632),
+    NAME_FUNC_OFFSET(20433, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, 633),
+    NAME_FUNC_OFFSET(20453, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, 634),
+    NAME_FUNC_OFFSET(20473, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, 635),
+    NAME_FUNC_OFFSET(20494, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, 636),
+    NAME_FUNC_OFFSET(20514, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, 637),
+    NAME_FUNC_OFFSET(20535, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, 638),
+    NAME_FUNC_OFFSET(20555, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, 639),
+    NAME_FUNC_OFFSET(20576, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, 640),
+    NAME_FUNC_OFFSET(20600, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, 641),
+    NAME_FUNC_OFFSET(20618, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, 642),
+    NAME_FUNC_OFFSET(20638, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, 643),
+    NAME_FUNC_OFFSET(20656, glFogCoorddEXT, glFogCoorddEXT, NULL, 644),
+    NAME_FUNC_OFFSET(20668, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 645),
+    NAME_FUNC_OFFSET(20681, glFogCoordfEXT, glFogCoordfEXT, NULL, 646),
+    NAME_FUNC_OFFSET(20693, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 647),
+    NAME_FUNC_OFFSET(20706, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 649),
+    NAME_FUNC_OFFSET(20726, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, 649),
+    NAME_FUNC_OFFSET(20750, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 666),
+    NAME_FUNC_OFFSET(20764, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 666),
+    NAME_FUNC_OFFSET(20781, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 667),
+    NAME_FUNC_OFFSET(20796, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 667),
+    NAME_FUNC_OFFSET(20814, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 668),
+    NAME_FUNC_OFFSET(20828, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 668),
+    NAME_FUNC_OFFSET(20845, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 669),
+    NAME_FUNC_OFFSET(20860, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 669),
+    NAME_FUNC_OFFSET(20878, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 670),
+    NAME_FUNC_OFFSET(20892, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 670),
+    NAME_FUNC_OFFSET(20909, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 671),
+    NAME_FUNC_OFFSET(20924, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 671),
+    NAME_FUNC_OFFSET(20942, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 672),
+    NAME_FUNC_OFFSET(20956, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 672),
+    NAME_FUNC_OFFSET(20973, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 673),
+    NAME_FUNC_OFFSET(20988, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 673),
+    NAME_FUNC_OFFSET(21006, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 674),
+    NAME_FUNC_OFFSET(21020, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 674),
+    NAME_FUNC_OFFSET(21037, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 675),
+    NAME_FUNC_OFFSET(21052, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 675),
+    NAME_FUNC_OFFSET(21070, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 676),
+    NAME_FUNC_OFFSET(21084, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 676),
+    NAME_FUNC_OFFSET(21101, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 677),
+    NAME_FUNC_OFFSET(21116, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 677),
+    NAME_FUNC_OFFSET(21134, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 678),
+    NAME_FUNC_OFFSET(21148, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 678),
+    NAME_FUNC_OFFSET(21165, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 679),
+    NAME_FUNC_OFFSET(21180, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 679),
+    NAME_FUNC_OFFSET(21198, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 680),
+    NAME_FUNC_OFFSET(21212, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 680),
+    NAME_FUNC_OFFSET(21229, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 681),
+    NAME_FUNC_OFFSET(21244, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 681),
+    NAME_FUNC_OFFSET(21262, glBindProgramNV, glBindProgramNV, NULL, 700),
+    NAME_FUNC_OFFSET(21279, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 701),
+    NAME_FUNC_OFFSET(21299, glGenProgramsNV, glGenProgramsNV, NULL, 703),
+    NAME_FUNC_OFFSET(21316, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 709),
+    NAME_FUNC_OFFSET(21342, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, 709),
+    NAME_FUNC_OFFSET(21371, glIsProgramNV, glIsProgramNV, NULL, 713),
+    NAME_FUNC_OFFSET(21386, glPointParameteriNV, glPointParameteriNV, NULL, 777),
+    NAME_FUNC_OFFSET(21404, glPointParameterivNV, glPointParameterivNV, NULL, 778),
+    NAME_FUNC_OFFSET(21423, gl_dispatch_stub_781, gl_dispatch_stub_781, NULL, 781),
+    NAME_FUNC_OFFSET(21444, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, 783),
+    NAME_FUNC_OFFSET(21460, glPrimitiveRestartIndexNV, glPrimitiveRestartIndexNV, NULL, 790),
+    NAME_FUNC_OFFSET(21484, gl_dispatch_stub_793, gl_dispatch_stub_793, NULL, 793),
+    NAME_FUNC_OFFSET(21508, gl_dispatch_stub_793, gl_dispatch_stub_793, NULL, 793),
+    NAME_FUNC_OFFSET(21535, glBindFramebufferEXT, glBindFramebufferEXT, NULL, 794),
+    NAME_FUNC_OFFSET(21553, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, 795),
+    NAME_FUNC_OFFSET(21572, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, 796),
+    NAME_FUNC_OFFSET(21597, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, 797),
+    NAME_FUNC_OFFSET(21618, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, 798),
+    NAME_FUNC_OFFSET(21640, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, 799),
+    NAME_FUNC_OFFSET(21666, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, 800),
+    NAME_FUNC_OFFSET(21689, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, 801),
+    NAME_FUNC_OFFSET(21712, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, 802),
+    NAME_FUNC_OFFSET(21735, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, 803),
+    NAME_FUNC_OFFSET(21753, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, 804),
+    NAME_FUNC_OFFSET(21772, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, 805),
+    NAME_FUNC_OFFSET(21789, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, 806),
+    NAME_FUNC_OFFSET(21827, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, 807),
+    NAME_FUNC_OFFSET(21856, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 808),
+    NAME_FUNC_OFFSET(21872, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, 809),
+    NAME_FUNC_OFFSET(21889, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, 810),
+    NAME_FUNC_OFFSET(21911, gl_dispatch_stub_811, gl_dispatch_stub_811, NULL, 811),
+    NAME_FUNC_OFFSET(21929, glBindFragDataLocationEXT, glBindFragDataLocationEXT, NULL, 814),
+    NAME_FUNC_OFFSET(21952, glGetFragDataLocationEXT, glGetFragDataLocationEXT, NULL, 815),
+    NAME_FUNC_OFFSET(21974, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 816),
+    NAME_FUNC_OFFSET(21990, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT, NULL, 817),
+    NAME_FUNC_OFFSET(22011, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT, NULL, 818),
+    NAME_FUNC_OFFSET(22033, glUniform1uiEXT, glUniform1uiEXT, NULL, 819),
+    NAME_FUNC_OFFSET(22046, glUniform1uivEXT, glUniform1uivEXT, NULL, 820),
+    NAME_FUNC_OFFSET(22060, glUniform2uiEXT, glUniform2uiEXT, NULL, 821),
+    NAME_FUNC_OFFSET(22073, glUniform2uivEXT, glUniform2uivEXT, NULL, 822),
+    NAME_FUNC_OFFSET(22087, glUniform3uiEXT, glUniform3uiEXT, NULL, 823),
+    NAME_FUNC_OFFSET(22100, glUniform3uivEXT, glUniform3uivEXT, NULL, 824),
+    NAME_FUNC_OFFSET(22114, glUniform4uiEXT, glUniform4uiEXT, NULL, 825),
+    NAME_FUNC_OFFSET(22127, glUniform4uivEXT, glUniform4uivEXT, NULL, 826),
+    NAME_FUNC_OFFSET(22141, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL, 827),
+    NAME_FUNC_OFFSET(22159, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL, 828),
+    NAME_FUNC_OFFSET(22178, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL, 829),
+    NAME_FUNC_OFFSET(22197, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT, NULL, 830),
+    NAME_FUNC_OFFSET(22217, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL, 831),
+    NAME_FUNC_OFFSET(22235, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL, 832),
+    NAME_FUNC_OFFSET(22254, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL, 833),
+    NAME_FUNC_OFFSET(22273, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT, NULL, 834),
+    NAME_FUNC_OFFSET(22293, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL, 835),
+    NAME_FUNC_OFFSET(22311, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL, 836),
+    NAME_FUNC_OFFSET(22330, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL, 837),
+    NAME_FUNC_OFFSET(22349, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT, NULL, 838),
+    NAME_FUNC_OFFSET(22369, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL, 839),
+    NAME_FUNC_OFFSET(22388, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL, 840),
+    NAME_FUNC_OFFSET(22406, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL, 841),
+    NAME_FUNC_OFFSET(22425, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL, 842),
+    NAME_FUNC_OFFSET(22444, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT, NULL, 843),
+    NAME_FUNC_OFFSET(22464, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL, 844),
+    NAME_FUNC_OFFSET(22483, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT, NULL, 845),
+    NAME_FUNC_OFFSET(22503, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT, NULL, 846),
+    NAME_FUNC_OFFSET(22523, glVertexAttribIPointerEXT, glVertexAttribIPointerEXT, NULL, 847),
+    NAME_FUNC_OFFSET(22546, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, 848),
+    NAME_FUNC_OFFSET(22572, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, 849),
+    NAME_FUNC_OFFSET(22585, glDisableIndexedEXT, glDisableIndexedEXT, NULL, 850),
+    NAME_FUNC_OFFSET(22596, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 851),
+    NAME_FUNC_OFFSET(22606, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, 852),
+    NAME_FUNC_OFFSET(22622, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, 853),
+    NAME_FUNC_OFFSET(22638, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, 854),
+    NAME_FUNC_OFFSET(22651, glGetTexParameterIivEXT, glGetTexParameterIivEXT, NULL, 857),
+    NAME_FUNC_OFFSET(22672, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT, NULL, 858),
+    NAME_FUNC_OFFSET(22694, glTexParameterIivEXT, glTexParameterIivEXT, NULL, 859),
+    NAME_FUNC_OFFSET(22712, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL, 860),
+    NAME_FUNC_OFFSET(22731, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, 861),
+    NAME_FUNC_OFFSET(22756, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, 862),
+    NAME_FUNC_OFFSET(22779, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, 863),
+    NAME_FUNC_OFFSET(22804, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, 864),
+    NAME_FUNC_OFFSET(22821, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, 866),
+    NAME_FUNC_OFFSET(22839, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, 867),
+    NAME_FUNC_OFFSET(22862, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, 868),
+    NAME_FUNC_OFFSET(22892, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, 869),
+    NAME_FUNC_OFFSET(22920, glProvokingVertexEXT, glProvokingVertexEXT, NULL, 870),
     NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
 };
 
index cdcfa36e51f9ad804e02f65b4874c5c59ebe81b1..0b4d8cf65df6ea2c488b4ebeba54154115355f3c 100644 (file)
@@ -5,7 +5,8 @@ GLAPI_SOURCES = \
        glapi_entrypoint.c \
        glapi_getproc.c \
        glapi_nop.c \
-       glthread.c
+       glthread.c \
+       glapi.c
 
 X86_API =                      \
        glapi_x86.S
index fdf2a89c52f21b8564b1e5d78b071df056da8a9b..69b6134bd27c5fcff96a774911cea5b77a6ecbd6 100644 (file)
 
 #include <stdlib.h>
 #include "u_current.h"
-#include "table.h"
 
 /* C version of the public entries */
+#define MAPI_TMP_DEFINES
+#define MAPI_TMP_PUBLIC_DECLARES
 #define MAPI_TMP_PUBLIC_ENTRIES
 #include "mapi_tmp.h"
 
@@ -51,6 +52,13 @@ entry_patch_public(void)
 {
 }
 
+mapi_func
+entry_get_public(int slot)
+{
+   /* pubic_entries are defined by MAPI_TMP_PUBLIC_ENTRIES */
+   return public_entries[slot];
+}
+
 mapi_func
 entry_generate(int slot)
 {
index 48ed3f9ec4a0550d779d20f04e68e9812177a484..9df81000470d0c4fb7083f2404216f20013e4400 100644 (file)
 #define _ENTRY_H_
 
 #include "u_compiler.h"
-#include "stub.h"
 
-/* declare public entries */
-#define MAPI_TMP_DEFINES
-#define MAPI_TMP_PUBLIC_DECLARES
-#include "mapi_tmp.h"
+typedef void (*mapi_func)(void);
 
 void
 entry_patch_public(void);
 
+mapi_func
+entry_get_public(int slot);
+
 mapi_func
 entry_generate(int slot);
 
index 2fbe73b5b3277cce28f2b5743b73121191df9d09..d14bf1c394698af92ff29c4ebed91b556e31aaa8 100644 (file)
 #include "u_execmem.h"
 #include "u_macros.h"
 
+#ifdef __linux__
+__asm__(".section .note.ABI-tag, \"a\"\n\t"
+        ".p2align 2\n\t"
+        ".long 1f - 0f\n\t"      /* name length */
+        ".long 3f - 2f\n\t"      /* data length */
+        ".long 1\n\t"            /* note length */
+        "0: .asciz \"GNU\"\n\t"  /* vendor name */
+        "1: .p2align 2\n\t"
+        "2: .long 0\n\t"         /* note data: the ABI tag */
+        ".long 2,4,20\n\t"       /* Minimum kernel version w/TLS */
+        "3: .p2align 2\n\t");    /* pad out section */
+#endif /* __linux__ */
+
 __asm__(".text");
 
 __asm__("x86_64_current_tls:\n\t"
-       "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t"
+       "movq u_current_table@GOTTPOFF(%rip), %rax\n\t"
        "ret");
 
+__asm__(".balign 32\n"
+        "x86_64_entry_start:");
+
 #define STUB_ASM_ENTRY(func)                             \
    ".globl " func "\n"                                   \
    ".type " func ", @function\n"                         \
@@ -43,7 +59,7 @@ __asm__("x86_64_current_tls:\n\t"
    func ":"
 
 #define STUB_ASM_CODE(slot)                              \
-   "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t"   \
+   "movq u_current_table@GOTTPOFF(%rip), %rax\n\t"   \
    "movq %fs:(%rax), %r11\n\t"                           \
    "jmp *(8 * " slot ")(%r11)"
 
@@ -58,6 +74,13 @@ entry_patch_public(void)
 {
 }
 
+mapi_func
+entry_get_public(int slot)
+{
+   extern char x86_64_entry_start[];
+   return (mapi_func) (x86_64_entry_start + slot * 32);
+}
+
 void
 entry_patch(mapi_func entry, int slot)
 {
index d4f7d98cf120385148e8f308a2e3885f0c375fc6..ea63490e1c782482d3693a2956b01fe0dbf1f01a 100644 (file)
 #include "u_execmem.h"
 #include "u_macros.h"
 
+#ifdef __linux__
+__asm__(".section .note.ABI-tag, \"a\"\n\t"
+        ".p2align 2\n\t"
+        ".long 1f - 0f\n\t"      /* name length */
+        ".long 3f - 2f\n\t"      /* data length */
+        ".long 1\n\t"            /* note length */
+        "0: .asciz \"GNU\"\n\t"  /* vendor name */
+        "1: .p2align 2\n\t"
+        "2: .long 0\n\t"         /* note data: the ABI tag */
+        ".long 2,4,20\n\t"       /* Minimum kernel version w/TLS */
+        "3: .p2align 2\n\t");    /* pad out section */
+#endif /* __linux__ */
+
 __asm__(".text");
 
 __asm__("x86_current_tls:\n\t"
@@ -37,15 +50,16 @@ __asm__("x86_current_tls:\n\t"
         "1:\n\t"
         "popl %eax\n\t"
        "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t"
-       "movl u_current_table_tls@GOTNTPOFF(%eax), %eax\n\t"
+       "movl u_current_table@GOTNTPOFF(%eax), %eax\n\t"
        "ret");
 
 #ifndef GLX_X86_READONLY_TEXT
-__asm__(".section wtext, \"awx\", @progbits\n"
-        ".balign 16\n"
-        "x86_entry_start:");
+__asm__(".section wtext, \"awx\", @progbits");
 #endif /* GLX_X86_READONLY_TEXT */
 
+__asm__(".balign 16\n"
+        "x86_entry_start:");
+
 #define STUB_ASM_ENTRY(func)     \
    ".globl " func "\n"           \
    ".type " func ", @function\n" \
@@ -88,6 +102,13 @@ entry_patch_public(void)
 #endif
 }
 
+mapi_func
+entry_get_public(int slot)
+{
+   extern char x86_entry_start[];
+   return (mapi_func) (x86_entry_start + slot * 16);
+}
+
 void
 entry_patch(mapi_func entry, int slot)
 {
index f37c7473a6f36d78ea9cadccaf71931fd44d88b6..0a07ad7424786161699c0741d6883b278b185afb 100644 (file)
@@ -32,7 +32,9 @@
 
 #define X86_ENTRY_SIZE 32
 
-__asm__(".text");
+__asm__(".text\n"
+        ".balign 32\n"
+        "x86_entry_start:");
 
 #define STUB_ASM_ENTRY(func)        \
    ".globl " func "\n"              \
@@ -60,6 +62,13 @@ entry_patch_public(void)
 {
 }
 
+mapi_func
+entry_get_public(int slot)
+{
+   extern const char x86_entry_start[];
+   return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE);
+}
+
 void
 entry_patch(mapi_func entry, int slot)
 {
index 2f1c3fff6ccee372a73be77420e250742f42f9a7..b471c40b1447bbe52e3e45219a3ae2866d30f63b 100644 (file)
@@ -36,8 +36,7 @@
 #include "table.h"
 
 /* dynamic stubs will run out before this array */
-#define MAPI_MAX_STUBS (sizeof(struct mapi_table) / sizeof(mapi_func))
-static const struct mapi_stub *mapi_stub_map[MAPI_MAX_STUBS];
+static const struct mapi_stub *mapi_stub_map[MAPI_TABLE_NUM_SLOTS];
 static int mapi_num_stubs;
 
 static const struct mapi_stub *
@@ -133,7 +132,7 @@ mapi_get_proc_address(const char *name)
    if (!stub)
       stub = stub_find_dynamic(name, 0);
 
-   return (stub) ? (mapi_proc) stub->addr : NULL;
+   return (stub) ? (mapi_proc) stub_get_addr(stub) : NULL;
 }
 
 /**
@@ -145,9 +144,9 @@ mapi_table_create(void)
    const struct mapi_table *noop = table_get_noop();
    struct mapi_table *tbl;
 
-   tbl = malloc(sizeof(*tbl));
+   tbl = malloc(MAPI_TABLE_SIZE);
    if (tbl)
-      memcpy(tbl, noop, sizeof(*tbl));
+      memcpy(tbl, noop, MAPI_TABLE_SIZE);
 
    return tbl;
 }
@@ -173,11 +172,12 @@ mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs)
 
    for (i = 0; i < mapi_num_stubs; i++) {
       const struct mapi_stub *stub = mapi_stub_map[i];
+      int slot = stub_get_slot(stub);
       mapi_func func = (mapi_func) procs[i];
 
       if (!func)
-         func = table_get_func(noop, stub);
-      table_set_func(tbl, stub, func);
+         func = table_get_func(noop, slot);
+      table_set_func(tbl, slot, func);
    }
 }
 
index 440eb4bb9c06e059ced9b7938d890bcd7565548f..5c212420a80190e56801ce8f1d3ce14b9920fb30 100644 (file)
@@ -45,6 +45,7 @@ class ABIEntry(object):
         self.slot = attrs['slot']
         self.hidden = attrs['hidden']
         self.alias = attrs['alias']
+        self.handcode = attrs['handcode']
 
     def c_prototype(self):
         return '%s %s(%s)' % (self.c_return(), self.name, self.c_params())
@@ -132,6 +133,7 @@ def abi_parse_line(line):
             'slot': -1,
             'hidden': False,
             'alias': None,
+            'handcode': None,
     }
 
     # extract attributes from the first column
@@ -144,6 +146,8 @@ def abi_parse_line(line):
             attrs['hidden'] = True
         elif val.startswith('alias='):
             attrs['alias'] = val[6:]
+        elif val.startswith('handcode='):
+            attrs['handcode'] = val[9:]
         elif not val:
             pass
         else:
@@ -166,10 +170,13 @@ def abi_parse(filename):
         # post-process attributes
         if attrs['alias']:
             try:
-                ent = entry_dict[attrs['alias']]
-                slot = ent.slot
+                alias = entry_dict[attrs['alias']]
             except KeyError:
                 raise Exception('failed to alias %s' % attrs['alias'])
+            if alias.alias:
+                raise Exception('recursive alias %s' % ent.name)
+            slot = alias.slot
+            attrs['alias'] = alias
         else:
             slot = next_slot
             next_slot += 1
@@ -194,209 +201,462 @@ def abi_parse(filename):
             raise Exception('entries are not ordered by slots')
         if entries[i].alias:
             raise Exception('first entry of slot %d aliases %s'
-                    % (slot, entries[i].alias))
+                    % (slot, entries[i].alias.name))
+        handcode = None
         while i < len(entries) and entries[i].slot == slot:
+            ent = entries[i]
+            if not handcode and ent.handcode:
+                handcode = ent.handcode
+            elif ent.handcode != handcode:
+                raise Exception('two aliases with handcode %s != %s',
+                        ent.handcode, handcode)
             i += 1
     if i < len(entries):
         raise Exception('there are %d invalid entries' % (len(entries) - 1))
 
     return entries
 
-def abi_dynamics():
-    """Return the dynamic entries."""
-    entries = []
-    for i in xrange(ABI_NUM_DYNAMIC_ENTRIES):
-        cols = ['void', 'dynamic%d' % (i), 'void']
-        attrs = { 'slot': -1, 'hidden': False, 'alias': None }
-        entries.append(ABIEntry(cols, attrs))
-    return entries
-
 class ABIPrinter(object):
-    """ABIEntry Printer"""
+    """MAPI Printer"""
 
-    def __init__(self, entries, options):
+    def __init__(self, entries):
         self.entries = entries
-        self.options = options
-        self._undefs = []
-
-    def _add_undefs(self, undefs):
-        self._undefs.extend(undefs)
 
-    def output_header(self):
-        print '/* This file is automatically generated.  Do not modify. */'
-        print
+        # sort entries by their names
+        self.entries_sorted_by_names = self.entries[:]
+        self.entries_sorted_by_names.sort(lambda x, y: cmp(x.name, y.name))
+
+        self.indent = ' ' * 3
+        self.noop_warn = 'noop_warn'
+        self.noop_generic = 'noop_generic'
+
+        self.api_defines = []
+        self.api_headers = ['"KHR/khrplatform.h"']
+        self.api_call = 'KHRONOS_APICALL'
+        self.api_entry = 'KHRONOS_APIENTRY'
+        self.api_attrs = 'KHRONOS_APIATTRIBUTES'
+
+        self.lib_need_table_size = True
+        self.lib_need_noop_array = True
+        self.lib_need_stubs = True
+        self.lib_need_entries = True
+
+    def c_notice(self):
+        return '/* This file is automatically generated by mapi_abi.py.  Do not modify. */'
+
+    def c_public_includes(self):
+        """Return includes of the client API headers."""
+        defines = ['#define ' + d for d in self.api_defines]
+        includes = ['#include ' + h for h in self.api_headers]
+        return "\n".join(defines + includes)
+
+    def need_entry_point(self, ent):
+        """Return True if an entry point is needed for the entry."""
+        # non-handcode hidden aliases may share the entry they alias
+        use_alias = (ent.hidden and ent.alias and not ent.handcode)
+        return not use_alias
+
+    def c_public_declarations(self, prefix):
+        """Return the declarations of public entry points."""
+        decls = []
+        for ent in self.entries:
+            if not self.need_entry_point(ent):
+                continue
+            export = self.api_call if not ent.hidden else ''
+            decls.append(self._c_decl(ent, prefix, True, export) + ';')
 
-    def output_footer(self):
-        print '/* clean up */'
-        for m in self._undefs:
-            print '#undef %s' % (m)
+        return "\n".join(decls)
 
-    def output_entry(self, ent):
-        if ent.slot < 0:
-            out_ent = 'MAPI_DYNAMIC_ENTRY(%s, %s, (%s))' % \
-                    (ent.c_return(), ent.name, ent.c_params())
-            out_code = ''
+    def c_mapi_table(self):
+        """Return defines of the dispatch table size."""
+        num_static_entries = 0
+        for ent in self.entries:
+            if not ent.alias:
+                num_static_entries += 1
+
+        return ('#define MAPI_TABLE_NUM_STATIC %d\n' + \
+                '#define MAPI_TABLE_NUM_DYNAMIC %d') % (
+                        num_static_entries, ABI_NUM_DYNAMIC_ENTRIES)
+
+    def c_mapi_table_initializer(self, prefix):
+        """Return the array initializer for mapi_table_fill."""
+        entries = [self._c_function(ent, prefix)
+                for ent in self.entries if not ent.alias]
+        pre = self.indent + '(mapi_proc) '
+        return pre + (',\n' + pre).join(entries)
+
+    def c_mapi_table_spec(self):
+        """Return the spec for mapi_init."""
+        specv1 = []
+        line = '"1'
+        for ent in self.entries:
+            if not ent.alias:
+                line += '\\0"\n'
+                specv1.append(line)
+                line = '"'
+            line += '%s\\0' % ent.name
+        line += '";'
+        specv1.append(line)
+
+        return self.indent + self.indent.join(specv1)
+
+    def _c_function(self, ent, prefix, mangle=False, stringify=False):
+        """Return the function name of an entry."""
+        formats = { True: '"%s%s"', False: '%s%s' }
+        fmt = formats[stringify]
+        name = ent.name
+        if mangle and ent.hidden:
+            name = '_dispatch_stub_' + str(ent.slot)
+        return fmt % (prefix, name)
+
+    def _c_function_call(self, ent, prefix):
+        """Return the function name used for calling."""
+        if ent.handcode:
+            # _c_function does not handle this case
+            fmt = '%s%s'
+            name = fmt % (prefix, ent.handcode)
+        elif self.need_entry_point(ent):
+            name = self._c_function(ent, prefix, True)
         else:
-            if ent.alias:
-                macro_ent = 'MAPI_ALIAS_ENTRY'
-                macro_code = 'MAPI_ALIAS_CODE'
-            else:
-                macro_ent = 'MAPI_ABI_ENTRY'
-                macro_code = 'MAPI_ABI_CODE'
+            name = self._c_function(ent.alias, prefix, True)
+        return name
 
-            if ent.ret:
-                macro_code += '_RETURN'
-            if ent.hidden:
-                macro_ent += '_HIDDEN'
-                macro_code += '_HIDDEN'
+    def _c_decl(self, ent, prefix, mangle=False, export=''):
+        """Return the C declaration for the entry."""
+        decl = '%s %s %s(%s)' % (ent.c_return(), self.api_entry,
+                self._c_function(ent, prefix, mangle), ent.c_params())
+        if export:
+            decl = export + ' ' + decl
+        if self.api_attrs:
+            decl += ' ' + self.api_attrs
 
-            if ent.alias:
-                out_ent = '%s(%s, %s, %s, (%s))' % (macro_ent,
-                        ent.alias, ent.c_return(), ent.name, ent.c_params())
-                out_code = '%s(%s, %s, %s, (%s))' % (macro_code,
-                        ent.alias, ent.c_return(), ent.name, ent.c_args())
-            else:
-                out_ent = '%s(%s, %s, (%s))' % (macro_ent,
-                        ent.c_return(), ent.name, ent.c_params())
-                out_code = '%s(%s, %s, (%s))' % (macro_code,
-                        ent.c_return(), ent.name, ent.c_args())
-
-        print out_ent
-        if out_code:
-            print '   ' + out_code
-
-    def output_entries(self, pool_offsets):
-        defs = [
-                # normal entries
-                ('MAPI_ABI_ENTRY', '(ret, name, params)', ''),
-                ('MAPI_ABI_CODE', '(ret, name, args)', ''),
-                ('MAPI_ABI_CODE_RETURN', '', 'MAPI_ABI_CODE'),
-                # alias entries
-                ('MAPI_ALIAS_ENTRY', '(alias, ret, name, params)', ''),
-                ('MAPI_ALIAS_CODE', '(alias, ret, name, args)', ''),
-                ('MAPI_ALIAS_CODE_RETURN', '', 'MAPI_ALIAS_CODE'),
-                # hidden normal entries
-                ('MAPI_ABI_ENTRY_HIDDEN', '', 'MAPI_ABI_ENTRY'),
-                ('MAPI_ABI_CODE_HIDDEN', '', 'MAPI_ABI_CODE'),
-                ('MAPI_ABI_CODE_RETURN_HIDDEN', '', 'MAPI_ABI_CODE_RETURN'),
-                # hidden alias entries
-                ('MAPI_ALIAS_ENTRY_HIDDEN', '', 'MAPI_ALIAS_ENTRY'),
-                ('MAPI_ALIAS_CODE_HIDDEN', '', 'MAPI_ALIAS_CODE'),
-                ('MAPI_ALIAS_CODE_RETURN_HIDDEN', '', 'MAPI_ALIAS_CODE_RETURN'),
-                # dynamic entries
-                ('MAPI_DYNAMIC_ENTRY', '(ret, name, params)', ''),
-        ]
-        undefs = [d[0] for d in defs]
-
-        print '#if defined(MAPI_ABI_ENTRY) || defined(MAPI_ABI_ENTRY_HIDDEN)'
-        print
-        for d in defs:
-            print '#ifndef %s' % (d[0])
-            if d[2]:
-                print '#define %s%s %s' % d
-            else:
-                print '#define %s%s' % d[:2]
+        return decl
 
-            print '#endif'
-        print
+    def _c_cast(self, ent):
+        """Return the C cast for the entry."""
+        cast = '%s (%s *)(%s)' % (
+                ent.c_return(), self.api_entry, ent.c_params())
 
-        print '/* see MAPI_TMP_TABLE */'
-        for ent in self.entries:
-            print '#define MAPI_SLOT_%s %d' % (ent.name, ent.slot)
-        print
-        print '/* see MAPI_TMP_PUBLIC_STUBS */'
-        for ent in self.entries:
-            print '#define MAPI_POOL_%s %d' % (ent.name, pool_offsets[ent])
-        print
+        return cast
 
-        # define macros that generate code
-        for ent in self.entries:
-            self.output_entry(ent)
-        print
-        dynamics = abi_dynamics()
-        for ent in dynamics:
-            self.output_entry(ent)
-        print
+    def c_private_declarations(self, prefix):
+        """Return the declarations of private functions."""
+        decls = [self._c_decl(ent, prefix) + ';'
+                for ent in self.entries if not ent.alias]
+
+        return "\n".join(decls)
 
+    def c_public_dispatches(self, prefix):
+        """Return the public dispatch functions."""
+        dispatches = []
         for ent in self.entries:
-            print '#undef MAPI_SLOT_%s' % (ent.name)
+            if not self.need_entry_point(ent):
+                continue
+
+            export = self.api_call if not ent.hidden else ''
+
+            proto = self._c_decl(ent, prefix, True, export)
+            cast = self._c_cast(ent)
+
+            ret = ''
+            if ent.ret:
+                ret = 'return '
+            stmt1 = self.indent
+            stmt1 += 'const struct mapi_table *tbl = u_current_get();'
+            stmt2 = self.indent
+            stmt2 += 'mapi_func func = ((const mapi_func *) tbl)[%d];' % (
+                    ent.slot)
+            stmt3 = self.indent
+            stmt3 += '%s((%s) func)(%s);' % (ret, cast, ent.c_args())
+
+            disp = '%s\n{\n%s\n%s\n%s\n}' % (proto, stmt1, stmt2, stmt3)
+
+            if ent.handcode:
+                disp = '#if 0\n' + disp + '\n#endif'
+
+            dispatches.append(disp)
+
+        return '\n\n'.join(dispatches)
+
+    def c_public_initializer(self, prefix):
+        """Return the initializer for public dispatch functions."""
+        names = []
         for ent in self.entries:
-            print '#undef MAPI_POOL_%s' % (ent.name)
-        print
-        print '#endif /* defined(MAPI_ABI_ENTRY) || defined(MAPI_ABI_ENTRY_HIDDEN) */'
-        print
+            if ent.alias:
+                continue
+
+            name = '%s(mapi_func) %s' % (self.indent,
+                    self._c_function_call(ent, prefix))
+            names.append(name)
+
+        return ',\n'.join(names)
 
-        self._add_undefs(undefs)
+    def c_stub_string_pool(self):
+        """Return the string pool for use by stubs."""
+        # sort entries by their names
+        sorted_entries = self.entries[:]
+        sorted_entries.sort(lambda x, y: cmp(x.name, y.name))
 
-    def _get_string_pool(self):
-        """Get the string pool."""
         pool = []
         offsets = {}
-
         count = 0
-        for ent in self.entries:
+        for ent in sorted_entries:
             offsets[ent] = count
-            pool.append(ent.name + '\\0')
+            pool.append('%s' % (ent.name))
             count += len(ent.name) + 1
 
-        return (pool, offsets)
+        pool_str =  self.indent + '"' + \
+                ('\\0"\n' + self.indent + '"').join(pool) + '";'
+        return (pool_str, offsets)
+
+    def c_stub_initializer(self, prefix, pool_offsets):
+        """Return the initializer for struct mapi_stub array."""
+        stubs = []
+        for ent in self.entries_sorted_by_names:
+            stubs.append('%s{ (void *) %d, %d, NULL }' % (
+                self.indent, pool_offsets[ent], ent.slot))
+
+        return ',\n'.join(stubs)
+
+    def c_noop_functions(self, prefix, warn_prefix):
+        """Return the noop functions."""
+        noops = []
+        for ent in self.entries:
+            if ent.alias:
+                continue
+
+            proto = self._c_decl(ent, prefix, False, 'static')
+
+            stmt1 = self.indent + '%s(%s);' % (self.noop_warn,
+                    self._c_function(ent, warn_prefix, False, True))
+
+            if ent.ret:
+                stmt2 = self.indent + 'return (%s) 0;' % (ent.ret)
+                noop = '%s\n{\n%s\n%s\n}' % (proto, stmt1, stmt2)
+            else:
+                noop = '%s\n{\n%s\n}' % (proto, stmt1)
+
+            noops.append(noop)
+
+        return '\n\n'.join(noops)
+
+    def c_noop_initializer(self, prefix, use_generic):
+        """Return an initializer for the noop dispatch table."""
+        entries = [self._c_function(ent, prefix)
+                for ent in self.entries if not ent.alias]
+        if use_generic:
+            entries = [self.noop_generic] * len(entries)
+
+        entries.extend([self.noop_generic] * ABI_NUM_DYNAMIC_ENTRIES)
+
+        pre = self.indent + '(mapi_func) '
+        return pre + (',\n' + pre).join(entries)
+
+    def c_asm_gcc(self, prefix):
+        asm = []
+
+        asm.append('__asm__(')
+        for ent in self.entries:
+            if not self.need_entry_point(ent):
+                continue
+
+            name = self._c_function(ent, prefix, True, True)
+
+            if ent.handcode:
+                asm.append('#if 0')
+
+            if ent.hidden:
+                asm.append('".hidden "%s"\\n"' % (name))
+
+            if ent.alias:
+                asm.append('".globl "%s"\\n"' % (name))
+                asm.append('".set "%s", "%s"\\n"' % (name,
+                    self._c_function(ent.alias, prefix, True, True)))
+            else:
+                asm.append('STUB_ASM_ENTRY(%s)"\\n"' % (name))
+                asm.append('"\\t"STUB_ASM_CODE("%d")"\\n"' % (ent.slot))
 
-    def output_sorted_indices(self):
-        entry_index_pairs = []
-        for i in xrange(len(self.entries)):
-            entry_index_pairs.append((self.entries[i], i))
-        entry_index_pairs.sort(lambda x, y: cmp(x[0].name, y[0].name))
+            if ent.handcode:
+                asm.append('#endif')
+            asm.append('')
+        asm.append(');')
 
-        print '/* see MAPI_TMP_PUBLIC_STUBS */'
-        print '#ifdef MAPI_ABI_SORTED_INDICES'
+        return "\n".join(asm)
+
+    def output_for_lib(self):
+        print self.c_notice()
         print
-        print 'static const int MAPI_ABI_SORTED_INDICES[] = {'
-        for ent, idx in entry_index_pairs:
-            print '   %d, /* %s */' % (idx, ent.name)
-        print '   -1'
-        print '};'
+        print '#ifdef MAPI_TMP_DEFINES'
+        print self.c_public_includes()
+        print
+        print self.c_public_declarations(self.prefix_lib)
+        print '#undef MAPI_TMP_DEFINES'
+        print '#endif /* MAPI_TMP_DEFINES */'
+
+        if self.lib_need_table_size:
+            print
+            print '#ifdef MAPI_TMP_TABLE'
+            print self.c_mapi_table()
+            print '#undef MAPI_TMP_TABLE'
+            print '#endif /* MAPI_TMP_TABLE */'
+
+        if self.lib_need_noop_array:
+            print
+            print '#ifdef MAPI_TMP_NOOP_ARRAY'
+            print '#ifdef DEBUG'
+            print
+            print self.c_noop_functions(self.prefix_noop, self.prefix_lib)
+            print
+            print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop)
+            print self.c_noop_initializer(self.prefix_noop, False)
+            print '};'
+            print
+            print '#else /* DEBUG */'
+            print
+            print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop)
+            print self.c_noop_initializer(self.prefix_noop, True)
+            print '};'
+            print
+            print '#endif /* DEBUG */'
+            print '#undef MAPI_TMP_NOOP_ARRAY'
+            print '#endif /* MAPI_TMP_NOOP_ARRAY */'
+
+        if self.lib_need_stubs:
+            pool, pool_offsets = self.c_stub_string_pool()
+            print
+            print '#ifdef MAPI_TMP_PUBLIC_STUBS'
+            print 'static const char public_string_pool[] ='
+            print pool
+            print
+            print 'static const struct mapi_stub public_stubs[] = {'
+            print self.c_stub_initializer(self.prefix_lib, pool_offsets)
+            print '};'
+            print '#undef MAPI_TMP_PUBLIC_STUBS'
+            print '#endif /* MAPI_TMP_PUBLIC_STUBS */'
+
+        if self.lib_need_entries:
+            print
+            print '#ifdef MAPI_TMP_PUBLIC_ENTRIES'
+            print self.c_public_dispatches(self.prefix_lib)
+            print
+            print 'static const mapi_func public_entries[] = {'
+            print self.c_public_initializer(self.prefix_lib)
+            print '};'
+            print '#undef MAPI_TMP_PUBLIC_ENTRIES'
+            print '#endif /* MAPI_TMP_PUBLIC_ENTRIES */'
+
+            print
+            print '#ifdef MAPI_TMP_STUB_ASM_GCC'
+            print self.c_asm_gcc(self.prefix_lib)
+            print '#undef MAPI_TMP_STUB_ASM_GCC'
+            print '#endif /* MAPI_TMP_STUB_ASM_GCC */'
+
+    def output_for_app(self):
+        print self.c_notice()
         print
-        print '#endif /* MAPI_ABI_SORTED_INDICES */'
+        print self.c_private_declarations(self.prefix_app)
         print
+        print '#ifdef API_TMP_DEFINE_SPEC'
+        print
+        print 'static const char %s_spec[] =' % (self.prefix_app)
+        print self.c_mapi_table_spec()
+        print
+        print 'static const mapi_proc %s_procs[] = {' % (self.prefix_app)
+        print self.c_mapi_table_initializer(self.prefix_app)
+        print '};'
+        print
+        print '#endif /* API_TMP_DEFINE_SPEC */'
 
-        self._add_undefs(['MAPI_ABI_SORTED_INDICES'])
+class GLAPIPrinter(ABIPrinter):
+    """OpenGL API Printer"""
 
-    def output_defines(self):
-        print '/* ABI defines */'
-        print '#ifdef MAPI_ABI_DEFINES'
-        print '#include "%s"' % (self.options.include)
-        print '#endif /* MAPI_ABI_DEFINES */'
-        print
+    def __init__(self, entries):
+        super(GLAPIPrinter, self).__init__(entries)
+
+        self.api_defines = ['GL_GLEXT_PROTOTYPES']
+        self.api_headers = ['"GL/gl.h"', '"GL/glext.h"']
+        self.api_call = 'GLAPI'
+        self.api_entry = 'APIENTRY'
+        self.api_attrs = ''
+
+        self.prefix_lib = 'gl'
+        self.prefix_app = '_mesa_'
+        self.prefix_noop = 'noop'
+
+    def output_for_app(self):
+        # not used
+        pass
 
-        self._add_undefs(['MAPI_ABI_DEFINES'])
+class ES1APIPrinter(GLAPIPrinter):
+    """OpenGL ES 1.x API Printer"""
 
-    def output(self):
-        pool, pool_offsets = self._get_string_pool()
+    def __init__(self, entries):
+        super(ES1APIPrinter, self).__init__(entries)
 
-        self.output_header()
-        self.output_defines()
-        self.output_entries(pool_offsets)
-        self.output_sorted_indices()
-        self.output_footer()
+        self.api_headers = ['"GLES/gl.h"', '"GLES/glext.h"']
+        self.api_call = 'GL_API'
+        self.api_entry = 'GL_APIENTRY'
+
+class ES2APIPrinter(GLAPIPrinter):
+    """OpenGL ES 2.x API Printer"""
+
+    def __init__(self, entries):
+        super(ES2APIPrinter, self).__init__(entries)
+
+        self.api_headers = ['"GLES2/gl2.h"', '"GLES2/gl2ext.h"']
+        self.api_call = 'GL_APICALL'
+        self.api_entry = 'GL_APIENTRY'
+
+class VGAPIPrinter(ABIPrinter):
+    """OpenVG API Printer"""
+
+    def __init__(self, entries):
+        super(VGAPIPrinter, self).__init__(entries)
+
+        self.api_defines = ['VG_VGEXT_PROTOTYPES']
+        self.api_headers = ['"VG/openvg.h"', '"VG/vgext.h"']
+        self.api_call = 'VG_API_CALL'
+        self.api_entry = 'VG_API_ENTRY'
+        self.api_attrs = 'VG_API_EXIT'
+
+        self.prefix_lib = 'vg'
+        self.prefix_app = 'vega'
+        self.prefix_noop = 'noop'
 
 def parse_args():
+    printers = ['glapi', 'es1api', 'es2api', 'vgapi']
+    modes = ['lib', 'app']
+
     parser = OptionParser(usage='usage: %prog [options] <filename>')
-    parser.add_option('-i', '--include', dest='include',
-            help='include the header for API defines')
+    parser.add_option('-p', '--printer', dest='printer',
+            help='printer to use: %s' % (", ".join(printers)))
+    parser.add_option('-m', '--mode', dest='mode',
+            help='target user: %s' % (", ".join(modes)))
 
     options, args = parser.parse_args()
-    if not args or not options.include:
+    if not args or options.printer not in printers or \
+            options.mode not in modes:
         parser.print_help()
         sys.exit(1)
 
     return (args[0], options)
 
 def main():
+    printers = {
+        'vgapi': VGAPIPrinter,
+        'glapi': GLAPIPrinter,
+        'es1api': ES1APIPrinter,
+        'es2api': ES2APIPrinter
+    }
+
     filename, options = parse_args()
 
     entries = abi_parse(filename)
-    printer = ABIPrinter(entries, options)
-    printer.output()
+    printer = printers[options.printer](entries)
+    if options.mode == 'lib':
+        printer.output_for_lib()
+    else:
+        printer.output_for_app()
 
 if __name__ == '__main__':
     main()
index 79beca47d2a1e038aa5690867ab0254b743563ec..a1b067fb73ce41fa9d5cedde60a6de59160b3938 100644 (file)
  *    Chia-I Wu <olv@lunarg.com>
  */
 
-#include "u_macros.h"
-
 #ifndef MAPI_ABI_HEADER
 #error "MAPI_ABI_HEADER must be defined"
 #endif
 
-
-/**
- * Get API defines.
- */
-#ifdef MAPI_TMP_DEFINES
-#   define MAPI_ABI_DEFINES
-#   include MAPI_ABI_HEADER
-
-#ifndef MAPI_ABI_PREFIX
-#error "MAPI_ABI_PREFIX must be defined"
-#endif
-#ifndef MAPI_ABI_PUBLIC
-#error "MAPI_ABI_PUBLIC must be defined"
-#endif
-#ifndef MAPI_ABI_ATTR
-#error "MAPI_ABI_ATTR must be defined"
-#endif
-
-#undef MAPI_TMP_DEFINES
-#endif /* MAPI_TMP_DEFINES */
-
-
-/**
- * Generate fields of struct mapi_table.
- */
-#ifdef MAPI_TMP_TABLE
-#   define MAPI_ABI_ENTRY(ret, name, params)                   \
-      ret (MAPI_ABI_ATTR *name) params;
-#   define MAPI_DYNAMIC_ENTRY(ret, name, params)               \
-      ret (MAPI_ABI_ATTR *name) params;
-#   include MAPI_ABI_HEADER
-#undef MAPI_TMP_TABLE
-#endif /* MAPI_TMP_TABLE */
-
-
-/**
- * Declare public entries.
- */
-#ifdef MAPI_TMP_PUBLIC_DECLARES
-#   define MAPI_ABI_ENTRY(ret, name, params)                   \
-      MAPI_ABI_PUBLIC ret MAPI_ABI_ATTR U_CONCAT(MAPI_ABI_PREFIX, name) params;
-#   define MAPI_ALIAS_ENTRY(alias, ret, name, params)          \
-      MAPI_ABI_ENTRY(ret, name, params);
-#   define MAPI_ABI_ENTRY_HIDDEN(ret, name, params)            \
-      HIDDEN ret MAPI_ABI_ATTR U_CONCAT(MAPI_ABI_PREFIX, name) params;
-#   define MAPI_ALIAS_ENTRY_HIDDEN(alias, ret, name, params)   \
-      MAPI_ABI_ENTRY_HIDDEN(ret, name, params)
-#   include MAPI_ABI_HEADER
-#undef MAPI_TMP_PUBLIC_DECLARES
-#endif /* MAPI_TMP_PUBLIC_DECLARES */
-
-
-/**
- * Generate string pool and public stubs.
- */
-#ifdef MAPI_TMP_PUBLIC_STUBS
-/* define the string pool */
-static const char public_string_pool[] =
-#   define MAPI_ABI_ENTRY(ret, name, params)                   \
-      U_STRINGIFY(name) "\0"
-#   define MAPI_ALIAS_ENTRY(alias, ret, name, params)          \
-      MAPI_ABI_ENTRY(ret, name, params)
-#   include MAPI_ABI_HEADER
-   ;
-/* define public_sorted_indices */
-#   define MAPI_ABI_SORTED_INDICES public_sorted_indices
-#   include MAPI_ABI_HEADER
-
-/* define public_stubs */
-static const struct mapi_stub public_stubs[] = {
-#   define MAPI_ABI_ENTRY(ret, name, params)                   \
-      { (mapi_func) U_CONCAT(MAPI_ABI_PREFIX, name),           \
-         MAPI_SLOT_ ## name, (void *) MAPI_POOL_ ## name },
-#   define MAPI_ALIAS_ENTRY(alias, ret, name, params)          \
-      MAPI_ABI_ENTRY(ret, name, params)
-#   include MAPI_ABI_HEADER
-   { NULL, -1, (void *) -1 }
-};
-
-#undef MAPI_TMP_PUBLIC_STUBS
-#endif /* MAPI_TMP_PUBLIC_STUBS */
-
-
-/**
- * Generate public entries.
- */
-#ifdef MAPI_TMP_PUBLIC_ENTRIES
-#   define MAPI_ABI_ENTRY(ret, name, params)                   \
-      ret MAPI_ABI_ATTR U_CONCAT(MAPI_ABI_PREFIX, name) params
-#   define MAPI_ABI_CODE(ret, name, args)                      \
-      {                                                        \
-         const struct mapi_table *tbl = u_current_get();       \
-         tbl->name args;                                       \
-      }
-#   define MAPI_ABI_CODE_RETURN(ret, name, args)               \
-      {                                                        \
-         const struct mapi_table *tbl = u_current_get();       \
-         return tbl->name args;                                \
-      }
-#   define MAPI_ALIAS_ENTRY(alias, ret, name, params)          \
-      MAPI_ABI_ENTRY(ret, name, params)
-#   define MAPI_ALIAS_CODE(alias, ret, name, args)             \
-      MAPI_ABI_CODE(ret, alias, args)
-#   define MAPI_ALIAS_CODE_RETURN(alias, ret, name, args)      \
-      MAPI_ABI_CODE_RETURN(ret, alias, args)
-#   include MAPI_ABI_HEADER
-#undef MAPI_TMP_PUBLIC_ENTRIES
-#endif /* MAPI_TMP_PUBLIC_ENTRIES */
-
-
-/**
- * Generate noop entries.
- */
-#ifdef MAPI_TMP_NOOP_ARRAY
-#ifdef DEBUG
-#   define MAPI_ABI_ENTRY(ret, name, params)                         \
-      static ret MAPI_ABI_ATTR U_CONCAT(noop_, name) params
-#   define MAPI_ABI_CODE(ret, name, args)                            \
-      {                                                              \
-         noop_warn(U_CONCAT_STR(MAPI_ABI_PREFIX, name));             \
-      }
-#   define MAPI_ABI_CODE_RETURN(ret, name, args)                     \
-      {                                                              \
-         noop_warn(U_CONCAT_STR(MAPI_ABI_PREFIX, name));             \
-         return (ret) 0;                                             \
-      }
-#   include MAPI_ABI_HEADER
-
-/* define the noop function array that may be casted to mapi_table */
-const mapi_func table_noop_array[] = {
-#   define MAPI_ABI_ENTRY(ret, name, params)                   \
-      (mapi_func) U_CONCAT(noop_, name),
-#   define MAPI_DYNAMIC_ENTRY(ret, name, params)               \
-      (mapi_func) noop_generic,
-#   include MAPI_ABI_HEADER
-      (mapi_func) noop_generic
-};
-
-#else /* DEBUG */
-
-const mapi_func table_noop_array[] = {
-#   define MAPI_ABI_ENTRY(ret, name, params)                   \
-      (mapi_func) noop_generic,
-#   define MAPI_DYNAMIC_ENTRY(ret, name, params)               \
-      (mapi_func) noop_generic,
-#   include MAPI_ABI_HEADER
-      (mapi_func) noop_generic
-};
-
-#endif /* DEBUG */
-#undef MAPI_TMP_NOOP_ARRAY
-#endif /* MAPI_TMP_NOOP_ARRAY */
-
-
-#ifdef MAPI_TMP_STUB_ASM_GCC
-#   define STUB_ASM_ALIAS(func, to)    \
-      ".globl " func "\n"              \
-      ".set " func ", " to
-#   define STUB_ASM_HIDE(func)         \
-      ".hidden " func
-
-#   define MAPI_ABI_ENTRY(ret, name, params)                         \
-      __asm__(STUB_ASM_ENTRY(U_CONCAT_STR(MAPI_ABI_PREFIX, name)));
-#   define MAPI_ABI_CODE(ret, name, args)                            \
-      __asm__(STUB_ASM_CODE(U_STRINGIFY(MAPI_SLOT_ ## name)));
-#   define MAPI_ALIAS_ENTRY(alias, ret, name, params)                \
-      __asm__(STUB_ASM_ALIAS(U_CONCAT_STR(MAPI_ABI_PREFIX, name),    \
-            U_CONCAT_STR(MAPI_ABI_PREFIX, alias)));
-#   define MAPI_ABI_ENTRY_HIDDEN(ret, name, params)                  \
-      __asm__(STUB_ASM_HIDE(U_CONCAT_STR(MAPI_ABI_PREFIX, name)));   \
-      MAPI_ABI_ENTRY(ret, name, params);
-#   define MAPI_ALIAS_ENTRY_HIDDEN(alias, ret, name, params)         \
-      __asm__(STUB_ASM_HIDE(U_CONCAT_STR(MAPI_ABI_PREFIX, name)));   \
-      MAPI_ALIAS_ENTRY(alias, ret, name, params);
-#   include MAPI_ABI_HEADER
-#undef MAPI_TMP_STUB_ASM_GCC
-#endif /* MAPI_TMP_STUB_ASM_GCC */
+#include MAPI_ABI_HEADER
index 5f327f3df628809036f22ed563a471461348159f..ed36e1af486bf931601c1b618574826637d47308 100644 (file)
@@ -1,12 +1,14 @@
 # src/mapi/mapi/sources.mak
 #
-# When MAPI_GLAPI_CURRENT is defined, MAPI_GLAPI_SOURCES can be built without
-# MAPI_SOURCES and it is used by glapi.
+# mapi may be used in several ways
 #
-# Otherwise, MAPI_ABI_HEADER must be defined.  It should expand to the header
-# generated by mapi_abi.py.
+#  - In default mode, mapi implements the interface defined by mapi.h.  To use
+#    this mode, compile MAPI_SOURCES.
+#
+#  - In util mode, mapi provides utility functions for use with glapi.  To use
+#    this mode, compile MAPI_UTIL_SOURCES with MAPI_MODE_UTIL defined.
 
-MAPI_GLAPI_SOURCES = \
+MAPI_UTIL_SOURCES = \
        u_current.c \
        u_execmem.c \
        u_thread.c
@@ -16,4 +18,4 @@ MAPI_SOURCES = \
        mapi.c \
        stub.c \
        table.c \
-       $(MAPI_GLAPI_SOURCES)
+       $(MAPI_UTIL_SOURCES)
index 8ceaec3132bf36bdf873e086b501278c80e61799..99b475a3b4b23012751e0834943229740aab7eb4 100644 (file)
@@ -27,7 +27,6 @@
  */
 
 #include <stdlib.h>
-#include <stddef.h> /* for offsetof */
 #include <string.h>
 #include <assert.h>
 
 #include "stub.h"
 #include "table.h"
 
-#define MAPI_TABLE_FIRST_DYNAMIC \
-   (offsetof(struct mapi_table, dynamic0) / sizeof(mapi_func))
-#define MAPI_TABLE_NUM_DYNAMIC \
-   ((offsetof(struct mapi_table, last) - \
-     offsetof(struct mapi_table, dynamic0)) / sizeof(mapi_func))
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
 
-/*
- * This will define public_string_pool, public_sorted_indices, and
- * public_stubs.
- */
+struct mapi_stub {
+   const void *name;
+   int slot;
+   mapi_func addr;
+};
+
+/* define public_string_pool and public_stubs */
 #define MAPI_TMP_PUBLIC_STUBS
 #include "mapi_tmp.h"
 
 static struct mapi_stub dynamic_stubs[MAPI_TABLE_NUM_DYNAMIC];
 static int num_dynamic_stubs;
-static int next_dynamic_slot = MAPI_TABLE_FIRST_DYNAMIC;
+static int next_dynamic_slot = MAPI_TABLE_NUM_STATIC;
 
 void
 stub_init_once(void)
@@ -74,11 +71,9 @@ static int
 stub_compare(const void *key, const void *elem)
 {
    const char *name = (const char *) key;
-   const int *index = (const int *) elem;
-   const struct mapi_stub *stub;
+   const struct mapi_stub *stub = (const struct mapi_stub *) elem;
    const char *stub_name;
 
-   stub = &public_stubs[*index];
    stub_name = &public_string_pool[(unsigned long) stub->name];
 
    return strcmp(name, stub_name);
@@ -90,13 +85,8 @@ stub_compare(const void *key, const void *elem)
 const struct mapi_stub *
 stub_find_public(const char *name)
 {
-   const int *index;
-
-   index = (const int *) bsearch(name, public_sorted_indices,
-         ARRAY_SIZE(public_sorted_indices) - 1,
-         sizeof(public_sorted_indices[0]), stub_compare);
-
-   return (index) ? &public_stubs[*index] : NULL;
+   return (const struct mapi_stub *) bsearch(name, public_stubs,
+         ARRAY_SIZE(public_stubs), sizeof(public_stubs[0]), stub_compare);
 }
 
 /**
@@ -109,14 +99,15 @@ stub_add_dynamic(const char *name)
    int idx;
 
    idx = num_dynamic_stubs;
-   if (idx >= MAPI_TABLE_NUM_DYNAMIC)
+   /* minus 1 to make sure we can never reach the last slot */
+   if (idx >= MAPI_TABLE_NUM_DYNAMIC - 1)
       return NULL;
 
    stub = &dynamic_stubs[idx];
 
-   /* dispatch to mapi_table->last, which is always no-op */
-   stub->addr =
-      entry_generate(MAPI_TABLE_FIRST_DYNAMIC + MAPI_TABLE_NUM_DYNAMIC);
+   /* dispatch to the last slot, which is reserved for no-op */
+   stub->addr = entry_generate(
+         MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC - 1);
    if (!stub->addr)
       return NULL;
 
@@ -178,3 +169,39 @@ stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias)
    entry_patch(stub->addr, slot);
    stub->slot = slot;
 }
+
+/**
+ * Return the name of a stub.
+ */
+const char *
+stub_get_name(const struct mapi_stub *stub)
+{
+   const char *name;
+
+   if (stub >= public_stubs &&
+       stub < public_stubs + ARRAY_SIZE(public_stubs))
+      name = &public_string_pool[(unsigned long) stub->name];
+   else
+      name = (const char *) stub->name;
+
+   return name;
+}
+
+/**
+ * Return the slot of a stub.
+ */
+int
+stub_get_slot(const struct mapi_stub *stub)
+{
+   return stub->slot;
+}
+
+/**
+ * Return the address of a stub.
+ */
+mapi_func
+stub_get_addr(const struct mapi_stub *stub)
+{
+   assert(stub->addr || (unsigned int) stub->slot < MAPI_TABLE_NUM_STATIC);
+   return (stub->addr) ? stub->addr : entry_get_public(stub->slot);
+}
index c7e194cf4fc51160ca68d036532c317706b61fe1..b2b6f1839c607e12afa05b0567742ecb6a7c9f93 100644 (file)
 #ifndef _STUB_H_
 #define _STUB_H_
 
-typedef void (*mapi_func)(void);
+#include "entry.h"
 
-struct mapi_stub {
-   mapi_func addr;
-   int slot;
-   const void *name;
-};
+struct mapi_stub;
 
 void
 stub_init_once(void);
@@ -49,4 +45,13 @@ stub_find_dynamic(const char *name, int generate);
 void
 stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias);
 
+const char *
+stub_get_name(const struct mapi_stub *stub);
+
+int
+stub_get_slot(const struct mapi_stub *stub);
+
+mapi_func
+stub_get_addr(const struct mapi_stub *stub);
+
 #endif /* _STUB_H_ */
index 8f4f700b92082d0eacbbec19249d81827187ead4..9bb9f654a2a1d9fccb38a766db579b2d8608278c 100644 (file)
@@ -29,7 +29,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "stub.h"
 #include "table.h"
 
 static void
@@ -41,7 +40,7 @@ noop_warn(const char *name)
       debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"));
 
    if (debug)
-      fprintf(stderr, "%s is no-op", name);
+      fprintf(stderr, "%s is no-op\n", name);
 }
 
 static int
@@ -52,5 +51,6 @@ noop_generic(void)
 }
 
 /* define noop_array */
+#define MAPI_TMP_DEFINES
 #define MAPI_TMP_NOOP_ARRAY
 #include "mapi_tmp.h"
index 48c99018aa39828189859274fe793bb5d0a8ef47..d84523f777799ee0a7bf1a74a14eaa6391ae2f06 100644 (file)
 #define _TABLE_H_
 
 #include "u_compiler.h"
-#include "stub.h"
+#include "entry.h"
 
-#define MAPI_TMP_DEFINES
-#include "mapi_tmp.h"
-
-struct mapi_table {
 #define MAPI_TMP_TABLE
 #include "mapi_tmp.h"
-   mapi_func last;
-};
+
+#define MAPI_TABLE_NUM_SLOTS (MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC)
+#define MAPI_TABLE_SIZE (MAPI_TABLE_NUM_SLOTS * sizeof(mapi_func))
 
 extern const mapi_func table_noop_array[];
 
@@ -53,24 +50,23 @@ table_get_noop(void)
 }
 
 /**
- * Update the dispatch table to dispatch a stub to the given function.
+ * Set the function of a slot.
  */
 static INLINE void
-table_set_func(struct mapi_table *tbl,
-               const struct mapi_stub *stub, mapi_func func)
+table_set_func(struct mapi_table *tbl, int slot, mapi_func func)
 {
    mapi_func *funcs = (mapi_func *) tbl;
-   funcs[stub->slot] = func;
+   funcs[slot] = func;
 }
 
 /**
- * Return the dispatched function of a stub.
+ * Return the function of a slot.
  */
 static INLINE mapi_func
-table_get_func(const struct mapi_table *tbl, const struct mapi_stub *stub)
+table_get_func(const struct mapi_table *tbl, int slot)
 {
    const mapi_func *funcs = (const mapi_func *) tbl;
-   return funcs[stub->slot];
+   return funcs[slot];
 }
 
 #endif /* _TABLE_H_ */
index ed9ccfe229958760546818c4f8c8c63bbc911784..7946d2a274194571a517e9f85b1447eac7535530 100644 (file)
@@ -51,7 +51,7 @@
 #include "u_current.h"
 #include "u_thread.h"
 
-#ifndef MAPI_GLAPI_CURRENT
+#ifndef MAPI_MODE_UTIL
 
 #include "table.h"
 #include "stub.h"
@@ -99,16 +99,13 @@ extern void (*__glapi_noop_table[])(void);
 /*@{*/
 #if defined(GLX_USE_TLS)
 
-__thread struct mapi_table *u_current_table_tls
+__thread struct mapi_table *u_current_table
     __attribute__((tls_model("initial-exec")))
     = (struct mapi_table *) table_noop_array;
 
-__thread void *u_current_user_tls
+__thread void *u_current_user
     __attribute__((tls_model("initial-exec")));
 
-const struct mapi_table *u_current_table;
-const void *u_current_user;
-
 #else
 
 struct mapi_table *u_current_table =
@@ -128,7 +125,7 @@ static int ThreadSafe;
 void
 u_current_destroy(void)
 {
-#if defined(THREADS) && defined(WIN32_THREADS)
+#if defined(THREADS) && defined(WIN32)
    u_tsd_destroy(&u_current_table_tsd);
    u_tsd_destroy(&u_current_user_tsd);
 #endif
@@ -147,7 +144,7 @@ u_current_init_tsd(void)
 /**
  * Mutex for multithread check.
  */
-#ifdef WIN32_THREADS
+#ifdef WIN32
 /* _glthread_DECLARE_STATIC_MUTEX is broken on windows.  There will be race! */
 #define CHECK_MULTITHREAD_LOCK()
 #define CHECK_MULTITHREAD_UNLOCK()
@@ -179,8 +176,8 @@ u_current_init(void)
    }
    else if (knownID != u_thread_self()) {
       ThreadSafe = 1;
-      u_current_set_internal(NULL);
-      u_current_set_user_internal(NULL);
+      u_current_set(NULL);
+      u_current_set_user(NULL);
    }
    CHECK_MULTITHREAD_UNLOCK();
 }
@@ -202,17 +199,17 @@ u_current_init(void)
  * void from the real context pointer type.
  */
 void
-u_current_set_user_internal(void *ptr)
+u_current_set_user(const void *ptr)
 {
    u_current_init();
 
 #if defined(GLX_USE_TLS)
-   u_current_user_tls = ptr;
+   u_current_user = (void *) ptr;
 #elif defined(THREADS)
-   u_tsd_set(&u_current_user_tsd, ptr);
-   u_current_user = (ThreadSafe) ? NULL : ptr;
+   u_tsd_set(&u_current_user_tsd, (void *) ptr);
+   u_current_user = (ThreadSafe) ? NULL : (void *) ptr;
 #else
-   u_current_user = ptr;
+   u_current_user = (void *) ptr;
 #endif
 }
 
@@ -225,7 +222,7 @@ void *
 u_current_get_user_internal(void)
 {
 #if defined(GLX_USE_TLS)
-   return u_current_user_tls;
+   return u_current_user;
 #elif defined(THREADS)
    return (ThreadSafe)
       ? u_tsd_get(&u_current_user_tsd)
@@ -241,22 +238,22 @@ u_current_get_user_internal(void)
  * table (__glapi_noop_table).
  */
 void
-u_current_set_internal(struct mapi_table *tbl)
+u_current_set(const struct mapi_table *tbl)
 {
    u_current_init();
 
    stub_init_once();
 
    if (!tbl)
-      tbl = (struct mapi_table *) table_noop_array;
+      tbl = (const struct mapi_table *) table_noop_array;
 
 #if defined(GLX_USE_TLS)
-   u_current_table_tls = tbl;
+   u_current_table = (struct mapi_table *) tbl;
 #elif defined(THREADS)
    u_tsd_set(&u_current_table_tsd, (void *) tbl);
-   u_current_table = (ThreadSafe) ? NULL : tbl;
+   u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
 #else
-   u_current_table = tbl;
+   u_current_table = (struct mapi_table *) tbl;
 #endif
 }
 
@@ -267,7 +264,7 @@ struct mapi_table *
 u_current_get_internal(void)
 {
 #if defined(GLX_USE_TLS)
-   return u_current_table_tls;
+   return u_current_table;
 #elif defined(THREADS)
    return (struct mapi_table *) ((ThreadSafe) ?
          u_tsd_get(&u_current_table_tsd) : (void *) u_current_table);
index 62e54c6c93d54b0355f0fe5c65e8692bc7a0cd2a..061fccc9495bc102421a6f4380610ae5d8383d8e 100644 (file)
@@ -1,28 +1,27 @@
 #ifndef _U_CURRENT_H_
 #define _U_CURRENT_H_
 
-#ifdef MAPI_GLAPI_CURRENT
+#ifdef MAPI_MODE_UTIL
 
 #include "glapi/glapi.h"
 
 /* ugly renames to match glapi.h */
 #define mapi_table _glapi_table
 
-#define u_current_table_tls _glapi_tls_Dispatch
-#define u_current_user_tls _glapi_tls_Context
+#ifdef GLX_USE_TLS
+#define u_current_table _glapi_tls_Dispatch
+#define u_current_user _glapi_tls_Context
+#else
 #define u_current_table _glapi_Dispatch
 #define u_current_user _glapi_Context
+#endif
 
-#define u_current_destroy _glapi_destroy_multithread
-#define u_current_init _glapi_check_multithread
-#define u_current_set_internal _glapi_set_dispatch
 #define u_current_get_internal _glapi_get_dispatch
-#define u_current_set_user_internal _glapi_set_context
 #define u_current_get_user_internal _glapi_get_context
 
 #define u_current_table_tsd _gl_DispatchTSD
 
-#else /* MAPI_GLAPI_CURRENT */
+#else /* MAPI_MODE_UTIL */
 
 #include "u_compiler.h"
 
@@ -30,15 +29,12 @@ struct mapi_table;
 
 #ifdef GLX_USE_TLS
 
-extern __thread struct mapi_table *u_current_table_tls
+extern __thread struct mapi_table *u_current_table
     __attribute__((tls_model("initial-exec")));
 
-extern __thread void *u_current_user_tls
+extern __thread void *u_current_user
     __attribute__((tls_model("initial-exec")));
 
-extern const struct mapi_table *u_current_table;
-extern const void *u_current_user;
-
 #else /* GLX_USE_TLS */
 
 extern struct mapi_table *u_current_table;
@@ -46,6 +42,8 @@ extern void *u_current_user;
 
 #endif /* GLX_USE_TLS */
 
+#endif /* MAPI_MODE_UTIL */
+
 void
 u_current_init(void);
 
@@ -53,50 +51,36 @@ void
 u_current_destroy(void);
 
 void
-u_current_set_internal(struct mapi_table *tbl);
+u_current_set(const struct mapi_table *tbl);
 
 struct mapi_table *
 u_current_get_internal(void);
 
 void
-u_current_set_user_internal(void *ptr);
+u_current_set_user(const void *ptr);
 
 void *
 u_current_get_user_internal(void);
 
-static INLINE void
-u_current_set(const struct mapi_table *tbl)
-{
-   u_current_set_internal((struct mapi_table *) tbl);
-}
-
 static INLINE const struct mapi_table *
 u_current_get(void)
 {
 #ifdef GLX_USE_TLS
-   return (const struct mapi_table *) u_current_table_tls;
+   return u_current_table;
 #else
    return (likely(u_current_table) ?
-         (const struct mapi_table *) u_current_table : u_current_get_internal());
+         u_current_table : u_current_get_internal());
 #endif
 }
 
-static INLINE void
-u_current_set_user(void *ptr)
-{
-   u_current_set_internal(ptr);
-}
-
-static INLINE void *
+static INLINE const void *
 u_current_get_user(void)
 {
 #ifdef GLX_USE_TLS
-   return u_current_user_tls;
+   return u_current_user;
 #else
    return likely(u_current_user) ? u_current_user : u_current_get_user_internal();
 #endif
 }
 
-#endif /* MAPI_GLAPI_CURRENT */
-
 #endif /* _U_CURRENT_H_ */
index e0fa64ae034d92081cdcc8c34818bc9d9d75a97e..138db47b5cd4d11d8e70605775f76307159d2329 100644 (file)
@@ -111,7 +111,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
  * Be sure that you compile using the Multithreaded runtime, otherwise
  * bad things will happen.
  */
-#ifdef WIN32_THREADS
+#ifdef WIN32
 
 static void InsteadOf_exit(int nCode)
 {
@@ -172,7 +172,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
    }
 }
 
-#endif /* WIN32_THREADS */
+#endif /* WIN32 */
 
 /*
  * BeOS threads
@@ -222,7 +222,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
  */
 
 unsigned long
-_glthread_GetID(void)
+u_thread_self(void)
 {
    return 0;
 }
index b4487a3400f86a8f2aa8ed9dbf692db16482c076..92a0a3916d0179614c53d2301d1b54782314aee7 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "u_compiler.h"
 
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)
 #ifndef THREADS
 #define THREADS
 #endif
@@ -85,7 +85,7 @@ typedef pthread_mutex_t u_mutex;
  * IMPORTANT: Link with multithreaded runtime library when THREADS are
  * used!
  */
-#ifdef WIN32_THREADS
+#ifdef WIN32
 #include <windows.h>
 
 struct u_tsd {
@@ -104,7 +104,7 @@ typedef CRITICAL_SECTION u_mutex;
 #define u_mutex_lock(name)    EnterCriticalSection(&name)
 #define u_mutex_unlock(name)  LeaveCriticalSection(&name)
 
-#endif /* WIN32_THREADS */
+#endif /* WIN32 */
 
 
 /*
index 702db03d1542aae9e526cbce53d4dff8d1f51ec0..e239e20987e7d80ba720f623fd1c39cab1ef15f6 100644 (file)
@@ -44,7 +44,7 @@ $(VGAPI_OBJECTS): %.o: $(MAPI)/%.c
 
 vgapi_tmp.h: vgapi.csv $(MAPI)/mapi_abi.py
        $(PYTHON2) $(PYTHON_FLAGS) $(MAPI)/mapi_abi.py \
-               -i vgapi/vgapi_defines.h $< > $@
+               --printer vgapi --mode lib $< > $@
 
 .PHONY: clean
 clean:
@@ -87,3 +87,5 @@ depend: $(VGAPI_SOURCES)
        @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \
                $(VGAPI_CPPFLAGS) $(VGAPI_SOURCES) 2>/dev/null | \
                sed -e 's,^$(MAPI)/,,' > depend
+
+-include depend
index 20d7f2744d09c3605fe0895dc179d411b76ec104..ee6d9fb827cef12aaa800035f2327b4ce7688f0b 100644 (file)
@@ -13,7 +13,7 @@ if env['platform'] != 'winddk':
                target = '#src/mapi/vgapi/vgapi_tmp.h',
                script = '../mapi/mapi_abi.py',
                source = 'vgapi.csv',
-               command = python_cmd + ' $SCRIPT -i vgapi/vgapi_defines.h $SOURCE > $TARGET'
+               command = python_cmd + ' $SCRIPT --printer vgapi --mode lib $SOURCE > $TARGET'
        )
 
        env.Append(CPPDEFINES = [
@@ -44,13 +44,20 @@ if env['platform'] != 'winddk':
 
        env.Depends(vgapi_objects, vgapi_header)
 
+       # libOpenVG.dll
+       env['LIBPREFIX'] = 'lib'
+       env['SHLIBPREFIX'] = 'lib'
+
        openvg = env.SharedLibrary(
-               target = 'libOpenVG',
+               target = 'OpenVG',
                source = vgapi_objects,
        )
 
        env.InstallSharedLibrary(openvg, version=(1, 0, 0))
 
-       vgapi = [env.FindIxes(openvg, 'LIBPREFIX', 'LIBSUFFIX')]
+       if env['platform'] == 'windows':
+           openvg = env.FindIxes(openvg, 'LIBPREFIX', 'LIBSUFFIX')
+       else:
+           openvg = env.FindIxes(openvg, 'SHLIBPREFIX', 'SHLIBSUFFIX')
 
-       Export(['vgapi', 'vgapi_header'])
+       Export(['openvg'])
index d28ee32b28be142471a3a51ed7646d6623a83a88..5b11d062aea63aa793bcd4648e3db31f8352157a 100644 (file)
@@ -79,15 +79,15 @@ void,                   Translate,                 VGfloat tx, VGfloat ty
 void,                   WritePixels,               const void *data, VGint dataStride, VGImageFormat dataFormat, VGint dx, VGint dy, VGint width, VGint height
 
 ## OpenVG 1.1
-#void,                   ClearGlyph,                VGFont font,VGuint glyphIndex
-#void,                   CopyMask,                  VGMaskLayer maskLayer, VGint dx, VGint dy, VGint sx, VGint sy, VGint width, VGint height
-#VGFont,                 CreateFont,                VGint glyphCapacityHint
-#VGMaskLayer,            CreateMaskLayer,           VGint width, VGint height
-#void,                   DestroyFont,               VGFont font
-#void,                   DestroyMaskLayer,          VGMaskLayer maskLayer
-#void,                   DrawGlyph,                 VGFont font, VGuint glyphIndex, VGbitfield paintModes, VGboolean allowAutoHinting
-#void,                   DrawGlyphs,                VGFont font, VGint glyphCount, const VGuint *glyphIndices, const VGfloat *adjustments_x, const VGfloat *adjustments_y, VGbitfield paintModes, VGboolean allowAutoHinting
-#void,                   FillMaskLayer,             VGMaskLayer maskLayer, VGint x, VGint y, VGint width, VGint height, VGfloat value
-#void,                   RenderToMask,              VGPath path, VGbitfield paintModes, VGMaskOperation operation
-#void,                   SetGlyphToImage,           VGFont font, VGuint glyphIndex, VGImage image, const VGfloat glyphOrigin[2], const VGfloat escapement[2]
-#void,                   SetGlyphToPath,            VGFont font, VGuint glyphIndex, VGPath path, VGboolean isHinted, const VGfloat glyphOrigin[2], const VGfloat escapement[2]
+void,                   ClearGlyph,                VGFont font, VGuint glyphIndex
+void,                   CopyMask,                  VGMaskLayer maskLayer, VGint dx, VGint dy, VGint sx, VGint sy, VGint width, VGint height
+VGFont,                 CreateFont,                VGint glyphCapacityHint
+VGMaskLayer,            CreateMaskLayer,           VGint width, VGint height
+void,                   DestroyFont,               VGFont font
+void,                   DestroyMaskLayer,          VGMaskLayer maskLayer
+void,                   DrawGlyph,                 VGFont font, VGuint glyphIndex, VGbitfield paintModes, VGboolean allowAutoHinting
+void,                   DrawGlyphs,                VGFont font, VGint glyphCount, const VGuint *glyphIndices, const VGfloat *adjustments_x, const VGfloat *adjustments_y, VGbitfield paintModes, VGboolean allowAutoHinting
+void,                   FillMaskLayer,             VGMaskLayer maskLayer, VGint x, VGint y, VGint width, VGint height, VGfloat value
+void,                   RenderToMask,              VGPath path, VGbitfield paintModes, VGMaskOperation operation
+void,                   SetGlyphToImage,           VGFont font, VGuint glyphIndex, VGImage image, const VGfloat glyphOrigin[2], const VGfloat escapement[2]
+void,                   SetGlyphToPath,            VGFont font, VGuint glyphIndex, VGPath path, VGboolean isHinted, const VGfloat glyphOrigin[2], const VGfloat escapement[2]
diff --git a/src/mapi/vgapi/vgapi_defines.h b/src/mapi/vgapi/vgapi_defines.h
deleted file mode 100644 (file)
index fb9f68c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef VGAPI_DEFINES_H
-#define VGAPI_DEFINES_H
-
-#include "VG/openvg.h"
-#include "VG/vgext.h"
-
-#define MAPI_ABI_PREFIX vg
-#define MAPI_ABI_PUBLIC VG_API_CALL
-#define MAPI_ABI_ATTR VG_API_ENTRY
-
-#endif /* VGAPI_DEFINES_H */
index 8b0756b84ec19d72406d3d87daf7b42dcab0999f..25e7cce425cdea4195060b26d49896bd609f2ea5 100644 (file)
@@ -6,37 +6,20 @@ include $(TOP)/configs/current
 MESA_LIBS := libmesa.a libmesagallium.a
 DEPENDS := depend
 
-ifeq ($(GLES_OVERLAY),1)
-ES1_LIBS := libes1gallium.a
-ES2_LIBS := libes2gallium.a
-DEPENDS += depend.es1 depend.es2
-endif
-
 MESA_OBJ_DIR := .
-ES1_OBJ_DIR := objs-es1
-ES2_OBJ_DIR := objs-es2
 
 
 include sources.mak
 
 # adjust object dirs
-ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_OBJECTS))
-ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_OBJECTS))
 MESA_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_OBJECTS))
-
-ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
-ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
 MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
 
 # define preprocessor flags
 MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
-ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES)
-ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES)
 
 # append include dirs
 MESA_CPPFLAGS += $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
-ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
-ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
 
 # tidy compiler flags
 CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
@@ -44,8 +27,6 @@ CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS))
 
 # LLVM is needed for the state tracker
 MESA_CFLAGS := $(LLVM_CFLAGS)
-ES1_CFLAGS := $(LLVM_CFLAGS)
-ES2_CFLAGS := $(LLVM_CFLAGS)
 
 define mesa-cc-c
        @mkdir -p $(dir $@)
@@ -66,29 +47,9 @@ $(MESA_OBJ_DIR)/%.o: %.cpp
 $(MESA_OBJ_DIR)/%.o: %.S
        $(call mesa-cc-c,MESA)
 
-$(ES1_OBJ_DIR)/%.o: %.c
-       $(call mesa-cc-c,ES1)
-
-$(ES1_OBJ_DIR)/%.o: %.cpp
-       $(call mesa-cxx-c,ES1)
-
-$(ES1_OBJ_DIR)/%.o: %.S
-       $(call mesa-cc-c,ES1)
-
-$(ES2_OBJ_DIR)/%.o: %.c
-       $(call mesa-cc-c,ES2)
-
-$(ES2_OBJ_DIR)/%.o: %.cpp
-       $(call mesa-cxx-c,ES2)
-
-$(ES2_OBJ_DIR)/%.o: %.S
-       $(call mesa-cc-c,ES2)
-
-
 # Default: build dependencies, then asm_subdirs, GLSL built-in lib,
 # then convenience libs (.a) and finally the device drivers:
-default: $(DEPENDS) asm_subdirs \
-       $(MESA_LIBS) $(ES1_LIBS) $(ES2_LIBS) driver_subdirs
+default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs
 
 main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
        $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
@@ -103,22 +64,10 @@ main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py m
 libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
        @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
 
-libes1.a: $(ES1_OBJECTS) $(GLSL_LIBS)
-       @$(MKLIB) -o es1 -static $(ES1_OBJECTS) $(GLSL_LIBS)
-
-libes2.a: $(ES2_OBJECTS) $(GLSL_LIBS)
-       @$(MKLIB) -o es2 -static $(ES2_OBJECTS) $(GLSL_LIBS)
-
 # Make archive of subset of core mesa object files for gallium
 libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
        @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
 
-libes1gallium.a: $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
-       @$(MKLIB) -o es1gallium -static $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
-
-libes2gallium.a: $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS)
-       @$(MKLIB) -o es2gallium -static $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS)
-
 ######################################################################
 # Device drivers
 driver_subdirs: $(MESA_LIBS)
@@ -146,18 +95,6 @@ depend: $(ALL_SOURCES)
        @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(MESA_CPPFLAGS) \
                $(ALL_SOURCES) > /dev/null 2>/dev/null
 
-depend.es1: $(ALL_SOURCES)
-       @echo "running $(MKDEP) for ES1"
-       @touch $@
-       @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES1_OBJ_DIR)/ $(ES1_CPPFLAGS) \
-               $(ALL_SOURCES) > /dev/null 2>/dev/null
-
-depend.es2: $(ALL_SOURCES)
-       @echo "running $(MKDEP) for ES2"
-       @touch $@
-       @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES2_OBJ_DIR)/ $(ES2_CPPFLAGS) \
-               $(ALL_SOURCES) > /dev/null 2>/dev/null
-
 ######################################################################
 # Installation rules
 
@@ -192,6 +129,7 @@ gl_pcedit = sed \
        -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
        -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
        -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
+       -e 's,@GLX_TLS@,$(GLX_TLS),' \
        -e 's,@GL_LIB@,$(GL_LIB),'
 
 gl.pc: gl.pc.in
@@ -234,17 +172,7 @@ install-dri: default
 tags:
        etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
 
-clean-es1:
-       -rm -f $(ES1_LIBS)
-       -rm -rf $(ES1_OBJ_DIR)
-       -rm -f depend.es1 depend.es1.bak
-
-clean-es2:
-       -rm -f $(ES2_LIBS)
-       -rm -rf $(ES2_OBJ_DIR)
-       -rm -f depend.es2 depend.es2.bak
-
-clean: clean-es1 clean-es2
+clean:
        -rm -f */*.o
        -rm -f */*/*.o
        -rm -f depend depend.bak libmesa.a libmesagallium.a
index 08d731de2d55e832cb5c982f63d7a0cef011678d..cc4ad09fa339050288c80e891e211d521fd68813 100644 (file)
@@ -16,7 +16,6 @@ if env['platform'] == 'windows':
     env.Append(CPPDEFINES = [
         '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
         'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
-        'WIN32_THREADS', # use Win32 thread API
     ])
     env.Prepend(CPPPATH = ['#src/talloc'])
 else:
index ba8be125718d27411550606752901cd3000a1a7e..fd12e4d0a667344d682e1c94d562cafc331ba1ce 100644 (file)
@@ -266,13 +266,16 @@ struct gen_mipmap_state
    GLuint FBO;
 };
 
-
+#define MAX_META_OPS_DEPTH      2
 /**
  * All per-context meta state.
  */
 struct gl_meta_state
 {
-   struct save_state Save;    /**< state saved during meta-ops */
+   /** Stack of state saved during meta-ops */
+   struct save_state Save[MAX_META_OPS_DEPTH];
+   /** Save stack depth */
+   GLuint SaveStackDepth;
 
    struct temp_texture TempTex;
 
@@ -324,8 +327,13 @@ _mesa_meta_free(struct gl_context *ctx)
 static void
 _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 {
-   struct save_state *save = &ctx->Meta->Save;
+   struct save_state *save;
+
+   /* hope MAX_META_OPS_DEPTH is large enough */
+   assert(ctx->Meta->SaveStackDepth < MAX_META_OPS_DEPTH);
 
+   save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth++];
+   memset(save, 0, sizeof(*save));
    save->SavedState = state;
 
    if (state & META_ALPHA_TEST) {
@@ -575,7 +583,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 static void
 _mesa_meta_end(struct gl_context *ctx)
 {
-   struct save_state *save = &ctx->Meta->Save;
+   struct save_state *save = &ctx->Meta->Save[--ctx->Meta->SaveStackDepth];
    const GLbitfield state = save->SavedState;
 
    if (state & META_ALPHA_TEST) {
@@ -1398,6 +1406,7 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
    struct vertex verts[4];
    /* save all state but scissor, pixel pack/unpack */
    GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE;
+   const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
 
    if (buffers & BUFFER_BITS_COLOR) {
       /* if clearing color buffers, don't save/restore colormask */
@@ -1453,7 +1462,7 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
       _mesa_StencilOpSeparate(GL_FRONT_AND_BACK,
                               GL_REPLACE, GL_REPLACE, GL_REPLACE);
       _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS,
-                                ctx->Stencil.Clear & 0x7fffffff,
+                                ctx->Stencil.Clear & stencilMax,
                                 ctx->Stencil.WriteMask[0]);
    }
    else {
@@ -2251,7 +2260,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
    const GLuint maxLevel = texObj->MaxLevel;
    const GLenum minFilterSave = texObj->MinFilter;
    const GLenum magFilterSave = texObj->MagFilter;
-   const GLint baseLevelSave = texObj->BaseLevel;
    const GLint maxLevelSave = texObj->MaxLevel;
    const GLboolean genMipmapSave = texObj->GenerateMipmap;
    const GLenum wrapSSave = texObj->WrapS;
@@ -2311,7 +2319,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
    }
    _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
 
-   _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+   _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
    _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -2487,8 +2495,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
          }
       }
 
-      /* limit sampling to src level */
-      _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
+      /* limit minification to src level */
       _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
 
       /* Set to draw into the current dstLevel */
@@ -2540,7 +2547,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
 
    _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave);
    _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave);
-   _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
    _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
    _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
    _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
index a5b71bd40adb51c683b65a1fefa9e6acfd99c17f..bf8cf6eec07e312529346b5a6790293d33771943 100644 (file)
@@ -790,6 +790,9 @@ driCreateNewScreen(int scrn,
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
 
+    if (driDriverAPI.InitScreen == NULL)
+       return NULL;
+
     psp = calloc(1, sizeof *psp);
     if (!psp)
        return NULL;
index abd79562f98490692d1f9991a8a7af96cf470144..f436d1398c26251359c85c1525e91c29299880fa 100644 (file)
 #define HW_WRITE_CLIPLOOP()    HW_CLIPLOOP()
 #endif
 
+#ifdef SPANTMP_MESA_FMT
+#define SPANTMP_PIXEL_FMT GL_NONE
+#define SPANTMP_PIXEL_TYPE GL_NONE
+#endif
+
+#ifndef SPANTMP_MESA_FMT
+#define SPANTMP_MESA_FMT MESA_FORMAT_COUNT
+#endif
+
 #if (SPANTMP_PIXEL_FMT == GL_RGB)  && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
 
 /**
        rgba[3] = p;                                                    \
      } while (0)
 
+#elif (SPANTMP_MESA_FMT == MESA_FORMAT_R8)
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLubyte *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLubyte *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+     p = color[0]
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
+   PUT_VALUE(_x, _y, r)
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )                                      \
+     do {                                                              \
+        GLubyte p = GET_VALUE(_x, _y);                                 \
+       rgba[0] = p;                                                    \
+       rgba[1] = 0;                                                    \
+       rgba[2] = 0;                                                    \
+       rgba[3] = 0;                                                    \
+     } while (0)
+
+#elif (SPANTMP_MESA_FMT == MESA_FORMAT_RG88)
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+   PACK_COLOR_8888(color[0], color[1], 0, 0)
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
+   PUT_VALUE(_x, _y, r)
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )                                      \
+     do {                                                              \
+        GLushort p = GET_VALUE(_x, _y);                                        \
+       rgba[0] = p & 0xff;                                             \
+       rgba[1] = (p >> 8) & 0xff;                                      \
+       rgba[2] = 0;                                                    \
+       rgba[3] = 0;                                                    \
+     } while (0)
+
+#elif (SPANTMP_MESA_FMT == MESA_FORMAT_R16)
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+     p = color[0]
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
+   PUT_VALUE(_x, _y, r)
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )                                      \
+     do {                                                              \
+        GLushort p = GET_VALUE(_x, _y);                                        \
+       rgba[0] = p;                                                    \
+       rgba[1] = 0;                                                    \
+       rgba[2] = 0;                                                    \
+       rgba[3] = 0;                                                    \
+     } while (0)
+
+#elif (SPANTMP_MESA_FMT == MESA_FORMAT_RG1616)
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (     buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color)                       \
+   ((color[1] << 16) | (color[0]))
+
+# define WRITE_RGBA(_x, _y, r, g, b, a)                                 \
+   PUT_VALUE(_x, _y, r)
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y )                                      \
+     do {                                                              \
+        GLuint p = GET_VALUE(_x, _y);                                  \
+       rgba[0] = p & 0xffff;                                           \
+       rgba[1] = (p >> 16) & 0xffff;                                   \
+       rgba[2] = 0;                                                    \
+       rgba[3] = 0;                                                    \
+     } while (0)
+
 #else
 #error SPANTMP_PIXEL_FMT must be set to a valid value!
 #endif
@@ -914,3 +1035,4 @@ static void TAG(InitPointers)(struct gl_renderbuffer *rb)
 #undef GET_PTR
 #undef SPANTMP_PIXEL_FMT
 #undef SPANTMP_PIXEL_TYPE
+#undef SPANTMP_MESA_FMT
index ae1317029a23c455818f82d9e84456c62bb9d3b9..99ee1bb4e907a54f62f58324244a5a29a7010726 100644 (file)
 #define TM0S2_VERITCAL_LINE_STRIDE_OFF  (1<<12)
 #define TM0S2_OUTPUT_CHAN_SHIFT         10
 #define TM0S2_OUTPUT_CHAN_MASK          (3<<10)
+#define TM0S2_BASE_MIP_LEVEL_SHIFT      1
+#define TM0S2_LOD_PRECLAMP              (1 << 0)
 
 #define TM0S3_MIP_FILTER_MASK           (0x3<<30)
 #define TM0S3_MIP_FILTER_SHIFT          30
 #define TM0S3_MAX_MIP_MASK             (0xff<<9)
 #define TM0S3_MIN_MIP_SHIFT            3
 #define TM0S3_MIN_MIP_MASK             (0x3f<<3)
+#define TM0S3_MIN_MIP_SHIFT_830                5
+#define TM0S3_MIN_MIP_MASK_830         (0x3f<<5)
 #define TM0S3_KILL_PIXEL               (1<<2)
 #define TM0S3_KEYED_FILTER             (1<<1)
 #define TM0S3_CHROMA_KEY               (1<<0)
index b3bb8837ccadcb943a067d836f0607c402af6ec0..c35b4b5ed06d1a1b3a77809656f1141f45b8b028 100644 (file)
 #include "main/mtypes.h"
 #include "main/enums.h"
 #include "main/colormac.h"
+#include "main/macros.h"
 
 #include "intel_mipmap_tree.h"
 #include "intel_tex.h"
 
 #include "i830_context.h"
 #include "i830_reg.h"
-
+#include "intel_chipset.h"
 
 
 static GLuint
@@ -139,9 +140,9 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
    /* Get first image here, since intelObj->firstLevel will get set in
     * the intel_finalize_mipmap_tree() call above.
     */
-   firstImage = tObj->Image[0][intelObj->firstLevel];
+   firstImage = tObj->Image[0][tObj->BaseLevel];
 
-   intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0,
+   intel_miptree_get_image_offset(intelObj->mt, tObj->BaseLevel, 0, 0,
                                  &dst_x, &dst_y);
 
    drm_intel_bo_reference(intelObj->mt->region->buffer);
@@ -189,6 +190,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
 
    {
       GLuint minFilt, mipFilt, magFilt;
+      float maxlod;
+      uint32_t minlod_fixed, maxlod_fixed;
 
       switch (tObj->MinFilter) {
       case GL_NEAREST:
@@ -252,10 +255,24 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
          state[I830_TEXREG_TM0S3] |= SS2_COLORSPACE_CONVERSION;
 #endif
 
-      state[I830_TEXREG_TM0S3] |= ((intelObj->lastLevel -
-                                    intelObj->firstLevel) *
-                                   4) << TM0S3_MIN_MIP_SHIFT;
-
+      /* We get one field with fraction bits for the maximum
+       * addressable (smallest resolution) LOD.  Use it to cover both
+       * MAX_LEVEL and MAX_LOD.
+       */
+      minlod_fixed = U_FIXED(CLAMP(tObj->MinLod, 0.0, 11), 4);
+      maxlod = MIN2(tObj->MaxLod, tObj->_MaxLevel - tObj->BaseLevel);
+      if (intel->intelScreen->deviceID == PCI_CHIP_I855_GM ||
+         intel->intelScreen->deviceID == PCI_CHIP_I865_G) {
+        maxlod_fixed = U_FIXED(CLAMP(maxlod, 0.0, 11.75), 2);
+        maxlod_fixed = MAX2(maxlod_fixed, (minlod_fixed + 3) >> 2);
+        state[I830_TEXREG_TM0S3] |= maxlod_fixed << TM0S3_MIN_MIP_SHIFT;
+        state[I830_TEXREG_TM0S2] |= TM0S2_LOD_PRECLAMP;
+      } else {
+        maxlod_fixed = U_FIXED(CLAMP(maxlod, 0.0, 11), 0);
+        maxlod_fixed = MAX2(maxlod_fixed, (minlod_fixed + 15) >> 4);
+        state[I830_TEXREG_TM0S3] |= maxlod_fixed << TM0S3_MIN_MIP_SHIFT_830;
+      }
+      state[I830_TEXREG_TM0S3] |= minlod_fixed << TM0S3_MAX_MIP_SHIFT;
       state[I830_TEXREG_TM0S3] |= ((minFilt << TM0S3_MIN_FILTER_SHIFT) |
                                    (mipFilt << TM0S3_MIP_FILTER_SHIFT) |
                                    (magFilt << TM0S3_MAG_FILTER_SHIFT));
index f7fdb78d059eec50660ced840c23004075409c84..ebdefeac87447b1edcba855af8a81af4460c58bf 100644 (file)
@@ -364,7 +364,7 @@ i830_emit_invarient_state(struct intel_context *intel)
 
 
 #define emit( intel, state, size )                     \
-   intel_batchbuffer_data(intel->batch, state, size )
+   intel_batchbuffer_data(intel->batch, state, size, false)
 
 static GLuint
 get_dirty(struct i830_hw_state *state)
@@ -429,7 +429,8 @@ i830_emit_state(struct intel_context *intel)
     * batchbuffer fills up.
     */
    intel_batchbuffer_require_space(intel->batch,
-                                  get_state_size(state) + INTEL_PRIM_EMIT_SIZE);
+                                  get_state_size(state) + INTEL_PRIM_EMIT_SIZE,
+                                  false);
    count = 0;
  again:
    aper_count = 0;
@@ -534,14 +535,9 @@ i830_emit_state(struct intel_context *intel)
          BEGIN_BATCH(I830_TEX_SETUP_SIZE + 1);
          OUT_BATCH(state->Tex[i][I830_TEXREG_TM0LI]);
 
-         if (state->tex_buffer[i]) {
-            OUT_RELOC(state->tex_buffer[i],
-                     I915_GEM_DOMAIN_SAMPLER, 0,
-                      state->tex_offset[i]);
-         }
-        else {
-           OUT_BATCH(state->tex_offset[i]);
-        }
+        OUT_RELOC(state->tex_buffer[i],
+                  I915_GEM_DOMAIN_SAMPLER, 0,
+                  state->tex_offset[i]);
 
          OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S1]);
          OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S2]);
@@ -584,6 +580,27 @@ i830_destroy_context(struct intel_context *intel)
    _tnl_free_vertices(&intel->ctx);
 }
 
+static uint32_t i830_render_target_format_for_mesa_format[MESA_FORMAT_COUNT] =
+{
+   [MESA_FORMAT_ARGB8888] = DV_PF_8888,
+   [MESA_FORMAT_XRGB8888] = DV_PF_8888,
+   [MESA_FORMAT_RGB565] = DV_PF_565,
+   [MESA_FORMAT_ARGB1555] = DV_PF_1555,
+   [MESA_FORMAT_ARGB4444] = DV_PF_4444,
+};
+
+static bool
+i830_render_target_supported(gl_format format)
+{
+   if (format == MESA_FORMAT_S8_Z24 ||
+       format == MESA_FORMAT_X8_Z24 ||
+       format == MESA_FORMAT_Z16) {
+      return true;
+   }
+
+   return i830_render_target_format_for_mesa_format[format] != 0;
+}
+
 static void
 i830_set_draw_region(struct intel_context *intel,
                      struct intel_region *color_regions[],
@@ -623,24 +640,7 @@ i830_set_draw_region(struct intel_context *intel,
             DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z);    /* .5 */
 
    if (irb != NULL) {
-      switch (irb->Base.Format) {
-      case MESA_FORMAT_ARGB8888:
-      case MESA_FORMAT_XRGB8888:
-        value |= DV_PF_8888;
-        break;
-      case MESA_FORMAT_RGB565:
-        value |= DV_PF_565;
-        break;
-      case MESA_FORMAT_ARGB1555:
-        value |= DV_PF_1555;
-        break;
-      case MESA_FORMAT_ARGB4444:
-        value |= DV_PF_4444;
-        break;
-      default:
-        _mesa_problem(ctx, "Bad renderbuffer format: %d\n",
-                      irb->Base.Format);
-      }
+      value |= i830_render_target_format_for_mesa_format[irb->Base.Format];
    }
 
    if (depth_region && depth_region->cpp == 4) {
@@ -728,4 +728,5 @@ i830InitVtbl(struct i830_context *i830)
    i830->intel.vtbl.assert_not_dirty = i830_assert_not_dirty;
    i830->intel.vtbl.finish_batch = intel_finish_vb;
    i830->intel.vtbl.invalidate_state = i830_invalidate_state;
+   i830->intel.vtbl.render_target_supported = i830_render_target_supported;
 }
index f943f81dd0571923a371c16e902f55bc6390e54e..f32f3cf6020d3b807936f4b5370c4c49c09f89db 100644 (file)
@@ -176,6 +176,7 @@ i915CreateContext(int api,
    ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = GL_TRUE;
    ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoIfs = GL_TRUE;
    ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoNoise = GL_TRUE;
+   ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoPow = GL_TRUE;
 
    ctx->Const.MaxDrawBuffers = 1;
 
index c00ee415b6b19336335843db3e25f98310080aec..1c6e9845172083c5f274f288ff7c69d0a7026f4d 100644 (file)
@@ -569,10 +569,14 @@ upload_program(struct i915_fragment_program *p)
         if (inst->DstReg.CondMask == COND_TR) {
            tmp = i915_get_utemp(p);
 
+           /* The KIL instruction discards the fragment if any component of
+            * the source is < 0.  Emit an immediate operand of {-1}.xywz.
+            */
            i915_emit_texld(p, get_live_regs(p, inst),
                            tmp, A0_DEST_CHANNEL_ALL,
                            0, /* use a dummy dest reg */
-                           swizzle(tmp, ONE, ONE, ONE, ONE), /* always */
+                           negate(swizzle(tmp, ONE, ONE, ONE, ONE),
+                                  1, 1, 1, 1),
                            T0_TEXKILL);
         } else {
            p->error = 1;
@@ -1158,11 +1162,6 @@ translate_program(struct i915_fragment_program *p)
    fixup_depth_write(p);
    i915_fini_program(p);
 
-   if (INTEL_DEBUG & DEBUG_WM) {
-      printf("i915:\n");
-      i915_disassemble_program(i915->state.Program, i915->state.ProgramSize);
-   }
-
    p->translated = 1;
 }
 
@@ -1423,6 +1422,11 @@ i915ValidateFragmentProgram(struct i915_context *i915)
 
    if (!p->on_hardware)
       i915_upload_program(i915, p);
+
+   if (INTEL_DEBUG & DEBUG_WM) {
+      printf("i915:\n");
+      i915_disassemble_program(i915->state.Program, i915->state.ProgramSize);
+   }
 }
 
 void
index c724a214967c1485a302879d4109e7bc8e76f9f9..af140c85f502fb47181607bd348ab0853daf590d 100644 (file)
@@ -156,7 +156,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
    /* Get first image here, since intelObj->firstLevel will get set in
     * the intel_finalize_mipmap_tree() call above.
     */
-   firstImage = tObj->Image[0][intelObj->firstLevel];
+   firstImage = tObj->Image[0][tObj->BaseLevel];
 
    drm_intel_bo_reference(intelObj->mt->region->buffer);
    i915->state.tex_buffer[unit] = intelObj->mt->region->buffer;
index 59dfe085632fd17fd5598416c8caf94e1de1033f..a94b957127563295ea0308242278bec2a91107f1 100644 (file)
@@ -217,7 +217,7 @@ i915_emit_invarient_state(struct intel_context *intel)
 
 
 #define emit(intel, state, size )                   \
-   intel_batchbuffer_data(intel->batch, state, size)
+   intel_batchbuffer_data(intel->batch, state, size, false)
 
 static GLuint
 get_dirty(struct i915_hw_state *state)
@@ -300,7 +300,8 @@ i915_emit_state(struct intel_context *intel)
     * batchbuffer fills up.
     */
    intel_batchbuffer_require_space(intel->batch,
-                                  get_state_size(state) + INTEL_PRIM_EMIT_SIZE);
+                                  get_state_size(state) + INTEL_PRIM_EMIT_SIZE,
+                                  false);
    count = 0;
  again:
    aper_count = 0;
@@ -435,15 +436,9 @@ i915_emit_state(struct intel_context *intel)
       OUT_BATCH((dirty & I915_UPLOAD_TEX_ALL) >> I915_UPLOAD_TEX_0_SHIFT);
       for (i = 0; i < I915_TEX_UNITS; i++)
          if (dirty & I915_UPLOAD_TEX(i)) {
-
-            if (state->tex_buffer[i]) {
-               OUT_RELOC(state->tex_buffer[i],
-                        I915_GEM_DOMAIN_SAMPLER, 0,
-                         state->tex_offset[i]);
-            }
-            else {
-               OUT_BATCH(state->tex_offset[i]);
-            }
+           OUT_RELOC(state->tex_buffer[i],
+                     I915_GEM_DOMAIN_SAMPLER, 0,
+                     state->tex_offset[i]);
 
             OUT_BATCH(state->Tex[i][I915_TEXREG_MS3]);
             OUT_BATCH(state->Tex[i][I915_TEXREG_MS4]);
@@ -523,6 +518,27 @@ i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region,
    }
 }
 
+static uint32_t i915_render_target_format_for_mesa_format[MESA_FORMAT_COUNT] =
+{
+   [MESA_FORMAT_ARGB8888] = DV_PF_8888,
+   [MESA_FORMAT_XRGB8888] = DV_PF_8888,
+   [MESA_FORMAT_RGB565] = DV_PF_565 | DITHER_FULL_ALWAYS,
+   [MESA_FORMAT_ARGB1555] = DV_PF_1555 | DITHER_FULL_ALWAYS,
+   [MESA_FORMAT_ARGB4444] = DV_PF_4444 | DITHER_FULL_ALWAYS,
+};
+
+static bool
+i915_render_target_supported(gl_format format)
+{
+   if (format == MESA_FORMAT_S8_Z24 ||
+       format == MESA_FORMAT_X8_Z24 ||
+       format == MESA_FORMAT_Z16) {
+      return true;
+   }
+
+   return i915_render_target_format_for_mesa_format[format] != 0;
+}
+
 static void
 i915_set_draw_region(struct intel_context *intel,
                      struct intel_region *color_regions[],
@@ -562,24 +578,7 @@ i915_set_draw_region(struct intel_context *intel,
             DSTORG_VERT_BIAS(0x8) |     /* .5 */
             LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL);
    if (irb != NULL) {
-      switch (irb->Base.Format) {
-      case MESA_FORMAT_ARGB8888:
-      case MESA_FORMAT_XRGB8888:
-        value |= DV_PF_8888;
-        break;
-      case MESA_FORMAT_RGB565:
-        value |= DV_PF_565 | DITHER_FULL_ALWAYS;
-        break;
-      case MESA_FORMAT_ARGB1555:
-        value |= DV_PF_1555 | DITHER_FULL_ALWAYS;
-        break;
-      case MESA_FORMAT_ARGB4444:
-        value |= DV_PF_4444 | DITHER_FULL_ALWAYS;
-        break;
-      default:
-        _mesa_problem(ctx, "Bad renderbuffer format: %d\n",
-                      irb->Base.Format);
-      }
+      value |= i915_render_target_format_for_mesa_format[irb->Base.Format];
    }
 
    /* This isn't quite safe, thus being hidden behind an option.  When changing
@@ -686,4 +685,5 @@ i915InitVtbl(struct i915_context *i915)
    i915->intel.vtbl.update_texture_state = i915UpdateTextureState;
    i915->intel.vtbl.assert_not_dirty = i915_assert_not_dirty;
    i915->intel.vtbl.finish_batch = intel_finish_vb;
+   i915->intel.vtbl.render_target_supported = i915_render_target_supported;
 }
index e3ca863fe51e3eb5152195cbee1e9414db53b8d0..7c3ac0c14ef02131a77ef99b504ec8036eae86cb 100644 (file)
@@ -81,7 +81,6 @@ DRIVER_SOURCES = \
        brw_wm_emit.c \
        brw_wm_fp.c \
        brw_wm_iz.c \
-       brw_wm_glsl.c \
        brw_wm_pass0.c \
        brw_wm_pass1.c \
        brw_wm_pass2.c \
index d3a1233aac0fe3d0e1d906b335b109f2a1ac9ad8..d286c9dbdc719efaf9085881db10a08512ba102b 100644 (file)
@@ -239,7 +239,7 @@ static void upload_blend_constant_color(struct brw_context *brw)
    struct brw_blend_constant_color bcc;
 
    memset(&bcc, 0, sizeof(bcc));
-   bcc.header.opcode = CMD_BLEND_CONSTANT_COLOR;
+   bcc.header.opcode = _3DSTATE_BLEND_CONSTANT_COLOR;
    bcc.header.length = sizeof(bcc)/4-2;
    bcc.blend_constant_color[0] = ctx->Color.BlendColor[0];
    bcc.blend_constant_color[1] = ctx->Color.BlendColor[1];
index cb0a8b96c9c3cdb03b7e3de33320a9461a381a96..8fc322fd82edb9996ee0db66f282a4bbd19696b8 100644 (file)
@@ -122,9 +122,6 @@ GLboolean brwCreateContext( int api,
         (i == MESA_SHADER_FRAGMENT);
       ctx->ShaderCompilerOptions[i].EmitNoIndirectTemp =
         (i == MESA_SHADER_FRAGMENT);
-
-      if (intel->gen == 6)
-        ctx->ShaderCompilerOptions[i].EmitNoIfs = (i == MESA_SHADER_VERTEX);
    }
 
    ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024);
@@ -154,6 +151,13 @@ GLboolean brwCreateContext( int api,
       MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
           ctx->Const.FragmentProgram.MaxEnvParams);
 
+   /* Gen6 converts quads to polygon in beginning of 3D pipeline,
+      but we're not sure how it's actually done for vertex order,
+      that affect provoking vertex decision. Always use last vertex
+      convention for quad primitive which works as expected for now. */
+   if (intel->gen == 6)
+       ctx->Const.QuadsFollowProvokingVertexConvention = GL_FALSE;
+
    if (intel->is_g4x || intel->gen >= 5) {
       brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45;
       brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
index 335339515a248550b0d8050bc759d1261f792f64..7069724466ab5f4e7693eac4757849143df8657a 100644 (file)
@@ -171,7 +171,6 @@ struct brw_vertex_program {
 struct brw_fragment_program {
    struct gl_fragment_program program;
    GLuint id;  /**< serial no. to identify frag progs, never re-used */
-   GLboolean isGLSL;  /**< really, any IF/LOOP/CONT/BREAK instructions */
 
    /** for debugging, which texture units are referenced */
    GLbitfield tex_units_used;
@@ -211,6 +210,7 @@ struct brw_wm_prog_data {
    GLuint nr_params;       /**< number of float params/constants */
    GLuint nr_pull_params;
    GLboolean error;
+   int dispatch_width;
 
    /* Pointer to tracked values (only valid once
     * _mesa_load_state_parameters has been called at runtime).
index 7b823eb201b0a54d9250c44a6ca46aaf577eb2b1..877b22fec19ad165ae29a67ca8448e698f8aa442 100644 (file)
@@ -242,21 +242,13 @@ static void prepare_constant_buffer(struct brw_context *brw)
       GLuint offset = brw->curbe.vs_start * 16;
       GLuint nr = brw->vs.prog_data->nr_params / 4;
 
-      if (vp->use_const_buffer) {
-        /* Load the subset of push constants that will get used when
-         * we also have a pull constant buffer.
-         */
-        for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
-           if (brw->vs.constant_map[i] != -1) {
-              assert(brw->vs.constant_map[i] <= nr);
-              memcpy(buf + offset + brw->vs.constant_map[i] * 4,
-                     vp->program.Base.Parameters->ParameterValues[i],
-                     4 * sizeof(float));
-           }
-        }
-      } else {
-        for (i = 0; i < nr; i++) {
-           memcpy(buf + offset + i * 4,
+      /* Load the subset of push constants that will get used when
+       * we also have a pull constant buffer.
+       */
+      for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
+        if (brw->vs.constant_map[i] != -1) {
+           assert(brw->vs.constant_map[i] <= nr);
+           memcpy(buf + offset + brw->vs.constant_map[i] * 4,
                   vp->program.Base.Parameters->ParameterValues[i],
                   4 * sizeof(float));
         }
index 239586a0366b46b58a26ede591c6b99877fcda80..2f7dcc2dda7fd8c600a98f334f05119b66edc15f 100644 (file)
 
 /* 3D state:
  */
-#define _3DOP_3DSTATE_PIPELINED       0x0
-#define _3DOP_3DSTATE_NONPIPELINED    0x1
-#define _3DOP_3DCONTROL               0x2
-#define _3DOP_3DPRIMITIVE             0x3
-
-#define _3DSTATE_PIPELINED_POINTERS       0x00
-#define _3DSTATE_BINDING_TABLE_POINTERS   0x01
-#define _3DSTATE_VERTEX_BUFFERS           0x08
-#define _3DSTATE_VERTEX_ELEMENTS          0x09
-#define _3DSTATE_INDEX_BUFFER             0x0A
-#define _3DSTATE_VF_STATISTICS            0x0B
-#define _3DSTATE_DRAWING_RECTANGLE            0x00
-#define _3DSTATE_CONSTANT_COLOR               0x01
-#define _3DSTATE_SAMPLER_PALETTE_LOAD         0x02
-#define _3DSTATE_CHROMA_KEY                   0x04
-#define _3DSTATE_DEPTH_BUFFER                 0x05
-#define _3DSTATE_POLY_STIPPLE_OFFSET          0x06
-#define _3DSTATE_POLY_STIPPLE_PATTERN         0x07
-#define _3DSTATE_LINE_STIPPLE                 0x08
-#define _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP    0x09
-#define _3DCONTROL    0x00
-
 #define PIPE_CONTROL_NOWRITE          0x00
 #define PIPE_CONTROL_WRITEIMMEDIATE   0x01
 #define PIPE_CONTROL_WRITEDEPTH       0x02
 #define BRW_SURFACEFORMAT_R8_SSCALED                     0x149
 #define BRW_SURFACEFORMAT_R8_USCALED                     0x14A
 #define BRW_SURFACEFORMAT_L8_UNORM_SRGB                  0x14C
+#define BRW_SURFACEFORMAT_DXT1_RGB_SRGB                  0x180
 #define BRW_SURFACEFORMAT_R1_UINT                        0x181 
 #define BRW_SURFACEFORMAT_YCRCB_NORMAL                   0x182 
 #define BRW_SURFACEFORMAT_YCRCB_SWAPUVY                  0x183 
 #define BRW_COMPRESSION_2NDHALF       1
 #define BRW_COMPRESSION_COMPRESSED    2
 
+#define GEN6_COMPRESSION_1Q            0
+#define GEN6_COMPRESSION_2Q            1
+#define GEN6_COMPRESSION_3Q            2
+#define GEN6_COMPRESSION_4Q            3
+#define GEN6_COMPRESSION_1H            0
+#define GEN6_COMPRESSION_2H            2
+
 #define BRW_CONDITIONAL_NONE  0
 #define BRW_CONDITIONAL_Z     1
 #define BRW_CONDITIONAL_NZ    2
 # define GEN6_BINDING_TABLE_MODIFY_GS  (1 << 9)
 # define GEN6_BINDING_TABLE_MODIFY_PS  (1 << 12)
 
-#define CMD_3D_SAMPLER_STATE_POINTERS                  0x7802 /* SNB+ */
+#define _3DSTATE_SAMPLER_STATE_POINTERS                0x7802 /* GEN6+ */
 # define PS_SAMPLER_STATE_CHANGE                               (1 << 12)
 # define GS_SAMPLER_STATE_CHANGE                               (1 << 9)
 # define VS_SAMPLER_STATE_CHANGE                               (1 << 8)
 #define CMD_INDEX_BUFFER              0x780a
 #define CMD_VF_STATISTICS_965          0x780b
 #define CMD_VF_STATISTICS_GM45        0x680b
-#define CMD_3D_CC_STATE_POINTERS      0x780e /* GEN6+ */
+#define _3DSTATE_CC_STATE_POINTERS             0x780e /* GEN6+ */
 
-#define CMD_URB                                        0x7805 /* GEN6+ */
+#define _3DSTATE_URB                           0x7805 /* GEN6+ */
 # define GEN6_URB_VS_SIZE_SHIFT                                16
 # define GEN6_URB_VS_ENTRIES_SHIFT                     0
 # define GEN6_URB_GS_ENTRIES_SHIFT                     8
 # define GEN6_URB_GS_SIZE_SHIFT                                0
 
-#define CMD_VIEWPORT_STATE_POINTERS                    0x780d /* GEN6+ */
+#define _3DSTATE_VIEWPORT_STATE_POINTERS       0x780d /* GEN6+ */
 # define GEN6_CC_VIEWPORT_MODIFY                       (1 << 12)
 # define GEN6_SF_VIEWPORT_MODIFY                       (1 << 11)
 # define GEN6_CLIP_VIEWPORT_MODIFY                     (1 << 10)
 
-#define CMD_3D_SCISSOR_STATE_POINTERS          0x780f /* GEN6+ */
+#define _3DSTATE_SCISSOR_STATE_POINTERS                0x780f /* GEN6+ */
 
-#define CMD_3D_VS_STATE                      0x7810 /* GEN6+ */
+#define _3DSTATE_VS                            0x7810 /* GEN6+ */
 /* DW2 */
 # define GEN6_VS_SPF_MODE                              (1 << 31)
 # define GEN6_VS_VECTOR_MASK_ENABLE                    (1 << 30)
 # define GEN6_VS_SAMPLER_COUNT_SHIFT                   27
 # define GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT       18
+# define GEN6_VS_FLOATING_POINT_MODE_IEEE_754          (0 << 16)
+# define GEN6_VS_FLOATING_POINT_MODE_ALT               (1 << 16)
 /* DW4 */
 # define GEN6_VS_DISPATCH_START_GRF_SHIFT              20
 # define GEN6_VS_URB_READ_LENGTH_SHIFT                 11
 # define GEN6_VS_CACHE_DISABLE                         (1 << 1)
 # define GEN6_VS_ENABLE                                        (1 << 0)
 
-#define CMD_3D_GS_STATE                      0x7811 /* GEN6+ */
+#define _3DSTATE_GS                            0x7811 /* GEN6+ */
 /* DW2 */
 # define GEN6_GS_SPF_MODE                              (1 << 31)
 # define GEN6_GS_VECTOR_MASK_ENABLE                    (1 << 30)
 /* DW6 */
 # define GEN6_GS_ENABLE                                        (1 << 15)
 
-#define CMD_3D_CLIP_STATE                    0x7812 /* GEN6+ */
+#define _3DSTATE_CLIP                          0x7812 /* GEN6+ */
 /* DW1 */
 # define GEN6_CLIP_STATISTICS_ENABLE                   (1 << 10)
 /**
 # define GEN6_CLIP_MAX_POINT_WIDTH_SHIFT               6
 # define GEN6_CLIP_FORCE_ZERO_RTAINDEX                 (1 << 5)
 
-#define CMD_3D_SF_STATE                                0x7813 /* GEN6+ */
+#define _3DSTATE_SF                            0x7813 /* GEN6+ */
 /* DW1 */
 # define GEN6_SF_NUM_OUTPUTS_SHIFT                     22
 # define GEN6_SF_SWIZZLE_ENABLE                                (1 << 21)
 # define ATTRIBUTE_0_CONST_SOURCE_SHIFT                        9
 # define ATTRIBUTE_0_SWIZZLE_SHIFT                     6
 # define ATTRIBUTE_0_SOURCE_SHIFT                      0
+
+# define ATTRIBUTE_SWIZZLE_INPUTATTR                    0
+# define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING             1
+# define ATTRIBUTE_SWIZZLE_INPUTATTR_W                  2
+# define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING_W           3
+# define ATTRIBUTE_SWIZZLE_SHIFT                        6
+
 /* DW16: Point sprite texture coordinate enables */
 /* DW17: Constant interpolation enables */
 /* DW18: attr 0-7 wrap shortest enables */
 /* DW19: attr 8-16 wrap shortest enables */
 
-#define CMD_3D_WM_STATE                      0x7814 /* GEN6+ */
+#define _3DSTATE_WM                            0x7814 /* GEN6+ */
 /* DW1: kernel pointer */
 /* DW2 */
 # define GEN6_WM_SPF_MODE                              (1 << 31)
 # define GEN6_WM_VECTOR_MASK_ENABLE                    (1 << 30)
 # define GEN6_WM_SAMPLER_COUNT_SHIFT                   27
 # define GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT       18
+# define GEN6_WM_FLOATING_POINT_MODE_IEEE_754          (0 << 16)
+# define GEN6_WM_FLOATING_POINT_MODE_ALT               (1 << 16)
 /* DW3: scratch space */
 /* DW4 */
 # define GEN6_WM_STATISTICS_ENABLE                     (1 << 31)
 /* DW7: kernel 1 pointer */
 /* DW8: kernel 2 pointer */
 
-#define CMD_3D_CONSTANT_VS_STATE             0x7815 /* GEN6+ */
-#define CMD_3D_CONSTANT_GS_STATE             0x7816 /* GEN6+ */
-#define CMD_3D_CONSTANT_PS_STATE             0x7817 /* GEN6+ */
+#define _3DSTATE_CONSTANT_VS                 0x7815 /* GEN6+ */
+#define _3DSTATE_CONSTANT_GS                 0x7816 /* GEN6+ */
+#define _3DSTATE_CONSTANT_PS                 0x7817 /* GEN6+ */
 # define GEN6_CONSTANT_BUFFER_3_ENABLE                 (1 << 15)
 # define GEN6_CONSTANT_BUFFER_2_ENABLE                 (1 << 14)
 # define GEN6_CONSTANT_BUFFER_1_ENABLE                 (1 << 13)
 # define GEN6_CONSTANT_BUFFER_0_ENABLE                 (1 << 12)
 
-#define CMD_3D_SAMPLE_MASK                     0x7818 /* GEN6+ */
+#define _3DSTATE_SAMPLE_MASK                   0x7818 /* GEN6+ */
 
-#define CMD_DRAW_RECT                 0x7900
-#define CMD_BLEND_CONSTANT_COLOR      0x7901
-#define CMD_CHROMA_KEY                0x7904
-#define CMD_DEPTH_BUFFER              0x7905
-#define CMD_POLY_STIPPLE_OFFSET       0x7906
-#define CMD_POLY_STIPPLE_PATTERN      0x7907
-#define CMD_LINE_STIPPLE_PATTERN      0x7908
-#define CMD_GLOBAL_DEPTH_OFFSET_CLAMP 0x7909
-#define CMD_AA_LINE_PARAMETERS        0x790a
+#define _3DSTATE_DRAWING_RECTANGLE             0x7900
+#define _3DSTATE_BLEND_CONSTANT_COLOR          0x7901
+#define _3DSTATE_CHROMA_KEY                    0x7904
+#define _3DSTATE_DEPTH_BUFFER                  0x7905
+#define _3DSTATE_POLY_STIPPLE_OFFSET           0x7906
+#define _3DSTATE_POLY_STIPPLE_PATTERN          0x7907
+#define _3DSTATE_LINE_STIPPLE_PATTERN          0x7908
+#define _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP     0x7909
+#define _3DSTATE_AA_LINE_PARAMETERS            0x790a /* G45+ */
 
-#define CMD_GS_SVB_INDEX                       0x790b /* CTG+ */
+#define _3DSTATE_GS_SVB_INDEX                  0x790b /* CTG+ */
 /* DW1 */
 # define SVB_INDEX_SHIFT                               29
 # define SVB_LOAD_INTERNAL_VERTEX_COUNT                        (1 << 0) /* SNB+ */
 /* DW2: SVB index */
 /* DW3: SVB maximum index */
 
-#define CMD_3D_MULTISAMPLE                     0x790d /* SNB+ */
+#define _3DSTATE_MULTISAMPLE                   0x790d /* GEN6+ */
 /* DW1 */
 # define MS_PIXEL_LOCATION_CENTER                      (0 << 4)
 # define MS_PIXEL_LOCATION_UPPER_LEFT                  (1 << 4)
 # define MS_NUMSAMPLES_4                               (2 << 1)
 # define MS_NUMSAMPLES_8                               (3 << 1)
 
-#define CMD_3D_CLEAR_PARAMS                    0x7910 /* ILK+ */
+#define _3DSTATE_STENCIL_BUFFER                        0x790e /* ILK, SNB */
+#define _3DSTATE_HIER_DEPTH_BUFFER             0x790f /* ILK, SNB */
+
+#define _3DSTATE_CLEAR_PARAMS                  0x7910 /* ILK+ */
 # define DEPTH_CLEAR_VALID                             (1 << 15)
 /* DW1: depth clear value */
 
index 962c04128b8280deb74b9f6a3a7638ee32b05556..111cb9974e1d1d17284c541848ad63047fcfbf6c 100644 (file)
@@ -899,7 +899,8 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen)
        err |= dest (file, inst);
     } else if (gen >= 6 && (inst->header.opcode == BRW_OPCODE_IF ||
                            inst->header.opcode == BRW_OPCODE_ELSE ||
-                           inst->header.opcode == BRW_OPCODE_ENDIF)) {
+                           inst->header.opcode == BRW_OPCODE_ENDIF ||
+                           inst->header.opcode == BRW_OPCODE_WHILE)) {
        format (file, " %d", inst->bits1.branch_gen6.jump_count);
     }
 
@@ -972,7 +973,7 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen)
                        inst->bits3.dp_render_cache.send_commit_msg,
                        inst->bits3.dp_render_cache.msg_length,
                        inst->bits3.dp_render_cache.response_length);
-           } else if (gen >= 5) {
+           } else if (gen >= 5 /* FINISHME: || is_g4x */) {
                format (file, " (%d, %d, %d)",
                        inst->bits3.dp_read_gen5.binding_table_index,
                        inst->bits3.dp_read_gen5.msg_control,
index a1f403ca4e668f7613e8e2f769fb222b1362a894..7eb16b71f4af1623ca2abc670e21352bb714ff63 100644 (file)
@@ -159,7 +159,7 @@ static void brw_emit_prim(struct brw_context *brw,
    }
    if (prim_packet.verts_per_instance) {
       intel_batchbuffer_data( brw->intel.batch, &prim_packet,
-                             sizeof(prim_packet));
+                             sizeof(prim_packet), false);
    }
    if (intel->always_flush_cache) {
       intel_batchbuffer_emit_mi_flush(intel->batch);
@@ -351,7 +351,8 @@ static GLboolean brw_try_draw_prims( struct gl_context *ctx,
        * an upper bound of how much we might emit in a single
        * brw_try_draw_prims().
        */
-      intel_batchbuffer_require_space(intel->batch, intel->batch->size / 4);
+      intel_batchbuffer_require_space(intel->batch, intel->batch->size / 4,
+                                     false);
 
       hw_prim = brw_set_prim(brw, &prim[i]);
 
index 2ff39e8e64a4eec3290bf48acda433ec4425f795..3b5c4c071e3416f2b5e217661067143bfa00bc73 100644 (file)
@@ -72,7 +72,37 @@ void brw_set_access_mode( struct brw_compile *p, GLuint access_mode )
 
 void brw_set_compression_control( struct brw_compile *p, GLboolean compression_control )
 {
-   p->current->header.compression_control = compression_control;
+   p->compressed = (compression_control == BRW_COMPRESSION_COMPRESSED);
+
+   if (p->brw->intel.gen >= 6) {
+      /* Since we don't use the 32-wide support in gen6, we translate
+       * the pre-gen6 compression control here.
+       */
+      switch (compression_control) {
+      case BRW_COMPRESSION_NONE:
+        /* This is the "use the first set of bits of dmask/vmask/arf
+         * according to execsize" option.
+         */
+        p->current->header.compression_control = GEN6_COMPRESSION_1Q;
+        break;
+      case BRW_COMPRESSION_2NDHALF:
+        /* For 8-wide, this is "use the second set of 8 bits." */
+        p->current->header.compression_control = GEN6_COMPRESSION_2Q;
+        break;
+      case BRW_COMPRESSION_COMPRESSED:
+        /* For 16-wide instruction compression, use the first set of 16 bits
+         * since we don't do 32-wide dispatch.
+         */
+        p->current->header.compression_control = GEN6_COMPRESSION_1H;
+        break;
+      default:
+        assert(!"not reached");
+        p->current->header.compression_control = GEN6_COMPRESSION_1H;
+        break;
+      }
+   } else {
+      p->current->header.compression_control = compression_control;
+   }
 }
 
 void brw_set_mask_control( struct brw_compile *p, GLuint value )
@@ -95,6 +125,7 @@ void brw_push_insn_state( struct brw_compile *p )
 {
    assert(p->current != &p->stack[BRW_EU_MAX_INSN_STACK-1]);
    memcpy(p->current+1, p->current, sizeof(struct brw_instruction));
+   p->compressed_stack[p->current - p->stack] = p->compressed;
    p->current++;   
 }
 
@@ -102,6 +133,7 @@ void brw_pop_insn_state( struct brw_compile *p )
 {
    assert(p->current != p->stack);
    p->current--;
+   p->compressed = p->compressed_stack[p->current - p->stack];
 }
 
 
@@ -112,6 +144,7 @@ void brw_init_compile( struct brw_context *brw, struct brw_compile *p )
    p->brw = brw;
    p->nr_insn = 0;
    p->current = p->stack;
+   p->compressed = false;
    memset(p->current, 0, sizeof(p->current[0]));
 
    /* Some defaults?
index b4538e6e8a7a23f17e6880c1244334c71afc39f8..119ffc72370456e4c6eee2cf8a0126659a4ad02e 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef BRW_EU_H
 #define BRW_EU_H
 
+#include <stdbool.h>
 #include "brw_structs.h"
 #include "brw_defines.h"
 #include "program/prog_instruction.h"
@@ -106,10 +107,12 @@ struct brw_compile {
    /* Allow clients to push/pop instruction state:
     */
    struct brw_instruction stack[BRW_EU_MAX_INSN_STACK];
+   bool compressed_stack[BRW_EU_MAX_INSN_STACK];
    struct brw_instruction *current;
 
    GLuint flag_value;
    GLboolean single_program_flow;
+   bool compressed;
    struct brw_context *brw;
 
    struct brw_glsl_label *first_label;  /**< linked list of labels */
@@ -858,7 +861,8 @@ void brw_fb_WRITE(struct brw_compile *p,
                   GLuint binding_table_index,
                   GLuint msg_length,
                   GLuint response_length,
-                  GLboolean eot);
+                  GLboolean eot,
+                  GLboolean header_present);
 
 void brw_SAMPLE(struct brw_compile *p,
                struct brw_reg dest,
@@ -954,6 +958,8 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p,
               struct brw_instruction *patch_insn);
 
 struct brw_instruction *brw_BREAK(struct brw_compile *p, int pop_count);
+struct brw_instruction *brw_CONT_gen6(struct brw_compile *p,
+                                     struct brw_instruction *do_insn);
 struct brw_instruction *brw_CONT(struct brw_compile *p, int pop_count);
 /* Forward jumps:
  */
@@ -1009,6 +1015,7 @@ void brw_math_invert( struct brw_compile *p,
 void brw_set_src1( struct brw_instruction *insn,
                           struct brw_reg reg );
 
+void brw_set_uip_jip(struct brw_compile *p);
 
 /* brw_optimize.c */
 void brw_optimize(struct brw_compile *p);
index 9cb941dacfdcabb53ef93237ed42beaa8a8a6a83..88131c432ec82ac48f4d3bd2c85ac7fcd06949bc 100644 (file)
  * Internal helper for constructing instructions
  */
 
-static void guess_execution_size( struct brw_instruction *insn,
-                                 struct brw_reg reg )
+static void guess_execution_size(struct brw_compile *p,
+                                struct brw_instruction *insn,
+                                struct brw_reg reg)
 {
-   if (reg.width == BRW_WIDTH_8 && 
-       insn->header.compression_control == BRW_COMPRESSION_COMPRESSED) 
+   if (reg.width == BRW_WIDTH_8 && p->compressed)
       insn->header.execution_size = BRW_EXECUTE_16;
    else
       insn->header.execution_size = reg.width; /* note - definitions are compatible */
 }
 
 
-static void brw_set_dest( struct brw_instruction *insn,
-                         struct brw_reg dest )
+static void brw_set_dest(struct brw_compile *p,
+                        struct brw_instruction *insn,
+                        struct brw_reg dest)
 {
    if (dest.file != BRW_ARCHITECTURE_REGISTER_FILE &&
        dest.file != BRW_MESSAGE_REGISTER_FILE)
@@ -100,7 +101,7 @@ static void brw_set_dest( struct brw_instruction *insn,
    /* NEW: Set the execution size based on dest.width and
     * insn->compression_control:
     */
-   guess_execution_size(insn, dest);
+   guess_execution_size(p, insn, dest);
 }
 
 extern int reg_type_size[];
@@ -535,6 +536,16 @@ brw_set_dp_read_message(struct brw_context *brw,
        insn->bits3.dp_read_gen5.end_of_thread = 0;
        insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_READ;
        insn->bits2.send_gen5.end_of_thread = 0;
+   } else if (intel->is_g4x) {
+       insn->bits3.dp_read_g4x.binding_table_index = binding_table_index; /*0:7*/
+       insn->bits3.dp_read_g4x.msg_control = msg_control;  /*8:10*/
+       insn->bits3.dp_read_g4x.msg_type = msg_type;  /*11:13*/
+       insn->bits3.dp_read_g4x.target_cache = target_cache;  /*14:15*/
+       insn->bits3.dp_read_g4x.response_length = response_length;  /*16:19*/
+       insn->bits3.dp_read_g4x.msg_length = msg_length;  /*20:23*/
+       insn->bits3.dp_read_g4x.msg_target = BRW_MESSAGE_TARGET_DATAPORT_READ; /*24:27*/
+       insn->bits3.dp_read_g4x.pad1 = 0;
+       insn->bits3.dp_read_g4x.end_of_thread = 0;
    } else {
        insn->bits3.dp_read.binding_table_index = binding_table_index; /*0:7*/
        insn->bits3.dp_read.msg_control = msg_control;  /*8:11*/
@@ -629,7 +640,7 @@ static struct brw_instruction *brw_alu1( struct brw_compile *p,
                                         struct brw_reg src )
 {
    struct brw_instruction *insn = next_insn(p, opcode);
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src);   
    return insn;
 }
@@ -641,7 +652,7 @@ static struct brw_instruction *brw_alu2(struct brw_compile *p,
                                        struct brw_reg src1 )
 {
    struct brw_instruction *insn = next_insn(p, opcode);   
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src0);
    brw_set_src1(insn, src1);
    return insn;
@@ -680,7 +691,7 @@ void brw_##OP(struct brw_compile *p,                                              \
 {                                                                            \
    struct brw_instruction *rnd, *add;                                        \
    rnd = next_insn(p, BRW_OPCODE_##OP);                                              \
-   brw_set_dest(rnd, dest);                                                  \
+   brw_set_dest(p, rnd, dest);                                               \
    brw_set_src0(rnd, src);                                                   \
    rnd->header.destreg__conditionalmod = 0x7; /* turn on round-increments */  \
                                                                              \
@@ -779,7 +790,7 @@ struct brw_instruction *brw_MUL(struct brw_compile *p,
 void brw_NOP(struct brw_compile *p)
 {
    struct brw_instruction *insn = next_insn(p, BRW_OPCODE_NOP);   
-   brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
+   brw_set_dest(p, insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
    brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
    brw_set_src1(insn, brw_imm_ud(0x0));
 }
@@ -840,11 +851,11 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size)
    /* Override the defaults for this instruction:
     */
    if (intel->gen < 6) {
-      brw_set_dest(insn, brw_ip_reg());
+      brw_set_dest(p, insn, brw_ip_reg());
       brw_set_src0(insn, brw_ip_reg());
       brw_set_src1(insn, brw_imm_d(0x0));
    } else {
-      brw_set_dest(insn, brw_imm_w(0));
+      brw_set_dest(p, insn, brw_imm_w(0));
       insn->bits1.branch_gen6.jump_count = 0;
       brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
       brw_set_src1(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
@@ -870,7 +881,7 @@ brw_IF_gen6(struct brw_compile *p, uint32_t conditional,
 
    insn = next_insn(p, BRW_OPCODE_IF);
 
-   brw_set_dest(insn, brw_imm_w(0));
+   brw_set_dest(p, insn, brw_imm_w(0));
    insn->header.execution_size = BRW_EXECUTE_8;
    insn->bits1.branch_gen6.jump_count = 0;
    brw_set_src0(insn, src0);
@@ -905,11 +916,11 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p,
    }
 
    if (intel->gen < 6) {
-      brw_set_dest(insn, brw_ip_reg());
+      brw_set_dest(p, insn, brw_ip_reg());
       brw_set_src0(insn, brw_ip_reg());
       brw_set_src1(insn, brw_imm_d(0x0));
    } else {
-      brw_set_dest(insn, brw_imm_w(0));
+      brw_set_dest(p, insn, brw_imm_w(0));
       insn->bits1.branch_gen6.jump_count = 0;
       brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
       brw_set_src1(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
@@ -965,11 +976,11 @@ void brw_ENDIF(struct brw_compile *p,
       struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ENDIF);
 
       if (intel->gen < 6) {
-        brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
+        brw_set_dest(p, insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
         brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
         brw_set_src1(insn, brw_imm_d(0x0));
       } else {
-        brw_set_dest(insn, brw_imm_w(0));
+        brw_set_dest(p, insn, brw_imm_w(0));
         brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
         brw_set_src1(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
       }
@@ -1029,16 +1040,44 @@ void brw_ENDIF(struct brw_compile *p,
 
 struct brw_instruction *brw_BREAK(struct brw_compile *p, int pop_count)
 {
+   struct intel_context *intel = &p->brw->intel;
    struct brw_instruction *insn;
+
    insn = next_insn(p, BRW_OPCODE_BREAK);
-   brw_set_dest(insn, brw_ip_reg());
+   if (intel->gen >= 6) {
+      brw_set_dest(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+      brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+      brw_set_src1(insn, brw_imm_d(0x0));
+   } else {
+      brw_set_dest(p, insn, brw_ip_reg());
+      brw_set_src0(insn, brw_ip_reg());
+      brw_set_src1(insn, brw_imm_d(0x0));
+      insn->bits3.if_else.pad0 = 0;
+      insn->bits3.if_else.pop_count = pop_count;
+   }
+   insn->header.compression_control = BRW_COMPRESSION_NONE;
+   insn->header.execution_size = BRW_EXECUTE_8;
+
+   return insn;
+}
+
+struct brw_instruction *brw_CONT_gen6(struct brw_compile *p,
+                                     struct brw_instruction *do_insn)
+{
+   struct brw_instruction *insn;
+   int br = 2;
+
+   insn = next_insn(p, BRW_OPCODE_CONTINUE);
+   brw_set_dest(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+   brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+   brw_set_dest(p, insn, brw_ip_reg());
    brw_set_src0(insn, brw_ip_reg());
    brw_set_src1(insn, brw_imm_d(0x0));
+
+   insn->bits3.break_cont.uip = br * (do_insn - insn);
+
    insn->header.compression_control = BRW_COMPRESSION_NONE;
    insn->header.execution_size = BRW_EXECUTE_8;
-   /* insn->header.mask_control = BRW_MASK_DISABLE; */
-   insn->bits3.if_else.pad0 = 0;
-   insn->bits3.if_else.pop_count = pop_count;
    return insn;
 }
 
@@ -1046,7 +1085,7 @@ struct brw_instruction *brw_CONT(struct brw_compile *p, int pop_count)
 {
    struct brw_instruction *insn;
    insn = next_insn(p, BRW_OPCODE_CONTINUE);
-   brw_set_dest(insn, brw_ip_reg());
+   brw_set_dest(p, insn, brw_ip_reg());
    brw_set_src0(insn, brw_ip_reg());
    brw_set_src1(insn, brw_imm_d(0x0));
    insn->header.compression_control = BRW_COMPRESSION_NONE;
@@ -1058,17 +1097,33 @@ struct brw_instruction *brw_CONT(struct brw_compile *p, int pop_count)
 }
 
 /* DO/WHILE loop:
+ *
+ * The DO/WHILE is just an unterminated loop -- break or continue are
+ * used for control within the loop.  We have a few ways they can be
+ * done.
+ *
+ * For uniform control flow, the WHILE is just a jump, so ADD ip, ip,
+ * jip and no DO instruction.
+ *
+ * For non-uniform control flow pre-gen6, there's a DO instruction to
+ * push the mask, and a WHILE to jump back, and BREAK to get out and
+ * pop the mask.
+ *
+ * For gen6, there's no more mask stack, so no need for DO.  WHILE
+ * just points back to the first instruction of the loop.
  */
 struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size)
 {
-   if (p->single_program_flow) {
+   struct intel_context *intel = &p->brw->intel;
+
+   if (intel->gen >= 6 || p->single_program_flow) {
       return &p->store[p->nr_insn];
    } else {
       struct brw_instruction *insn = next_insn(p, BRW_OPCODE_DO);
 
       /* Override the defaults for this instruction:
        */
-      brw_set_dest(insn, brw_null_reg());
+      brw_set_dest(p, insn, brw_null_reg());
       brw_set_src0(insn, brw_null_reg());
       brw_set_src1(insn, brw_null_reg());
 
@@ -1094,34 +1149,42 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p,
    if (intel->gen >= 5)
       br = 2;
 
-   if (p->single_program_flow)
-      insn = next_insn(p, BRW_OPCODE_ADD);
-   else
+   if (intel->gen >= 6) {
       insn = next_insn(p, BRW_OPCODE_WHILE);
 
-   brw_set_dest(insn, brw_ip_reg());
-   brw_set_src0(insn, brw_ip_reg());
-   brw_set_src1(insn, brw_imm_d(0x0));
+      brw_set_dest(p, insn, brw_imm_w(0));
+      insn->bits1.branch_gen6.jump_count = br * (do_insn - insn);
+      brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+      brw_set_src1(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
 
-   insn->header.compression_control = BRW_COMPRESSION_NONE;
+      insn->header.execution_size = do_insn->header.execution_size;
+      assert(insn->header.execution_size == BRW_EXECUTE_8);
+   } else {
+      if (p->single_program_flow) {
+        insn = next_insn(p, BRW_OPCODE_ADD);
 
-   if (p->single_program_flow) {
-      insn->header.execution_size = BRW_EXECUTE_1;
+        brw_set_dest(p, insn, brw_ip_reg());
+        brw_set_src0(insn, brw_ip_reg());
+        brw_set_src1(insn, brw_imm_d((do_insn - insn) * 16));
+        insn->header.execution_size = BRW_EXECUTE_1;
+      } else {
+        insn = next_insn(p, BRW_OPCODE_WHILE);
 
-      insn->bits3.d = (do_insn - insn) * 16;
-   } else {
-      insn->header.execution_size = do_insn->header.execution_size;
+        assert(do_insn->header.opcode == BRW_OPCODE_DO);
 
-      assert(do_insn->header.opcode == BRW_OPCODE_DO);
-      insn->bits3.if_else.jump_count = br * (do_insn - insn + 1);
-      insn->bits3.if_else.pop_count = 0;
-      insn->bits3.if_else.pad0 = 0;
-   }
+        brw_set_dest(p, insn, brw_ip_reg());
+        brw_set_src0(insn, brw_ip_reg());
+        brw_set_src1(insn, brw_imm_d(0));
 
-/*    insn->header.mask_control = BRW_MASK_ENABLE; */
+        insn->header.execution_size = do_insn->header.execution_size;
+        insn->bits3.if_else.jump_count = br * (do_insn - insn + 1);
+        insn->bits3.if_else.pop_count = 0;
+        insn->bits3.if_else.pad0 = 0;
+      }
+   }
+   insn->header.compression_control = BRW_COMPRESSION_NONE;
+   p->current->header.predicate_control = BRW_PREDICATE_NONE;
 
-   /* insn->header.mask_control = BRW_MASK_DISABLE; */
-   p->current->header.predicate_control = BRW_PREDICATE_NONE;   
    return insn;
 }
 
@@ -1159,7 +1222,7 @@ void brw_CMP(struct brw_compile *p,
    struct brw_instruction *insn = next_insn(p, BRW_OPCODE_CMP);
 
    insn->header.destreg__conditionalmod = conditional;
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src0);
    brw_set_src1(insn, src1);
 
@@ -1184,7 +1247,7 @@ void brw_WAIT (struct brw_compile *p)
    struct brw_instruction *insn = next_insn(p, BRW_OPCODE_WAIT);
    struct brw_reg src = brw_notification_1_reg();
 
-   brw_set_dest(insn, src);
+   brw_set_dest(p, insn, src);
    brw_set_src0(insn, src);
    brw_set_src1(insn, brw_null_reg());
    insn->header.execution_size = 0; /* must */
@@ -1219,6 +1282,10 @@ void brw_math( struct brw_compile *p,
       assert(dest.hstride == BRW_HORIZONTAL_STRIDE_1);
       assert(src.hstride == BRW_HORIZONTAL_STRIDE_1);
 
+      /* Source modifiers are ignored for extended math instructions. */
+      assert(!src.negate);
+      assert(!src.abs);
+
       if (function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT &&
          function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) {
         assert(src.type == BRW_REGISTER_TYPE_F);
@@ -1228,8 +1295,9 @@ void brw_math( struct brw_compile *p,
        * becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
        */
       insn->header.destreg__conditionalmod = function;
+      insn->header.saturate = saturate;
 
-      brw_set_dest(insn, dest);
+      brw_set_dest(p, insn, dest);
       brw_set_src0(insn, src);
       brw_set_src1(insn, brw_null_reg());
    } else {
@@ -1242,7 +1310,7 @@ void brw_math( struct brw_compile *p,
       insn->header.predicate_control = 0;
       insn->header.destreg__conditionalmod = msg_reg_nr;
 
-      brw_set_dest(insn, dest);
+      brw_set_dest(p, insn, dest);
       brw_set_src0(insn, src);
       brw_set_math_message(p->brw,
                           insn,
@@ -1284,12 +1352,18 @@ void brw_math2(struct brw_compile *p,
       assert(src1.type == BRW_REGISTER_TYPE_F);
    }
 
+   /* Source modifiers are ignored for extended math instructions. */
+   assert(!src0.negate);
+   assert(!src0.abs);
+   assert(!src1.negate);
+   assert(!src1.abs);
+
    /* Math is the same ISA format as other opcodes, except that CondModifier
     * becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
     */
    insn->header.destreg__conditionalmod = function;
 
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src0);
    brw_set_src1(insn, src1);
 }
@@ -1318,8 +1392,13 @@ void brw_math_16( struct brw_compile *p,
        * becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
        */
       insn->header.destreg__conditionalmod = function;
+      insn->header.saturate = saturate;
 
-      brw_set_dest(insn, dest);
+      /* Source modifiers are ignored for extended math instructions. */
+      assert(!src.negate);
+      assert(!src.abs);
+
+      brw_set_dest(p, insn, dest);
       brw_set_src0(insn, src);
       brw_set_src1(insn, brw_null_reg());
       return;
@@ -1334,7 +1413,7 @@ void brw_math_16( struct brw_compile *p,
    insn = next_insn(p, BRW_OPCODE_SEND);
    insn->header.destreg__conditionalmod = msg_reg_nr;
 
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src);
    brw_set_math_message(p->brw,
                        insn, 
@@ -1351,7 +1430,7 @@ void brw_math_16( struct brw_compile *p,
    insn->header.compression_control = BRW_COMPRESSION_2NDHALF;
    insn->header.destreg__conditionalmod = msg_reg_nr+1;
 
-   brw_set_dest(insn, offset(dest,1));
+   brw_set_dest(p, insn, offset(dest,1));
    brw_set_src0(insn, src);
    brw_set_math_message(p->brw, 
                        insn, 
@@ -1446,7 +1525,7 @@ void brw_oword_block_write_scratch(struct brw_compile *p,
         send_commit_msg = 1;
       }
 
-      brw_set_dest(insn, dest);
+      brw_set_dest(p, insn, dest);
       brw_set_src0(insn, brw_null_reg());
 
       brw_set_dp_write_message(p->brw,
@@ -1516,7 +1595,7 @@ brw_oword_block_read_scratch(struct brw_compile *p,
       insn->header.compression_control = BRW_COMPRESSION_NONE;
       insn->header.destreg__conditionalmod = mrf.nr;
 
-      brw_set_dest(insn, dest);        /* UW? */
+      brw_set_dest(p, insn, dest);     /* UW? */
       brw_set_src0(insn, brw_null_reg());
 
       brw_set_dp_read_message(p->brw,
@@ -1569,7 +1648,7 @@ void brw_oword_block_read(struct brw_compile *p,
    /* cast dest to a uword[8] vector */
    dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW);
 
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    if (intel->gen >= 6) {
       brw_set_src0(insn, mrf);
    } else {
@@ -1614,7 +1693,7 @@ void brw_dword_scattered_read(struct brw_compile *p,
    /* cast dest to a uword[8] vector */
    dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW);
 
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, brw_null_reg());
 
    brw_set_dp_read_message(p->brw,
@@ -1639,29 +1718,22 @@ void brw_dp_READ_4_vs(struct brw_compile *p,
                       GLuint location,
                       GLuint bind_table_index)
 {
+   struct intel_context *intel = &p->brw->intel;
    struct brw_instruction *insn;
    GLuint msg_reg_nr = 1;
-   struct brw_reg b;
 
-   /*
-   printf("vs const read msg, location %u, msg_reg_nr %d\n",
-          location, msg_reg_nr);
-   */
+   if (intel->gen >= 6)
+      location /= 16;
 
    /* Setup MRF[1] with location/offset into const buffer */
    brw_push_insn_state(p);
+   brw_set_access_mode(p, BRW_ALIGN_1);
    brw_set_compression_control(p, BRW_COMPRESSION_NONE);
    brw_set_mask_control(p, BRW_MASK_DISABLE);
    brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-
-   /* XXX I think we're setting all the dwords of MRF[1] to 'location'.
-    * when the docs say only dword[2] should be set.  Hmmm.  But it works.
-    */
-   b = brw_message_reg(msg_reg_nr);
-   b = retype(b, BRW_REGISTER_TYPE_UD);
-   /*b = get_element_ud(b, 2);*/
-   brw_MOV(p, b, brw_imm_ud(location));
-
+   brw_MOV(p, retype(brw_vec1_reg(BRW_MESSAGE_REGISTER_FILE, msg_reg_nr, 2),
+                    BRW_REGISTER_TYPE_UD),
+          brw_imm_ud(location));
    brw_pop_insn_state(p);
 
    insn = next_insn(p, BRW_OPCODE_SEND);
@@ -1671,8 +1743,12 @@ void brw_dp_READ_4_vs(struct brw_compile *p,
    insn->header.destreg__conditionalmod = msg_reg_nr;
    insn->header.mask_control = BRW_MASK_DISABLE;
 
-   brw_set_dest(insn, dest);
-   brw_set_src0(insn, brw_null_reg());
+   brw_set_dest(p, insn, dest);
+   if (intel->gen >= 6) {
+      brw_set_src0(insn, brw_message_reg(msg_reg_nr));
+   } else {
+      brw_set_src0(insn, brw_null_reg());
+   }
 
    brw_set_dp_read_message(p->brw,
                           insn,
@@ -1699,6 +1775,7 @@ void brw_dp_READ_4_vs_relative(struct brw_compile *p,
 
    /* Setup MRF[1] with offset into const buffer */
    brw_push_insn_state(p);
+   brw_set_access_mode(p, BRW_ALIGN_1);
    brw_set_compression_control(p, BRW_COMPRESSION_NONE);
    brw_set_mask_control(p, BRW_MASK_DISABLE);
    brw_set_predicate_control(p, BRW_PREDICATE_NONE);
@@ -1706,7 +1783,7 @@ void brw_dp_READ_4_vs_relative(struct brw_compile *p,
    /* M1.0 is block offset 0, M1.4 is block offset 1, all other
     * fields ignored.
     */
-   brw_ADD(p, retype(brw_message_reg(1), BRW_REGISTER_TYPE_UD),
+   brw_ADD(p, retype(brw_message_reg(1), BRW_REGISTER_TYPE_D),
           addr_reg, brw_imm_d(offset));
    brw_pop_insn_state(p);
 
@@ -1717,7 +1794,7 @@ void brw_dp_READ_4_vs_relative(struct brw_compile *p,
    insn->header.destreg__conditionalmod = 0;
    insn->header.mask_control = BRW_MASK_DISABLE;
 
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, brw_vec8_grf(0, 0));
 
    if (intel->gen == 6)
@@ -1747,12 +1824,12 @@ void brw_fb_WRITE(struct brw_compile *p,
                   GLuint binding_table_index,
                   GLuint msg_length,
                   GLuint response_length,
-                  GLboolean eot)
+                  GLboolean eot,
+                  GLboolean header_present)
 {
    struct intel_context *intel = &p->brw->intel;
    struct brw_instruction *insn;
    GLuint msg_control, msg_type;
-   GLboolean header_present = GL_TRUE;
 
    if (intel->gen >= 6 && binding_table_index == 0) {
       insn = next_insn(p, BRW_OPCODE_SENDC);
@@ -1764,9 +1841,6 @@ void brw_fb_WRITE(struct brw_compile *p,
    insn->header.compression_control = BRW_COMPRESSION_NONE;
 
    if (intel->gen >= 6) {
-      if (msg_length == 4)
-        header_present = GL_FALSE;
-
        /* headerless version, just submit color payload */
        src0 = brw_message_reg(msg_reg_nr);
 
@@ -1782,7 +1856,7 @@ void brw_fb_WRITE(struct brw_compile *p,
    else
       msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01;
 
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src0);
    brw_set_dp_write_message(p->brw,
                            insn,
@@ -1860,7 +1934,7 @@ void brw_SAMPLE(struct brw_compile *p,
 
         struct brw_reg m1 = brw_message_reg(msg_reg_nr);
 
-        guess_execution_size(p->current, dest);
+        guess_execution_size(p, p->current, dest);
         if (p->current->header.execution_size == BRW_EXECUTE_16)
            dispatch_16 = GL_TRUE;
 
@@ -1871,7 +1945,8 @@ void brw_SAMPLE(struct brw_compile *p,
         brw_set_compression_control(p, BRW_COMPRESSION_NONE);
         brw_set_mask_control(p, BRW_MASK_DISABLE);
 
-        brw_MOV(p, m1, brw_vec8_grf(0,0));      
+        brw_MOV(p, retype(m1, BRW_REGISTER_TYPE_UD),
+                retype(brw_vec8_grf(0,0), BRW_REGISTER_TYPE_UD));
         brw_MOV(p, get_element_ud(m1, 2), brw_imm_ud(newmask << 12)); 
 
         brw_pop_insn_state(p);
@@ -1895,12 +1970,15 @@ void brw_SAMPLE(struct brw_compile *p,
        * and the first message register index comes from src0.
        */
       if (intel->gen >= 6) {
-         brw_push_insn_state(p);
-         brw_set_mask_control( p, BRW_MASK_DISABLE );
-         /* m1 contains header? */
-         brw_MOV(p, brw_message_reg(msg_reg_nr), src0);
-         brw_pop_insn_state(p);
-         src0 = brw_message_reg(msg_reg_nr);
+        if (src0.file != BRW_ARCHITECTURE_REGISTER_FILE ||
+            src0.nr != BRW_ARF_NULL) {
+           brw_push_insn_state(p);
+           brw_set_mask_control( p, BRW_MASK_DISABLE );
+           brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+           brw_MOV(p, retype(brw_message_reg(msg_reg_nr), src0.type), src0);
+           brw_pop_insn_state(p);
+        }
+        src0 = brw_message_reg(msg_reg_nr);
       }
 
       insn = next_insn(p, BRW_OPCODE_SEND);
@@ -1909,7 +1987,7 @@ void brw_SAMPLE(struct brw_compile *p,
       if (intel->gen < 6)
          insn->header.destreg__conditionalmod = msg_reg_nr;
 
-      brw_set_dest(insn, dest);
+      brw_set_dest(p, insn, dest);
       brw_set_src0(insn, src0);
       brw_set_sampler_message(p->brw, insn,
                              binding_table_index,
@@ -1929,7 +2007,8 @@ void brw_SAMPLE(struct brw_compile *p,
        */
       brw_push_insn_state(p);
       brw_set_compression_control(p, BRW_COMPRESSION_NONE);
-      brw_MOV(p, reg, reg);          
+      brw_MOV(p, retype(reg, BRW_REGISTER_TYPE_UD),
+             retype(reg, BRW_REGISTER_TYPE_UD));
       brw_pop_insn_state(p);
    }
 
@@ -1961,7 +2040,8 @@ void brw_urb_WRITE(struct brw_compile *p,
    if (intel->gen >= 6) {
       brw_push_insn_state(p);
       brw_set_mask_control( p, BRW_MASK_DISABLE );
-      brw_MOV(p, brw_message_reg(msg_reg_nr), src0);
+      brw_MOV(p, retype(brw_message_reg(msg_reg_nr), BRW_REGISTER_TYPE_UD),
+             retype(src0, BRW_REGISTER_TYPE_UD));
       brw_pop_insn_state(p);
       src0 = brw_message_reg(msg_reg_nr);
    }
@@ -1970,7 +2050,7 @@ void brw_urb_WRITE(struct brw_compile *p,
 
    assert(msg_length < BRW_MAX_MRF);
 
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src0);
    brw_set_src1(insn, brw_imm_d(0));
 
@@ -1989,6 +2069,80 @@ void brw_urb_WRITE(struct brw_compile *p,
                       swizzle);
 }
 
+static int
+brw_find_next_block_end(struct brw_compile *p, int start)
+{
+   int ip;
+
+   for (ip = start + 1; ip < p->nr_insn; ip++) {
+      struct brw_instruction *insn = &p->store[ip];
+
+      switch (insn->header.opcode) {
+      case BRW_OPCODE_ENDIF:
+      case BRW_OPCODE_ELSE:
+      case BRW_OPCODE_WHILE:
+        return ip;
+      }
+   }
+   assert(!"not reached");
+   return start + 1;
+}
+
+/* There is no DO instruction on gen6, so to find the end of the loop
+ * we have to see if the loop is jumping back before our start
+ * instruction.
+ */
+static int
+brw_find_loop_end(struct brw_compile *p, int start)
+{
+   int ip;
+   int br = 2;
+
+   for (ip = start + 1; ip < p->nr_insn; ip++) {
+      struct brw_instruction *insn = &p->store[ip];
+
+      if (insn->header.opcode == BRW_OPCODE_WHILE) {
+        if (ip + insn->bits1.branch_gen6.jump_count / br < start)
+           return ip;
+      }
+   }
+   assert(!"not reached");
+   return start + 1;
+}
+
+/* After program generation, go back and update the UIP and JIP of
+ * BREAK and CONT instructions to their correct locations.
+ */
+void
+brw_set_uip_jip(struct brw_compile *p)
+{
+   struct intel_context *intel = &p->brw->intel;
+   int ip;
+   int br = 2;
+
+   if (intel->gen < 6)
+      return;
+
+   for (ip = 0; ip < p->nr_insn; ip++) {
+      struct brw_instruction *insn = &p->store[ip];
+
+      switch (insn->header.opcode) {
+      case BRW_OPCODE_BREAK:
+        insn->bits3.break_cont.jip = br * (brw_find_next_block_end(p, ip) - ip);
+        insn->bits3.break_cont.uip = br * (brw_find_loop_end(p, ip) - ip + 1);
+        break;
+      case BRW_OPCODE_CONTINUE:
+        /* JIP is set at CONTINUE emit time, since that's when we
+         * know where the start of the loop is.
+         */
+        insn->bits3.break_cont.jip = br * (brw_find_next_block_end(p, ip) - ip);
+        assert(insn->bits3.break_cont.uip != 0);
+        assert(insn->bits3.break_cont.jip != 0);
+        break;
+      }
+   }
+}
+
 void brw_ff_sync(struct brw_compile *p,
                   struct brw_reg dest,
                   GLuint msg_reg_nr,
@@ -2013,7 +2167,7 @@ void brw_ff_sync(struct brw_compile *p,
    }
 
    insn = next_insn(p, BRW_OPCODE_SEND);
-   brw_set_dest(insn, dest);
+   brw_set_dest(p, insn, dest);
    brw_set_src0(insn, src0);
    brw_set_src1(insn, brw_imm_d(0));
 
index 6796fb208dc72cc54c897bd4c74004b6af4eee98..d0b0c22abf6d5f66ee70d089b9d8cb361d553c39 100644 (file)
@@ -36,8 +36,6 @@
 #include "swrast/swrast.h"
 #include "tnl/tnl.h"
 #include "brw_context.h"
-#include "intel_fbo.h"
-#include "intel_regions.h"
 
 #define FILE_DEBUG_FLAG DEBUG_FALLBACKS
 
@@ -63,49 +61,14 @@ static GLboolean do_check_fallback(struct brw_context *brw)
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
       struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
       if (texUnit->_ReallyEnabled) {
-        struct intel_texture_object *intelObj = intel_texture_object(texUnit->_Current);
-        struct gl_texture_image *texImage = intelObj->base.Image[0][intelObj->firstLevel];
+        struct gl_texture_object *tex_obj = texUnit->_Current;
+        struct gl_texture_image *texImage = tex_obj->Image[0][tex_obj->BaseLevel];
         if (texImage->Border) {
            DBG("FALLBACK: texture border\n");
            return GL_TRUE;
         }
       }
    }
-   
-   /* _NEW_STENCIL 
-    */
-   if (ctx->Stencil._Enabled &&
-       (ctx->DrawBuffer->Name == 0 && !brw->intel.hw_stencil)) {
-      DBG("FALLBACK: stencil\n");
-      return GL_TRUE;
-   }
-
-   /* _NEW_BUFFERS */
-   if (!brw->has_surface_tile_offset) {
-      for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
-        struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
-        struct intel_renderbuffer *irb = intel_renderbuffer(rb);
-
-        /* The original gen4 hardware couldn't set up WM surfaces pointing
-         * at an offset within a tile, which can happen when rendering to
-         * anything but the base level of a texture or the +X face/0 depth.
-         * This was fixed with the 4 Series hardware.
-         *
-         * For these original chips, you would have to make the depth and
-         * color destination surfaces include information on the texture
-         * type, LOD, face, and various limits to use them as a destination.
-         * I would have done this, but there's also a nasty requirement that
-         * the depth and the color surfaces all be of the same LOD, which
-         * may be a worse requirement than this alignment.  (Also, we may
-         * want to just demote the texture to untiled, instead).
-         */
-        if (irb->region && irb->region->tiling != I915_TILING_NONE &&
-            (irb->region->draw_offset & 4095)) {
-           DBG("FALLBACK: non-tile-aligned destination for tiled FBO\n");
-           return GL_TRUE;
-        }
-      }
-   }
 
    return GL_FALSE;
 }
@@ -117,7 +80,7 @@ static void check_fallback(struct brw_context *brw)
 
 const struct brw_tracked_state brw_check_fallback = {
    .dirty = {
-      .mesa = _NEW_BUFFERS | _NEW_RENDERMODE | _NEW_TEXTURE | _NEW_STENCIL,
+      .mesa = _NEW_RENDERMODE | _NEW_TEXTURE | _NEW_STENCIL,
       .brw  = 0,
       .cache = 0
    },
index edb02fabb2344cf9f24e8c6e8ee270c3f99c883e..a35687d599186ea7e6ff35ba89ec47e471b265d3 100644 (file)
@@ -48,6 +48,7 @@ extern "C" {
 #include "../glsl/ir_optimization.h"
 #include "../glsl/ir_print_visitor.h"
 
+#define MAX_INSTRUCTION (1 << 30)
 static struct brw_reg brw_reg_from_fs_reg(class fs_reg *reg);
 
 struct gl_shader *
@@ -89,6 +90,9 @@ brw_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
 GLboolean
 brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 {
+   struct brw_context *brw = brw_context(ctx);
+   struct intel_context *intel = &brw->intel;
+
    struct brw_shader *shader =
       (struct brw_shader *)prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
    if (shader != NULL) {
@@ -107,7 +111,15 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
                         SUB_TO_ADD_NEG |
                         EXP_TO_EXP2 |
                         LOG_TO_LOG2);
+
+      /* Pre-gen6 HW can only nest if-statements 16 deep.  Beyond this,
+       * if-statements need to be flattened.
+       */
+      if (intel->gen < 6)
+        lower_if_to_cond_assign(shader->ir, 16);
+
       do_lower_texture_projection(shader->ir);
+      do_vec_index_to_cond_assign(shader->ir);
       brw_do_cubemap_normalize(shader->ir);
 
       do {
@@ -474,8 +486,13 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir)
    wpos.reg_offset++;
 
    /* gl_FragCoord.z */
-   emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y,
-               interp_reg(FRAG_ATTRIB_WPOS, 2)));
+   if (intel->gen >= 6) {
+      emit(fs_inst(BRW_OPCODE_MOV, wpos,
+                  fs_reg(brw_vec8_grf(c->source_depth_reg, 0))));
+   } else {
+      emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y,
+                  interp_reg(FRAG_ATTRIB_WPOS, 2)));
+   }
    wpos.reg_offset++;
 
    /* gl_FragCoord.w: Already set up in emit_interpolation */
@@ -518,25 +535,40 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
            continue;
         }
 
-        for (unsigned int c = 0; c < type->vector_elements; c++) {
-           struct brw_reg interp = interp_reg(location, c);
-           emit(fs_inst(FS_OPCODE_LINTERP,
-                        attr,
-                        this->delta_x,
-                        this->delta_y,
-                        fs_reg(interp)));
-           attr.reg_offset++;
-        }
-
-        if (intel->gen < 6) {
-           attr.reg_offset -= type->vector_elements;
+        if (c->key.flat_shade && (location == FRAG_ATTRIB_COL0 ||
+                                  location == FRAG_ATTRIB_COL1)) {
+           /* Constant interpolation (flat shading) case. The SF has
+            * handed us defined values in only the constant offset
+            * field of the setup reg.
+            */
            for (unsigned int c = 0; c < type->vector_elements; c++) {
-              emit(fs_inst(BRW_OPCODE_MUL,
-                           attr,
+              struct brw_reg interp = interp_reg(location, c);
+              interp = suboffset(interp, 3);
+              emit(fs_inst(FS_OPCODE_CINTERP, attr, fs_reg(interp)));
+              attr.reg_offset++;
+           }
+        } else {
+           /* Perspective interpolation case. */
+           for (unsigned int c = 0; c < type->vector_elements; c++) {
+              struct brw_reg interp = interp_reg(location, c);
+              emit(fs_inst(FS_OPCODE_LINTERP,
                            attr,
-                           this->pixel_w));
+                           this->delta_x,
+                           this->delta_y,
+                           fs_reg(interp)));
               attr.reg_offset++;
            }
+
+           if (intel->gen < 6) {
+              attr.reg_offset -= type->vector_elements;
+              for (unsigned int c = 0; c < type->vector_elements; c++) {
+                 emit(fs_inst(BRW_OPCODE_MUL,
+                              attr,
+                              attr,
+                              this->pixel_w));
+                 attr.reg_offset++;
+              }
+           }
         }
         location++;
       }
@@ -600,8 +632,13 @@ fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src)
     * might be able to do better by doing execsize = 1 math and then
     * expanding that result out, but we would need to be careful with
     * masking.
+    *
+    * The hardware ignores source modifiers (negate and abs) on math
+    * instructions, so we also move to a temp to set those up.
     */
-   if (intel->gen >= 6 && src.file == UNIFORM) {
+   if (intel->gen >= 6 && (src.file == UNIFORM ||
+                          src.abs ||
+                          src.negate)) {
       fs_reg expanded = fs_reg(this, glsl_type::float_type);
       emit(fs_inst(BRW_OPCODE_MOV, expanded, src));
       src = expanded;
@@ -765,6 +802,30 @@ fs_visitor::try_emit_saturate(ir_expression *ir)
    return true;
 }
 
+static uint32_t
+brw_conditional_for_comparison(unsigned int op)
+{
+   switch (op) {
+   case ir_binop_less:
+      return BRW_CONDITIONAL_L;
+   case ir_binop_greater:
+      return BRW_CONDITIONAL_G;
+   case ir_binop_lequal:
+      return BRW_CONDITIONAL_LE;
+   case ir_binop_gequal:
+      return BRW_CONDITIONAL_GE;
+   case ir_binop_equal:
+   case ir_binop_all_equal: /* same as equal for scalars */
+      return BRW_CONDITIONAL_Z;
+   case ir_binop_nequal:
+   case ir_binop_any_nequal: /* same as nequal for scalars */
+      return BRW_CONDITIONAL_NZ;
+   default:
+      assert(!"not reached: bad operation for comparison");
+      return BRW_CONDITIONAL_NZ;
+   }
+}
+
 void
 fs_visitor::visit(ir_expression *ir)
 {
@@ -814,6 +875,7 @@ fs_visitor::visit(ir_expression *ir)
       break;
    case ir_unop_abs:
       op[0].abs = true;
+      op[0].negate = false;
       this->result = op[0];
       break;
    case ir_unop_sign:
@@ -880,35 +942,20 @@ fs_visitor::visit(ir_expression *ir)
       break;
 
    case ir_binop_less:
-      inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1]));
-      inst->conditional_mod = BRW_CONDITIONAL_L;
-      emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1)));
-      break;
    case ir_binop_greater:
-      inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1]));
-      inst->conditional_mod = BRW_CONDITIONAL_G;
-      emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1)));
-      break;
    case ir_binop_lequal:
-      inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1]));
-      inst->conditional_mod = BRW_CONDITIONAL_LE;
-      emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1)));
-      break;
    case ir_binop_gequal:
-      inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1]));
-      inst->conditional_mod = BRW_CONDITIONAL_GE;
-      emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1)));
-      break;
    case ir_binop_equal:
-   case ir_binop_all_equal: /* same as nequal for scalars */
-      inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1]));
-      inst->conditional_mod = BRW_CONDITIONAL_Z;
-      emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1)));
-      break;
+   case ir_binop_all_equal:
    case ir_binop_nequal:
-   case ir_binop_any_nequal: /* same as nequal for scalars */
-      inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1]));
-      inst->conditional_mod = BRW_CONDITIONAL_NZ;
+   case ir_binop_any_nequal:
+      temp = this->result;
+      /* original gen4 does implicit conversion before comparison. */
+      if (intel->gen < 5)
+        temp.type = op[0].type;
+
+      inst = emit(fs_inst(BRW_OPCODE_CMP, temp, op[0], op[1]));
+      inst->conditional_mod = brw_conditional_for_comparison(ir->operation);
       emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1)));
       break;
 
@@ -933,6 +980,10 @@ fs_visitor::visit(ir_expression *ir)
       assert(!"not reached: should be handled by lower_noise");
       break;
 
+   case ir_quadop_vector:
+      assert(!"not reached: should be handled by lower_quadop_vector");
+      break;
+
    case ir_unop_sqrt:
       emit_math(FS_OPCODE_SQRT, this->result, op[0]);
       break;
@@ -949,7 +1000,12 @@ fs_visitor::visit(ir_expression *ir)
       break;
    case ir_unop_f2b:
    case ir_unop_i2b:
-      inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0.0f)));
+      temp = this->result;
+      /* original gen4 does implicit conversion before comparison. */
+      if (intel->gen < 5)
+        temp.type = op[0].type;
+
+      inst = emit(fs_inst(BRW_OPCODE_CMP, temp, op[0], fs_reg(0.0f)));
       inst->conditional_mod = BRW_CONDITIONAL_NZ;
       inst = emit(fs_inst(BRW_OPCODE_AND, this->result,
                          this->result, fs_reg(1)));
@@ -1423,28 +1479,70 @@ fs_visitor::visit(ir_discard *ir)
 void
 fs_visitor::visit(ir_constant *ir)
 {
-   fs_reg reg(this, ir->type);
-   this->result = reg;
+   /* Set this->result to reg at the bottom of the function because some code
+    * paths will cause this visitor to be applied to other fields.  This will
+    * cause the value stored in this->result to be modified.
+    *
+    * Make reg constant so that it doesn't get accidentally modified along the
+    * way.  Yes, I actually had this problem. :(
+    */
+   const fs_reg reg(this, ir->type);
+   fs_reg dst_reg = reg;
 
-   for (unsigned int i = 0; i < ir->type->vector_elements; i++) {
-      switch (ir->type->base_type) {
-      case GLSL_TYPE_FLOAT:
-        emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg(ir->value.f[i])));
-        break;
-      case GLSL_TYPE_UINT:
-        emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg(ir->value.u[i])));
-        break;
-      case GLSL_TYPE_INT:
-        emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg(ir->value.i[i])));
-        break;
-      case GLSL_TYPE_BOOL:
-        emit(fs_inst(BRW_OPCODE_MOV, reg, fs_reg((int)ir->value.b[i])));
-        break;
-      default:
-        assert(!"Non-float/uint/int/bool constant");
+   if (ir->type->is_array()) {
+      const unsigned size = type_size(ir->type->fields.array);
+
+      for (unsigned i = 0; i < ir->type->length; i++) {
+        ir->array_elements[i]->accept(this);
+        fs_reg src_reg = this->result;
+
+        dst_reg.type = src_reg.type;
+        for (unsigned j = 0; j < size; j++) {
+           emit(fs_inst(BRW_OPCODE_MOV, dst_reg, src_reg));
+           src_reg.reg_offset++;
+           dst_reg.reg_offset++;
+        }
+      }
+   } else if (ir->type->is_record()) {
+      foreach_list(node, &ir->components) {
+        ir_instruction *const field = (ir_instruction *) node;
+        const unsigned size = type_size(field->type);
+
+        field->accept(this);
+        fs_reg src_reg = this->result;
+
+        dst_reg.type = src_reg.type;
+        for (unsigned j = 0; j < size; j++) {
+           emit(fs_inst(BRW_OPCODE_MOV, dst_reg, src_reg));
+           src_reg.reg_offset++;
+           dst_reg.reg_offset++;
+        }
+      }
+   } else {
+      const unsigned size = type_size(ir->type);
+
+      for (unsigned i = 0; i < size; i++) {
+        switch (ir->type->base_type) {
+        case GLSL_TYPE_FLOAT:
+           emit(fs_inst(BRW_OPCODE_MOV, dst_reg, fs_reg(ir->value.f[i])));
+           break;
+        case GLSL_TYPE_UINT:
+           emit(fs_inst(BRW_OPCODE_MOV, dst_reg, fs_reg(ir->value.u[i])));
+           break;
+        case GLSL_TYPE_INT:
+           emit(fs_inst(BRW_OPCODE_MOV, dst_reg, fs_reg(ir->value.i[i])));
+           break;
+        case GLSL_TYPE_BOOL:
+           emit(fs_inst(BRW_OPCODE_MOV, dst_reg, fs_reg((int)ir->value.b[i])));
+           break;
+        default:
+           assert(!"Non-float/uint/int/bool constant");
+        }
+        dst_reg.reg_offset++;
       }
-      reg.reg_offset++;
    }
+
+   this->result = reg;
 }
 
 void
@@ -1490,7 +1588,7 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)
            inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d,
                                op[0], fs_reg(0.0f)));
         } else {
-           inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_d, op[0]));
+           inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_f, op[0]));
         }
         inst->conditional_mod = BRW_CONDITIONAL_NZ;
         break;
@@ -1505,31 +1603,18 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)
         break;
 
       case ir_binop_greater:
-        inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_G;
-        break;
       case ir_binop_gequal:
-        inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_GE;
-        break;
       case ir_binop_less:
-        inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_L;
-        break;
       case ir_binop_lequal:
-        inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_LE;
-        break;
       case ir_binop_equal:
       case ir_binop_all_equal:
-        inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_Z;
-        break;
       case ir_binop_nequal:
       case ir_binop_any_nequal:
-        inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_NZ;
+        inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_cmp, op[0], op[1]));
+        inst->conditional_mod =
+           brw_conditional_for_comparison(expr->operation);
         break;
+
       default:
         assert(!"not reached");
         this->fail = true;
@@ -1574,7 +1659,7 @@ fs_visitor::emit_if_gen6(ir_if *ir)
 
       switch (expr->operation) {
       case ir_unop_logic_not:
-        inst = emit(fs_inst(BRW_OPCODE_IF, temp, op[0], fs_reg(1)));
+        inst = emit(fs_inst(BRW_OPCODE_IF, temp, op[0], fs_reg(0)));
         inst->conditional_mod = BRW_CONDITIONAL_Z;
         return;
 
@@ -1608,30 +1693,16 @@ fs_visitor::emit_if_gen6(ir_if *ir)
         return;
 
       case ir_binop_greater:
-        inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_G;
-        return;
       case ir_binop_gequal:
-        inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_GE;
-        return;
       case ir_binop_less:
-        inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_L;
-        return;
       case ir_binop_lequal:
-        inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_LE;
-        return;
       case ir_binop_equal:
       case ir_binop_all_equal:
-        inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_Z;
-        return;
       case ir_binop_nequal:
       case ir_binop_any_nequal:
         inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
-        inst->conditional_mod = BRW_CONDITIONAL_NZ;
+        inst->conditional_mod =
+           brw_conditional_for_comparison(expr->operation);
         return;
       default:
         assert(!"not reached");
@@ -1713,32 +1784,9 @@ fs_visitor::visit(ir_loop *ir)
       this->base_ir = ir->to;
       ir->to->accept(this);
 
-      fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d,
+      fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_cmp,
                                   counter, this->result));
-      switch (ir->cmp) {
-      case ir_binop_equal:
-        inst->conditional_mod = BRW_CONDITIONAL_Z;
-        break;
-      case ir_binop_nequal:
-        inst->conditional_mod = BRW_CONDITIONAL_NZ;
-        break;
-      case ir_binop_gequal:
-        inst->conditional_mod = BRW_CONDITIONAL_GE;
-        break;
-      case ir_binop_lequal:
-        inst->conditional_mod = BRW_CONDITIONAL_LE;
-        break;
-      case ir_binop_greater:
-        inst->conditional_mod = BRW_CONDITIONAL_G;
-        break;
-      case ir_binop_less:
-        inst->conditional_mod = BRW_CONDITIONAL_L;
-        break;
-      default:
-        assert(!"not reached: unknown loop condition");
-        this->fail = true;
-        break;
-      }
+      inst->conditional_mod = brw_conditional_for_comparison(ir->cmp);
 
       inst = emit(fs_inst(BRW_OPCODE_BREAK));
       inst->predicated = true;
@@ -1951,7 +1999,7 @@ fs_visitor::emit_interpolation_setup_gen6()
    emit(fs_inst(BRW_OPCODE_MOV, this->pixel_y, int_pixel_y));
 
    this->current_annotation = "compute 1/pos.w";
-   this->wpos_w = fs_reg(brw_vec8_grf(c->key.source_w_reg, 0));
+   this->wpos_w = fs_reg(brw_vec8_grf(c->source_w_reg, 0));
    this->pixel_w = fs_reg(this, glsl_type::float_type);
    emit_math(FS_OPCODE_RCP, this->pixel_w, wpos_w);
 
@@ -1979,17 +2027,17 @@ fs_visitor::emit_fb_writes()
       nr += 2;
    }
 
-   if (c->key.aa_dest_stencil_reg) {
+   if (c->aa_dest_stencil_reg) {
       emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++),
-                  fs_reg(brw_vec8_grf(c->key.aa_dest_stencil_reg, 0))));
+                  fs_reg(brw_vec8_grf(c->aa_dest_stencil_reg, 0))));
    }
 
    /* Reserve space for color. It'll be filled in per MRT below. */
    int color_mrf = nr;
    nr += 4;
 
-   if (c->key.source_depth_to_render_target) {
-      if (c->key.computes_depth) {
+   if (c->source_depth_to_render_target) {
+      if (c->computes_depth) {
         /* Hand over gl_FragDepth. */
         assert(this->frag_depth);
         fs_reg depth = *(variable_storage(this->frag_depth));
@@ -1998,20 +2046,22 @@ fs_visitor::emit_fb_writes()
       } else {
         /* Pass through the payload depth. */
         emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++),
-                     fs_reg(brw_vec8_grf(c->key.source_depth_reg, 0))));
+                     fs_reg(brw_vec8_grf(c->source_depth_reg, 0))));
       }
    }
 
-   if (c->key.dest_depth_reg) {
+   if (c->dest_depth_reg) {
       emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++),
-                  fs_reg(brw_vec8_grf(c->key.dest_depth_reg, 0))));
+                  fs_reg(brw_vec8_grf(c->dest_depth_reg, 0))));
    }
 
    fs_reg color = reg_undef;
    if (this->frag_color)
       color = *(variable_storage(this->frag_color));
-   else if (this->frag_data)
+   else if (this->frag_data) {
       color = *(variable_storage(this->frag_data));
+      color.type = BRW_REGISTER_TYPE_F;
+   }
 
    for (int target = 0; target < c->key.nr_color_regions; target++) {
       this->current_annotation = talloc_asprintf(this->mem_ctx,
@@ -2105,7 +2155,8 @@ fs_visitor::generate_fb_write(fs_inst *inst)
                inst->target,
                inst->mlen,
                0,
-               eot);
+               eot,
+               inst->header_present);
 }
 
 void
@@ -2452,7 +2503,7 @@ fs_visitor::generate_pull_constant_load(fs_inst *inst, struct brw_reg dst)
 void
 fs_visitor::assign_curb_setup()
 {
-   c->prog_data.first_curbe_grf = c->key.nr_payload_regs;
+   c->prog_data.first_curbe_grf = c->nr_payload_regs;
    c->prog_data.curb_read_length = ALIGN(c->prog_data.nr_params, 8) / 8;
 
    /* Map the offsets in the UNIFORM file to fixed HW regs. */
@@ -2522,12 +2573,15 @@ fs_visitor::assign_urb_setup()
    foreach_iter(exec_list_iterator, iter, this->instructions) {
       fs_inst *inst = (fs_inst *)iter.get();
 
-      if (inst->opcode != FS_OPCODE_LINTERP)
-        continue;
-
-      assert(inst->src[2].file == FIXED_HW_REG);
+      if (inst->opcode == FS_OPCODE_LINTERP) {
+        assert(inst->src[2].file == FIXED_HW_REG);
+        inst->src[2].fixed_hw_reg.nr += urb_start;
+      }
 
-      inst->src[2].fixed_hw_reg.nr += urb_start;
+      if (inst->opcode == FS_OPCODE_CINTERP) {
+        assert(inst->src[0].file == FIXED_HW_REG);
+        inst->src[0].fixed_hw_reg.nr += urb_start;
+      }
    }
 
    this->first_non_payload_grf = urb_start + c->prog_data.urb_read_length;
@@ -2618,6 +2672,7 @@ fs_visitor::split_virtual_grfs()
         }
       }
    }
+   this->live_intervals_valid = false;
 }
 
 /**
@@ -2692,8 +2747,11 @@ fs_visitor::calculate_live_intervals()
    int loop_start = 0;
    int bb_header_ip = 0;
 
+   if (this->live_intervals_valid)
+      return;
+
    for (int i = 0; i < num_vars; i++) {
-      def[i] = 1 << 30;
+      def[i] = MAX_INSTRUCTION;
       use[i] = -1;
    }
 
@@ -2771,6 +2829,8 @@ fs_visitor::calculate_live_intervals()
    talloc_free(this->virtual_grf_use);
    this->virtual_grf_def = def;
    this->virtual_grf_use = use;
+
+   this->live_intervals_valid = true;
 }
 
 /**
@@ -2786,6 +2846,8 @@ fs_visitor::propagate_constants()
 {
    bool progress = false;
 
+   calculate_live_intervals();
+
    foreach_iter(exec_list_iterator, iter, this->instructions) {
       fs_inst *inst = (fs_inst *)iter.get();
 
@@ -2843,6 +2905,7 @@ fs_visitor::propagate_constants()
                  /* Fit this constant in by commuting the operands */
                  scan_inst->src[0] = scan_inst->src[1];
                  scan_inst->src[1] = inst->src[0];
+                 progress = true;
               }
               break;
            case BRW_OPCODE_CMP:
@@ -2863,6 +2926,9 @@ fs_visitor::propagate_constants()
       }
    }
 
+   if (progress)
+       this->live_intervals_valid = false;
+
    return progress;
 }
 /**
@@ -2877,6 +2943,8 @@ fs_visitor::dead_code_eliminate()
    bool progress = false;
    int pc = 0;
 
+   calculate_live_intervals();
+
    foreach_iter(exec_list_iterator, iter, this->instructions) {
       fs_inst *inst = (fs_inst *)iter.get();
 
@@ -2888,6 +2956,9 @@ fs_visitor::dead_code_eliminate()
       pc++;
    }
 
+   if (progress)
+      live_intervals_valid = false;
+
    return progress;
 }
 
@@ -2895,10 +2966,35 @@ bool
 fs_visitor::register_coalesce()
 {
    bool progress = false;
+   int if_depth = 0;
+   int loop_depth = 0;
 
    foreach_iter(exec_list_iterator, iter, this->instructions) {
       fs_inst *inst = (fs_inst *)iter.get();
 
+      /* Make sure that we dominate the instructions we're going to
+       * scan for interfering with our coalescing, or we won't have
+       * scanned enough to see if anything interferes with our
+       * coalescing.  We don't dominate the following instructions if
+       * we're in a loop or an if block.
+       */
+      switch (inst->opcode) {
+      case BRW_OPCODE_DO:
+        loop_depth++;
+        break;
+      case BRW_OPCODE_WHILE:
+        loop_depth--;
+        break;
+      case BRW_OPCODE_IF:
+        if_depth++;
+        break;
+      case BRW_OPCODE_ENDIF:
+        if_depth--;
+        break;
+      }
+      if (loop_depth || if_depth)
+        continue;
+
       if (inst->opcode != BRW_OPCODE_MOV ||
          inst->predicated ||
          inst->saturate ||
@@ -2916,14 +3012,6 @@ fs_visitor::register_coalesce()
       for (; scan_iter.has_next(); scan_iter.next()) {
         fs_inst *scan_inst = (fs_inst *)scan_iter.get();
 
-        if (scan_inst->opcode == BRW_OPCODE_DO ||
-            scan_inst->opcode == BRW_OPCODE_WHILE ||
-            scan_inst->opcode == BRW_OPCODE_ENDIF) {
-           interfered = true;
-           iter = scan_iter;
-           break;
-        }
-
         if (scan_inst->dst.file == GRF) {
            if (scan_inst->dst.reg == inst->dst.reg &&
                (scan_inst->dst.reg_offset == inst->dst.reg_offset ||
@@ -2943,10 +3031,6 @@ fs_visitor::register_coalesce()
         continue;
       }
 
-      /* Update live interval so we don't have to recalculate. */
-      this->virtual_grf_use[inst->src[0].reg] = MAX2(virtual_grf_use[inst->src[0].reg],
-                                                    virtual_grf_use[inst->dst.reg]);
-
       /* Rewrite the later usage to point at the source of the move to
        * be removed.
        */
@@ -2971,6 +3055,9 @@ fs_visitor::register_coalesce()
       progress = true;
    }
 
+   if (progress)
+      live_intervals_valid = false;
+
    return progress;
 }
 
@@ -2981,6 +3068,8 @@ fs_visitor::compute_to_mrf()
    bool progress = false;
    int next_ip = 0;
 
+   calculate_live_intervals();
+
    foreach_iter(exec_list_iterator, iter, this->instructions) {
       fs_inst *inst = (fs_inst *)iter.get();
 
@@ -3184,15 +3273,16 @@ fs_visitor::virtual_grf_interferes(int a, int b)
    int start = MAX2(this->virtual_grf_def[a], this->virtual_grf_def[b]);
    int end = MIN2(this->virtual_grf_use[a], this->virtual_grf_use[b]);
 
-   /* For dead code, just check if the def interferes with the other range. */
-   if (this->virtual_grf_use[a] == -1) {
-      return (this->virtual_grf_def[a] >= this->virtual_grf_def[b] &&
-             this->virtual_grf_def[a] < this->virtual_grf_use[b]);
-   }
-   if (this->virtual_grf_use[b] == -1) {
-      return (this->virtual_grf_def[b] >= this->virtual_grf_def[a] &&
-             this->virtual_grf_def[b] < this->virtual_grf_use[a]);
-   }
+   /* We can't handle dead register writes here, without iterating
+    * over the whole instruction stream to find every single dead
+    * write to that register to compare to the live interval of the
+    * other register.  Just assert that dead_code_eliminate() has been
+    * called.
+    */
+   assert((this->virtual_grf_use[a] != -1 ||
+          this->virtual_grf_def[a] == MAX_INSTRUCTION) &&
+         (this->virtual_grf_use[b] != -1 ||
+          this->virtual_grf_def[b] == MAX_INSTRUCTION));
 
    return start < end;
 }
@@ -3227,6 +3317,7 @@ static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg)
         break;
       default:
         assert(!"not reached");
+        brw_reg = brw_null_reg();
         break;
       }
       break;
@@ -3241,6 +3332,10 @@ static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg)
       assert(!"not reached");
       brw_reg = brw_null_reg();
       break;
+   default:
+      assert(!"not reached");
+      brw_reg = brw_null_reg();
+      break;
    }
    if (reg->abs)
       brw_reg = brw_abs(brw_reg);
@@ -3373,10 +3468,6 @@ fs_visitor::generate_code()
         break;
 
       case BRW_OPCODE_DO:
-        /* FINISHME: We need to write the loop instruction support still. */
-        if (intel->gen >= 6)
-           this->fail = true;
-
         loop_stack[loop_stack_depth++] = brw_DO(p, BRW_EXECUTE_8);
         if_depth_in_loop[loop_stack_depth] = 0;
         break;
@@ -3386,7 +3477,11 @@ fs_visitor::generate_code()
         brw_set_predicate_control(p, BRW_PREDICATE_NONE);
         break;
       case BRW_OPCODE_CONTINUE:
-        brw_CONT(p, if_depth_in_loop[loop_stack_depth]);
+        /* FINISHME: We need to write the loop instruction support still. */
+        if (intel->gen >= 6)
+           brw_CONT_gen6(p, loop_stack[loop_stack_depth - 1]);
+        else
+           brw_CONT(p, if_depth_in_loop[loop_stack_depth]);
         brw_set_predicate_control(p, BRW_PREDICATE_NONE);
         break;
 
@@ -3400,16 +3495,18 @@ fs_visitor::generate_code()
         assert(loop_stack_depth > 0);
         loop_stack_depth--;
         inst0 = inst1 = brw_WHILE(p, loop_stack[loop_stack_depth]);
-        /* patch all the BREAK/CONT instructions from last BGNLOOP */
-        while (inst0 > loop_stack[loop_stack_depth]) {
-           inst0--;
-           if (inst0->header.opcode == BRW_OPCODE_BREAK &&
-               inst0->bits3.if_else.jump_count == 0) {
-              inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
+        if (intel->gen < 6) {
+           /* patch all the BREAK/CONT instructions from last BGNLOOP */
+           while (inst0 > loop_stack[loop_stack_depth]) {
+              inst0--;
+              if (inst0->header.opcode == BRW_OPCODE_BREAK &&
+                  inst0->bits3.if_else.jump_count == 0) {
+                 inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
            }
-           else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
-                    inst0->bits3.if_else.jump_count == 0) {
-              inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
+              else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
+                       inst0->bits3.if_else.jump_count == 0) {
+                 inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
+              }
            }
         }
       }
@@ -3425,6 +3522,9 @@ fs_visitor::generate_code()
       case FS_OPCODE_COS:
         generate_math(inst, dst, src);
         break;
+      case FS_OPCODE_CINTERP:
+        brw_MOV(p, dst, src[0]);
+        break;
       case FS_OPCODE_LINTERP:
         generate_linterp(inst, dst, src);
         break;
@@ -3486,6 +3586,26 @@ fs_visitor::generate_code()
 
       last_native_inst = p->nr_insn;
    }
+
+   brw_set_uip_jip(p);
+
+   /* OK, while the INTEL_DEBUG=wm above is very nice for debugging FS
+    * emit issues, it doesn't get the jump distances into the output,
+    * which is often something we want to debug.  So this is here in
+    * case you're doing that.
+    */
+   if (0) {
+      if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
+        for (unsigned int i = 0; i < p->nr_insn; i++) {
+           printf("0x%08x 0x%08x 0x%08x 0x%08x ",
+                  ((uint32_t *)&p->store[i])[3],
+                  ((uint32_t *)&p->store[i])[2],
+                  ((uint32_t *)&p->store[i])[1],
+                  ((uint32_t *)&p->store[i])[0]);
+           brw_disasm(stdout, &p->store[i], intel->gen);
+        }
+      }
+   }
 }
 
 GLboolean
@@ -3553,7 +3673,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c)
 
         progress = v.remove_duplicate_mrf_writes() || progress;
 
-        v.calculate_live_intervals();
         progress = v.propagate_constants() || progress;
         progress = v.register_coalesce() || progress;
         progress = v.compute_to_mrf() || progress;
@@ -3566,7 +3685,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c)
         for (int i = 1; i < virtual_grf_count; i++) {
            v.spill_reg(i);
         }
-        v.calculate_live_intervals();
       }
 
       if (0)
@@ -3575,8 +3693,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c)
         while (!v.assign_regs()) {
            if (v.fail)
               break;
-
-           v.calculate_live_intervals();
         }
       }
    }
index de7b15312a58d37f1a207e4e207bac42042c8d47..82d96f6ac0297a1acece61ad015e7dac6ab1180a 100644 (file)
@@ -68,6 +68,7 @@ enum fs_opcodes {
    FS_OPCODE_COS,
    FS_OPCODE_DDX,
    FS_OPCODE_DDY,
+   FS_OPCODE_CINTERP,
    FS_OPCODE_LINTERP,
    FS_OPCODE_TEX,
    FS_OPCODE_TXB,
@@ -348,6 +349,23 @@ public:
                                          hash_table_pointer_hash,
                                          hash_table_pointer_compare);
 
+      /* There's a question that appears to be left open in the spec:
+       * How do implicit dst conversions interact with the CMP
+       * instruction or conditional mods?  On gen6, the instruction:
+       *
+       * CMP null<d> src0<f> src1<f>
+       *
+       * will do src1 - src0 and compare that result as if it was an
+       * integer.  On gen4, it will do src1 - src0 as float, convert
+       * the result to int, and compare as int.  In between, it
+       * appears that it does src1 - src0 and does the compare in the
+       * execution type so dst type doesn't matter.
+       */
+      if (this->intel->gen > 4)
+        this->reg_null_cmp = reg_null_d;
+      else
+        this->reg_null_cmp = reg_null_f;
+
       this->frag_color = NULL;
       this->frag_data = NULL;
       this->frag_depth = NULL;
@@ -361,6 +379,7 @@ public:
       this->virtual_grf_array_size = 0;
       this->virtual_grf_def = NULL;
       this->virtual_grf_use = NULL;
+      this->live_intervals_valid = false;
 
       this->kill_emitted = false;
    }
@@ -462,6 +481,7 @@ public:
    int virtual_grf_array_size;
    int *virtual_grf_def;
    int *virtual_grf_use;
+   bool live_intervals_valid;
 
    struct hash_table *variable_ht;
    ir_variable *frag_color, *frag_data, *frag_depth;
@@ -485,6 +505,7 @@ public:
    fs_reg pixel_w;
    fs_reg delta_x;
    fs_reg delta_y;
+   fs_reg reg_null_cmp;
 
    int grf_used;
 };
index 3b7b03a05b80193557591d8589f8022b15dd2a85..20bfa4c3ea372ccd7f07aef72b07b852891c223b 100644 (file)
@@ -205,6 +205,8 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_unop_round_even:
    case ir_unop_sin:
    case ir_unop_cos:
+   case ir_unop_sin_reduced:
+   case ir_unop_cos_reduced:
    case ir_unop_dFdx:
    case ir_unop_dFdy:
       for (i = 0; i < vector_elements; i++) {
@@ -328,6 +330,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_unop_noise:
       assert(!"noise should have been broken down to function call");
       break;
+   case ir_quadop_vector:
+      assert(!"should have been lowered");
+      break;
    }
 
    ir->remove();
index bbb210cd449bdc71b4ff521dd63644e499a3b5b8..078a349abdf1466c7d397a72c6f89264f91b86d8 100644 (file)
@@ -94,6 +94,8 @@ fs_visitor::assign_regs()
    int class_count = 0;
    int aligned_pair_class = -1;
 
+   calculate_live_intervals();
+
    /* Set up the register classes.
     *
     * The base registers store a scalar value.  For texture samples,
@@ -416,4 +418,6 @@ fs_visitor::spill_reg(int spill_reg)
         }
       }
    }
+
+   this->live_intervals_valid = false;
 }
index b0c76f4094d9cbba1cc10a74f6f1400057e7ed53..70c451d071db0d5ad6da6d3a79bce067d2c5b1c3 100644 (file)
@@ -96,6 +96,9 @@ static void compile_gs_prog( struct brw_context *brw,
       brw_gs_quad_strip( &c, key );
       break;
    case GL_LINE_LOOP:
+      /* Gen6: LINELOOP is converted to LINESTRIP at the beginning of the 3D pipeline */
+      if (intel->gen == 6)
+          return;
       brw_gs_lines( &c );
       break;
    case GL_LINES:
@@ -166,6 +169,9 @@ static void populate_key( struct brw_context *brw,
                          struct brw_gs_prog_key *key )
 {
    struct gl_context *ctx = &brw->intel.ctx;
+   struct intel_context *intel = &brw->intel;
+   int prim_gs_always;
+
    memset(key, 0, sizeof(*key));
 
    /* CACHE_NEW_VS_PROG */
@@ -185,10 +191,14 @@ static void populate_key( struct brw_context *brw,
       key->pv_first = GL_TRUE;
    }
 
-   key->need_gs_prog = (key->hint_gs_always ||
-                       brw->primitive == GL_QUADS ||
+   if (intel->gen == 6)
+       prim_gs_always = 0;
+   else
+       prim_gs_always = brw->primitive == GL_QUADS ||
                        brw->primitive == GL_QUAD_STRIP ||
-                       brw->primitive == GL_LINE_LOOP);
+                       brw->primitive == GL_LINE_LOOP;
+
+   key->need_gs_prog = (key->hint_gs_always || prim_gs_always);
 }
 
 /* Calculate interpolants for triangle and line rasterization.
@@ -205,8 +215,10 @@ static void prepare_gs_prog(struct brw_context *brw)
       brw->gs.prog_active = key.need_gs_prog;
    }
 
+   drm_intel_bo_unreference(brw->gs.prog_bo);
+   brw->gs.prog_bo = NULL;
+
    if (brw->gs.prog_active) {
-      drm_intel_bo_unreference(brw->gs.prog_bo);
       brw->gs.prog_bo = brw_search_cache(&brw->cache, BRW_GS_PROG,
                                         &key, sizeof(key),
                                         NULL, 0,
index a91b0528fac61394f51b5727ce26fd39a55f2fab..79afe19deba04d51ae1dfc694f1966fc54aa2c17 100644 (file)
@@ -214,7 +214,7 @@ static void emit_depthbuffer(struct brw_context *brw)
 
    if (region == NULL) {
       BEGIN_BATCH(len);
-      OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (len - 2));
+      OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (len - 2));
       OUT_BATCH((BRW_DEPTHFORMAT_D32_FLOAT << 18) |
                (BRW_SURFACE_NULL << 29));
       OUT_BATCH(0);
@@ -251,7 +251,7 @@ static void emit_depthbuffer(struct brw_context *brw)
         assert(region->tiling != I915_TILING_NONE);
 
       BEGIN_BATCH(len);
-      OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (len - 2));
+      OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (len - 2));
       OUT_BATCH(((region->pitch * region->cpp) - 1) |
                (format << 18) |
                (BRW_TILEWALK_YMAJOR << 26) |
@@ -277,7 +277,7 @@ static void emit_depthbuffer(struct brw_context *brw)
    /* Initialize it for safety. */
    if (intel->gen >= 6) {
       BEGIN_BATCH(2);
-      OUT_BATCH(CMD_3D_CLEAR_PARAMS << 16 | (2 - 2));
+      OUT_BATCH(_3DSTATE_CLEAR_PARAMS << 16 | (2 - 2));
       OUT_BATCH(0);
       ADVANCE_BATCH();
    }
@@ -309,7 +309,7 @@ static void upload_polygon_stipple(struct brw_context *brw)
       return;
 
    memset(&bps, 0, sizeof(bps));
-   bps.header.opcode = CMD_POLY_STIPPLE_PATTERN;
+   bps.header.opcode = _3DSTATE_POLY_STIPPLE_PATTERN;
    bps.header.length = sizeof(bps)/4-2;
 
    /* Polygon stipple is provided in OpenGL order, i.e. bottom
@@ -354,7 +354,7 @@ static void upload_polygon_stipple_offset(struct brw_context *brw)
       return;
 
    memset(&bpso, 0, sizeof(bpso));
-   bpso.header.opcode = CMD_POLY_STIPPLE_OFFSET;
+   bpso.header.opcode = _3DSTATE_POLY_STIPPLE_OFFSET;
    bpso.header.length = sizeof(bpso)/4-2;
 
    /* If we're drawing to a system window (ctx->DrawBuffer->Name == 0),
@@ -401,7 +401,7 @@ static void upload_aa_line_parameters(struct brw_context *brw)
 
    /* use legacy aa line coverage computation */
    memset(&balp, 0, sizeof(balp));
-   balp.header.opcode = CMD_AA_LINE_PARAMETERS;
+   balp.header.opcode = _3DSTATE_AA_LINE_PARAMETERS;
    balp.header.length = sizeof(balp) / 4 - 2;
    
    BRW_CACHED_BATCH_STRUCT(brw, &balp);
@@ -431,7 +431,7 @@ static void upload_line_stipple(struct brw_context *brw)
       return;
 
    memset(&bls, 0, sizeof(bls));
-   bls.header.opcode = CMD_LINE_STIPPLE_PATTERN;
+   bls.header.opcode = _3DSTATE_LINE_STIPPLE_PATTERN;
    bls.header.length = sizeof(bls)/4 - 2;
 
    bls.bits0.pattern = ctx->Line.StipplePattern;
@@ -481,7 +481,7 @@ static void upload_invarient_state( struct brw_context *brw )
 
       /* Disable depth offset clamping. 
        */
-      gdo.header.opcode = CMD_GLOBAL_DEPTH_OFFSET_CLAMP;
+      gdo.header.opcode = _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP;
       gdo.header.length = sizeof(gdo)/4 - 2;
       gdo.depth_offset_clamp = 0.0;
 
@@ -492,20 +492,20 @@ static void upload_invarient_state( struct brw_context *brw )
       int i;
 
       BEGIN_BATCH(3);
-      OUT_BATCH(CMD_3D_MULTISAMPLE << 16 | (3 - 2));
+      OUT_BATCH(_3DSTATE_MULTISAMPLE << 16 | (3 - 2));
       OUT_BATCH(MS_PIXEL_LOCATION_CENTER |
                MS_NUMSAMPLES_1);
       OUT_BATCH(0); /* positions for 4/8-sample */
       ADVANCE_BATCH();
 
       BEGIN_BATCH(2);
-      OUT_BATCH(CMD_3D_SAMPLE_MASK << 16 | (2 - 2));
+      OUT_BATCH(_3DSTATE_SAMPLE_MASK << 16 | (2 - 2));
       OUT_BATCH(1);
       ADVANCE_BATCH();
 
       for (i = 0; i < 4; i++) {
         BEGIN_BATCH(4);
-        OUT_BATCH(CMD_GS_SVB_INDEX << 16 | (4 - 2));
+        OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2));
         OUT_BATCH(i << SVB_INDEX_SHIFT);
         OUT_BATCH(0);
         OUT_BATCH(0xffffffff);
index 1367d8146968ff0e72a12c055840fd21e9d7011b..94efa79109187bb5a8ff77e1a0717145111cc0e4 100644 (file)
@@ -142,7 +142,6 @@ static GLboolean brwProgramStringNotify( struct gl_context *ctx,
       if (newFP == curFP)
         brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
       newFP->id = brw->program_id++;      
-      newFP->isGLSL = brw_wm_is_glsl(fprog);
 
       /* Don't reject fragment shaders for their Mesa IR state when we're
        * using the new FS backend.
index f28f28663ea728cce8ce33c2abfdf482ea1ed20f..656aad630a19024d84ef99a4b5197b986c6ea683 100644 (file)
@@ -232,6 +232,12 @@ brw_prepare_query_begin(struct brw_context *brw)
       brw->query.bo = NULL;
 
       brw->query.bo = drm_intel_bo_alloc(intel->bufmgr, "query", 4096, 1);
+
+      /* clear target buffer */
+      drm_intel_bo_map(brw->query.bo, GL_TRUE);
+      memset((char *)brw->query.bo->virtual, 0, 4096);
+      drm_intel_bo_unmap(brw->query.bo);
+
       brw->query.index = 0;
    }
 
index 3beed16945b8ddc66e707bc884de70c1e71a6efd..4bb93e73369ee287c01211dbb313ba81bdd686bf 100644 (file)
@@ -164,7 +164,8 @@ void brw_destroy_caches( struct brw_context *brw );
 /***********************************************************************
  * brw_state_batch.c
  */
-#define BRW_BATCH_STRUCT(brw, s) intel_batchbuffer_data( brw->intel.batch, (s), sizeof(*(s)))
+#define BRW_BATCH_STRUCT(brw, s) intel_batchbuffer_data(brw->intel.batch, (s), \
+                                                       sizeof(*(s)), false)
 #define BRW_CACHED_BATCH_STRUCT(brw, s) brw_cached_batch_struct( brw, (s), sizeof(*(s)) )
 
 GLboolean brw_cached_batch_struct( struct brw_context *brw,
index be3989eb7db3374624b68b1d7a0b8fde9ab94f48..a21af13caa328b3c9388407bc3488e98a08fbdff 100644 (file)
@@ -48,7 +48,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,
    struct header *newheader = (struct header *)data;
 
    if (brw->emit_state_always) {
-      intel_batchbuffer_data(brw->intel.batch, data, sz);
+      intel_batchbuffer_data(brw->intel.batch, data, sz, false);
       return GL_TRUE;
    }
 
@@ -75,7 +75,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,
 
  emit:
    memcpy(item->header, newheader, sz);
-   intel_batchbuffer_data(brw->intel.batch, data, sz);
+   intel_batchbuffer_data(brw->intel.batch, data, sz, false);
    return GL_TRUE;
 }
 
index 58ff528d44bfdfff85d25d1f939fd867f4601d8a..7045888ad4a034ae44ed7b0bdfd0d959cbab62e1 100644 (file)
@@ -58,8 +58,6 @@
 
 #include "main/imports.h"
 #include "brw_state.h"
-#include "intel_batchbuffer.h"
-#include "brw_wm.h"
 
 #define FILE_DEBUG_FLAG DEBUG_STATE
 
index 338f3876b31bdc6c1c77cf7ec9ffc60bee411a71..eba4411ca702a77e369cc80df47b7bd30260dfef 100644 (file)
@@ -129,7 +129,7 @@ const struct brw_tracked_state *gen6_atoms[] =
 
    &brw_vs_constants, /* Before vs_surfaces and constant_buffer */
    &brw_wm_constants, /* Before wm_surfaces and constant_buffer */
-   &gen6_wm_constants, /* Before wm_surfaces and constant_buffer */
+   &gen6_wm_constants, /* Before wm_state */
 
    &brw_vs_surfaces,           /* must do before unit */
    &brw_wm_constant_surface,   /* must do before wm surfaces/bind bo */
index 8ce9af9c4fed79a43d7b7e75e98551d926ed2ddf..6687a89e80ad6bc8a09459542c69f8fcc23518ce 100644 (file)
@@ -1017,7 +1017,14 @@ struct brw_wm_unit_state
       GLuint enable_32_pix:1; 
       GLuint enable_con_32_pix:1;
       GLuint enable_con_64_pix:1;
-      GLuint pad0:5;
+      GLuint pad0:1;
+
+      /* These next four bits are for Ironlake+ */
+      GLuint fast_span_coverage_enable:1;
+      GLuint depth_buffer_clear:1;
+      GLuint depth_buffer_resolve_enable:1;
+      GLuint hierarchical_depth_buffer_resolve_enable:1;
+
       GLuint legacy_global_depth_bias:1; 
       GLuint line_stipple:1; 
       GLuint depth_offset:1; 
@@ -1064,6 +1071,15 @@ struct brw_sampler_default_color {
    GLfloat color[4];
 };
 
+struct gen5_sampler_default_color {
+   uint8_t ub[4];
+   float f[4];
+   uint16_t hf[4];
+   uint16_t us[4];
+   int16_t s[4];
+   uint8_t b[4];
+};
+
 struct brw_sampler_state
 {
    
@@ -1169,7 +1185,12 @@ struct brw_surface_state
       GLuint cube_neg_y:1; 
       GLuint cube_pos_x:1; 
       GLuint cube_neg_x:1; 
-      GLuint pad:4;
+      GLuint pad:2;
+      /* Required on gen6 for surfaces accessed through render cache messages.
+       */
+      GLuint render_cache_read_write:1;
+      /* Ironlake and newer: instead of replicating one of the texels */
+      GLuint cube_corner_average:1;
       GLuint mipmap_layout_mode:1; 
       GLuint vert_line_stride_ofs:1; 
       GLuint vert_line_stride:1; 
@@ -1539,6 +1560,21 @@ struct brw_instruction
         GLuint  pad0:12;
       } if_else;
 
+      struct
+      {
+        /* Signed jump distance to the ip to jump to if all channels
+         * are disabled after the break or continue.  It should point
+         * to the end of the innermost control flow block, as that's
+         * where some channel could get re-enabled.
+         */
+        int jip:16;
+
+        /* Signed jump distance to the location to resume execution
+         * of this channel if it's enabled for the break or continue.
+         */
+        int uip:16;
+      } break_cont;
+
       struct {
         GLuint function:4;
         GLuint int_type:1;
@@ -1634,6 +1670,18 @@ struct brw_instruction
         GLuint end_of_thread:1;
       } dp_read;
 
+      struct {
+        GLuint binding_table_index:8;
+        GLuint msg_control:3;
+        GLuint msg_type:3;
+        GLuint target_cache:2;
+        GLuint response_length:4;
+        GLuint msg_length:4;
+        GLuint msg_target:4;
+        GLuint pad1:3;
+        GLuint end_of_thread:1;
+      } dp_read_g4x;
+
       struct {
         GLuint binding_table_index:8;
         GLuint msg_control:3;  
index 4a41c7a517629f03f17479a18d218c2d1a3b31f3..6ae75d22c149e6dc2e92c3afe3ef0fa9c1cc34ff 100644 (file)
@@ -99,8 +99,8 @@ static void do_vs_prog( struct brw_context *brw,
    (void) ctx;
 
    aux_size = sizeof(c.prog_data);
-   if (c.vp->use_const_buffer)
-      aux_size += c.vp->program.Base.Parameters->NumParameters;
+   /* constant_map */
+   aux_size += c.vp->program.Base.Parameters->NumParameters;
 
    drm_intel_bo_unreference(brw->vs.prog_bo);
    brw->vs.prog_bo = brw_upload_cache_with_auxdata(&brw->cache, BRW_VS_PROG,
@@ -130,6 +130,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
    key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
    key.copy_edgeflag = (ctx->Polygon.FrontMode != GL_FILL ||
                        ctx->Polygon.BackMode != GL_FILL);
+   key.two_side_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
 
    /* _NEW_POINT */
    if (ctx->Point.PointSprite) {
@@ -157,7 +158,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
  */
 const struct brw_tracked_state brw_vs_prog = {
    .dirty = {
-      .mesa  = _NEW_TRANSFORM | _NEW_POLYGON | _NEW_POINT,
+      .mesa  = _NEW_TRANSFORM | _NEW_POLYGON | _NEW_POINT | _NEW_LIGHT,
       .brw   = BRW_NEW_VERTEX_PROGRAM,
       .cache = 0
    },
index 9338a6b7dbfe988fbe26e4baf61e2aae2c762bd7..0b88cc1ec76453fb512243f75941c7edc12182b4 100644 (file)
@@ -44,6 +44,7 @@ struct brw_vs_prog_key {
    GLuint nr_userclip:4;
    GLuint copy_edgeflag:1;
    GLuint point_coord_replace:8;
+   GLuint two_side_color: 1;
 };
 
 
index a13c3cae0bd02e2cf6d6762181259e3ee7817580..0411ce0b36c4957be58496d75b28452b4dc61f38 100644 (file)
@@ -140,9 +140,13 @@ clear_current_const(struct brw_vs_compile *c)
 static void brw_vs_alloc_regs( struct brw_vs_compile *c )
 {
    struct intel_context *intel = &c->func.brw->intel;
-   GLuint i, reg = 0, mrf;
+   GLuint i, reg = 0, mrf, j;
    int attributes_in_vue;
    int first_reladdr_output;
+   int max_constant;
+   int constant = 0;
+   int vert_result_reoder[VERT_RESULT_MAX];
+   int bfc = 0;
 
    /* Determine whether to use a real constant buffer or use a block
     * of GRF registers for constants.  The later is faster but only
@@ -181,62 +185,81 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
 
    }
 
-   /* Vertex program parameters from curbe:
+   /* Assign some (probably all) of the vertex program constants to
+    * the push constant buffer/CURBE.
+    *
+    * There's an obvious limit to the numer of push constants equal to
+    * the number of register available, and that number is smaller
+    * than the minimum maximum number of vertex program parameters, so
+    * support for pull constants is required if we overflow.
+    * Additionally, on gen6 the number of push constants is even
+    * lower.
+    *
+    * When there's relative addressing, we don't know what range of
+    * Mesa IR registers can be accessed.  And generally, when relative
+    * addressing is used we also have too many constants to load them
+    * all as push constants.  So, we'll just support relative
+    * addressing out of the pull constant buffers, and try to load as
+    * many statically-accessed constants into the push constant buffer
+    * as we can.
     */
-   if (c->vp->use_const_buffer) {
-      int max_constant = BRW_MAX_GRF - 20 - c->vp->program.Base.NumTemporaries;
-      int constant = 0;
-
-      /* We've got more constants than we can load with the push
-       * mechanism.  This is often correlated with reladdr loads where
-       * we should probably be using a pull mechanism anyway to avoid
-       * excessive reading.  However, the pull mechanism is slow in
-       * general.  So, we try to allocate as many non-reladdr-loaded
-       * constants through the push buffer as we can before giving up.
-       */
-      memset(c->constant_map, -1, c->vp->program.Base.Parameters->NumParameters);
-      for (i = 0;
-          i < c->vp->program.Base.NumInstructions && constant < max_constant;
-          i++) {
-        struct prog_instruction *inst = &c->vp->program.Base.Instructions[i];
-        int arg;
-
-        for (arg = 0; arg < 3 && constant < max_constant; arg++) {
-           if ((inst->SrcReg[arg].File != PROGRAM_STATE_VAR &&
-                inst->SrcReg[arg].File != PROGRAM_CONSTANT &&
-                inst->SrcReg[arg].File != PROGRAM_UNIFORM &&
-                inst->SrcReg[arg].File != PROGRAM_ENV_PARAM &&
-                inst->SrcReg[arg].File != PROGRAM_LOCAL_PARAM) ||
-               inst->SrcReg[arg].RelAddr)
-              continue;
-
-           if (c->constant_map[inst->SrcReg[arg].Index] == -1) {
-              c->constant_map[inst->SrcReg[arg].Index] = constant++;
-           }
+   if (intel->gen >= 6) {
+      /* We can only load 32 regs of push constants. */
+      max_constant = 32 * 2 - c->key.nr_userclip;
+   } else {
+      max_constant = BRW_MAX_GRF - 20 - c->vp->program.Base.NumTemporaries;
+   }
+
+   /* constant_map maps from ParameterValues[] index to index in the
+    * push constant buffer, or -1 if it's only in the pull constant
+    * buffer.
+    */
+   memset(c->constant_map, -1, c->vp->program.Base.Parameters->NumParameters);
+   for (i = 0;
+       i < c->vp->program.Base.NumInstructions && constant < max_constant;
+       i++) {
+      struct prog_instruction *inst = &c->vp->program.Base.Instructions[i];
+      int arg;
+
+      for (arg = 0; arg < 3 && constant < max_constant; arg++) {
+        if (inst->SrcReg[arg].File != PROGRAM_STATE_VAR &&
+            inst->SrcReg[arg].File != PROGRAM_CONSTANT &&
+            inst->SrcReg[arg].File != PROGRAM_UNIFORM &&
+            inst->SrcReg[arg].File != PROGRAM_ENV_PARAM &&
+            inst->SrcReg[arg].File != PROGRAM_LOCAL_PARAM) {
+           continue;
+        }
+
+        if (inst->SrcReg[arg].RelAddr) {
+           c->vp->use_const_buffer = GL_TRUE;
+           continue;
         }
-      }
 
-      for (i = 0; i < constant; i++) {
-         c->regs[PROGRAM_STATE_VAR][i] = stride( brw_vec4_grf(reg+i/2,
-                                                             (i%2) * 4),
-                                                0, 4, 1);
+        if (c->constant_map[inst->SrcReg[arg].Index] == -1) {
+           c->constant_map[inst->SrcReg[arg].Index] = constant++;
+        }
       }
-      reg += (constant + 1) / 2;
-      c->prog_data.curb_read_length = reg - 1;
-      /* XXX 0 causes a bug elsewhere... */
-      c->prog_data.nr_params = MAX2(constant * 4, 4);
    }
-   else {
-      /* use a section of the GRF for constants */
-      GLuint nr_params = c->vp->program.Base.Parameters->NumParameters;
-      for (i = 0; i < nr_params; i++) {
-         c->regs[PROGRAM_STATE_VAR][i] = stride( brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1);
-      }
-      reg += (nr_params + 1) / 2;
-      c->prog_data.curb_read_length = reg - 1;
 
-      c->prog_data.nr_params = nr_params * 4;
+   /* If we ran out of push constant space, then we'll also upload all
+    * constants through the pull constant buffer so that they can be
+    * accessed no matter what.  For relative addressing (the common
+    * case) we need them all in place anyway.
+    */
+   if (constant == max_constant)
+      c->vp->use_const_buffer = GL_TRUE;
+
+   for (i = 0; i < constant; i++) {
+      c->regs[PROGRAM_STATE_VAR][i] = stride(brw_vec4_grf(reg + i / 2,
+                                                         (i % 2) * 4),
+                                            0, 4, 1);
    }
+   reg += (constant + 1) / 2;
+   c->prog_data.curb_read_length = reg - 1;
+   c->prog_data.nr_params = constant * 4;
+   /* XXX 0 causes a bug elsewhere... */
+   if (intel->gen < 6 && c->prog_data.nr_params == 0)
+      c->prog_data.nr_params = 4;
 
    /* Allocate input regs:  
     */
@@ -270,7 +293,36 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
       mrf = 4;
 
    first_reladdr_output = get_first_reladdr_output(&c->vp->program);
-   for (i = 0; i < VERT_RESULT_MAX; i++) {
+
+   for (i = 0; i < VERT_RESULT_MAX; i++)
+       vert_result_reoder[i] = i;
+
+   /* adjust attribute order in VUE for BFC0/BFC1 on Gen6+ */
+   if (intel->gen >= 6 && c->key.two_side_color) {
+       if ((c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_COL1)) &&
+           (c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC1))) {
+           assert(c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0));
+           assert(c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0));
+           bfc = 2;
+       } else if ((c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0)) &&
+           (c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0)))
+           bfc = 1;
+
+       if (bfc) {
+           for (i = 0; i < bfc; i++) {
+               vert_result_reoder[VERT_RESULT_COL0 + i * 2 + 0] = VERT_RESULT_COL0 + i;
+               vert_result_reoder[VERT_RESULT_COL0 + i * 2 + 1] = VERT_RESULT_BFC0 + i;
+           }
+
+           for (i = VERT_RESULT_COL0 + bfc * 2; i < VERT_RESULT_BFC0 + bfc; i++) {
+               vert_result_reoder[i] = i - bfc;
+           }
+       }
+   }
+
+   for (j = 0; j < VERT_RESULT_MAX; j++) {
+      i = vert_result_reoder[j];
+
       if (c->prog_data.outputs_written & BITFIELD64_BIT(i)) {
         c->nr_outputs++;
          assert(i < Elements(c->regs[PROGRAM_OUTPUT]));
@@ -281,7 +333,6 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
         else if (i == VERT_RESULT_PSIZ) {
            c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0);
            reg++;
-           mrf++;              /* just a placeholder?  XXX fix later stages & remove this */
         }
         else {
            /* Two restrictions on our compute-to-MRF here.  The
@@ -607,6 +658,22 @@ static void emit_min( struct brw_compile *p,
    }
 }
 
+static void emit_arl(struct brw_compile *p,
+                    struct brw_reg dst,
+                    struct brw_reg src)
+{
+   struct intel_context *intel = &p->brw->intel;
+
+   if (intel->gen >= 6) {
+      struct brw_reg dst_f = retype(dst, BRW_REGISTER_TYPE_F);
+
+      brw_RNDD(p, dst_f, src);
+      brw_MOV(p, dst, dst_f);
+   } else {
+      brw_RNDD(p, dst, src);
+   }
+}
+
 static void emit_math1_gen4(struct brw_vs_compile *c,
                            GLuint function,
                            struct brw_reg dst,
@@ -698,7 +765,7 @@ emit_math1(struct brw_vs_compile *c,
       emit_math1_gen4(c, function, dst, arg0, precision);
 }
 
-static void emit_math2( struct brw_vs_compile *c, 
+static void emit_math2_gen4( struct brw_vs_compile *c, 
                        GLuint function,
                        struct brw_reg dst,
                        struct brw_reg arg0,
@@ -706,14 +773,11 @@ static void emit_math2( struct brw_vs_compile *c,
                        GLuint precision)
 {
    struct brw_compile *p = &c->func;
-   struct intel_context *intel = &p->brw->intel;
    struct brw_reg tmp = dst;
    GLboolean need_tmp = GL_FALSE;
 
-   if (dst.file != BRW_GENERAL_REGISTER_FILE)
-      need_tmp = GL_TRUE;
-
-   if (intel->gen < 6 && dst.dw1.bits.writemask != 0xf)
+   if (dst.file != BRW_GENERAL_REGISTER_FILE ||
+       dst.dw1.bits.writemask != 0xf)
       need_tmp = GL_TRUE;
 
    if (need_tmp) 
@@ -736,6 +800,53 @@ static void emit_math2( struct brw_vs_compile *c,
    }
 }
 
+static void emit_math2_gen6( struct brw_vs_compile *c, 
+                       GLuint function,
+                       struct brw_reg dst,
+                       struct brw_reg arg0,
+                       struct brw_reg arg1,
+                       GLuint precision)
+{
+   struct brw_compile *p = &c->func;
+   struct brw_reg tmp_src0, tmp_src1, tmp_dst;
+
+   tmp_src0 = get_tmp(c);
+   tmp_src1 = get_tmp(c);
+   tmp_dst = get_tmp(c);
+
+   brw_MOV(p, tmp_src0, arg0);
+   brw_MOV(p, tmp_src1, arg1);
+   
+   brw_set_access_mode(p, BRW_ALIGN_1);
+   brw_math2(p,
+           tmp_dst,
+           function,
+           tmp_src0,
+           tmp_src1);
+   brw_set_access_mode(p, BRW_ALIGN_16);
+
+   brw_MOV(p, dst, tmp_dst);
+
+   release_tmp(c, tmp_src0);
+   release_tmp(c, tmp_src1);
+   release_tmp(c, tmp_dst);
+}
+
+static void emit_math2( struct brw_vs_compile *c, 
+                       GLuint function,
+                       struct brw_reg dst,
+                       struct brw_reg arg0,
+                       struct brw_reg arg1,
+                       GLuint precision)
+{
+   struct brw_compile *p = &c->func;
+   struct intel_context *intel = &p->brw->intel;
+
+   if (intel->gen >= 6)
+      emit_math2_gen6(c, function, dst, arg0, arg1, precision);
+   else
+      emit_math2_gen4(c, function, dst, arg0, arg1, precision);
+}
 
 static void emit_exp_noalias( struct brw_vs_compile *c,
                              struct brw_reg dst,
@@ -1008,8 +1119,6 @@ get_constant(struct brw_vs_compile *c,
 
    assert(argIndex < 3);
 
-   assert(c->func.brw->intel.gen < 6); /* FINISHME */
-
    if (c->current_const[argIndex].index != src->Index) {
       /* Keep track of the last constant loaded in this slot, for reuse. */
       c->current_const[argIndex].index = src->Index;
@@ -1027,7 +1136,7 @@ get_constant(struct brw_vs_compile *c,
    }
 
    /* replicate lower four floats into upper half (to get XYZWXYZW) */
-   const_reg = stride(const_reg, 0, 4, 0);
+   const_reg = stride(const_reg, 0, 4, 1);
    const_reg.subnr = 0;
 
    return const_reg;
@@ -1040,14 +1149,14 @@ get_reladdr_constant(struct brw_vs_compile *c,
 {
    const struct prog_src_register *src = &inst->SrcReg[argIndex];
    struct brw_compile *p = &c->func;
+   struct brw_context *brw = p->brw;
+   struct intel_context *intel = &brw->intel;
    struct brw_reg const_reg = c->current_const[argIndex].reg;
-   struct brw_reg addrReg = c->regs[PROGRAM_ADDRESS][0];
-   struct brw_reg byte_addr_reg = retype(get_tmp(c), BRW_REGISTER_TYPE_D);
+   struct brw_reg addr_reg = c->regs[PROGRAM_ADDRESS][0];
+   uint32_t offset;
 
    assert(argIndex < 3);
 
-   assert(c->func.brw->intel.gen < 6); /* FINISHME */
-
    /* Can't reuse a reladdr constant load. */
    c->current_const[argIndex].index = -1;
 
@@ -1056,15 +1165,21 @@ get_reladdr_constant(struct brw_vs_compile *c,
          src->Index, argIndex, c->current_const[argIndex].reg.nr);
 #endif
 
-   brw_MUL(p, byte_addr_reg, addrReg, brw_imm_ud(16));
+   if (intel->gen >= 6) {
+      offset = src->Index;
+   } else {
+      struct brw_reg byte_addr_reg = retype(get_tmp(c), BRW_REGISTER_TYPE_D);
+      brw_MUL(p, byte_addr_reg, addr_reg, brw_imm_d(16));
+      addr_reg = byte_addr_reg;
+      offset = 16 * src->Index;
+   }
 
    /* fetch the first vec4 */
    brw_dp_READ_4_vs_relative(p,
-                            const_reg,                     /* writeback dest */
-                            byte_addr_reg,                 /* address register */
-                            16 * src->Index,               /* byte offset */
-                            SURF_INDEX_VERT_CONST_BUFFER   /* binding table index */
-                            );
+                            const_reg,
+                            addr_reg,
+                            offset,
+                            SURF_INDEX_VERT_CONST_BUFFER);
 
    return const_reg;
 }
@@ -1259,22 +1374,18 @@ get_src_reg( struct brw_vs_compile *c,
    case PROGRAM_UNIFORM:
    case PROGRAM_ENV_PARAM:
    case PROGRAM_LOCAL_PARAM:
-      if (c->vp->use_const_buffer) {
-        if (!relAddr && c->constant_map[index] != -1) {
-           assert(c->regs[PROGRAM_STATE_VAR][c->constant_map[index]].nr != 0);
-           return c->regs[PROGRAM_STATE_VAR][c->constant_map[index]];
-        } else if (relAddr)
+      if (!relAddr && c->constant_map[index] != -1) {
+        /* Take from the push constant buffer if possible. */
+        assert(c->regs[PROGRAM_STATE_VAR][c->constant_map[index]].nr != 0);
+        return c->regs[PROGRAM_STATE_VAR][c->constant_map[index]];
+      } else {
+        /* Must be in the pull constant buffer then .*/
+        assert(c->vp->use_const_buffer);
+        if (relAddr)
            return get_reladdr_constant(c, inst, argIndex);
         else
            return get_constant(c, inst, argIndex);
       }
-      else if (relAddr) {
-         return deref(c, c->regs[PROGRAM_STATE_VAR][0], index, 16);
-      }
-      else {
-         assert(c->regs[PROGRAM_STATE_VAR][index].nr != 0);
-         return c->regs[PROGRAM_STATE_VAR][index];
-      }
    case PROGRAM_ADDRESS:
       assert(index == 0);
       return c->regs[file][index];
@@ -1315,11 +1426,10 @@ static struct brw_reg get_arg( struct brw_vs_compile *c,
                                          GET_SWZ(src->Swizzle, 1),
                                          GET_SWZ(src->Swizzle, 2),
                                          GET_SWZ(src->Swizzle, 3));
-   }
 
-   /* Note this is ok for non-swizzle instructions: 
-    */
-   reg.negate = src->Negate ? 1 : 0;   
+      /* Note this is ok for non-swizzle ARB_vp instructions */
+      reg.negate = src->Negate ? 1 : 0;
+   }
 
    return reg;
 }
@@ -1603,6 +1713,8 @@ static void emit_vertex_write( struct brw_vs_compile *c)
         break;
       if (!(c->prog_data.outputs_written & BITFIELD64_BIT(i)))
         continue;
+      if (i == VERT_RESULT_PSIZ)
+        continue;
 
       if (i >= VERT_RESULT_TEX0 &&
          c->regs[PROGRAM_OUTPUT][i].file == BRW_GENERAL_REGISTER_FILE) {
@@ -1830,6 +1942,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
 
       switch (inst->Opcode) {
       case OPCODE_ABS:
+        args[0].negate = false;
         brw_MOV(p, dst, brw_abs(args[0]));
         break;
       case OPCODE_ADD:
@@ -1866,7 +1979,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
         emit_math1(c, BRW_MATH_FUNCTION_EXP, dst, args[0], BRW_MATH_PRECISION_FULL);
         break;
       case OPCODE_ARL:
-        brw_RNDD(p, dst, args[0]);
+        emit_arl(p, dst, args[0]);
         break;
       case OPCODE_FLR:
         brw_RNDD(p, dst, args[0]);
@@ -1913,7 +2026,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
         emit_math1(c, BRW_MATH_FUNCTION_INV, dst, args[0], BRW_MATH_PRECISION_FULL);
         break;
       case OPCODE_RSQ:
-        emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, args[0], BRW_MATH_PRECISION_FULL);
+        emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, brw_abs(args[0]), BRW_MATH_PRECISION_FULL);
         break;
 
       case OPCODE_SEQ:
@@ -1987,35 +2100,42 @@ void brw_vs_emit(struct brw_vs_compile *c )
          break;
       case OPCODE_CONT:
         brw_set_predicate_control(p, get_predicate(inst));
-        brw_CONT(p, if_depth_in_loop[loop_depth]);
+        if (intel->gen >= 6) {
+           brw_CONT_gen6(p, loop_inst[loop_depth - 1]);
+        } else {
+           brw_CONT(p, if_depth_in_loop[loop_depth]);
+        }
          brw_set_predicate_control(p, BRW_PREDICATE_NONE);
          break;
-      case OPCODE_ENDLOOP: 
-         {
-           clear_current_const(c);
-            struct brw_instruction *inst0, *inst1;
-           GLuint br = 1;
-
-            loop_depth--;
-
-           if (intel->gen == 5)
-              br = 2;
-
-            inst0 = inst1 = brw_WHILE(p, loop_inst[loop_depth]);
-            /* patch all the BREAK/CONT instructions from last BEGINLOOP */
-            while (inst0 > loop_inst[loop_depth]) {
-               inst0--;
-               if (inst0->header.opcode == BRW_OPCODE_BREAK &&
+
+      case OPCODE_ENDLOOP: {
+        clear_current_const(c);
+        struct brw_instruction *inst0, *inst1;
+        GLuint br = 1;
+
+        loop_depth--;
+
+        if (intel->gen == 5)
+           br = 2;
+
+        inst0 = inst1 = brw_WHILE(p, loop_inst[loop_depth]);
+
+        if (intel->gen < 6) {
+           /* patch all the BREAK/CONT instructions from last BEGINLOOP */
+           while (inst0 > loop_inst[loop_depth]) {
+              inst0--;
+              if (inst0->header.opcode == BRW_OPCODE_BREAK &&
                   inst0->bits3.if_else.jump_count == 0) {
-                  inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
-               }
-               else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
-                       inst0->bits3.if_else.jump_count == 0) {
-                  inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
-               }
-            }
-         }
+                 inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
+              } else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
+                         inst0->bits3.if_else.jump_count == 0) {
+                 inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
+              }
+           }
+        }
+      }
          break;
+
       case OPCODE_BRA:
         brw_set_predicate_control(p, get_predicate(inst));
          brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
@@ -2106,6 +2226,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
    }
 
    brw_resolve_cals(p);
+   brw_set_uip_jip(p);
 
    brw_optimize(p);
 
index eabac511602f98d4e206d4932c827b174a8b0e85..b0b05445eb980292fb263391cdb0d5ed41fa7fb7 100644 (file)
@@ -82,6 +82,15 @@ prepare_vs_constants(struct brw_context *brw)
             params->ParameterValues[i],
             4 * sizeof(float));
    }
+
+   if (0) {
+      for (i = 0; i < params->NumParameters; i++) {
+        float *row = (float *)brw->vs.const_bo->virtual + i * 4;
+        printf("vs const surface %3d: %4.3f %4.3f %4.3f %4.3f\n",
+               i, row[0], row[1], row[2], row[3]);
+      }
+   }
+
    drm_intel_gem_bo_unmap_gtt(brw->vs.const_bo);
    brw->state.dirty.brw |= BRW_NEW_VS_CONSTBUF;
 }
index 3d7a98c9812d1c3782e40be5ba0ad76eea05bb8b..100a21b59d723b0830c8bb7a32dbf5af9bc4d603 100644 (file)
@@ -203,4 +203,5 @@ void brwInitVtbl( struct brw_context *brw )
    brw->intel.vtbl.destroy = brw_destroy_context;
    brw->intel.vtbl.set_draw_region = brw_set_draw_region;
    brw->intel.vtbl.debug_batch = brw_debug_batch;
+   brw->intel.vtbl.render_target_supported = brw_render_target_supported;
 }
index ccdc18e0b8df4d4bea18d3e93450edb8d019d95e..656501b4f79c33993bf7325ece53056be0c10595 100644 (file)
@@ -119,6 +119,62 @@ brw_wm_non_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c)
    brw_wm_emit(c);
 }
 
+static void
+brw_wm_payload_setup(struct brw_context *brw,
+                    struct brw_wm_compile *c)
+{
+   struct intel_context *intel = &brw->intel;
+   bool uses_depth = (c->fp->program.Base.InputsRead &
+                     (1 << FRAG_ATTRIB_WPOS)) != 0;
+
+   if (intel->gen >= 6) {
+      /* R0-1: masks, pixel X/Y coordinates. */
+      c->nr_payload_regs = 2;
+      /* R2: only for 32-pixel dispatch.*/
+      /* R3-4: perspective pixel location barycentric */
+      c->nr_payload_regs += 2;
+      /* R5-6: perspective pixel location bary for dispatch width != 8 */
+      if (c->dispatch_width == 16) {
+        c->nr_payload_regs += 2;
+      }
+      /* R7-10: perspective centroid barycentric */
+      /* R11-14: perspective sample barycentric */
+      /* R15-18: linear pixel location barycentric */
+      /* R19-22: linear centroid barycentric */
+      /* R23-26: linear sample barycentric */
+
+      /* R27: interpolated depth if uses source depth */
+      if (uses_depth) {
+        c->source_depth_reg = c->nr_payload_regs;
+        c->nr_payload_regs++;
+        if (c->dispatch_width == 16) {
+           /* R28: interpolated depth if not 8-wide. */
+           c->nr_payload_regs++;
+        }
+      }
+      /* R29: interpolated W set if GEN6_WM_USES_SOURCE_W.
+       */
+      if (uses_depth) {
+        c->source_w_reg = c->nr_payload_regs;
+        c->nr_payload_regs++;
+        if (c->dispatch_width == 16) {
+           /* R30: interpolated W if not 8-wide. */
+           c->nr_payload_regs++;
+        }
+      }
+      /* R31: MSAA position offsets. */
+      /* R32-: bary for 32-pixel. */
+      /* R58-59: interp W for 32-pixel. */
+
+      if (c->fp->program.Base.OutputsWritten &
+         BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
+        c->source_depth_to_render_target = GL_TRUE;
+        c->computes_depth = GL_TRUE;
+      }
+   } else {
+      brw_wm_lookup_iz(intel, c);
+   }
+}
 
 /**
  * All Mesa program -> GPU code generation goes through this function.
@@ -167,23 +223,18 @@ static void do_wm_prog( struct brw_context *brw,
 
    brw_init_compile(brw, &c->func);
 
-   /* temporary sanity check assertion */
-   ASSERT(fp->isGLSL == brw_wm_is_glsl(&c->fp->program));
+   brw_wm_payload_setup(brw, c);
 
    if (!brw_wm_fs_emit(brw, c)) {
       /*
        * Shader which use GLSL features such as flow control are handled
        * differently from "simple" shaders.
        */
-      if (fp->isGLSL) {
-        c->dispatch_width = 8;
-        brw_wm_glsl_emit(brw, c);
-      }
-      else {
-        c->dispatch_width = 16;
-        brw_wm_non_glsl_emit(brw, c);
-      }
+      c->dispatch_width = 16;
+      brw_wm_payload_setup(brw, c);
+      brw_wm_non_glsl_emit(brw, c);
    }
+   c->prog_data.dispatch_width = c->dispatch_width;
 
    /* Scratch space is used for register spilling */
    if (c->last_scratch) {
@@ -220,12 +271,10 @@ static void do_wm_prog( struct brw_context *brw,
 static void brw_wm_populate_key( struct brw_context *brw,
                                 struct brw_wm_prog_key *key )
 {
-   struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &brw->intel.ctx;
    /* BRW_NEW_FRAGMENT_PROGRAM */
    const struct brw_fragment_program *fp = 
       (struct brw_fragment_program *)brw->fragment_program;
-   GLboolean uses_depth = (fp->program.Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
    GLuint lookup = 0;
    GLuint line_aa;
    GLuint i;
@@ -285,57 +334,9 @@ static void brw_wm_populate_key( struct brw_context *brw,
       }
    }
 
-   if (intel->gen >= 6) {
-      /* R0-1: masks, pixel X/Y coordinates. */
-      key->nr_payload_regs = 2;
-      /* R2: only for 32-pixel dispatch.*/
-      /* R3-4: perspective pixel location barycentric */
-      key->nr_payload_regs += 2;
-      /* R5-6: perspective pixel location bary for dispatch width != 8 */
-      if (!fp->isGLSL) { /* dispatch_width != 8 */
-        key->nr_payload_regs += 2;
-      }
-      /* R7-10: perspective centroid barycentric */
-      /* R11-14: perspective sample barycentric */
-      /* R15-18: linear pixel location barycentric */
-      /* R19-22: linear centroid barycentric */
-      /* R23-26: linear sample barycentric */
-
-      /* R27: interpolated depth if uses source depth */
-      if (uses_depth) {
-        key->source_depth_reg = key->nr_payload_regs;
-        key->nr_payload_regs++;
-        if (!fp->isGLSL) { /* dispatch_width != 8 */
-           /* R28: interpolated depth if not 8-wide. */
-           key->nr_payload_regs++;
-        }
-      }
-      /* R29: interpolated W set if GEN6_WM_USES_SOURCE_W.
-       */
-      if (uses_depth) {
-        key->source_w_reg = key->nr_payload_regs;
-        key->nr_payload_regs++;
-        if (!fp->isGLSL) { /* dispatch_width != 8 */
-           /* R30: interpolated W if not 8-wide. */
-           key->nr_payload_regs++;
-        }
-      }
-      /* R31: MSAA position offsets. */
-      /* R32-: bary for 32-pixel. */
-      /* R58-59: interp W for 32-pixel. */
-
-      if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
-        key->source_depth_to_render_target = GL_TRUE;
-        key->computes_depth = GL_TRUE;
-      }
-
-   } else {
-      brw_wm_lookup_iz(intel,
-                      line_aa,
-                      lookup,
-                      uses_depth,
-                      key);
-   }
+   key->iz_lookup = lookup;
+   key->line_aa = line_aa;
+   key->stats_wm = brw->intel.stats_wm;
 
    /* BRW_NEW_WM_INPUT_DIMENSIONS */
    key->proj_attrib_mask = brw->wm.input_size_masks[4-1];
@@ -377,6 +378,10 @@ static void brw_wm_populate_key( struct brw_context *brw,
               swizzles[2] = SWIZZLE_ZERO;
            } else if (t->DepthMode == GL_LUMINANCE) {
               swizzles[3] = SWIZZLE_ONE;
+           } else if (t->DepthMode == GL_RED) {
+              swizzles[1] = SWIZZLE_ZERO;
+              swizzles[2] = SWIZZLE_ZERO;
+              swizzles[3] = SWIZZLE_ZERO;
            }
         }
 
index 2ca685784fce8926023f4eb1dc560e60bf6e3873..d9cae75ab5b7861ce06d9b643d9eb7eeac7adb47 100644 (file)
 #define AA_ALWAYS    2
 
 struct brw_wm_prog_key {
-   GLuint source_depth_reg:3;
-   GLuint source_w_reg:3;
-   GLuint aa_dest_stencil_reg:3;
-   GLuint dest_depth_reg:3;
-   GLuint nr_payload_regs:4;
-   GLuint computes_depth:1;    /* could be derived from program string */
-   GLuint source_depth_to_render_target:1;
+   GLuint stats_wm:1;
    GLuint flat_shade:1;
    GLuint linear_color:1;  /**< linear interpolation vs perspective interp */
-   GLuint runtime_check_aads_emit:1;
    GLuint nr_color_regions:5;
    GLuint render_to_fbo:1;
 
@@ -81,6 +74,8 @@ struct brw_wm_prog_key {
 
    GLushort drawable_height;
    GLbitfield64 vp_outputs_written;
+   GLuint iz_lookup;
+   GLuint line_aa;
    GLuint program_string_id:32;
 };
 
@@ -204,6 +199,15 @@ struct brw_wm_compile {
       PASS2_DONE
    } state;
 
+   GLuint source_depth_reg:3;
+   GLuint source_w_reg:3;
+   GLuint aa_dest_stencil_reg:3;
+   GLuint dest_depth_reg:3;
+   GLuint nr_payload_regs:4;
+   GLuint computes_depth:1;    /* could be derived from program string */
+   GLuint source_depth_to_render_target:1;
+   GLuint runtime_check_aads_emit:1;
+
    /* Initial pass - translate fp instructions to fp instructions,
     * simplifying and adding instructions for interpolation and
     * framebuffer writes.
@@ -306,14 +310,9 @@ void brw_wm_print_insn( struct brw_wm_compile *c,
 void brw_wm_print_program( struct brw_wm_compile *c,
                           const char *stage );
 
-void brw_wm_lookup_iz( struct intel_context *intel,
-                      GLuint line_aa,
-                      GLuint lookup,
-                      GLboolean ps_uses_depth,
-                      struct brw_wm_prog_key *key );
+void brw_wm_lookup_iz(struct intel_context *intel,
+                     struct brw_wm_compile *c);
 
-GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp);
-void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c);
 GLboolean brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c);
 
 /* brw_wm_emit.c */
@@ -381,7 +380,6 @@ void emit_fb_write(struct brw_wm_compile *c,
 void emit_frontfacing(struct brw_compile *p,
                      const struct brw_reg *dst,
                      GLuint mask);
-void emit_kil_nv(struct brw_wm_compile *c);
 void emit_linterp(struct brw_compile *p,
                  const struct brw_reg *dst,
                  GLuint mask,
@@ -476,5 +474,6 @@ struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint typ
 struct gl_shader_program *brw_new_shader_program(struct gl_context *ctx, GLuint name);
 
 bool brw_color_buffer_write_enabled(struct brw_context *brw);
+bool brw_render_target_supported(gl_format format);
 
 #endif
index 96fecc97ee2bf1c03eae446d3b169336db7e3be8..2336e27c1ef21e8d577f8c6f4c8cf132a8c5e046 100644 (file)
@@ -219,43 +219,45 @@ void emit_wpos_xy(struct brw_wm_compile *c,
                  const struct brw_reg *arg0)
 {
    struct brw_compile *p = &c->func;
+   struct intel_context *intel = &p->brw->intel;
+   struct brw_reg delta_x = retype(arg0[0], BRW_REGISTER_TYPE_W);
+   struct brw_reg delta_y = retype(arg0[1], BRW_REGISTER_TYPE_W);
 
    if (mask & WRITEMASK_X) {
+      if (intel->gen >= 6) {
+        struct brw_reg delta_x_f = retype(delta_x, BRW_REGISTER_TYPE_F);
+        brw_MOV(p, delta_x_f, delta_x);
+        delta_x = delta_x_f;
+      }
+
       if (c->fp->program.PixelCenterInteger) {
         /* X' = X */
-        brw_MOV(p,
-                dst[0],
-                retype(arg0[0], BRW_REGISTER_TYPE_W));
+        brw_MOV(p, dst[0], delta_x);
       } else {
         /* X' = X + 0.5 */
-        brw_ADD(p,
-                dst[0],
-                retype(arg0[0], BRW_REGISTER_TYPE_W),
-                brw_imm_f(0.5));
+        brw_ADD(p, dst[0], delta_x, brw_imm_f(0.5));
       }
    }
 
    if (mask & WRITEMASK_Y) {
+      if (intel->gen >= 6) {
+        struct brw_reg delta_y_f = retype(delta_y, BRW_REGISTER_TYPE_F);
+        brw_MOV(p, delta_y_f, delta_y);
+        delta_y = delta_y_f;
+      }
+
       if (c->fp->program.OriginUpperLeft) {
         if (c->fp->program.PixelCenterInteger) {
            /* Y' = Y */
-           brw_MOV(p,
-                   dst[1],
-                   retype(arg0[1], BRW_REGISTER_TYPE_W));
+           brw_MOV(p, dst[1], delta_y);
         } else {
-           /* Y' = Y + 0.5 */
-           brw_ADD(p,
-                   dst[1],
-                   retype(arg0[1], BRW_REGISTER_TYPE_W),
-                   brw_imm_f(0.5));
+           brw_ADD(p, dst[1], delta_y, 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_ADD(p, dst[1], negate(delta_y),
                 brw_imm_f(c->key.drawable_height - 1 + center_offset));
       }
    }
@@ -896,10 +898,14 @@ void emit_math1(struct brw_wm_compile *c,
                      BRW_MATH_SATURATE_NONE);
    struct brw_reg src;
 
-   if (intel->gen >= 6 && (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0 ||
-                          arg0[0].file != BRW_GENERAL_REGISTER_FILE)) {
+   if (intel->gen >= 6 && ((arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0 ||
+                           arg0[0].file != BRW_GENERAL_REGISTER_FILE) ||
+                          arg0[0].negate || arg0[0].abs)) {
       /* Gen6 math requires that source and dst horizontal stride be 1,
        * and that the argument be in the GRF.
+       *
+       * The hardware ignores source modifiers (negate and abs) on math
+       * instructions, so we also move to a temp to set those up.
        */
       src = dst[dst_chan];
       brw_MOV(p, src, arg0[0]);
@@ -967,34 +973,23 @@ void emit_math2(struct brw_wm_compile *c,
       struct brw_reg temp_dst = dst[dst_chan];
 
       if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0) {
-        if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) {
-           /* Both scalar arguments.  Do scalar calc. */
-           src0.hstride = BRW_HORIZONTAL_STRIDE_1;
-           src1.hstride = BRW_HORIZONTAL_STRIDE_1;
-           temp_dst.hstride = BRW_HORIZONTAL_STRIDE_1;
-           temp_dst.width = BRW_WIDTH_1;
-
-           if (arg0[0].subnr != 0) {
-              brw_MOV(p, temp_dst, src0);
-              src0 = temp_dst;
-
-              /* Ouch.  We've used the temp as a dst, and we still
-               * need a temp to store arg1 in, because src and dst
-               * offsets have to be equal.  Leaving this up to
-               * glsl2-965 to handle correctly.
-               */
-              assert(arg1[0].subnr == 0);
-           } else if (arg1[0].subnr != 0) {
-              brw_MOV(p, temp_dst, src1);
-              src1 = temp_dst;
-           }
-        } else {
-           brw_MOV(p, temp_dst, src0);
-           src0 = temp_dst;
-        }
-      } else if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) {
-        brw_MOV(p, temp_dst, src1);
-        src1 = temp_dst;
+        brw_MOV(p, temp_dst, src0);
+        src0 = temp_dst;
+      }
+
+      if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) {
+        /* This is a heinous hack to get a temporary register for use
+         * in case both arg0 and arg1 are constants.  Why you're
+         * doing exponentiation on constant values in the shader, we
+         * don't know.
+         *
+         * max_wm_grf is almost surely less than the maximum GRF, and
+         * gen6 doesn't care about the number of GRFs used in a
+         * shader like pre-gen6 did.
+         */
+        struct brw_reg temp = brw_vec8_grf(c->max_wm_grf, 0);
+        brw_MOV(p, temp, src1);
+        src1 = temp;
       }
 
       brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
@@ -1012,14 +1007,6 @@ void emit_math2(struct brw_wm_compile *c,
                   sechalf(src0),
                   sechalf(src1));
       }
-
-      /* Splat a scalar result into all the channels. */
-      if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0 &&
-         arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) {
-        temp_dst.hstride = BRW_HORIZONTAL_STRIDE_0;
-        temp_dst.vstride = BRW_VERTICAL_STRIDE_0;
-        brw_MOV(p, dst[dst_chan], temp_dst);
-      }
    } else {
       GLuint saturate = ((mask & SATURATE) ?
                         BRW_MATH_SATURATE_SATURATE :
@@ -1301,9 +1288,15 @@ static void emit_kil( struct brw_wm_compile *c,
                      struct brw_reg *arg0)
 {
    struct brw_compile *p = &c->func;
-   struct brw_reg r0uw = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
+   struct intel_context *intel = &p->brw->intel;
+   struct brw_reg pixelmask;
    GLuint i, j;
 
+   if (intel->gen >= 6)
+      pixelmask = retype(brw_vec1_grf(1, 7), BRW_REGISTER_TYPE_UW);
+   else
+      pixelmask = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
+
    for (i = 0; i < 4; i++) {
       /* Check if we've already done the comparison for this reg
        * -- common when someone does KIL TEMP.wwww.
@@ -1319,26 +1312,11 @@ static void emit_kil( struct brw_wm_compile *c,
       brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0[i], brw_imm_f(0));   
       brw_set_predicate_control_flag_value(p, 0xff);
       brw_set_compression_control(p, BRW_COMPRESSION_NONE);
-      brw_AND(p, r0uw, brw_flag_reg(), r0uw);
+      brw_AND(p, pixelmask, brw_flag_reg(), pixelmask);
       brw_pop_insn_state(p);
    }
 }
 
-/* KIL_NV kills the pixels that are currently executing, not based on a test
- * of the arguments.
- */
-void emit_kil_nv( struct brw_wm_compile *c )
-{
-   struct brw_compile *p = &c->func;
-   struct brw_reg r0uw = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
-
-   brw_push_insn_state(p);
-   brw_set_mask_control(p, BRW_MASK_DISABLE);
-   brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */
-   brw_AND(p, r0uw, c->emit_mask_reg, r0uw);
-   brw_pop_insn_state(p);
-}
-
 static void fire_fb_write( struct brw_wm_compile *c,
                           GLuint base_reg,
                           GLuint nr,
@@ -1355,9 +1333,11 @@ static void fire_fb_write( struct brw_wm_compile *c,
       dst = retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW);
 
    /* Pass through control information:
+    * 
+    * Gen6 has done m1 mov in emit_fb_write() for current SIMD16 case.
     */
 /*  mov (8) m1.0<1>:ud   r1.0<8;8,1>:ud   { Align1 NoMask } */
-   if (intel->gen < 6) /* gen6, use headerless for fb write */
+   if (intel->gen < 6)
    {
       brw_push_insn_state(p);
       brw_set_mask_control(p, BRW_MASK_DISABLE); /* ? */
@@ -1378,7 +1358,8 @@ static void fire_fb_write( struct brw_wm_compile *c,
                target,         
                nr,
                0, 
-               eot);
+               eot,
+               GL_TRUE);
 }
 
 
@@ -1387,8 +1368,8 @@ static void emit_aa( struct brw_wm_compile *c,
                     GLuint reg )
 {
    struct brw_compile *p = &c->func;
-   GLuint comp = c->key.aa_dest_stencil_reg / 2;
-   GLuint off = c->key.aa_dest_stencil_reg % 2;
+   GLuint comp = c->aa_dest_stencil_reg / 2;
+   GLuint off = c->aa_dest_stencil_reg % 2;
    struct brw_reg aa = offset(arg1[comp], off);
 
    brw_push_insn_state(p);
@@ -1416,11 +1397,10 @@ void emit_fb_write(struct brw_wm_compile *c,
    struct intel_context *intel = &brw->intel;
    GLuint nr = 2;
    GLuint channel;
-   int base_reg; /* For gen6 fb write with no header, starting from color payload directly!. */
 
    /* Reserve a space for AA - may not be needed:
     */
-   if (c->key.aa_dest_stencil_reg)
+   if (c->aa_dest_stencil_reg)
       nr += 1;
 
    /* I don't really understand how this achieves the color interleave
@@ -1428,11 +1408,6 @@ void emit_fb_write(struct brw_wm_compile *c,
     */
    brw_push_insn_state(p);
 
-   if (intel->gen >= 6)
-       base_reg = nr;
-   else
-       base_reg = 0;
-
    for (channel = 0; channel < 4; channel++) {
       if (intel->gen >= 6) {
         /* gen6 SIMD16 single source DP write looks like:
@@ -1493,9 +1468,9 @@ void emit_fb_write(struct brw_wm_compile *c,
 
    brw_pop_insn_state(p);
 
-   if (c->key.source_depth_to_render_target)
+   if (c->source_depth_to_render_target)
    {
-      if (c->key.computes_depth) 
+      if (c->computes_depth)
         brw_MOV(p, brw_message_reg(nr), arg2[2]);
       else 
         brw_MOV(p, brw_message_reg(nr), arg1[1]); /* ? */
@@ -1503,10 +1478,10 @@ void emit_fb_write(struct brw_wm_compile *c,
       nr += 2;
    }
 
-   if (c->key.dest_depth_reg)
+   if (c->dest_depth_reg)
    {
-      GLuint comp = c->key.dest_depth_reg / 2;
-      GLuint off = c->key.dest_depth_reg % 2;
+      GLuint comp = c->dest_depth_reg / 2;
+      GLuint off = c->dest_depth_reg % 2;
 
       if (off != 0) {
          brw_push_insn_state(p);
@@ -1524,15 +1499,28 @@ void emit_fb_write(struct brw_wm_compile *c,
    }
 
    if (intel->gen >= 6) {
-      /* Subtract off the message header, since we send headerless. */
-      nr -= 2;
+      /* Load the message header.  There's no implied move from src0
+       * to the base mrf on gen6.
+       */
+      brw_push_insn_state(p);
+      brw_set_mask_control(p, BRW_MASK_DISABLE);
+      brw_MOV(p, retype(brw_message_reg(0), BRW_REGISTER_TYPE_UD),
+             retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD));
+      brw_pop_insn_state(p);
+
+      if (target != 0) {
+        brw_MOV(p, retype(brw_vec1_reg(BRW_MESSAGE_REGISTER_FILE,
+                                       0,
+                                       2), BRW_REGISTER_TYPE_UD),
+                brw_imm_ud(target));
+      }
    }
 
-   if (!c->key.runtime_check_aads_emit) {
-      if (c->key.aa_dest_stencil_reg)
+   if (!c->runtime_check_aads_emit) {
+      if (c->aa_dest_stencil_reg)
         emit_aa(c, arg1, 2);
 
-      fire_fb_write(c, base_reg, nr, target, eot);
+      fire_fb_write(c, 0, nr, target, eot);
    }
    else {
       struct brw_reg v1_null_ud = vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
@@ -1897,10 +1885,6 @@ void brw_wm_emit( struct brw_wm_compile *c )
         emit_kil(c, args[0]);
         break;
 
-      case OPCODE_KIL_NV:
-        emit_kil_nv(c);
-        break;
-
       default:
         printf("Unsupported opcode %i (%s) in fragment shader\n",
                inst->opcode, inst->opcode < MAX_OPCODE ?
index 2cae6988804efaf29b078afed4953d342d0ca69e..4759b289a0c87496cadda4b41da83fc0328c6edd 100644 (file)
@@ -338,11 +338,13 @@ static struct prog_src_register get_delta_xy( struct brw_wm_compile *c )
 
 static struct prog_src_register get_pixel_w( struct brw_wm_compile *c )
 {
-   /* This is only called for producing 1/w in pre-gen6 interp.  for
-    * gen6, the interp opcodes don't use this argument.
+   /* This is called for producing 1/w in pre-gen6 interp.  for gen6,
+    * the interp opcodes don't use this argument.  But to keep the
+    * nr_args = 3 expectations of pinterp happy, just stuff delta_xy
+    * into the slot.
     */
    if (c->func.brw->intel.gen >= 6)
-      return src_undef();
+      return c->delta_xy;
 
    if (src_is_undef(c->pixel_w)) {
       struct prog_dst_register pixel_w = get_temp(c);
@@ -373,11 +375,7 @@ static void emit_interp( struct brw_wm_compile *c,
    struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx);
    struct prog_src_register deltas;
 
-   if (c->func.brw->intel.gen < 6) {
-      deltas = get_delta_xy(c);
-   } else {
-      deltas = src_undef();
-   }
+   deltas = get_delta_xy(c);
 
    /* Need to use PINTERP on attributes which have been
     * multiplied by 1/W in the SF program, and LINTERP on those
@@ -1133,6 +1131,11 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
         precalc_lit(c, inst);
         break;
 
+      case OPCODE_RSQ:
+        out = emit_scalar_insn(c, inst);
+        out->SrcReg[0].Abs = GL_TRUE;
+        break;
+
       case OPCODE_TEX:
         precalc_tex(c, inst);
         break;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
deleted file mode 100644 (file)
index 7fe8ab1..0000000
+++ /dev/null
@@ -1,1035 +0,0 @@
-#include "main/macros.h"
-#include "program/prog_parameter.h"
-#include "program/prog_print.h"
-#include "program/prog_optimize.h"
-#include "brw_context.h"
-#include "brw_eu.h"
-#include "brw_wm.h"
-
-static struct brw_reg get_dst_reg(struct brw_wm_compile *c,
-                                  const struct prog_instruction *inst,
-                                  GLuint component);
-
-/**
- * Determine if the given fragment program uses GLSL features such
- * as flow conditionals, loops, subroutines.
- * Some GLSL shaders may use these features, others might not.
- */
-GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp)
-{
-    int i;
-
-    if (unlikely(INTEL_DEBUG & DEBUG_GLSL_FORCE))
-       return GL_TRUE;
-
-    for (i = 0; i < fp->Base.NumInstructions; i++) {
-       const struct prog_instruction *inst = &fp->Base.Instructions[i];
-       switch (inst->Opcode) {
-           case OPCODE_ARL:
-           case OPCODE_IF:
-           case OPCODE_ENDIF:
-           case OPCODE_CAL:
-           case OPCODE_BRK:
-           case OPCODE_RET:
-           case OPCODE_BGNLOOP:
-               return GL_TRUE; 
-           default:
-               break;
-       }
-    }
-    return GL_FALSE; 
-}
-
-
-
-static void
-reclaim_temps(struct brw_wm_compile *c);
-
-
-/** Mark GRF register as used. */
-static void
-prealloc_grf(struct brw_wm_compile *c, int r)
-{
-   c->used_grf[r] = GL_TRUE;
-}
-
-
-/** Mark given GRF register as not in use. */
-static void
-release_grf(struct brw_wm_compile *c, int r)
-{
-   /*assert(c->used_grf[r]);*/
-   c->used_grf[r] = GL_FALSE;
-   c->first_free_grf = MIN2(c->first_free_grf, r);
-}
-
-
-/** Return index of a free GRF, mark it as used. */
-static int
-alloc_grf(struct brw_wm_compile *c)
-{
-   GLuint r;
-   for (r = c->first_free_grf; r < BRW_WM_MAX_GRF; r++) {
-      if (!c->used_grf[r]) {
-         c->used_grf[r] = GL_TRUE;
-         c->first_free_grf = r + 1;  /* a guess */
-         return r;
-      }
-   }
-
-   /* no free temps, try to reclaim some */
-   reclaim_temps(c);
-   c->first_free_grf = 0;
-
-   /* try alloc again */
-   for (r = c->first_free_grf; r < BRW_WM_MAX_GRF; r++) {
-      if (!c->used_grf[r]) {
-         c->used_grf[r] = GL_TRUE;
-         c->first_free_grf = r + 1;  /* a guess */
-         return r;
-      }
-   }
-
-   for (r = 0; r < BRW_WM_MAX_GRF; r++) {
-      assert(c->used_grf[r]);
-   }
-
-   /* really, no free GRF regs found */
-   if (!c->out_of_regs) {
-      /* print warning once per compilation */
-      _mesa_warning(NULL, "i965: ran out of registers for fragment program");
-      c->out_of_regs = GL_TRUE;
-   }
-
-   return -1;
-}
-
-
-/** Return number of GRF registers used */
-static int
-num_grf_used(const struct brw_wm_compile *c)
-{
-   int r;
-   for (r = BRW_WM_MAX_GRF - 1; r >= 0; r--)
-      if (c->used_grf[r])
-         return r + 1;
-   return 0;
-}
-
-
-
-/**
- * Record the mapping of a Mesa register to a hardware register.
- */
-static void set_reg(struct brw_wm_compile *c, int file, int index, 
-       int component, struct brw_reg reg)
-{
-    c->wm_regs[file][index][component].reg = reg;
-    c->wm_regs[file][index][component].inited = GL_TRUE;
-}
-
-static struct brw_reg alloc_tmp(struct brw_wm_compile *c)
-{
-    struct brw_reg reg;
-
-    /* if we need to allocate another temp, grow the tmp_regs[] array */
-    if (c->tmp_index == c->tmp_max) {
-       int r = alloc_grf(c);
-       if (r < 0) {
-          /*printf("Out of temps in %s\n", __FUNCTION__);*/
-          r = 50; /* XXX random register! */
-       }
-       c->tmp_regs[ c->tmp_max++ ] = r;
-    }
-
-    /* form the GRF register */
-    reg = brw_vec8_grf(c->tmp_regs[ c->tmp_index++ ], 0);
-    /*printf("alloc_temp %d\n", reg.nr);*/
-    assert(reg.nr < BRW_WM_MAX_GRF);
-    return reg;
-
-}
-
-/**
- * Save current temp register info.
- * There must be a matching call to release_tmps().
- */
-static int mark_tmps(struct brw_wm_compile *c)
-{
-    return c->tmp_index;
-}
-
-static void release_tmps(struct brw_wm_compile *c, int mark)
-{
-    c->tmp_index = mark;
-}
-
-/**
- * Convert Mesa src register to brw register.
- *
- * Since we're running in SOA mode each Mesa register corresponds to four
- * hardware registers.  We allocate the hardware registers as needed here.
- *
- * \param file  register file, one of PROGRAM_x
- * \param index  register number
- * \param component  src component (X=0, Y=1, Z=2, W=3)
- * \param nr  not used?!?
- * \param neg  negate value?
- * \param abs  take absolute value?
- */
-static struct brw_reg 
-get_reg(struct brw_wm_compile *c, int file, int index, int component,
-        int nr, GLuint neg, GLuint abs)
-{
-    struct brw_reg reg;
-    switch (file) {
-       case PROGRAM_STATE_VAR:
-       case PROGRAM_CONSTANT:
-       case PROGRAM_UNIFORM:
-           file = PROGRAM_STATE_VAR;
-           break;
-       case PROGRAM_UNDEFINED:
-           return brw_null_reg();      
-       case PROGRAM_TEMPORARY:
-       case PROGRAM_INPUT:
-       case PROGRAM_OUTPUT:
-       case PROGRAM_PAYLOAD:
-           break;
-       default:
-           _mesa_problem(NULL, "Unexpected file in get_reg()");
-           return brw_null_reg();
-    }
-
-    assert(index < 256);
-    assert(component < 4);
-
-    /* see if we've already allocated a HW register for this Mesa register */
-    if (c->wm_regs[file][index][component].inited) {
-       /* yes, re-use */
-       reg = c->wm_regs[file][index][component].reg;
-    }
-    else {
-       /* no, allocate new register */
-       int grf = alloc_grf(c);
-       /*printf("alloc grf %d for reg %d:%d.%d\n", grf, file, index, component);*/
-       if (grf < 0) {
-          /* totally out of temps */
-          grf = 51; /* XXX random register! */
-       }
-
-       reg = brw_vec8_grf(grf, 0);
-       /*printf("Alloc new grf %d for %d.%d\n", reg.nr, index, component);*/
-
-       set_reg(c, file, index, component, reg);
-    }
-
-    if (neg & (1 << component)) {
-       reg = negate(reg);
-    }
-    if (abs)
-       reg = brw_abs(reg);
-    return reg;
-}
-
-
-
-/**
- * This is called if we run out of GRF registers.  Examine the live intervals
- * of temp regs in the program and free those which won't be used again.
- */
-static void
-reclaim_temps(struct brw_wm_compile *c)
-{
-   GLint intBegin[MAX_PROGRAM_TEMPS];
-   GLint intEnd[MAX_PROGRAM_TEMPS];
-   int index;
-
-   /*printf("Reclaim temps:\n");*/
-
-   _mesa_find_temp_intervals(c->prog_instructions, c->nr_fp_insns,
-                             intBegin, intEnd);
-
-   for (index = 0; index < MAX_PROGRAM_TEMPS; index++) {
-      if (intEnd[index] != -1 && intEnd[index] < c->cur_inst) {
-         /* program temp[i] can be freed */
-         int component;
-         /*printf("  temp[%d] is dead\n", index);*/
-         for (component = 0; component < 4; component++) {
-            if (c->wm_regs[PROGRAM_TEMPORARY][index][component].inited) {
-               int r = c->wm_regs[PROGRAM_TEMPORARY][index][component].reg.nr;
-               release_grf(c, r);
-               /*
-               printf("  Reclaim temp %d, reg %d at inst %d\n",
-                      index, r, c->cur_inst);
-               */
-               c->wm_regs[PROGRAM_TEMPORARY][index][component].inited = GL_FALSE;
-            }
-         }
-      }
-   }
-}
-
-
-
-
-/**
- * Preallocate registers.  This sets up the Mesa to hardware register
- * mapping for certain registers, such as constants (uniforms/state vars)
- * and shader inputs.
- */
-static void prealloc_reg(struct brw_wm_compile *c)
-{
-    struct intel_context *intel = &c->func.brw->intel;
-    int i, j;
-    struct brw_reg reg;
-    int urb_read_length = 0;
-    GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted;
-    GLuint reg_index = 0;
-
-    memset(c->used_grf, GL_FALSE, sizeof(c->used_grf));
-    c->first_free_grf = 0;
-
-    for (i = 0; i < 4; i++) {
-       if (i < (c->key.nr_payload_regs + 1) / 2)
-            reg = brw_vec8_grf(i * 2, 0);
-        else
-            reg = brw_vec8_grf(0, 0);
-       set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg);
-    }
-    set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_W, 0,
-           brw_vec8_grf(c->key.source_w_reg, 0));
-    reg_index += c->key.nr_payload_regs;
-
-    /* constants */
-    {
-        const GLuint nr_params = c->fp->program.Base.Parameters->NumParameters;
-        const GLuint nr_temps = c->fp->program.Base.NumTemporaries;
-
-        /* use a real constant buffer, or just use a section of the GRF? */
-        /* XXX this heuristic may need adjustment... */
-        if ((nr_params + nr_temps) * 4 + reg_index > 80) {
-          for (i = 0; i < nr_params; i++) {
-             float *pv = c->fp->program.Base.Parameters->ParameterValues[i];
-             for (j = 0; j < 4; j++) {
-                c->prog_data.pull_param[c->prog_data.nr_pull_params] = &pv[j];
-                c->prog_data.nr_pull_params++;
-             }
-          }
-
-          c->prog_data.nr_params = 0;
-       }
-        /*printf("WM use_const_buffer = %d\n", c->fp->use_const_buffer);*/
-
-        if (!c->prog_data.nr_pull_params) {
-           const struct gl_program_parameter_list *plist = 
-              c->fp->program.Base.Parameters;
-           int index = 0;
-
-           /* number of float constants in CURBE */
-           c->prog_data.nr_params = 4 * nr_params;
-
-           /* loop over program constants (float[4]) */
-           for (i = 0; i < nr_params; i++) {
-              /* loop over XYZW channels */
-              for (j = 0; j < 4; j++, index++) {
-                 reg = brw_vec1_grf(reg_index + index / 8, index % 8);
-                 /* Save pointer to parameter/constant value.
-                  * Constants will be copied in prepare_constant_buffer()
-                  */
-                 c->prog_data.param[index] = &plist->ParameterValues[i][j];
-                 set_reg(c, PROGRAM_STATE_VAR, i, j, reg);
-              }
-           }
-           /* number of constant regs used (each reg is float[8]) */
-          c->nr_creg = ALIGN(nr_params, 2) / 2;
-          reg_index += c->nr_creg;
-        }
-    }
-
-    /* fragment shader inputs: One 2-reg pair of interpolation
-     * coefficients for each vec4 to be set up.
-     */
-    if (intel->gen >= 6) {
-       for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
-         if (!(c->fp->program.Base.InputsRead & BITFIELD64_BIT(i)))
-            continue;
-
-         reg = brw_vec8_grf(reg_index, 0);
-         for (j = 0; j < 4; j++) {
-            set_reg(c, PROGRAM_PAYLOAD, i, j, reg);
-         }
-         reg_index += 2;
-       }
-       urb_read_length = reg_index;
-    } else {
-       for (i = 0; i < VERT_RESULT_MAX; i++) {
-         int fp_input;
-
-         if (i >= VERT_RESULT_VAR0)
-            fp_input = i - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0;
-         else if (i <= VERT_RESULT_TEX7)
-            fp_input = i;
-         else
-            fp_input = -1;
-
-         if (fp_input >= 0 && inputs & (1 << fp_input)) {
-            urb_read_length = reg_index;
-            reg = brw_vec8_grf(reg_index, 0);
-            for (j = 0; j < 4; j++)
-               set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg);
-         }
-         if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) {
-            reg_index += 2;
-         }
-       }
-    }
-
-    c->prog_data.first_curbe_grf = c->key.nr_payload_regs;
-    c->prog_data.urb_read_length = urb_read_length;
-    c->prog_data.curb_read_length = c->nr_creg;
-    c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0);
-    reg_index++;
-    c->stack =  brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0);
-    reg_index += 2;
-
-    /* mark GRF regs [0..reg_index-1] as in-use */
-    for (i = 0; i < reg_index; i++)
-       prealloc_grf(c, i);
-
-    /* Don't use GRF 126, 127.  Using them seems to lead to GPU lock-ups */
-    prealloc_grf(c, 126);
-    prealloc_grf(c, 127);
-
-    for (i = 0; i < c->nr_fp_insns; i++) {
-       const struct prog_instruction *inst = &c->prog_instructions[i];
-       struct brw_reg dst[4];
-
-       switch (inst->Opcode) {
-       case OPCODE_TEX:
-       case OPCODE_TXB:
-           /* Allocate the channels of texture results contiguously,
-            * since they are written out that way by the sampler unit.
-            */
-           for (j = 0; j < 4; j++) {
-               dst[j] = get_dst_reg(c, inst, j);
-               if (j != 0)
-                   assert(dst[j].nr == dst[j - 1].nr + 1);
-           }
-           break;
-       default:
-           break;
-       }
-    }
-
-    for (i = 0; i < c->nr_fp_insns; i++) {
-       const struct prog_instruction *inst = &c->prog_instructions[i];
-
-       switch (inst->Opcode) {
-       case WM_DELTAXY:
-           /* Allocate WM_DELTAXY destination on G45/GM45 to an
-            * even-numbered GRF if possible so that we can use the PLN
-            * instruction.
-            */
-           if (inst->DstReg.WriteMask == WRITEMASK_XY &&
-               !c->wm_regs[inst->DstReg.File][inst->DstReg.Index][0].inited &&
-               !c->wm_regs[inst->DstReg.File][inst->DstReg.Index][1].inited &&
-               (IS_G4X(intel->intelScreen->deviceID) || intel->gen == 5)) {
-               int grf;
-
-               for (grf = c->first_free_grf & ~1;
-                    grf < BRW_WM_MAX_GRF;
-                    grf += 2)
-               {
-                   if (!c->used_grf[grf] && !c->used_grf[grf + 1]) {
-                       c->used_grf[grf] = GL_TRUE;
-                       c->used_grf[grf + 1] = GL_TRUE;
-                       c->first_free_grf = grf + 2;  /* a guess */
-
-                       set_reg(c, inst->DstReg.File, inst->DstReg.Index, 0,
-                               brw_vec8_grf(grf, 0));
-                       set_reg(c, inst->DstReg.File, inst->DstReg.Index, 1,
-                               brw_vec8_grf(grf + 1, 0));
-                       break;
-                   }
-               }
-           }
-       default:
-           break;
-       }
-    }
-
-    /* An instruction may reference up to three constants.
-     * They'll be found in these registers.
-     * XXX alloc these on demand!
-     */
-    if (c->prog_data.nr_pull_params) {
-       for (i = 0; i < 3; i++) {
-          c->current_const[i].index = -1;
-          c->current_const[i].reg = brw_vec8_grf(alloc_grf(c), 0);
-       }
-    }
-#if 0
-    printf("USE CONST BUFFER? %d\n", c->fp->use_const_buffer);
-    printf("AFTER PRE_ALLOC, reg_index = %d\n", reg_index);
-#endif
-}
-
-
-/**
- * Check if any of the instruction's src registers are constants, uniforms,
- * or statevars.  If so, fetch any constants that we don't already have in
- * the three GRF slots.
- */
-static void fetch_constants(struct brw_wm_compile *c,
-                            const struct prog_instruction *inst)
-{
-   struct brw_compile *p = &c->func;
-   GLuint i;
-
-   /* loop over instruction src regs */
-   for (i = 0; i < 3; i++) {
-      const struct prog_src_register *src = &inst->SrcReg[i];
-      if (src->File == PROGRAM_STATE_VAR ||
-          src->File == PROGRAM_CONSTANT ||
-          src->File == PROGRAM_UNIFORM) {
-        c->current_const[i].index = src->Index;
-
-#if 0
-        printf("  fetch const[%d] for arg %d into reg %d\n",
-               src->Index, i, c->current_const[i].reg.nr);
-#endif
-
-        /* need to fetch the constant now */
-        brw_oword_block_read(p,
-                             c->current_const[i].reg,
-                             brw_message_reg(1),
-                             16 * src->Index,
-                             SURF_INDEX_FRAG_CONST_BUFFER);
-      }
-   }
-}
-
-
-/**
- * Convert Mesa dst register to brw register.
- */
-static struct brw_reg get_dst_reg(struct brw_wm_compile *c, 
-                                  const struct prog_instruction *inst,
-                                  GLuint component)
-{
-    const int nr = 1;
-    return get_reg(c, inst->DstReg.File, inst->DstReg.Index, component, nr,
-           0, 0);
-}
-
-
-static struct brw_reg
-get_src_reg_const(struct brw_wm_compile *c,
-                  const struct prog_instruction *inst,
-                  GLuint srcRegIndex, GLuint component)
-{
-   /* We should have already fetched the constant from the constant
-    * buffer in fetch_constants().  Now we just have to return a
-    * register description that extracts the needed component and
-    * smears it across all eight vector components.
-    */
-   const struct prog_src_register *src = &inst->SrcReg[srcRegIndex];
-   struct brw_reg const_reg;
-
-   assert(component < 4);
-   assert(srcRegIndex < 3);
-   assert(c->current_const[srcRegIndex].index != -1);
-   const_reg = c->current_const[srcRegIndex].reg;
-
-   /* extract desired float from the const_reg, and smear */
-   const_reg = stride(const_reg, 0, 1, 0);
-   const_reg.subnr = component * 4;
-
-   if (src->Negate & (1 << component))
-      const_reg = negate(const_reg);
-   if (src->Abs)
-      const_reg = brw_abs(const_reg);
-
-#if 0
-   printf("  form const[%d].%d for arg %d, reg %d\n",
-          c->current_const[srcRegIndex].index,
-          component,
-          srcRegIndex,
-          const_reg.nr);
-#endif
-
-   return const_reg;
-}
-
-
-/**
- * Convert Mesa src register to brw register.
- */
-static struct brw_reg get_src_reg(struct brw_wm_compile *c, 
-                                  const struct prog_instruction *inst,
-                                  GLuint srcRegIndex, GLuint channel)
-{
-    const struct prog_src_register *src = &inst->SrcReg[srcRegIndex];
-    const GLuint nr = 1;
-    const GLuint component = GET_SWZ(src->Swizzle, channel);
-
-    /* Only one immediate value can be used per native opcode, and it
-     * has be in the src1 slot, so not all Mesa instructions will get
-     * to take advantage of immediate constants.
-     */
-    if (brw_wm_arg_can_be_immediate(inst->Opcode, srcRegIndex)) {
-       const struct gl_program_parameter_list *params;
-
-       params = c->fp->program.Base.Parameters;
-
-       /* Extended swizzle terms */
-       if (component == SWIZZLE_ZERO) {
-         return brw_imm_f(0.0F);
-       } else if (component == SWIZZLE_ONE) {
-         if (src->Negate)
-            return brw_imm_f(-1.0F);
-         else
-            return brw_imm_f(1.0F);
-       }
-
-       if (src->File == PROGRAM_CONSTANT) {
-         float f = params->ParameterValues[src->Index][component];
-
-         if (src->Abs)
-            f = fabs(f);
-         if (src->Negate)
-            f = -f;
-
-         return brw_imm_f(f);
-       }
-    }
-
-    if (c->prog_data.nr_pull_params &&
-        (src->File == PROGRAM_STATE_VAR ||
-         src->File == PROGRAM_CONSTANT ||
-         src->File == PROGRAM_UNIFORM)) {
-       return get_src_reg_const(c, inst, srcRegIndex, component);
-    }
-    else {
-       /* other type of source register */
-       return get_reg(c, src->File, src->Index, component, nr, 
-                      src->Negate, src->Abs);
-    }
-}
-
-static void emit_arl(struct brw_wm_compile *c,
-                     const struct prog_instruction *inst)
-{
-    struct brw_compile *p = &c->func;
-    struct brw_reg src0, addr_reg;
-    brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
-    addr_reg = brw_uw8_reg(BRW_ARCHITECTURE_REGISTER_FILE, 
-                           BRW_ARF_ADDRESS, 0);
-    src0 = get_src_reg(c, inst, 0, 0); /* channel 0 */
-    brw_MOV(p, addr_reg, src0);
-    brw_set_saturate(p, 0);
-}
-
-static INLINE struct brw_reg high_words( struct brw_reg reg )
-{
-    return stride( suboffset( retype( reg, BRW_REGISTER_TYPE_W ), 1 ),
-                  0, 8, 2 );
-}
-
-static INLINE struct brw_reg low_words( struct brw_reg reg )
-{
-    return stride( retype( reg, BRW_REGISTER_TYPE_W ), 0, 8, 2 );
-}
-
-static INLINE struct brw_reg even_bytes( struct brw_reg reg )
-{
-    return stride( retype( reg, BRW_REGISTER_TYPE_B ), 0, 16, 2 );
-}
-
-static INLINE struct brw_reg odd_bytes( struct brw_reg reg )
-{
-    return stride( suboffset( retype( reg, BRW_REGISTER_TYPE_B ), 1 ),
-                  0, 16, 2 );
-}
-
-/**
- * Resolve subroutine calls after code emit is done.
- */
-static void post_wm_emit( struct brw_wm_compile *c )
-{
-    brw_resolve_cals(&c->func);
-}
-
-static void
-get_argument_regs(struct brw_wm_compile *c,
-                 const struct prog_instruction *inst,
-                 int index,
-                 struct brw_reg *dst,
-                 struct brw_reg *regs,
-                 int mask)
-{
-    struct brw_compile *p = &c->func;
-    int i, j;
-
-    for (i = 0; i < 4; i++) {
-       if (mask & (1 << i)) {
-           regs[i] = get_src_reg(c, inst, index, i);
-
-           /* Unalias destination registers from our sources. */
-           if (regs[i].file == BRW_GENERAL_REGISTER_FILE) {
-              for (j = 0; j < 4; j++) {
-                  if (memcmp(&regs[i], &dst[j], sizeof(regs[0])) == 0) {
-                      struct brw_reg tmp = alloc_tmp(c);
-                      brw_MOV(p, tmp, regs[i]);
-                      regs[i] = tmp;
-                      break;
-                  }
-              }
-           }
-       }
-    }
-}
-
-static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
-{
-   struct intel_context *intel = &brw->intel;
-#define MAX_IF_DEPTH 32
-#define MAX_LOOP_DEPTH 32
-    struct brw_instruction *if_inst[MAX_IF_DEPTH], *loop_inst[MAX_LOOP_DEPTH];
-    int if_depth_in_loop[MAX_LOOP_DEPTH];
-    GLuint i, if_depth = 0, loop_depth = 0;
-    struct brw_compile *p = &c->func;
-    struct brw_indirect stack_index = brw_indirect(0, 0);
-
-    c->out_of_regs = GL_FALSE;
-
-    if_depth_in_loop[loop_depth] = 0;
-
-    prealloc_reg(c);
-    brw_set_compression_control(p, BRW_COMPRESSION_NONE);
-    brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack));
-
-    if (intel->gen >= 6)
-       brw_set_acc_write_control(p, 1);
-
-    for (i = 0; i < c->nr_fp_insns; i++) {
-        const struct prog_instruction *inst = &c->prog_instructions[i];
-       int dst_flags;
-       struct brw_reg args[3][4], dst[4];
-       int j;
-       int mark = mark_tmps( c );
-
-        c->cur_inst = i;
-
-#if 0
-        printf("Inst %d: ", i);
-        _mesa_print_instruction(inst);
-#endif
-
-        /* fetch any constants that this instruction needs */
-        if (c->prog_data.nr_pull_params)
-           fetch_constants(c, inst);
-
-       if (inst->Opcode != OPCODE_ARL) {
-          for (j = 0; j < 4; j++) {
-             if (inst->DstReg.WriteMask & (1 << j))
-                dst[j] = get_dst_reg(c, inst, j);
-             else
-                dst[j] = brw_null_reg();
-          }
-       }
-       for (j = 0; j < brw_wm_nr_args(inst->Opcode); j++)
-           get_argument_regs(c, inst, j, dst, args[j], WRITEMASK_XYZW);
-
-       dst_flags = inst->DstReg.WriteMask;
-       if (inst->SaturateMode == SATURATE_ZERO_ONE)
-           dst_flags |= SATURATE;
-
-       if (inst->CondUpdate)
-           brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
-       else
-           brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE);
-
-       switch (inst->Opcode) {
-           case WM_PIXELXY:
-               emit_pixel_xy(c, dst, dst_flags);
-               break;
-           case WM_DELTAXY: 
-               emit_delta_xy(p, dst, dst_flags, args[0]);
-               break;
-           case WM_PIXELW:
-               emit_pixel_w(c, dst, dst_flags, args[0], args[1]);
-               break;  
-           case WM_LINTERP:
-               emit_linterp(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case WM_PINTERP:
-               emit_pinterp(p, dst, dst_flags, args[0], args[1], args[2]);
-               break;
-           case WM_CINTERP:
-               emit_cinterp(p, dst, dst_flags, args[0]);
-               break;
-           case WM_WPOSXY:
-               emit_wpos_xy(c, dst, dst_flags, args[0]);
-               break;
-           case WM_FB_WRITE:
-               emit_fb_write(c, args[0], args[1], args[2],
-                             INST_AUX_GET_TARGET(inst->Aux),
-                             inst->Aux & INST_AUX_EOT);
-               break;
-           case WM_FRONTFACING:
-               emit_frontfacing(p, dst, dst_flags);
-               break;
-           case OPCODE_ADD:
-               emit_alu2(p, brw_ADD, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_ARL:
-               emit_arl(c, inst);
-               break;
-           case OPCODE_FRC:
-               emit_alu1(p, brw_FRC, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_FLR:
-               emit_alu1(p, brw_RNDD, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_LRP:
-               emit_lrp(p, dst, dst_flags, args[0], args[1], args[2]);
-               break;
-           case OPCODE_TRUNC:
-               emit_alu1(p, brw_RNDZ, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_MOV:
-           case OPCODE_SWZ:
-               emit_alu1(p, brw_MOV, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_DP2:
-               emit_dp2(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_DP3:
-               emit_dp3(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_DP4:
-               emit_dp4(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_XPD:
-               emit_xpd(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_DPH:
-               emit_dph(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_RCP:
-               emit_math1(c, BRW_MATH_FUNCTION_INV, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_RSQ:
-               emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_SIN:
-               emit_math1(c, BRW_MATH_FUNCTION_SIN, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_COS:
-               emit_math1(c, BRW_MATH_FUNCTION_COS, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_EX2:
-               emit_math1(c, BRW_MATH_FUNCTION_EXP, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_LG2:
-               emit_math1(c, BRW_MATH_FUNCTION_LOG, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_CMP:
-               emit_cmp(p, dst, dst_flags, args[0], args[1], args[2]);
-               break;
-           case OPCODE_MIN:    
-               emit_min(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_MAX:    
-               emit_max(p, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_DDX:
-           case OPCODE_DDY:
-               emit_ddxy(p, dst, dst_flags, (inst->Opcode == OPCODE_DDX),
-                         args[0]);
-                break;
-           case OPCODE_SLT:
-               emit_sop(p, dst, dst_flags,
-                        BRW_CONDITIONAL_L, args[0], args[1]);
-               break;
-           case OPCODE_SLE:
-               emit_sop(p, dst, dst_flags,
-                        BRW_CONDITIONAL_LE, args[0], args[1]);
-               break;
-           case OPCODE_SGT:
-               emit_sop(p, dst, dst_flags,
-                        BRW_CONDITIONAL_G, args[0], args[1]);
-               break;
-           case OPCODE_SGE:
-               emit_sop(p, dst, dst_flags,
-                        BRW_CONDITIONAL_GE, args[0], args[1]);
-               break;
-           case OPCODE_SEQ:
-               emit_sop(p, dst, dst_flags,
-                        BRW_CONDITIONAL_EQ, args[0], args[1]);
-               break;
-           case OPCODE_SNE:
-               emit_sop(p, dst, dst_flags,
-                        BRW_CONDITIONAL_NEQ, args[0], args[1]);
-               break;
-           case OPCODE_SSG:
-               emit_sign(p, dst, dst_flags, args[0]);
-               break;
-           case OPCODE_MUL:
-               emit_alu2(p, brw_MUL, dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_POW:
-               emit_math2(c, BRW_MATH_FUNCTION_POW,
-                          dst, dst_flags, args[0], args[1]);
-               break;
-           case OPCODE_MAD:
-               emit_mad(p, dst, dst_flags, args[0], args[1], args[2]);
-               break;
-           case OPCODE_TEX:
-               emit_tex(c, dst, dst_flags, args[0],
-                        get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH,
-                                0, 1, 0, 0),
-                        inst->TexSrcTarget,
-                        inst->TexSrcUnit,
-                        (c->key.shadowtex_mask & (1 << inst->TexSrcUnit)) != 0);
-               break;
-           case OPCODE_TXB:
-               emit_txb(c, dst, dst_flags, args[0],
-                        get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH,
-                                0, 1, 0, 0),
-                        inst->TexSrcTarget,
-                        c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]);
-               break;
-           case OPCODE_KIL_NV:
-               emit_kil_nv(c);
-               break;
-           case OPCODE_IF:
-               assert(if_depth < MAX_IF_DEPTH);
-               if_inst[if_depth++] = brw_IF(p, BRW_EXECUTE_8);
-               if_depth_in_loop[loop_depth]++;
-               break;
-           case OPCODE_ELSE:
-               assert(if_depth > 0);
-               if_inst[if_depth-1]  = brw_ELSE(p, if_inst[if_depth-1]);
-               break;
-           case OPCODE_ENDIF:
-               assert(if_depth > 0);
-               brw_ENDIF(p, if_inst[--if_depth]);
-               if_depth_in_loop[loop_depth]--;
-               break;
-           case OPCODE_BGNSUB:
-               brw_save_label(p, inst->Comment, p->nr_insn);
-               break;
-           case OPCODE_ENDSUB:
-               /* no-op */
-               break;
-           case OPCODE_CAL: 
-               brw_push_insn_state(p);
-               brw_set_mask_control(p, BRW_MASK_DISABLE);
-                brw_set_access_mode(p, BRW_ALIGN_1);
-                brw_ADD(p, deref_1ud(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16));
-                brw_set_access_mode(p, BRW_ALIGN_16);
-                brw_ADD(p, get_addr_reg(stack_index),
-                         get_addr_reg(stack_index), brw_imm_d(4));
-               brw_save_call(&c->func, inst->Comment, p->nr_insn);
-                brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
-                brw_pop_insn_state(p);
-               break;
-
-           case OPCODE_RET:
-               brw_push_insn_state(p);
-               brw_set_mask_control(p, BRW_MASK_DISABLE);
-                brw_ADD(p, get_addr_reg(stack_index),
-                        get_addr_reg(stack_index), brw_imm_d(-4));
-                brw_set_access_mode(p, BRW_ALIGN_1);
-                brw_MOV(p, brw_ip_reg(), deref_1ud(stack_index, 0));
-                brw_set_access_mode(p, BRW_ALIGN_16);
-               brw_pop_insn_state(p);
-
-               break;
-           case OPCODE_BGNLOOP:
-                /* XXX may need to invalidate the current_constant regs */
-               loop_inst[loop_depth++] = brw_DO(p, BRW_EXECUTE_8);
-               if_depth_in_loop[loop_depth] = 0;
-               break;
-           case OPCODE_BRK:
-               brw_BREAK(p, if_depth_in_loop[loop_depth]);
-               brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-               break;
-           case OPCODE_CONT:
-               brw_CONT(p, if_depth_in_loop[loop_depth]);
-               brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-               break;
-           case OPCODE_ENDLOOP: 
-               {
-                  struct brw_instruction *inst0, *inst1;
-                  GLuint br = 1;
-
-                  if (intel->gen == 5)
-                     br = 2;
-
-                 assert(loop_depth > 0);
-                  loop_depth--;
-                  inst0 = inst1 = brw_WHILE(p, loop_inst[loop_depth]);
-                  /* patch all the BREAK/CONT instructions from last BGNLOOP */
-                  while (inst0 > loop_inst[loop_depth]) {
-                     inst0--;
-                     if (inst0->header.opcode == BRW_OPCODE_BREAK &&
-                        inst0->bits3.if_else.jump_count == 0) {
-                       inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
-                     }
-                     else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
-                             inst0->bits3.if_else.jump_count == 0) {
-                        inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
-                     }
-                  }
-               }
-               break;
-           default:
-               printf("unsupported opcode %d (%s) in fragment shader\n",
-                      inst->Opcode, inst->Opcode < MAX_OPCODE ?
-                      _mesa_opcode_string(inst->Opcode) : "unknown");
-       }
-
-       /* Release temporaries containing any unaliased source regs. */
-       release_tmps( c, mark );
-
-       if (inst->CondUpdate)
-           brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
-       else
-           brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-    }
-    post_wm_emit(c);
-
-    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-      printf("wm-native:\n");
-      for (i = 0; i < p->nr_insn; i++)
-        brw_disasm(stdout, &p->store[i], intel->gen);
-      printf("\n");
-    }
-}
-
-/**
- * Do GPU code generation for shaders that use GLSL features such as
- * flow control.  Other shaders will be compiled with the 
- */
-void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c)
-{
-    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-        printf("brw_wm_glsl_emit:\n");
-    }
-
-    /* initial instruction translation/simplification */
-    brw_wm_pass_fp(c);
-
-    /* actual code generation */
-    brw_wm_emit_glsl(brw, c);
-
-    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-        brw_wm_print_program(c, "brw_wm_glsl_emit done");
-    }
-
-    c->prog_data.total_grf = num_grf_used(c);
-    c->prog_data.total_scratch = 0;
-}
index 62e556698ba8dea4fba3cb87840efe40042cd8d6..471ea1c18d68ac0e8cef6630cd8db569852a82b6 100644 (file)
@@ -120,14 +120,14 @@ const struct {
  * \param line_aa  AA_NEVER, AA_ALWAYS or AA_SOMETIMES
  * \param lookup  bitmask of IZ_* flags
  */
-void brw_wm_lookup_iz( struct intel_context *intel,
-                      GLuint line_aa,
-                      GLuint lookup,
-                      GLboolean ps_uses_depth,
-                      struct brw_wm_prog_key *key )
+void brw_wm_lookup_iz(struct intel_context *intel,
+                     struct brw_wm_compile *c)
 {
    GLuint reg = 2;
    GLboolean kill_stats_promoted_workaround = GL_FALSE;
+   int lookup = c->key.iz_lookup;
+   bool uses_depth = (c->fp->program.Base.InputsRead &
+                     (1 << FRAG_ATTRIB_WPOS)) != 0;
 
    assert (lookup < IZ_BIT_MAX);
 
@@ -136,36 +136,36 @@ void brw_wm_lookup_iz( struct intel_context *intel,
     * statistics are enabled..." paragraph of 11.5.3.2: Early Depth
     * Test Cases [Pre-DevGT] of the 3D Pipeline - Windower B-Spec.
     */
-   if (intel->stats_wm &&
+   if (c->key.stats_wm &&
        (lookup & IZ_PS_KILL_ALPHATEST_BIT) &&
        wm_iz_table[lookup].mode == P) {
       kill_stats_promoted_workaround = GL_TRUE;
    }
 
    if (lookup & IZ_PS_COMPUTES_DEPTH_BIT)
-      key->computes_depth = 1;
+      c->computes_depth = 1;
 
-   if (wm_iz_table[lookup].sd_present || ps_uses_depth ||
+   if (wm_iz_table[lookup].sd_present || uses_depth ||
        kill_stats_promoted_workaround) {
-      key->source_depth_reg = reg;
+      c->source_depth_reg = reg;
       reg += 2;
    }
 
    if (wm_iz_table[lookup].sd_to_rt || kill_stats_promoted_workaround)
-      key->source_depth_to_render_target = 1;
+      c->source_depth_to_render_target = 1;
 
-   if (wm_iz_table[lookup].ds_present || line_aa != AA_NEVER) {
-      key->aa_dest_stencil_reg = reg;
-      key->runtime_check_aads_emit = (!wm_iz_table[lookup].ds_present &&
-                                     line_aa == AA_SOMETIMES);
+   if (wm_iz_table[lookup].ds_present || c->key.line_aa != AA_NEVER) {
+      c->aa_dest_stencil_reg = reg;
+      c->runtime_check_aads_emit = (!wm_iz_table[lookup].ds_present &&
+                                   c->key.line_aa == AA_SOMETIMES);
       reg++;
    }
 
    if (wm_iz_table[lookup].dd_present) {
-      key->dest_depth_reg = reg;
+      c->dest_depth_reg = reg;
       reg+=2;
    }
 
-   key->nr_payload_regs = reg;
+   c->nr_payload_regs = reg;
 }
 
index 83152526b3ad61d319a795f709e869e51b9c199f..f78bdc31866c576a67aa815b8be66935871e0534 100644 (file)
@@ -380,7 +380,7 @@ static void pass0_init_payload( struct brw_wm_compile *c )
    GLuint i;
 
    for (i = 0; i < 4; i++) {
-      GLuint j = i >= (c->key.nr_payload_regs + 1) / 2 ? 0 : i;
+      GLuint j = i >= (c->nr_payload_regs + 1) / 2 ? 0 : i;
       pass0_set_fpreg_value( c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, 
                             &c->payload.depth[j] );
    }
index 3a2874b6ddfba8cd50516da9ccd18499e54cb66d..7d6a3fa9f12e38fd3640b26a141a8b45c687508e 100644 (file)
@@ -128,8 +128,7 @@ void brw_wm_pass1( struct brw_wm_compile *c )
       if (inst->opcode == WM_FB_WRITE) {
         track_arg(c, inst, 0, WRITEMASK_XYZW); 
         track_arg(c, inst, 1, WRITEMASK_XYZW); 
-        if (c->key.source_depth_to_render_target &&
-            c->key.computes_depth)
+        if (c->source_depth_to_render_target && c->computes_depth)
            track_arg(c, inst, 2, WRITEMASK_Z); 
         else
            track_arg(c, inst, 2, 0); 
@@ -281,7 +280,6 @@ void brw_wm_pass1( struct brw_wm_compile *c )
 
       case OPCODE_DST:
       case WM_FRONTFACING:
-      case OPCODE_KIL_NV:
       default:
         break;
       }
index 44e39538145877a413a25078af4ffdd18149dbc7..8c2b9e7020b32c75ed02508bbdc487c6a980408f 100644 (file)
@@ -69,6 +69,8 @@ static void prealloc_reg(struct brw_wm_compile *c,
  */
 static void init_registers( struct brw_wm_compile *c )
 {
+   struct brw_context *brw = c->func.brw;
+   struct intel_context *intel = &brw->intel;
    GLuint nr_interp_regs = 0;
    GLuint i = 0;
    GLuint j;
@@ -76,32 +78,41 @@ static void init_registers( struct brw_wm_compile *c )
    for (j = 0; j < c->grf_limit; j++) 
       c->pass2_grf[j].nextuse = BRW_WM_MAX_INSN;
 
-   for (j = 0; j < (c->key.nr_payload_regs + 1) / 2; j++)
+   for (j = 0; j < (c->nr_payload_regs + 1) / 2; j++)
       prealloc_reg(c, &c->payload.depth[j], i++);
 
    for (j = 0; j < c->nr_creg; j++) 
       prealloc_reg(c, &c->creg[j], i++);
 
-   for (j = 0; j < VERT_RESULT_MAX; j++) {
-      if (c->key.vp_outputs_written & BITFIELD64_BIT(j)) {
-        int fp_index;
-
-        if (j >= VERT_RESULT_VAR0)
-           fp_index = j - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0);
-        else if (j <= VERT_RESULT_TEX7)
-           fp_index = j;
-        else
-           fp_index = -1;
-
-        nr_interp_regs++;
-        if (fp_index >= 0)
-           prealloc_reg(c, &c->payload.input_interp[fp_index], i++);
+   if (intel->gen >= 6) {
+      for (unsigned int j = 0; j < FRAG_ATTRIB_MAX; j++) {
+        if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(j)) {
+           nr_interp_regs++;
+           prealloc_reg(c, &c->payload.input_interp[j], i++);
+        }
+      }
+   } else {
+      for (j = 0; j < VERT_RESULT_MAX; j++) {
+        if (c->key.vp_outputs_written & BITFIELD64_BIT(j)) {
+           int fp_index;
+
+           if (j >= VERT_RESULT_VAR0)
+              fp_index = j - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0);
+           else if (j <= VERT_RESULT_TEX7)
+              fp_index = j;
+           else
+              fp_index = -1;
+
+           nr_interp_regs++;
+           if (fp_index >= 0)
+              prealloc_reg(c, &c->payload.input_interp[fp_index], i++);
+        }
       }
+      assert(nr_interp_regs >= 1);
    }
 
-   assert(nr_interp_regs >= 1);
 
-   c->prog_data.first_curbe_grf = ALIGN(c->key.nr_payload_regs, 2);
+   c->prog_data.first_curbe_grf = ALIGN(c->nr_payload_regs, 2);
    c->prog_data.urb_read_length = nr_interp_regs * 2;
    c->prog_data.curb_read_length = c->nr_creg * 2;
 
index fea96d353818e67361274e931a770beb771c7201..30672b4251beecb4aea7edd73a22cb3562d40b19 100644 (file)
@@ -69,12 +69,43 @@ static GLuint translate_wrap_mode( GLenum wrap )
 static drm_intel_bo *upload_default_color( struct brw_context *brw,
                                     const GLfloat *color )
 {
-   struct brw_sampler_default_color sdc;
+   struct intel_context *intel = &brw->intel;
 
-   COPY_4V(sdc.color, color); 
-   
-   return brw_cache_data(&brw->cache, BRW_SAMPLER_DEFAULT_COLOR,
-                        &sdc, sizeof(sdc));
+   if (intel->gen >= 5) {
+      struct gen5_sampler_default_color sdc;
+
+      memset(&sdc, 0, sizeof(sdc));
+
+      UNCLAMPED_FLOAT_TO_UBYTE(sdc.ub[0], color[0]);
+      UNCLAMPED_FLOAT_TO_UBYTE(sdc.ub[1], color[1]);
+      UNCLAMPED_FLOAT_TO_UBYTE(sdc.ub[2], color[2]);
+      UNCLAMPED_FLOAT_TO_UBYTE(sdc.ub[3], color[3]);
+
+      UNCLAMPED_FLOAT_TO_USHORT(sdc.us[0], color[0]);
+      UNCLAMPED_FLOAT_TO_USHORT(sdc.us[1], color[1]);
+      UNCLAMPED_FLOAT_TO_USHORT(sdc.us[2], color[2]);
+      UNCLAMPED_FLOAT_TO_USHORT(sdc.us[3], color[3]);
+
+      UNCLAMPED_FLOAT_TO_SHORT(sdc.s[0], color[0]);
+      UNCLAMPED_FLOAT_TO_SHORT(sdc.s[1], color[1]);
+      UNCLAMPED_FLOAT_TO_SHORT(sdc.s[2], color[2]);
+      UNCLAMPED_FLOAT_TO_SHORT(sdc.s[3], color[3]);
+
+      /* XXX: Fill in half floats */
+      /* XXX: Fill in signed bytes */
+
+      COPY_4V(sdc.f, color);
+
+      return brw_cache_data(&brw->cache, BRW_SAMPLER_DEFAULT_COLOR,
+                           &sdc, sizeof(sdc));
+   } else {
+      struct brw_sampler_default_color sdc;
+
+      COPY_4V(sdc.color, color);
+
+      return brw_cache_data(&brw->cache, BRW_SAMPLER_DEFAULT_COLOR,
+                           &sdc, sizeof(sdc));
+   }
 }
 
 
@@ -245,9 +276,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
         struct wm_sampler_entry *entry = &key->sampler[unit];
         struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
         struct gl_texture_object *texObj = texUnit->_Current;
-        struct intel_texture_object *intelObj = intel_texture_object(texObj);
         struct gl_texture_image *firstImage =
-           texObj->Image[0][intelObj->firstLevel];
+           texObj->Image[0][texObj->BaseLevel];
 
         memset(last_entry_end, 0, 
                (char*)entry - last_entry_end + sizeof(*entry));
index 76de7b7b6f63e33264abfd1ac8ccfff775dfe646..e9ef635bca2d2489da2bad8d009edfe8df0054b3 100644 (file)
@@ -87,7 +87,6 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
 {
    struct gl_context *ctx = &brw->intel.ctx;
    const struct gl_fragment_program *fp = brw->fragment_program;
-   const struct brw_fragment_program *bfp = (struct brw_fragment_program *) fp;
    struct intel_context *intel = &brw->intel;
 
    memset(key, 0, sizeof(*key));
@@ -132,7 +131,6 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
 
    /* _NEW_COLOR */
    key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;
-   key->is_glsl = bfp->isGLSL;
 
    /* If using the fragment shader backend, the program is always
     * 8-wide.
index 76fc94df1f6bbcaaec3652c11950fa97a7696ffb..233fe3b731065d2c5cae1b8cb8340c192674f1ed 100644 (file)
@@ -42,7 +42,7 @@
 #include "brw_context.h"
 #include "brw_state.h"
 #include "brw_defines.h"
-
+#include "brw_wm.h"
 
 static GLuint translate_tex_target( GLenum target )
 {
@@ -68,104 +68,72 @@ static GLuint translate_tex_target( GLenum target )
    }
 }
 
+static uint32_t brw_format_for_mesa_format[MESA_FORMAT_COUNT] =
+{
+   [MESA_FORMAT_L8] = BRW_SURFACEFORMAT_L8_UNORM,
+   [MESA_FORMAT_I8] = BRW_SURFACEFORMAT_I8_UNORM,
+   [MESA_FORMAT_A8] = BRW_SURFACEFORMAT_A8_UNORM,
+   [MESA_FORMAT_AL88] = BRW_SURFACEFORMAT_L8A8_UNORM,
+   [MESA_FORMAT_AL1616] = BRW_SURFACEFORMAT_L16A16_UNORM,
+   [MESA_FORMAT_R8] = BRW_SURFACEFORMAT_R8_UNORM,
+   [MESA_FORMAT_R16] = BRW_SURFACEFORMAT_R16_UNORM,
+   [MESA_FORMAT_RG88] = BRW_SURFACEFORMAT_R8G8_UNORM,
+   [MESA_FORMAT_RG1616] = BRW_SURFACEFORMAT_R16G16_UNORM,
+   [MESA_FORMAT_ARGB8888] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM,
+   [MESA_FORMAT_XRGB8888] = BRW_SURFACEFORMAT_B8G8R8X8_UNORM,
+   [MESA_FORMAT_RGB565] = BRW_SURFACEFORMAT_B5G6R5_UNORM,
+   [MESA_FORMAT_ARGB1555] = BRW_SURFACEFORMAT_B5G5R5A1_UNORM,
+   [MESA_FORMAT_ARGB4444] = BRW_SURFACEFORMAT_B4G4R4A4_UNORM,
+   [MESA_FORMAT_YCBCR_REV] = BRW_SURFACEFORMAT_YCRCB_NORMAL,
+   [MESA_FORMAT_YCBCR] = BRW_SURFACEFORMAT_YCRCB_SWAPUVY,
+   [MESA_FORMAT_RGB_FXT1] = BRW_SURFACEFORMAT_FXT1,
+   [MESA_FORMAT_RGBA_FXT1] = BRW_SURFACEFORMAT_FXT1,
+   [MESA_FORMAT_RGB_DXT1] = BRW_SURFACEFORMAT_DXT1_RGB,
+   [MESA_FORMAT_RGBA_DXT1] = BRW_SURFACEFORMAT_BC1_UNORM,
+   [MESA_FORMAT_RGBA_DXT3] = BRW_SURFACEFORMAT_BC2_UNORM,
+   [MESA_FORMAT_RGBA_DXT5] = BRW_SURFACEFORMAT_BC3_UNORM,
+   [MESA_FORMAT_SRGB_DXT1] = BRW_SURFACEFORMAT_DXT1_RGB_SRGB,
+   [MESA_FORMAT_SRGBA_DXT1] = BRW_SURFACEFORMAT_BC1_UNORM_SRGB,
+   [MESA_FORMAT_SRGBA_DXT3] = BRW_SURFACEFORMAT_BC2_UNORM_SRGB,
+   [MESA_FORMAT_SRGBA_DXT5] = BRW_SURFACEFORMAT_BC3_UNORM_SRGB,
+   [MESA_FORMAT_SARGB8] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB,
+   [MESA_FORMAT_SLA8] = BRW_SURFACEFORMAT_L8A8_UNORM_SRGB,
+   [MESA_FORMAT_SL8] = BRW_SURFACEFORMAT_L8_UNORM_SRGB,
+   [MESA_FORMAT_DUDV8] = BRW_SURFACEFORMAT_R8G8_SNORM,
+   [MESA_FORMAT_SIGNED_RGBA8888_REV] = BRW_SURFACEFORMAT_R8G8B8A8_SNORM,
+};
+
+bool
+brw_render_target_supported(gl_format format)
+{
+   if (format == MESA_FORMAT_S8_Z24 ||
+       format == MESA_FORMAT_X8_Z24 ||
+       format == MESA_FORMAT_Z16) {
+      return true;
+   }
+
+   /* Not exactly true, as some of those formats are not renderable.
+    * But at least we know how to translate them.
+    */
+   return brw_format_for_mesa_format[format] != 0;
+}
 
 static GLuint translate_tex_format( gl_format mesa_format,
                                     GLenum internal_format,
                                    GLenum depth_mode )
 {
    switch( mesa_format ) {
-   case MESA_FORMAT_L8:
-      return BRW_SURFACEFORMAT_L8_UNORM;
-
-   case MESA_FORMAT_I8:
-      return BRW_SURFACEFORMAT_I8_UNORM;
-
-   case MESA_FORMAT_A8:
-      return BRW_SURFACEFORMAT_A8_UNORM; 
-
-   case MESA_FORMAT_AL88:
-      return BRW_SURFACEFORMAT_L8A8_UNORM;
-
-   case MESA_FORMAT_AL1616:
-      return BRW_SURFACEFORMAT_L16A16_UNORM;
-
-   case MESA_FORMAT_R8:
-      return BRW_SURFACEFORMAT_R8_UNORM;
-
-   case MESA_FORMAT_R16:
-      return BRW_SURFACEFORMAT_R16_UNORM;
-
-   case MESA_FORMAT_RG88:
-      return BRW_SURFACEFORMAT_R8G8_UNORM;
-
-   case MESA_FORMAT_RG1616:
-      return BRW_SURFACEFORMAT_R16G16_UNORM;
-
-   case MESA_FORMAT_RGB888:
-      assert(0);               /* not supported for sampling */
-      return BRW_SURFACEFORMAT_R8G8B8_UNORM;      
-
-   case MESA_FORMAT_ARGB8888:
-      return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
-
-   case MESA_FORMAT_XRGB8888:
-      return BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
-
-   case MESA_FORMAT_RGBA8888_REV:
-      _mesa_problem(NULL, "unexpected format in i965:translate_tex_format()");
-      return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
-
-   case MESA_FORMAT_RGB565:
-      return BRW_SURFACEFORMAT_B5G6R5_UNORM;
-
-   case MESA_FORMAT_ARGB1555:
-      return BRW_SURFACEFORMAT_B5G5R5A1_UNORM;
-
-   case MESA_FORMAT_ARGB4444:
-      return BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
-
-   case MESA_FORMAT_YCBCR_REV:
-      return BRW_SURFACEFORMAT_YCRCB_NORMAL;
-
-   case MESA_FORMAT_YCBCR:
-      return BRW_SURFACEFORMAT_YCRCB_SWAPUVY;
-
-   case MESA_FORMAT_RGB_FXT1:
-   case MESA_FORMAT_RGBA_FXT1:
-      return BRW_SURFACEFORMAT_FXT1;
 
    case MESA_FORMAT_Z16:
       if (depth_mode == GL_INTENSITY) 
          return BRW_SURFACEFORMAT_I16_UNORM;
       else if (depth_mode == GL_ALPHA)
          return BRW_SURFACEFORMAT_A16_UNORM;
+      else if (depth_mode == GL_RED)
+         return BRW_SURFACEFORMAT_R16_UNORM;
       else
          return BRW_SURFACEFORMAT_L16_UNORM;
 
-   case MESA_FORMAT_RGB_DXT1:
-       return BRW_SURFACEFORMAT_DXT1_RGB;
-
-   case MESA_FORMAT_RGBA_DXT1:
-       return BRW_SURFACEFORMAT_BC1_UNORM;
-       
-   case MESA_FORMAT_RGBA_DXT3:
-       return BRW_SURFACEFORMAT_BC2_UNORM;
-       
-   case MESA_FORMAT_RGBA_DXT5:
-       return BRW_SURFACEFORMAT_BC3_UNORM;
-
-   case MESA_FORMAT_SARGB8:
-      return BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB;
-
-   case MESA_FORMAT_SLA8:
-      return BRW_SURFACEFORMAT_L8A8_UNORM_SRGB;
-
-   case MESA_FORMAT_SL8:
-      return BRW_SURFACEFORMAT_L8_UNORM_SRGB;
-
-   case MESA_FORMAT_SRGB_DXT1:
-      return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
-
    case MESA_FORMAT_S8_Z24:
       /* XXX: these different surface formats don't seem to
        * make any difference for shadow sampler/compares.
@@ -174,18 +142,14 @@ static GLuint translate_tex_format( gl_format mesa_format,
          return BRW_SURFACEFORMAT_I24X8_UNORM;
       else if (depth_mode == GL_ALPHA)
          return BRW_SURFACEFORMAT_A24X8_UNORM;
+      else if (depth_mode == GL_RED)
+         return BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS;
       else
          return BRW_SURFACEFORMAT_L24X8_UNORM;
 
-   case MESA_FORMAT_DUDV8:
-      return BRW_SURFACEFORMAT_R8G8_SNORM;
-
-   case MESA_FORMAT_SIGNED_RGBA8888_REV:
-      return BRW_SURFACEFORMAT_R8G8B8A8_SNORM;
-
    default:
-      assert(0);
-      return 0;
+      assert(brw_format_for_mesa_format[mesa_format] != 0);
+      return brw_format_for_mesa_format[mesa_format];
    }
 }
 
@@ -214,7 +178,7 @@ brw_update_texture_surface( struct gl_context *ctx, GLuint unit )
    struct brw_context *brw = brw_context(ctx);
    struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
    struct intel_texture_object *intelObj = intel_texture_object(tObj);
-   struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel];
+   struct gl_texture_image *firstImage = tObj->Image[0][tObj->BaseLevel];
    const GLuint surf_index = SURF_INDEX_TEXTURE(unit);
    struct brw_surface_state surf;
    void *map;
@@ -232,7 +196,7 @@ brw_update_texture_surface( struct gl_context *ctx, GLuint unit )
 /*    surf.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
    surf.ss1.base_addr = intelObj->mt->region->buffer->offset; /* reloc */
 
-   surf.ss2.mip_count = intelObj->lastLevel - intelObj->firstLevel;
+   surf.ss2.mip_count = intelObj->_MaxLevel - tObj->BaseLevel;
    surf.ss2.width = firstImage->Width - 1;
    surf.ss2.height = firstImage->Height - 1;
    brw_set_surface_tiling(&surf, intelObj->mt->region->tiling);
@@ -274,6 +238,7 @@ brw_create_constant_surface(struct brw_context *brw,
                            drm_intel_bo **out_bo,
                            uint32_t *out_offset)
 {
+   struct intel_context *intel = &brw->intel;
    const GLint w = width - 1;
    struct brw_surface_state surf;
    void *map;
@@ -284,6 +249,9 @@ brw_create_constant_surface(struct brw_context *brw,
    surf.ss0.surface_type = BRW_SURFACE_BUFFER;
    surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
 
+   if (intel->gen >= 6)
+      surf.ss0.render_cache_read_write = 1;
+
    assert(bo);
    surf.ss1.base_addr = bo->offset; /* reloc */
 
@@ -404,6 +372,38 @@ const struct brw_tracked_state brw_wm_constant_surface = {
    .emit = upload_wm_constant_surface,
 };
 
+static void
+brw_update_null_renderbuffer_surface(struct brw_context *brw, unsigned int unit)
+{
+   struct intel_context *intel = &brw->intel;
+   struct brw_surface_state surf;
+   void *map;
+
+   memset(&surf, 0, sizeof(surf));
+
+   surf.ss0.surface_type = BRW_SURFACE_NULL;
+   surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+   surf.ss1.base_addr = 0;
+
+   surf.ss2.width = 0;
+   surf.ss2.height = 0;
+   brw_set_surface_tiling(&surf, I915_TILING_NONE);
+   surf.ss3.pitch = 0;
+
+   if (intel->gen < 6) {
+      /* _NEW_COLOR */
+      surf.ss0.color_blend = 0;
+      surf.ss0.writedisable_red =   1;
+      surf.ss0.writedisable_green = 1;
+      surf.ss0.writedisable_blue =  1;
+      surf.ss0.writedisable_alpha = 1;
+   }
+
+   map = brw_state_batch(brw, sizeof(surf), 32,
+                        &brw->wm.surf_bo[unit],
+                        &brw->wm.surf_offset[unit]);
+   memcpy(map, &surf, sizeof(surf));
+}
 
 /**
  * Sets up a surface state structure to point at the given region.
@@ -417,123 +417,53 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
 {
    struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &intel->ctx;
-   drm_intel_bo *region_bo = NULL;
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);
-   struct intel_region *region = irb ? irb->region : NULL;
-   struct {
-      unsigned int surface_type;
-      unsigned int surface_format;
-      unsigned int width, height, pitch, cpp;
-      GLubyte color_mask[4];
-      GLboolean color_blend;
-      uint32_t tiling;
-      uint32_t draw_x;
-      uint32_t draw_y;
-   } key;
+   struct intel_region *region = irb->region;
    struct brw_surface_state surf;
    void *map;
 
-   memset(&key, 0, sizeof(key));
-
-   if (region != NULL) {
-      region_bo = region->buffer;
-
-      key.surface_type = BRW_SURFACE_2D;
-      switch (irb->Base.Format) {
-      /* XRGB and ARGB are treated the same here because the chips in this
-       * family cannot render to XRGB targets.  This means that we have to
-       * mask writes to alpha (ala glColorMask) and reconfigure the alpha
-       * blending hardware to use GL_ONE (or GL_ZERO) for cases where
-       * GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is used.
-       */
-      case MESA_FORMAT_ARGB8888:
-      case MESA_FORMAT_XRGB8888:
-        key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
-        break;
-      case MESA_FORMAT_SARGB8:
-        key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB;
-        break;
-      case MESA_FORMAT_RGB565:
-        key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM;
-        break;
-      case MESA_FORMAT_ARGB1555:
-        key.surface_format = BRW_SURFACEFORMAT_B5G5R5A1_UNORM;
-        break;
-      case MESA_FORMAT_ARGB4444:
-        key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
-        break;
-      case MESA_FORMAT_A8:
-        key.surface_format = BRW_SURFACEFORMAT_A8_UNORM;
-        break;
-      case MESA_FORMAT_R8:
-        key.surface_format = BRW_SURFACEFORMAT_R8_UNORM;
-        break;
-      case MESA_FORMAT_R16:
-        key.surface_format = BRW_SURFACEFORMAT_R16_UNORM;
-        break;
-      case MESA_FORMAT_RG88:
-        key.surface_format = BRW_SURFACEFORMAT_R8G8_UNORM;
-        break;
-      case MESA_FORMAT_RG1616:
-        key.surface_format = BRW_SURFACEFORMAT_R16G16_UNORM;
-        break;
-      default:
-        _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format);
-      }
-      key.tiling = region->tiling;
-      key.width = rb->Width;
-      key.height = rb->Height;
-      key.pitch = region->pitch;
-      key.cpp = region->cpp;
-      key.draw_x = region->draw_x;
-      key.draw_y = region->draw_y;
-   } else {
-      key.surface_type = BRW_SURFACE_NULL;
-      key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
-      key.tiling = I915_TILING_X;
-      key.width = 1;
-      key.height = 1;
-      key.cpp = 4;
-      key.draw_x = 0;
-      key.draw_y = 0;
-   }
-
-   if (intel->gen < 6) {
-      /* _NEW_COLOR */
-      memcpy(key.color_mask, ctx->Color.ColorMask[unit],
-            sizeof(key.color_mask));
+   memset(&surf, 0, sizeof(surf));
 
-      /* As mentioned above, disable writes to the alpha component when the
-       * renderbuffer is XRGB.
+   switch (irb->Base.Format) {
+   case MESA_FORMAT_XRGB8888:
+      /* XRGB is handled as ARGB because the chips in this family
+       * cannot render to XRGB targets.  This means that we have to
+       * mask writes to alpha (ala glColorMask) and reconfigure the
+       * alpha blending hardware to use GL_ONE (or GL_ZERO) for
+       * cases where GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is
+       * used.
        */
-      if (ctx->DrawBuffer->Visual.alphaBits == 0)
-        key.color_mask[3] = GL_FALSE;
-
-      key.color_blend = (!ctx->Color._LogicOpEnabled &&
-                        (ctx->Color.BlendEnabled & (1 << unit)));
+      surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+      break;
+   case MESA_FORMAT_SARGB8:
+      /* without GL_EXT_framebuffer_sRGB we shouldn't bind sRGB
+        surfaces to the blend/update as sRGB */
+      surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+      break;
+   default:
+      surf.ss0.surface_format = brw_format_for_mesa_format[irb->Base.Format];
+      assert(surf.ss0.surface_format != 0);
    }
 
-   memset(&surf, 0, sizeof(surf));
-
-   surf.ss0.surface_format = key.surface_format;
-   surf.ss0.surface_type = key.surface_type;
-   if (key.tiling == I915_TILING_NONE) {
-      surf.ss1.base_addr = (key.draw_x + key.draw_y * key.pitch) * key.cpp;
+   surf.ss0.surface_type = BRW_SURFACE_2D;
+   if (region->tiling == I915_TILING_NONE) {
+      surf.ss1.base_addr = (region->draw_x +
+                           region->draw_y * region->pitch) * region->cpp;
    } else {
       uint32_t tile_base, tile_x, tile_y;
-      uint32_t pitch = key.pitch * key.cpp;
+      uint32_t pitch = region->pitch * region->cpp;
 
-      if (key.tiling == I915_TILING_X) {
-        tile_x = key.draw_x % (512 / key.cpp);
-        tile_y = key.draw_y % 8;
-        tile_base = ((key.draw_y / 8) * (8 * pitch));
-        tile_base += (key.draw_x - tile_x) / (512 / key.cpp) * 4096;
+      if (region->tiling == I915_TILING_X) {
+        tile_x = region->draw_x % (512 / region->cpp);
+        tile_y = region->draw_y % 8;
+        tile_base = ((region->draw_y / 8) * (8 * pitch));
+        tile_base += (region->draw_x - tile_x) / (512 / region->cpp) * 4096;
       } else {
         /* Y */
-        tile_x = key.draw_x % (128 / key.cpp);
-        tile_y = key.draw_y % 32;
-        tile_base = ((key.draw_y / 32) * (32 * pitch));
-        tile_base += (key.draw_x - tile_x) / (128 / key.cpp) * 4096;
+        tile_x = region->draw_x % (128 / region->cpp);
+        tile_y = region->draw_y % 32;
+        tile_base = ((region->draw_y / 32) * (32 * pitch));
+        tile_base += (region->draw_x - tile_x) / (128 / region->cpp) * 4096;
       }
       assert(brw->has_surface_tile_offset || (tile_x == 0 && tile_y == 0));
       assert(tile_x % 4 == 0);
@@ -545,21 +475,27 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
       surf.ss5.x_offset = tile_x / 4;
       surf.ss5.y_offset = tile_y / 2;
    }
-   if (region_bo != NULL)
-      surf.ss1.base_addr += region_bo->offset; /* reloc */
+   surf.ss1.base_addr += region->buffer->offset; /* reloc */
 
-   surf.ss2.width = key.width - 1;
-   surf.ss2.height = key.height - 1;
-   brw_set_surface_tiling(&surf, key.tiling);
-   surf.ss3.pitch = (key.pitch * key.cpp) - 1;
+   surf.ss2.width = rb->Width - 1;
+   surf.ss2.height = rb->Height - 1;
+   brw_set_surface_tiling(&surf, region->tiling);
+   surf.ss3.pitch = (region->pitch * region->cpp) - 1;
 
    if (intel->gen < 6) {
       /* _NEW_COLOR */
-      surf.ss0.color_blend = key.color_blend;
-      surf.ss0.writedisable_red =   !key.color_mask[0];
-      surf.ss0.writedisable_green = !key.color_mask[1];
-      surf.ss0.writedisable_blue =  !key.color_mask[2];
-      surf.ss0.writedisable_alpha = !key.color_mask[3];
+      surf.ss0.color_blend = (!ctx->Color._LogicOpEnabled &&
+                             (ctx->Color.BlendEnabled & (1 << unit)));
+      surf.ss0.writedisable_red =   !ctx->Color.ColorMask[unit][0];
+      surf.ss0.writedisable_green = !ctx->Color.ColorMask[unit][1];
+      surf.ss0.writedisable_blue =  !ctx->Color.ColorMask[unit][2];
+      /* As mentioned above, disable writes to the alpha component when the
+       * renderbuffer is XRGB.
+       */
+      if (ctx->DrawBuffer->Visual.alphaBits == 0)
+        surf.ss0.writedisable_alpha = 1;
+      else
+        surf.ss0.writedisable_alpha = !ctx->Color.ColorMask[unit][3];
    }
 
    map = brw_state_batch(brw, sizeof(surf), 32,
@@ -567,15 +503,13 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
                         &brw->wm.surf_offset[unit]);
    memcpy(map, &surf, sizeof(surf));
 
-   if (region_bo != NULL) {
-      drm_intel_bo_emit_reloc(brw->wm.surf_bo[unit],
-                             brw->wm.surf_offset[unit] +
-                             offsetof(struct brw_surface_state, ss1),
-                             region_bo,
-                             surf.ss1.base_addr - region_bo->offset,
-                             I915_GEM_DOMAIN_RENDER,
-                             I915_GEM_DOMAIN_RENDER);
-   }
+   drm_intel_bo_emit_reloc(brw->wm.surf_bo[unit],
+                          brw->wm.surf_offset[unit] +
+                          offsetof(struct brw_surface_state, ss1),
+                          region->buffer,
+                          surf.ss1.base_addr - region->buffer->offset,
+                          I915_GEM_DOMAIN_RENDER,
+                          I915_GEM_DOMAIN_RENDER);
 }
 
 static void
@@ -635,12 +569,16 @@ upload_wm_surfaces(struct brw_context *brw)
    /* Update surfaces for drawing buffers */
    if (ctx->DrawBuffer->_NumColorDrawBuffers >= 1) {
       for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
-         brw_update_renderbuffer_surface(brw,
-                                        ctx->DrawBuffer->_ColorDrawBuffers[i],
-                                        i);
+        if (intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[i])) {
+           brw_update_renderbuffer_surface(brw,
+                                           ctx->DrawBuffer->_ColorDrawBuffers[i],
+                                           i);
+        } else {
+           brw_update_null_renderbuffer_surface(brw, i);
+        }
       }
    } else {
-      brw_update_renderbuffer_surface(brw, NULL, 0);
+      brw_update_null_renderbuffer_surface(brw, 0);
    }
 
    /* Update surfaces for textures */
index 800a25552141bb76aae204f02b383d056a08a55e..dbcdc5b86936ddc7687dfc9d4c702b48e81572a9 100644 (file)
@@ -35,6 +35,7 @@
 struct gen6_blend_state_key {
    GLboolean color_blend, alpha_enabled;
    GLboolean dither;
+   GLboolean color_mask[BRW_MAX_DRAW_BUFFERS][4];
 
    GLenum logic_op;
 
@@ -53,6 +54,9 @@ blend_state_populate_key(struct brw_context *brw,
 
    memset(key, 0, sizeof(*key));
 
+   /* _NEW_COLOR */
+   memcpy(key->color_mask, ctx->Color.ColorMask, sizeof(key->color_mask));
+
    /* _NEW_COLOR */
    if (ctx->Color._LogicOpEnabled)
       key->logic_op = ctx->Color.LogicOp;
@@ -87,54 +91,62 @@ static drm_intel_bo *
 blend_state_create_from_key(struct brw_context *brw,
                            struct gen6_blend_state_key *key)
 {
-   struct gen6_blend_state blend;
+   struct gen6_blend_state blend[BRW_MAX_DRAW_BUFFERS];
    drm_intel_bo *bo;
+   int b;
 
    memset(&blend, 0, sizeof(blend));
 
-   if (key->logic_op != GL_COPY) {
-      blend.blend1.logic_op_enable = 1;
-      blend.blend1.logic_op_func = intel_translate_logic_op(key->logic_op);
-   } else if (key->color_blend) {
-      GLenum eqRGB = key->blend_eq_rgb;
-      GLenum eqA = key->blend_eq_a;
-      GLenum srcRGB = key->blend_src_rgb;
-      GLenum dstRGB = key->blend_dst_rgb;
-      GLenum srcA = key->blend_src_a;
-      GLenum dstA = key->blend_dst_a;
-
-      if (eqRGB == GL_MIN || eqRGB == GL_MAX) {
-        srcRGB = dstRGB = GL_ONE;
-      }
-
-      if (eqA == GL_MIN || eqA == GL_MAX) {
-        srcA = dstA = GL_ONE;
+   for (b = 0; b < BRW_MAX_DRAW_BUFFERS; b++) {
+      if (key->logic_op != GL_COPY) {
+        blend[b].blend1.logic_op_enable = 1;
+        blend[b].blend1.logic_op_func = intel_translate_logic_op(key->logic_op);
+      } else if (key->color_blend & (1 << b)) {
+        GLenum eqRGB = key->blend_eq_rgb;
+        GLenum eqA = key->blend_eq_a;
+        GLenum srcRGB = key->blend_src_rgb;
+        GLenum dstRGB = key->blend_dst_rgb;
+        GLenum srcA = key->blend_src_a;
+        GLenum dstA = key->blend_dst_a;
+
+        if (eqRGB == GL_MIN || eqRGB == GL_MAX) {
+           srcRGB = dstRGB = GL_ONE;
+        }
+
+        if (eqA == GL_MIN || eqA == GL_MAX) {
+           srcA = dstA = GL_ONE;
+        }
+
+        blend[b].blend0.dest_blend_factor = brw_translate_blend_factor(dstRGB);
+        blend[b].blend0.source_blend_factor = brw_translate_blend_factor(srcRGB);
+        blend[b].blend0.blend_func = brw_translate_blend_equation(eqRGB);
+
+        blend[b].blend0.ia_dest_blend_factor = brw_translate_blend_factor(dstA);
+        blend[b].blend0.ia_source_blend_factor = brw_translate_blend_factor(srcA);
+        blend[b].blend0.ia_blend_func = brw_translate_blend_equation(eqA);
+
+        blend[b].blend0.blend_enable = 1;
+        blend[b].blend0.ia_blend_enable = (srcA != srcRGB ||
+                                        dstA != dstRGB ||
+                                        eqA != eqRGB);
       }
 
-      blend.blend0.dest_blend_factor = brw_translate_blend_factor(dstRGB);
-      blend.blend0.source_blend_factor = brw_translate_blend_factor(srcRGB);
-      blend.blend0.blend_func = brw_translate_blend_equation(eqRGB);
-
-      blend.blend0.ia_dest_blend_factor = brw_translate_blend_factor(dstA);
-      blend.blend0.ia_source_blend_factor = brw_translate_blend_factor(srcA);
-      blend.blend0.ia_blend_func = brw_translate_blend_equation(eqA);
+      if (key->alpha_enabled) {
+        blend[b].blend1.alpha_test_enable = 1;
+        blend[b].blend1.alpha_test_func = intel_translate_compare_func(key->alpha_func);
 
-      blend.blend0.blend_enable = 1;
-      blend.blend0.ia_blend_enable = (srcA != srcRGB ||
-                                     dstA != dstRGB ||
-                                     eqA != eqRGB);
-   }
-
-   if (key->alpha_enabled) {
-      blend.blend1.alpha_test_enable = 1;
-      blend.blend1.alpha_test_func = intel_translate_compare_func(key->alpha_func);
+      }
 
-   }
+      if (key->dither) {
+        blend[b].blend1.dither_enable = 1;
+        blend[b].blend1.y_dither_offset = 0;
+        blend[b].blend1.x_dither_offset = 0;
+      }
 
-   if (key->dither) {
-      blend.blend1.dither_enable = 1;
-      blend.blend1.y_dither_offset = 0;
-      blend.blend1.x_dither_offset = 0;
+      blend[b].blend1.write_disable_r = !key->color_mask[b][0];
+      blend[b].blend1.write_disable_g = !key->color_mask[b][1];
+      blend[b].blend1.write_disable_b = !key->color_mask[b][2];
+      blend[b].blend1.write_disable_a = !key->color_mask[b][3];
    }
 
    bo = brw_upload_cache(&brw->cache, BRW_BLEND_STATE,
@@ -172,7 +184,7 @@ const struct brw_tracked_state gen6_blend_state = {
 };
 
 struct gen6_color_calc_state_key {
-   GLubyte blend_constant_color[4];
+   float blend_constant_color[4];
    GLclampf alpha_ref;
    GLubyte stencil_ref[2];
 };
@@ -266,7 +278,7 @@ static void upload_cc_state_pointers(struct brw_context *brw)
    struct intel_context *intel = &brw->intel;
 
    BEGIN_BATCH(4);
-   OUT_BATCH(CMD_3D_CC_STATE_POINTERS << 16 | (4 - 2));
+   OUT_BATCH(_3DSTATE_CC_STATE_POINTERS << 16 | (4 - 2));
    OUT_RELOC(brw->cc.blend_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    OUT_RELOC(brw->cc.depth_stencil_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
index c65b41e2b6bf9c71c30d707bdc67fddd54657e2b..38c98f30efbeac309f4d5105c8d176a840201d87 100644 (file)
@@ -43,7 +43,10 @@ upload_clip_state(struct brw_context *brw)
       depth_clamp = GEN6_CLIP_Z_TEST;
 
    if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION) {
-      provoking = 0;
+      provoking =
+        (0 << GEN6_CLIP_TRI_PROVOKE_SHIFT) |
+        (1 << GEN6_CLIP_TRIFAN_PROVOKE_SHIFT) |
+        (0 << GEN6_CLIP_LINE_PROVOKE_SHIFT);
    } else {
       provoking =
         (2 << GEN6_CLIP_TRI_PROVOKE_SHIFT) |
@@ -55,7 +58,7 @@ upload_clip_state(struct brw_context *brw)
    userclip = (1 << brw_count_bits(ctx->Transform.ClipPlanesEnabled)) - 1;
 
    BEGIN_BATCH(4);
-   OUT_BATCH(CMD_3D_CLIP_STATE << 16 | (4 - 2));
+   OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));
    OUT_BATCH(GEN6_CLIP_STATISTICS_ENABLE);
    OUT_BATCH(GEN6_CLIP_ENABLE |
             GEN6_CLIP_API_OGL |
@@ -64,7 +67,9 @@ upload_clip_state(struct brw_context *brw)
             userclip << GEN6_USER_CLIP_CLIP_DISTANCES_SHIFT |
             depth_clamp |
             provoking);
-   OUT_BATCH(GEN6_CLIP_FORCE_ZERO_RTAINDEX);
+   OUT_BATCH(U_FIXED(0.125, 3) << GEN6_CLIP_MIN_POINT_WIDTH_SHIFT |
+             U_FIXED(225.875, 3) << GEN6_CLIP_MAX_POINT_WIDTH_SHIFT |
+             GEN6_CLIP_FORCE_ZERO_RTAINDEX);
    ADVANCE_BATCH();
 }
 
index 6127b9197a1b880acaaecc6d83ed4e509b849e51..7296c7cd1b04268c988840f0235c4e1fa2b2c6ae 100644 (file)
@@ -37,7 +37,7 @@ upload_gs_state(struct brw_context *brw)
 
    /* Disable all the constant buffers. */
    BEGIN_BATCH(5);
-   OUT_BATCH(CMD_3D_CONSTANT_GS_STATE << 16 | (5 - 2));
+   OUT_BATCH(_3DSTATE_CONSTANT_GS << 16 | (5 - 2));
    OUT_BATCH(0);
    OUT_BATCH(0);
    OUT_BATCH(0);
@@ -46,7 +46,7 @@ upload_gs_state(struct brw_context *brw)
 
    if (brw->gs.prog_bo) {
       BEGIN_BATCH(7);
-      OUT_BATCH(CMD_3D_GS_STATE << 16 | (7 - 2));
+      OUT_BATCH(_3DSTATE_GS << 16 | (7 - 2));
       OUT_RELOC(brw->gs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
       OUT_BATCH(GEN6_GS_SPF_MODE |
                (0 << GEN6_GS_SAMPLER_COUNT_SHIFT) |
@@ -62,7 +62,7 @@ upload_gs_state(struct brw_context *brw)
       ADVANCE_BATCH();
    } else {
       BEGIN_BATCH(7);
-      OUT_BATCH(CMD_3D_GS_STATE << 16 | (7 - 2));
+      OUT_BATCH(_3DSTATE_GS << 16 | (7 - 2));
       OUT_BATCH(0); /* prog_bo */
       OUT_BATCH((0 << GEN6_GS_SAMPLER_COUNT_SHIFT) |
                (0 << GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
index fc5d391c3cfe132593fad2307d3249c14d66c8fe..f65c651bdff9b1d43fb7329e77f1860840d4fd28 100644 (file)
@@ -36,7 +36,7 @@ upload_sampler_state_pointers(struct brw_context *brw)
    struct intel_context *intel = &brw->intel;
 
    BEGIN_BATCH(4);
-   OUT_BATCH(CMD_3D_SAMPLER_STATE_POINTERS << 16 |
+   OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS << 16 |
             VS_SAMPLER_STATE_CHANGE |
             GS_SAMPLER_STATE_CHANGE |
             PS_SAMPLER_STATE_CHANGE |
index b57126c7938e054acf5d72459c7cdb332fb9470a..12b65826ae99a98531f1258e99c6c43194546953 100644 (file)
@@ -92,7 +92,7 @@ static void upload_scissor_state_pointers(struct brw_context *brw)
    struct intel_context *intel = &brw->intel;
 
    BEGIN_BATCH(2);
-   OUT_BATCH(CMD_3D_SCISSOR_STATE_POINTERS << 16 | (2 - 2));
+   OUT_BATCH(_3DSTATE_SCISSOR_STATE_POINTERS << 16 | (2 - 2));
    OUT_RELOC(brw->sf.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
    ADVANCE_BATCH();
 
index 471067e8f02ac1481357579505e65b75608afa7d..f27782935d42ac3930dfe5401d205891a90263b3 100644 (file)
 #include "intel_batchbuffer.h"
 
 static uint32_t
-get_attr_override(struct brw_context *brw, int fs_attr)
+get_attr_override(struct brw_context *brw, int fs_attr, int two_side_color)
 {
    int attr_index = 0, i, vs_attr;
+   int bfc = 0;
 
    if (fs_attr <= FRAG_ATTRIB_TEX7)
       vs_attr = fs_attr;
@@ -57,6 +58,30 @@ get_attr_override(struct brw_context *brw, int fs_attr)
         attr_index++;
    }
 
+   assert(attr_index < 32);
+
+   if (two_side_color) {
+       if ((brw->vs.prog_data->outputs_written & BITFIELD64_BIT(VERT_RESULT_COL1)) &&
+           (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC1))) {
+           assert(brw->vs.prog_data->outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0));
+           assert(brw->vs.prog_data->outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0));
+           bfc = 2;
+       } else if ((brw->vs.prog_data->outputs_written & BITFIELD64_BIT(VERT_RESULT_COL0)) &&
+                (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(VERT_RESULT_BFC0)))
+           bfc = 1;
+   }
+
+   if (bfc && (fs_attr <= FRAG_ATTRIB_TEX7 && fs_attr > FRAG_ATTRIB_WPOS)) {
+       if (fs_attr == FRAG_ATTRIB_COL0)
+           attr_index |= (ATTRIBUTE_SWIZZLE_INPUTATTR_FACING << ATTRIBUTE_SWIZZLE_SHIFT);
+       else if (fs_attr == FRAG_ATTRIB_COL1 && bfc == 2) {
+           attr_index++;
+           attr_index |= (ATTRIBUTE_SWIZZLE_INPUTATTR_FACING << ATTRIBUTE_SWIZZLE_SHIFT);
+       } else {
+           attr_index += bfc;
+       }
+   }
+
    return attr_index;
 }
 
@@ -67,13 +92,15 @@ upload_sf_state(struct brw_context *brw)
    struct gl_context *ctx = &intel->ctx;
    /* CACHE_NEW_VS_PROG */
    uint32_t num_inputs = brw_count_bits(brw->vs.prog_data->outputs_written);
+   /* BRW_NEW_FRAGMENT_PROGRAM */
    uint32_t num_outputs = brw_count_bits(brw->fragment_program->Base.InputsRead);
-   uint32_t dw1, dw2, dw3, dw4, dw16;
+   uint32_t dw1, dw2, dw3, dw4, dw16, dw17;
    int i;
    /* _NEW_BUFFER */
    GLboolean render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
    int attr = 0;
    int urb_start;
+   int two_side_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
 
    /* _NEW_TRANSFORM */
    if (ctx->Transform.ClipPlanesEnabled)
@@ -91,6 +118,7 @@ upload_sf_state(struct brw_context *brw)
    dw3 = 0;
    dw4 = 0;
    dw16 = 0;
+   dw17 = 0;
 
    /* _NEW_POLYGON */
    if ((ctx->Polygon.FrontFace == GL_CCW) ^ render_to_fbo)
@@ -99,6 +127,48 @@ upload_sf_state(struct brw_context *brw)
    if (ctx->Polygon.OffsetFill)
        dw2 |= GEN6_SF_GLOBAL_DEPTH_OFFSET_SOLID;
 
+   if (ctx->Polygon.OffsetLine)
+       dw2 |= GEN6_SF_GLOBAL_DEPTH_OFFSET_WIREFRAME;
+
+   if (ctx->Polygon.OffsetPoint)
+       dw2 |= GEN6_SF_GLOBAL_DEPTH_OFFSET_POINT;
+
+   switch (ctx->Polygon.FrontMode) {
+   case GL_FILL:
+       dw2 |= GEN6_SF_FRONT_SOLID;
+       break;
+
+   case GL_LINE:
+       dw2 |= GEN6_SF_FRONT_WIREFRAME;
+       break;
+
+   case GL_POINT:
+       dw2 |= GEN6_SF_FRONT_POINT;
+       break;
+
+   default:
+       assert(0);
+       break;
+   }
+
+   switch (ctx->Polygon.BackMode) {
+   case GL_FILL:
+       dw2 |= GEN6_SF_BACK_SOLID;
+       break;
+
+   case GL_LINE:
+       dw2 |= GEN6_SF_BACK_WIREFRAME;
+       break;
+
+   case GL_POINT:
+       dw2 |= GEN6_SF_BACK_POINT;
+       break;
+
+   default:
+       assert(0);
+       break;
+   }
+
    /* _NEW_SCISSOR */
    if (ctx->Scissor.Enabled)
       dw3 |= GEN6_SF_SCISSOR_ENABLE;
@@ -160,8 +230,14 @@ upload_sf_state(struct brw_context *brw)
        }
    }
 
+   /* flat shading */
+   if (ctx->Light.ShadeModel == GL_FLAT) {
+       dw17 |= ((brw->fragment_program->Base.InputsRead & (FRAG_BIT_COL0 | FRAG_BIT_COL1)) >>
+                ((brw->fragment_program->Base.InputsRead & FRAG_BIT_WPOS) ? 0 : 1));
+   }
+
    BEGIN_BATCH(20);
-   OUT_BATCH(CMD_3D_SF_STATE << 16 | (20 - 2));
+   OUT_BATCH(_3DSTATE_SF << 16 | (20 - 2));
    OUT_BATCH(dw1);
    OUT_BATCH(dw2);
    OUT_BATCH(dw3);
@@ -174,7 +250,7 @@ upload_sf_state(struct brw_context *brw)
 
       for (; attr < 64; attr++) {
         if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)) {
-           attr_overrides |= get_attr_override(brw, attr);
+           attr_overrides |= get_attr_override(brw, attr, two_side_color);
            attr++;
            break;
         }
@@ -182,7 +258,7 @@ upload_sf_state(struct brw_context *brw)
 
       for (; attr < 64; attr++) {
         if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)) {
-           attr_overrides |= get_attr_override(brw, attr) << 16;
+           attr_overrides |= get_attr_override(brw, attr, two_side_color) << 16;
            attr++;
            break;
         }
@@ -190,7 +266,7 @@ upload_sf_state(struct brw_context *brw)
       OUT_BATCH(attr_overrides);
    }
    OUT_BATCH(dw16); /* point sprite texcoord bitmask */
-   OUT_BATCH(0); /* constant interp bitmask */
+   OUT_BATCH(dw17); /* constant interp bitmask */
    OUT_BATCH(0); /* wrapshortest enables 0-7 */
    OUT_BATCH(0); /* wrapshortest enables 8-15 */
    ADVANCE_BATCH();
@@ -205,7 +281,8 @@ const struct brw_tracked_state gen6_sf_state = {
                _NEW_BUFFERS |
                _NEW_POINT |
                _NEW_TRANSFORM),
-      .brw   = BRW_NEW_CONTEXT,
+      .brw   = (BRW_NEW_CONTEXT |
+               BRW_NEW_FRAGMENT_PROGRAM),
       .cache = CACHE_NEW_VS_PROG
    },
    .emit = upload_sf_state,
index a34123478fb7f8d1a6e697cb7c2abd9e64c0fb15..fc46c4cb79e3373eec99991dea33675d0c9b4bd6 100644 (file)
@@ -60,7 +60,7 @@ upload_urb(struct brw_context *brw)
    assert(!brw->gs.prog_bo || brw->urb.vs_size < 5);
 
    BEGIN_BATCH(3);
-   OUT_BATCH(CMD_URB << 16 | (3 - 2));
+   OUT_BATCH(_3DSTATE_URB << 16 | (3 - 2));
    OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_VS_SIZE_SHIFT) |
             ((brw->urb.nr_vs_entries) << GEN6_URB_VS_ENTRIES_SHIFT));
    OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_GS_SIZE_SHIFT) |
@@ -72,7 +72,7 @@ const struct brw_tracked_state gen6_urb = {
    .dirty = {
       .mesa = 0,
       .brw = BRW_NEW_CONTEXT,
-      .cache = CACHE_NEW_VS_PROG,
+      .cache = (CACHE_NEW_VS_PROG | CACHE_NEW_GS_PROG),
    },
    .prepare = prepare_urb,
    .emit = upload_urb,
index d691bbebc83f9cde921090ee04e3235cd00520e2..cd7d209e3eadb74c795dbbc77750a16985cdbf7b 100644 (file)
@@ -117,7 +117,7 @@ static void upload_viewport_state_pointers(struct brw_context *brw)
    struct intel_context *intel = &brw->intel;
 
    BEGIN_BATCH(4);
-   OUT_BATCH(CMD_VIEWPORT_STATE_POINTERS << 16 | (4 - 2) |
+   OUT_BATCH(_3DSTATE_VIEWPORT_STATE_POINTERS << 16 | (4 - 2) |
             GEN6_CC_VIEWPORT_MODIFY |
             GEN6_SF_VIEWPORT_MODIFY |
             GEN6_CLIP_VIEWPORT_MODIFY);
index e94d0c0ddbb6e2d02afc8a18c0162b1a940e10dc..e68c0ac261c963e1b30f9edd4df92645b068bb13 100644 (file)
@@ -47,14 +47,14 @@ upload_vs_state(struct brw_context *brw)
    if (brw->vs.prog_data->nr_params == 0 && !ctx->Transform.ClipPlanesEnabled) {
       /* Disable the push constant buffers. */
       BEGIN_BATCH(5);
-      OUT_BATCH(CMD_3D_CONSTANT_VS_STATE << 16 | (5 - 2));
+      OUT_BATCH(_3DSTATE_CONSTANT_VS << 16 | (5 - 2));
       OUT_BATCH(0);
       OUT_BATCH(0);
       OUT_BATCH(0);
       OUT_BATCH(0);
       ADVANCE_BATCH();
    } else {
-      int params_uploaded = 0;
+      int params_uploaded = 0, param_regs;
       float *param;
 
       if (brw->vertex_program->IsNVProgram)
@@ -88,20 +88,11 @@ upload_vs_state(struct brw_context *brw)
         params_uploaded++;
       }
 
-      if (vp->use_const_buffer) {
-        for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
-           if (brw->vs.constant_map[i] != -1) {
-              memcpy(param + brw->vs.constant_map[i] * 4,
-                     vp->program.Base.Parameters->ParameterValues[i],
-                     4 * sizeof(float));
-              params_uploaded++;
-           }
-        }
-      } else {
-        for (i = 0; i < nr_params; i++) {
-           memcpy(param, vp->program.Base.Parameters->ParameterValues[i],
+      for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
+        if (brw->vs.constant_map[i] != -1) {
+           memcpy(param + brw->vs.constant_map[i] * 4,
+                  vp->program.Base.Parameters->ParameterValues[i],
                   4 * sizeof(float));
-           param += 4;
            params_uploaded++;
         }
       }
@@ -117,13 +108,16 @@ upload_vs_state(struct brw_context *brw)
 
       drm_intel_gem_bo_unmap_gtt(constant_bo);
 
+      param_regs = (params_uploaded + 1) / 2;
+      assert(param_regs <= 32);
+
       BEGIN_BATCH(5);
-      OUT_BATCH(CMD_3D_CONSTANT_VS_STATE << 16 |
+      OUT_BATCH(_3DSTATE_CONSTANT_VS << 16 |
                GEN6_CONSTANT_BUFFER_0_ENABLE |
                (5 - 2));
       OUT_RELOC(constant_bo,
                I915_GEM_DOMAIN_RENDER, 0, /* XXX: bad domain */
-               ALIGN(params_uploaded, 2) / 2 - 1);
+               param_regs - 1);
       OUT_BATCH(0);
       OUT_BATCH(0);
       OUT_BATCH(0);
@@ -133,9 +127,10 @@ upload_vs_state(struct brw_context *brw)
    }
 
    BEGIN_BATCH(6);
-   OUT_BATCH(CMD_3D_VS_STATE << 16 | (6 - 2));
+   OUT_BATCH(_3DSTATE_VS << 16 | (6 - 2));
    OUT_RELOC(brw->vs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
    OUT_BATCH((0 << GEN6_VS_SAMPLER_COUNT_SHIFT) |
+            GEN6_VS_FLOATING_POINT_MODE_ALT |
             (brw->vs.nr_surfaces << GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
    OUT_BATCH(0); /* scratch space base offset */
    OUT_BATCH((1 << GEN6_VS_DISPATCH_START_GRF_SHIFT) |
index ea5418bacf1c9f6cad5b7b86851d82d754ec9489..78901ecac576232a7752f71ddffa7b13808a8d32 100644 (file)
@@ -66,6 +66,21 @@ prepare_wm_constants(struct brw_context *brw)
         constants[i] = convert_param(brw->wm.prog_data->param_convert[i],
                                      *brw->wm.prog_data->param[i]);
       }
+
+      if (0) {
+        printf("WM constants:\n");
+        for (i = 0; i < brw->wm.prog_data->nr_params; i++) {
+           if ((i & 7) == 0)
+              printf("g%d: ", brw->wm.prog_data->first_curbe_grf + i / 8);
+           printf("%8f ", constants[i]);
+           if ((i & 7) == 7)
+              printf("\n");
+        }
+        if ((i & 7) != 0)
+           printf("\n");
+        printf("\n");
+      }
+
       drm_intel_gem_bo_unmap_gtt(brw->wm.push_const_bo);
    }
 }
@@ -88,10 +103,11 @@ upload_wm_state(struct brw_context *brw)
       brw_fragment_program_const(brw->fragment_program);
    uint32_t dw2, dw4, dw5, dw6;
 
+   /* CACHE_NEW_WM_PROG */
    if (brw->wm.prog_data->nr_params == 0) {
       /* Disable the push constant buffers. */
       BEGIN_BATCH(5);
-      OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 | (5 - 2));
+      OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 | (5 - 2));
       OUT_BATCH(0);
       OUT_BATCH(0);
       OUT_BATCH(0);
@@ -99,12 +115,13 @@ upload_wm_state(struct brw_context *brw)
       ADVANCE_BATCH();
    } else {
       BEGIN_BATCH(5);
-      OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 |
+      OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 |
                GEN6_CONSTANT_BUFFER_0_ENABLE |
                (5 - 2));
       OUT_RELOC(brw->wm.push_const_bo,
                I915_GEM_DOMAIN_RENDER, 0, /* XXX: bad domain */
-               ALIGN(brw->wm.prog_data->nr_params, 8) / 8 - 1);
+               ALIGN(brw->wm.prog_data->nr_params,
+                     brw->wm.prog_data->dispatch_width) / 8 - 1);
       OUT_BATCH(0);
       OUT_BATCH(0);
       OUT_BATCH(0);
@@ -116,6 +133,9 @@ upload_wm_state(struct brw_context *brw)
    dw5 |= GEN6_WM_LINE_AA_WIDTH_1_0;
    dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5;
 
+   /* OpenGL non-ieee floating point mode */
+   dw2 |= GEN6_WM_FLOATING_POINT_MODE_ALT;
+
    /* BRW_NEW_NR_WM_SURFACES */
    dw2 |= brw->wm.nr_surfaces << GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT;
 
@@ -126,8 +146,8 @@ upload_wm_state(struct brw_context *brw)
 
    dw5 |= (40 - 1) << GEN6_WM_MAX_THREADS_SHIFT;
 
-   /* BRW_NEW_FRAGMENT_PROGRAM */
-   if (fp->isGLSL)
+   /* CACHE_NEW_WM_PROG */
+   if (brw->wm.prog_data->dispatch_width == 8)
       dw5 |= GEN6_WM_8_DISPATCH_ENABLE;
    else
       dw5 |= GEN6_WM_16_DISPATCH_ENABLE;
@@ -161,7 +181,7 @@ upload_wm_state(struct brw_context *brw)
       GEN6_WM_NUM_SF_OUTPUTS_SHIFT;
 
    BEGIN_BATCH(9);
-   OUT_BATCH(CMD_3D_WM_STATE << 16 | (9 - 2));
+   OUT_BATCH(_3DSTATE_WM << 16 | (9 - 2));
    OUT_RELOC(brw->wm.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
    OUT_BATCH(dw2);
    OUT_BATCH(0); /* scratch space base offset */
@@ -176,13 +196,14 @@ upload_wm_state(struct brw_context *brw)
 const struct brw_tracked_state gen6_wm_state = {
    .dirty = {
       .mesa  = (_NEW_LINE | _NEW_POLYGONSTIPPLE | _NEW_COLOR | _NEW_BUFFERS |
-               _NEW_PROGRAM_CONSTANTS),
+               _NEW_PROGRAM_CONSTANTS | _NEW_POLYGON),
       .brw   = (BRW_NEW_CURBE_OFFSETS |
                BRW_NEW_FRAGMENT_PROGRAM |
                 BRW_NEW_NR_WM_SURFACES |
                BRW_NEW_URB_FENCE |
                BRW_NEW_BATCH),
-      .cache = CACHE_NEW_SAMPLER
+      .cache = (CACHE_NEW_SAMPLER |
+               CACHE_NEW_WM_PROG)
    },
    .emit = upload_wm_state,
 };
index 4b498f8c5b2b28b77bd69014bc0094b70398cbb6..67ce8a4da026dcbda6d06aca81b34784c02da8bd 100644 (file)
@@ -92,9 +92,17 @@ do_flush_locked(struct intel_batchbuffer *batch, GLuint used)
 
    batch->ptr = NULL;
 
-   if (!intel->no_hw) {
-      drm_intel_bo_exec(batch->buf, used, NULL, 0,
-                       (x_off & 0xffff) | (y_off << 16));
+   if (!intel->intelScreen->no_hw) {
+      int ring;
+
+      if (intel->gen < 6 || !intel->batch->is_blit) {
+        ring = I915_EXEC_RENDER;
+      } else {
+        ring = I915_EXEC_BLT;
+      }
+
+      drm_intel_bo_mrb_exec(batch->buf, used, NULL, 0,
+                           (x_off & 0xffff) | (y_off << 16), ring);
    }
 
    if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
@@ -242,10 +250,10 @@ intel_batchbuffer_emit_reloc_fenced(struct intel_batchbuffer *batch,
 
 void
 intel_batchbuffer_data(struct intel_batchbuffer *batch,
-                       const void *data, GLuint bytes)
+                       const void *data, GLuint bytes, bool is_blit)
 {
    assert((bytes & 3) == 0);
-   intel_batchbuffer_require_space(batch, bytes);
+   intel_batchbuffer_require_space(batch, bytes, is_blit);
    __memcpy(batch->ptr, data, bytes);
    batch->ptr += bytes;
 }
@@ -262,22 +270,32 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch)
    struct intel_context *intel = batch->intel;
 
    if (intel->gen >= 6) {
-      BEGIN_BATCH(8);
-
-      /* XXX workaround: issue any post sync != 0 before write cache flush = 1 */
-      OUT_BATCH(_3DSTATE_PIPE_CONTROL);
-      OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE);
-      OUT_BATCH(0); /* write address */
-      OUT_BATCH(0); /* write data */
-
-      OUT_BATCH(_3DSTATE_PIPE_CONTROL);
-      OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH |
-               PIPE_CONTROL_WRITE_FLUSH |
-               PIPE_CONTROL_DEPTH_CACHE_FLUSH |
-               PIPE_CONTROL_NO_WRITE);
-      OUT_BATCH(0); /* write address */
-      OUT_BATCH(0); /* write data */
-      ADVANCE_BATCH();
+      if (intel->batch->is_blit) {
+        BEGIN_BATCH_BLT(4);
+        OUT_BATCH(MI_FLUSH_DW);
+        OUT_BATCH(0);
+        OUT_BATCH(0);
+        OUT_BATCH(0);
+        ADVANCE_BATCH();
+      } else {
+        BEGIN_BATCH(8);
+        /* XXX workaround: issue any post sync != 0 before write
+         * cache flush = 1
+         */
+        OUT_BATCH(_3DSTATE_PIPE_CONTROL);
+        OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE);
+        OUT_BATCH(0); /* write address */
+        OUT_BATCH(0); /* write data */
+
+        OUT_BATCH(_3DSTATE_PIPE_CONTROL);
+        OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH |
+                  PIPE_CONTROL_WRITE_FLUSH |
+                  PIPE_CONTROL_DEPTH_CACHE_FLUSH |
+                  PIPE_CONTROL_NO_WRITE);
+        OUT_BATCH(0); /* write address */
+        OUT_BATCH(0); /* write data */
+        ADVANCE_BATCH();
+      }
    } else if (intel->gen >= 4) {
       BEGIN_BATCH(4);
       OUT_BATCH(_3DSTATE_PIPE_CONTROL |
index 428c027c2f1ed3c2770119866fbd76c390958909..635708587a6af9f81ae9b699e9041498d2af88f3 100644 (file)
@@ -31,6 +31,7 @@ struct intel_batchbuffer
    } emit;
 #endif
 
+   bool is_blit;
    GLuint dirty_state;
    GLuint reserved_space;
 };
@@ -55,7 +56,7 @@ void intel_batchbuffer_reset(struct intel_batchbuffer *batch);
  * intel_buffer_dword() calls.
  */
 void intel_batchbuffer_data(struct intel_batchbuffer *batch,
-                            const void *data, GLuint bytes);
+                            const void *data, GLuint bytes, bool is_blit);
 
 void intel_batchbuffer_release_space(struct intel_batchbuffer *batch,
                                      GLuint bytes);
@@ -114,8 +115,16 @@ intel_batchbuffer_emit_float(struct intel_batchbuffer *batch, float f)
 
 static INLINE void
 intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
-                                GLuint sz)
+                                GLuint sz, int is_blit)
 {
+
+   if (batch->intel->gen >= 6 && batch->is_blit != is_blit &&
+       batch->ptr != batch->map) {
+      intel_batchbuffer_flush(batch);
+   }
+
+   batch->is_blit = is_blit;
+
 #ifdef DEBUG
    assert(sz < batch->size - 8);
 #endif
@@ -124,9 +133,10 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
 }
 
 static INLINE void
-intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n)
+intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n, bool is_blit)
 {
-   intel_batchbuffer_require_space(batch, n * 4);
+   intel_batchbuffer_require_space(batch, n * 4, is_blit);
+
 #ifdef DEBUG
    assert(batch->map);
    assert(batch->emit.start_ptr == NULL);
@@ -154,7 +164,8 @@ intel_batchbuffer_advance(struct intel_batchbuffer *batch)
  */
 #define BATCH_LOCALS
 
-#define BEGIN_BATCH(n) intel_batchbuffer_begin(intel->batch, n)
+#define BEGIN_BATCH(n) intel_batchbuffer_begin(intel->batch, n, false)
+#define BEGIN_BATCH_BLT(n) intel_batchbuffer_begin(intel->batch, n, true)
 #define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d)
 #define OUT_BATCH_F(f) intel_batchbuffer_emit_float(intel->batch,f)
 #define OUT_RELOC(buf, read_domains, write_domain, delta) do {         \
index c2917e9b07e79847a7ba4fb94f29669b3dd06fc2..6232e479cb6ef4ba86c38bd7d421ce4f2295714c 100644 (file)
@@ -38,6 +38,7 @@
 #include "intel_reg.h"
 #include "intel_regions.h"
 #include "intel_batchbuffer.h"
+#include "intel_mipmap_tree.h"
 
 #define FILE_DEBUG_FLAG DEBUG_BLIT
 
@@ -107,10 +108,6 @@ intelEmitCopyBlit(struct intel_context *intel,
    drm_intel_bo *aper_array[3];
    BATCH_LOCALS;
 
-   /* Blits are in a different ringbuffer so we don't use them. */
-   if (intel->gen >= 6)
-      return GL_FALSE;
-
    if (dst_tiling != I915_TILING_NONE) {
       if (dst_offset & 4095)
         return GL_FALSE;
@@ -140,7 +137,7 @@ intelEmitCopyBlit(struct intel_context *intel,
    if (pass >= 2)
       return GL_FALSE;
 
-   intel_batchbuffer_require_space(intel->batch, 8 * 4);
+   intel_batchbuffer_require_space(intel->batch, 8 * 4, true);
    DBG("%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
        __FUNCTION__,
        src_buffer, src_pitch, src_offset, src_x, src_y,
@@ -181,7 +178,7 @@ intelEmitCopyBlit(struct intel_context *intel,
    assert(dst_x < dst_x2);
    assert(dst_y < dst_y2);
 
-   BEGIN_BATCH(8);
+   BEGIN_BATCH_BLT(8);
    OUT_BATCH(CMD);
    OUT_BATCH(BR13 | (uint16_t)dst_pitch);
    OUT_BATCH((dst_y << 16) | dst_x);
@@ -209,7 +206,7 @@ intelEmitCopyBlit(struct intel_context *intel,
  * which we're clearing with triangles.
  * \param mask  bitmask of BUFFER_BIT_* values indicating buffers to clear
  */
-void
+GLbitfield
 intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
 {
    struct intel_context *intel = intel_context(ctx);
@@ -217,11 +214,9 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
    GLuint clear_depth;
    GLboolean all;
    GLint cx, cy, cw, ch;
+   GLbitfield fail_mask = 0;
    BATCH_LOCALS;
 
-   /* Blits are in a different ringbuffer so we don't use them. */
-   assert(intel->gen < 6);
-
    /*
     * Compute values for clearing the buffers.
     */
@@ -242,7 +237,7 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
    ch = fb->_Ymax - fb->_Ymin;
 
    if (cw == 0 || ch == 0)
-      return;
+      return 0;
 
    GLuint buf;
    all = (cw == fb->Width && ch == fb->Height);
@@ -338,9 +333,9 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
                                        clear[3], clear[3]);
            break;
         default:
-           _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
-                         irb->Base.Format);
-           clear_val = 0;
+           fail_mask |= bufBit;
+           mask &= ~bufBit;
+           continue;
         }
       }
 
@@ -356,7 +351,7 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
         intel_batchbuffer_flush(intel->batch);
       }
 
-      BEGIN_BATCH(6);
+      BEGIN_BATCH_BLT(6);
       OUT_BATCH(CMD);
       OUT_BATCH(BR13);
       OUT_BATCH((y1 << 16) | x1);
@@ -375,6 +370,8 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
       else
         mask &= ~bufBit;    /* turn off bit, for faster loop exit */
    }
+
+   return fail_mask;
 }
 
 GLboolean
@@ -393,10 +390,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
    int dwords = ALIGN(src_size, 8) / 4;
    uint32_t opcode, br13, blit_cmd;
 
-   /* Blits are in a different ringbuffer so we don't use them. */
-   if (intel->gen >= 6)
-      return GL_FALSE;
-
    if (dst_tiling != I915_TILING_NONE) {
       if (dst_offset & 4095)
         return GL_FALSE;
@@ -420,7 +413,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
    intel_batchbuffer_require_space( intel->batch,
                                    (8 * 4) +
                                    (3 * 4) +
-                                   dwords * 4 );
+                                   dwords * 4, true);
 
    opcode = XY_SETUP_BLT_CMD;
    if (cpp == 4)
@@ -439,7 +432,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
    if (dst_tiling != I915_TILING_NONE)
       blit_cmd |= XY_DST_TILED;
 
-   BEGIN_BATCH(8 + 3);
+   BEGIN_BATCH_BLT(8 + 3);
    OUT_BATCH(opcode);
    OUT_BATCH(br13);
    OUT_BATCH((0 << 16) | 0); /* clip x1, y1 */
@@ -456,9 +449,9 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
    OUT_BATCH(((y + h) << 16) | (x + w));
    ADVANCE_BATCH();
 
-   intel_batchbuffer_data( intel->batch,
-                          src_bits,
-                          dwords * 4 );
+   intel_batchbuffer_data(intel->batch,
+                         src_bits,
+                         dwords * 4, true);
 
    intel_batchbuffer_emit_mi_flush(intel->batch);
 
@@ -480,9 +473,6 @@ intel_emit_linear_blit(struct intel_context *intel,
    GLuint pitch, height;
    GLboolean ok;
 
-   /* Blits are in a different ringbuffer so we don't use them. */
-   assert(intel->gen < 6);
-
    /* The pitch given to the GPU must be DWORD aligned, and
     * we want width to match pitch. Max width is (1 << 15 - 1),
     * rounding that down to the nearest DWORD is 1 << 15 - 4
@@ -514,3 +504,81 @@ intel_emit_linear_blit(struct intel_context *intel,
       assert(ok);
    }
 }
+
+/**
+ * Used to initialize the alpha value of an ARGB8888 teximage after
+ * loading it from an XRGB8888 source.
+ *
+ * This is very common with glCopyTexImage2D().
+ */
+void
+intel_set_teximage_alpha_to_one(struct gl_context *ctx,
+                               struct intel_texture_image *intel_image)
+{
+   struct intel_context *intel = intel_context(ctx);
+   unsigned int image_x, image_y;
+   uint32_t x1, y1, x2, y2;
+   uint32_t BR13, CMD;
+   int pitch, cpp;
+   drm_intel_bo *aper_array[2];
+   struct intel_region *region = intel_image->mt->region;
+   BATCH_LOCALS;
+
+   assert(intel_image->base.TexFormat == MESA_FORMAT_ARGB8888);
+
+   /* get dest x/y in destination texture */
+   intel_miptree_get_image_offset(intel_image->mt,
+                                 intel_image->level,
+                                 intel_image->face,
+                                 0,
+                                 &image_x, &image_y);
+
+   x1 = image_x;
+   y1 = image_y;
+   x2 = image_x + intel_image->base.Width;
+   y2 = image_y + intel_image->base.Height;
+
+   pitch = region->pitch;
+   cpp = region->cpp;
+
+   DBG("%s dst:buf(%p)/%d %d,%d sz:%dx%d\n",
+       __FUNCTION__,
+       intel_image->mt->region->buffer, (pitch * region->cpp),
+       x1, y1, x2 - x1, y2 - y1);
+
+   BR13 = br13_for_cpp(region->cpp) | 0xf0 << 16;
+   CMD = XY_COLOR_BLT_CMD;
+   CMD |= XY_BLT_WRITE_ALPHA;
+
+   assert(region->tiling != I915_TILING_Y);
+
+#ifndef I915
+   if (region->tiling != I915_TILING_NONE) {
+      CMD |= XY_DST_TILED;
+      pitch /= 4;
+   }
+#endif
+   BR13 |= (pitch * region->cpp);
+
+   /* do space check before going any further */
+   aper_array[0] = intel->batch->buf;
+   aper_array[1] = region->buffer;
+
+   if (drm_intel_bufmgr_check_aperture_space(aper_array,
+                                            ARRAY_SIZE(aper_array)) != 0) {
+      intel_batchbuffer_flush(intel->batch);
+   }
+
+   BEGIN_BATCH_BLT(6);
+   OUT_BATCH(CMD);
+   OUT_BATCH(BR13);
+   OUT_BATCH((y1 << 16) | x1);
+   OUT_BATCH((y2 << 16) | x2);
+   OUT_RELOC_FENCED(region->buffer,
+                   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+                   0);
+   OUT_BATCH(0xffffffff); /* white, but only alpha gets written */
+   ADVANCE_BATCH();
+
+   intel_batchbuffer_emit_mi_flush(intel->batch);
+}
index 01631465735323d9fc08f76f59084d11f1f10b7f..88322c7b493253150020a51600cf4ad24c72f8f7 100644 (file)
@@ -33,7 +33,7 @@
 extern void intelCopyBuffer(const __DRIdrawable * dpriv,
                             const drm_clip_rect_t * rect);
 
-extern void intelClearWithBlit(struct gl_context * ctx, GLbitfield mask);
+extern GLbitfield intelClearWithBlit(struct gl_context * ctx, GLbitfield mask);
 
 GLboolean
 intelEmitCopyBlit(struct intel_context *intel,
@@ -69,5 +69,7 @@ void intel_emit_linear_blit(struct intel_context *intel,
                            drm_intel_bo *src_bo,
                            unsigned int src_offset,
                            unsigned int size);
+void intel_set_teximage_alpha_to_one(struct gl_context *ctx,
+                                    struct intel_texture_image *intel_image);
 
 #endif
index 87da60a771e86cb20b86a1e2c8afbff64c7e5504..d917161c4be3c41f9c3be6616cac62c321dbf440 100644 (file)
@@ -27,6 +27,7 @@
 
 
 #include "main/imports.h"
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
 #include "main/bufferobj.h"
index fa451f0045ecaf4dd8ec8a9b8fad17d565447833..82d29e76712b0c94f6caafa5cfa059e6f848054e 100644 (file)
@@ -85,6 +85,8 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
    GLbitfield blit_mask = 0;
    GLbitfield swrast_mask = 0;
    struct gl_framebuffer *fb = ctx->DrawBuffer;
+   struct intel_renderbuffer *irb;
+   int i;
 
    if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) {
       intel->front_buffer_dirty = GL_TRUE;
@@ -93,6 +95,22 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
    if (0)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
+   /* Get SW clears out of the way: Anything without an intel_renderbuffer */
+   for (i = 0; i < BUFFER_COUNT; i++) {
+      if (!(mask & (1 << i)))
+        continue;
+
+      irb = intel_get_renderbuffer(fb, i);
+      if (unlikely(!irb)) {
+        swrast_mask |= (1 << i);
+        mask &= ~(1 << i);
+      }
+   }
+   if (unlikely(swrast_mask)) {
+      debug_mask("swrast", swrast_mask);
+      _swrast_Clear(ctx, swrast_mask);
+   }
+
    /* HW color buffers (front, back, aux, generic FBO, etc) */
    if (colorMask == ~0) {
       /* clear all R,G,B,A */
@@ -151,44 +169,18 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
       }
    }
 
-   if (intel->gen >= 6) {
-      /* Blits are in a different ringbuffer so we don't use them. */
-      tri_mask |= blit_mask;
-      blit_mask = 0;
-   }
-
-   /* SW fallback clearing */
-   swrast_mask = mask & ~tri_mask & ~blit_mask;
-
-   {
-      /* look for non-Intel renderbuffers (clear them with swrast) */
-      GLbitfield blit_or_tri = blit_mask | tri_mask;
-      while (blit_or_tri) {
-         GLuint i = _mesa_ffs(blit_or_tri) - 1;
-         GLbitfield bufBit = 1 << i;
-         if (!fb->Attachment[i].Renderbuffer->ClassID) {
-            blit_mask &= ~bufBit;
-            tri_mask &= ~bufBit;
-            swrast_mask |= bufBit;
-         }
-         blit_or_tri ^= bufBit;
-      }
-   }
+   /* Anything left, just use tris */
+   tri_mask |= mask & ~blit_mask;
 
    if (blit_mask) {
       debug_mask("blit", blit_mask);
-      intelClearWithBlit(ctx, blit_mask);
+      tri_mask |= intelClearWithBlit(ctx, blit_mask);
    }
 
    if (tri_mask) {
       debug_mask("tri", tri_mask);
       _mesa_meta_Clear(&intel->ctx, tri_mask);
    }
-
-   if (swrast_mask) {
-      debug_mask("swrast", swrast_mask);
-      _swrast_Clear(ctx, swrast_mask);
-   }
 }
 
 
index 152cdcaf37d69b73fbc166a27413697c0e5cf0b5..2a5029964befbf805aa928d993acb2627b103255 100644 (file)
@@ -519,7 +519,6 @@ static const struct dri_debug_control debug_control[] = {
    { "sing",  DEBUG_SINGLE_THREAD },
    { "thre",  DEBUG_SINGLE_THREAD },
    { "wm",    DEBUG_WM },
-   { "glsl_force", DEBUG_GLSL_FORCE },
    { "urb",   DEBUG_URB },
    { "vs",    DEBUG_VS },
    { "clip",  DEBUG_CLIP },
@@ -566,7 +565,8 @@ intel_glFlush(struct gl_context *ctx)
 
    intel_flush(ctx);
    intel_flush_front(ctx);
-   intel->need_throttle = GL_TRUE;
+   if (intel->is_front_buffer_rendering)
+      intel->need_throttle = GL_TRUE;
 }
 
 void
@@ -683,6 +683,69 @@ intelInitContext(struct intel_context *intel,
       }
    }
 
+   memset(&ctx->TextureFormatSupported, 0,
+         sizeof(ctx->TextureFormatSupported));
+   ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = GL_TRUE;
+   if (intel->has_xrgb_textures)
+      ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_L8] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_A8] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_I8] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_AL88] = GL_TRUE;
+   if (intel->gen >= 4)
+      ctx->TextureFormatSupported[MESA_FORMAT_AL1616] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = GL_TRUE;
+   /*
+    * This was disabled in initial FBO enabling to avoid combinations
+    * of depth+stencil that wouldn't work together.  We since decided
+    * that it was OK, since it's up to the app to come up with the
+    * combo that actually works, so this can probably be re-enabled.
+    */
+   /*
+   ctx->TextureFormatSupported[MESA_FORMAT_Z16] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_Z24] = GL_TRUE;
+   */
+
+   /* ctx->Extensions.MESA_ycbcr_texture */
+   ctx->TextureFormatSupported[MESA_FORMAT_YCBCR] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_YCBCR_REV] = GL_TRUE;
+
+   /* GL_3DFX_texture_compression_FXT1 */
+   ctx->TextureFormatSupported[MESA_FORMAT_RGB_FXT1] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_FXT1] = GL_TRUE;
+
+   /* GL_EXT_texture_compression_s3tc */
+   ctx->TextureFormatSupported[MESA_FORMAT_RGB_DXT1] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT1] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT3] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT5] = GL_TRUE;
+
+#ifndef I915
+   /* GL_ARB_texture_rg */
+   ctx->TextureFormatSupported[MESA_FORMAT_R8] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_R16] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_RG88] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_RG1616] = GL_TRUE;
+
+   ctx->TextureFormatSupported[MESA_FORMAT_DUDV8] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_SIGNED_RGBA8888_REV] = GL_TRUE;
+
+   /* GL_EXT_texture_sRGB */
+   ctx->TextureFormatSupported[MESA_FORMAT_SARGB8] = GL_TRUE;
+   if (intel->gen >= 5 || intel->is_g4x)
+      ctx->TextureFormatSupported[MESA_FORMAT_SRGB_DXT1] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_SRGBA_DXT1] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_SRGBA_DXT3] = GL_TRUE;
+   ctx->TextureFormatSupported[MESA_FORMAT_SRGBA_DXT5] = GL_TRUE;
+   if (intel->has_luminance_srgb) {
+      ctx->TextureFormatSupported[MESA_FORMAT_SL8] = GL_TRUE;
+      ctx->TextureFormatSupported[MESA_FORMAT_SLA8] = GL_TRUE;
+   }
+#endif
+
    driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
                        sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915");
    if (intelScreen->deviceID == PCI_CHIP_I865_G)
@@ -800,11 +863,6 @@ intelInitContext(struct intel_context *intel,
    if (INTEL_DEBUG & DEBUG_BUFMGR)
       dri_bufmgr_set_debug(intel->bufmgr, GL_TRUE);
 
-   /* XXX force SIMD8 kernel for Sandybridge before we fixed
-      SIMD16 interpolation. */
-   if (intel->gen == 6)
-       INTEL_DEBUG |= DEBUG_GLSL_FORCE;
-
    intel->batch = intel_batchbuffer_alloc(intel);
 
    intel_fbo_init(intel);
@@ -838,11 +896,6 @@ intelInitContext(struct intel_context *intel,
       intel->always_flush_cache = 1;
    }
 
-   /* Disable all hardware rendering (skip emitting batches and fences/waits
-    * to the kernel)
-    */
-   intel->no_hw = getenv("INTEL_NO_HW") != NULL;
-
    return GL_TRUE;
 }
 
index 9d5139c00003bc7c06a5d8eb04c0801c8a9e7d91..fd3c3ba58fcb77a1534a7c2940ef643331db8bc9 100644 (file)
@@ -29,7 +29,7 @@
 #define INTELCONTEXT_INC
 
 
-
+#include <stdbool.h>
 #include "main/mtypes.h"
 #include "main/mm.h"
 #include "dri_metaops.h"
@@ -149,6 +149,7 @@ struct intel_context
       void (*assert_not_dirty) (struct intel_context *intel);
 
       void (*debug_batch)(struct intel_context *intel);
+      bool (*render_target_supported)(gl_format format);
    } vtbl;
 
    struct dri_metaops meta;
@@ -207,7 +208,6 @@ struct intel_context
    GLboolean hw_stipple;
    GLboolean depth_buffer_is_float;
    GLboolean no_rast;
-   GLboolean no_hw;
    GLboolean always_flush_batch;
    GLboolean always_flush_cache;
 
@@ -362,7 +362,6 @@ extern int INTEL_DEBUG;
 #define DEBUG_WM        0x800000
 #define DEBUG_URB       0x1000000
 #define DEBUG_VS        0x2000000
-#define DEBUG_GLSL_FORCE 0x4000000
 #define DEBUG_CLIP      0x8000000
 
 #define DBG(...) do {                                          \
index 556a4195bddbe8701c404c28ea8b1a2595283e2c..fab533f39fc6c61a9e1be6a08c22a6e86be72e13 100644 (file)
  * 
  **************************************************************************/
 
+#include "main/mfeatures.h"
+
 #include "intel_chipset.h"
 #include "intel_context.h"
 #include "intel_extensions.h"
 #include "utils.h"
 
 
+#define need_GL_ARB_ES2_compatibility
 #define need_GL_ARB_draw_elements_base_vertex
 #define need_GL_ARB_framebuffer_object
 #define need_GL_ARB_map_buffer_range
  * i965_dri.
  */
 static const struct dri_extension card_extensions[] = {
+   { "GL_ARB_ES2_compatibility",          GL_ARB_ES2_compatibility_functions },
    { "GL_ARB_draw_elements_base_vertex",  GL_ARB_draw_elements_base_vertex_functions },
    { "GL_ARB_explicit_attrib_location",   NULL },
+   { "GL_ARB_framebuffer_object",         GL_ARB_framebuffer_object_functions},
    { "GL_ARB_half_float_pixel",           NULL },
    { "GL_ARB_map_buffer_range",           GL_ARB_map_buffer_range_functions },
    { "GL_ARB_multitexture",               NULL },
@@ -161,7 +166,6 @@ static const struct dri_extension brw_extensions[] = {
    { "GL_ARB_fragment_program",           NULL },
    { "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 },
index 71c86339c7268a5ae6c03cba315c00d8d0c43e6e..5ef6b0561deac883b1eb68269db14cda1e4cb4bc 100644 (file)
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 #include "main/extensions.h"
+#include "main/mfeatures.h"
 
 #include "intel_extensions.h"
 
@@ -62,6 +63,7 @@ static const char *es2_extensions[] = {
    "GL_EXT_blend_minmax",
    "GL_EXT_blend_subtract",
    "GL_EXT_stencil_wrap",
+   "GL_NV_blend_square",
 
    /* Optional GLES2 */
    "GL_ARB_framebuffer_object",
@@ -78,6 +80,17 @@ static const char *es2_extensions[] = {
    NULL,
 };
 
+/**
+ * \brief Extensions to disable.
+ *
+ * These extensions must be manually disabled because they may have been
+ * enabled by default.
+ */
+static const char* es2_extensions_disabled[] = {
+   "GL_OES_standard_derivatives",
+   NULL,
+};
+
 /**
  * Initializes potential list of extensions if ctx == NULL, or actually enables
  * extensions for a context.
@@ -92,4 +105,6 @@ intelInitExtensionsES2(struct gl_context *ctx)
 
    for (i = 0; es2_extensions[i]; i++)
       _mesa_enable_extension(ctx, es2_extensions[i]);
+   for (i = 0; es2_extensions_disabled[i]; i++)
+      _mesa_disable_extension(ctx, es2_extensions_disabled[i]);
 }
index 862a13d2ea51605aeb39ecd8452a060c80d25192..0db5a491c8fa3cb493fb43f39ebee31165e03cd0 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "main/fbobject.h"
 #include "main/framebuffer.h"
 #include "intel_fbo.h"
 #include "intel_mipmap_tree.h"
 #include "intel_regions.h"
+#include "intel_tex.h"
+#include "intel_span.h"
+#ifndef I915
+#include "brw_context.h"
+#endif
 
 #define FILE_DEBUG_FLAG DEBUG_FBO
 
@@ -107,79 +113,27 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
    ASSERT(rb->Name != 0);
 
    switch (internalFormat) {
-   case GL_RED:
-   case GL_R8:
-      rb->Format = MESA_FORMAT_R8;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      break;
-   case GL_R16:
-      rb->Format = MESA_FORMAT_R16;
-      rb->DataType = GL_UNSIGNED_SHORT;
-      break;
-   case GL_RG:
-   case GL_RG8:
-      rb->Format = MESA_FORMAT_RG88;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      break;
-   case GL_RG16:
-      rb->Format = MESA_FORMAT_RG1616;
-      rb->DataType = GL_UNSIGNED_SHORT;
-      break;
-   case GL_R3_G3_B2:
-   case GL_RGB4:
-   case GL_RGB5:
-      rb->Format = MESA_FORMAT_RGB565;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      break;
-   case GL_RGB:
-   case GL_RGB8:
-   case GL_RGB10:
-   case GL_RGB12:
-   case GL_RGB16:
-      rb->Format = MESA_FORMAT_XRGB8888;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      break;
-   case GL_RGBA:
-   case GL_RGBA2:
-   case GL_RGBA4:
-   case GL_RGB5_A1:
-   case GL_RGBA8:
-   case GL_RGB10_A2:
-   case GL_RGBA12:
-   case GL_RGBA16:
-      rb->Format = MESA_FORMAT_ARGB8888;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      break;
-   case GL_ALPHA:
-   case GL_ALPHA8:
-      rb->Format = MESA_FORMAT_A8;
-      rb->DataType = GL_UNSIGNED_BYTE;
-      break;
-   case GL_DEPTH_COMPONENT16:
-      rb->Format = MESA_FORMAT_Z16;
-      rb->DataType = GL_UNSIGNED_SHORT;
+   default:
+      /* Use the same format-choice logic as for textures.
+       * Renderbuffers aren't any different from textures for us,
+       * except they're less useful because you can't texture with
+       * them.
+       */
+      rb->Format = intel->ctx.Driver.ChooseTextureFormat(ctx, internalFormat,
+                                                        GL_NONE, GL_NONE);
       break;
    case GL_STENCIL_INDEX:
    case GL_STENCIL_INDEX1_EXT:
    case GL_STENCIL_INDEX4_EXT:
    case GL_STENCIL_INDEX8_EXT:
    case GL_STENCIL_INDEX16_EXT:
-   case GL_DEPTH_COMPONENT:
-   case GL_DEPTH_COMPONENT24:
-   case GL_DEPTH_COMPONENT32:
-   case GL_DEPTH_STENCIL_EXT:
-   case GL_DEPTH24_STENCIL8_EXT:
-      /* alloc a depth+stencil buffer */
+      /* These aren't actual texture formats, so force them here. */
       rb->Format = MESA_FORMAT_S8_Z24;
-      rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
       break;
-   default:
-      _mesa_problem(ctx,
-                    "Unexpected format in intel_alloc_renderbuffer_storage");
-      return GL_FALSE;
    }
 
    rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
+   rb->DataType = intel_mesa_format_to_rb_datatype(rb->Format);
    cpp = _mesa_get_format_bytes(rb->Format);
 
    intel_flush(ctx);
@@ -195,10 +149,15 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
    DBG("Allocating %d x %d Intel RBO\n", width, height);
 
    tiling = I915_TILING_NONE;
+   if (intel->use_texture_tiling) {
+      GLenum base_format = _mesa_get_format_base_format(rb->Format);
 
-   /* Gen6 requires depth must be tiling */
-   if (intel->gen >= 6 && rb->Format == MESA_FORMAT_S8_Z24)
-       tiling = I915_TILING_Y;
+      if (intel->gen >= 4 && (base_format == GL_DEPTH_COMPONENT ||
+                             base_format == GL_DEPTH_STENCIL))
+        tiling = I915_TILING_Y;
+      else
+        tiling = I915_TILING_X;
+   }
 
    irb->region = intel_region_alloc(intel->intelScreen, tiling, cpp,
                                    width, height, GL_TRUE);
@@ -334,53 +293,10 @@ intel_create_renderbuffer(gl_format format)
 
    _mesa_init_renderbuffer(&irb->Base, 0);
    irb->Base.ClassID = INTEL_RB_CLASS;
-
-   switch (format) {
-   case MESA_FORMAT_RGB565:
-      irb->Base._BaseFormat = GL_RGB;
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      break;
-   case MESA_FORMAT_XRGB8888:
-      irb->Base._BaseFormat = GL_RGB;
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      break;
-   case MESA_FORMAT_ARGB8888:
-      irb->Base._BaseFormat = GL_RGBA;
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      break;
-   case MESA_FORMAT_Z16:
-      irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
-      irb->Base.DataType = GL_UNSIGNED_SHORT;
-      break;
-   case MESA_FORMAT_X8_Z24:
-      irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
-      irb->Base.DataType = GL_UNSIGNED_INT;
-      break;
-   case MESA_FORMAT_S8_Z24:
-      irb->Base._BaseFormat = GL_DEPTH_STENCIL;
-      irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
-      break;
-   case MESA_FORMAT_A8:
-      irb->Base._BaseFormat = GL_ALPHA;
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      break;
-   case MESA_FORMAT_R8:
-      irb->Base._BaseFormat = GL_RED;
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      break;
-   case MESA_FORMAT_RG88:
-      irb->Base._BaseFormat = GL_RG;
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      break;
-   default:
-      _mesa_problem(NULL,
-                    "Unexpected intFormat in intel_create_renderbuffer");
-      free(irb);
-      return NULL;
-   }
-
+   irb->Base._BaseFormat = _mesa_get_format_base_format(format);
    irb->Base.Format = format;
    irb->Base.InternalFormat = irb->Base._BaseFormat;
+   irb->Base.DataType = intel_mesa_format_to_rb_datatype(format);
 
    /* intel-specific methods */
    irb->Base.Delete = intel_delete_renderbuffer;
@@ -457,66 +373,16 @@ static GLboolean
 intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb, 
                     struct gl_texture_image *texImage)
 {
-   if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to RGBA8 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_XRGB8888) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to XGBA8 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_SARGB8) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to SARGB8 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_RGB565) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to RGB5 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to ARGB1555 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to ARGB4444 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_A8) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to A8 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_R8) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to R8 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_RG88) {
-      irb->Base.DataType = GL_UNSIGNED_BYTE;
-      DBG("Render to RG88 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_R16) {
-      irb->Base.DataType = GL_UNSIGNED_SHORT;
-      DBG("Render to R8 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_RG1616) {
-      irb->Base.DataType = GL_UNSIGNED_SHORT;
-      DBG("Render to RG88 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_Z16) {
-      irb->Base.DataType = GL_UNSIGNED_SHORT;
-      DBG("Render to DEPTH16 texture OK\n");
-   }
-   else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) {
-      irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
-      DBG("Render to DEPTH_STENCIL texture OK\n");
-   }
-   else {
+   if (!intel_span_supports_format(texImage->TexFormat)) {
       DBG("Render to texture BAD FORMAT %s\n",
          _mesa_get_format_name(texImage->TexFormat));
       return GL_FALSE;
+   } else {
+      DBG("Render to texture %s\n", _mesa_get_format_name(texImage->TexFormat));
    }
 
    irb->Base.Format = texImage->TexFormat;
-
+   irb->Base.DataType = intel_mesa_format_to_rb_datatype(texImage->TexFormat);
    irb->Base.InternalFormat = texImage->InternalFormat;
    irb->Base._BaseFormat = _mesa_base_fbo_format(ctx, irb->Base.InternalFormat);
    irb->Base.Width = texImage->Width;
@@ -558,6 +424,24 @@ intel_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage)
    return irb;
 }
 
+static void
+intel_set_draw_offset_for_image(struct intel_texture_image *intel_image,
+                               int zoffset)
+{
+   struct intel_mipmap_tree *mt = intel_image->mt;
+   unsigned int dst_x, dst_y;
+
+   /* compute offset of the particular 2D image within the texture region */
+   intel_miptree_get_image_offset(intel_image->mt,
+                                 intel_image->level,
+                                 intel_image->face,
+                                 zoffset,
+                                 &dst_x, &dst_y);
+
+   mt->region->draw_offset = (dst_y * mt->region->pitch + dst_x) * mt->cpp;
+   mt->region->draw_x = dst_x;
+   mt->region->draw_y = dst_y;
+}
 
 /**
  * Called by glFramebufferTexture[123]DEXT() (and other places) to
@@ -574,7 +458,6 @@ intel_render_texture(struct gl_context * ctx,
       = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
    struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
    struct intel_texture_image *intel_image;
-   GLuint dst_x, dst_y;
 
    (void) fb;
 
@@ -620,19 +503,53 @@ intel_render_texture(struct gl_context * ctx,
       intel_region_reference(&irb->region, intel_image->mt->region);
    }
 
-   /* compute offset of the particular 2D image within the texture region */
-   intel_miptree_get_image_offset(intel_image->mt,
-                                 att->TextureLevel,
-                                 att->CubeMapFace,
-                                 att->Zoffset,
-                                 &dst_x, &dst_y);
-
-   intel_image->mt->region->draw_offset = (dst_y * intel_image->mt->region->pitch +
-                                          dst_x) * intel_image->mt->cpp;
-   intel_image->mt->region->draw_x = dst_x;
-   intel_image->mt->region->draw_y = dst_y;
+   intel_set_draw_offset_for_image(intel_image, att->Zoffset);
    intel_image->used_as_render_target = GL_TRUE;
 
+#ifndef I915
+   if (!brw_context(ctx)->has_surface_tile_offset &&
+       (intel_image->mt->region->draw_offset & 4095) != 0) {
+      /* Original gen4 hardware couldn't draw to a non-tile-aligned
+       * destination in a miptree unless you actually setup your
+       * renderbuffer as a miptree and used the fragile
+       * lod/array_index/etc. controls to select the image.  So,
+       * instead, we just make a new single-level miptree and render
+       * into that.
+       */
+      struct intel_context *intel = intel_context(ctx);
+      struct intel_mipmap_tree *old_mt = intel_image->mt;
+      struct intel_mipmap_tree *new_mt;
+      int comp_byte = 0, texel_bytes;
+
+      if (_mesa_is_format_compressed(intel_image->base.TexFormat))
+        comp_byte = intel_compressed_num_bytes(intel_image->base.TexFormat);
+
+      texel_bytes = _mesa_get_format_bytes(intel_image->base.TexFormat);
+
+      new_mt = intel_miptree_create(intel, newImage->TexObject->Target,
+                                   intel_image->base._BaseFormat,
+                                   intel_image->base.InternalFormat,
+                                   intel_image->level,
+                                   intel_image->level,
+                                   intel_image->base.Width,
+                                   intel_image->base.Height,
+                                   intel_image->base.Depth,
+                                   texel_bytes, comp_byte, GL_TRUE);
+
+      intel_miptree_image_copy(intel,
+                               new_mt,
+                               intel_image->face,
+                              intel_image->level,
+                              old_mt);
+
+      intel_miptree_release(intel, &intel_image->mt);
+      intel_image->mt = new_mt;
+      intel_set_draw_offset_for_image(intel_image, att->Zoffset);
+
+      intel_region_release(&irb->region);
+      intel_region_reference(&irb->region, intel_image->mt->region);
+   }
+#endif
    /* update drawing region, etc */
    intel_draw_buffer(ctx, fb);
 }
@@ -655,7 +572,8 @@ intel_finish_render_texture(struct gl_context * ctx,
        _glthread_GetID(), att->Texture->Name);
 
    /* Flag that this image may now be validated into the object's miptree. */
-   intel_image->used_as_render_target = GL_FALSE;
+   if (intel_image)
+      intel_image->used_as_render_target = GL_FALSE;
 
    /* Since we've (probably) rendered to the texture and will (likely) use
     * it in the texture domain later on in this batchbuffer, flush the
@@ -671,6 +589,7 @@ intel_finish_render_texture(struct gl_context * ctx,
 static void
 intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
 {
+   struct intel_context *intel = intel_context(ctx);
    const struct intel_renderbuffer *depthRb =
       intel_get_renderbuffer(fb, BUFFER_DEPTH);
    const struct intel_renderbuffer *stencilRb =
@@ -678,10 +597,10 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
    int i;
 
    if (depthRb && stencilRb && stencilRb != depthRb) {
-      if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Type == GL_TEXTURE &&
-         ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Type == GL_TEXTURE &&
-         (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Texture->Name ==
-          ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Texture->Name)) {
+      if (fb->Attachment[BUFFER_DEPTH].Type == GL_TEXTURE &&
+         fb->Attachment[BUFFER_STENCIL].Type == GL_TEXTURE &&
+         (fb->Attachment[BUFFER_DEPTH].Texture->Name ==
+          fb->Attachment[BUFFER_STENCIL].Texture->Name)) {
         /* OK */
       } else {
         /* we only support combined depth/stencil buffers, not separate
@@ -694,33 +613,35 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
       }
    }
 
-   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
-      struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+   for (i = 0; i < Elements(fb->Attachment); i++) {
+      struct gl_renderbuffer *rb;
+      struct intel_renderbuffer *irb;
+
+      if (fb->Attachment[i].Type == GL_NONE)
+        continue;
 
-      if (rb == NULL)
+      /* A supported attachment will have a Renderbuffer set either
+       * from being a Renderbuffer or being a texture that got the
+       * intel_wrap_texture() treatment.
+       */
+      rb = fb->Attachment[i].Renderbuffer;
+      if (rb == NULL) {
+        DBG("attachment without renderbuffer\n");
+        fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
         continue;
+      }
 
+      irb = intel_renderbuffer(rb);
       if (irb == NULL) {
         DBG("software rendering renderbuffer\n");
         fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
         continue;
       }
 
-      switch (irb->Base.Format) {
-      case MESA_FORMAT_ARGB8888:
-      case MESA_FORMAT_XRGB8888:
-      case MESA_FORMAT_SARGB8:
-      case MESA_FORMAT_RGB565:
-      case MESA_FORMAT_ARGB1555:
-      case MESA_FORMAT_ARGB4444:
-      case MESA_FORMAT_A8:
-      case MESA_FORMAT_R8:
-      case MESA_FORMAT_R16:
-      case MESA_FORMAT_RG88:
-      case MESA_FORMAT_RG1616:
-        break;
-      default:
+      if (!intel_span_supports_format(irb->Base.Format) ||
+         !intel->vtbl.render_target_supported(irb->Base.Format)) {
+        DBG("Unsupported texture/renderbuffer format attached: %s\n",
+            _mesa_get_format_name(irb->Base.Format));
         fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
       }
    }
index 9c4e5c5ee8c9288108d22c63208ea08156cb1655..a3409274fb7f4b418a7a5a771a57c2770df1927e 100644 (file)
@@ -157,8 +157,6 @@ struct intel_mipmap_tree *
 intel_miptree_create_for_region(struct intel_context *intel,
                                GLenum target,
                                GLenum internal_format,
-                               GLuint first_level,
-                               GLuint last_level,
                                struct intel_region *region,
                                GLuint depth0,
                                GLuint compress_byte)
@@ -166,7 +164,7 @@ intel_miptree_create_for_region(struct intel_context *intel,
    struct intel_mipmap_tree *mt;
 
    mt = intel_miptree_create_internal(intel, target, internal_format,
-                                     first_level, last_level,
+                                     0, 0,
                                      region->width, region->height, 1,
                                      region->cpp, compress_byte,
                                      I915_TILING_NONE);
index 21db2f4d3b3c191a028cf6536491b5e72d9c2316..760a8bce60144fc9f69f11983909ccedfc91b67d 100644 (file)
@@ -137,8 +137,6 @@ struct intel_mipmap_tree *
 intel_miptree_create_for_region(struct intel_context *intel,
                                GLenum target,
                                GLenum internal_format,
-                               GLuint first_level,
-                               GLuint last_level,
                                struct intel_region *region,
                                GLuint depth0,
                                GLuint compress_byte);
index 955b100b212e088b921badfebcd397665e42c434..5258699d3f948a71dbdbd4ed8265883dc33bbe46 100644 (file)
@@ -37,6 +37,8 @@
 #define FLUSH_MAP_CACHE                                (1 << 0)
 #define INHIBIT_FLUSH_RENDER_CACHE             (1 << 2)
 
+#define MI_FLUSH_DW                    (CMD_MI | (0x26 << 23) | 2)
+
 /* Stalls command execution waiting for the given events to have occurred. */
 #define MI_WAIT_FOR_EVENT               (CMD_MI | (0x3 << 23))
 #define MI_WAIT_FOR_PLANE_B_FLIP        (1<<6)
index 061f0d278d6a99d050c6dc9aad436c639246396f..5d14bcd34c082574af1343f9d9420f90c53d7022 100644 (file)
 #include "main/renderbuffer.h"
 #include "main/hash.h"
 #include "main/fbobject.h"
+#include "main/mfeatures.h"
 
 #include "utils.h"
 #include "xmlpool.h"
 
-#include "intel_batchbuffer.h"
-#include "intel_buffers.h"
-#include "intel_bufmgr.h"
-#include "intel_chipset.h"
-#include "intel_fbo.h"
-#include "intel_screen.h"
-#include "intel_tex.h"
-#include "intel_regions.h"
-
-#include "i915_drm.h"
-
-#define DRI_CONF_TEXTURE_TILING(def) \
-
 PUBLIC const char __driConfigOptions[] =
    DRI_CONF_BEGIN
    DRI_CONF_SECTION_PERFORMANCE
@@ -92,6 +80,17 @@ DRI_CONF_END;
 
 const GLuint __driNConfigOptions = 11;
 
+#include "intel_batchbuffer.h"
+#include "intel_buffers.h"
+#include "intel_bufmgr.h"
+#include "intel_chipset.h"
+#include "intel_fbo.h"
+#include "intel_screen.h"
+#include "intel_tex.h"
+#include "intel_regions.h"
+
+#include "i915_drm.h"
+
 #ifdef USE_NEW_INTERFACE
 static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
 #endif /*USE_NEW_INTERFACE */
@@ -452,7 +451,7 @@ intelCreateContext(gl_api api,
       return brwCreateContext(api, mesaVis,
                              driContextPriv, sharedContextPrivate);
 #endif
-   fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID);
+   fprintf(stderr, "Unrecognized deviceID 0x%x\n", intelScreen->deviceID);
    return GL_FALSE;
 }
 
@@ -462,7 +461,8 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
    __DRIscreen *spriv = intelScreen->driScrnPriv;
    int num_fences = 0;
 
-   intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
+   intelScreen->no_hw = (getenv("INTEL_NO_HW") != NULL ||
+                        getenv("INTEL_DEVID_OVERRIDE") != NULL);
 
    intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
    if (intelScreen->bufmgr == NULL) {
@@ -497,6 +497,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
    GLenum fb_format[3];
    GLenum fb_type[3];
    unsigned int api_mask;
+   char *devid_override;
 
    static const GLenum back_buffer_modes[] = {
        GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
@@ -523,6 +524,16 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
                        &intelScreen->deviceID))
       return GL_FALSE;
 
+   /* Allow an override of the device ID for the purpose of making the
+    * driver produce dumps for debugging of new chipset enablement.
+    * This implies INTEL_NO_HW, to avoid programming your actual GPU
+    * incorrectly.
+    */
+   devid_override = getenv("INTEL_DEVID_OVERRIDE");
+   if (devid_override) {
+      intelScreen->deviceID = strtod(devid_override, NULL);
+   }
+
    api_mask = (1 << __DRI_API_OPENGL);
 #if FEATURE_ES1
    api_mask |= (1 << __DRI_API_GLES);
index 104cadf0f9eea66b238615ff673596fd1e1b7e33..1f41518535c05f787acde9d55c067ebbf21129d2 100644 (file)
@@ -25,6 +25,7 @@
  * 
  **************************************************************************/
 
+#include <stdbool.h>
 #include "main/glheader.h"
 #include "main/macros.h"
 #include "main/mtypes.h"
@@ -113,6 +114,26 @@ intel_set_span_functions(struct intel_context *intel,
 #define TAG2(x,y) intel_##x##y##_A8
 #include "spantmp2.h"
 
+#define SPANTMP_MESA_FMT MESA_FORMAT_R8
+#define TAG(x) intel_##x##_R8
+#define TAG2(x,y) intel_##x##y##_R8
+#include "spantmp2.h"
+
+#define SPANTMP_MESA_FMT MESA_FORMAT_RG88
+#define TAG(x) intel_##x##_RG88
+#define TAG2(x,y) intel_##x##y##_RG88
+#include "spantmp2.h"
+
+#define SPANTMP_MESA_FMT MESA_FORMAT_R16
+#define TAG(x) intel_##x##_R16
+#define TAG2(x,y) intel_##x##y##_R16
+#include "spantmp2.h"
+
+#define SPANTMP_MESA_FMT MESA_FORMAT_RG1616
+#define TAG(x) intel_##x##_RG1616
+#define TAG2(x,y) intel_##x##y##_RG1616
+#include "spantmp2.h"
+
 #define LOCAL_DEPTH_VARS                                               \
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);            \
    const GLint yScale = rb->Name ? 1 : -1;                             \
@@ -339,6 +360,32 @@ intel_unmap_vertex_shader_textures(struct gl_context *ctx)
    }
 }
 
+typedef void (*span_init_func)(struct gl_renderbuffer *rb);
+
+static span_init_func intel_span_init_funcs[MESA_FORMAT_COUNT] =
+{
+   [MESA_FORMAT_A8] = intel_InitPointers_A8,
+   [MESA_FORMAT_RGB565] = intel_InitPointers_RGB565,
+   [MESA_FORMAT_ARGB4444] = intel_InitPointers_ARGB4444,
+   [MESA_FORMAT_ARGB1555] = intel_InitPointers_ARGB1555,
+   [MESA_FORMAT_XRGB8888] = intel_InitPointers_xRGB8888,
+   [MESA_FORMAT_ARGB8888] = intel_InitPointers_ARGB8888,
+   [MESA_FORMAT_SARGB8] = intel_InitPointers_ARGB8888,
+   [MESA_FORMAT_Z16] = intel_InitDepthPointers_z16,
+   [MESA_FORMAT_X8_Z24] = intel_InitDepthPointers_z24_s8,
+   [MESA_FORMAT_S8_Z24] = intel_InitDepthPointers_z24_s8,
+   [MESA_FORMAT_R8] = intel_InitPointers_R8,
+   [MESA_FORMAT_RG88] = intel_InitPointers_RG88,
+   [MESA_FORMAT_R16] = intel_InitPointers_R16,
+   [MESA_FORMAT_RG1616] = intel_InitPointers_RG1616,
+};
+
+bool
+intel_span_supports_format(gl_format format)
+{
+   return intel_span_init_funcs[format] != NULL;
+}
+
 /**
  * Plug in appropriate span read/write functions for the given renderbuffer.
  * These are used for the software fallbacks.
@@ -349,37 +396,6 @@ intel_set_span_functions(struct intel_context *intel,
 {
    struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
 
-   switch (irb->Base.Format) {
-   case MESA_FORMAT_A8:
-      intel_InitPointers_A8(rb);
-      break;
-   case MESA_FORMAT_RGB565:
-      intel_InitPointers_RGB565(rb);
-      break;
-   case MESA_FORMAT_ARGB4444:
-      intel_InitPointers_ARGB4444(rb);
-      break;
-   case MESA_FORMAT_ARGB1555:
-      intel_InitPointers_ARGB1555(rb);
-      break;
-   case MESA_FORMAT_XRGB8888:
-      intel_InitPointers_xRGB8888(rb);
-      break;
-   case MESA_FORMAT_ARGB8888:
-   case MESA_FORMAT_SARGB8:
-      intel_InitPointers_ARGB8888(rb);
-      break;
-   case MESA_FORMAT_Z16:
-      intel_InitDepthPointers_z16(rb);
-      break;
-   case MESA_FORMAT_X8_Z24:
-   case MESA_FORMAT_S8_Z24:
-      intel_InitDepthPointers_z24_s8(rb);
-      break;
-   default:
-      _mesa_problem(NULL,
-                   "Unexpected MesaFormat %d in intelSetSpanFunctions",
-                   irb->Base.Format);
-      break;
-   }
+   assert(intel_span_init_funcs[irb->Base.Format]);
+   intel_span_init_funcs[irb->Base.Format](rb);
 }
index aa8d08e843a95872e3ffaa5bba37221d93c5de40..5a4c4e8e52a5a26d3e233d808954869de405e548 100644 (file)
@@ -28,6 +28,9 @@
 #ifndef _INTEL_SPAN_H
 #define _INTEL_SPAN_H
 
+#include "main/formats.h"
+#include <stdbool.h>
+
 extern void intelInitSpanFuncs(struct gl_context * ctx);
 
 extern void intelSpanRenderFinish(struct gl_context * ctx);
@@ -38,5 +41,6 @@ void intel_renderbuffer_unmap(struct intel_context *intel,
                              struct gl_renderbuffer *rb);
 void intel_map_vertex_shader_textures(struct gl_context *ctx);
 void intel_unmap_vertex_shader_textures(struct gl_context *ctx);
+bool intel_span_supports_format(gl_format format);
 
 #endif
index 2c21ea0576e9a56a9dccf49e34a65c72187efe72..2c3eab20fdadf9212dac42c8b8ce3882c2df6e3a 100644 (file)
@@ -113,7 +113,6 @@ intelGenerateMipmap(struct gl_context *ctx, GLenum target,
 void
 intelInitTextureFuncs(struct dd_function_table *functions)
 {
-   functions->ChooseTextureFormat = intelChooseTextureFormat;
    functions->GenerateMipmap = intelGenerateMipmap;
 
    functions->NewTextureObject = intelNewTextureObject;
index 7906554e45349d319db4af8f97c89af733d6b099..6552ed0d332afb78926bc1bdf0ebae56d6972ddb 100644 (file)
@@ -40,8 +40,7 @@ void intelInitTextureSubImageFuncs(struct dd_function_table *functions);
 
 void intelInitTextureCopyImageFuncs(struct dd_function_table *functions);
 
-gl_format intelChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
-                                   GLenum format, GLenum type);
+GLenum intel_mesa_format_to_rb_datatype(gl_format format);
 
 void intelSetTexBuffer(__DRIcontext *pDRICtx,
                       GLint target, __DRIdrawable *pDraw);
index 87b31bf078ce62c66c9d04869317d22633f0035d..a40011ab40c396aad71a2873a2cb62ae2e4f4e0b 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "intel_screen.h"
 #include "intel_context.h"
-#include "intel_buffers.h"
 #include "intel_mipmap_tree.h"
 #include "intel_regions.h"
 #include "intel_fbo.h"
  * Do the best we can using the blitter.  A future project is to use
  * the texture engine and fragment programs for these copies.
  */
-static const struct intel_region *
-get_teximage_source(struct intel_context *intel, GLenum internalFormat)
+static struct intel_renderbuffer *
+get_teximage_readbuffer(struct intel_context *intel, GLenum internalFormat)
 {
-   struct intel_renderbuffer *irb;
-
    DBG("%s %s\n", __FUNCTION__,
        _mesa_lookup_enum_by_nr(internalFormat));
 
    switch (internalFormat) {
    case GL_DEPTH_COMPONENT:
    case GL_DEPTH_COMPONENT16:
-      irb = intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH);
-      if (irb && irb->region && irb->region->cpp == 2)
-         return irb->region;
-      return NULL;
    case GL_DEPTH24_STENCIL8_EXT:
    case GL_DEPTH_STENCIL_EXT:
-      irb = intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH);
-      if (irb && irb->region && irb->region->cpp == 4)
-         return irb->region;
-      return NULL;
-   case 4:
-   case GL_RGBA:
-   case GL_RGBA8:
-      irb = intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
-      /* We're required to set alpha to 1.0 in this case, but we can't
-       * do that with the blitter, so fall back.  We could use the 3D
-       * engine or do two passes with the blitter, but it doesn't seem
-       * worth it for this case. */
-      if (irb->Base._BaseFormat == GL_RGB)
-        return NULL;
-      return irb->region;
-   case 3:
-   case GL_RGB:
-   case GL_RGB8:
-      return intel_readbuf_region(intel);
+      return intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH);
    default:
-      return NULL;
+      return intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
    }
 }
 
@@ -101,23 +76,34 @@ do_copy_texsubimage(struct intel_context *intel,
                     GLint x, GLint y, GLsizei width, GLsizei height)
 {
    struct gl_context *ctx = &intel->ctx;
-   const struct intel_region *src = get_teximage_source(intel, internalFormat);
+   struct intel_renderbuffer *irb;
+   bool copy_supported_with_alpha_override = false;
+
+   intel_prepare_render(intel);
 
-   if (!intelImage->mt || !src || !src->buffer) {
+   irb = get_teximage_readbuffer(intel, internalFormat);
+   if (!intelImage->mt || !irb || !irb->region) {
       if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS))
         fprintf(stderr, "%s fail %p %p (0x%08x)\n",
-                __FUNCTION__, intelImage->mt, src, internalFormat);
+                __FUNCTION__, intelImage->mt, irb, internalFormat);
       return GL_FALSE;
    }
 
-   if (intelImage->mt->cpp != src->cpp) {
-      fallback_debug("%s fail %d vs %d cpp\n",
-                    __FUNCTION__, intelImage->mt->cpp, src->cpp);
+   if (irb->Base.Format == MESA_FORMAT_XRGB8888 &&
+       intelImage->base.TexFormat == MESA_FORMAT_ARGB8888) {
+      copy_supported_with_alpha_override = true;
+   }
+
+   if (intelImage->base.TexFormat != irb->Base.Format &&
+       !copy_supported_with_alpha_override) {
+      if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS))
+        fprintf(stderr, "%s mismatched formats %s, %s\n",
+                __FUNCTION__,
+                _mesa_get_format_name(intelImage->base.TexFormat),
+                _mesa_get_format_name(irb->Base.Format));
       return GL_FALSE;
    }
 
-   /* intel_flush(ctx); */
-   intel_prepare_render(intel);
    {
       drm_intel_bo *dst_bo = intel_region_buffer(intel,
                                                 intelImage->mt->region,
@@ -140,24 +126,24 @@ do_copy_texsubimage(struct intel_context *intel,
       if (ctx->ReadBuffer->Name == 0) {
         /* Flip vertical orientation for system framebuffers */
         y = ctx->ReadBuffer->Height - (y + height);
-        src_pitch = -src->pitch;
+        src_pitch = -irb->region->pitch;
       } else {
         /* reading from a FBO, y is already oriented the way we like */
-        src_pitch = src->pitch;
+        src_pitch = irb->region->pitch;
       }
 
       /* blit from src buffer to texture */
       if (!intelEmitCopyBlit(intel,
                             intelImage->mt->cpp,
                             src_pitch,
-                            src->buffer,
+                            irb->region->buffer,
                             0,
-                            src->tiling,
+                            irb->region->tiling,
                             intelImage->mt->region->pitch,
                             dst_bo,
                             0,
                             intelImage->mt->region->tiling,
-                            src->draw_x + x, src->draw_y + y,
+                            irb->region->draw_x + x, irb->region->draw_y + y,
                             image_x + dstx, image_y + dsty,
                             width, height,
                             GL_COPY)) {
@@ -165,6 +151,9 @@ do_copy_texsubimage(struct intel_context *intel,
       }
    }
 
+   if (copy_supported_with_alpha_override)
+      intel_set_teximage_alpha_to_one(ctx, intelImage);
+
    return GL_TRUE;
 }
 
index 9d73a2fb3757535e0e98d780fe427ddd9b9615eb..87745bc66d4b528c2fbaa62daecb4a964f2c7c33 100644 (file)
 #include "main/formats.h"
 
 /**
- * Choose hardware texture format given the user's glTexImage parameters.
- *
- * It works out that this function is fine for all the supported
- * hardware.  However, there is still a need to map the formats onto
- * hardware descriptors.
- *
- * Note that the i915 can actually support many more formats than
- * these if we take the step of simply swizzling the colors
- * immediately after sampling...
+ * Returns the renderbuffer DataType for a MESA_FORMAT.
  */
-gl_format
-intelChooseTextureFormat(struct gl_context * ctx, GLint internalFormat,
-                         GLenum format, GLenum type)
+GLenum
+intel_mesa_format_to_rb_datatype(gl_format format)
 {
-   struct intel_context *intel = intel_context(ctx);
-
-#if 0
-   printf("%s intFmt=0x%x format=0x%x type=0x%x\n",
-          __FUNCTION__, internalFormat, format, type);
-#endif
-
-   switch (internalFormat) {
-   case 4:
-   case GL_RGBA:
-   case GL_COMPRESSED_RGBA:
-      if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV)
-        return MESA_FORMAT_ARGB4444;
-      else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV)
-        return MESA_FORMAT_ARGB1555;
-      else
-        return MESA_FORMAT_ARGB8888;
-
-   case 3:
-   case GL_RGB:
-   case GL_COMPRESSED_RGB:
-      if (type == GL_UNSIGNED_SHORT_5_6_5)
-        return MESA_FORMAT_RGB565;
-      else if (intel->has_xrgb_textures)
-        return MESA_FORMAT_XRGB8888;
-      else
-        return MESA_FORMAT_ARGB8888;
-
-   case GL_RGBA8:
-   case GL_RGB10_A2:
-   case GL_RGBA12:
-   case GL_RGBA16:
-      return MESA_FORMAT_ARGB8888;
-
-   case GL_RGBA4:
-   case GL_RGBA2:
-      return MESA_FORMAT_ARGB4444;
-
-   case GL_RGB5_A1:
-      return MESA_FORMAT_ARGB1555;
-
-   case GL_RGB8:
-   case GL_RGB10:
-   case GL_RGB12:
-   case GL_RGB16:
-      if (intel->has_xrgb_textures)
-        return MESA_FORMAT_XRGB8888;
-      else
-        return MESA_FORMAT_ARGB8888;
-
-   case GL_RGB5:
-   case GL_RGB4:
-   case GL_R3_G3_B2:
-      return MESA_FORMAT_RGB565;
-
-   case GL_ALPHA:
-   case GL_ALPHA4:
-   case GL_ALPHA8:
-   case GL_ALPHA12:
-   case GL_ALPHA16:
-   case GL_COMPRESSED_ALPHA:
-      return MESA_FORMAT_A8;
-
-   case 1:
-   case GL_LUMINANCE:
-   case GL_LUMINANCE4:
-   case GL_LUMINANCE8:
-   case GL_LUMINANCE12:
-   case GL_LUMINANCE16:
-   case GL_COMPRESSED_LUMINANCE:
-      return MESA_FORMAT_L8;
-
-   case GL_LUMINANCE12_ALPHA4:
-   case GL_LUMINANCE12_ALPHA12:
-   case GL_LUMINANCE16_ALPHA16:
-      /* i915 could implement this mode using MT_32BIT_RG1616.  However, this
-       * would require an extra swizzle instruction in the fragment shader to
-       * convert the { R, G, 1.0, 1.0 } to { R, R, R, G }.
-       */
-#ifndef I915
-      return MESA_FORMAT_AL1616;
-#else
-      /* FALLTHROUGH */
-#endif
-
-   case 2:
-   case GL_LUMINANCE_ALPHA:
-   case GL_LUMINANCE4_ALPHA4:
-   case GL_LUMINANCE6_ALPHA2:
-   case GL_LUMINANCE8_ALPHA8:
-   case GL_COMPRESSED_LUMINANCE_ALPHA:
-      return MESA_FORMAT_AL88;
-
-   case GL_INTENSITY:
-   case GL_INTENSITY4:
-   case GL_INTENSITY8:
-   case GL_INTENSITY12:
-   case GL_INTENSITY16:
-   case GL_COMPRESSED_INTENSITY:
-      return MESA_FORMAT_I8;
-
-   case GL_YCBCR_MESA:
-      if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE)
-         return MESA_FORMAT_YCBCR;
-      else
-         return MESA_FORMAT_YCBCR_REV;
-
-   case GL_COMPRESSED_RGB_FXT1_3DFX:
-      return MESA_FORMAT_RGB_FXT1;
-   case GL_COMPRESSED_RGBA_FXT1_3DFX:
-      return MESA_FORMAT_RGBA_FXT1;
-
-   case GL_RGB_S3TC:
-   case GL_RGB4_S3TC:
-   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-      return MESA_FORMAT_RGB_DXT1;
-
-   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-      return MESA_FORMAT_RGBA_DXT1;
-
-   case GL_RGBA_S3TC:
-   case GL_RGBA4_S3TC:
-   case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-      return MESA_FORMAT_RGBA_DXT3;
-
-   case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-      return MESA_FORMAT_RGBA_DXT5;
-
-   case GL_DEPTH_COMPONENT:
-   case GL_DEPTH_COMPONENT16:
-   case GL_DEPTH_COMPONENT24:
-   case GL_DEPTH_COMPONENT32:
-#if 0
-      return MESA_FORMAT_Z16;
-#else
-      /* fall-through.
-       * 16bpp depth texture can't be paired with a stencil buffer so
-       * always used combined depth/stencil format.
-       */
-#endif
-   case GL_DEPTH_STENCIL_EXT:
-   case GL_DEPTH24_STENCIL8_EXT:
-      return MESA_FORMAT_S8_Z24;
-
-#ifndef I915
-   case GL_SRGB_EXT:
-   case GL_SRGB8_EXT:
-   case GL_SRGB_ALPHA_EXT:
-   case GL_SRGB8_ALPHA8_EXT:
-   case GL_COMPRESSED_SRGB_EXT:
-   case GL_COMPRESSED_SRGB_ALPHA_EXT:
-   case GL_COMPRESSED_SLUMINANCE_EXT:
-   case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
-      return MESA_FORMAT_SARGB8;
-   case GL_SLUMINANCE_EXT:
-   case GL_SLUMINANCE8_EXT:
-      if (intel->has_luminance_srgb)
-         return MESA_FORMAT_SL8;
-      else
-         return MESA_FORMAT_SARGB8;
-   case GL_SLUMINANCE_ALPHA_EXT:
-   case GL_SLUMINANCE8_ALPHA8_EXT:
-      if (intel->has_luminance_srgb)
-         return MESA_FORMAT_SLA8;
-      else
-         return MESA_FORMAT_SARGB8;
-   case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
-   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-      return MESA_FORMAT_SRGB_DXT1;
-
-   /* i915 could also do this */
-   case GL_DUDV_ATI:
-   case GL_DU8DV8_ATI:
-      return MESA_FORMAT_DUDV8;
-   case GL_RGBA_SNORM:
-   case GL_RGBA8_SNORM:
-      return MESA_FORMAT_SIGNED_RGBA8888_REV;
-
-   /* i915 can do a RG16, but it can't do any of the other RED or RG formats.
-    * In addition, it only implements the broken D3D mode where undefined
-    * components are read as 1.0.  I'm not sure who thought reading
-    * { R, G, 1.0, 1.0 } from a red-green texture would be useful.
-    */
-   case GL_RED:
-   case GL_R8:
-      return MESA_FORMAT_R8;
-   case GL_R16:
-      return MESA_FORMAT_R16;
-   case GL_RG:
-   case GL_RG8:
-      return MESA_FORMAT_RG88;
-   case GL_RG16:
-      return MESA_FORMAT_RG1616;
-#endif
-
+   switch (format) {
+   case MESA_FORMAT_ARGB8888:
+   case MESA_FORMAT_XRGB8888:
+   case MESA_FORMAT_SARGB8:
+   case MESA_FORMAT_R8:
+   case MESA_FORMAT_RG88:
+   case MESA_FORMAT_A8:
+   case MESA_FORMAT_AL88:
+   case MESA_FORMAT_RGB565:
+   case MESA_FORMAT_ARGB1555:
+   case MESA_FORMAT_ARGB4444:
+      return GL_UNSIGNED_BYTE;
+   case MESA_FORMAT_R16:
+   case MESA_FORMAT_RG1616:
+   case MESA_FORMAT_Z16:
+      return GL_UNSIGNED_SHORT;
+   case MESA_FORMAT_X8_Z24:
+      return GL_UNSIGNED_INT;
+   case MESA_FORMAT_S8_Z24:
+      return GL_UNSIGNED_INT_24_8_EXT;
    default:
-      fprintf(stderr, "unexpected texture format %s in %s\n",
-              _mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__);
-      return MESA_FORMAT_NONE;
+      _mesa_problem(NULL, "unexpected MESA_FORMAT for renderbuffer");
+      return GL_UNSIGNED_BYTE;
    }
-
-   return MESA_FORMAT_NONE;       /* never get here */
 }
 
 int intel_compressed_num_bytes(GLuint mesaFormat)
index 41cdbfd2cbdf42e4b2eb408cefb5834f9c2e8d41..cd8c4c22e5aa9ab5023ee1f65b293afa1c7aacee 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "main/glheader.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "main/enums.h"
 #include "main/bufferobj.h"
@@ -55,11 +56,11 @@ logbase2(int n)
  * 0)..(1x1).  Consider pruning this tree at a validation if the
  * saving is worth it.
  */
-static void
-guess_and_alloc_mipmap_tree(struct intel_context *intel,
-                            struct intel_texture_object *intelObj,
-                            struct intel_texture_image *intelImage,
-                           GLboolean expect_accelerated_upload)
+static struct intel_mipmap_tree *
+intel_miptree_create_for_teximage(struct intel_context *intel,
+                                 struct intel_texture_object *intelObj,
+                                 struct intel_texture_image *intelImage,
+                                 GLboolean expect_accelerated_upload)
 {
    GLuint firstLevel;
    GLuint lastLevel;
@@ -72,70 +73,71 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel,
    DBG("%s\n", __FUNCTION__);
 
    if (intelImage->base.Border)
-      return;
+      return NULL;
 
    if (intelImage->level > intelObj->base.BaseLevel &&
        (intelImage->base.Width == 1 ||
         (intelObj->base.Target != GL_TEXTURE_1D &&
          intelImage->base.Height == 1) ||
         (intelObj->base.Target == GL_TEXTURE_3D &&
-         intelImage->base.Depth == 1)))
-      return;
-
-   /* If this image disrespects BaseLevel, allocate from level zero.
-    * Usually BaseLevel == 0, so it's unlikely to happen.
-    */
-   if (intelImage->level < intelObj->base.BaseLevel)
-      firstLevel = 0;
-   else
-      firstLevel = intelObj->base.BaseLevel;
-
-
-   /* Figure out image dimensions at start level. 
-    */
-   for (i = intelImage->level; i > firstLevel; i--) {
-      width <<= 1;
-      if (height != 1)
-         height <<= 1;
-      if (depth != 1)
-         depth <<= 1;
-   }
+         intelImage->base.Depth == 1))) {
+      /* For this combination, we're at some lower mipmap level and
+       * some important dimension is 1.  We can't extrapolate up to a
+       * likely base level width/height/depth for a full mipmap stack
+       * from this info, so just allocate this one level.
+       */
+      firstLevel = intelImage->level;
+      lastLevel = intelImage->level;
+   } else {
+      /* If this image disrespects BaseLevel, allocate from level zero.
+       * Usually BaseLevel == 0, so it's unlikely to happen.
+       */
+      if (intelImage->level < intelObj->base.BaseLevel)
+        firstLevel = 0;
+      else
+        firstLevel = intelObj->base.BaseLevel;
+
+      /* Figure out image dimensions at start level. */
+      for (i = intelImage->level; i > firstLevel; i--) {
+        width <<= 1;
+        if (height != 1)
+           height <<= 1;
+        if (depth != 1)
+           depth <<= 1;
+      }
 
-   /* Guess a reasonable value for lastLevel.  This is probably going
-    * to be wrong fairly often and might mean that we have to look at
-    * resizable buffers, or require that buffers implement lazy
-    * pagetable arrangements.
-    */
-   if ((intelObj->base.MinFilter == GL_NEAREST ||
-        intelObj->base.MinFilter == GL_LINEAR) &&
-       intelImage->level == firstLevel &&
-       (intel->gen < 4 || firstLevel == 0)) {
-      lastLevel = firstLevel;
-   }
-   else {
-      lastLevel = firstLevel + logbase2(MAX2(MAX2(width, height), depth));
+      /* Guess a reasonable value for lastLevel.  This is probably going
+       * to be wrong fairly often and might mean that we have to look at
+       * resizable buffers, or require that buffers implement lazy
+       * pagetable arrangements.
+       */
+      if ((intelObj->base.MinFilter == GL_NEAREST ||
+          intelObj->base.MinFilter == GL_LINEAR) &&
+         intelImage->level == firstLevel &&
+         (intel->gen < 4 || firstLevel == 0)) {
+        lastLevel = firstLevel;
+      } else {
+        lastLevel = firstLevel + logbase2(MAX2(MAX2(width, height), depth));
+      }
    }
 
-   assert(!intelObj->mt);
    if (_mesa_is_format_compressed(intelImage->base.TexFormat))
       comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat);
 
    texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat);
 
-   intelObj->mt = intel_miptree_create(intel,
-                                       intelObj->base.Target,
-                                       intelImage->base._BaseFormat,
-                                       intelImage->base.InternalFormat,
-                                       firstLevel,
-                                       lastLevel,
-                                       width,
-                                       height,
-                                       depth,
-                                       texelBytes,
-                                       comp_byte,
-                                      expect_accelerated_upload);
-
-   DBG("%s - success\n", __FUNCTION__);
+   return intel_miptree_create(intel,
+                              intelObj->base.Target,
+                              intelImage->base._BaseFormat,
+                              intelImage->base.InternalFormat,
+                              firstLevel,
+                              lastLevel,
+                              width,
+                              height,
+                              depth,
+                              texelBytes,
+                              comp_byte,
+                              expect_accelerated_upload);
 }
 
 
@@ -343,41 +345,29 @@ intelTexImage(struct gl_context * ctx,
       texImage->Data = NULL;
    }
 
-   if (!intelObj->mt) {
-      guess_and_alloc_mipmap_tree(intel, intelObj, intelImage, pixels == NULL);
-      if (!intelObj->mt) {
-        DBG("guess_and_alloc_mipmap_tree: failed\n");
-      }
-   }
-
    assert(!intelImage->mt);
 
    if (intelObj->mt &&
        intel_miptree_match_image(intelObj->mt, &intelImage->base)) {
-
+      /* Use an existing miptree when possible */
       intel_miptree_reference(&intelImage->mt, intelObj->mt);
       assert(intelImage->mt);
    } else if (intelImage->base.Border == 0) {
-      int comp_byte = 0;
-      GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat);
-      GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat);
-      if (_mesa_is_format_compressed(intelImage->base.TexFormat)) {
-        comp_byte =
-           intel_compressed_num_bytes(intelImage->base.TexFormat);
-      }
-
       /* Didn't fit in the object miptree, but it's suitable for inclusion in
        * a miptree, so create one just for our level and store it in the image.
        * It'll get moved into the object miptree at validate time.
        */
-      intelImage->mt = intel_miptree_create(intel, target,
-                                           baseFormat,
-                                           internalFormat,
-                                           level, level,
-                                           width, height, depth,
-                                           texelBytes,
-                                           comp_byte, pixels == NULL);
-
+      intelImage->mt = intel_miptree_create_for_teximage(intel, intelObj,
+                                                        intelImage,
+                                                        pixels == NULL);
+
+      /* Even if the object currently has a mipmap tree associated
+       * with it, this one is a more likely candidate to represent the
+       * whole object since our level didn't fit what was there
+       * before, and any lower levels would fit into our miptree.
+       */
+      if (intelImage->mt)
+        intel_miptree_reference(&intelObj->mt, intelImage->mt);
    }
 
    /* PBO fastpaths:
@@ -711,8 +701,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
    }
 
    mt = intel_miptree_create_for_region(intel, target,
-                                       internalFormat,
-                                       0, 0, rb->region, 1, 0);
+                                       internalFormat, rb->region, 1, 0);
    if (mt == NULL)
        return;
 
@@ -777,7 +766,7 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
 
    mt = intel_miptree_create_for_region(intel, target,
                                        image->internal_format,
-                                       0, 0, image->region, 1, 0);
+                                       image->region, 1, 0);
    if (mt == NULL)
        return;
 
index 5f60e0ea4f3a1bc3af6119fea49511647320bb24..e93ef4a4727937893bc890901a46102f62f76acb 100644 (file)
@@ -32,11 +32,11 @@ struct intel_texture_object
 {
    struct gl_texture_object base;       /* The "parent" object */
 
-   /* The mipmap tree must include at least these levels once
-    * validated:
+   /* This is a mirror of base._MaxLevel, updated at validate time,
+    * except that we don't bother with the non-base levels for
+    * non-mipmapped textures.
     */
-   GLuint firstLevel;
-   GLuint lastLevel;
+   unsigned int _MaxLevel;
 
    /* Offset for firstLevel image:
     */
index ed5c5d896b9c200eb8ebb1affbe3f2eceb773fbe..8537e7f3682b192b16aec156b117eb469950ab1a 100644 (file)
@@ -8,72 +8,21 @@
 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
 
 /**
- * Compute which mipmap levels that really need to be sent to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
+ * When validating, we only care about the texture images that could
+ * be seen, so for non-mipmapped modes we want to ignore everything
+ * but BaseLevel.
  */
 static void
-intel_calculate_first_last_level(struct intel_context *intel,
-                                struct intel_texture_object *intelObj)
+intel_update_max_level(struct intel_context *intel,
+                      struct intel_texture_object *intelObj)
 {
    struct gl_texture_object *tObj = &intelObj->base;
-   const struct gl_texture_image *const baseImage =
-      tObj->Image[0][tObj->BaseLevel];
 
-   /* These must be signed values.  MinLod and MaxLod can be negative numbers,
-    * and having firstLevel and lastLevel as signed prevents the need for
-    * extra sign checks.
-    */
-   int firstLevel;
-   int lastLevel;
-
-   /* Yes, this looks overly complicated, but it's all needed.
-    */
-   switch (tObj->Target) {
-   case GL_TEXTURE_1D:
-   case GL_TEXTURE_2D:
-   case GL_TEXTURE_3D:
-   case GL_TEXTURE_CUBE_MAP:
-      if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
-         /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
-          */
-         firstLevel = lastLevel = tObj->BaseLevel;
-      }
-      else {
-        if (intel->gen == 2) {
-           firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5);
-           firstLevel = MAX2(firstLevel, tObj->BaseLevel);
-           firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2);
-           lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5);
-           lastLevel = MAX2(lastLevel, tObj->BaseLevel);
-           lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
-           lastLevel = MIN2(lastLevel, tObj->MaxLevel);
-           lastLevel = MAX2(firstLevel, lastLevel);       /* need at least one level */
-        } else {
-           /* Min/max LOD are taken into account in sampler state.  We don't
-            * want to re-layout textures just because clamping has been applied
-            * since it means a bunch of blitting around and probably no memory
-            * savings (since we have to keep the other levels around anyway).
-            */
-           firstLevel = tObj->BaseLevel;
-           lastLevel = MIN2(tObj->BaseLevel + baseImage->MaxLog2,
-                            tObj->MaxLevel);
-           /* need at least one level */
-           lastLevel = MAX2(firstLevel, lastLevel);
-        }
-      }
-      break;
-   case GL_TEXTURE_RECTANGLE_NV:
-   case GL_TEXTURE_4D_SGIS:
-      firstLevel = lastLevel = 0;
-      break;
-   default:
-      return;
+   if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
+      intelObj->_MaxLevel = tObj->BaseLevel;
+   } else {
+      intelObj->_MaxLevel = tObj->_MaxLevel;
    }
-
-   /* save these values */
-   intelObj->firstLevel = firstLevel;
-   intelObj->lastLevel = lastLevel;
 }
 
 /**
@@ -135,8 +84,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
 
    /* What levels must the tree include at a minimum?
     */
-   intel_calculate_first_last_level(intel, intelObj);
-   firstImage = intel_texture_image(tObj->Image[0][intelObj->firstLevel]);
+   intel_update_max_level(intel, intelObj);
+   firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
 
    /* Fallback case:
     */
@@ -147,23 +96,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
       return GL_FALSE;
    }
 
-
-   /* If both firstImage and intelObj have a tree which can contain
-    * all active images, favour firstImage.  Note that because of the
-    * completeness requirement, we know that the image dimensions
-    * will match.
-    */
-   if (firstImage->mt &&
-       firstImage->mt != intelObj->mt &&
-       firstImage->mt->first_level <= intelObj->firstLevel &&
-       firstImage->mt->last_level >= intelObj->lastLevel) {
-
-      if (intelObj->mt)
-         intel_miptree_release(intel, &intelObj->mt);
-
-      intel_miptree_reference(&intelObj->mt, firstImage->mt);
-   }
-
    if (_mesa_is_format_compressed(firstImage->base.TexFormat)) {
       comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat);
       cpp = comp_byte;
@@ -173,18 +105,17 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
 
    /* Check tree can hold all active levels.  Check tree matches
     * target, imageFormat, etc.
-    * 
-    * XXX: For some layouts (eg i945?), the test might have to be
-    * first_level == firstLevel, as the tree isn't valid except at the
-    * original start level.  Hope to get around this by
-    * programming minLod, maxLod, baseLevel into the hardware and
-    * leaving the tree alone.
+    *
+    * For pre-gen4, we have to match first_level == tObj->BaseLevel,
+    * because we don't have the control that gen4 does to make min/mag
+    * determination happen at a nonzero (hardware) baselevel.  Because
+    * of that, we just always relayout on baselevel change.
     */
    if (intelObj->mt &&
        (intelObj->mt->target != intelObj->base.Target ||
        intelObj->mt->internal_format != firstImage->base.InternalFormat ||
-       intelObj->mt->first_level != intelObj->firstLevel ||
-       intelObj->mt->last_level != intelObj->lastLevel ||
+       intelObj->mt->first_level != tObj->BaseLevel ||
+       intelObj->mt->last_level < intelObj->_MaxLevel ||
        intelObj->mt->width0 != firstImage->base.Width ||
        intelObj->mt->height0 != firstImage->base.Height ||
        intelObj->mt->depth0 != firstImage->base.Depth ||
@@ -201,8 +132,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
                                           intelObj->base.Target,
                                           firstImage->base._BaseFormat,
                                           firstImage->base.InternalFormat,
-                                          intelObj->firstLevel,
-                                          intelObj->lastLevel,
+                                          tObj->BaseLevel,
+                                          intelObj->_MaxLevel,
                                           firstImage->base.Width,
                                           firstImage->base.Height,
                                           firstImage->base.Depth,
@@ -215,11 +146,13 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
     */
    nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
    for (face = 0; face < nr_faces; face++) {
-      for (i = intelObj->firstLevel; i <= intelObj->lastLevel; i++) {
+      for (i = tObj->BaseLevel; i <= intelObj->_MaxLevel; i++) {
          struct intel_texture_image *intelImage =
             intel_texture_image(intelObj->base.Image[face][i]);
-
-         /* Need to import images in main memory or held in other trees.
+        /* skip too small size mipmap */
+        if (intelImage == NULL)
+                break;
+        /* Need to import images in main memory or held in other trees.
          * If it's a render target, then its data isn't needed to be in
          * the object tree (otherwise we'd be FBO incomplete), and we need
          * to keep track of the image's MT as needing to be pulled in still,
@@ -289,7 +222,7 @@ intel_tex_map_images(struct intel_context *intel,
 
    DBG("%s\n", __FUNCTION__);
 
-   for (i = intelObj->firstLevel; i <= intelObj->lastLevel; i++)
+   for (i = intelObj->base.BaseLevel; i <= intelObj->_MaxLevel; i++)
       intel_tex_map_level_images(intel, intelObj, i);
 }
 
@@ -299,6 +232,6 @@ intel_tex_unmap_images(struct intel_context *intel,
 {
    int i;
 
-   for (i = intelObj->firstLevel; i <= intelObj->lastLevel; i++)
+   for (i = intelObj->base.BaseLevel; i <= intelObj->_MaxLevel; i++)
       intel_tex_unmap_level_images(intel, intelObj, i);
 }
index 11e8f53b283e168a60b34ddcc5aa001f2f88e4c7..70bc0ae79de4215276f2493caeeb9de2b9a3667c 100644 (file)
@@ -295,11 +295,11 @@ extern GLboolean mach64UnbindContext( __DRIcontext *driContextPriv );
 #define LE32_OUT( x, y )       do { *(GLuint *)(x) = (y); } while (0)
 #define LE32_OUT_FLOAT( x, y ) do { *(GLfloat *)(x) = (y); } while (0)
 #else
-#ifndef __OpenBSD__
-#include <byteswap.h>
-#else
+#if defined(__OpenBSD__) || defined(__NetBSD__)
 #include <machine/endian.h>
 #define bswap_32 bswap32
+#else
+#include <byteswap.h>
 #endif
 
 #define LE32_IN( x )           bswap_32( *(GLuint *)(x) )
index 27e2892f71116ddf4f869706175ecc26e09de8c0..45630be7f6eb80db6b3d904c2dfcd89f0013fa8b 100644 (file)
@@ -24,6 +24,8 @@
  *
  */
 
+#include "main/mfeatures.h"
+
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
 #include "nouveau_fbo.h"
index 8036b18edc05f82b4c84e8db8a77d4142496e628..c5ac1282d0d6db4f56637551336a3a3d57c6e0e3 100644 (file)
@@ -38,7 +38,6 @@
 #include <assert.h>
 
 #include "nouveau_device.h"
-#include "nouveau_pushbuf.h"
 #include "nouveau_grobj.h"
 #include "nouveau_channel.h"
 #include "nouveau_bo.h"
@@ -46,6 +45,7 @@
 #include "nouveau_screen.h"
 #include "nouveau_state.h"
 #include "nouveau_surface.h"
+#include "nv04_pushbuf.h"
 
 #define DRIVER_DATE    "20091015"
 #define DRIVER_AUTHOR  "Nouveau"
index 079b5d63e4c399a53f457ed493b263cd0d88bec7..b36b578878124f49fa042d0c9f82cf101b1212ae 100644 (file)
@@ -32,6 +32,7 @@
 #include "main/framebuffer.h"
 #include "main/renderbuffer.h"
 #include "main/fbobject.h"
+#include "main/mfeatures.h"
 
 static GLboolean
 set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum internalFormat)
index 5abfc9dac51b895fb6a2745562ada16d68bf9677..9c045b73accd2404739c1b6575be0d3b93aad474 100644 (file)
@@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/simple_list.h"
 #include "main/imports.h"
 #include "main/extensions.h"
+#include "main/mfeatures.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
index 8a047e6419b38522ebcbdb3595ae1355490f1256..b62290231b97933914a8ba057a0c20d7e4786cbf 100644 (file)
@@ -200,6 +200,7 @@ void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev )
            }
         default:
            assert(0);
+           emitsize = 0;
         }
         if (!rmesa->radeon.tcl.aos[nr].bo) {
           rcommon_emit_vector( ctx,
index 064324731b5e27a1db5eff2e379f59a623638e0e..092b7575831fc4cf0c89162871613d5b0de4c223 100644 (file)
@@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/image.h"
+#include "main/mfeatures.h"
 #include "main/simple_list.h"
 #include "main/texstore.h"
 #include "main/teximage.h"
index 7b9c3167940ad754b78519c4aa6c6d06f5d9234e..e0d349b98ce147b33c17cd3b61b5857a6785b99d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 
+#include "radeon_compiler_util.h"
 #include "radeon_dataflow.h"
 #include "radeon_emulate_branches.h"
 #include "radeon_emulate_loops.h"
@@ -54,6 +55,8 @@ static void rc_rewrite_depth_out(struct radeon_compiler *cc, void *user)
 
        for (rci = c->Base.Program.Instructions.Next; rci != &c->Base.Program.Instructions; rci = rci->Next) {
                struct rc_sub_instruction * inst = &rci->U.I;
+               unsigned i;
+               const struct rc_opcode_info *info = rc_get_opcode_info(inst->Opcode);
 
                if (inst->DstReg.File != RC_FILE_OUTPUT || inst->DstReg.Index != c->OutputDepth)
                        continue;
@@ -65,27 +68,12 @@ static void rc_rewrite_depth_out(struct radeon_compiler *cc, void *user)
                        continue;
                }
 
-               switch (inst->Opcode) {
-                       case RC_OPCODE_FRC:
-                       case RC_OPCODE_MOV:
-                               inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]);
-                               break;
-                       case RC_OPCODE_ADD:
-                       case RC_OPCODE_MAX:
-                       case RC_OPCODE_MIN:
-                       case RC_OPCODE_MUL:
-                               inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]);
-                               inst->SrcReg[1] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[1]);
-                               break;
-                       case RC_OPCODE_CMP:
-                       case RC_OPCODE_MAD:
-                               inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]);
-                               inst->SrcReg[1] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[1]);
-                               inst->SrcReg[2] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[2]);
-                               break;
-                       default:
-                               // Scalar instructions needn't be reswizzled
-                               break;
+               if (!info->IsComponentwise) {
+                       continue;
+               }
+
+               for (i = 0; i < info->NumSrcRegs; i++) {
+                       inst->SrcReg[i] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[i]);
                }
        }
 }
@@ -93,7 +81,6 @@ static void rc_rewrite_depth_out(struct radeon_compiler *cc, void *user)
 void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
 {
        int is_r500 = c->Base.is_r500;
-       int kill_consts = c->Base.remove_unused_constants;
        int opt = !c->Base.disable_optimizations;
 
        /* Lists of instruction transformations. */
@@ -133,7 +120,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
                {"emulate loops",               1, !is_r500,    rc_emulate_loops,               NULL},
                {"dataflow optimize",           1, opt,         rc_optimize,                    NULL},
                {"dataflow swizzles",           1, 1,           rc_dataflow_swizzles,           NULL},
-               {"dead constants",              1, kill_consts, rc_remove_unused_constants,     &c->code->constants_remap_table},
+               {"dead constants",              1, 1,           rc_remove_unused_constants,     &c->code->constants_remap_table},
                /* This pass makes it easier for the scheduler to group TEX
                 * instructions and reduces the chances of creating too
                 * many texture indirections.*/
@@ -150,9 +137,10 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
                {NULL, 0, 0, NULL, NULL}
        };
 
+       c->Base.type = RC_FRAGMENT_PROGRAM;
        c->Base.SwizzleCaps = c->Base.is_r500 ? &r500_swizzle_caps : &r300_swizzle_caps;
 
-       rc_run_compiler(&c->Base, fs_list, "Fragment Program");
+       rc_run_compiler(&c->Base, fs_list);
 
        rc_constants_copy(&c->code->constants, &c->Base.Program.Constants);
 }
index bf8341f0173662a826c003e7e8fbd4b8ed4e75be..472029f63d0758d2b0b8d7c5f508da794edc8d34 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "../r300_reg.h"
 
+#include "radeon_compiler_util.h"
 #include "radeon_dataflow.h"
 #include "radeon_program_alu.h"
 #include "radeon_swizzle.h"
@@ -790,19 +791,14 @@ static void allocate_temporary_registers(struct radeon_compiler *c, void *user)
                                                if (!hwtemps[j])
                                                        break;
                                        }
-                                       if (j >= c->max_temp_regs) {
-                                               rc_error(c, "Too many temporaries\n");
-                                               return;
+                                       ta[orig].Allocated = 1;
+                                       if (last_inst_src_reladdr &&
+                                           last_inst_src_reladdr->IP > inst->IP) {
+                                               ta[orig].HwTemp = orig;
                                        } else {
-                                               ta[orig].Allocated = 1;
-                                               if (last_inst_src_reladdr &&
-                                                   last_inst_src_reladdr->IP > inst->IP) {
-                                                       ta[orig].HwTemp = orig;
-                                               } else {
-                                                       ta[orig].HwTemp = j;
-                                               }
-                                               hwtemps[ta[orig].HwTemp] = 1;
+                                               ta[orig].HwTemp = j;
                                        }
+                                       hwtemps[ta[orig].HwTemp] = 1;
                                }
 
                                inst->U.I.DstReg.Index = ta[orig].HwTemp;
@@ -1018,7 +1014,6 @@ static struct rc_swizzle_caps r300_vertprog_swizzle_caps = {
 void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
 {
        int is_r500 = c->Base.is_r500;
-       int kill_consts = c->Base.remove_unused_constants;
        int opt = !c->Base.disable_optimizations;
 
        /* Lists of instruction transformations. */
@@ -1062,18 +1057,18 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
                {"dataflow optimize",           1, opt,         rc_optimize,                    NULL},
                /* This pass must be done after optimizations. */
                {"source conflict resolve",     1, 1,           rc_local_transform,             resolve_src_conflicts},
-               {"dataflow swizzles",           1, 1,           rc_dataflow_swizzles,           NULL},
                {"register allocation",         1, opt,         allocate_temporary_registers,   NULL},
-               {"dead constants",              1, kill_consts, rc_remove_unused_constants,     &c->code->constants_remap_table},
+               {"dead constants",              1, 1,           rc_remove_unused_constants,     &c->code->constants_remap_table},
                {"final code validation",       0, 1,           rc_validate_final_shader,       NULL},
                {"machine code generation",     0, 1,           translate_vertex_program,       NULL},
                {"dump machine code",           0, c->Base.Debug & RC_DBG_LOG, r300_vertex_program_dump,        NULL},
                {NULL, 0, 0, NULL, NULL}
        };
 
+       c->Base.type = RC_VERTEX_PROGRAM;
        c->Base.SwizzleCaps = &r300_vertprog_swizzle_caps;
 
-       rc_run_compiler(&c->Base, vs_list, "Vertex Program");
+       rc_run_compiler(&c->Base, vs_list);
 
        c->code->InputsRead = c->Base.Program.InputsRead;
        c->code->OutputsWritten = c->Base.Program.OutputsWritten;
index 289bb87ae593dd83d5ad8fc46c270782bfa4e0ed..ef81be48f7779afe93c651db5fdfc27198abb0e1 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 
+#include "radeon_compiler_util.h"
 #include "../r300_reg.h"
 
 /**
index 4286baed0c69467de17c64ea169112b0b85c9986..65548604bcca832c25abca83ae7dc0cedd8fb590 100644 (file)
@@ -29,6 +29,7 @@
 #include "radeon_dataflow.h"
 #include "radeon_program.h"
 #include "radeon_program_pair.h"
+#include "radeon_compiler_util.h"
 
 
 void rc_init(struct radeon_compiler * c)
@@ -356,66 +357,92 @@ void rc_transform_fragment_face(struct radeon_compiler *c, unsigned face)
 static void reg_count_callback(void * userdata, struct rc_instruction * inst,
                rc_register_file file, unsigned int index, unsigned int mask)
 {
-       unsigned int * max_reg = userdata;
+       int *max_reg = userdata;
        if (file == RC_FILE_TEMPORARY)
-               index > *max_reg ? *max_reg = index : 0;
+               (int)index > *max_reg ? *max_reg = index : 0;
 }
 
-static void print_stats(struct radeon_compiler * c)
+void rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s)
 {
+       int max_reg = -1;
        struct rc_instruction * tmp;
-       unsigned max_reg, insts, fc, tex, alpha, rgb, presub;
-       max_reg = insts = fc = tex = alpha = rgb = presub = 0;
+       memset(s, 0, sizeof(*s));
+
        for(tmp = c->Program.Instructions.Next; tmp != &c->Program.Instructions;
                                                        tmp = tmp->Next){
                const struct rc_opcode_info * info;
                rc_for_all_reads_mask(tmp, reg_count_callback, &max_reg);
                if (tmp->Type == RC_INSTRUCTION_NORMAL) {
                        if (tmp->U.I.PreSub.Opcode != RC_PRESUB_NONE)
-                               presub++;
+                               s->num_presub_ops++;
                        info = rc_get_opcode_info(tmp->U.I.Opcode);
                } else {
                        if (tmp->U.P.RGB.Src[RC_PAIR_PRESUB_SRC].Used)
-                               presub++;
+                               s->num_presub_ops++;
                        if (tmp->U.P.Alpha.Src[RC_PAIR_PRESUB_SRC].Used)
-                               presub++;
+                               s->num_presub_ops++;
                        /* Assuming alpha will never be a flow control or
                         * a tex instruction. */
                        if (tmp->U.P.Alpha.Opcode != RC_OPCODE_NOP)
-                               alpha++;
+                               s->num_alpha_insts++;
                        if (tmp->U.P.RGB.Opcode != RC_OPCODE_NOP)
-                               rgb++;
+                               s->num_rgb_insts++;
                        info = rc_get_opcode_info(tmp->U.P.RGB.Opcode);
                }
                if (info->IsFlowControl)
-                       fc++;
+                       s->num_fc_insts++;
                if (info->HasTexture)
-                       tex++;
-               insts++;
+                       s->num_tex_insts++;
+               s->num_insts++;
        }
-       if (insts < 4)
-               return;
-       fprintf(stderr,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
-                      "~%4u Instructions\n"
-                      "~%4u Vector Instructions (RGB)\n"
-                      "~%4u Scalar Instructions (Alpha)\n"
-                      "~%4u Flow Control Instructions\n"
-                      "~%4u Texture Instructions\n"
-                      "~%4u Presub Operations\n"
-                      "~%4u Temporary Registers\n"
-                      "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
-                      insts, rgb, alpha, fc, tex, presub, max_reg + 1);
+       s->num_temp_regs = max_reg + 1;
 }
 
-/* Executes a list of compiler passes given in the parameter 'list'. */
-void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list,
-                    const char *shader_name)
+static void print_stats(struct radeon_compiler * c)
 {
-       if (c->Debug & RC_DBG_LOG) {
-               fprintf(stderr, "%s: before compilation\n", shader_name);
-               rc_print_program(&c->Program);
+       struct rc_program_stats s;
+
+       rc_get_stats(c, &s);
+
+       if (s.num_insts < 4)
+               return;
+
+       switch (c->type) {
+       case RC_VERTEX_PROGRAM:
+               fprintf(stderr,"~~~~~~~~~ VERTEX PROGRAM ~~~~~~~~\n"
+                              "~%4u Instructions\n"
+                              "~%4u Flow Control Instructions\n"
+                              "~%4u Temporary Registers\n"
+                              "~~~~~~~~~~~~~~ END ~~~~~~~~~~~~~~\n",
+                              s.num_insts, s.num_fc_insts, s.num_temp_regs);
+               break;
+
+       case RC_FRAGMENT_PROGRAM:
+               fprintf(stderr,"~~~~~~~~ FRAGMENT PROGRAM ~~~~~~~\n"
+                              "~%4u Instructions\n"
+                              "~%4u Vector Instructions (RGB)\n"
+                              "~%4u Scalar Instructions (Alpha)\n"
+                              "~%4u Flow Control Instructions\n"
+                              "~%4u Texture Instructions\n"
+                              "~%4u Presub Operations\n"
+                              "~%4u Temporary Registers\n"
+                              "~~~~~~~~~~~~~~ END ~~~~~~~~~~~~~~\n",
+                              s.num_insts, s.num_rgb_insts, s.num_alpha_insts,
+                              s.num_fc_insts, s.num_tex_insts, s.num_presub_ops,
+                              s.num_temp_regs);
+               break;
+       default:
+               assert(0);
        }
+}
 
+static const char *shader_name[RC_NUM_PROGRAM_TYPES] = {
+       "Vertex Program",
+       "Fragment Program"
+};
+
+void rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pass *list)
+{
        for (unsigned i = 0; list[i].name; i++) {
                if (list[i].predicate) {
                        list[i].run(c, list[i].user);
@@ -424,11 +451,23 @@ void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *lis
                                return;
 
                        if ((c->Debug & RC_DBG_LOG) && list[i].dump) {
-                               fprintf(stderr, "%s: after '%s'\n", shader_name, list[i].name);
+                               fprintf(stderr, "%s: after '%s'\n", shader_name[c->type], list[i].name);
                                rc_print_program(&c->Program);
                        }
                }
        }
+}
+
+/* Executes a list of compiler passes given in the parameter 'list'. */
+void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list)
+{
+       if (c->Debug & RC_DBG_LOG) {
+               fprintf(stderr, "%s: before compilation\n", shader_name[c->type]);
+               rc_print_program(&c->Program);
+       }
+
+       rc_run_compiler_passes(c, list);
+
        if (c->Debug & RC_DBG_STATS)
                print_stats(c);
 }
index 31fd469a04f8ec8fb55448f1b5358a904c5c88c2..e6633395895b7dbb2a0fe7ef3878b04a9ec2b436 100644 (file)
 
 struct rc_swizzle_caps;
 
+enum rc_program_type {
+       RC_VERTEX_PROGRAM,
+       RC_FRAGMENT_PROGRAM,
+       RC_NUM_PROGRAM_TYPES
+};
+
 struct radeon_compiler {
        struct memory_pool Pool;
        struct rc_program Program;
+       enum rc_program_type type;
        unsigned Debug:2;
        unsigned Error:1;
        char * ErrorMsg;
@@ -140,9 +147,21 @@ struct radeon_compiler_pass {
        void *user;             /* Optional parameter which is passed to the run function. */
 };
 
+struct rc_program_stats {
+       unsigned num_insts;
+       unsigned num_fc_insts;
+       unsigned num_tex_insts;
+       unsigned num_rgb_insts;
+       unsigned num_alpha_insts;
+       unsigned num_presub_ops;
+       unsigned num_temp_regs;
+};
+
+void rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s);
+
 /* Executes a list of compiler passes given in the parameter 'list'. */
-void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list,
-                    const char *shader_name);
+void rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pass *list);
+void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list);
 void rc_validate_final_shader(struct radeon_compiler *c, void *user);
 
 #endif /* RADEON_COMPILER_H */
index 2b8d284ce9fda110ef65df6bfcb6e044b5b5f094..2482fc68bebf9bd92c4d0e289d6535c864d3af10 100644 (file)
@@ -48,6 +48,91 @@ unsigned int rc_swizzle_to_writemask(unsigned int swz)
        return mask;
 }
 
+rc_swizzle get_swz(unsigned int swz, rc_swizzle idx)
+{
+       if (idx & 0x4)
+               return idx;
+       return GET_SWZ(swz, idx);
+}
+
+unsigned int combine_swizzles4(unsigned int src,
+               rc_swizzle swz_x, rc_swizzle swz_y, rc_swizzle swz_z, rc_swizzle swz_w)
+{
+       unsigned int ret = 0;
+
+       ret |= get_swz(src, swz_x);
+       ret |= get_swz(src, swz_y) << 3;
+       ret |= get_swz(src, swz_z) << 6;
+       ret |= get_swz(src, swz_w) << 9;
+
+       return ret;
+}
+
+unsigned int combine_swizzles(unsigned int src, unsigned int swz)
+{
+       unsigned int ret = 0;
+
+       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_X));
+       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_Y)) << 3;
+       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_Z)) << 6;
+       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_W)) << 9;
+
+       return ret;
+}
+
+/**
+ * @param mask Must be either RC_MASK_X, RC_MASK_Y, RC_MASK_Z, or RC_MASK_W
+ */
+rc_swizzle rc_mask_to_swizzle(unsigned int mask)
+{
+       switch (mask) {
+       case RC_MASK_X: return RC_SWIZZLE_X;
+       case RC_MASK_Y: return RC_SWIZZLE_Y;
+       case RC_MASK_Z: return RC_SWIZZLE_Z;
+       case RC_MASK_W: return RC_SWIZZLE_W;
+       }
+       return RC_SWIZZLE_UNUSED;
+}
+
+/* Reorder mask bits according to swizzle. */
+unsigned swizzle_mask(unsigned swizzle, unsigned mask)
+{
+       unsigned ret = 0;
+       for (unsigned chan = 0; chan < 4; ++chan) {
+               unsigned swz = GET_SWZ(swizzle, chan);
+               if (swz < 4)
+                       ret |= GET_BIT(mask, swz) << chan;
+       }
+       return ret;
+}
+
+/**
+ * Left multiplication of a register with a swizzle
+ */
+struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg)
+{
+       struct rc_src_register tmp = srcreg;
+       int i;
+       tmp.Swizzle = 0;
+       tmp.Negate = 0;
+       for(i = 0; i < 4; ++i) {
+               rc_swizzle swz = GET_SWZ(swizzle, i);
+               if (swz < 4) {
+                       tmp.Swizzle |= GET_SWZ(srcreg.Swizzle, swz) << (i*3);
+                       tmp.Negate |= GET_BIT(srcreg.Negate, swz) << i;
+               } else {
+                       tmp.Swizzle |= swz << (i*3);
+               }
+       }
+       return tmp;
+}
+
+void reset_srcreg(struct rc_src_register* reg)
+{
+       memset(reg, 0, sizeof(struct rc_src_register));
+       reg->Swizzle = RC_SWIZZLE_XYZW;
+}
+
 unsigned int rc_src_reads_dst_mask(
                rc_register_file src_file,
                unsigned int src_idx,
@@ -138,7 +223,6 @@ unsigned int rc_inst_can_use_presub(
 {
        struct can_use_presub_data d;
        unsigned int num_presub_srcs;
-       unsigned int presub_src_type = rc_source_type_mask(presub_writemask);
        const struct rc_opcode_info * info =
                                        rc_get_opcode_info(inst->U.I.Opcode);
 
@@ -168,13 +252,7 @@ unsigned int rc_inst_can_use_presub(
 
        num_presub_srcs = rc_presubtract_src_reg_count(presub_op);
 
-       if ((presub_src_type & RC_SOURCE_RGB)
-                                       && d.RGBCount + num_presub_srcs > 3) {
-               return 0;
-       }
-
-       if ((presub_src_type & RC_SOURCE_ALPHA)
-                                       && d.AlphaCount + num_presub_srcs > 3) {
+       if (d.RGBCount + num_presub_srcs > 3 || d.AlphaCount + num_presub_srcs > 3) {
                return 0;
        }
 
index e50dfbd4fb9949feb45fe59a7cd6ddd167bdab0c..461ab9ffb10676484bfe5870ddd4ee4072475468 100644 (file)
@@ -8,6 +8,22 @@ struct rc_src_register;
 
 unsigned int rc_swizzle_to_writemask(unsigned int swz);
 
+rc_swizzle get_swz(unsigned int swz, rc_swizzle idx);
+
+unsigned int combine_swizzles4(unsigned int src,
+                              rc_swizzle swz_x, rc_swizzle swz_y,
+                              rc_swizzle swz_z, rc_swizzle swz_w);
+
+unsigned int combine_swizzles(unsigned int src, unsigned int swz);
+
+rc_swizzle rc_mask_to_swizzle(unsigned int mask);
+
+unsigned swizzle_mask(unsigned swizzle, unsigned mask);
+
+struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg);
+
+void reset_srcreg(struct rc_src_register* reg);
+
 unsigned int rc_src_reads_dst_mask(
                rc_register_file src_file,
                unsigned int src_idx,
index a0f7bd81741ed3da80cc28e4c7de2bbc2b61f9e1..133a9f72ec7a1731e2d320647f575a827734d67e 100644 (file)
@@ -56,6 +56,7 @@ static void rewrite_source(struct radeon_compiler * c,
                mov->U.I.DstReg.Index = tempreg;
                mov->U.I.DstReg.WriteMask = split.Phase[phase];
                mov->U.I.SrcReg[0] = inst->U.I.SrcReg[src];
+               mov->U.I.PreSub = inst->U.I.PreSub;
 
                phase_refmask = 0;
                for(unsigned int chan = 0; chan < 4; ++chan) {
index da495a3afaa7d9eb0b666456646e8454f562be9e..25afd272beefd397326c360882ddeeb3311a171c 100644 (file)
@@ -66,6 +66,13 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = {
                .HasDstReg = 1,
                .IsComponentwise = 1
        },
+       {
+               .Opcode = RC_OPCODE_CLAMP,
+               .Name = "CLAMP",
+               .NumSrcRegs = 3,
+               .HasDstReg = 1,
+               .IsComponentwise = 1
+       },
        {
                .Opcode = RC_OPCODE_CMP,
                .Name = "CMP",
@@ -453,6 +460,7 @@ void rc_compute_sources_for_writemask(
                        srcmasks[1] |= RC_MASK_XY;
                        break;
                case RC_OPCODE_DP3:
+               case RC_OPCODE_XPD:
                        srcmasks[0] |= RC_MASK_XYZ;
                        srcmasks[1] |= RC_MASK_XYZ;
                        break;
@@ -460,6 +468,10 @@ void rc_compute_sources_for_writemask(
                        srcmasks[0] |= RC_MASK_XYZW;
                        srcmasks[1] |= RC_MASK_XYZW;
                        break;
+               case RC_OPCODE_DPH:
+                       srcmasks[0] |= RC_MASK_XYZ;
+                       srcmasks[1] |= RC_MASK_XYZW;
+                       break;
                case RC_OPCODE_TXB:
                case RC_OPCODE_TXP:
                        srcmasks[0] |= RC_MASK_W;
index d3f639c87012fc0d8268e52c484879db5c5798a5..7e666101276a2ed96269e324f91777281bbcf5f9 100644 (file)
@@ -50,6 +50,9 @@ typedef enum {
        /** vec4 instruction: dst.c = ceil(src0.c) */
        RC_OPCODE_CEIL,
 
+       /** vec4 instruction: dst.c = clamp(src0.c, src1.c, src2.c) */
+       RC_OPCODE_CLAMP,
+
        /** vec4 instruction: dst.c = src0.c < 0.0 ? src1.c : src2.c */
        RC_OPCODE_CMP,
 
index 27b10ffbd615a3c196b1cb38a07ebce136dca6e7..44f4c0fbdc74b4a119bcdcdfff1e5f225deb3149 100644 (file)
@@ -54,12 +54,7 @@ static struct rc_src_register chain_srcregs(struct rc_src_register outer, struct
                combine.Negate = outer.Negate;
        } else {
                combine.Abs = inner.Abs;
-               combine.Negate = 0;
-               for(unsigned int chan = 0; chan < 4; ++chan) {
-                       unsigned int swz = GET_SWZ(outer.Swizzle, chan);
-                       if (swz < 4)
-                               combine.Negate |= GET_BIT(inner.Negate, swz) << chan;
-               }
+               combine.Negate = swizzle_mask(outer.Swizzle, inner.Negate);
                combine.Negate ^= outer.Negate;
        }
        combine.Swizzle = combine_swizzles(inner.Swizzle, outer.Swizzle);
index 3f880c88fa7f54b4d7da6e794567ba0abcd66233..d53181e1f75646ff6e0513a16c18a81986f4008f 100644 (file)
@@ -217,9 +217,9 @@ static void compute_live_intervals(struct radeon_compiler *c,
                 * instruction is used as the end of the live interval and
                 * the BGNLOOP instruction is used as the beginning. */
                if (inst->U.I.Opcode == RC_OPCODE_BGNLOOP && s->EndLoop < 0) {
-                       s->BeginLoop = inst->IP;
                        int loops = 1;
                        struct rc_instruction * tmp;
+                       s->BeginLoop = inst->IP;
                        for(tmp = inst->Next;
                                        tmp != &s->C->Program.Instructions;
                                        tmp = tmp->Next) {
index cbb5ef6237e98962534fe1b33847c2f20e0e5f2e..9beb5d6357996c9651796742c6e3fba6ea55ecdb 100644 (file)
@@ -701,7 +701,7 @@ static int convert_rgb_to_alpha(
                                get_reg_valuep(s,
                                        RC_FILE_TEMPORARY,
                                        pair_inst->RGB.DestIndex,
-                                       rc_mask_to_swz(old_mask));
+                                       rc_mask_to_swizzle(old_mask));
                        new_index = i;
                        *new_regvalp = *old_regvalp;
                        *old_regvalp = NULL;
index d7bedc57291938ce887ca56e0b98b70b7e1cb2bb..fe5756ebc45deb990ab2636d3b522ee2749ae7f0 100644 (file)
@@ -71,27 +71,6 @@ void rc_local_transform(
        }
 }
 
-/**
- * Left multiplication of a register with a swizzle
- */
-struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg)
-{
-       struct rc_src_register tmp = srcreg;
-       int i;
-       tmp.Swizzle = 0;
-       tmp.Negate = 0;
-       for(i = 0; i < 4; ++i) {
-               rc_swizzle swz = GET_SWZ(swizzle, i);
-               if (swz < 4) {
-                       tmp.Swizzle |= GET_SWZ(srcreg.Swizzle, swz) << (i*3);
-                       tmp.Negate |= GET_BIT(srcreg.Negate, swz) << i;
-               } else {
-                       tmp.Swizzle |= swz << (i*3);
-               }
-       }
-       return tmp;
-}
-
 struct get_used_temporaries_data {
        unsigned char * Used;
        unsigned int UsedLength;
@@ -244,14 +223,3 @@ unsigned int rc_recompute_ips(struct radeon_compiler * c)
 
        return ip;
 }
-
-rc_swizzle rc_mask_to_swizzle(unsigned int mask)
-{
-       switch(mask) {
-               case RC_MASK_X: return RC_SWIZZLE_X;
-               case RC_MASK_Y: return RC_SWIZZLE_Y;
-               case RC_MASK_Z: return RC_SWIZZLE_Z;
-               case RC_MASK_W: return RC_SWIZZLE_W;
-               default: return RC_SWIZZLE_UNUSED;
-       }
-}
index be078b4f4fa596a8fac216d3939ab6b7fd6283f8..df6c94b35f9ba07bbd1ef0aa76b1028ad3adb113 100644 (file)
@@ -159,61 +159,6 @@ struct rc_program {
        struct rc_constant_list Constants;
 };
 
-static inline rc_swizzle get_swz(unsigned int swz, rc_swizzle idx)
-{
-       if (idx & 0x4)
-               return idx;
-       return GET_SWZ(swz, idx);
-}
-
-static inline unsigned int combine_swizzles4(unsigned int src,
-               rc_swizzle swz_x, rc_swizzle swz_y, rc_swizzle swz_z, rc_swizzle swz_w)
-{
-       unsigned int ret = 0;
-
-       ret |= get_swz(src, swz_x);
-       ret |= get_swz(src, swz_y) << 3;
-       ret |= get_swz(src, swz_z) << 6;
-       ret |= get_swz(src, swz_w) << 9;
-
-       return ret;
-}
-
-static inline unsigned int combine_swizzles(unsigned int src, unsigned int swz)
-{
-       unsigned int ret = 0;
-
-       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_X));
-       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_Y)) << 3;
-       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_Z)) << 6;
-       ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_W)) << 9;
-
-       return ret;
-}
-
-/**
- * @param mask Must be either RC_MASK_X, RC_MASK_Y, RC_MASK_Z, or RC_MASK_W
- */
-static inline rc_swizzle rc_mask_to_swz(unsigned int mask)
-{
-       switch (mask) {
-       case RC_MASK_X: return RC_SWIZZLE_X;
-       case RC_MASK_Y: return RC_SWIZZLE_Y;
-       case RC_MASK_Z: return RC_SWIZZLE_Z;
-       case RC_MASK_W: return RC_SWIZZLE_W;
-       default: assert(0);
-       }
-       return RC_SWIZZLE_UNUSED;
-}
-struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg);
-
-static inline void reset_srcreg(struct rc_src_register* reg)
-{
-       memset(reg, 0, sizeof(struct rc_src_register));
-       reg->Swizzle = RC_SWIZZLE_XYZW;
-}
-
-
 /**
  * A transformation that can be passed to \ref rc_local_transform.
  *
index 39408845d5ad80f69d3efe0ae9d4b2bac4beb3df..c8063171b81e7c95ed93b8f727a53553d21fee38 100644 (file)
@@ -36,6 +36,7 @@
 #include "radeon_program_alu.h"
 
 #include "radeon_compiler.h"
+#include "radeon_compiler_util.h"
 
 
 static struct rc_instruction *emit1(
@@ -84,16 +85,6 @@ static struct rc_instruction *emit3(
        return fpi;
 }
 
-static struct rc_dst_register dstreg(int file, int index)
-{
-       struct rc_dst_register dst;
-       dst.File = file;
-       dst.Index = index;
-       dst.WriteMask = RC_MASK_XYZW;
-       dst.RelAddr = 0;
-       return dst;
-}
-
 static struct rc_dst_register dstregtmpmask(int index, int mask)
 {
        struct rc_dst_register dst = {0};
@@ -186,6 +177,38 @@ static struct rc_src_register swizzle_wwww(struct rc_src_register reg)
        return swizzle_smear(reg, RC_SWIZZLE_W);
 }
 
+static int is_dst_safe_to_reuse(struct rc_instruction *inst)
+{
+       const struct rc_opcode_info *info = rc_get_opcode_info(inst->U.I.Opcode);
+       unsigned i;
+
+       assert(info->HasDstReg);
+
+       if (inst->U.I.DstReg.File != RC_FILE_TEMPORARY)
+               return 0;
+
+       for (i = 0; i < info->NumSrcRegs; i++) {
+               if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY &&
+                   inst->U.I.SrcReg[i].Index == inst->U.I.DstReg.Index)
+                       return 0;
+       }
+
+       return 1;
+}
+
+static struct rc_dst_register try_to_reuse_dst(struct radeon_compiler *c,
+                                              struct rc_instruction *inst)
+{
+       unsigned tmp;
+
+       if (is_dst_safe_to_reuse(inst))
+               tmp = inst->U.I.DstReg.Index;
+       else
+               tmp = rc_find_free_temporary(c);
+
+       return dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask);
+}
+
 static void transform_ABS(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
@@ -209,10 +232,26 @@ static void transform_CEIL(struct radeon_compiler* c,
         *     ceil(x) = x+frac(-x)
         */
 
-       int tempreg = rc_find_free_temporary(c);
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]));
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, negate(inst->U.I.SrcReg[0]));
        emit2(c, inst->Prev, RC_OPCODE_ADD, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, tempreg));
+               inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index));
+       rc_remove_instruction(inst);
+}
+
+static void transform_CLAMP(struct radeon_compiler *c,
+       struct rc_instruction *inst)
+{
+       /* CLAMP dst, src, min, max
+        *    into:
+        * MIN tmp, src, max
+        * MAX dst, tmp, min
+        */
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+       emit2(c, inst->Prev, RC_OPCODE_MIN, 0, dst,
+               inst->U.I.SrcReg[0], inst->U.I.SrcReg[2]);
+       emit2(c, inst->Prev, RC_OPCODE_MAX, inst->U.I.SaturateMode, inst->U.I.DstReg,
+               srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1]);
        rc_remove_instruction(inst);
 }
 
@@ -258,10 +297,10 @@ static void transform_DST(struct radeon_compiler* c,
 static void transform_FLR(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
-       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0]);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+       emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, inst->U.I.SrcReg[0]);
        emit2(c, inst->Prev, RC_OPCODE_ADD, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, tempreg)));
+               inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
        rc_remove_instruction(inst);
 }
 
@@ -351,14 +390,14 @@ static void transform_LIT(struct radeon_compiler* c,
 static void transform_LRP(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
        emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
-               dstreg(RC_FILE_TEMPORARY, tempreg),
+               dst,
                inst->U.I.SrcReg[1], negate(inst->U.I.SrcReg[2]));
        emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode,
                inst->U.I.DstReg,
-               inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[2]);
+               inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[2]);
 
        rc_remove_instruction(inst);
 }
@@ -366,9 +405,8 @@ static void transform_LRP(struct radeon_compiler* c,
 static void transform_POW(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
-       struct rc_dst_register tempdst = dstreg(RC_FILE_TEMPORARY, tempreg);
-       struct rc_src_register tempsrc = srcreg(RC_FILE_TEMPORARY, tempreg);
+       struct rc_dst_register tempdst = try_to_reuse_dst(c, inst);
+       struct rc_src_register tempsrc = srcreg(RC_FILE_TEMPORARY, tempdst.Index);
        tempdst.WriteMask = RC_MASK_W;
        tempsrc.Swizzle = RC_SWIZZLE_WWWW;
 
@@ -388,11 +426,11 @@ static void transform_RSQ(struct radeon_compiler* c,
 static void transform_SEQ(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               negate(absolute(srcreg(RC_FILE_TEMPORARY, tempreg))), builtin_zero, builtin_one);
+               negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_zero, builtin_one);
 
        rc_remove_instruction(inst);
 }
@@ -407,11 +445,11 @@ static void transform_SFL(struct radeon_compiler* c,
 static void transform_SGE(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               srcreg(RC_FILE_TEMPORARY, tempreg), builtin_zero, builtin_one);
+               srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
 
        rc_remove_instruction(inst);
 }
@@ -419,11 +457,11 @@ static void transform_SGE(struct radeon_compiler* c,
 static void transform_SGT(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
+       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
        emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               srcreg(RC_FILE_TEMPORARY, tempreg), builtin_one, builtin_zero);
+               srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
 
        rc_remove_instruction(inst);
 }
@@ -431,11 +469,11 @@ static void transform_SGT(struct radeon_compiler* c,
 static void transform_SLE(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
+       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
        emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               srcreg(RC_FILE_TEMPORARY, tempreg), builtin_zero, builtin_one);
+               srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
 
        rc_remove_instruction(inst);
 }
@@ -443,11 +481,11 @@ static void transform_SLE(struct radeon_compiler* c,
 static void transform_SLT(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               srcreg(RC_FILE_TEMPORARY, tempreg), builtin_one, builtin_zero);
+               srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
 
        rc_remove_instruction(inst);
 }
@@ -455,11 +493,11 @@ static void transform_SLT(struct radeon_compiler* c,
 static void transform_SNE(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+       emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
        emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-               negate(absolute(srcreg(RC_FILE_TEMPORARY, tempreg))), builtin_one, builtin_zero);
+               negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_one, builtin_zero);
 
        rc_remove_instruction(inst);
 }
@@ -473,12 +511,13 @@ static void transform_SSG(struct radeon_compiler* c,
         *   CMP tmp1, x, 1, 0
         *   ADD result, tmp0, -tmp1;
         */
-       unsigned tmp0, tmp1;
+       struct rc_dst_register dst0;
+       unsigned tmp1;
 
        /* 0 < x */
-       tmp0 = rc_find_free_temporary(c);
+       dst0 = try_to_reuse_dst(c, inst);
        emit3(c, inst->Prev, RC_OPCODE_CMP, 0,
-             dstregtmpmask(tmp0, inst->U.I.DstReg.WriteMask),
+             dst0,
              negate(inst->U.I.SrcReg[0]),
              builtin_one,
              builtin_zero);
@@ -495,7 +534,7 @@ static void transform_SSG(struct radeon_compiler* c,
        /* result = tmp0 - tmp1 */
        emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
              inst->U.I.DstReg,
-             srcreg(RC_FILE_TEMPORARY, tmp0),
+             srcreg(RC_FILE_TEMPORARY, dst0.Index),
              negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
 
        rc_remove_instruction(inst);
@@ -517,15 +556,15 @@ static void transform_SWZ(struct radeon_compiler* c,
 static void transform_XPD(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
-       emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstreg(RC_FILE_TEMPORARY, tempreg),
+       emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dst,
                swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W),
                swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W));
        emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode, inst->U.I.DstReg,
                swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W),
                swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W),
-               negate(srcreg(RC_FILE_TEMPORARY, tempreg)));
+               negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
 
        rc_remove_instruction(inst);
 }
@@ -553,6 +592,7 @@ int radeonTransformALU(
        switch(inst->U.I.Opcode) {
        case RC_OPCODE_ABS: transform_ABS(c, inst); return 1;
        case RC_OPCODE_CEIL: transform_CEIL(c, inst); return 1;
+       case RC_OPCODE_CLAMP: transform_CLAMP(c, inst); return 1;
        case RC_OPCODE_DP2: transform_DP2(c, inst); return 1;
        case RC_OPCODE_DPH: transform_DPH(c, inst); return 1;
        case RC_OPCODE_DST: transform_DST(c, inst); return 1;
@@ -592,7 +632,7 @@ static void transform_r300_vertex_CMP(struct radeon_compiler* c,
 {
        /* There is no decent CMP available, so let's rig one up.
         * CMP is defined as dst = src0 < 0.0 ? src1 : src2
-        * The following sequence consumes two temps and two extra slots
+        * The following sequence consumes zero to two temps and two extra slots
         * (the second temp and the second slot is consumed by transform_LRP),
         * but should be equivalent:
         *
@@ -600,18 +640,18 @@ static void transform_r300_vertex_CMP(struct radeon_compiler* c,
         * LRP dst, tmp0, src1, src2
         *
         * Yes, I know, I'm a mad scientist. ~ C. & M. */
-       int tempreg0 = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 
        /* SLT tmp0, src0, 0.0 */
        emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
-               dstreg(RC_FILE_TEMPORARY, tempreg0),
+               dst,
                inst->U.I.SrcReg[0], builtin_zero);
 
        /* LRP dst, tmp0, src1, src2 */
        transform_LRP(c,
                emit3(c, inst->Prev, RC_OPCODE_LRP, 0,
                      inst->U.I.DstReg,
-                     srcreg(RC_FILE_TEMPORARY, tempreg0), inst->U.I.SrcReg[1],  inst->U.I.SrcReg[2]));
+                     srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1],  inst->U.I.SrcReg[2]));
 
        rc_remove_instruction(inst);
 }
@@ -642,24 +682,25 @@ static void transform_r300_vertex_DP3(struct radeon_compiler* c,
 static void transform_r300_vertex_fix_LIT(struct radeon_compiler* c,
        struct rc_instruction* inst)
 {
-       int tempreg = rc_find_free_temporary(c);
+       struct rc_dst_register dst = try_to_reuse_dst(c, inst);
        unsigned constant_swizzle;
        int constant = rc_constants_add_immediate_scalar(&c->Program.Constants,
                                                         0.0000000000000000001,
                                                         &constant_swizzle);
 
        /* MOV dst, src */
+       dst.WriteMask = RC_MASK_XYZW;
        emit1(c, inst->Prev, RC_OPCODE_MOV, 0,
-               dstreg(RC_FILE_TEMPORARY, tempreg),
+               dst,
                inst->U.I.SrcReg[0]);
 
-       /* MAX dst.z, src, 0.00...001 */
+       /* MAX dst.y, src, 0.00...001 */
        emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
-               dstregtmpmask(tempreg, RC_MASK_Y),
-               srcreg(RC_FILE_TEMPORARY, tempreg),
+               dstregtmpmask(dst.Index, RC_MASK_Y),
+               srcreg(RC_FILE_TEMPORARY, dst.Index),
                srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));
 
-       inst->U.I.SrcReg[0] = srcreg(RC_FILE_TEMPORARY, tempreg);
+       inst->U.I.SrcReg[0] = srcreg(RC_FILE_TEMPORARY, dst.Index);
 }
 
 static void transform_r300_vertex_SEQ(struct radeon_compiler *c,
@@ -743,12 +784,13 @@ static void transform_r300_vertex_SSG(struct radeon_compiler* c,
         *   SLT tmp1, x, 0;
         *   ADD result, tmp0, -tmp1;
         */
-       unsigned tmp0, tmp1;
+       struct rc_dst_register dst0 = try_to_reuse_dst(c, inst);
+       unsigned tmp1;
 
        /* 0 < x */
-       tmp0 = rc_find_free_temporary(c);
+       dst0 = try_to_reuse_dst(c, inst);
        emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
-             dstregtmpmask(tmp0, inst->U.I.DstReg.WriteMask),
+             dst0,
              builtin_zero,
              inst->U.I.SrcReg[0]);
 
@@ -763,7 +805,7 @@ static void transform_r300_vertex_SSG(struct radeon_compiler* c,
        /* result = tmp0 - tmp1 */
        emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
              inst->U.I.DstReg,
-             srcreg(RC_FILE_TEMPORARY, tmp0),
+             srcreg(RC_FILE_TEMPORARY, dst0.Index),
              negate(srcreg(RC_FILE_TEMPORARY, tmp1)));
 
        rc_remove_instruction(inst);
@@ -781,6 +823,7 @@ int r300_transform_vertex_alu(
        switch(inst->U.I.Opcode) {
        case RC_OPCODE_ABS: transform_r300_vertex_ABS(c, inst); return 1;
        case RC_OPCODE_CEIL: transform_CEIL(c, inst); return 1;
+       case RC_OPCODE_CLAMP: transform_CLAMP(c, inst); return 1;
        case RC_OPCODE_CMP: transform_r300_vertex_CMP(c, inst); return 1;
        case RC_OPCODE_DP2: transform_r300_vertex_DP2(c, inst); return 1;
        case RC_OPCODE_DP3: transform_r300_vertex_DP3(c, inst); return 1;
index 530afa5e08e245984a7acee765f8523b7ad2201a..f9d9f34b6ad9f7e25629450df2ee144f88f0b779 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "radeon_program_tex.h"
 
+#include "radeon_compiler_util.h"
+
 /* Series of transformations to be done on textures. */
 
 static struct rc_src_register shadow_ambient(struct r300_fragment_program_compiler *compiler,
index 5f67f536f61ae29e75aff97d7f8177551f2953ee..7d76585a593b6b822bd48b1d12a5477e947019b1 100644 (file)
@@ -87,8 +87,9 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user)
                rc_for_all_reads_src(inst, mark_used, &d);
        }
 
-       /* Pass 2: If there is relative addressing, mark all externals as used. */
-       if (has_rel_addr) {
+       /* Pass 2: If there is relative addressing or dead constant elimination
+        * is disabled, mark all externals as used. */
+       if (has_rel_addr || !c->remove_unused_constants) {
                for (unsigned i = 0; i < c->Program.Constants.Count; i++)
                        if (constants[i].Type == RC_CONSTANT_EXTERNAL)
                                const_used[i] = 1;
@@ -119,7 +120,7 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user)
        /*  is_identity ==> new_count == old_count
         * !is_identity ==> new_count <  old_count */
        assert( is_identity || new_count <  c->Program.Constants.Count);
-       assert(!(has_rel_addr && are_externals_remapped));
+       assert(!((has_rel_addr || !c->remove_unused_constants) && are_externals_remapped));
 
        /* Pass 4: Redirect reads of all constants to their new locations. */
        if (!is_identity) {
@@ -127,7 +128,6 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user)
                     inst != &c->Program.Instructions; inst = inst->Next) {
                        rc_remap_registers(inst, remap_regs, inv_remap_table);
                }
-
        }
 
        /* Set the new constant count. Note that new_count may be less than
index 88165f78953e456c80ed2672cf289c0967a1391c..5bd19c0b9c615c9d57d77a2bee0eff665923b042 100644 (file)
@@ -51,6 +51,14 @@ void rc_rename_regs(struct radeon_compiler *c, void *user)
        struct rc_reader_data reader_data;
        unsigned char * used;
 
+       /* XXX Remove this once the register allocation works with flow control. */
+       for(inst = c->Program.Instructions.Next;
+                                       inst != &c->Program.Instructions;
+                                       inst = inst->Next) {
+               if (inst->U.I.Opcode == RC_OPCODE_BGNLOOP)
+                       return;
+       }
+
        used_length = 2 * rc_recompute_ips(c);
        used = memory_pool_malloc(&c->Pool, sizeof(unsigned char) * used_length);
        memset(used, 0, sizeof(unsigned char) * used_length);
index c288834d24349b0d52fa9daa66742affae6a359e..0d8bd4fc706d4cd29c60610aaad63098f5f950a4 100644 (file)
@@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/extensions.h"
 #include "main/bufferobj.h"
 #include "main/texobj.h"
+#include "main/mfeatures.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
index de662939992f9e46a8df3fb68783428604dd62b3..f930b4d06bf7e9e62428db8e9a2dc41b1946dc5a 100644 (file)
@@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/image.h"
+#include "main/mfeatures.h"
 #include "main/mipmap.h"
 #include "main/simple_list.h"
 #include "main/texstore.h"
index fc9fa9d22c7a6b2e10d45a6aa0a03d663a497cc5..e07da8c15b469d4f77e226845a099791d66f0c44 100644 (file)
@@ -1406,9 +1406,95 @@ eg_set_default_state(context_t *context)
            num_hs_stack_entries = 85;
            num_ls_stack_entries = 85;
            break;
+    case CHIP_FAMILY_PALM:
+           num_ps_gprs = 93;
+           num_vs_gprs = 46;
+           num_temp_gprs = 4;
+           num_gs_gprs = 31;
+           num_es_gprs = 31;
+           num_hs_gprs = 23;
+           num_ls_gprs = 23;
+           num_ps_threads = 96;
+           num_vs_threads = 16;
+           num_gs_threads = 16;
+           num_es_threads = 16;
+           num_hs_threads = 16;
+           num_ls_threads = 16;
+           num_ps_stack_entries = 42;
+           num_vs_stack_entries = 42;
+           num_gs_stack_entries = 42;
+           num_es_stack_entries = 42;
+           num_hs_stack_entries = 42;
+           num_ls_stack_entries = 42;
+           break;
+    case CHIP_FAMILY_BARTS:
+           num_ps_gprs = 93;
+           num_vs_gprs = 46;
+           num_temp_gprs = 4;
+           num_gs_gprs = 31;
+           num_es_gprs = 31;
+           num_hs_gprs = 23;
+           num_ls_gprs = 23;
+           num_ps_threads = 128;
+           num_vs_threads = 20;
+           num_gs_threads = 20;
+           num_es_threads = 20;
+           num_hs_threads = 20;
+           num_ls_threads = 20;
+           num_ps_stack_entries = 85;
+           num_vs_stack_entries = 85;
+           num_gs_stack_entries = 85;
+           num_es_stack_entries = 85;
+           num_hs_stack_entries = 85;
+           num_ls_stack_entries = 85;
+           break;
+    case CHIP_FAMILY_TURKS:
+           num_ps_gprs = 93;
+           num_vs_gprs = 46;
+           num_temp_gprs = 4;
+           num_gs_gprs = 31;
+           num_es_gprs = 31;
+           num_hs_gprs = 23;
+           num_ls_gprs = 23;
+           num_ps_threads = 128;
+           num_vs_threads = 20;
+           num_gs_threads = 20;
+           num_es_threads = 20;
+           num_hs_threads = 20;
+           num_ls_threads = 20;
+           num_ps_stack_entries = 42;
+           num_vs_stack_entries = 42;
+           num_gs_stack_entries = 42;
+           num_es_stack_entries = 42;
+           num_hs_stack_entries = 42;
+           num_ls_stack_entries = 42;
+           break;
+    case CHIP_FAMILY_CAICOS:
+           num_ps_gprs = 93;
+           num_vs_gprs = 46;
+           num_temp_gprs = 4;
+           num_gs_gprs = 31;
+           num_es_gprs = 31;
+           num_hs_gprs = 23;
+           num_ls_gprs = 23;
+           num_ps_threads = 128;
+           num_vs_threads = 10;
+           num_gs_threads = 10;
+           num_es_threads = 10;
+           num_hs_threads = 10;
+           num_ls_threads = 10;
+           num_ps_stack_entries = 42;
+           num_vs_stack_entries = 42;
+           num_gs_stack_entries = 42;
+           num_es_stack_entries = 42;
+           num_hs_stack_entries = 42;
+           num_ls_stack_entries = 42;
+           break;
     }
 
-    if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CEDAR)
+    if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CEDAR) ||
+       (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_PALM) ||
+       (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CAICOS))
            CLEARbit(sq_config, EG_SQ_CONFIG__VC_ENABLE_bit);
     else
            SETbit(sq_config, EG_SQ_CONFIG__VC_ENABLE_bit);
index 076a608573ced0ac605bfcafc4c62ee5c68d7043..648cda0078e242cc50bdeee53cddcd90d55dee3a 100644 (file)
@@ -1469,6 +1469,30 @@ static void evergreenInitSQConfig(struct gl_context * ctx)
         uMaxThreads = 192;
         uMaxStackEntries = 256;
            break;
+    case CHIP_FAMILY_BARTS:
+           uSqNumCfInsts       = 2;
+        bVC_ENABLE = GL_TRUE;
+        uMaxGPRs = 256;
+        uPSThreadCount = 128;
+        uMaxThreads = 248;
+        uMaxStackEntries = 512;
+           break;
+    case CHIP_FAMILY_TURKS:
+           uSqNumCfInsts       = 2;
+        bVC_ENABLE = GL_TRUE;
+        uMaxGPRs = 256;
+        uPSThreadCount = 128;
+        uMaxThreads = 248;
+        uMaxStackEntries = 256;
+           break;
+    case CHIP_FAMILY_CAICOS:
+           uSqNumCfInsts       = 1;
+        bVC_ENABLE = GL_FALSE;
+        uMaxGPRs = 256;
+        uPSThreadCount = 128;
+        uMaxThreads = 192;
+        uMaxStackEntries = 256;
+           break;
     default:
         uSqNumCfInsts       = 2;
         bVC_ENABLE = GL_TRUE;
index 057d98e0fc585897b0ad3c6d8ee5ca30837573f9..00708be19937dbcc667a49a89447f66df86a7c12 100644 (file)
@@ -44,6 +44,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/bufferobj.h"
 #include "main/texobj.h"
 #include "main/points.h"
+#include "main/mfeatures.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -259,7 +260,7 @@ static void r600InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
     R700_CHIP_CONTEXT *r700    = (R700_CHIP_CONTEXT*)(&context->hw);
 
     if(  (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_CEDAR)
-       &&(context->radeon.radeonScreen->chip_family <= CHIP_FAMILY_PALM) )
+       &&(context->radeon.radeonScreen->chip_family <= CHIP_FAMILY_CAICOS) )
     {
         r700->bShaderUseMemConstant = GL_TRUE;
     }
@@ -285,8 +286,13 @@ static void r600InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
        ctx->Const.MaxTextureMaxAnisotropy = 16.0;
        ctx->Const.MaxTextureLodBias = 16.0;
 
-       ctx->Const.MaxTextureLevels = 13; /* hw support 14 */
-       ctx->Const.MaxTextureRectSize = 4096; /* hw support 8192 */
+       if (screen->chip_family >= CHIP_FAMILY_CEDAR) {
+               ctx->Const.MaxTextureLevels = 15;
+               ctx->Const.MaxTextureRectSize = 16384;
+       } else {
+               ctx->Const.MaxTextureLevels = 14;
+               ctx->Const.MaxTextureRectSize = 8192;
+       }
 
        ctx->Const.MinPointSize   = 0x0001 / 8.0;
        ctx->Const.MinPointSizeAA = 0x0001 / 8.0;
index c3d68c41e573458a5ebb4c99848e617f8adb15ec..2a99ded5d674ba7c6dcc5fda6c30a6b5abbdaf59 100644 (file)
@@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/image.h"
+#include "main/mfeatures.h"
 #include "main/mipmap.h"
 #include "main/simple_list.h"
 #include "main/texstore.h"
index 2bf24096a0dbe8324d5d318cd016b9518cfbc868..024853c1beb160a7503a83d7d8b52fb2f17614df 100644 (file)
@@ -481,6 +481,8 @@ unsigned int EG_GetNumOperands(GLuint opcode, GLuint nIsOp3)
     case EG_OP2_INST_FLT_TO_INT:
     case EG_OP2_INST_SIN:
     case EG_OP2_INST_COS:
+    case EG_OP2_INST_FLT_TO_INT_FLOOR:
+    case EG_OP2_INST_MOVA_INT:
         return 1;
         
     default: radeon_error(
@@ -1134,7 +1136,7 @@ GLboolean EG_assemble_vfetch_instruction(r700_AssemblerBase* pAsm,
              EG_VTX_WORD1__DST_SEL_W_shift,
              EG_VTX_WORD1__DST_SEL_W_mask);
     
-    SETfield(vfetch_instruction_ptr->m_Word1.val, 0, /* use format here, in r6/r7, format used set in const, need to use same */
+    SETfield(vfetch_instruction_ptr->m_Word1.val, 1, 
              EG_VTX_WORD1__UCF_shift,
              EG_VTX_WORD1__UCF_bit);
     SETfield(vfetch_instruction_ptr->m_Word1.val, data_format,
@@ -3297,23 +3299,76 @@ GLboolean assemble_ARL(r700_AssemblerBase *pAsm)
         return GL_FALSE;
     }
 
-    pAsm->D.dst.opcode = SQ_OP2_INST_MOVA_FLOOR;
-    setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
-    pAsm->D.dst.rtype = DST_REG_TEMPORARY;
-    pAsm->D.dst.reg = 0;
-    pAsm->D.dst.writex = 0;
-    pAsm->D.dst.writey = 0;
-    pAsm->D.dst.writez = 0;
-    pAsm->D.dst.writew = 0;
-
-    if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+    if(8 == pAsm->unAsic)
     {
-        return GL_FALSE;
-    }
+        /* Evergreen */
 
-    if( GL_FALSE == next_ins(pAsm) )
+        /* Float to Signed Integer Using FLOOR */
+        pAsm->D.dst.opcode = EG_OP2_INST_FLT_TO_INT_FLOOR;
+        setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+        pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+        pAsm->D.dst.reg = 0;
+        pAsm->D.dst.writex = 0;
+        pAsm->D.dst.writey = 0;
+        pAsm->D.dst.writez = 0;
+        pAsm->D.dst.writew = 0;
+
+        if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+        {
+            return GL_FALSE;
+        }
+
+        if( GL_FALSE == next_ins(pAsm) )
+        {
+            return GL_FALSE;
+        }
+
+        /* Copy Signed Integer To Integer in AR and GPR */
+        pAsm->D.dst.opcode = EG_OP2_INST_MOVA_INT;
+        setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+        pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+        pAsm->D.dst.reg = 0;
+        pAsm->D.dst.writex = 0;
+        pAsm->D.dst.writey = 0;
+        pAsm->D.dst.writez = 0;
+        pAsm->D.dst.writew = 0;
+
+        if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+        {
+            return GL_FALSE;
+        }
+
+        if( GL_FALSE == next_ins(pAsm) )
+        {
+            return GL_FALSE;
+        }
+    }
+    else
     {
-        return GL_FALSE;
+        /* r6xx/r7xx */
+
+        /* Truncate floating-point to the nearest integer
+           in the range [-256, +255], and copy to AR and
+           to a GPR.
+        */
+        pAsm->D.dst.opcode = SQ_OP2_INST_MOVA_FLOOR;
+        setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+        pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+        pAsm->D.dst.reg = 0;
+        pAsm->D.dst.writex = 0;
+        pAsm->D.dst.writey = 0;
+        pAsm->D.dst.writez = 0;
+        pAsm->D.dst.writew = 0;
+
+        if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+        {
+            return GL_FALSE;
+        }
+
+        if( GL_FALSE == next_ins(pAsm) )
+        {
+            return GL_FALSE;
+        }
     }
 
     return GL_TRUE;
@@ -3334,7 +3389,14 @@ GLboolean assemble_CMP(r700_AssemblerBase *pAsm)
         return GL_FALSE;
     }
 
-    pAsm->D.dst.opcode = SQ_OP3_INST_CNDGE;
+    if(8 == pAsm->unAsic)
+    {
+       pAsm->D.dst.opcode = EG_OP3_INST_CNDGE;
+    }
+    else
+    {
+       pAsm->D.dst.opcode = SQ_OP3_INST_CNDGE;
+    }
     pAsm->D.dst.op3     = 1;  
 
     tmp = (-1);
@@ -3416,8 +3478,14 @@ GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode)
     checkop1(pAsm);
 
     tmp = gethelpr(pAsm);
-
-    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    if(8 == pAsm->unAsic)
+    {
+        pAsm->D.dst.opcode = EG_OP3_INST_MULADD;
+    }
+    else
+    {
+        pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    }
     pAsm->D.dst.op3    = 1;
 
     setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
@@ -3457,7 +3525,14 @@ GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode)
     {
         return GL_FALSE;
     }
-    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    if(8 == pAsm->unAsic)
+    {
+        pAsm->D.dst.opcode = EG_OP3_INST_MULADD;
+    }
+    else
+    {
+        pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    }
     pAsm->D.dst.op3    = 1;
 
     setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
@@ -4742,7 +4817,14 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm)
 
     tmp = gethelpr(pAsm);
 
-    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    if(8 == pAsm->unAsic)
+    {
+        pAsm->D.dst.opcode = EG_OP3_INST_MULADD;
+    }
+    else
+    {
+        pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    }
     pAsm->D.dst.op3    = 1;
 
     setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
@@ -4782,7 +4864,14 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm)
     {
         return GL_FALSE;
     }
-    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    if(8 == pAsm->unAsic)
+    {
+        pAsm->D.dst.opcode = EG_OP3_INST_MULADD;
+    }
+    else
+    {
+        pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    }
     pAsm->D.dst.op3    = 1;
 
     setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
@@ -5010,7 +5099,14 @@ GLboolean assemble_SSG(r700_AssemblerBase *pAsm)
     
     GLuint tmp = gethelpr(pAsm);
     /* tmp = (src > 0 ? 1 : src) */
-    pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT;
+    if(8 == pAsm->unAsic)
+    {
+        pAsm->D.dst.opcode = EG_OP3_INST_CNDGT;
+    }
+    else
+    {
+        pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT;
+    }
     pAsm->D.dst.op3    = 1;
     pAsm->D.dst.rtype = DST_REG_TEMPORARY;
     pAsm->D.dst.reg   = tmp;
@@ -5033,7 +5129,14 @@ GLboolean assemble_SSG(r700_AssemblerBase *pAsm)
     }
 
     /* dst = (-tmp > 0 ? -1 : tmp) */
-    pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT;
+    if(8 == pAsm->unAsic)
+    {
+        pAsm->D.dst.opcode = EG_OP3_INST_CNDGT;
+    }
+    else
+    {
+        pAsm->D.dst.opcode = SQ_OP3_INST_CNDGT;
+    }
     pAsm->D.dst.op3    = 1;
 
     if( GL_FALSE == assemble_dst(pAsm) )
index 6c2648b6bd86c99f7787a614145b14520066740f..60f104960261a283433b005df608ab338d0ef0a1 100644 (file)
@@ -67,6 +67,9 @@ struct drm_radeon_info {
 #define DRM_RADEON_INFO 0x1
 #endif
 
+static inline void radeon_gem_get_kernel_name(struct radeon_bo *dummy, uint32_t *value)
+{
+}
 
 static inline uint32_t radeon_gem_name_bo(struct radeon_bo *dummy)
 {
index 82789cec5ed4b3def8b00f0e7b04ae345e32e7d9..399052cbcbd08ef315b79b15d3472d8226863882 100644 (file)
 #define PCI_CHIP_PALM_9804              0x9804
 #define PCI_CHIP_PALM_9805              0x9805
 
+#define PCI_CHIP_BARTS_6720             0x6720
+#define PCI_CHIP_BARTS_6721             0x6721
+#define PCI_CHIP_BARTS_6722             0x6722
+#define PCI_CHIP_BARTS_6723             0x6723
+#define PCI_CHIP_BARTS_6724             0x6724
+#define PCI_CHIP_BARTS_6725             0x6725
+#define PCI_CHIP_BARTS_6726             0x6726
+#define PCI_CHIP_BARTS_6727             0x6727
+#define PCI_CHIP_BARTS_6728             0x6728
+#define PCI_CHIP_BARTS_6729             0x6729
+#define PCI_CHIP_BARTS_6738             0x6738
+#define PCI_CHIP_BARTS_6739             0x6739
+
+#define PCI_CHIP_TURKS_6740             0x6740
+#define PCI_CHIP_TURKS_6741             0x6741
+#define PCI_CHIP_TURKS_6742             0x6742
+#define PCI_CHIP_TURKS_6743             0x6743
+#define PCI_CHIP_TURKS_6744             0x6744
+#define PCI_CHIP_TURKS_6745             0x6745
+#define PCI_CHIP_TURKS_6746             0x6746
+#define PCI_CHIP_TURKS_6747             0x6747
+#define PCI_CHIP_TURKS_6748             0x6748
+#define PCI_CHIP_TURKS_6749             0x6749
+#define PCI_CHIP_TURKS_6750             0x6750
+#define PCI_CHIP_TURKS_6758             0x6758
+#define PCI_CHIP_TURKS_6759             0x6759
+
+#define PCI_CHIP_CAICOS_6760            0x6760
+#define PCI_CHIP_CAICOS_6761            0x6761
+#define PCI_CHIP_CAICOS_6762            0x6762
+#define PCI_CHIP_CAICOS_6763            0x6763
+#define PCI_CHIP_CAICOS_6764            0x6764
+#define PCI_CHIP_CAICOS_6765            0x6765
+#define PCI_CHIP_CAICOS_6766            0x6766
+#define PCI_CHIP_CAICOS_6767            0x6767
+#define PCI_CHIP_CAICOS_6768            0x6768
+#define PCI_CHIP_CAICOS_6770            0x6770
+#define PCI_CHIP_CAICOS_6779            0x6779
+
 enum {
    CHIP_FAMILY_R100,
    CHIP_FAMILY_RV100,
@@ -489,6 +528,9 @@ enum {
    CHIP_FAMILY_CYPRESS,
    CHIP_FAMILY_HEMLOCK,
    CHIP_FAMILY_PALM,
+   CHIP_FAMILY_BARTS,
+   CHIP_FAMILY_TURKS,
+   CHIP_FAMILY_CAICOS,
    CHIP_FAMILY_LAST
 };
 
index ca6ab46ca436cd3644591581f07e6c56ddaeee13..a1124483a6cba4e9286a182beafcfd6218940604 100644 (file)
@@ -100,6 +100,9 @@ static const char* get_chip_family_name(int chip_family)
        case CHIP_FAMILY_CYPRESS: return "CYPRESS";
        case CHIP_FAMILY_HEMLOCK: return "HEMLOCK";
        case CHIP_FAMILY_PALM: return "PALM";
+       case CHIP_FAMILY_BARTS: return "BARTS";
+       case CHIP_FAMILY_TURKS: return "TURKS";
+       case CHIP_FAMILY_CAICOS: return "CAICOS";
        default: return "unknown";
        }
 }
index e3de534b5f73e4bcada012dc57cfe7d87a153f0e..154a8815e4a6c958ea1f4d251fa938a0c6b27e60 100644 (file)
@@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/simple_list.h"
 #include "main/imports.h"
 #include "main/extensions.h"
+#include "main/mfeatures.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
index a36a1dc94ac40fa7ae0a6dc82c299a515b8c0300..6656d391e0966b2ba020001209ffd428486b63d8 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "main/enums.h"
 #include "main/fbobject.h"
index 088f97017223dcd6222afe7591ca838c46c6e48d..a68a97687799562b15d9dfcb0234544a7bc86bf1 100644 (file)
@@ -49,7 +49,7 @@ struct _radeon_mipmap_level {
 };
 
 /* store the max possible in the miptree */
-#define RADEON_MIPTREE_MAX_TEXTURE_LEVELS 13
+#define RADEON_MIPTREE_MAX_TEXTURE_LEVELS 15
 
 /**
  * A mipmap tree contains texture images in the layout that the hardware
index 94e56c2ade6d482b159baba517ee799ecb994228..a35fcfe9d7faffe700524eecc06bd6db27656619 100644 (file)
@@ -1163,6 +1163,54 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id)
        screen->chip_flags = RADEON_CHIPSET_TCL;
        break;
 
+   case PCI_CHIP_BARTS_6720:
+   case PCI_CHIP_BARTS_6721:
+   case PCI_CHIP_BARTS_6722:
+   case PCI_CHIP_BARTS_6723:
+   case PCI_CHIP_BARTS_6724:
+   case PCI_CHIP_BARTS_6725:
+   case PCI_CHIP_BARTS_6726:
+   case PCI_CHIP_BARTS_6727:
+   case PCI_CHIP_BARTS_6728:
+   case PCI_CHIP_BARTS_6729:
+   case PCI_CHIP_BARTS_6738:
+   case PCI_CHIP_BARTS_6739:
+       screen->chip_family = CHIP_FAMILY_BARTS;
+       screen->chip_flags = RADEON_CHIPSET_TCL;
+       break;
+
+   case PCI_CHIP_TURKS_6740:
+   case PCI_CHIP_TURKS_6741:
+   case PCI_CHIP_TURKS_6742:
+   case PCI_CHIP_TURKS_6743:
+   case PCI_CHIP_TURKS_6744:
+   case PCI_CHIP_TURKS_6745:
+   case PCI_CHIP_TURKS_6746:
+   case PCI_CHIP_TURKS_6747:
+   case PCI_CHIP_TURKS_6748:
+   case PCI_CHIP_TURKS_6749:
+   case PCI_CHIP_TURKS_6750:
+   case PCI_CHIP_TURKS_6758:
+   case PCI_CHIP_TURKS_6759:
+       screen->chip_family = CHIP_FAMILY_TURKS;
+       screen->chip_flags = RADEON_CHIPSET_TCL;
+       break;
+
+   case PCI_CHIP_CAICOS_6760:
+   case PCI_CHIP_CAICOS_6761:
+   case PCI_CHIP_CAICOS_6762:
+   case PCI_CHIP_CAICOS_6763:
+   case PCI_CHIP_CAICOS_6764:
+   case PCI_CHIP_CAICOS_6765:
+   case PCI_CHIP_CAICOS_6766:
+   case PCI_CHIP_CAICOS_6767:
+   case PCI_CHIP_CAICOS_6768:
+   case PCI_CHIP_CAICOS_6770:
+   case PCI_CHIP_CAICOS_6779:
+       screen->chip_family = CHIP_FAMILY_CAICOS;
+       screen->chip_flags = RADEON_CHIPSET_TCL;
+       break;
+
    default:
       fprintf(stderr, "unknown chip id 0x%x, can't guess.\n",
              device_id);
index 83b1d1b1d74bd0729f198d01cc7f78b52b26a4e8..8a35c7d2d279405a0a0e6a387b606228ade4ad9b 100644 (file)
@@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/image.h"
+#include "main/mfeatures.h"
 #include "main/simple_list.h"
 #include "main/texstore.h"
 #include "main/teximage.h"
index 8b1e34fe7669cdb122359654fc1d579e8545225d..cf85a5bb572d5dfab039a83395d2795c540989d8 100644 (file)
@@ -33,6 +33,7 @@
 #include "main/imports.h"
 #include "main/context.h"
 #include "main/enums.h"
+#include "main/mfeatures.h"
 #include "main/mipmap.h"
 #include "main/texcompress.h"
 #include "main/texstore.h"
index a1908c6bc72bc6ea5f5398705ae357290e01c56f..538a07fbba8bfcf7665327370d0d7c4fe2963dcf 100644 (file)
@@ -32,6 +32,7 @@
 #define RADEON_TEXTURE_H
 
 #include "main/formats.h"
+#include "main/mfeatures.h"
 
 void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
        GLuint numrows, GLuint rowsize);
index f0171f3c0f804a8a995233a0bd16afe84cd628ed..7d8f507115d5696540d59b18cf277f4c10d71810 100644 (file)
@@ -72,13 +72,4 @@ typedef struct {
   int dummy;
 } SISDRIContextRec, *SISDRIContextPtr;
 
-#ifdef XFree86Server
-
-#include "screenint.h"
-
-Bool SISDRIScreenInit(ScreenPtr pScreen);
-void SISDRICloseScreen(ScreenPtr pScreen);
-Bool SISDRIFinishScreenInit(ScreenPtr pScreen);
-
-#endif
 #endif
index fb38419dcdd2c390b436a1c509c94f91e5f7e6c6..7e2f0e00a8e2ef90e1492719dfc8ee008ae419dd 100644 (file)
 
 #include <sys/time.h>
 #include "dri_util.h"
-#ifdef XFree86Server
-#include "GL/xf86glx.h"
-#else
 #include "main/glheader.h"
-#endif
 #if defined(__linux__)
 #include <signal.h>
 #endif
index b47397d5728e510ff0a65afc0dc7b28b5a309848..c6eed03c1c93c74d4388a7aca9953aac40387a29 100644 (file)
@@ -35,9 +35,7 @@
 #define VIA_DRIDDX_VERSION_MINOR  0
 #define VIA_DRIDDX_VERSION_PATCH  0
 
-#ifndef XFree86Server
 typedef int Bool;
-#endif
 
 typedef struct {
     drm_handle_t handle;
index 10ba6b793144d984e1008f5d799609260228aa9c..e1f0c69bacfb10446ae3292325a6f9ec4a757920 100644 (file)
@@ -1356,7 +1356,7 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
 
 
    /* this updates the visual's red/green/blue/alphaBits fields */
-   _mesa_update_framebuffer_visual(osmesa->gl_buffer);
+   _mesa_update_framebuffer_visual(&osmesa->mesa, osmesa->gl_buffer);
 
    /* update the framebuffer size */
    _mesa_resize_framebuffer(&osmesa->mesa, osmesa->gl_buffer, width, height);
index 7145bffa510d0b0e33eb0d337cbd329fb7381bdf..69f03b8e47c81480387067efc13cbecdda9f70ea 100644 (file)
@@ -1,7 +1,8 @@
 #include "glapi.h"
 #include "glThread.h"
 
-#ifdef WIN32_THREADS
+#ifdef WIN32
+
 extern "C" _glthread_Mutex OneTimeLock;
 extern "C" _glthread_Mutex GenTexturesLock;
 
@@ -29,4 +30,4 @@ public:
 _CriticalSectionInit _CriticalSectionInit::m_inst;
 
 
-#endif
+#endif /* WIN32 */
index d88afba20e7c42aa2710e59e87f251c86c575c88..ee002191bc06d6ba9179892b67f53dc9c94d6206 100644 (file)
 
 #include "main/glheader.h"
 
-#ifdef XFree86Server
-
-# include "xorg-server.h"
-# include "resource.h"
-# include "windowstr.h"
-
-#else
 
 # include <X11/Xlib.h>
 # include <X11/Xlibint.h>
@@ -51,7 +44,6 @@
 # include <GL/glx.h>
 # include <sys/time.h>
 
-#endif
 
 
 
index 00ceb960c624932dac0ddf6198debd49f294838d..b5eabadf486b5158f1efb3cbc38b332af2b1f962 100644 (file)
@@ -158,14 +158,12 @@ static short hpcr_rgbTbl[3][256] = {
 /**
  * Return the host's byte order as LSBFirst or MSBFirst ala X.
  */
-#ifndef XFree86Server
 static int host_byte_order( void )
 {
    int i = 1;
    char *cptr = (char *) &i;
    return (*cptr==1) ? LSBFirst : MSBFirst;
 }
-#endif
 
 
 /**
@@ -176,7 +174,7 @@ static int host_byte_order( void )
  */
 static int check_for_xshm( XMesaDisplay *display )
 {
-#if defined(USE_XSHM) && !defined(XFree86Server)
+#if defined(USE_XSHM) 
    int major, minor, ignore;
    Bool pixmaps;
 
@@ -227,16 +225,6 @@ gamma_adjust( GLfloat gamma, GLint value, GLint max )
 static int
 bits_per_pixel( XMesaVisual xmv )
 {
-#ifdef XFree86Server
-   const int depth = xmv->nplanes;
-   int i;
-   assert(depth > 0);
-   for (i = 0; i < screenInfo.numPixmapFormats; i++) {
-      if (screenInfo.formats[i].depth == depth)
-         return screenInfo.formats[i].bitsPerPixel;
-   }
-   return depth;  /* should never get here, but this should be safe */
-#else
    XMesaDisplay *dpy = xmv->display;
    XMesaVisualInfo visinfo = xmv->visinfo;
    XMesaImage *img;
@@ -257,7 +245,6 @@ bits_per_pixel( XMesaVisual xmv )
    img->data = NULL;
    XMesaDestroyImage( img );
    return bitsPerPixel;
-#endif
 }
 
 
@@ -271,7 +258,6 @@ bits_per_pixel( XMesaVisual xmv )
  * Return:  GL_TRUE - window exists
  *          GL_FALSE - window doesn't exist
  */
-#ifndef XFree86Server
 static GLboolean WindowExistsFlag;
 
 static int window_exists_err_handler( XMesaDisplay* dpy, XErrorEvent* xerr )
@@ -306,7 +292,6 @@ get_drawable_size( XMesaDisplay *dpy, Drawable d, GLuint *width, GLuint *height
    *height = h;
    return stat;
 }
-#endif
 
 
 /**
@@ -319,10 +304,6 @@ void
 xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b,
                       GLuint *width, GLuint *height)
 {
-#ifdef XFree86Server
-   *width = MIN2(b->frontxrb->drawable->width, MAX_WIDTH);
-   *height = MIN2(b->frontxrb->drawable->height, MAX_HEIGHT);
-#else
    Status stat;
 
    _glthread_LOCK_MUTEX(_xmesa_lock);
@@ -335,7 +316,6 @@ xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b,
       _mesa_warning(NULL, "XGetGeometry failed!\n");
       *width = *height = 1;
    }
-#endif
 }
 
 
@@ -549,16 +529,11 @@ noFaultXAllocColor( int client,
                     XMesaColor *color,
                     int *exact, int *alloced )
 {
-#ifdef XFree86Server
-   Pixel *ppixIn;
-   xrgb *ctable;
-#else
    /* we'll try to cache ctable for better remote display performance */
    static Display *prevDisplay = NULL;
    static XMesaColormap prevCmap = 0;
    static int prevCmapSize = 0;
    static XMesaColor *ctable = NULL;
-#endif
    XMesaColor subColor;
    int i, bestmatch;
    double mindist;       /* 3*2^16^2 exceeds long int precision. */
@@ -566,14 +541,7 @@ noFaultXAllocColor( int client,
    (void) client;
 
    /* First try just using XAllocColor. */
-#ifdef XFree86Server
-   if (AllocColor(cmap,
-                 &color->red, &color->green, &color->blue,
-                 &color->pixel,
-                 client) == Success)
-#else
    if (XAllocColor(dpy, cmap, color))
-#endif
    {
       *exact = 1;
       *alloced = 1;
@@ -584,14 +552,6 @@ noFaultXAllocColor( int client,
 
    /* Retrieve color table entries. */
    /* XXX alloca candidate. */
-#ifdef XFree86Server
-   ppixIn = (Pixel *) MALLOC(cmapSize * sizeof(Pixel));
-   ctable = (xrgb *) MALLOC(cmapSize * sizeof(xrgb));
-   for (i = 0; i < cmapSize; i++) {
-      ppixIn[i] = i;
-   }
-   QueryColors(cmap, cmapSize, ppixIn, ctable);
-#else
    if (prevDisplay != dpy || prevCmap != cmap
        || prevCmapSize != cmapSize || !ctable) {
       /* free previously cached color table */
@@ -608,7 +568,6 @@ noFaultXAllocColor( int client,
       prevCmap = cmap;
       prevCmapSize = cmapSize;
    }
-#endif
 
    /* Find best match. */
    bestmatch = -1;
@@ -632,14 +591,7 @@ noFaultXAllocColor( int client,
     * fail if the cell is read/write.  Otherwise, we're incrementing
     * the cell's reference count.
     */
-#ifdef XFree86Server
-   if (AllocColor(cmap,
-                 &subColor.red, &subColor.green, &subColor.blue,
-                 &subColor.pixel,
-                 client) == Success) {
-#else
    if (XAllocColor(dpy, cmap, &subColor)) {
-#endif
       *alloced = 1;
    }
    else {
@@ -651,12 +603,7 @@ noFaultXAllocColor( int client,
       subColor.flags = DoRed | DoGreen | DoBlue;
       *alloced = 0;
    }
-#ifdef XFree86Server
-   free(ppixIn);
-   free(ctable);
-#else
    /* don't free table, save it for next time */
-#endif
 
    *color = subColor;
    *exact = 0;
@@ -873,10 +820,8 @@ setup_8bit_hpcr(XMesaVisual v)
       v->hpcr_clear_pixmap = XMesaCreatePixmap(v->display,
                                                DefaultRootWindow(v->display),
                                                16, 2, 8);
-#ifndef XFree86Server
       v->hpcr_clear_ximage = XGetImage(v->display, v->hpcr_clear_pixmap,
                                        0, 0, 16, 2, AllPlanes, ZPixmap);
-#endif
    }
 }
 
@@ -1049,9 +994,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
    int client = 0;
    const int xclass = v->visualType;
 
-#ifdef XFree86Server
-   client = (window) ? CLIENT_ID(window->id) : 0;
-#endif
 
    ASSERT(!b || b->xm_visual == v);
 
@@ -1120,40 +1062,23 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
       }
 
       /* X11 graphics contexts */
-#ifdef XFree86Server
-      b->gc = CreateScratchGC(v->display, window->depth);
-#else
       b->gc = XCreateGC( v->display, window, 0, NULL );
-#endif
       XMesaSetFunction( v->display, b->gc, GXcopy );
 
       /* cleargc - for glClear() */
-#ifdef XFree86Server
-      b->cleargc = CreateScratchGC(v->display, window->depth);
-#else
       b->cleargc = XCreateGC( v->display, window, 0, NULL );
-#endif
       XMesaSetFunction( v->display, b->cleargc, GXcopy );
 
       /*
        * Don't generate Graphics Expose/NoExpose events in swapbuffers().
        * Patch contributed by Michael Pichler May 15, 1995.
        */
-#ifdef XFree86Server
-      b->swapgc = CreateScratchGC(v->display, window->depth);
-      {
-         CARD32 v[1];
-         v[0] = FALSE;
-         dixChangeGC(NullClient, b->swapgc, GCGraphicsExposures, v, NULL);
-      }
-#else
       {
          XGCValues gcvalues;
          gcvalues.graphics_exposures = False;
          b->swapgc = XCreateGC(v->display, window,
                                GCGraphicsExposures, &gcvalues);
       }
-#endif
       XMesaSetFunction( v->display, b->swapgc, GXcopy );
       /*
        * Set fill style and tile pixmap once for all for HPCR stuff
@@ -1175,9 +1100,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
 
       /* Initialize the row buffer XImage for use in write_color_span() */
       data = (char*) MALLOC(MAX_WIDTH*4);
-#ifdef XFree86Server
-      b->rowimage = XMesaCreateImage(GET_VISUAL_DEPTH(v), MAX_WIDTH, 1, data);
-#else
       b->rowimage = XCreateImage( v->display,
                                   v->visinfo->visual,
                                   v->visinfo->depth,
@@ -1186,7 +1108,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
                                   MAX_WIDTH, 1,         /*width, height*/
                                   32,                   /*bitmap_pad*/
                                   0                     /*bytes_per_line*/ );
-#endif
       if (!b->rowimage)
          return GL_FALSE;
    }
@@ -1334,7 +1255,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
    XMesaVisual v;
    GLint red_bits, green_bits, blue_bits, alpha_bits;
 
-#ifndef XFree86Server
    /* For debugging only */
    if (_mesa_getenv("MESA_XSYNC")) {
       /* This makes debugging X easier.
@@ -1343,7 +1263,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
        */
       XSynchronize( display, 1 );
    }
-#endif
 
    /* Color-index rendering not supported. */
    if (!rgb_flag)
@@ -1360,14 +1279,12 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
     * the struct but we may need some of the information contained in it
     * at a later time.
     */
-#ifndef XFree86Server
    v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
    if(!v->visinfo) {
       free(v);
       return NULL;
    }
    memcpy(v->visinfo, visinfo, sizeof(*visinfo));
-#endif
 
    /* check for MESA_GAMMA environment variable */
    gamma = _mesa_getenv("MESA_GAMMA");
@@ -1384,30 +1301,13 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
 
    v->ximage_flag = ximage_flag;
 
-#ifdef XFree86Server
-   /* We could calculate these values by ourselves.  nplanes is either the sum
-    * of the red, green, and blue bits or the number index bits.
-    * ColormapEntries is either (1U << index_bits) or
-    * (1U << max(redBits, greenBits, blueBits)).
-    */
-   assert(visinfo->nplanes > 0);
-   v->nplanes = visinfo->nplanes;
-   v->ColormapEntries = visinfo->ColormapEntries;
-
-   v->mesa_visual.redMask = visinfo->redMask;
-   v->mesa_visual.greenMask = visinfo->greenMask;
-   v->mesa_visual.blueMask = visinfo->blueMask;
-   v->visualID = visinfo->vid;
-   v->screen = 0; /* FIXME: What should be done here? */
-#else
    v->mesa_visual.redMask = visinfo->red_mask;
    v->mesa_visual.greenMask = visinfo->green_mask;
    v->mesa_visual.blueMask = visinfo->blue_mask;
    v->visualID = visinfo->visualid;
    v->screen = visinfo->screen;
-#endif
 
-#if defined(XFree86Server) || !(defined(__cplusplus) || defined(c_plusplus))
+#if !(defined(__cplusplus) || defined(c_plusplus))
    v->visualType = xmesa_convert_from_x_visual_type(visinfo->class);
 #else
    v->visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);
@@ -1461,9 +1361,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
 PUBLIC
 void XMesaDestroyVisual( XMesaVisual v )
 {
-#ifndef XFree86Server
    free(v->visinfo);
-#endif
    free(v);
 }
 
@@ -1532,12 +1430,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
     _mesa_enable_extension(mesaCtx, "GL_EXT_timer_query");
 #endif
 
-#ifdef XFree86Server
-   /* If we're running in the X server, do bounds checking to prevent
-    * segfaults and server crashes!
-    */
-   mesaCtx->Const.CheckArrayBounds = GL_TRUE;
-#endif
 
    /* finish up xmesa context initializations */
    c->swapbytes = CHECK_BYTE_ORDER(v) ? GL_FALSE : GL_TRUE;
@@ -1602,9 +1494,7 @@ void XMesaDestroyContext( XMesaContext c )
 PUBLIC XMesaBuffer
 XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
 {
-#ifndef XFree86Server
    XWindowAttributes attr;
-#endif
    XMesaBuffer b;
    XMesaColormap cmap;
    int depth;
@@ -1613,12 +1503,8 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
    assert(w);
 
    /* Check that window depth matches visual depth */
-#ifdef XFree86Server
-   depth = ((XMesaDrawable)w)->depth;
-#else
    XGetWindowAttributes( v->display, w, &attr );
    depth = attr.depth;
-#endif
    if (GET_VISUAL_DEPTH(v) != depth) {
       _mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual (%d) and window (%d)!\n",
                     GET_VISUAL_DEPTH(v), depth);
@@ -1626,9 +1512,6 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
    }
 
    /* Find colormap */
-#ifdef XFree86Server
-   cmap = (ColormapPtr)LookupIDByType(wColormap(w), RT_COLORMAP);
-#else
    if (attr.colormap) {
       cmap = attr.colormap;
    }
@@ -1638,7 +1521,6 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
       /* OK, let's just allocate a new one and hope for the best */
       cmap = XCreateColormap(v->display, w, attr.visual, AllocNone);
    }
-#endif
 
    b = create_xmesa_buffer((XMesaDrawable) w, WINDOW, v, cmap);
    if (!b)
@@ -1748,7 +1630,6 @@ XMesaBuffer
 XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
                    unsigned int width, unsigned int height)
 {
-#ifndef XFree86Server
    XMesaWindow root;
    XMesaDrawable drawable;  /* X Pixmap Drawable */
    XMesaBuffer b;
@@ -1770,9 +1651,6 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
    }
 
    return b;
-#else
-   return 0;
-#endif
 }
 
 
@@ -1931,40 +1809,6 @@ XMesaBuffer XMesaGetCurrentReadBuffer( void )
 }
 
 
-#ifdef XFree86Server
-PUBLIC
-GLboolean XMesaForceCurrent(XMesaContext c)
-{
-   if (c) {
-      _glapi_set_dispatch(c->mesa.CurrentDispatch);
-
-      if (&(c->mesa) != _mesa_get_current_context()) {
-        _mesa_make_current(&c->mesa, c->mesa.DrawBuffer, c->mesa.ReadBuffer);
-      }
-   }
-   else {
-      _mesa_make_current(NULL, NULL, NULL);
-   }
-   return GL_TRUE;
-}
-
-
-PUBLIC
-GLboolean XMesaLoseCurrent(XMesaContext c)
-{
-   (void) c;
-   _mesa_make_current(NULL, NULL, NULL);
-   return GL_TRUE;
-}
-
-
-PUBLIC
-GLboolean XMesaCopyContext( XMesaContext xm_src, XMesaContext xm_dst, GLuint mask )
-{
-   _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask);
-   return GL_TRUE;
-}
-#endif /* XFree86Server */
 
 
 #ifndef FX
@@ -2004,7 +1848,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
 #endif
       if (b->backxrb->ximage) {
         /* Copy Ximage (back buf) from client memory to server window */
-#if defined(USE_XSHM) && !defined(XFree86Server)
+#if defined(USE_XSHM) 
         if (b->shm) {
             /*_glthread_LOCK_MUTEX(_xmesa_lock);*/
            XShmPutImage( b->xm_visual->display, b->frontxrb->drawable,
@@ -2041,9 +1885,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
       if (b->swAlpha)
          _mesa_copy_soft_alpha_renderbuffers(ctx, &b->mesa_buffer);
    }
-#if !defined(XFree86Server)
    XSync( b->xm_visual->display, False );
-#endif
 }
 
 
@@ -2074,7 +1916,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
 #endif
       if (b->backxrb->ximage) {
          /* Copy Ximage from host's memory to server's window */
-#if defined(USE_XSHM) && !defined(XFree86Server)
+#if defined(USE_XSHM) 
          if (b->shm) {
             /* XXX assuming width and height aren't too large! */
             XShmPutImage( b->xm_visual->display, b->frontxrb->drawable,
@@ -2116,7 +1958,6 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
  * Return:  GL_TRUE = context is double buffered
  *          GL_FALSE = context is single buffered
  */
-#ifndef XFree86Server
 GLboolean XMesaGetBackBuffer( XMesaBuffer b,
                               XMesaPixmap *pixmap,
                               XMesaImage **ximage )
@@ -2134,7 +1975,6 @@ GLboolean XMesaGetBackBuffer( XMesaBuffer b,
       return GL_FALSE;
    }
 }
-#endif /* XFree86Server */
 
 
 /*
@@ -2171,11 +2011,7 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
 void XMesaFlush( XMesaContext c )
 {
    if (c && c->xm_visual) {
-#ifdef XFree86Server
-      /* NOT_NEEDED */
-#else
       XSync( c->xm_visual->display, False );
-#endif
    }
 }
 
@@ -2234,15 +2070,11 @@ void XMesaGarbageCollect( void )
    for (b=XMesaBufferList; b; b=next) {
       next = b->Next;
       if (b->display && b->frontxrb->drawable && b->type == WINDOW) {
-#ifdef XFree86Server
-        /* NOT_NEEDED */
-#else
          XSync(b->display, False);
          if (!window_exists( b->display, b->frontxrb->drawable )) {
             /* found a dead window, free the ancillary info */
             XMesaDestroyBuffer( b );
          }
-#endif
       }
    }
 }
index 2683bd44d196899fc50294fcd4eddf588d82d0fb..10829b4284fd714f3f4f6d6db00bbc51fdb97a30 100644 (file)
@@ -37,7 +37,7 @@
 #include "main/renderbuffer.h"
 
 
-#if defined(USE_XSHM) && !defined(XFree86Server)
+#if defined(USE_XSHM) 
 static volatile int mesaXErrorFlag = 0;
 
 /**
@@ -170,7 +170,7 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
    if (b->db_mode == BACK_XIMAGE) {
       /* Deallocate the old backxrb->ximage, if any */
       if (b->backxrb->ximage) {
-#if defined(USE_XSHM) && !defined(XFree86Server)
+#if defined(USE_XSHM) 
         if (b->shm) {
            XShmDetach(b->xm_visual->display, &b->shminfo);
            XDestroyImage(b->backxrb->ximage);
@@ -188,10 +188,6 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
       /* Allocate new back buffer */
       if (b->shm == 0 || !alloc_back_shm_ximage(b, width, height)) {
         /* Allocate a regular XImage for the back buffer. */
-#ifdef XFree86Server
-        b->backxrb->ximage = XMesaCreateImage(b->xm_visual->BitsPerPixel,
-                                               width, height, NULL);
-#else
         b->backxrb->ximage = XCreateImage(b->xm_visual->display,
                                       b->xm_visual->visinfo->visual,
                                       GET_VISUAL_DEPTH(b->xm_visual),
@@ -199,7 +195,6 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
                                      NULL,
                                       width, height,
                                      8, 0);  /* pad, bytes_per_line */
-#endif
         if (!b->backxrb->ximage) {
            _mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed.\n");
             return;
@@ -359,16 +354,8 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
    if (b->num_alloced > 0) {
       /* If no other buffer uses this X colormap then free the colors. */
       if (!xmesa_find_buffer(b->display, b->cmap, b)) {
-#ifdef XFree86Server
-         int client = 0;
-         if (b->frontxrb->drawable)
-            client = CLIENT_ID(b->frontxrb->drawable->id);
-         (void)FreeColors(b->cmap, client,
-                          b->num_alloced, b->alloced_colors, 0);
-#else
          XFreeColors(b->display, b->cmap,
                      b->alloced_colors, b->num_alloced, 0);
-#endif
       }
    }
 
@@ -382,7 +369,7 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
    if (fb->Visual.doubleBufferMode) {
       /* free back ximage/pixmap/shmregion */
       if (b->backxrb->ximage) {
-#if defined(USE_XSHM) && !defined(XFree86Server)
+#if defined(USE_XSHM) 
          if (b->shm) {
             XShmDetach( b->display, &b->shminfo );
             XDestroyImage( b->backxrb->ximage );
index acece2025cfa8a97d7c035d7666867c3d4b590cb..b8d9e20c4267ed1d30b6b51d9b0a19d31964b65b 100644 (file)
@@ -93,16 +93,12 @@ const int xmesa_kernel1[16] = {
 static void
 finish_or_flush( struct gl_context *ctx )
 {
-#ifdef XFree86Server
-      /* NOT_NEEDED */
-#else
    const XMesaContext xmesa = XMESA_CONTEXT(ctx);
    if (xmesa) {
       _glthread_LOCK_MUTEX(_xmesa_lock);
       XSync( xmesa->display, False );
       _glthread_UNLOCK_MUTEX(_xmesa_lock);
    }
-#endif
 }
 
 
@@ -388,7 +384,6 @@ clear_buffers(struct gl_context *ctx, GLbitfield buffers)
 }
 
 
-#ifndef XFree86Server
 /* XXX these functions haven't been tested in the Xserver environment */
 
 
@@ -731,7 +726,6 @@ xmesa_CopyPixels( struct gl_context *ctx,
    }
 }
 
-#endif /* XFree86Server */
 
 
 
@@ -745,17 +739,9 @@ get_string( struct gl_context *ctx, GLenum name )
    (void) ctx;
    switch (name) {
       case GL_RENDERER:
-#ifdef XFree86Server
-         return (const GLubyte *) "Mesa GLX Indirect";
-#else
          return (const GLubyte *) "Mesa X11";
-#endif
       case GL_VENDOR:
-#ifdef XFree86Server
-         return (const GLubyte *) "Mesa project: www.mesa3d.org";
-#else
          return NULL;
-#endif
       default:
          return NULL;
    }
@@ -947,43 +933,6 @@ xmesa_update_state( struct gl_context *ctx, GLbitfield new_state )
 
 
 
-/**
- * Called via ctx->Driver.TestProxyTeximage().  Normally, we'd just use
- * the _mesa_test_proxy_teximage() fallback function, but we're going to
- * special-case the 3D texture case to allow textures up to 512x512x32
- * texels.
- */
-static GLboolean
-test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-                    GLint internalFormat, GLenum format, GLenum type,
-                    GLint width, GLint height, GLint depth, GLint border)
-{
-   if (target == GL_PROXY_TEXTURE_3D) {
-      /* special case for 3D textures */
-      if (width * height * depth > 512 * 512 * 64 ||
-          width  < 2 * border ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           _mesa_bitcount(width  - 2 * border) != 1) ||
-          height < 2 * border ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           _mesa_bitcount(height - 2 * border) != 1) ||
-          depth  < 2 * border ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           _mesa_bitcount(depth  - 2 * border) != 1)) {
-         /* Bad size, or too many texels */
-         return GL_FALSE;
-      }
-      return GL_TRUE;
-   }
-   else {
-      /* use the fallback routine for 1D, 2D, cube and rect targets */
-      return _mesa_test_proxy_teximage(ctx, target, level, internalFormat,
-                                       format, type, width, height, depth,
-                                       border);
-   }
-}
-
-
 /**
  * In SW, we don't really compress GL_COMPRESSED_RGB[A] textures!
  */
@@ -1124,7 +1073,6 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
    }
    else {
       driver->Clear = clear_buffers;
-#ifndef XFree86Server
       driver->CopyPixels = xmesa_CopyPixels;
       if (xmvisual->undithered_pf == PF_8R8G8B &&
           xmvisual->dithered_pf == PF_8R8G8B &&
@@ -1134,9 +1082,8 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
       else if (xmvisual->undithered_pf == PF_5R6G5B) {
          driver->DrawPixels = xmesa_DrawPixels_5R6G5B;
       }
-#endif
    }
-   driver->TestProxyTexImage = test_proxy_teximage;
+
 #if ENABLE_EXT_texure_compression_s3tc
    driver->ChooseTextureFormat = choose_tex_format;
 #else
index cbd69b011a1d15e7dcc33013ab43d5a3c1101f51..d8a0e6de6d0b2f13c0f81b1e952bee0ab1a068a2 100644 (file)
@@ -140,16 +140,8 @@ static void FXgetImage( XMesaBuffer b )
    GLuint x, y;
    GLuint width, height;
 
-#ifdef XFree86Server
-   x = b->frontxrb->pixmap->x;
-   y = b->frontxrb->pixmap->y;
-   width = b->frontxrb->pixmap->width;
-   height = b->frontxrb->pixmap->height;
-   depth = b->frontxrb->pixmap->depth;
-#else
    xmesa_get_window_size(b->display, b, &width, &height);
    x = y = 0;
-#endif
    if (b->mesa_buffer.Width != width || b->mesa_buffer.Height != height) {
       b->mesa_buffer.Width = MIN2((int)width, b->FXctx->width);
       b->mesa_buffer.Height = MIN2((int)height, b->FXctx->height);
index 087b4e4c3a7c81f02c4049c625ce981cde94eb76..12fef7dad345cecb9e8374fae58a0a979fcdf440 100644 (file)
@@ -37,97 +37,3 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "glxheader.h"
 #include "xmesaP.h"
 
-#ifdef XFree86Server
-
-#ifdef ROUNDUP
-#undef ROUNDUP
-#endif
-
-#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
-
-XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data)
-{
-    XMesaImage *image;
-
-    image = (XMesaImage *)xalloc(sizeof(XMesaImage));
-
-    if (image) {
-       image->width = width;
-       image->height = height;
-       image->data = data;
-       /* Always pad to 32 bits */
-       image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32);
-       image->bits_per_pixel = bitsPerPixel;
-    }
-
-    return image;
-}
-
-void XMesaDestroyImage(XMesaImage *image)
-{
-    if (image->data)
-       free(image->data);
-    xfree(image);
-}
-
-unsigned long XMesaGetPixel(XMesaImage *image, int x, int y)
-{
-    CARD8  *row = (CARD8 *)(image->data + y*image->bytes_per_line);
-    CARD8  *i8;
-    CARD16 *i16;
-    CARD32 *i32;
-    switch (image->bits_per_pixel) {
-    case 8:
-       i8 = (CARD8 *)row;
-       return i8[x];
-       break;
-    case 15:
-    case 16:
-       i16 = (CARD16 *)row;
-       return i16[x];
-       break;
-    case 24: /* WARNING: architecture specific code */
-       i8 = (CARD8 *)row;
-       return (((CARD32)i8[x*3]) |
-               (((CARD32)i8[x*3+1])<<8) |
-               (((CARD32)i8[x*3+2])<<16));
-       break;
-    case 32:
-       i32 = (CARD32 *)row;
-       return i32[x];
-       break;
-    }
-    return 0;
-}
-
-#ifndef XMESA_USE_PUTPIXEL_MACRO
-void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel)
-{
-    CARD8  *row = (CARD8 *)(image->data + y*image->bytes_per_line);
-    CARD8  *i8;
-    CARD16 *i16;
-    CARD32 *i32;
-    switch (image->bits_per_pixel) {
-    case 8:
-       i8 = (CARD8 *)row;
-       i8[x] = (CARD8)pixel;
-       break;
-    case 15:
-    case 16:
-       i16 = (CARD16 *)row;
-       i16[x] = (CARD16)pixel;
-       break;
-    case 24: /* WARNING: architecture specific code */
-       i8 = (CARD8 *)__row;
-       i8[x*3]   = (CARD8)(p);
-       i8[x*3+1] = (CARD8)(p>>8);
-       i8[x*3+2] = (CARD8)(p>>16);
-    case 32:
-       i32 = (CARD32 *)row;
-       i32[x] = (CARD32)pixel;
-       break;
-    }
-}
-#endif
-
-#endif /* XFree86Server */
index f03f99f918f629b66fbd1fd098e2ac08052c241e..04cedcd4ec09431e5e968b531221bf73a67a064a 100644 (file)
@@ -537,7 +537,6 @@ void xmesa_choose_point( struct gl_context *ctx )
 
 
 
-#ifndef XFree86Server
 /**
  * Draw fast, XOR line with XDrawLine in front color buffer.
  * WARNING: this isn't fully OpenGL conformant because different pixels
@@ -567,7 +566,6 @@ xor_line(struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1)
    XDrawLine(dpy, xrb->pixmap, gc, x0, y0, x1, y1);
    XMesaSetFunction(dpy, gc, GXcopy);  /* this gc is used elsewhere */
 }
-#endif /* XFree86Server */
 
 
 #endif /* CHAN_BITS == 8 */
@@ -660,7 +658,6 @@ get_line_func(struct gl_context *ctx)
       }
    }
 
-#ifndef XFree86Server
    if (ctx->DrawBuffer->_NumColorDrawBuffers == 1
        && ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT
        && swrast->_RasterMask == LOGIC_OP_BIT
@@ -669,7 +666,6 @@ get_line_func(struct gl_context *ctx)
        && !ctx->Line.SmoothFlag) {
       return xor_line;
    }
-#endif /* XFree86Server */
 
 #endif /* CHAN_BITS == 8 */
    return (swrast_line_func) NULL;
index ab66c5e1f12f9fd71cd4c8a727d843db92aeab97..294b93a57ccafc8a9a6432547a09b98a3819aa10 100644 (file)
@@ -42,7 +42,6 @@
  * generate BadMatch errors if the drawable isn't mapped.
  */
 
-#ifndef XFree86Server
 static int caught_xgetimage_error = 0;
 static int (*old_xerror_handler)( XMesaDisplay *dpy, XErrorEvent *ev );
 static unsigned long xgetimage_serial;
@@ -87,7 +86,6 @@ static int check_xgetimage_errors( void )
    /* return 0=no error, 1=error caught */
    return caught_xgetimage_error;
 }
-#endif
 
 
 /*
@@ -97,7 +95,6 @@ static unsigned long read_pixel( XMesaDisplay *dpy,
                                  XMesaDrawable d, int x, int y )
 {
    unsigned long p;
-#ifndef XFree86Server
    XMesaImage *pixel = NULL;
    int error;
 
@@ -113,9 +110,6 @@ static unsigned long read_pixel( XMesaDisplay *dpy,
    if (pixel) {
       XMesaDestroyImage( pixel );
    }
-#else
-   (*dpy->GetImage)(d, x, y, 1, 1, ZPixmap, ~0L, (pointer)&p);
-#endif
    return p;
 }
 
@@ -3763,7 +3757,6 @@ static void put_values_ci_ximage( PUT_VALUES_ARGS )
 /*****                      Pixel reading                         *****/
 /**********************************************************************/
 
-#ifndef XFree86Server
 /**
  * Do clip testing prior to calling XGetImage.  If any of the region lies
  * outside the screen's bounds, XGetImage will return NULL.
@@ -3806,7 +3799,6 @@ clip_for_xgetimage(struct gl_context *ctx, XMesaPixmap pixmap, GLuint *n, GLint
    }
    return 0;
 }
-#endif
 
 
 /*
@@ -3824,7 +3816,6 @@ get_row_ci(struct gl_context *ctx, struct gl_renderbuffer *rb,
    y = YFLIP(xrb, y);
 
    if (xrb->pixmap) {
-#ifndef XFree86Server
       XMesaImage *span = NULL;
       int error;
       int k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y);
@@ -3850,11 +3841,6 @@ get_row_ci(struct gl_context *ctx, struct gl_renderbuffer *rb,
       if (span) {
         XMesaDestroyImage( span );
       }
-#else
-      (*xmesa->display->GetImage)(xrb->drawable,
-                                 x, y, n, 1, ZPixmap,
-                                 ~0L, (pointer)index);
-#endif
    }
    else if (xrb->ximage) {
       XMesaImage *img = xrb->ximage;
@@ -3882,14 +3868,6 @@ get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
       /* Read from Pixmap or Window */
       XMesaImage *span = NULL;
       int error;
-#ifdef XFree86Server
-      span = XMesaCreateImage(xmesa->xm_visual->BitsPerPixel, n, 1, NULL);
-      span->data = (char *)MALLOC(span->height * span->bytes_per_line);
-      error = (!span->data);
-      (*xmesa->display->GetImage)(xrb->drawable,
-                                 x, YFLIP(xrb, y), n, 1, ZPixmap,
-                                 ~0L, (pointer)span->data);
-#else
       int k;
       y = YFLIP(xrb, y);
       k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y);
@@ -3900,7 +3878,6 @@ get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
       span = XGetImage( xmesa->display, xrb->pixmap,
                        x, y, n, 1, AllPlanes, ZPixmap );
       error = check_xgetimage_errors();
-#endif
       if (span && !error) {
         switch (xmesa->pixelformat) {
            case PF_Truecolor:
index f63626a97026b77c7ddfd5a363ba62bfe0e42bc9..98737fab248e06ebcbfe83bc91829d1721a4d9f7 100644 (file)
@@ -72,13 +72,9 @@ and create a window, you must do the following to use the X/Mesa interface:
 extern "C" {
 #endif
 
-#ifdef XFree86Server
-#include "xmesa_xf86.h"
-#else
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include "xmesa_x.h"
-#endif
 #include "GL/gl.h"
 
 #ifdef AMIWIN
@@ -180,19 +176,6 @@ extern XMesaContext XMesaCreateContext( XMesaVisual v,
 extern void XMesaDestroyContext( XMesaContext c );
 
 
-#ifdef XFree86Server
-/*
- * These are the extra routines required for integration with XFree86.
- * None of these routines should be user visible. -KEM
- */
-extern GLboolean XMesaForceCurrent( XMesaContext c );
-
-extern GLboolean XMesaLoseCurrent( XMesaContext c );
-
-extern GLboolean XMesaCopyContext( XMesaContext src,
-                                  XMesaContext dst,
-                                  GLuint mask );
-#endif /* XFree86Server */
 
 
 /*
index 5d34b430cb6dd5d0502862d68fc1ddfe41ea8cc4..63e3e211bf624b102d7cc5b7a57f7eb18cf9496e 100644 (file)
@@ -33,9 +33,6 @@
 #include "fxmesa.h"
 #include "xm_glide.h"
 #endif
-#ifdef XFree86Server
-#include "xm_image.h"
-#endif
 
 
 extern _glthread_Mutex _xmesa_lock;
@@ -88,13 +85,8 @@ struct xmesa_visual {
    XMesaDisplay *display;      /* The X11 display */
    int screen, visualID;
    int visualType;
-#ifdef XFree86Server
-   GLint ColormapEntries;
-   GLint nplanes;
-#else
    XMesaVisualInfo visinfo;    /* X's visual info (pointer to private copy) */
    XVisualInfo *vishandle;     /* Only used in fakeglx.c */
-#endif
    GLint BitsPerPixel;         /* True bits per pixel for XImages */
 
    GLboolean ximage_flag;      /* Use XImage for back buffer (not pixmap)? */
@@ -233,7 +225,7 @@ struct xmesa_buffer {
                                /*    0 = not available                 */
                                /*    1 = XImage support available      */
                                /*    2 = Pixmap support available too  */
-#if defined(USE_XSHM) && !defined(XFree86Server)
+#if defined(USE_XSHM) 
    XShmSegmentInfo shminfo;
 #endif
 
@@ -259,11 +251,7 @@ struct xmesa_buffer {
 
    /* Used to do XAllocColor/XFreeColors accounting: */
    int num_alloced;
-#if defined(XFree86Server)
-   Pixel alloced_colors[256];
-#else
    unsigned long alloced_colors[256];
-#endif
 
 #if defined( FX )
    /* For 3Dfx Glide only */
@@ -578,9 +566,7 @@ extern void xmesa_register_swrast_functions( struct gl_context *ctx );
 
 #define ENABLE_EXT_texure_compression_s3tc 0 /* SW texture compression */
 
-#ifdef XFree86Server
-#define ENABLE_EXT_timer_query 0
-#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#if   defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 #define ENABLE_EXT_timer_query 1 /* should have 64-bit GLuint64EXT */
 #else
 #define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */
index 97b86596fcf49f33058d741d57f4248abc5de2e0..2d3bc917ece89892beb5f799f4cb8832a34aa892 100644 (file)
@@ -10,3 +10,4 @@ Version: @VERSION@
 Libs: -L${libdir} -l@GL_LIB@
 Libs.private: @GL_PC_LIB_PRIV@
 Cflags: -I${includedir} @GL_PC_CFLAGS@
+glx_tls: @GLX_TLS@
index 4dc0b0d485194b69a1fb3ab0eff900a0b32e4d25..50446a9093a21c8f395acd507118178e60f3270f 100644 (file)
                        <value name="GL_UNSIGNED_INT_24_8_OES"/>
                </desc>
        </desc>
+
+       <desc name="format" category="EXT_texture_format_BGRA8888">
+               <value name="GL_BGRA_EXT"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+               </desc>
+       </desc>
 </template>
 
 <template name="BindTexture">
 <api name="mesa" implementation="true">
        <category name="MESA"/>
 
-       <function name="Color4f"  default_prefix="_vbo_" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="Color4f"  default_prefix="_es_" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
        <function name="ClipPlane" template="ClipPlane" gltype="GLdouble"/>
        <function name="CullFace" template="CullFace"/>
 
 
        <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
 
-       <function name="Materialf" default_prefix="_vbo_" template="Material" gltype="GLfloat" expand_vector="true"/>
-       <function name="Materialfv" default_prefix="_vbo_" template="Material" gltype="GLfloat"/>
+       <function name="Materialf" default_prefix="_es_" template="Material" gltype="GLfloat" expand_vector="true"/>
+       <function name="Materialfv" default_prefix="_es_" template="Material" gltype="GLfloat"/>
 
        <function name="PointSize" template="PointSize" gltype="GLfloat"/>
        <function name="PointSizePointer" template="PointSizePointer"/>
        <function name="ClearColor" template="ClearColor" gltype="GLclampf"/>
        <function name="ClearStencil" template="ClearStencil"/>
        <function name="ClearDepth" template="ClearDepth" gltype="GLclampd"/>
+       <function name="ClearDepthf" template="ClearDepth" gltype="GLclampf"/>
 
        <function name="StencilMask" template="StencilMask"/>
        <function name="StencilMaskSeparate" template="StencilMaskSeparate"/>
        <function name="IsEnabled" template="IsEnabled"/>
 
        <function name="DepthRange" template="DepthRange" gltype="GLclampd"/>
+       <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/>
        <function name="Frustum" template="Frustum" gltype="GLdouble"/>
 
        <function name="LoadIdentity" template="LoadIdentity"/>
        <function name="EnableClientState" template="EnableClientState"/>
 
        <function name="GetPointerv" template="GetPointer"/>
-       <function name="Normal3f" default_prefix="_vbo_" template="Normal" gltype="GLfloat" expand_vector="true"/>
+       <function name="Normal3f" default_prefix="_es_" template="Normal" gltype="GLfloat" expand_vector="true"/>
        <function name="NormalPointer" template="NormalPointer"/>
        <function name="TexCoordPointer" template="TexCoordPointer"/>
        <function name="VertexPointer" template="VertexPointer"/>
        <function name="ActiveTextureARB" template="ActiveTexture"/>
        <function name="ClientActiveTextureARB" template="ClientActiveTexture"/>
 
-       <function name="MultiTexCoord4f" default_prefix="_vbo_" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="MultiTexCoord4f" default_prefix="_es_" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
 
        <function name="SampleCoverageARB" template="SampleCoverage" gltype="GLclampf"/>
 
        <function name="PointParameterf" template="PointParameter" gltype="GLfloat" expand_vector="true"/>
        <function name="PointParameterfv" template="PointParameter" gltype="GLfloat"/>
 
-       <function name="VertexAttrib1f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
-       <function name="VertexAttrib2f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
-       <function name="VertexAttrib3f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
-       <function name="VertexAttrib4f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="VertexAttrib1fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
-       <function name="VertexAttrib2fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
-       <function name="VertexAttrib3fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
-       <function name="VertexAttrib4fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
+       <function name="VertexAttrib1f" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
+       <function name="VertexAttrib2f" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
+       <function name="VertexAttrib3f" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
+       <function name="VertexAttrib4f" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="VertexAttrib1fv" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
+       <function name="VertexAttrib2fv" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
+       <function name="VertexAttrib3fv" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
+       <function name="VertexAttrib4fv" default_prefix="_es_" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
 
        <function name="VertexAttribPointerARB" template="VertexAttribPointer"/>
        <function name="EnableVertexAttribArrayARB" template="EnableVertexAttribArray"/>
 
        <category name="OES_matrix_palette"/>
 
-       <function name="Color4f" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="Color4f" external="true" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
        <function name="Color4ub" template="Color" gltype="GLubyte" vector_size="4" expand_vector="true"/>
        <function name="Color4x" template="Color" gltype="GLfixed" vector_size="4" expand_vector="true"/>
 
        <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
        <function name="LineWidthx" template="LineWidth" gltype="GLfixed"/>
 
-       <function name="Materialf" template="Material" gltype="GLfloat" expand_vector="true"/>
-       <function name="Materialfv" template="Material" gltype="GLfloat"/>
+       <function name="Materialf" external="true" template="Material" gltype="GLfloat" expand_vector="true"/>
+       <function name="Materialfv" external="true" template="Material" gltype="GLfloat"/>
        <function name="Materialx" template="Material" gltype="GLfixed" expand_vector="true"/>
        <function name="Materialxv" template="Material" gltype="GLfixed"/>
 
 
        <function name="GetPointerv" template="GetPointer"/>
 
-       <function name="Normal3f" template="Normal" gltype="GLfloat" expand_vector="true"/>
+       <function name="Normal3f" external="true" template="Normal" gltype="GLfloat" expand_vector="true"/>
        <function name="Normal3x" template="Normal" gltype="GLfixed" expand_vector="true"/>
        <function name="NormalPointer" template="NormalPointer"/>
        <function name="TexCoordPointer" template="TexCoordPointer"/>
        <function name="ActiveTexture" template="ActiveTexture"/>
        <function name="ClientActiveTexture" template="ClientActiveTexture"/>
 
-       <function name="MultiTexCoord4f" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="MultiTexCoord4f" external="true" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
 
        <function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/>
        <function name="SampleCoveragex" template="SampleCoverage" gltype="GLclampx"/>
 
        <function name="BlendFuncSeparate" template="BlendFuncSeparate"/>
 
-       <function name="VertexAttrib1f" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
-       <function name="VertexAttrib2f" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
-       <function name="VertexAttrib3f" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
-       <function name="VertexAttrib4f" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="VertexAttrib1fv" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
-       <function name="VertexAttrib2fv" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
-       <function name="VertexAttrib3fv" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
-       <function name="VertexAttrib4fv" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
+       <function name="VertexAttrib1f" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
+       <function name="VertexAttrib2f" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
+       <function name="VertexAttrib3f" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
+       <function name="VertexAttrib4f" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="VertexAttrib1fv" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
+       <function name="VertexAttrib2fv" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
+       <function name="VertexAttrib3fv" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
+       <function name="VertexAttrib4fv" external="true" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
 
        <function name="VertexAttribPointer" template="VertexAttribPointer"/>
 
index 9026110f3efef7fc9a987c91b915d5ac662658f4..940f398f0230bac4b16953e6e2fae796f093cdec 100644 (file)
@@ -27,6 +27,7 @@
 #include "context.h"
 #include "imports.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "state.h"
 #include "mtypes.h"
 #include "main/dispatch.h"
index c22e18c9fbc8e0b6aad450ad110bdfbcc7e51363..b429e2627e3ac5e7c401f9f392ccdc97531a7f18 100644 (file)
@@ -40,6 +40,8 @@
 #include "context.h"
 #include "imports.h"
 #include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "main/dispatch.h"
 
 typedef void (GLAPIENTRY *array_func)( const void * );
index 610e522a943551accf9c764f25190cbe1af6e09d..b90d713682ed595ee2b08f525bbcc8dccc8795d6 100644 (file)
@@ -28,6 +28,7 @@
 #define API_ARRAYELT_H
 
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 
 #if FEATURE_arrayelt
index 1427abd107af99971faeed55d4e2ce697cbfaef1..f1e4f7361f4c77744e499788f182fe6ee5ca02ad 100644 (file)
@@ -361,6 +361,10 @@ _mesa_create_exec_table(void)
    SET_PointParameterfvEXT(exec, _mesa_PointParameterfv);
 #endif
 
+   /* 95. GL_ARB_ES2_compatibility */
+   SET_ClearDepthf(exec, _mesa_ClearDepthf);
+   SET_DepthRangef(exec, _mesa_DepthRangef);
+
    /* 97. GL_EXT_compiled_vertex_array */
 #if _HAVE_FULL_GL
    SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
index 08b4b4a3b675fc449b7078030b6131f0517dbc81..7d3d33272791a0604e6ac735436bb6ae099d7b73 100644 (file)
@@ -30,6 +30,7 @@
 #include "context.h"
 #include "light.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "dlist.h"
 #include "eval.h"
 #include "main/dispatch.h"
index e7fd49bafbbe9c8b28b7119847855f33801390b6..aca7f088db6b1464474e8ee91b5367b10f7bde46 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef _API_NOOP_H
 #define _API_NOOP_H
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 
 #if FEATURE_beginend
index 0d64b7de8dd9e4c66b86d97d690914d4a7c1009a..9e9728c2c62480131622206a18e14bc53a6719d3 100644 (file)
 #include "hash.h"
 #include "imports.h"
 #include "context.h"
+#include "mfeatures.h"
 #if FEATURE_ARB_vertex_buffer_object
 #include "bufferobj.h"
 #endif
 #include "arrayobj.h"
 #include "macros.h"
+#include "mtypes.h"
 #include "main/dispatch.h"
 
 
index ae2feb3229ad03e3314e71e0d820e7df91f4f05e..44097e1a266059bf26d695326d802755cce232a1 100644 (file)
@@ -26,6 +26,7 @@
 #include "main/hash.h"
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/enums.h"
 #include "main/mtypes.h"
 #include "main/dispatch.h"
@@ -316,6 +317,7 @@ _mesa_DeleteFragmentShaderATI(GLuint id)
       if (prog) {
         prog->RefCount--;
         if (prog->RefCount <= 0) {
+           assert(prog != &DummyShader);
            free(prog);
         }
       }
index fb6fbe5b6db3ed4ec1657bc1ea8949eb4a569e27..adfec3b0d5a9cf9d6e65a9d1a615159186ef02da 100644 (file)
@@ -43,6 +43,7 @@
 #include "lines.h"
 #include "macros.h"
 #include "matrix.h"
+#include "mfeatures.h"
 #include "multisample.h"
 #include "points.h"
 #include "polygon.h"
index 4d62f54a95ae17d0eb97f20d6ebf311d42f849c4..1f9a5212c0415f08ac678cee267779d512c3e241 100644 (file)
@@ -39,6 +39,8 @@
 #include "context.h"
 #include "bufferobj.h"
 #include "fbobject.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "texobj.h"
 
 
index 4b97e34767e5dea0ba9f38ebbd1c9f69efec7efa..09ccab31742bf845773477250f29535b6f4d2b60 100644 (file)
@@ -29,6 +29,7 @@
 #define BUFFEROBJ_H
 
 
+#include "mfeatures.h"
 #include "mtypes.h"
 
 
index 86446311fe3fa0a66bfd64931558e4821e0e9db7..5c37f3d1a86874d8e85d5fbd86cb0bd039cfec12 100644 (file)
@@ -35,6 +35,7 @@
 #include "colormac.h"
 #include "context.h"
 #include "enums.h"
+#include "mtypes.h"
 
 
 #define BAD_MASK ~0u
index c4c1d96e49c44a5f726a3973c695f3711517cd04..43a9ccc116a1777dc45502130109486e349e73f9 100644 (file)
@@ -36,6 +36,7 @@
 #include "colormac.h"
 #include "enums.h"
 #include "macros.h"
+#include "mtypes.h"
 #include "state.h"
 
 
index 245fb658bb36cce64e0f90593732e9cc332fd691..a328dcd32af9468b2bb7dae7fa33d1835106067b 100644 (file)
@@ -198,12 +198,23 @@ do {                                              \
    ((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) |   \
     ((A) ? 0x80 : 0))
 
+#define PACK_COLOR_2101010_UB( A, B, G, R )                                    \
+   (((B) << 22) | ((G) << 12) | ((R) << 2) |   \
+    (((A) & 0xc0) << 24))
+
+#define PACK_COLOR_2101010_US( A, B, G, R )                                    \
+   ((((B) >> 6) << 20) | (((G) >> 6) << 10) | ((R) >> 6) |     \
+    (((A) >> 14) << 30))
+
 #define PACK_COLOR_4444( R, G, B, A )                                  \
    ((((R) & 0xf0) << 8) | (((G) & 0xf0) << 4) | ((B) & 0xf0) | ((A) >> 4))
 
 #define PACK_COLOR_4444_REV( R, G, B, A )                              \
    ((((B) & 0xf0) << 8) | (((A) & 0xf0) << 4) | ((R) & 0xf0) | ((G) >> 4))
 
+#define PACK_COLOR_44( L, A )                                          \
+   (((L) & 0xf0) | (((A) & 0xf0) >> 4))
+
 #define PACK_COLOR_88( L, A )                                          \
    (((L) << 8) | (A))
 
index caa95835bc280a3d109f76c62482dd0a96115af3..b0ba31c732f069e0670c0818b935611198a44df1 100644 (file)
@@ -29,6 +29,8 @@
 #include "context.h"
 #include "image.h"
 #include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "pack.h"
 #include "state.h"
 #include "teximage.h"
index 800eb839005bebadf19e15da34a13f31a224370a..5557a3b5cb5ac4ffd804bb27d84ee22d389dc6c6 100644 (file)
@@ -358,6 +358,10 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 #define M_E (2.7182818284590452354)
 #endif
 
+#ifndef M_LOG2E
+#define M_LOG2E     (1.4426950408889634074)
+#endif
+
 #ifndef ONE_DIV_LN2
 #define ONE_DIV_LN2 (1.442695040888963456)
 #endif
index 25b3dd678dc5399b753d2531bf547bb40a0091de..352e2e2b165dbf8cea6a6e42b3edf840d3d1c844 100644 (file)
@@ -34,6 +34,7 @@
 #include "glheader.h"
 #include "condrender.h"
 #include "enums.h"
+#include "mtypes.h"
 #include "queryobj.h"
 
 
index 0f2d1a8f8da5993220f870180817f0f8570721c2..fffb1a7d2ececba81d37aeaf4a22d30963b75fd5 100644 (file)
 /** Max texture palette / color table size */
 #define MAX_COLOR_TABLE_SIZE 256
 
+/** Max memory to allow for a single texture image (in megabytes) */
+#define MAX_TEXTURE_MBYTES 1024
+
 /** Number of 1D/2D texture mipmap levels */
-#define MAX_TEXTURE_LEVELS 13
+#define MAX_TEXTURE_LEVELS 15
 
 /** Number of 3D texture mipmap levels */
-#define MAX_3D_TEXTURE_LEVELS 9
+#define MAX_3D_TEXTURE_LEVELS 15
 
 /** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
-#define MAX_CUBE_TEXTURE_LEVELS 13
+#define MAX_CUBE_TEXTURE_LEVELS 15
 
 /** Maximum rectangular texture size - GL_NV_texture_rectangle */
-#define MAX_TEXTURE_RECT_SIZE 4096
+#define MAX_TEXTURE_RECT_SIZE 16384
 
 /** Maximum number of layers in a 1D or 2D array texture - GL_MESA_texture_array */
 #define MAX_ARRAY_TEXTURE_LAYERS 64
  */
 
 #ifndef MAX_WIDTH
-#   define MAX_WIDTH 4096
+#   define MAX_WIDTH 16384
 #endif
 /** Maximum viewport/image height */
 #ifndef MAX_HEIGHT
-#   define MAX_HEIGHT 4096
+#   define MAX_HEIGHT 16384
+#endif
+
+/* XXX: hack to prevent stack overflow on windows until all temporary arrays
+ * [MAX_WIDTH] are allocated from the heap */
+#ifdef WIN32
+#undef MAX_TEXTURE_LEVELS
+#undef MAX_3D_TEXTURE_LEVELS
+#undef MAX_CUBE_TEXTURE_LEVELS
+#undef MAX_TEXTURE_RECT_SIZE
+#undef MAX_WIDTH
+#undef MAX_HEIGHT
+#define MAX_TEXTURE_LEVELS 13
+#define MAX_3D_TEXTURE_LEVELS 9
+#define MAX_CUBE_TEXTURE_LEVELS 13
+#define MAX_TEXTURE_RECT_SIZE 4096
+#define MAX_WIDTH 4096
+#define MAX_HEIGHT 4096
 #endif
 
 /** Maxmimum size for CVA.  May be overridden by the drivers.  */
 #define MAX_TEXTURE_MAX_ANISOTROPY 16.0
 
 /** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
-#define MAX_TEXTURE_LOD_BIAS 12.0
+#define MAX_TEXTURE_LOD_BIAS 14.0
 
 /** For any program target/extension */
 /*@{*/
index e2c91c3e400fac4c817040fc86a7bcc9f2b40e36..958ea10a4225bab646b1ac0141517e60ccfb8a2f 100644 (file)
@@ -96,6 +96,7 @@
 #include "fbobject.h"
 #include "feedback.h"
 #include "fog.h"
+#include "formats.h"
 #include "framebuffer.h"
 #include "hint.h"
 #include "hash.h"
@@ -417,6 +418,10 @@ one_time_init( struct gl_context *ctx )
                     MESA_VERSION_STRING, __DATE__, __TIME__);
       }
 #endif
+
+#ifdef DEBUG
+      _mesa_test_formats();
+#endif
    }
 
    /* per-API one-time init */
@@ -535,6 +540,7 @@ _mesa_init_constants(struct gl_context *ctx)
    assert(ctx);
 
    /* Constants, may be overriden (usually only reduced) by device drivers */
+   ctx->Const.MaxTextureMbytes = MAX_TEXTURE_MBYTES;
    ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
    ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
    ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
@@ -954,6 +960,14 @@ _mesa_initialize_context_for_api(struct gl_context *ctx,
       ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
    }
 
+   /* Mesa core handles all the formats that mesa core knows about.
+    * Drivers will want to override this list with just the formats
+    * they can handle, and confirm that appropriate fallbacks exist in
+    * _mesa_choose_tex_format().
+    */
+   memset(&ctx->TextureFormatSupported, GL_TRUE,
+         sizeof(ctx->TextureFormatSupported));
+
    switch (ctx->API) {
    case API_OPENGL:
 #if FEATURE_dlist
index 0231bcf6d3ff34fa5135e65250df0d22cc18afd7..5d286eb316bcb12ae324e0f40dc766e15e1950a6 100644 (file)
@@ -36,6 +36,7 @@
 #include "colormac.h"
 #include "convolve.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "main/dispatch.h"
 
index 35de69b180fdbae6a2bf425ec80b2d9ca6a041d7..6363512961af843e537cc02c7e7b29e121f47d76 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 
-#include "main/imports.h"
+#include "main/compiler.h"
 #include "main/cpuinfo.h"
 
 
index c5a910e144a4965671394d2b4954c0638ade4e1a..0bb47731ea39c7e7539974646fceb2b49c78ea66 100644 (file)
@@ -56,6 +56,12 @@ _mesa_ClearDepth( GLclampd depth )
 }
 
 
+void GLAPIENTRY
+_mesa_ClearDepthf( GLclampf depth )
+{
+   _mesa_ClearDepth(depth);
+}
+
 
 void GLAPIENTRY
 _mesa_DepthFunc( GLenum func )
index b498a471534ba5ec20dece74c74b250a7c710ab3..2f428629f9a0e8ebd43e8df94c26a4b58d4ff7ab 100644 (file)
@@ -43,6 +43,9 @@ struct gl_context;
 extern void GLAPIENTRY
 _mesa_ClearDepth( GLclampd depth );
 
+extern void GLAPIENTRY
+_mesa_ClearDepthf( GLclampf depth );
+
 extern void GLAPIENTRY
 _mesa_DepthFunc( GLenum func );
 
index 24241a4bd4ff2eed08b26b8dc46931bc3dc270d0..160ed62f557c8ebd8bad21d264ed2cb945c6c117 100644 (file)
@@ -33,6 +33,7 @@
 #define DLIST_H
 
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 
 
index 757aae6e70306437cb5d1e8bd2a3807fd5d7f96e..6fda3c5665c69577a03359485145827a5036fc0b 100644 (file)
@@ -30,6 +30,7 @@
 #include "enums.h"
 #include "feedback.h"
 #include "framebuffer.h"
+#include "mfeatures.h"
 #include "readpix.h"
 #include "state.h"
 #include "dispatch.h"
index b9afc9974e0ca02ecdaa499edef4fa5f9c67fc94..2089cdfcef91519845893e0242ea34ebe9d595df 100644 (file)
@@ -24,6 +24,8 @@
 #include "main/drawtex.h"
 #include "main/state.h"
 #include "main/imports.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
 
 
 #if FEATURE_OES_draw_texture
index a038a95c55ac864dd3189d6de660e4f23378152f..d047586eb35f205345c3ba963134a1c5a9334527 100644 (file)
@@ -33,6 +33,7 @@
 #include "enable.h"
 #include "light.h"
 #include "simple_list.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "enums.h"
 #include "api_arrayelt.h"
index 0ce62c0e3c74ac01642b928565ceb33fa5d84708..9ceee99dc0279c395484b5b179d0ccd7923c034a 100644 (file)
@@ -5909,8 +5909,8 @@ static const unsigned reduced_enums[1551] =
       1306, /* GL_PALETTE8_R5_G6_B5_OES */
       1309, /* GL_PALETTE8_RGBA4_OES */
       1307, /* GL_PALETTE8_RGB5_A1_OES */
-       726, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-       724, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+       725, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */
+       723, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */
       1355, /* GL_POINT_SIZE_ARRAY_OES */
       2014, /* GL_TEXTURE_CROP_RECT_OES */
        996, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */
index c607e6a26af212a73e39cbca8a5b1a27898ccc35..9ab55072f00cdf970539432c4975aada5be84fea 100644 (file)
@@ -43,6 +43,7 @@
 #include "context.h"
 #include "eval.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "main/dispatch.h"
 
index bd908f00cdd96f7e557d2445c65743395cff6306..bfeeebde54dc24e4893944d4ed423441fedd3c15 100644 (file)
@@ -37,6 +37,7 @@
 #define EVAL_H
 
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 
 
index a7bdfcc02041697678d29abc8438f8b04b711a16..24404993c69f4e0a9170246b6fffc20904679427 100644 (file)
  */
 
 
+/**
+ * \file
+ * \brief Extension handling
+ */
+
+
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
 #include "extensions.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 
+enum {
+   DISABLE = 0,
+   GL  = 1 << API_OPENGL,
+   ES1 = 1 << API_OPENGLES,
+   ES2 = 1 << API_OPENGLES2,
+};
 
-#define F(x) offsetof(struct gl_extensions, x)
-#define ON GL_TRUE
-#define OFF GL_FALSE
+/**
+ * \brief An element of the \c extension_table.
+ */
+struct extension {
+   /** Name of extension, such as "GL_ARB_depth_clamp". */
+   const char *name;
 
+   /** Offset (in bytes) of the corresponding member in struct gl_extensions. */
+   size_t offset;
 
-/*
+   /** Set of API's in which the extension exists, as a bitset. */
+   uint8_t api_set;
+};
+
+
+/**
+ * Given a member \c x of struct gl_extensions, return offset of
+ * \c x in bytes.
+ */
+#define o(x) offsetof(struct gl_extensions, x)
+
+
+/**
+ * \brief Table of supported OpenGL extensions for all API's.
+ *
  * Note: The GL_MESAX_* extensions are placeholders for future ARB extensions.
  */
-static const struct {
-   GLboolean enabled;
-   const char *name;
-   int flag_offset;
-} default_extensions[] = {
-   { OFF, "GL_ARB_blend_func_extended",        F(ARB_blend_func_extended) },
-   { ON,  "GL_ARB_copy_buffer",                F(ARB_copy_buffer) },
-   { OFF, "GL_ARB_depth_buffer_float",         F(ARB_depth_buffer_float) },
-   { OFF, "GL_ARB_depth_clamp",                F(ARB_depth_clamp) },
-   { OFF, "GL_ARB_depth_texture",              F(ARB_depth_texture) },
-   { 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_draw_instanced",             F(ARB_draw_instanced) },
-   { OFF, "GL_ARB_explicit_attrib_location",   F(ARB_explicit_attrib_location) },
-   { 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) },
-   /* TODO: reenable this when the new GLSL compiler actually supports them */
-   /* { OFF, "GL_ARB_geometry_shader4",           F(ARB_geometry_shader4) }, */
-   { 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_instanced_arrays",           F(ARB_instanced_arrays) },
-   { OFF, "GL_ARB_map_buffer_range",           F(ARB_map_buffer_range) },
-   { ON,  "GL_ARB_multisample",                F(ARB_multisample) },
-   { OFF, "GL_ARB_multitexture",               F(ARB_multitexture) },
-   { OFF, "GL_ARB_occlusion_query",            F(ARB_occlusion_query) },
-   { OFF, "GL_ARB_occlusion_query2",           F(ARB_occlusion_query2) },
-   { OFF, "GL_ARB_pixel_buffer_object",        F(EXT_pixel_buffer_object) },
-   { OFF, "GL_ARB_point_parameters",           F(EXT_point_parameters) },
-   { OFF, "GL_ARB_point_sprite",               F(ARB_point_sprite) },
-   { OFF, "GL_ARB_provoking_vertex",           F(EXT_provoking_vertex) },
-   { OFF, "GL_ARB_sampler_objects",            F(ARB_sampler_objects) },
-   { OFF, "GL_ARB_seamless_cube_map",          F(ARB_seamless_cube_map) },
-   { OFF, "GL_ARB_shader_objects",             F(ARB_shader_objects) },
-   { OFF, "GL_ARB_shader_stencil_export",      F(ARB_shader_stencil_export) },
-   { OFF, "GL_ARB_shading_language_100",       F(ARB_shading_language_100) },
-   { OFF, "GL_ARB_shadow",                     F(ARB_shadow) },
-   { OFF, "GL_ARB_shadow_ambient",             F(ARB_shadow_ambient) },
-   { OFF, "GL_ARB_sync",                       F(ARB_sync) },
-   { OFF, "GL_ARB_texture_border_clamp",       F(ARB_texture_border_clamp) },
-   { OFF, "GL_ARB_texture_buffer_object",      F(ARB_texture_buffer_object) },
-   { ON,  "GL_ARB_texture_compression",        F(ARB_texture_compression) },
-   { OFF, "GL_ARB_texture_compression_rgtc",   F(ARB_texture_compression_rgtc) },
-   { OFF, "GL_ARB_texture_cube_map",           F(ARB_texture_cube_map) },
-   { OFF, "GL_ARB_texture_env_add",            F(EXT_texture_env_add) },
-   { OFF, "GL_ARB_texture_env_combine",        F(ARB_texture_env_combine) },
-   { OFF, "GL_ARB_texture_env_crossbar",       F(ARB_texture_env_crossbar) },
-   { OFF, "GL_ARB_texture_env_dot3",           F(ARB_texture_env_dot3) },
-   { OFF, "GL_MESAX_texture_float",            F(ARB_texture_float) },
-   { OFF, "GL_ARB_texture_mirrored_repeat",    F(ARB_texture_mirrored_repeat)},
-   { OFF, "GL_ARB_texture_multisample",        F(ARB_texture_multisample) },
-   { OFF, "GL_ARB_texture_non_power_of_two",   F(ARB_texture_non_power_of_two)},
-   { OFF, "GL_ARB_texture_rectangle",          F(NV_texture_rectangle) },
-   { OFF, "GL_ARB_texture_rg",                 F(ARB_texture_rg) },
-   { OFF, "GL_ARB_texture_rgb10_a2ui",         F(ARB_texture_rgb10_a2ui) },
-   { OFF, "GL_ARB_texture_swizzle",            F(EXT_texture_swizzle) },
-   { ON,  "GL_ARB_transpose_matrix",           F(ARB_transpose_matrix) },
-   { OFF, "GL_ARB_transform_feedback2",        F(ARB_transform_feedback2) },
-   { OFF, "GL_ARB_uniform_buffer_object",      F(ARB_uniform_buffer_object) },
-   { OFF, "GL_ARB_vertex_array_bgra",          F(EXT_vertex_array_bgra) },
-   { OFF, "GL_ARB_vertex_array_object",        F(ARB_vertex_array_object) },
-   { ON,  "GL_ARB_vertex_buffer_object",       F(ARB_vertex_buffer_object) },
-   { OFF, "GL_ARB_vertex_program",             F(ARB_vertex_program) },
-   { OFF, "GL_ARB_vertex_shader",              F(ARB_vertex_shader) },
-   { OFF, "GL_ARB_vertex_type_2_10_10_10_rev", F(ARB_vertex_type_2_10_10_10_rev) },
-   { ON,  "GL_ARB_window_pos",                 F(ARB_window_pos) },
-   { ON,  "GL_EXT_abgr",                       F(EXT_abgr) },
-   { ON,  "GL_EXT_bgra",                       F(EXT_bgra) },
-   { OFF, "GL_EXT_blend_color",                F(EXT_blend_color) },
-   { OFF, "GL_EXT_blend_equation_separate",    F(EXT_blend_equation_separate) },
-   { OFF, "GL_EXT_blend_func_separate",        F(EXT_blend_func_separate) },
-   { OFF, "GL_EXT_blend_logic_op",             F(EXT_blend_logic_op) },
-   { OFF, "GL_EXT_blend_minmax",               F(EXT_blend_minmax) },
-   { OFF, "GL_EXT_blend_subtract",             F(EXT_blend_subtract) },
-   { OFF, "GL_EXT_clip_volume_hint",           F(EXT_clip_volume_hint) },
-   { ON,  "GL_EXT_compiled_vertex_array",      F(EXT_compiled_vertex_array) },
-   { ON,  "GL_EXT_copy_texture",               F(EXT_copy_texture) },
-   { OFF, "GL_EXT_depth_bounds_test",          F(EXT_depth_bounds_test) },
-   { OFF, "GL_EXT_draw_buffers2",              F(EXT_draw_buffers2) },
-   { OFF, "GL_EXT_draw_instanced",             F(ARB_draw_instanced) },
-   { ON,  "GL_EXT_draw_range_elements",        F(EXT_draw_range_elements) },
-   { OFF, "GL_EXT_framebuffer_blit",           F(EXT_framebuffer_blit) },
-   { OFF, "GL_EXT_framebuffer_multisample",    F(EXT_framebuffer_multisample) },
-   { OFF, "GL_EXT_framebuffer_object",         F(EXT_framebuffer_object) },
-   { OFF, "GL_EXT_framebuffer_sRGB",           F(EXT_framebuffer_sRGB) },
-   { OFF, "GL_EXT_fog_coord",                  F(EXT_fog_coord) },
-   { OFF, "GL_EXT_gpu_program_parameters",     F(EXT_gpu_program_parameters) },
-   { OFF, "GL_EXT_gpu_shader4",                F(EXT_gpu_shader4) },
-   { ON,  "GL_EXT_multi_draw_arrays",          F(EXT_multi_draw_arrays) },
-   { OFF, "GL_EXT_packed_depth_stencil",       F(EXT_packed_depth_stencil) },
-   { OFF, "GL_EXT_packed_float",               F(EXT_packed_float) },
-   { ON,  "GL_EXT_packed_pixels",              F(EXT_packed_pixels) },
-   { OFF, "GL_EXT_paletted_texture",           F(EXT_paletted_texture) },
-   { OFF, "GL_EXT_pixel_buffer_object",        F(EXT_pixel_buffer_object) },
-   { OFF, "GL_EXT_point_parameters",           F(EXT_point_parameters) },
-   { ON,  "GL_EXT_polygon_offset",             F(EXT_polygon_offset) },
-   { OFF, "GL_EXT_provoking_vertex",           F(EXT_provoking_vertex) },
-   { ON,  "GL_EXT_rescale_normal",             F(EXT_rescale_normal) },
-   { OFF, "GL_EXT_secondary_color",            F(EXT_secondary_color) },
-   { OFF, "GL_EXT_separate_shader_objects",    F(EXT_separate_shader_objects) },
-   { ON,  "GL_EXT_separate_specular_color",    F(EXT_separate_specular_color) },
-   { OFF, "GL_EXT_shadow_funcs",               F(EXT_shadow_funcs) },
-   { OFF, "GL_EXT_shared_texture_palette",     F(EXT_shared_texture_palette) },
-   { OFF, "GL_EXT_stencil_two_side",           F(EXT_stencil_two_side) },
-   { OFF, "GL_EXT_stencil_wrap",               F(EXT_stencil_wrap) },
-   { ON,  "GL_EXT_subtexture",                 F(EXT_subtexture) },
-   { ON,  "GL_EXT_texture",                    F(EXT_texture) },
-   { ON,  "GL_EXT_texture3D",                  F(EXT_texture3D) },
-   { OFF, "GL_EXT_texture_array",              F(EXT_texture_array) },
-   { OFF, "GL_EXT_texture_compression_s3tc",   F(EXT_texture_compression_s3tc) },
-   { OFF, "GL_EXT_texture_compression_rgtc",   F(ARB_texture_compression_rgtc) },
-   { OFF, "GL_EXT_texture_cube_map",           F(ARB_texture_cube_map) },
-   { ON,  "GL_EXT_texture_edge_clamp",         F(SGIS_texture_edge_clamp) },
-   { OFF, "GL_EXT_texture_env_add",            F(EXT_texture_env_add) },
-   { OFF, "GL_EXT_texture_env_combine",        F(EXT_texture_env_combine) },
-   { OFF, "GL_EXT_texture_env_dot3",           F(EXT_texture_env_dot3) },
-   { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) },
-   { OFF, "GL_EXT_texture_integer",            F(EXT_texture_integer) },
-   { OFF, "GL_EXT_texture_lod_bias",           F(EXT_texture_lod_bias) },
-   { OFF, "GL_EXT_texture_mirror_clamp",       F(EXT_texture_mirror_clamp) },
-   { ON,  "GL_EXT_texture_object",             F(EXT_texture_object) },
-   { OFF, "GL_EXT_texture_rectangle",          F(NV_texture_rectangle) },
-   { OFF, "GL_EXT_texture_shared_exponent",    F(EXT_texture_shared_exponent) },
-   { OFF, "GL_EXT_texture_sRGB",               F(EXT_texture_sRGB) },
-   { OFF, "GL_EXT_texture_swizzle",            F(EXT_texture_swizzle) },
-   { OFF, "GL_EXT_timer_query",                F(EXT_timer_query) },
-   { OFF, "GL_EXT_transform_feedback",         F(EXT_transform_feedback) },
-   { ON,  "GL_EXT_vertex_array",               F(EXT_vertex_array) },
-   { OFF, "GL_EXT_vertex_array_bgra",          F(EXT_vertex_array_bgra) },
-   { OFF, "GL_EXT_vertex_array_set",           F(EXT_vertex_array_set) },
-   { OFF, "GL_3DFX_texture_compression_FXT1",  F(TDFX_texture_compression_FXT1) },
-   { OFF, "GL_APPLE_client_storage",           F(APPLE_client_storage) },
-   { ON,  "GL_APPLE_packed_pixels",            F(APPLE_packed_pixels) },
-   { OFF, "GL_APPLE_vertex_array_object",      F(APPLE_vertex_array_object) },
-   { OFF, "GL_APPLE_object_purgeable",         F(APPLE_object_purgeable) },
-   { OFF, "GL_ATI_blend_equation_separate",    F(EXT_blend_equation_separate) },
-   { OFF, "GL_ATI_envmap_bumpmap",             F(ATI_envmap_bumpmap) },
-   { OFF, "GL_ATI_texture_env_combine3",       F(ATI_texture_env_combine3)},
-   { OFF, "GL_ATI_texture_mirror_once",        F(ATI_texture_mirror_once)},
-   { OFF, "GL_ATI_fragment_shader",            F(ATI_fragment_shader)},
-   { OFF, "GL_ATI_separate_stencil",           F(ATI_separate_stencil)},
-   { ON,  "GL_IBM_multimode_draw_arrays",      F(IBM_multimode_draw_arrays) },
-   { ON,  "GL_IBM_rasterpos_clip",             F(IBM_rasterpos_clip) },
-   { OFF, "GL_IBM_texture_mirrored_repeat",    F(ARB_texture_mirrored_repeat)},
-   { OFF, "GL_INGR_blend_func_separate",       F(EXT_blend_func_separate) },
-   { OFF, "GL_MESA_pack_invert",               F(MESA_pack_invert) },
-   { OFF, "GL_MESA_resize_buffers",            F(MESA_resize_buffers) },
-   { OFF, "GL_MESA_texture_array",             F(MESA_texture_array) },
-   { OFF, "GL_MESA_texture_signed_rgba",       F(MESA_texture_signed_rgba) },
-   { OFF, "GL_MESA_ycbcr_texture",             F(MESA_ycbcr_texture) },
-   { ON,  "GL_MESA_window_pos",                F(ARB_window_pos) },
-   { OFF, "GL_NV_blend_square",                F(NV_blend_square) },
-   { OFF, "GL_NV_conditional_render",          F(NV_conditional_render) },
-   { OFF, "GL_NV_depth_clamp",                 F(ARB_depth_clamp) },
-   { OFF, "GL_NV_fragment_program",            F(NV_fragment_program) },
-   { OFF, "GL_NV_fragment_program_option",     F(NV_fragment_program_option) },
-   { ON,  "GL_NV_light_max_exponent",          F(NV_light_max_exponent) },
-   { OFF, "GL_NV_packed_depth_stencil",        F(EXT_packed_depth_stencil) },
-   { OFF, "GL_NV_point_sprite",                F(NV_point_sprite) },
-   { OFF, "GL_NV_primitive_restart",           F(NV_primitive_restart) },
-   { ON,  "GL_NV_texgen_reflection",           F(NV_texgen_reflection) },
-   { OFF, "GL_NV_texture_env_combine4",        F(NV_texture_env_combine4) },
-   { OFF, "GL_NV_texture_rectangle",           F(NV_texture_rectangle) },
-   { OFF, "GL_NV_vertex_program",              F(NV_vertex_program) },
-   { OFF, "GL_NV_vertex_program1_1",           F(NV_vertex_program1_1) },
-   { ON,  "GL_OES_read_format",                F(OES_read_format) },
-   { OFF, "GL_SGI_texture_color_table",        F(SGI_texture_color_table) },
-   { ON,  "GL_SGIS_generate_mipmap",           F(SGIS_generate_mipmap) },
-   { OFF, "GL_SGIS_texture_border_clamp",      F(ARB_texture_border_clamp) },
-   { ON,  "GL_SGIS_texture_edge_clamp",        F(SGIS_texture_edge_clamp) },
-   { ON,  "GL_SGIS_texture_lod",               F(SGIS_texture_lod) },
-   { ON,  "GL_SUN_multi_draw_arrays",          F(EXT_multi_draw_arrays) },
-   { OFF, "GL_S3_s3tc",                        F(S3_s3tc) },
-   { OFF, "GL_EXT_texture_format_BGRA8888",    F(EXT_texture_format_BGRA8888) },
-#if FEATURE_OES_EGL_image
-   { OFF, "GL_OES_EGL_image",                  F(OES_EGL_image) },
-#endif
+static const struct extension extension_table[] = {
+   /* ARB Extensions */
+   { "GL_ARB_ES2_compatibility",                   o(ARB_ES2_compatibility),                   GL             },
+   { "GL_ARB_blend_func_extended",                 o(ARB_blend_func_extended),                 GL             },
+   { "GL_ARB_copy_buffer",                         o(ARB_copy_buffer),                         GL             },
+   { "GL_ARB_depth_buffer_float",                  o(ARB_depth_buffer_float),                  GL             },
+   { "GL_ARB_depth_clamp",                         o(ARB_depth_clamp),                         GL             },
+   { "GL_ARB_depth_texture",                       o(ARB_depth_texture),                       GL             },
+   { "GL_ARB_draw_buffers",                        o(ARB_draw_buffers),                        GL             },
+   { "GL_ARB_draw_elements_base_vertex",           o(ARB_draw_elements_base_vertex),           GL             },
+   { "GL_ARB_draw_instanced",                      o(ARB_draw_instanced),                      GL             },
+   { "GL_ARB_explicit_attrib_location",            o(ARB_explicit_attrib_location),            GL             },
+   { "GL_ARB_fragment_coord_conventions",          o(ARB_fragment_coord_conventions),          GL             },
+   { "GL_ARB_fragment_program",                    o(ARB_fragment_program),                    GL             },
+   { "GL_ARB_fragment_program_shadow",             o(ARB_fragment_program_shadow),             GL             },
+   { "GL_ARB_fragment_shader",                     o(ARB_fragment_shader),                     GL             },
+   { "GL_ARB_framebuffer_object",                  o(ARB_framebuffer_object),                  GL             },
+   { "GL_ARB_half_float_pixel",                    o(ARB_half_float_pixel),                    GL             },
+   { "GL_ARB_half_float_vertex",                   o(ARB_half_float_vertex),                   GL             },
+   { "GL_ARB_instanced_arrays",                    o(ARB_instanced_arrays),                    GL             },
+   { "GL_ARB_map_buffer_range",                    o(ARB_map_buffer_range),                    GL             },
+   { "GL_ARB_multisample",                         o(ARB_multisample),                         GL             },
+   { "GL_ARB_multitexture",                        o(ARB_multitexture),                        GL             },
+   { "GL_ARB_occlusion_query2",                    o(ARB_occlusion_query2),                    GL             },
+   { "GL_ARB_occlusion_query",                     o(ARB_occlusion_query),                     GL             },
+   { "GL_ARB_pixel_buffer_object",                 o(EXT_pixel_buffer_object),                 GL             },
+   { "GL_ARB_point_parameters",                    o(EXT_point_parameters),                    GL             },
+   { "GL_ARB_point_sprite",                        o(ARB_point_sprite),                        GL             },
+   { "GL_ARB_provoking_vertex",                    o(EXT_provoking_vertex),                    GL             },
+   { "GL_ARB_sampler_objects",                     o(ARB_sampler_objects),                     GL             },
+   { "GL_ARB_seamless_cube_map",                   o(ARB_seamless_cube_map),                   GL             },
+   { "GL_ARB_shader_objects",                      o(ARB_shader_objects),                      GL             },
+   { "GL_ARB_shader_stencil_export",               o(ARB_shader_stencil_export),               GL             },
+   { "GL_ARB_shading_language_100",                o(ARB_shading_language_100),                GL             },
+   { "GL_ARB_shadow_ambient",                      o(ARB_shadow_ambient),                      GL             },
+   { "GL_ARB_shadow",                              o(ARB_shadow),                              GL             },
+   { "GL_ARB_sync",                                o(ARB_sync),                                GL             },
+   { "GL_ARB_texture_border_clamp",                o(ARB_texture_border_clamp),                GL             },
+   { "GL_ARB_texture_buffer_object",               o(ARB_texture_buffer_object),               GL             },
+   { "GL_ARB_texture_compression",                 o(ARB_texture_compression),                 GL             },
+   { "GL_ARB_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            GL             },
+   { "GL_ARB_texture_cube_map",                    o(ARB_texture_cube_map),                    GL             },
+   { "GL_ARB_texture_env_add",                     o(EXT_texture_env_add),                     GL             },
+   { "GL_ARB_texture_env_combine",                 o(ARB_texture_env_combine),                 GL             },
+   { "GL_ARB_texture_env_crossbar",                o(ARB_texture_env_crossbar),                GL             },
+   { "GL_ARB_texture_env_dot3",                    o(ARB_texture_env_dot3),                    GL             },
+   { "GL_ARB_texture_mirrored_repeat",             o(ARB_texture_mirrored_repeat),             GL             },
+   { "GL_ARB_texture_multisample",                 o(ARB_texture_multisample),                 GL             },
+   { "GL_ARB_texture_non_power_of_two",            o(ARB_texture_non_power_of_two),            GL             },
+   { "GL_ARB_texture_rectangle",                   o(NV_texture_rectangle),                    GL             },
+   { "GL_ARB_texture_rgb10_a2ui",                  o(ARB_texture_rgb10_a2ui),                  GL             },
+   { "GL_ARB_texture_rg",                          o(ARB_texture_rg),                          GL             },
+   { "GL_ARB_texture_swizzle",                     o(EXT_texture_swizzle),                     GL             },
+   { "GL_ARB_transform_feedback2",                 o(ARB_transform_feedback2),                 GL             },
+   { "GL_ARB_transpose_matrix",                    o(ARB_transpose_matrix),                    GL             },
+   { "GL_ARB_uniform_buffer_object",               o(ARB_uniform_buffer_object),               GL             },
+   { "GL_ARB_vertex_array_bgra",                   o(EXT_vertex_array_bgra),                   GL             },
+   { "GL_ARB_vertex_array_object",                 o(ARB_vertex_array_object),                 GL             },
+   { "GL_ARB_vertex_buffer_object",                o(ARB_vertex_buffer_object),                GL             },
+   { "GL_ARB_vertex_program",                      o(ARB_vertex_program),                      GL             },
+   { "GL_ARB_vertex_shader",                       o(ARB_vertex_shader),                       GL             },
+   { "GL_ARB_vertex_type_2_10_10_10_rev",          o(ARB_vertex_type_2_10_10_10_rev),          GL             },
+   { "GL_ARB_window_pos",                          o(ARB_window_pos),                          GL             },
+
+   /* EXT extensions */
+   { "GL_EXT_abgr",                                o(EXT_abgr),                                GL             },
+   { "GL_EXT_bgra",                                o(EXT_bgra),                                GL             },
+   { "GL_EXT_blend_color",                         o(EXT_blend_color),                         GL             },
+   { "GL_EXT_blend_equation_separate",             o(EXT_blend_equation_separate),             GL             },
+   { "GL_EXT_blend_func_separate",                 o(EXT_blend_func_separate),                 GL             },
+   { "GL_EXT_blend_logic_op",                      o(EXT_blend_logic_op),                      GL             },
+   { "GL_EXT_blend_minmax",                        o(EXT_blend_minmax),                        GL | ES1 | ES2 },
+   { "GL_EXT_blend_subtract",                      o(EXT_blend_subtract),                      GL             },
+   { "GL_EXT_clip_volume_hint",                    o(EXT_clip_volume_hint),                    GL             },
+   { "GL_EXT_compiled_vertex_array",               o(EXT_compiled_vertex_array),               GL             },
+   { "GL_EXT_copy_texture",                        o(EXT_copy_texture),                        GL             },
+   { "GL_EXT_depth_bounds_test",                   o(EXT_depth_bounds_test),                   GL             },
+   { "GL_EXT_draw_buffers2",                       o(EXT_draw_buffers2),                       GL             },
+   { "GL_EXT_draw_instanced",                      o(ARB_draw_instanced),                      GL             },
+   { "GL_EXT_draw_range_elements",                 o(EXT_draw_range_elements),                 GL             },
+   { "GL_EXT_fog_coord",                           o(EXT_fog_coord),                           GL             },
+   { "GL_EXT_framebuffer_blit",                    o(EXT_framebuffer_blit),                    GL             },
+   { "GL_EXT_framebuffer_multisample",             o(EXT_framebuffer_multisample),             GL             },
+   { "GL_EXT_framebuffer_object",                  o(EXT_framebuffer_object),                  GL             },
+   { "GL_EXT_framebuffer_sRGB",                    o(EXT_framebuffer_sRGB),                    GL             },
+   { "GL_EXT_gpu_program_parameters",              o(EXT_gpu_program_parameters),              GL             },
+   { "GL_EXT_gpu_shader4",                         o(EXT_gpu_shader4),                         GL             },
+   { "GL_EXT_multi_draw_arrays",                   o(EXT_multi_draw_arrays),                   GL | ES1 | ES2 },
+   { "GL_EXT_packed_depth_stencil",                o(EXT_packed_depth_stencil),                GL             },
+   { "GL_EXT_packed_float",                        o(EXT_packed_float),                        GL             },
+   { "GL_EXT_packed_pixels",                       o(EXT_packed_pixels),                       GL             },
+   { "GL_EXT_paletted_texture",                    o(EXT_paletted_texture),                    GL             },
+   { "GL_EXT_pixel_buffer_object",                 o(EXT_pixel_buffer_object),                 GL             },
+   { "GL_EXT_point_parameters",                    o(EXT_point_parameters),                    GL             },
+   { "GL_EXT_polygon_offset",                      o(EXT_polygon_offset),                      GL             },
+   { "GL_EXT_provoking_vertex",                    o(EXT_provoking_vertex),                    GL             },
+   { "GL_EXT_rescale_normal",                      o(EXT_rescale_normal),                      GL             },
+   { "GL_EXT_secondary_color",                     o(EXT_secondary_color),                     GL             },
+   { "GL_EXT_separate_shader_objects",             o(EXT_separate_shader_objects),             GL             },
+   { "GL_EXT_separate_specular_color",             o(EXT_separate_specular_color),             GL             },
+   { "GL_EXT_shadow_funcs",                        o(EXT_shadow_funcs),                        GL             },
+   { "GL_EXT_shared_texture_palette",              o(EXT_shared_texture_palette),              GL             },
+   { "GL_EXT_stencil_two_side",                    o(EXT_stencil_two_side),                    GL             },
+   { "GL_EXT_stencil_wrap",                        o(EXT_stencil_wrap),                        GL             },
+   { "GL_EXT_subtexture",                          o(EXT_subtexture),                          GL             },
+   { "GL_EXT_texture3D",                           o(EXT_texture3D),                           GL             },
+   { "GL_EXT_texture_array",                       o(EXT_texture_array),                       GL             },
+   { "GL_EXT_texture_compression_dxt1",            o(EXT_texture_compression_s3tc),            GL | ES1 | ES2 },
+   { "GL_EXT_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            GL             },
+   { "GL_EXT_texture_compression_s3tc",            o(EXT_texture_compression_s3tc),            GL             },
+   { "GL_EXT_texture_cube_map",                    o(ARB_texture_cube_map),                    GL             },
+   { "GL_EXT_texture_edge_clamp",                  o(SGIS_texture_edge_clamp),                 GL             },
+   { "GL_EXT_texture_env_add",                     o(EXT_texture_env_add),                     GL             },
+   { "GL_EXT_texture_env_combine",                 o(EXT_texture_env_combine),                 GL             },
+   { "GL_EXT_texture_env_dot3",                    o(EXT_texture_env_dot3),                    GL             },
+   { "GL_EXT_texture_filter_anisotropic",          o(EXT_texture_filter_anisotropic),          GL | ES1 | ES2 },
+   { "GL_EXT_texture_format_BGRA8888",             o(EXT_texture_format_BGRA8888),                  ES1 | ES2 },
+   { "GL_EXT_texture_integer",                     o(EXT_texture_integer),                     GL             },
+   { "GL_EXT_texture_lod_bias",                    o(EXT_texture_lod_bias),                    GL | ES1       },
+   { "GL_EXT_texture_mirror_clamp",                o(EXT_texture_mirror_clamp),                GL             },
+   { "GL_EXT_texture_object",                      o(EXT_texture_object),                      GL             },
+   { "GL_EXT_texture",                             o(EXT_texture),                             GL             },
+   { "GL_EXT_texture_rectangle",                   o(NV_texture_rectangle),                    GL             },
+   { "GL_EXT_texture_shared_exponent",             o(EXT_texture_shared_exponent),             GL             },
+   { "GL_EXT_texture_sRGB",                        o(EXT_texture_sRGB),                        GL             },
+   { "GL_EXT_texture_swizzle",                     o(EXT_texture_swizzle),                     GL             },
+   { "GL_EXT_texture_type_2_10_10_10_REV",         o(dummy_true),                                         ES2 },
+   { "GL_EXT_timer_query",                         o(EXT_timer_query),                         GL             },
+   { "GL_EXT_transform_feedback",                  o(EXT_transform_feedback),                  GL             },
+   { "GL_EXT_vertex_array_bgra",                   o(EXT_vertex_array_bgra),                   GL             },
+   { "GL_EXT_vertex_array",                        o(EXT_vertex_array),                        GL             },
+   { "GL_EXT_vertex_array_set",                    o(EXT_vertex_array_set),                    GL             },
+
+   /* OES extensions */
+   { "GL_OES_blend_equation_separate",             o(EXT_blend_equation_separate),                  ES1       },
+   { "GL_OES_blend_func_separate",                 o(EXT_blend_func_separate),                      ES1       },
+   { "GL_OES_blend_subtract",                      o(EXT_blend_subtract),                           ES1       },
+   { "GL_OES_byte_coordinates",                    o(dummy_true),                                   ES1       },
+   { "GL_OES_compressed_paletted_texture",         o(dummy_false),                     DISABLE                },
+   { "GL_OES_depth24",                             o(EXT_framebuffer_object),                       ES1 | ES2 },
+   { "GL_OES_depth32",                             o(dummy_false),                     DISABLE                },
+   { "GL_OES_depth_texture",                       o(ARB_depth_texture),                                  ES2 },
 #if FEATURE_OES_draw_texture
-   { OFF, "GL_OES_draw_texture",               F(OES_draw_texture) },
-#endif /* FEATURE_OES_draw_texture */
+   { "GL_OES_draw_texture",                        o(OES_draw_texture),                             ES1 | ES2 },
+#endif
+#if FEATURE_OES_EGL_image
+   /*  FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */
+   { "GL_OES_EGL_image",                           o(OES_EGL_image),                           GL | ES1 | ES2 },
+#endif
+   { "GL_OES_element_index_uint",                  o(EXT_vertex_array),                             ES1 | ES2 },
+   { "GL_OES_fbo_render_mipmap",                   o(EXT_framebuffer_object),                       ES1 | ES2 },
+   { "GL_OES_fixed_point",                         o(dummy_true),                                   ES1       },
+   { "GL_OES_framebuffer_object",                  o(EXT_framebuffer_object),                       ES1       },
+   { "GL_OES_mapbuffer",                           o(ARB_vertex_buffer_object),                     ES1 | ES2 },
+   { "GL_OES_matrix_get",                          o(dummy_true),                                   ES1       },
+   { "GL_OES_packed_depth_stencil",                o(EXT_packed_depth_stencil),                     ES1 | ES2 },
+   { "GL_OES_point_size_array",                    o(dummy_true),                                   ES1       },
+   { "GL_OES_point_sprite",                        o(ARB_point_sprite),                             ES1       },
+   { "GL_OES_query_matrix",                        o(dummy_true),                                   ES1       },
+   { "GL_OES_read_format",                         o(OES_read_format),                         GL | ES1       },
+   { "GL_OES_rgb8_rgba8",                          o(EXT_framebuffer_object),                       ES1 | ES2 },
+   { "GL_OES_single_precision",                    o(dummy_true),                                   ES1       },
+   { "GL_OES_standard_derivatives",                o(OES_standard_derivatives),                           ES2 },
+   { "GL_OES_stencil1",                            o(dummy_false),                     DISABLE                },
+   { "GL_OES_stencil4",                            o(dummy_false),                     DISABLE                },
+   { "GL_OES_stencil8",                            o(EXT_framebuffer_object),                       ES1 | ES2 },
+   { "GL_OES_stencil_wrap",                        o(EXT_stencil_wrap),                             ES1       },
+   /* GL_OES_texture_3D is disabled due to missing GLSL support. */
+   { "GL_OES_texture_3D",                          o(EXT_texture3D),                   DISABLE                },
+   { "GL_OES_texture_cube_map",                    o(ARB_texture_cube_map),                         ES1       },
+   { "GL_OES_texture_env_crossbar",                o(ARB_texture_env_crossbar),                     ES1       },
+   { "GL_OES_texture_mirrored_repeat",             o(ARB_texture_mirrored_repeat),                  ES1       },
+   { "GL_OES_texture_npot",                        o(ARB_texture_non_power_of_two),                       ES2 },
+
+   /* Vendor extensions */
+   { "GL_3DFX_texture_compression_FXT1",           o(TDFX_texture_compression_FXT1),           GL             },
+   { "GL_APPLE_client_storage",                    o(APPLE_client_storage),                    GL             },
+   { "GL_APPLE_object_purgeable",                  o(APPLE_object_purgeable),                  GL             },
+   { "GL_APPLE_packed_pixels",                     o(APPLE_packed_pixels),                     GL             },
+   { "GL_APPLE_vertex_array_object",               o(APPLE_vertex_array_object),               GL             },
+   { "GL_ATI_blend_equation_separate",             o(EXT_blend_equation_separate),             GL             },
+   { "GL_ATI_envmap_bumpmap",                      o(ATI_envmap_bumpmap),                      GL             },
+   { "GL_ATI_fragment_shader",                     o(ATI_fragment_shader),                     GL             },
+   { "GL_ATI_separate_stencil",                    o(ATI_separate_stencil),                    GL             },
+   { "GL_ATI_texture_env_combine3",                o(ATI_texture_env_combine3),                GL             },
+   { "GL_ATI_texture_mirror_once",                 o(ATI_texture_mirror_once),                 GL             },
+   { "GL_IBM_multimode_draw_arrays",               o(IBM_multimode_draw_arrays),               GL             },
+   { "GL_IBM_rasterpos_clip",                      o(IBM_rasterpos_clip),                      GL             },
+   { "GL_IBM_texture_mirrored_repeat",             o(ARB_texture_mirrored_repeat),             GL             },
+   { "GL_INGR_blend_func_separate",                o(EXT_blend_func_separate),                 GL             },
+   { "GL_MESA_pack_invert",                        o(MESA_pack_invert),                        GL             },
+   { "GL_MESA_resize_buffers",                     o(MESA_resize_buffers),                     GL             },
+   { "GL_MESA_texture_array",                      o(MESA_texture_array),                      GL             },
+   { "GL_MESA_texture_signed_rgba",                o(MESA_texture_signed_rgba),                GL             },
+   { "GL_MESA_window_pos",                         o(ARB_window_pos),                          GL             },
+   { "GL_MESAX_texture_float",                     o(ARB_texture_float),                       GL             },
+   { "GL_MESA_ycbcr_texture",                      o(MESA_ycbcr_texture),                      GL             },
+   { "GL_NV_blend_square",                         o(NV_blend_square),                         GL             },
+   { "GL_NV_conditional_render",                   o(NV_conditional_render),                   GL             },
+   { "GL_NV_depth_clamp",                          o(ARB_depth_clamp),                         GL             },
+   { "GL_NV_fragment_program",                     o(NV_fragment_program),                     GL             },
+   { "GL_NV_fragment_program_option",              o(NV_fragment_program_option),              GL             },
+   { "GL_NV_light_max_exponent",                   o(NV_light_max_exponent),                   GL             },
+   { "GL_NV_packed_depth_stencil",                 o(EXT_packed_depth_stencil),                GL             },
+   { "GL_NV_point_sprite",                         o(NV_point_sprite),                         GL             },
+   { "GL_NV_primitive_restart",                    o(NV_primitive_restart),                    GL             },
+   { "GL_NV_texgen_reflection",                    o(NV_texgen_reflection),                    GL             },
+   { "GL_NV_texture_env_combine4",                 o(NV_texture_env_combine4),                 GL             },
+   { "GL_NV_texture_rectangle",                    o(NV_texture_rectangle),                    GL             },
+   { "GL_NV_vertex_program1_1",                    o(NV_vertex_program1_1),                    GL             },
+   { "GL_NV_vertex_program",                       o(NV_vertex_program),                       GL             },
+   { "GL_S3_s3tc",                                 o(S3_s3tc),                                 GL             },
+   { "GL_SGIS_generate_mipmap",                    o(SGIS_generate_mipmap),                    GL             },
+   { "GL_SGIS_texture_border_clamp",               o(ARB_texture_border_clamp),                GL             },
+   { "GL_SGIS_texture_edge_clamp",                 o(SGIS_texture_edge_clamp),                 GL             },
+   { "GL_SGIS_texture_lod",                        o(SGIS_texture_lod),                        GL             },
+   { "GL_SGI_texture_color_table",                 o(SGI_texture_color_table),                 GL             },
+   { "GL_SUN_multi_draw_arrays",                   o(EXT_multi_draw_arrays),                   GL             },
+
+   { 0, 0, 0 },
 };
 
 
+/**
+ * Given an extension name, lookup up the corresponding member of struct
+ * gl_extensions and return that member's offset (in bytes).  If the name is
+ * not found in the \c extension_table, return 0.
+ *
+ * \param name Name of extension.
+ * \return Offset of member in struct gl_extensions.
+ */
+static size_t
+name_to_offset(const char* name)
+{
+   const struct extension *i;
+
+   if (name == 0)
+      return 0;
+
+   for (i = extension_table; i->name != 0; ++i) {
+      if (strcmp(name, i->name) == 0)
+        return i->offset;
+   }
+
+   return 0;
+}
+
+
+/**
+ * \brief Extensions enabled by default.
+ *
+ * These extensions are enabled by _mesa_init_extensions().
+ *
+ * XXX: Should these defaults also apply to GLES?
+ */
+static const size_t default_extensions[] = {
+   o(ARB_copy_buffer),
+   o(ARB_draw_buffers),
+   o(ARB_multisample),
+   o(ARB_texture_compression),
+   o(ARB_transpose_matrix),
+   o(ARB_vertex_buffer_object),
+   o(ARB_window_pos),
+
+   o(EXT_abgr),
+   o(EXT_bgra),
+   o(EXT_compiled_vertex_array),
+   o(EXT_copy_texture),
+   o(EXT_draw_range_elements),
+   o(EXT_multi_draw_arrays),
+   o(EXT_packed_pixels),
+   o(EXT_polygon_offset),
+   o(EXT_rescale_normal),
+   o(EXT_separate_specular_color),
+   o(EXT_subtexture),
+   o(EXT_texture),
+   o(EXT_texture3D),
+   o(EXT_texture_object),
+   o(EXT_vertex_array),
+
+   o(OES_read_format),
+   o(OES_standard_derivatives),
+
+   /* Vendor Extensions */
+   o(APPLE_packed_pixels),
+   o(IBM_multimode_draw_arrays),
+   o(IBM_rasterpos_clip),
+   o(NV_light_max_exponent),
+   o(NV_texgen_reflection),
+   o(SGIS_generate_mipmap),
+   o(SGIS_texture_edge_clamp),
+   o(SGIS_texture_lod),
+
+   0,
+};
+
 
 /**
  * Enable all extensions suitable for a software-only renderer.
@@ -250,7 +393,8 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
 #if FEATURE_ARB_framebuffer_object
    ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
 #endif
-#if FEATURE_ARB_geometry_shader4
+#if FEATURE_ARB_geometry_shader4 && 0
+   /* XXX re-enable when GLSL compiler again supports geometry shaders */
    ctx->Extensions.ARB_geometry_shader4 = GL_TRUE;
 #endif
    ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
@@ -259,6 +403,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.ARB_multitexture = GL_TRUE;
 #if FEATURE_queryobj
    ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+   ctx->Extensions.ARB_occlusion_query2 = GL_TRUE;
 #endif
    ctx->Extensions.ARB_point_sprite = GL_TRUE;
 #if FEATURE_ARB_shader_objects
@@ -511,8 +656,7 @@ _mesa_enable_2_1_extensions(struct gl_context *ctx)
 static GLboolean
 set_extension( struct gl_context *ctx, const char *name, GLboolean state )
 {
-   GLboolean *base = (GLboolean *) &ctx->Extensions;
-   GLuint i;
+   size_t offset;
 
    if (ctx->Extensions.String) {
       /* The string was already queried - can't change it now! */
@@ -520,16 +664,20 @@ set_extension( struct gl_context *ctx, const char *name, GLboolean state )
       return GL_FALSE;
    }
 
-   for (i = 0 ; i < Elements(default_extensions) ; i++) {
-      if (strcmp(default_extensions[i].name, name) == 0) {
-         if (default_extensions[i].flag_offset) {
-            GLboolean *enabled = base + default_extensions[i].flag_offset;
-            *enabled = state;
-         }
-         return GL_TRUE;
-      }
+   offset = name_to_offset(name);
+   if (offset == 0) {
+      _mesa_problem(ctx, "Trying to enable/disable unknown extension %s",
+                   name);
+      return GL_FALSE;
+   } else if (offset == o(dummy_true) && state == GL_FALSE) {
+      _mesa_problem(ctx, "Trying to disable a permanently enabled extension: "
+                         "%s", name);
+      return GL_FALSE;
+   } else {
+      GLboolean *base = (GLboolean *) &ctx->Extensions;
+      base[offset] = state;
+      return GL_TRUE;
    }
-   return GL_FALSE;
 }
 
 
@@ -557,37 +705,23 @@ _mesa_disable_extension( struct gl_context *ctx, const char *name )
 }
 
 
-/**
- * Check if the i-th extension is enabled.
- */
-static GLboolean
-extension_enabled(struct gl_context *ctx, GLuint index)
-{
-   const GLboolean *base = (const GLboolean *) &ctx->Extensions;
-   if (!default_extensions[index].flag_offset ||
-       *(base + default_extensions[index].flag_offset)) {
-      return GL_TRUE;
-   }
-   else {
-      return GL_FALSE;
-   }
-}
-
-
 /**
  * Test if the named extension is enabled in this context.
  */
 GLboolean
 _mesa_extension_is_enabled( struct gl_context *ctx, const char *name )
 {
-   GLuint i;
+   size_t offset;
+   GLboolean *base;
 
-   for (i = 0 ; i < Elements(default_extensions) ; i++) {
-      if (strcmp(default_extensions[i].name, name) == 0) {
-         return extension_enabled(ctx, i);
-      }
-   }
-   return GL_FALSE;
+   if (name == 0)
+      return GL_FALSE;
+
+   offset = name_to_offset(name);
+   if (offset == 0)
+      return GL_FALSE;
+   base = (GLboolean *) &ctx->Extensions;
+   return base[offset];
 }
 
 
@@ -618,8 +752,10 @@ append(const char *a, const char *b)
  * For extension names that are recognized, turn them on.  For extension
  * names that are recognized and prefixed with '-', turn them off.
  * Return a string of the unknown/leftover names.
+ *
+ * Returnd string needs to be freed.
  */
-static const char *
+static char *
 get_extension_override( struct gl_context *ctx )
 {
    const char *envExt = _mesa_getenv("MESA_EXTENSION_OVERRIDE");
@@ -666,22 +802,27 @@ get_extension_override( struct gl_context *ctx )
 
 
 /**
- * Run through the default_extensions array above and set the
- * ctx->Extensions.ARB/EXT_* flags accordingly.
- * To be called during context initialization.
+ * \brief Initialize extension tables and enable default extensions.
+ *
+ * This should be called during context initialization.
+ * Note: Sets gl_extensions.dummy_true to true.
  */
 void
 _mesa_init_extensions( struct gl_context *ctx )
 {
    GLboolean *base = (GLboolean *) &ctx->Extensions;
-   GLuint i;
-
-   for (i = 0 ; i < Elements(default_extensions) ; i++) {
-      if (default_extensions[i].enabled &&
-          default_extensions[i].flag_offset) {
-         *(base + default_extensions[i].flag_offset) = GL_TRUE;
-      }
-   }
+   GLboolean *sentinel = base + o(extension_sentinel);
+   GLboolean *i;
+   const size_t *j;
+
+   /* First, turn all extensions off. */
+   for (i = base; i != sentinel; ++i)
+      *i = GL_FALSE;
+
+   /* Then, selectively turn default extensions on. */
+   ctx->Extensions.dummy_true = GL_TRUE;
+   for (j = default_extensions; *j != 0; ++j)
+      base[*j] = GL_TRUE;
 }
 
 
@@ -689,254 +830,46 @@ _mesa_init_extensions( struct gl_context *ctx )
  * Construct the GL_EXTENSIONS string.  Called the first time that
  * glGetString(GL_EXTENSIONS) is called.
  */
-static GLubyte *
-compute_extensions( struct gl_context *ctx )
+GLubyte*
+_mesa_make_extension_string(struct gl_context *ctx)
 {
-   const char *extraExt = get_extension_override(ctx);
-   GLuint extStrLen = 0;
-   char *s;
-   GLuint i;
+   /* The extension string. */
+   char *exts = 0;
+   /* Length of extension string. */
+   size_t length = 0;
+   /* String of extra extensions. */
+   char *extra_extensions = get_extension_override(ctx);
+   GLboolean *base = (GLboolean *) &ctx->Extensions;
+   const struct extension *i;
 
-   /* first, compute length of the extension string */
-   for (i = 0 ; i < Elements(default_extensions) ; i++) {
-      if (extension_enabled(ctx, i)) {
-         extStrLen += (GLuint) strlen(default_extensions[i].name) + 1;
+   /* Compute length of the extension string. */
+   for (i = extension_table; i->name != 0; ++i) {
+      if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+        length += strlen(i->name) + 1; /* +1 for space */
       }
    }
+   if (extra_extensions != NULL)
+      length += 1 + strlen(extra_extensions); /* +1 for space */
 
-   if (extraExt)
-      extStrLen += strlen(extraExt) + 1; /* +1 for space */
-
-   /* allocate the extension string */
-   s = (char *) malloc(extStrLen);
-   if (!s)
+   exts = (char *) calloc(length + 1, sizeof(char));
+   if (exts == NULL) {
+      free(extra_extensions);
       return NULL;
-
-   /* second, build the extension string */
-   extStrLen = 0;
-   for (i = 0 ; i < Elements(default_extensions) ; i++) {
-      if (extension_enabled(ctx, i)) {
-         GLuint len = (GLuint) strlen(default_extensions[i].name);
-         memcpy(s + extStrLen, default_extensions[i].name, len);
-         extStrLen += len;
-         s[extStrLen] = ' ';
-         extStrLen++;
-      }
    }
-   ASSERT(extStrLen > 0);
-
-   s[extStrLen - 1] = 0; /* -1 to overwrite trailing the ' ' */
-
-   if (extraExt) {
-      s = append(s, " ");
-      s = append(s, extraExt);
-   }
-
-   return (GLubyte *) s;
-}
 
-static size_t
-append_extension(GLubyte **str, const char *ext)
-{
-   GLubyte *s = *str;
-   size_t len = strlen(ext);
-
-   if (s) {
-      memcpy(s, ext, len);
-      s[len++] = ' ';
-      s[len] = '\0';
-
-      *str += len;
+   /* Build the extension string.*/
+   for (i = extension_table; i->name != 0; ++i) {
+      if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+         strcat(exts, i->name);
+         strcat(exts, " ");
+      }
    }
-   else {
-      len++;
+   if (extra_extensions != 0) {
+      strcat(exts, extra_extensions);
+      free(extra_extensions);
    }
 
-   return len;
-}
-
-
-static size_t
-make_extension_string_es1(const struct gl_context *ctx, GLubyte *str)
-{
-   size_t len = 0;
-
-   /* Core additions */
-   len += append_extension(&str, "GL_OES_byte_coordinates");
-   len += append_extension(&str, "GL_OES_fixed_point");
-   len += append_extension(&str, "GL_OES_single_precision");
-   len += append_extension(&str, "GL_OES_matrix_get");
-
-   /* 1.1 required extensions */
-   len += append_extension(&str, "GL_OES_read_format");
-   len += append_extension(&str, "GL_OES_compressed_paletted_texture");
-   len += append_extension(&str, "GL_OES_point_size_array");
-   len += append_extension(&str, "GL_OES_point_sprite");
-
-   /* 1.1 deprecated extensions */
-   len += append_extension(&str, "GL_OES_query_matrix");
-
-#if FEATURE_OES_draw_texture
-   if (ctx->Extensions.OES_draw_texture)
-      len += append_extension(&str, "GL_OES_draw_texture");
-#endif
-
-   if (ctx->Extensions.EXT_blend_equation_separate)
-      len += append_extension(&str, "GL_OES_blend_equation_separate");
-   if (ctx->Extensions.EXT_blend_func_separate)
-      len += append_extension(&str, "GL_OES_blend_func_separate");
-   if (ctx->Extensions.EXT_blend_subtract)
-      len += append_extension(&str, "GL_OES_blend_subtract");
-
-   if (ctx->Extensions.EXT_stencil_wrap)
-      len += append_extension(&str, "GL_OES_stencil_wrap");
-
-   if (ctx->Extensions.ARB_texture_cube_map)
-      len += append_extension(&str, "GL_OES_texture_cube_map");
-   if (ctx->Extensions.ARB_texture_env_crossbar)
-      len += append_extension(&str, "GL_OES_texture_env_crossbar");
-   if (ctx->Extensions.ARB_texture_mirrored_repeat)
-      len += append_extension(&str, "GL_OES_texture_mirrored_repeat");
-
-   if (ctx->Extensions.ARB_framebuffer_object) {
-      len += append_extension(&str, "GL_OES_framebuffer_object");
-      len += append_extension(&str, "GL_OES_depth24");
-      len += append_extension(&str, "GL_OES_depth32");
-      len += append_extension(&str, "GL_OES_fbo_render_mipmap");
-      len += append_extension(&str, "GL_OES_rgb8_rgba8");
-      len += append_extension(&str, "GL_OES_stencil1");
-      len += append_extension(&str, "GL_OES_stencil4");
-      len += append_extension(&str, "GL_OES_stencil8");
-   }
-
-   if (ctx->Extensions.EXT_vertex_array)
-      len += append_extension(&str, "GL_OES_element_index_uint");
-   if (ctx->Extensions.ARB_vertex_buffer_object)
-      len += append_extension(&str, "GL_OES_mapbuffer");
-   if (ctx->Extensions.EXT_texture_filter_anisotropic)
-      len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
-
-   /* some applications check this for NPOT support */
-   if (ctx->Extensions.ARB_texture_non_power_of_two)
-      len += append_extension(&str, "GL_ARB_texture_non_power_of_two");
-
-   if (ctx->Extensions.EXT_texture_compression_s3tc)
-      len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
-   if (ctx->Extensions.EXT_texture_lod_bias)
-      len += append_extension(&str, "GL_EXT_texture_lod_bias");
-   if (ctx->Extensions.EXT_blend_minmax)
-      len += append_extension(&str, "GL_EXT_blend_minmax");
-   if (ctx->Extensions.EXT_multi_draw_arrays)
-      len += append_extension(&str, "GL_EXT_multi_draw_arrays");
-
-#if FEATURE_OES_EGL_image
-   if (ctx->Extensions.OES_EGL_image)
-      len += append_extension(&str, "GL_OES_EGL_image");
-#endif
-
-   return len;
-}
-
-
-static GLubyte *
-compute_extensions_es1(const struct gl_context *ctx)
-{
-   GLubyte *s;
-   unsigned int len;
-   
-   len = make_extension_string_es1(ctx, NULL);
-   s = malloc(len + 1);
-   if (!s)
-      return NULL;
-   make_extension_string_es1(ctx, s);
-   
-   return s;
-}
-
-static size_t
-make_extension_string_es2(const struct gl_context *ctx, GLubyte *str)
-{
-   size_t len = 0;
-
-   len += append_extension(&str, "GL_OES_compressed_paletted_texture");
-
-   if (ctx->Extensions.ARB_framebuffer_object) {
-      len += append_extension(&str, "GL_OES_depth24");
-      len += append_extension(&str, "GL_OES_depth32");
-      len += append_extension(&str, "GL_OES_fbo_render_mipmap");
-      len += append_extension(&str, "GL_OES_rgb8_rgba8");
-      len += append_extension(&str, "GL_OES_stencil1");
-      len += append_extension(&str, "GL_OES_stencil4");
-   }
-
-   if (ctx->Extensions.EXT_vertex_array)
-      len += append_extension(&str, "GL_OES_element_index_uint");
-   if (ctx->Extensions.ARB_vertex_buffer_object)
-      len += append_extension(&str, "GL_OES_mapbuffer");
-
-   if (ctx->Extensions.EXT_texture3D)
-      len += append_extension(&str, "GL_OES_texture_3D");
-   if (ctx->Extensions.ARB_texture_non_power_of_two)
-      len += append_extension(&str, "GL_OES_texture_npot");
-   if (ctx->Extensions.EXT_texture_filter_anisotropic)
-      len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
-
-   len += append_extension(&str, "GL_EXT_texture_type_2_10_10_10_REV");
-   if (ctx->Extensions.ARB_depth_texture)
-      len += append_extension(&str, "GL_OES_depth_texture");
-   if (ctx->Extensions.EXT_packed_depth_stencil)
-      len += append_extension(&str, "GL_OES_packed_depth_stencil");
-   if (ctx->Extensions.ARB_fragment_shader)
-      len += append_extension(&str, "GL_OES_standard_derivatives");
-
-   if (ctx->Extensions.EXT_texture_compression_s3tc)
-      len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
-   if (ctx->Extensions.EXT_blend_minmax)
-      len += append_extension(&str, "GL_EXT_blend_minmax");
-   if (ctx->Extensions.EXT_multi_draw_arrays)
-      len += append_extension(&str, "GL_EXT_multi_draw_arrays");
-
-#if FEATURE_OES_EGL_image
-   if (ctx->Extensions.OES_EGL_image)
-      len += append_extension(&str, "GL_OES_EGL_image");
-#endif
-
-   if (ctx->Extensions.EXT_texture_format_BGRA8888)
-      len += append_extension(&str, "GL_EXT_texture_format_BGRA8888");
-
-   return len;
-}
-
-static GLubyte *
-compute_extensions_es2(struct gl_context *ctx)
-{
-   GLubyte *s;
-   unsigned int len;
-
-   len = make_extension_string_es2(ctx, NULL);
-   s = malloc(len + 1);
-   if (!s)
-      return NULL;
-   make_extension_string_es2(ctx, s);
-   
-   return s;
-}
-
-
-GLubyte *
-_mesa_make_extension_string(struct gl_context *ctx)
-{
-   switch (ctx->API) {
-   case API_OPENGL:
-      return compute_extensions(ctx);
-   case API_OPENGLES2:
-      return compute_extensions_es2(ctx);
-   case API_OPENGLES:
-      return compute_extensions_es1(ctx);
-   default:
-      assert(0);
-      return NULL;
-   }
+   return (GLubyte *) exts;
 }
 
 /**
@@ -945,38 +878,42 @@ _mesa_make_extension_string(struct gl_context *ctx)
 GLuint
 _mesa_get_extension_count(struct gl_context *ctx)
 {
-   GLuint i;
+   GLboolean *base;
+   const struct extension *i;
 
    /* only count once */
-   if (!ctx->Extensions.Count) {
-      for (i = 0; i < Elements(default_extensions); i++) {
-         if (extension_enabled(ctx, i)) {
-            ctx->Extensions.Count++;
-         }
+   if (ctx->Extensions.Count != 0)
+      return ctx->Extensions.Count;
+
+   base = (GLboolean *) &ctx->Extensions;
+   for (i = extension_table; i->name != 0; ++i) {
+      if (base[i->offset]) {
+        ctx->Extensions.Count++;
       }
    }
-
-   if (0)
-      _mesa_debug(ctx, "%u of %d extensions enabled\n", ctx->Extensions.Count,
-                  (int) Elements(default_extensions));
-
    return ctx->Extensions.Count;
 }
 
-
 /**
  * Return name of i-th enabled extension
  */
 const GLubyte *
 _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
 {
-   GLuint i;
+   const GLboolean *base;
+   size_t n;
+   const struct extension *i;
+
+   if (index < 0)
+      return NULL;
 
-   for (i = 0; i < Elements(default_extensions); i++) {
-      if (extension_enabled(ctx, i)) {
-         if (index == 0)
-            return (const GLubyte *) default_extensions[i].name;
-         index--;
+   base = (GLboolean*) &ctx->Extensions;
+   n = 0;
+   for (i = extension_table; i->name != 0; ++i) {
+      if (n == index && base[i->offset]) {
+        return (GLubyte*) i->name;
+      } else if (base[i->offset]) {
+        ++n;
       }
    }
 
index 7c3357043faf3b1efc372a120eaaf45fb96a2a1a..f31d8b36db8ffbde680bc3753636b7bbe2cbcac6 100644 (file)
@@ -40,6 +40,8 @@
 #include "framebuffer.h"
 #include "hash.h"
 #include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "renderbuffer.h"
 #include "state.h"
 #include "teximage.h"
@@ -402,8 +404,8 @@ fbo_incomplete(const char *msg, int index)
 /**
  * Is the given base format a legal format for a color renderbuffer?
  */
-static GLboolean
-is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
+GLboolean
+_mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
 {
    switch (baseFormat) {
    case GL_RGB:
@@ -488,7 +490,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
       baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
 
       if (format == GL_COLOR) {
-         if (!is_legal_color_format(ctx, baseFormat)) {
+         if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
             att_incomplete("bad format");
             att->Complete = GL_FALSE;
             return;
@@ -542,8 +544,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
          return;
       }
       if (format == GL_COLOR) {
-         if (baseFormat != GL_RGB &&
-             baseFormat != GL_RGBA) {
+         if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
             att_incomplete("bad renderbuffer color format");
             att->Complete = GL_FALSE;
             return;
@@ -669,7 +670,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
          f = texImg->_BaseFormat;
          mesaFormat = texImg->TexFormat;
          numImages++;
-         if (!is_legal_color_format(ctx, f) &&
+         if (!_mesa_is_legal_color_format(ctx, f) &&
              !is_legal_depth_format(ctx, f)) {
             fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
             fbo_incomplete("texture attachment incomplete", -1);
@@ -793,7 +794,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
       fb->Height = minHeight;
 
       /* finally, update the visual info for the framebuffer */
-      _mesa_update_framebuffer_visual(fb);
+      _mesa_update_framebuffer_visual(ctx, fb);
    }
 }
 
@@ -959,67 +960,42 @@ _mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers)
 
 
 /**
- * Given an internal format token for a render buffer, return the
+ * Given an internal format token for a renderbuffer, return the
  * corresponding base format.
- * This is very similar to _mesa_base_tex_format() but the set of valid
- * internal formats is somewhat different.
- *
- * \return one of GL_RGB, GL_RGBA, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT
- *  GL_DEPTH_STENCIL_EXT or zero if error.
- *
- * XXX in the future when we support red-only and red-green formats
- * we'll also return GL_RED and GL_RG.
  */
 GLenum
 _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
 {
+   GLenum baseFormat;
+
    switch (internalFormat) {
-   case GL_ALPHA:
-   case GL_ALPHA4:
-   case GL_ALPHA8:
-   case GL_ALPHA12:
-   case GL_ALPHA16:
-      return GL_ALPHA;
-   case GL_RGB:
-   case GL_R3_G3_B2:
-   case GL_RGB4:
-   case GL_RGB5:
-   case GL_RGB8:
-   case GL_RGB10:
-   case GL_RGB12:
-   case GL_RGB16:
-      return GL_RGB;
-   case GL_RGBA:
-   case GL_RGBA2:
-   case GL_RGBA4:
-   case GL_RGB5_A1:
-   case GL_RGBA8:
-   case GL_RGB10_A2:
-   case GL_RGBA12:
-   case GL_RGBA16:
    case GL_RGBA16_SNORM:
+      /* This is used internally by Mesa for accum buffers. */
       return GL_RGBA;
    case GL_STENCIL_INDEX:
    case GL_STENCIL_INDEX1_EXT:
    case GL_STENCIL_INDEX4_EXT:
    case GL_STENCIL_INDEX8_EXT:
    case GL_STENCIL_INDEX16_EXT:
+      /* This is not a valid texture internalFormat, but valid for
+       * renderbuffers.
+       */
       return GL_STENCIL_INDEX;
    case GL_DEPTH_COMPONENT:
    case GL_DEPTH_COMPONENT16:
    case GL_DEPTH_COMPONENT24:
    case GL_DEPTH_COMPONENT32:
+      /* This is an override of _mesa_base_tex_format's check that
+       * ARB_depth_texture is present.  We allow depth RBs without it.
+       */
       return GL_DEPTH_COMPONENT;
-   case GL_DEPTH_STENCIL_EXT:
-   case GL_DEPTH24_STENCIL8_EXT:
-      if (ctx->Extensions.EXT_packed_depth_stencil)
-         return GL_DEPTH_STENCIL_EXT;
-      else
-         return 0;
-   /* XXX add floating point formats eventually */
-   default:
-      return 0;
    }
+
+   baseFormat = _mesa_base_tex_format(ctx, internalFormat);
+   if (baseFormat < 0)
+      return 0;
+
+   return baseFormat;
 }
 
 
@@ -1055,6 +1031,14 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
       return;
    }
 
+   if (baseFormat != GL_DEPTH_COMPONENT &&
+       baseFormat != GL_STENCIL_INDEX &&
+       baseFormat != GL_DEPTH_STENCIL &&
+       !_mesa_is_legal_color_format(ctx, baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat)", func);
+      return;
+   }
+
    if (width < 1 || width > (GLsizei) ctx->Const.MaxRenderbufferSize) {
       _mesa_error(ctx, GL_INVALID_VALUE, "%s(width)", func);
       return;
@@ -1172,8 +1156,17 @@ get_component_bits(GLenum pname, GLenum baseFormat, gl_format format)
    switch (pname) {
    case GL_RENDERBUFFER_RED_SIZE_EXT:
    case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+      if (baseFormat == GL_RGB || baseFormat == GL_RGBA ||
+         baseFormat == GL_RG || baseFormat == GL_RED)
+         return _mesa_get_format_bits(format, pname);
+      else
+         return 0;
    case GL_RENDERBUFFER_GREEN_SIZE_EXT:
    case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+      if (baseFormat == GL_RGB || baseFormat == GL_RGBA || baseFormat == GL_RG)
+         return _mesa_get_format_bits(format, pname);
+      else
+         return 0;
    case GL_RENDERBUFFER_BLUE_SIZE_EXT:
    case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
       if (baseFormat == GL_RGB || baseFormat == GL_RGBA)
@@ -1182,7 +1175,8 @@ get_component_bits(GLenum pname, GLenum baseFormat, gl_format format)
          return 0;
    case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
    case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
-      if (baseFormat == GL_RGBA || baseFormat == GL_ALPHA)
+      if (baseFormat == GL_RGBA || baseFormat == GL_ALPHA ||
+         baseFormat == GL_LUMINANCE_ALPHA)
          return _mesa_get_format_bits(format, pname);
       else
          return 0;
@@ -1913,6 +1907,13 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
                      " renderbuffer %u)", renderbuffer);
         return;
       }
+      else if (rb == &DummyRenderbuffer) {
+         /* This is what NVIDIA does */
+        _mesa_error(ctx, GL_INVALID_VALUE,
+                    "glFramebufferRenderbufferEXT(renderbuffer %u)",
+                     renderbuffer);
+        return;
+      }
    }
    else {
       /* remove renderbuffer attachment */
@@ -1940,7 +1941,7 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
    /* Some subsequent GL commands may depend on the framebuffer's visual
     * after the binding is updated.  Update visual info now.
     */
-   _mesa_update_framebuffer_visual(fb);
+   _mesa_update_framebuffer_visual(ctx, fb);
 }
 
 
@@ -2014,7 +2015,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
 
    switch (pname) {
    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
-      *params = att->Type;
+      *params = buffer->Name == 0 ? GL_FRAMEBUFFER_DEFAULT : att->Type;
       return;
    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:
       if (att->Type == GL_RENDERBUFFER_EXT) {
@@ -2024,8 +2025,8 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
         *params = att->Texture->Name;
       }
       else {
-        _mesa_error(ctx, GL_INVALID_ENUM,
-                    "glGetFramebufferAttachmentParameterivEXT(pname)");
+         assert(att->Type == GL_NONE);
+         *params = 0;
       }
       return;
    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT:
@@ -2146,6 +2147,7 @@ _mesa_GenerateMipmapEXT(GLenum target)
       /* OK, legal value */
       break;
    default:
+      /* XXX need to implement GL_TEXTURE_1D_ARRAY and GL_TEXTURE_2D_ARRAY */
       _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target)");
       return;
    }
@@ -2157,6 +2159,13 @@ _mesa_GenerateMipmapEXT(GLenum target)
       return;
    }
 
+   if (texObj->Target == GL_TEXTURE_CUBE_MAP &&
+       !_mesa_cube_complete(texObj)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glGenerateMipmap(incomplete cube map)");
+      return;
+   }
+
    _mesa_lock_texture(ctx, texObj);
    if (target == GL_TEXTURE_CUBE_MAP) {
       GLuint face;
index 2aace2ebd4bf02d85503d29efd042e5b6f29a0de..8763f99c4a7312b3cef5b2db97aaf35f8e18a3ff 100644 (file)
@@ -71,6 +71,9 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb
 extern void
 _mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb);
 
+extern GLboolean
+_mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
+
 extern GLenum
 _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
 
index ffdecaecc29e0a92640980b49b61c2c0a6847cf5..fcb089f1f31eae7049159f7d2457715ec9fd57e9 100644 (file)
@@ -35,6 +35,7 @@
 #include "enums.h"
 #include "feedback.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "main/dispatch.h"
 
index f9fbbce70b9f333cf1ec7c209b1489e01a306fe8..0039a0b4cb00fd389ebf18f881a515cb2daceb31 100644 (file)
@@ -27,6 +27,7 @@
 #define FEEDBACK_H
 
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 
 
index 0f2c313c819fbe2ddc0eb853dc330bd54ce72c7d..b8e49a3757f2e0815179d371bbe08fadb8b0efb9 100644 (file)
@@ -36,6 +36,7 @@
 #include "main/glheader.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/enums.h"
 #include "main/ffvertex_prog.h"
 #include "program/program.h"
index 88a04e888e407a6a1628babecb0a99db407befaf..1bc72726e132955fd4b02db18c437e17e4f8e7f6 100644 (file)
@@ -40,9 +40,10 @@ struct gl_format_info
    const char *StrName;
 
    /**
-    * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE,
-    * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX,
-    * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
+    * Base format is one of GL_RED, GL_RG, GL_RGB, GL_RGBA, GL_ALPHA,
+    * GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA,
+    * GL_COLOR_INDEX, GL_DEPTH_COMPONENT, GL_STENCIL_INDEX,
+    * GL_DEPTH_STENCIL, GL_DUDV_ATI.
     */
    GLenum BaseFormat;
 
@@ -221,6 +222,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
       1, 1, 2                      /* BlockWidth/Height,Bytes */
    },
+   {
+      MESA_FORMAT_AL44,            /* Name */
+      "MESA_FORMAT_AL44",          /* StrName */
+      GL_LUMINANCE_ALPHA,          /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 4,                  /* Red/Green/Blue/AlphaBits */
+      4, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 1                      /* BlockWidth/Height,Bytes */
+   },
    {
       MESA_FORMAT_AL88,            /* Name */
       "MESA_FORMAT_AL88",          /* StrName */
@@ -275,6 +285,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
       1, 1, 1                      /* BlockWidth/Height,Bytes */
    },
+   {
+      MESA_FORMAT_A16,             /* Name */
+      "MESA_FORMAT_A16",           /* StrName */
+      GL_ALPHA,                    /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 16,                 /* Red/Green/Blue/AlphaBits */
+      0, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
    {
       MESA_FORMAT_L8,              /* Name */
       "MESA_FORMAT_L8",            /* StrName */
@@ -284,6 +303,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       8, 0, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
       1, 1, 1                      /* BlockWidth/Height,Bytes */
    },
+   {
+      MESA_FORMAT_L16,             /* Name */
+      "MESA_FORMAT_L16",           /* StrName */
+      GL_LUMINANCE,                /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      16, 0, 0, 0, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
    {
       MESA_FORMAT_I8,              /* Name */
       "MESA_FORMAT_I8",            /* StrName */
@@ -293,6 +321,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       0, 8, 0, 0, 0,               /* Lum/Int/Index/Depth/StencilBits */
       1, 1, 1                      /* BlockWidth/Height,Bytes */
    },
+   {
+      MESA_FORMAT_I16,             /* Name */
+      "MESA_FORMAT_I16",           /* StrName */
+      GL_INTENSITY,                /* BaseFormat */
+      GL_UNSIGNED_NORMALIZED,      /* DataType */
+      0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
+      0, 16, 0, 0, 0,              /* Lum/Int/Index/Depth/StencilBits */
+      1, 1, 2                      /* BlockWidth/Height,Bytes */
+   },
    {
       MESA_FORMAT_CI8,             /* Name */
       "MESA_FORMAT_CI8",           /* StrName */
@@ -374,6 +411,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
       0, 0, 0, 0, 0,
       1, 1, 4
    },
+   {
+      MESA_FORMAT_ARGB2101010,
+      "MESA_FORMAT_ARGB2101010",
+      GL_RGBA,
+      GL_UNSIGNED_NORMALIZED,
+      10, 10, 10, 2,
+      0, 0, 0, 0, 0,
+      1, 1, 4
+   },
    {
       MESA_FORMAT_Z24_S8,          /* Name */
       "MESA_FORMAT_Z24_S8",        /* StrName */
@@ -756,7 +802,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_R8,        /* Name */
       "MESA_FORMAT_SIGNED_R8",      /* StrName */
-      GL_RGBA,                      /* BaseFormat */
+      GL_RED,                       /* BaseFormat */
       GL_SIGNED_NORMALIZED,         /* DataType */
       8, 0, 0, 0,                   /* Red/Green/Blue/AlphaBits */
       0, 0, 0, 0, 0,                /* Lum/Int/Index/Depth/StencilBits */
@@ -765,7 +811,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RG88,
       "MESA_FORMAT_SIGNED_RG88",
-      GL_RGBA,
+      GL_RG,
       GL_SIGNED_NORMALIZED,
       8, 8, 0, 0,
       0, 0, 0, 0, 0,
@@ -774,7 +820,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RGBX8888,
       "MESA_FORMAT_SIGNED_RGBX8888",
-      GL_RGBA,
+      GL_RGB,
       GL_SIGNED_NORMALIZED,
       8, 8, 8, 0,
       0, 0, 0, 0, 0,
@@ -803,7 +849,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_R_16,
       "MESA_FORMAT_SIGNED_R_16",
-      GL_RGBA,
+      GL_RED,
       GL_SIGNED_NORMALIZED,
       16, 0, 0, 0,
       0, 0, 0, 0, 0,
@@ -812,7 +858,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RG_16,
       "MESA_FORMAT_SIGNED_RG_16",
-      GL_RGBA,
+      GL_RG,
       GL_SIGNED_NORMALIZED,
       16, 16, 0, 0,
       0, 0, 0, 0, 0,
@@ -821,7 +867,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
    {
       MESA_FORMAT_SIGNED_RGB_16,
       "MESA_FORMAT_SIGNED_RGB_16",
-      GL_RGBA,
+      GL_RGB,
       GL_SIGNED_NORMALIZED,
       16, 16, 16, 0,
       0, 0, 0, 0, 0,
@@ -863,7 +909,6 @@ const char *
 _mesa_get_format_name(gl_format format)
 {
    const struct gl_format_info *info = _mesa_get_format_info(format);
-   ASSERT(info->BytesPerBlock);
    return info->StrName;
 }
 
@@ -1057,11 +1102,12 @@ _mesa_format_image_size(gl_format format, GLsizei width,
    const struct gl_format_info *info = _mesa_get_format_info(format);
    /* Strictly speaking, a conditional isn't needed here */
    if (info->BlockWidth > 1 || info->BlockHeight > 1) {
-      /* compressed format */
+      /* compressed format (2D only for now) */
       const GLuint bw = info->BlockWidth, bh = info->BlockHeight;
       const GLuint wblocks = (width + bw - 1) / bw;
       const GLuint hblocks = (height + bh - 1) / bh;
       const GLuint sz = wblocks * hblocks * info->BytesPerBlock;
+      assert(depth == 1);
       return sz;
    }
    else {
@@ -1072,6 +1118,36 @@ _mesa_format_image_size(gl_format format, GLsizei width,
 }
 
 
+/**
+ * Same as _mesa_format_image_size() but returns a 64-bit value to
+ * accomodate very large textures.
+ */
+uint64_t
+_mesa_format_image_size64(gl_format format, GLsizei width,
+                          GLsizei height, GLsizei depth)
+{
+   const struct gl_format_info *info = _mesa_get_format_info(format);
+   /* Strictly speaking, a conditional isn't needed here */
+   if (info->BlockWidth > 1 || info->BlockHeight > 1) {
+      /* compressed format (2D only for now) */
+      const uint64_t bw = info->BlockWidth, bh = info->BlockHeight;
+      const uint64_t wblocks = (width + bw - 1) / bw;
+      const uint64_t hblocks = (height + bh - 1) / bh;
+      const uint64_t sz = wblocks * hblocks * info->BytesPerBlock;
+      assert(depth == 1);
+      return sz;
+   }
+   else {
+      /* non-compressed */
+      const uint64_t sz = ((uint64_t) width *
+                           (uint64_t) height *
+                           (uint64_t) depth *
+                           info->BytesPerBlock);
+      return sz;
+   }
+}
+
+
 
 GLint
 _mesa_format_row_stride(gl_format format, GLsizei width)
@@ -1092,6 +1168,27 @@ _mesa_format_row_stride(gl_format format, GLsizei width)
 }
 
 
+/**
+ * Debug/test: check that all formats are handled in the
+ * _mesa_format_to_type_and_comps() function.  When new pixel formats
+ * are added to Mesa, that function needs to be updated.
+ * This is a no-op after the first call.
+ */
+static void
+check_format_to_type_and_comps(void)
+{
+   gl_format f;
+
+   for (f = MESA_FORMAT_NONE + 1; f < MESA_FORMAT_COUNT; f++) {
+      GLenum datatype = 0;
+      GLuint comps = 0;
+      /* This function will emit a problem/warning if the format is
+       * not handled.
+       */
+      _mesa_format_to_type_and_comps(f, &datatype, &comps);
+   }
+}
+
 
 /**
  * Do sanity checking of the format info table.
@@ -1116,7 +1213,7 @@ _mesa_test_formats(void)
          if (info->RedBits > 0) {
             GLuint t = info->RedBits + info->GreenBits
                + info->BlueBits + info->AlphaBits;
-            assert(t / 8 == info->BytesPerBlock);
+            assert(t / 8 <= info->BytesPerBlock);
             (void) t;
          }
       }
@@ -1124,6 +1221,7 @@ _mesa_test_formats(void)
       assert(info->DataType == GL_UNSIGNED_NORMALIZED ||
              info->DataType == GL_SIGNED_NORMALIZED ||
              info->DataType == GL_UNSIGNED_INT ||
+             info->DataType == GL_INT ||
              info->DataType == GL_FLOAT);
 
       if (info->BaseFormat == GL_RGB) {
@@ -1174,8 +1272,9 @@ _mesa_test_formats(void)
          assert(info->LuminanceBits == 0);
          assert(info->IntensityBits > 0);
       }
-
    }
+
+   check_format_to_type_and_comps();
 }
 
 
@@ -1221,11 +1320,17 @@ _mesa_format_to_type_and_comps(gl_format format,
       *comps = 4;
       return;
 
+   case MESA_FORMAT_ARGB2101010:
+      *datatype = GL_UNSIGNED_INT_2_10_10_10_REV;
+      *comps = 4;
+      return;
+
    case MESA_FORMAT_RGBA5551:
       *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
       *comps = 4;
       return;
 
+   case MESA_FORMAT_AL44: /* XXX this isn't plain GL_UNSIGNED_BYTE */
    case MESA_FORMAT_AL88:
    case MESA_FORMAT_AL88_REV:
    case MESA_FORMAT_RG88:
@@ -1243,6 +1348,9 @@ _mesa_format_to_type_and_comps(gl_format format,
       return;
 
    case MESA_FORMAT_R16:
+   case MESA_FORMAT_A16:
+   case MESA_FORMAT_L16:
+   case MESA_FORMAT_I16:
       *datatype = GL_UNSIGNED_SHORT;
       *comps = 1;
       return;
@@ -1447,10 +1555,13 @@ _mesa_format_to_type_and_comps(gl_format format,
       *comps = 4;
       return;
 
-   case MESA_FORMAT_NONE:
    case MESA_FORMAT_COUNT:
+      assert(0);
+      return;
+
+   case MESA_FORMAT_NONE:
    /* For debug builds, warn if any formats are not handled */
-#ifndef DEBUG
+#ifdef DEBUG
    default:
 #endif
       _mesa_problem(NULL, "bad format %s in _mesa_format_to_type_and_comps",
index eeb460dabe70fbc8fa4c172fdb26d744f215396a..b8e76664f85f9db90001cf00f65027dc8c76efb1 100644 (file)
@@ -65,14 +65,18 @@ typedef enum
    MESA_FORMAT_RGBA5551,        /*                     RRRR RGGG GGBB BBBA */
    MESA_FORMAT_ARGB1555,       /*                     ARRR RRGG GGGB BBBB */
    MESA_FORMAT_ARGB1555_REV,   /*                     GGGB BBBB ARRR RRGG */
+   MESA_FORMAT_AL44,           /*                               AAAA LLLL */
    MESA_FORMAT_AL88,           /*                     AAAA AAAA LLLL LLLL */
    MESA_FORMAT_AL88_REV,       /*                     LLLL LLLL AAAA AAAA */
    MESA_FORMAT_AL1616,          /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
    MESA_FORMAT_AL1616_REV,      /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
    MESA_FORMAT_RGB332,         /*                               RRRG GGBB */
    MESA_FORMAT_A8,             /*                               AAAA AAAA */
+   MESA_FORMAT_A16,             /*                     AAAA AAAA AAAA AAAA */
    MESA_FORMAT_L8,             /*                               LLLL LLLL */
+   MESA_FORMAT_L16,             /*                     LLLL LLLL LLLL LLLL */
    MESA_FORMAT_I8,             /*                               IIII IIII */
+   MESA_FORMAT_I16,             /*                     IIII IIII IIII IIII */
    MESA_FORMAT_CI8,            /*                               CCCC CCCC */
    MESA_FORMAT_YCBCR,          /*                     YYYY YYYY UorV UorV */
    MESA_FORMAT_YCBCR_REV,      /*                     UorV UorV YYYY YYYY */
@@ -82,6 +86,7 @@ typedef enum
    MESA_FORMAT_R16,            /*                     RRRR RRRR RRRR RRRR */
    MESA_FORMAT_RG1616,         /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
    MESA_FORMAT_RG1616_REV,     /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
+   MESA_FORMAT_ARGB2101010,     /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
    MESA_FORMAT_Z24_S8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
    MESA_FORMAT_S8_Z24,          /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
    MESA_FORMAT_Z16,             /*                     ZZZZ ZZZZ ZZZZ ZZZZ */
@@ -209,6 +214,10 @@ extern GLuint
 _mesa_format_image_size(gl_format format, GLsizei width,
                         GLsizei height, GLsizei depth);
 
+extern uint64_t
+_mesa_format_image_size64(gl_format format, GLsizei width,
+                          GLsizei height, GLsizei depth);
+
 extern GLint
 _mesa_format_row_stride(gl_format format, GLsizei width);
 
index 5530c51c892fd9408182727dce61ad236a0fd08d..63da71c95b4bd9609173f099e432bed07431da2c 100644 (file)
@@ -522,7 +522,8 @@ _mesa_update_draw_buffer_bounds(struct gl_context *ctx)
  * integer Z values.
  */
 void
-_mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
+_mesa_update_framebuffer_visual(struct gl_context *ctx,
+                               struct gl_framebuffer *fb)
 {
    GLuint i;
 
@@ -542,9 +543,8 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
          const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
          const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
          const gl_format fmt = rb->Format;
-         
-         if (baseFormat == GL_RGBA || baseFormat == GL_RGB ||
-            baseFormat == GL_ALPHA) {
+
+         if (_mesa_is_legal_color_format(ctx, baseFormat)) {
             fb->Visual.redBits = _mesa_get_format_bits(fmt, GL_RED_BITS);
             fb->Visual.greenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS);
             fb->Visual.blueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS);
index 20e3ff56b558f2988ddc2b051144150d2334c5ba..c3bd638c9dee7af26e13012ff78aad6c0ffa353a 100644 (file)
@@ -70,7 +70,8 @@ extern void
 _mesa_update_draw_buffer_bounds(struct gl_context *ctx);
 
 extern void
-_mesa_update_framebuffer_visual(struct gl_framebuffer *fb);
+_mesa_update_framebuffer_visual(struct gl_context *ctx,
+                               struct gl_framebuffer *fb);
 
 extern void
 _mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
index b54af6ee86bce5f7022a3639aeb8355e43d21628..ba273cef46130f4cd2713401018746f5ac96117c 100644 (file)
@@ -29,6 +29,7 @@
 #include "extensions.h"
 #include "get.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "state.h"
 #include "texcompress.h"
@@ -272,6 +273,7 @@ static const int extra_EXT_gpu_shader4[] = {
 };
 
 
+EXTRA_EXT(ARB_ES2_compatibility);
 EXTRA_EXT(ARB_multitexture);
 EXTRA_EXT(ARB_texture_cube_map);
 EXTRA_EXT(MESA_texture_array);
@@ -314,6 +316,7 @@ EXTRA_EXT2(ARB_vertex_program, NV_vertex_program);
 EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program);
 EXTRA_EXT(ARB_vertex_buffer_object);
 EXTRA_EXT(ARB_geometry_shader4);
+EXTRA_EXT(ARB_copy_buffer);
 
 static const int
 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
@@ -469,6 +472,10 @@ static const struct value_desc values[] = {
    { GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0,
      extra_ARB_vertex_buffer_object },
 
+   /* GL_ARB_copy_buffer */
+   { GL_COPY_READ_BUFFER, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer },
+   { GL_COPY_WRITE_BUFFER, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer },
+
    /* GL_OES_read_format */
    { GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, LOC_CUSTOM, TYPE_INT, 0,
      extra_new_buffers_OES_read_format },
@@ -581,6 +588,15 @@ static const struct value_desc values[] = {
    { GL_TEXTURE_COORD_ARRAY_STRIDE,
      LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Stride), NO_EXTRA },
 
+   /* GL_ARB_ES2_compatibility */
+   { GL_SHADER_COMPILER, CONST(1), extra_ARB_ES2_compatibility },
+   { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying),
+     extra_ARB_ES2_compatibility },
+   { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0,
+     extra_ARB_ES2_compatibility },
+   { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0,
+     extra_ARB_ES2_compatibility },
+
    /* GL_ARB_multitexture */
    { GL_MAX_TEXTURE_UNITS_ARB,
      CONTEXT_INT(Const.MaxTextureUnits), extra_ARB_multitexture },
@@ -700,12 +716,9 @@ static const struct value_desc values[] = {
 #if FEATURE_ES2
    /* Enums unique to OpenGL ES 2.0 */
    { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA },
-   { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
-     offsetof(struct gl_context, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA },
-   { GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT,
-     offsetof(struct gl_context, Const.MaxVarying), NO_EXTRA },
-   { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
-     offsetof(struct gl_context, Const.VertexProgram.MaxUniformComponents), NO_EXTRA },
+   { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
+   { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying), NO_EXTRA },
+   { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
    { GL_SHADER_COMPILER, CONST(1), NO_EXTRA },
    /* OES_get_program_binary */
    { GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
@@ -1112,6 +1125,14 @@ static const struct value_desc values[] = {
      extra_valid_draw_buffer },
    { GL_DRAW_BUFFER3_ARB, BUFFER_ENUM(ColorDrawBuffer[3]),
      extra_valid_draw_buffer },
+   { GL_DRAW_BUFFER4_ARB, BUFFER_ENUM(ColorDrawBuffer[4]),
+     extra_valid_draw_buffer },
+   { GL_DRAW_BUFFER5_ARB, BUFFER_ENUM(ColorDrawBuffer[5]),
+     extra_valid_draw_buffer },
+   { GL_DRAW_BUFFER6_ARB, BUFFER_ENUM(ColorDrawBuffer[6]),
+     extra_valid_draw_buffer },
+   { GL_DRAW_BUFFER7_ARB, BUFFER_ENUM(ColorDrawBuffer[7]),
+     extra_valid_draw_buffer },
 
    /* GL_ATI_fragment_shader */
    { GL_NUM_FRAGMENT_REGISTERS_ATI, CONST(6), extra_ATI_fragment_shader },
@@ -1564,6 +1585,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
       v->value_int = ctx->Array.ElementArrayBufferObj->Name;
       break;
 
+   /* ARB_copy_buffer */
+   case GL_COPY_READ_BUFFER:
+      v->value_int = ctx->CopyReadBuffer->Name;
+      break;
+   case GL_COPY_WRITE_BUFFER:
+      v->value_int = ctx->CopyWriteBuffer->Name;
+      break;
+
    case GL_FRAGMENT_PROGRAM_BINDING_NV:
       v->value_int = 
         ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0;
@@ -1604,6 +1633,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
    case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
       v->value_int = ctx->Array.ArrayObj->PointSize.BufferObj->Name;
       break;
+
+   case GL_MAX_VERTEX_UNIFORM_VECTORS:
+      v->value_int = ctx->Const.VertexProgram.MaxUniformComponents / 4;
+      break;
+
+   case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+      v->value_int = ctx->Const.FragmentProgram.MaxUniformComponents / 4;
+      break;
    }   
 }
 
@@ -1733,16 +1770,18 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
    hash = (pname * prime_factor);
    while (1) {
       d = &values[table[hash & mask]];
-      if (likely(d->pname == pname))
-        break;
 
       /* If the enum isn't valid, the hash walk ends with index 0,
        * which is the API mask entry at the beginning of values[]. */
-      if (d->type == TYPE_API_MASK) {
+      if (unlikely(d->type == TYPE_API_MASK)) {
         _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
                      _mesa_lookup_enum_by_nr(pname));
         return &error_value;
       }
+
+      if (likely(d->pname == pname))
+        break;
+
       hash += prime_step;
    }
 
@@ -2282,8 +2321,10 @@ void GLAPIENTRY
 _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
 {
    union value v;
+   enum value_type type =
+      find_value_indexed("glGetBooleanIndexedv", pname, index, &v);
 
-   switch (find_value_indexed("glGetBooleanIndexedv", pname, index, &v)) {
+   switch (type) {
    case TYPE_INT:
       params[0] = INT_TO_BOOLEAN(v.value_int);
       break;
@@ -2297,7 +2338,7 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
       params[0] = INT64_TO_BOOLEAN(v.value_int);
       break;
    default:
-      assert(0);
+      ; /* nothing - GL error was recorded */
    }
 }
 
@@ -2305,8 +2346,10 @@ void GLAPIENTRY
 _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
 {
    union value v;
+   enum value_type type =
+      find_value_indexed("glGetIntegerIndexedv", pname, index, &v);
 
-   switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) {
+   switch (type) {
    case TYPE_INT:
       params[0] = v.value_int;
       break;
@@ -2320,7 +2363,7 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
       params[0] = INT64_TO_INT(v.value_int);
       break;
    default:
-      assert(0);
+      ; /* nothing - GL error was recorded */
    }
 }
 
@@ -2329,8 +2372,10 @@ void GLAPIENTRY
 _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
 {
    union value v;
+   enum value_type type =
+      find_value_indexed("glGetIntegerIndexedv", pname, index, &v);      
 
-   switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) {
+   switch (type) {
    case TYPE_INT:
       params[0] = v.value_int;
       break;
@@ -2344,7 +2389,7 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
       params[0] = v.value_int;
       break;
    default:
-      assert(0);
+      ; /* nothing - GL error was recorded */
    }
 }
 #endif /* FEATURE_ARB_sync */
index bfa283f6a30354a9357dbe8e072b5eaf6deeefce..f8866f685811f29837d3601febc3a25f0441e880 100644 (file)
@@ -29,6 +29,8 @@
 #include "get.h"
 #include "enums.h"
 #include "extensions.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 
 
 /**
index 87784269c5cdf0e5a3fca2d5eb090fbd0ff79f56..29823d06fe4103a3dd2e67a14baf87e1a054e113 100644 (file)
@@ -59,7 +59,7 @@
     } while(0)
 
 /* total number of offsets below */
-#define _gloffset_COUNT 881
+#define _gloffset_COUNT 886
 
 #define _gloffset_NewList 0
 #define _gloffset_EndList 1
 #define _gloffset_IsTransformFeedback 597
 #define _gloffset_PauseTransformFeedback 598
 #define _gloffset_ResumeTransformFeedback 599
-#define _gloffset_PolygonOffsetEXT 600
-#define _gloffset_GetPixelTexGenParameterfvSGIS 601
-#define _gloffset_GetPixelTexGenParameterivSGIS 602
-#define _gloffset_PixelTexGenParameterfSGIS 603
-#define _gloffset_PixelTexGenParameterfvSGIS 604
-#define _gloffset_PixelTexGenParameteriSGIS 605
-#define _gloffset_PixelTexGenParameterivSGIS 606
-#define _gloffset_SampleMaskSGIS 607
-#define _gloffset_SamplePatternSGIS 608
-#define _gloffset_ColorPointerEXT 609
-#define _gloffset_EdgeFlagPointerEXT 610
-#define _gloffset_IndexPointerEXT 611
-#define _gloffset_NormalPointerEXT 612
-#define _gloffset_TexCoordPointerEXT 613
-#define _gloffset_VertexPointerEXT 614
-#define _gloffset_PointParameterfEXT 615
-#define _gloffset_PointParameterfvEXT 616
-#define _gloffset_LockArraysEXT 617
-#define _gloffset_UnlockArraysEXT 618
-#define _gloffset_SecondaryColor3bEXT 619
-#define _gloffset_SecondaryColor3bvEXT 620
-#define _gloffset_SecondaryColor3dEXT 621
-#define _gloffset_SecondaryColor3dvEXT 622
-#define _gloffset_SecondaryColor3fEXT 623
-#define _gloffset_SecondaryColor3fvEXT 624
-#define _gloffset_SecondaryColor3iEXT 625
-#define _gloffset_SecondaryColor3ivEXT 626
-#define _gloffset_SecondaryColor3sEXT 627
-#define _gloffset_SecondaryColor3svEXT 628
-#define _gloffset_SecondaryColor3ubEXT 629
-#define _gloffset_SecondaryColor3ubvEXT 630
-#define _gloffset_SecondaryColor3uiEXT 631
-#define _gloffset_SecondaryColor3uivEXT 632
-#define _gloffset_SecondaryColor3usEXT 633
-#define _gloffset_SecondaryColor3usvEXT 634
-#define _gloffset_SecondaryColorPointerEXT 635
-#define _gloffset_MultiDrawArraysEXT 636
-#define _gloffset_MultiDrawElementsEXT 637
-#define _gloffset_FogCoordPointerEXT 638
-#define _gloffset_FogCoorddEXT 639
-#define _gloffset_FogCoorddvEXT 640
-#define _gloffset_FogCoordfEXT 641
-#define _gloffset_FogCoordfvEXT 642
-#define _gloffset_PixelTexGenSGIX 643
-#define _gloffset_BlendFuncSeparateEXT 644
-#define _gloffset_FlushVertexArrayRangeNV 645
-#define _gloffset_VertexArrayRangeNV 646
-#define _gloffset_CombinerInputNV 647
-#define _gloffset_CombinerOutputNV 648
-#define _gloffset_CombinerParameterfNV 649
-#define _gloffset_CombinerParameterfvNV 650
-#define _gloffset_CombinerParameteriNV 651
-#define _gloffset_CombinerParameterivNV 652
-#define _gloffset_FinalCombinerInputNV 653
-#define _gloffset_GetCombinerInputParameterfvNV 654
-#define _gloffset_GetCombinerInputParameterivNV 655
-#define _gloffset_GetCombinerOutputParameterfvNV 656
-#define _gloffset_GetCombinerOutputParameterivNV 657
-#define _gloffset_GetFinalCombinerInputParameterfvNV 658
-#define _gloffset_GetFinalCombinerInputParameterivNV 659
-#define _gloffset_ResizeBuffersMESA 660
-#define _gloffset_WindowPos2dMESA 661
-#define _gloffset_WindowPos2dvMESA 662
-#define _gloffset_WindowPos2fMESA 663
-#define _gloffset_WindowPos2fvMESA 664
-#define _gloffset_WindowPos2iMESA 665
-#define _gloffset_WindowPos2ivMESA 666
-#define _gloffset_WindowPos2sMESA 667
-#define _gloffset_WindowPos2svMESA 668
-#define _gloffset_WindowPos3dMESA 669
-#define _gloffset_WindowPos3dvMESA 670
-#define _gloffset_WindowPos3fMESA 671
-#define _gloffset_WindowPos3fvMESA 672
-#define _gloffset_WindowPos3iMESA 673
-#define _gloffset_WindowPos3ivMESA 674
-#define _gloffset_WindowPos3sMESA 675
-#define _gloffset_WindowPos3svMESA 676
-#define _gloffset_WindowPos4dMESA 677
-#define _gloffset_WindowPos4dvMESA 678
-#define _gloffset_WindowPos4fMESA 679
-#define _gloffset_WindowPos4fvMESA 680
-#define _gloffset_WindowPos4iMESA 681
-#define _gloffset_WindowPos4ivMESA 682
-#define _gloffset_WindowPos4sMESA 683
-#define _gloffset_WindowPos4svMESA 684
-#define _gloffset_MultiModeDrawArraysIBM 685
-#define _gloffset_MultiModeDrawElementsIBM 686
-#define _gloffset_DeleteFencesNV 687
-#define _gloffset_FinishFenceNV 688
-#define _gloffset_GenFencesNV 689
-#define _gloffset_GetFenceivNV 690
-#define _gloffset_IsFenceNV 691
-#define _gloffset_SetFenceNV 692
-#define _gloffset_TestFenceNV 693
-#define _gloffset_AreProgramsResidentNV 694
-#define _gloffset_BindProgramNV 695
-#define _gloffset_DeleteProgramsNV 696
-#define _gloffset_ExecuteProgramNV 697
-#define _gloffset_GenProgramsNV 698
-#define _gloffset_GetProgramParameterdvNV 699
-#define _gloffset_GetProgramParameterfvNV 700
-#define _gloffset_GetProgramStringNV 701
-#define _gloffset_GetProgramivNV 702
-#define _gloffset_GetTrackMatrixivNV 703
-#define _gloffset_GetVertexAttribPointervNV 704
-#define _gloffset_GetVertexAttribdvNV 705
-#define _gloffset_GetVertexAttribfvNV 706
-#define _gloffset_GetVertexAttribivNV 707
-#define _gloffset_IsProgramNV 708
-#define _gloffset_LoadProgramNV 709
-#define _gloffset_ProgramParameters4dvNV 710
-#define _gloffset_ProgramParameters4fvNV 711
-#define _gloffset_RequestResidentProgramsNV 712
-#define _gloffset_TrackMatrixNV 713
-#define _gloffset_VertexAttrib1dNV 714
-#define _gloffset_VertexAttrib1dvNV 715
-#define _gloffset_VertexAttrib1fNV 716
-#define _gloffset_VertexAttrib1fvNV 717
-#define _gloffset_VertexAttrib1sNV 718
-#define _gloffset_VertexAttrib1svNV 719
-#define _gloffset_VertexAttrib2dNV 720
-#define _gloffset_VertexAttrib2dvNV 721
-#define _gloffset_VertexAttrib2fNV 722
-#define _gloffset_VertexAttrib2fvNV 723
-#define _gloffset_VertexAttrib2sNV 724
-#define _gloffset_VertexAttrib2svNV 725
-#define _gloffset_VertexAttrib3dNV 726
-#define _gloffset_VertexAttrib3dvNV 727
-#define _gloffset_VertexAttrib3fNV 728
-#define _gloffset_VertexAttrib3fvNV 729
-#define _gloffset_VertexAttrib3sNV 730
-#define _gloffset_VertexAttrib3svNV 731
-#define _gloffset_VertexAttrib4dNV 732
-#define _gloffset_VertexAttrib4dvNV 733
-#define _gloffset_VertexAttrib4fNV 734
-#define _gloffset_VertexAttrib4fvNV 735
-#define _gloffset_VertexAttrib4sNV 736
-#define _gloffset_VertexAttrib4svNV 737
-#define _gloffset_VertexAttrib4ubNV 738
-#define _gloffset_VertexAttrib4ubvNV 739
-#define _gloffset_VertexAttribPointerNV 740
-#define _gloffset_VertexAttribs1dvNV 741
-#define _gloffset_VertexAttribs1fvNV 742
-#define _gloffset_VertexAttribs1svNV 743
-#define _gloffset_VertexAttribs2dvNV 744
-#define _gloffset_VertexAttribs2fvNV 745
-#define _gloffset_VertexAttribs2svNV 746
-#define _gloffset_VertexAttribs3dvNV 747
-#define _gloffset_VertexAttribs3fvNV 748
-#define _gloffset_VertexAttribs3svNV 749
-#define _gloffset_VertexAttribs4dvNV 750
-#define _gloffset_VertexAttribs4fvNV 751
-#define _gloffset_VertexAttribs4svNV 752
-#define _gloffset_VertexAttribs4ubvNV 753
-#define _gloffset_GetTexBumpParameterfvATI 754
-#define _gloffset_GetTexBumpParameterivATI 755
-#define _gloffset_TexBumpParameterfvATI 756
-#define _gloffset_TexBumpParameterivATI 757
-#define _gloffset_AlphaFragmentOp1ATI 758
-#define _gloffset_AlphaFragmentOp2ATI 759
-#define _gloffset_AlphaFragmentOp3ATI 760
-#define _gloffset_BeginFragmentShaderATI 761
-#define _gloffset_BindFragmentShaderATI 762
-#define _gloffset_ColorFragmentOp1ATI 763
-#define _gloffset_ColorFragmentOp2ATI 764
-#define _gloffset_ColorFragmentOp3ATI 765
-#define _gloffset_DeleteFragmentShaderATI 766
-#define _gloffset_EndFragmentShaderATI 767
-#define _gloffset_GenFragmentShadersATI 768
-#define _gloffset_PassTexCoordATI 769
-#define _gloffset_SampleMapATI 770
-#define _gloffset_SetFragmentShaderConstantATI 771
-#define _gloffset_PointParameteriNV 772
-#define _gloffset_PointParameterivNV 773
-#define _gloffset_ActiveStencilFaceEXT 774
-#define _gloffset_BindVertexArrayAPPLE 775
-#define _gloffset_DeleteVertexArraysAPPLE 776
-#define _gloffset_GenVertexArraysAPPLE 777
-#define _gloffset_IsVertexArrayAPPLE 778
-#define _gloffset_GetProgramNamedParameterdvNV 779
-#define _gloffset_GetProgramNamedParameterfvNV 780
-#define _gloffset_ProgramNamedParameter4dNV 781
-#define _gloffset_ProgramNamedParameter4dvNV 782
-#define _gloffset_ProgramNamedParameter4fNV 783
-#define _gloffset_ProgramNamedParameter4fvNV 784
-#define _gloffset_PrimitiveRestartIndexNV 785
-#define _gloffset_PrimitiveRestartNV 786
-#define _gloffset_DepthBoundsEXT 787
-#define _gloffset_BlendEquationSeparateEXT 788
-#define _gloffset_BindFramebufferEXT 789
-#define _gloffset_BindRenderbufferEXT 790
-#define _gloffset_CheckFramebufferStatusEXT 791
-#define _gloffset_DeleteFramebuffersEXT 792
-#define _gloffset_DeleteRenderbuffersEXT 793
-#define _gloffset_FramebufferRenderbufferEXT 794
-#define _gloffset_FramebufferTexture1DEXT 795
-#define _gloffset_FramebufferTexture2DEXT 796
-#define _gloffset_FramebufferTexture3DEXT 797
-#define _gloffset_GenFramebuffersEXT 798
-#define _gloffset_GenRenderbuffersEXT 799
-#define _gloffset_GenerateMipmapEXT 800
-#define _gloffset_GetFramebufferAttachmentParameterivEXT 801
-#define _gloffset_GetRenderbufferParameterivEXT 802
-#define _gloffset_IsFramebufferEXT 803
-#define _gloffset_IsRenderbufferEXT 804
-#define _gloffset_RenderbufferStorageEXT 805
-#define _gloffset_BlitFramebufferEXT 806
-#define _gloffset_BufferParameteriAPPLE 807
-#define _gloffset_FlushMappedBufferRangeAPPLE 808
-#define _gloffset_BindFragDataLocationEXT 809
-#define _gloffset_GetFragDataLocationEXT 810
-#define _gloffset_GetUniformuivEXT 811
-#define _gloffset_GetVertexAttribIivEXT 812
-#define _gloffset_GetVertexAttribIuivEXT 813
-#define _gloffset_Uniform1uiEXT 814
-#define _gloffset_Uniform1uivEXT 815
-#define _gloffset_Uniform2uiEXT 816
-#define _gloffset_Uniform2uivEXT 817
-#define _gloffset_Uniform3uiEXT 818
-#define _gloffset_Uniform3uivEXT 819
-#define _gloffset_Uniform4uiEXT 820
-#define _gloffset_Uniform4uivEXT 821
-#define _gloffset_VertexAttribI1iEXT 822
-#define _gloffset_VertexAttribI1ivEXT 823
-#define _gloffset_VertexAttribI1uiEXT 824
-#define _gloffset_VertexAttribI1uivEXT 825
-#define _gloffset_VertexAttribI2iEXT 826
-#define _gloffset_VertexAttribI2ivEXT 827
-#define _gloffset_VertexAttribI2uiEXT 828
-#define _gloffset_VertexAttribI2uivEXT 829
-#define _gloffset_VertexAttribI3iEXT 830
-#define _gloffset_VertexAttribI3ivEXT 831
-#define _gloffset_VertexAttribI3uiEXT 832
-#define _gloffset_VertexAttribI3uivEXT 833
-#define _gloffset_VertexAttribI4bvEXT 834
-#define _gloffset_VertexAttribI4iEXT 835
-#define _gloffset_VertexAttribI4ivEXT 836
-#define _gloffset_VertexAttribI4svEXT 837
-#define _gloffset_VertexAttribI4ubvEXT 838
-#define _gloffset_VertexAttribI4uiEXT 839
-#define _gloffset_VertexAttribI4uivEXT 840
-#define _gloffset_VertexAttribI4usvEXT 841
-#define _gloffset_VertexAttribIPointerEXT 842
-#define _gloffset_FramebufferTextureLayerEXT 843
-#define _gloffset_ColorMaskIndexedEXT 844
-#define _gloffset_DisableIndexedEXT 845
-#define _gloffset_EnableIndexedEXT 846
-#define _gloffset_GetBooleanIndexedvEXT 847
-#define _gloffset_GetIntegerIndexedvEXT 848
-#define _gloffset_IsEnabledIndexedEXT 849
-#define _gloffset_ClearColorIiEXT 850
-#define _gloffset_ClearColorIuiEXT 851
-#define _gloffset_GetTexParameterIivEXT 852
-#define _gloffset_GetTexParameterIuivEXT 853
-#define _gloffset_TexParameterIivEXT 854
-#define _gloffset_TexParameterIuivEXT 855
-#define _gloffset_BeginConditionalRenderNV 856
-#define _gloffset_EndConditionalRenderNV 857
-#define _gloffset_BeginTransformFeedbackEXT 858
-#define _gloffset_BindBufferBaseEXT 859
-#define _gloffset_BindBufferOffsetEXT 860
-#define _gloffset_BindBufferRangeEXT 861
-#define _gloffset_EndTransformFeedbackEXT 862
-#define _gloffset_GetTransformFeedbackVaryingEXT 863
-#define _gloffset_TransformFeedbackVaryingsEXT 864
-#define _gloffset_ProvokingVertexEXT 865
-#define _gloffset_GetTexParameterPointervAPPLE 866
-#define _gloffset_TextureRangeAPPLE 867
-#define _gloffset_GetObjectParameterivAPPLE 868
-#define _gloffset_ObjectPurgeableAPPLE 869
-#define _gloffset_ObjectUnpurgeableAPPLE 870
-#define _gloffset_ActiveProgramEXT 871
-#define _gloffset_CreateShaderProgramEXT 872
-#define _gloffset_UseShaderProgramEXT 873
-#define _gloffset_StencilFuncSeparateATI 874
-#define _gloffset_ProgramEnvParameters4fvEXT 875
-#define _gloffset_ProgramLocalParameters4fvEXT 876
-#define _gloffset_GetQueryObjecti64vEXT 877
-#define _gloffset_GetQueryObjectui64vEXT 878
-#define _gloffset_EGLImageTargetRenderbufferStorageOES 879
-#define _gloffset_EGLImageTargetTexture2DOES 880
+#define _gloffset_ClearDepthf 600
+#define _gloffset_DepthRangef 601
+#define _gloffset_GetShaderPrecisionFormat 602
+#define _gloffset_ReleaseShaderCompiler 603
+#define _gloffset_ShaderBinary 604
+#define _gloffset_PolygonOffsetEXT 605
+#define _gloffset_GetPixelTexGenParameterfvSGIS 606
+#define _gloffset_GetPixelTexGenParameterivSGIS 607
+#define _gloffset_PixelTexGenParameterfSGIS 608
+#define _gloffset_PixelTexGenParameterfvSGIS 609
+#define _gloffset_PixelTexGenParameteriSGIS 610
+#define _gloffset_PixelTexGenParameterivSGIS 611
+#define _gloffset_SampleMaskSGIS 612
+#define _gloffset_SamplePatternSGIS 613
+#define _gloffset_ColorPointerEXT 614
+#define _gloffset_EdgeFlagPointerEXT 615
+#define _gloffset_IndexPointerEXT 616
+#define _gloffset_NormalPointerEXT 617
+#define _gloffset_TexCoordPointerEXT 618
+#define _gloffset_VertexPointerEXT 619
+#define _gloffset_PointParameterfEXT 620
+#define _gloffset_PointParameterfvEXT 621
+#define _gloffset_LockArraysEXT 622
+#define _gloffset_UnlockArraysEXT 623
+#define _gloffset_SecondaryColor3bEXT 624
+#define _gloffset_SecondaryColor3bvEXT 625
+#define _gloffset_SecondaryColor3dEXT 626
+#define _gloffset_SecondaryColor3dvEXT 627
+#define _gloffset_SecondaryColor3fEXT 628
+#define _gloffset_SecondaryColor3fvEXT 629
+#define _gloffset_SecondaryColor3iEXT 630
+#define _gloffset_SecondaryColor3ivEXT 631
+#define _gloffset_SecondaryColor3sEXT 632
+#define _gloffset_SecondaryColor3svEXT 633
+#define _gloffset_SecondaryColor3ubEXT 634
+#define _gloffset_SecondaryColor3ubvEXT 635
+#define _gloffset_SecondaryColor3uiEXT 636
+#define _gloffset_SecondaryColor3uivEXT 637
+#define _gloffset_SecondaryColor3usEXT 638
+#define _gloffset_SecondaryColor3usvEXT 639
+#define _gloffset_SecondaryColorPointerEXT 640
+#define _gloffset_MultiDrawArraysEXT 641
+#define _gloffset_MultiDrawElementsEXT 642
+#define _gloffset_FogCoordPointerEXT 643
+#define _gloffset_FogCoorddEXT 644
+#define _gloffset_FogCoorddvEXT 645
+#define _gloffset_FogCoordfEXT 646
+#define _gloffset_FogCoordfvEXT 647
+#define _gloffset_PixelTexGenSGIX 648
+#define _gloffset_BlendFuncSeparateEXT 649
+#define _gloffset_FlushVertexArrayRangeNV 650
+#define _gloffset_VertexArrayRangeNV 651
+#define _gloffset_CombinerInputNV 652
+#define _gloffset_CombinerOutputNV 653
+#define _gloffset_CombinerParameterfNV 654
+#define _gloffset_CombinerParameterfvNV 655
+#define _gloffset_CombinerParameteriNV 656
+#define _gloffset_CombinerParameterivNV 657
+#define _gloffset_FinalCombinerInputNV 658
+#define _gloffset_GetCombinerInputParameterfvNV 659
+#define _gloffset_GetCombinerInputParameterivNV 660
+#define _gloffset_GetCombinerOutputParameterfvNV 661
+#define _gloffset_GetCombinerOutputParameterivNV 662
+#define _gloffset_GetFinalCombinerInputParameterfvNV 663
+#define _gloffset_GetFinalCombinerInputParameterivNV 664
+#define _gloffset_ResizeBuffersMESA 665
+#define _gloffset_WindowPos2dMESA 666
+#define _gloffset_WindowPos2dvMESA 667
+#define _gloffset_WindowPos2fMESA 668
+#define _gloffset_WindowPos2fvMESA 669
+#define _gloffset_WindowPos2iMESA 670
+#define _gloffset_WindowPos2ivMESA 671
+#define _gloffset_WindowPos2sMESA 672
+#define _gloffset_WindowPos2svMESA 673
+#define _gloffset_WindowPos3dMESA 674
+#define _gloffset_WindowPos3dvMESA 675
+#define _gloffset_WindowPos3fMESA 676
+#define _gloffset_WindowPos3fvMESA 677
+#define _gloffset_WindowPos3iMESA 678
+#define _gloffset_WindowPos3ivMESA 679
+#define _gloffset_WindowPos3sMESA 680
+#define _gloffset_WindowPos3svMESA 681
+#define _gloffset_WindowPos4dMESA 682
+#define _gloffset_WindowPos4dvMESA 683
+#define _gloffset_WindowPos4fMESA 684
+#define _gloffset_WindowPos4fvMESA 685
+#define _gloffset_WindowPos4iMESA 686
+#define _gloffset_WindowPos4ivMESA 687
+#define _gloffset_WindowPos4sMESA 688
+#define _gloffset_WindowPos4svMESA 689
+#define _gloffset_MultiModeDrawArraysIBM 690
+#define _gloffset_MultiModeDrawElementsIBM 691
+#define _gloffset_DeleteFencesNV 692
+#define _gloffset_FinishFenceNV 693
+#define _gloffset_GenFencesNV 694
+#define _gloffset_GetFenceivNV 695
+#define _gloffset_IsFenceNV 696
+#define _gloffset_SetFenceNV 697
+#define _gloffset_TestFenceNV 698
+#define _gloffset_AreProgramsResidentNV 699
+#define _gloffset_BindProgramNV 700
+#define _gloffset_DeleteProgramsNV 701
+#define _gloffset_ExecuteProgramNV 702
+#define _gloffset_GenProgramsNV 703
+#define _gloffset_GetProgramParameterdvNV 704
+#define _gloffset_GetProgramParameterfvNV 705
+#define _gloffset_GetProgramStringNV 706
+#define _gloffset_GetProgramivNV 707
+#define _gloffset_GetTrackMatrixivNV 708
+#define _gloffset_GetVertexAttribPointervNV 709
+#define _gloffset_GetVertexAttribdvNV 710
+#define _gloffset_GetVertexAttribfvNV 711
+#define _gloffset_GetVertexAttribivNV 712
+#define _gloffset_IsProgramNV 713
+#define _gloffset_LoadProgramNV 714
+#define _gloffset_ProgramParameters4dvNV 715
+#define _gloffset_ProgramParameters4fvNV 716
+#define _gloffset_RequestResidentProgramsNV 717
+#define _gloffset_TrackMatrixNV 718
+#define _gloffset_VertexAttrib1dNV 719
+#define _gloffset_VertexAttrib1dvNV 720
+#define _gloffset_VertexAttrib1fNV 721
+#define _gloffset_VertexAttrib1fvNV 722
+#define _gloffset_VertexAttrib1sNV 723
+#define _gloffset_VertexAttrib1svNV 724
+#define _gloffset_VertexAttrib2dNV 725
+#define _gloffset_VertexAttrib2dvNV 726
+#define _gloffset_VertexAttrib2fNV 727
+#define _gloffset_VertexAttrib2fvNV 728
+#define _gloffset_VertexAttrib2sNV 729
+#define _gloffset_VertexAttrib2svNV 730
+#define _gloffset_VertexAttrib3dNV 731
+#define _gloffset_VertexAttrib3dvNV 732
+#define _gloffset_VertexAttrib3fNV 733
+#define _gloffset_VertexAttrib3fvNV 734
+#define _gloffset_VertexAttrib3sNV 735
+#define _gloffset_VertexAttrib3svNV 736
+#define _gloffset_VertexAttrib4dNV 737
+#define _gloffset_VertexAttrib4dvNV 738
+#define _gloffset_VertexAttrib4fNV 739
+#define _gloffset_VertexAttrib4fvNV 740
+#define _gloffset_VertexAttrib4sNV 741
+#define _gloffset_VertexAttrib4svNV 742
+#define _gloffset_VertexAttrib4ubNV 743
+#define _gloffset_VertexAttrib4ubvNV 744
+#define _gloffset_VertexAttribPointerNV 745
+#define _gloffset_VertexAttribs1dvNV 746
+#define _gloffset_VertexAttribs1fvNV 747
+#define _gloffset_VertexAttribs1svNV 748
+#define _gloffset_VertexAttribs2dvNV 749
+#define _gloffset_VertexAttribs2fvNV 750
+#define _gloffset_VertexAttribs2svNV 751
+#define _gloffset_VertexAttribs3dvNV 752
+#define _gloffset_VertexAttribs3fvNV 753
+#define _gloffset_VertexAttribs3svNV 754
+#define _gloffset_VertexAttribs4dvNV 755
+#define _gloffset_VertexAttribs4fvNV 756
+#define _gloffset_VertexAttribs4svNV 757
+#define _gloffset_VertexAttribs4ubvNV 758
+#define _gloffset_GetTexBumpParameterfvATI 759
+#define _gloffset_GetTexBumpParameterivATI 760
+#define _gloffset_TexBumpParameterfvATI 761
+#define _gloffset_TexBumpParameterivATI 762
+#define _gloffset_AlphaFragmentOp1ATI 763
+#define _gloffset_AlphaFragmentOp2ATI 764
+#define _gloffset_AlphaFragmentOp3ATI 765
+#define _gloffset_BeginFragmentShaderATI 766
+#define _gloffset_BindFragmentShaderATI 767
+#define _gloffset_ColorFragmentOp1ATI 768
+#define _gloffset_ColorFragmentOp2ATI 769
+#define _gloffset_ColorFragmentOp3ATI 770
+#define _gloffset_DeleteFragmentShaderATI 771
+#define _gloffset_EndFragmentShaderATI 772
+#define _gloffset_GenFragmentShadersATI 773
+#define _gloffset_PassTexCoordATI 774
+#define _gloffset_SampleMapATI 775
+#define _gloffset_SetFragmentShaderConstantATI 776
+#define _gloffset_PointParameteriNV 777
+#define _gloffset_PointParameterivNV 778
+#define _gloffset_ActiveStencilFaceEXT 779
+#define _gloffset_BindVertexArrayAPPLE 780
+#define _gloffset_DeleteVertexArraysAPPLE 781
+#define _gloffset_GenVertexArraysAPPLE 782
+#define _gloffset_IsVertexArrayAPPLE 783
+#define _gloffset_GetProgramNamedParameterdvNV 784
+#define _gloffset_GetProgramNamedParameterfvNV 785
+#define _gloffset_ProgramNamedParameter4dNV 786
+#define _gloffset_ProgramNamedParameter4dvNV 787
+#define _gloffset_ProgramNamedParameter4fNV 788
+#define _gloffset_ProgramNamedParameter4fvNV 789
+#define _gloffset_PrimitiveRestartIndexNV 790
+#define _gloffset_PrimitiveRestartNV 791
+#define _gloffset_DepthBoundsEXT 792
+#define _gloffset_BlendEquationSeparateEXT 793
+#define _gloffset_BindFramebufferEXT 794
+#define _gloffset_BindRenderbufferEXT 795
+#define _gloffset_CheckFramebufferStatusEXT 796
+#define _gloffset_DeleteFramebuffersEXT 797
+#define _gloffset_DeleteRenderbuffersEXT 798
+#define _gloffset_FramebufferRenderbufferEXT 799
+#define _gloffset_FramebufferTexture1DEXT 800
+#define _gloffset_FramebufferTexture2DEXT 801
+#define _gloffset_FramebufferTexture3DEXT 802
+#define _gloffset_GenFramebuffersEXT 803
+#define _gloffset_GenRenderbuffersEXT 804
+#define _gloffset_GenerateMipmapEXT 805
+#define _gloffset_GetFramebufferAttachmentParameterivEXT 806
+#define _gloffset_GetRenderbufferParameterivEXT 807
+#define _gloffset_IsFramebufferEXT 808
+#define _gloffset_IsRenderbufferEXT 809
+#define _gloffset_RenderbufferStorageEXT 810
+#define _gloffset_BlitFramebufferEXT 811
+#define _gloffset_BufferParameteriAPPLE 812
+#define _gloffset_FlushMappedBufferRangeAPPLE 813
+#define _gloffset_BindFragDataLocationEXT 814
+#define _gloffset_GetFragDataLocationEXT 815
+#define _gloffset_GetUniformuivEXT 816
+#define _gloffset_GetVertexAttribIivEXT 817
+#define _gloffset_GetVertexAttribIuivEXT 818
+#define _gloffset_Uniform1uiEXT 819
+#define _gloffset_Uniform1uivEXT 820
+#define _gloffset_Uniform2uiEXT 821
+#define _gloffset_Uniform2uivEXT 822
+#define _gloffset_Uniform3uiEXT 823
+#define _gloffset_Uniform3uivEXT 824
+#define _gloffset_Uniform4uiEXT 825
+#define _gloffset_Uniform4uivEXT 826
+#define _gloffset_VertexAttribI1iEXT 827
+#define _gloffset_VertexAttribI1ivEXT 828
+#define _gloffset_VertexAttribI1uiEXT 829
+#define _gloffset_VertexAttribI1uivEXT 830
+#define _gloffset_VertexAttribI2iEXT 831
+#define _gloffset_VertexAttribI2ivEXT 832
+#define _gloffset_VertexAttribI2uiEXT 833
+#define _gloffset_VertexAttribI2uivEXT 834
+#define _gloffset_VertexAttribI3iEXT 835
+#define _gloffset_VertexAttribI3ivEXT 836
+#define _gloffset_VertexAttribI3uiEXT 837
+#define _gloffset_VertexAttribI3uivEXT 838
+#define _gloffset_VertexAttribI4bvEXT 839
+#define _gloffset_VertexAttribI4iEXT 840
+#define _gloffset_VertexAttribI4ivEXT 841
+#define _gloffset_VertexAttribI4svEXT 842
+#define _gloffset_VertexAttribI4ubvEXT 843
+#define _gloffset_VertexAttribI4uiEXT 844
+#define _gloffset_VertexAttribI4uivEXT 845
+#define _gloffset_VertexAttribI4usvEXT 846
+#define _gloffset_VertexAttribIPointerEXT 847
+#define _gloffset_FramebufferTextureLayerEXT 848
+#define _gloffset_ColorMaskIndexedEXT 849
+#define _gloffset_DisableIndexedEXT 850
+#define _gloffset_EnableIndexedEXT 851
+#define _gloffset_GetBooleanIndexedvEXT 852
+#define _gloffset_GetIntegerIndexedvEXT 853
+#define _gloffset_IsEnabledIndexedEXT 854
+#define _gloffset_ClearColorIiEXT 855
+#define _gloffset_ClearColorIuiEXT 856
+#define _gloffset_GetTexParameterIivEXT 857
+#define _gloffset_GetTexParameterIuivEXT 858
+#define _gloffset_TexParameterIivEXT 859
+#define _gloffset_TexParameterIuivEXT 860
+#define _gloffset_BeginConditionalRenderNV 861
+#define _gloffset_EndConditionalRenderNV 862
+#define _gloffset_BeginTransformFeedbackEXT 863
+#define _gloffset_BindBufferBaseEXT 864
+#define _gloffset_BindBufferOffsetEXT 865
+#define _gloffset_BindBufferRangeEXT 866
+#define _gloffset_EndTransformFeedbackEXT 867
+#define _gloffset_GetTransformFeedbackVaryingEXT 868
+#define _gloffset_TransformFeedbackVaryingsEXT 869
+#define _gloffset_ProvokingVertexEXT 870
+#define _gloffset_GetTexParameterPointervAPPLE 871
+#define _gloffset_TextureRangeAPPLE 872
+#define _gloffset_GetObjectParameterivAPPLE 873
+#define _gloffset_ObjectPurgeableAPPLE 874
+#define _gloffset_ObjectUnpurgeableAPPLE 875
+#define _gloffset_ActiveProgramEXT 876
+#define _gloffset_CreateShaderProgramEXT 877
+#define _gloffset_UseShaderProgramEXT 878
+#define _gloffset_StencilFuncSeparateATI 879
+#define _gloffset_ProgramEnvParameters4fvEXT 880
+#define _gloffset_ProgramLocalParameters4fvEXT 881
+#define _gloffset_GetQueryObjecti64vEXT 882
+#define _gloffset_GetQueryObjectui64vEXT 883
+#define _gloffset_EGLImageTargetRenderbufferStorageOES 884
+#define _gloffset_EGLImageTargetTexture2DOES 885
 
 #else /* !_GLAPI_USE_REMAP_TABLE */
 
-#define driDispatchRemapTable_size 473
+#define driDispatchRemapTable_size 478
 extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 
 #define AttachShader_remap_index 0
@@ -1143,287 +1148,292 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define IsTransformFeedback_remap_index 189
 #define PauseTransformFeedback_remap_index 190
 #define ResumeTransformFeedback_remap_index 191
-#define PolygonOffsetEXT_remap_index 192
-#define GetPixelTexGenParameterfvSGIS_remap_index 193
-#define GetPixelTexGenParameterivSGIS_remap_index 194
-#define PixelTexGenParameterfSGIS_remap_index 195
-#define PixelTexGenParameterfvSGIS_remap_index 196
-#define PixelTexGenParameteriSGIS_remap_index 197
-#define PixelTexGenParameterivSGIS_remap_index 198
-#define SampleMaskSGIS_remap_index 199
-#define SamplePatternSGIS_remap_index 200
-#define ColorPointerEXT_remap_index 201
-#define EdgeFlagPointerEXT_remap_index 202
-#define IndexPointerEXT_remap_index 203
-#define NormalPointerEXT_remap_index 204
-#define TexCoordPointerEXT_remap_index 205
-#define VertexPointerEXT_remap_index 206
-#define PointParameterfEXT_remap_index 207
-#define PointParameterfvEXT_remap_index 208
-#define LockArraysEXT_remap_index 209
-#define UnlockArraysEXT_remap_index 210
-#define SecondaryColor3bEXT_remap_index 211
-#define SecondaryColor3bvEXT_remap_index 212
-#define SecondaryColor3dEXT_remap_index 213
-#define SecondaryColor3dvEXT_remap_index 214
-#define SecondaryColor3fEXT_remap_index 215
-#define SecondaryColor3fvEXT_remap_index 216
-#define SecondaryColor3iEXT_remap_index 217
-#define SecondaryColor3ivEXT_remap_index 218
-#define SecondaryColor3sEXT_remap_index 219
-#define SecondaryColor3svEXT_remap_index 220
-#define SecondaryColor3ubEXT_remap_index 221
-#define SecondaryColor3ubvEXT_remap_index 222
-#define SecondaryColor3uiEXT_remap_index 223
-#define SecondaryColor3uivEXT_remap_index 224
-#define SecondaryColor3usEXT_remap_index 225
-#define SecondaryColor3usvEXT_remap_index 226
-#define SecondaryColorPointerEXT_remap_index 227
-#define MultiDrawArraysEXT_remap_index 228
-#define MultiDrawElementsEXT_remap_index 229
-#define FogCoordPointerEXT_remap_index 230
-#define FogCoorddEXT_remap_index 231
-#define FogCoorddvEXT_remap_index 232
-#define FogCoordfEXT_remap_index 233
-#define FogCoordfvEXT_remap_index 234
-#define PixelTexGenSGIX_remap_index 235
-#define BlendFuncSeparateEXT_remap_index 236
-#define FlushVertexArrayRangeNV_remap_index 237
-#define VertexArrayRangeNV_remap_index 238
-#define CombinerInputNV_remap_index 239
-#define CombinerOutputNV_remap_index 240
-#define CombinerParameterfNV_remap_index 241
-#define CombinerParameterfvNV_remap_index 242
-#define CombinerParameteriNV_remap_index 243
-#define CombinerParameterivNV_remap_index 244
-#define FinalCombinerInputNV_remap_index 245
-#define GetCombinerInputParameterfvNV_remap_index 246
-#define GetCombinerInputParameterivNV_remap_index 247
-#define GetCombinerOutputParameterfvNV_remap_index 248
-#define GetCombinerOutputParameterivNV_remap_index 249
-#define GetFinalCombinerInputParameterfvNV_remap_index 250
-#define GetFinalCombinerInputParameterivNV_remap_index 251
-#define ResizeBuffersMESA_remap_index 252
-#define WindowPos2dMESA_remap_index 253
-#define WindowPos2dvMESA_remap_index 254
-#define WindowPos2fMESA_remap_index 255
-#define WindowPos2fvMESA_remap_index 256
-#define WindowPos2iMESA_remap_index 257
-#define WindowPos2ivMESA_remap_index 258
-#define WindowPos2sMESA_remap_index 259
-#define WindowPos2svMESA_remap_index 260
-#define WindowPos3dMESA_remap_index 261
-#define WindowPos3dvMESA_remap_index 262
-#define WindowPos3fMESA_remap_index 263
-#define WindowPos3fvMESA_remap_index 264
-#define WindowPos3iMESA_remap_index 265
-#define WindowPos3ivMESA_remap_index 266
-#define WindowPos3sMESA_remap_index 267
-#define WindowPos3svMESA_remap_index 268
-#define WindowPos4dMESA_remap_index 269
-#define WindowPos4dvMESA_remap_index 270
-#define WindowPos4fMESA_remap_index 271
-#define WindowPos4fvMESA_remap_index 272
-#define WindowPos4iMESA_remap_index 273
-#define WindowPos4ivMESA_remap_index 274
-#define WindowPos4sMESA_remap_index 275
-#define WindowPos4svMESA_remap_index 276
-#define MultiModeDrawArraysIBM_remap_index 277
-#define MultiModeDrawElementsIBM_remap_index 278
-#define DeleteFencesNV_remap_index 279
-#define FinishFenceNV_remap_index 280
-#define GenFencesNV_remap_index 281
-#define GetFenceivNV_remap_index 282
-#define IsFenceNV_remap_index 283
-#define SetFenceNV_remap_index 284
-#define TestFenceNV_remap_index 285
-#define AreProgramsResidentNV_remap_index 286
-#define BindProgramNV_remap_index 287
-#define DeleteProgramsNV_remap_index 288
-#define ExecuteProgramNV_remap_index 289
-#define GenProgramsNV_remap_index 290
-#define GetProgramParameterdvNV_remap_index 291
-#define GetProgramParameterfvNV_remap_index 292
-#define GetProgramStringNV_remap_index 293
-#define GetProgramivNV_remap_index 294
-#define GetTrackMatrixivNV_remap_index 295
-#define GetVertexAttribPointervNV_remap_index 296
-#define GetVertexAttribdvNV_remap_index 297
-#define GetVertexAttribfvNV_remap_index 298
-#define GetVertexAttribivNV_remap_index 299
-#define IsProgramNV_remap_index 300
-#define LoadProgramNV_remap_index 301
-#define ProgramParameters4dvNV_remap_index 302
-#define ProgramParameters4fvNV_remap_index 303
-#define RequestResidentProgramsNV_remap_index 304
-#define TrackMatrixNV_remap_index 305
-#define VertexAttrib1dNV_remap_index 306
-#define VertexAttrib1dvNV_remap_index 307
-#define VertexAttrib1fNV_remap_index 308
-#define VertexAttrib1fvNV_remap_index 309
-#define VertexAttrib1sNV_remap_index 310
-#define VertexAttrib1svNV_remap_index 311
-#define VertexAttrib2dNV_remap_index 312
-#define VertexAttrib2dvNV_remap_index 313
-#define VertexAttrib2fNV_remap_index 314
-#define VertexAttrib2fvNV_remap_index 315
-#define VertexAttrib2sNV_remap_index 316
-#define VertexAttrib2svNV_remap_index 317
-#define VertexAttrib3dNV_remap_index 318
-#define VertexAttrib3dvNV_remap_index 319
-#define VertexAttrib3fNV_remap_index 320
-#define VertexAttrib3fvNV_remap_index 321
-#define VertexAttrib3sNV_remap_index 322
-#define VertexAttrib3svNV_remap_index 323
-#define VertexAttrib4dNV_remap_index 324
-#define VertexAttrib4dvNV_remap_index 325
-#define VertexAttrib4fNV_remap_index 326
-#define VertexAttrib4fvNV_remap_index 327
-#define VertexAttrib4sNV_remap_index 328
-#define VertexAttrib4svNV_remap_index 329
-#define VertexAttrib4ubNV_remap_index 330
-#define VertexAttrib4ubvNV_remap_index 331
-#define VertexAttribPointerNV_remap_index 332
-#define VertexAttribs1dvNV_remap_index 333
-#define VertexAttribs1fvNV_remap_index 334
-#define VertexAttribs1svNV_remap_index 335
-#define VertexAttribs2dvNV_remap_index 336
-#define VertexAttribs2fvNV_remap_index 337
-#define VertexAttribs2svNV_remap_index 338
-#define VertexAttribs3dvNV_remap_index 339
-#define VertexAttribs3fvNV_remap_index 340
-#define VertexAttribs3svNV_remap_index 341
-#define VertexAttribs4dvNV_remap_index 342
-#define VertexAttribs4fvNV_remap_index 343
-#define VertexAttribs4svNV_remap_index 344
-#define VertexAttribs4ubvNV_remap_index 345
-#define GetTexBumpParameterfvATI_remap_index 346
-#define GetTexBumpParameterivATI_remap_index 347
-#define TexBumpParameterfvATI_remap_index 348
-#define TexBumpParameterivATI_remap_index 349
-#define AlphaFragmentOp1ATI_remap_index 350
-#define AlphaFragmentOp2ATI_remap_index 351
-#define AlphaFragmentOp3ATI_remap_index 352
-#define BeginFragmentShaderATI_remap_index 353
-#define BindFragmentShaderATI_remap_index 354
-#define ColorFragmentOp1ATI_remap_index 355
-#define ColorFragmentOp2ATI_remap_index 356
-#define ColorFragmentOp3ATI_remap_index 357
-#define DeleteFragmentShaderATI_remap_index 358
-#define EndFragmentShaderATI_remap_index 359
-#define GenFragmentShadersATI_remap_index 360
-#define PassTexCoordATI_remap_index 361
-#define SampleMapATI_remap_index 362
-#define SetFragmentShaderConstantATI_remap_index 363
-#define PointParameteriNV_remap_index 364
-#define PointParameterivNV_remap_index 365
-#define ActiveStencilFaceEXT_remap_index 366
-#define BindVertexArrayAPPLE_remap_index 367
-#define DeleteVertexArraysAPPLE_remap_index 368
-#define GenVertexArraysAPPLE_remap_index 369
-#define IsVertexArrayAPPLE_remap_index 370
-#define GetProgramNamedParameterdvNV_remap_index 371
-#define GetProgramNamedParameterfvNV_remap_index 372
-#define ProgramNamedParameter4dNV_remap_index 373
-#define ProgramNamedParameter4dvNV_remap_index 374
-#define ProgramNamedParameter4fNV_remap_index 375
-#define ProgramNamedParameter4fvNV_remap_index 376
-#define PrimitiveRestartIndexNV_remap_index 377
-#define PrimitiveRestartNV_remap_index 378
-#define DepthBoundsEXT_remap_index 379
-#define BlendEquationSeparateEXT_remap_index 380
-#define BindFramebufferEXT_remap_index 381
-#define BindRenderbufferEXT_remap_index 382
-#define CheckFramebufferStatusEXT_remap_index 383
-#define DeleteFramebuffersEXT_remap_index 384
-#define DeleteRenderbuffersEXT_remap_index 385
-#define FramebufferRenderbufferEXT_remap_index 386
-#define FramebufferTexture1DEXT_remap_index 387
-#define FramebufferTexture2DEXT_remap_index 388
-#define FramebufferTexture3DEXT_remap_index 389
-#define GenFramebuffersEXT_remap_index 390
-#define GenRenderbuffersEXT_remap_index 391
-#define GenerateMipmapEXT_remap_index 392
-#define GetFramebufferAttachmentParameterivEXT_remap_index 393
-#define GetRenderbufferParameterivEXT_remap_index 394
-#define IsFramebufferEXT_remap_index 395
-#define IsRenderbufferEXT_remap_index 396
-#define RenderbufferStorageEXT_remap_index 397
-#define BlitFramebufferEXT_remap_index 398
-#define BufferParameteriAPPLE_remap_index 399
-#define FlushMappedBufferRangeAPPLE_remap_index 400
-#define BindFragDataLocationEXT_remap_index 401
-#define GetFragDataLocationEXT_remap_index 402
-#define GetUniformuivEXT_remap_index 403
-#define GetVertexAttribIivEXT_remap_index 404
-#define GetVertexAttribIuivEXT_remap_index 405
-#define Uniform1uiEXT_remap_index 406
-#define Uniform1uivEXT_remap_index 407
-#define Uniform2uiEXT_remap_index 408
-#define Uniform2uivEXT_remap_index 409
-#define Uniform3uiEXT_remap_index 410
-#define Uniform3uivEXT_remap_index 411
-#define Uniform4uiEXT_remap_index 412
-#define Uniform4uivEXT_remap_index 413
-#define VertexAttribI1iEXT_remap_index 414
-#define VertexAttribI1ivEXT_remap_index 415
-#define VertexAttribI1uiEXT_remap_index 416
-#define VertexAttribI1uivEXT_remap_index 417
-#define VertexAttribI2iEXT_remap_index 418
-#define VertexAttribI2ivEXT_remap_index 419
-#define VertexAttribI2uiEXT_remap_index 420
-#define VertexAttribI2uivEXT_remap_index 421
-#define VertexAttribI3iEXT_remap_index 422
-#define VertexAttribI3ivEXT_remap_index 423
-#define VertexAttribI3uiEXT_remap_index 424
-#define VertexAttribI3uivEXT_remap_index 425
-#define VertexAttribI4bvEXT_remap_index 426
-#define VertexAttribI4iEXT_remap_index 427
-#define VertexAttribI4ivEXT_remap_index 428
-#define VertexAttribI4svEXT_remap_index 429
-#define VertexAttribI4ubvEXT_remap_index 430
-#define VertexAttribI4uiEXT_remap_index 431
-#define VertexAttribI4uivEXT_remap_index 432
-#define VertexAttribI4usvEXT_remap_index 433
-#define VertexAttribIPointerEXT_remap_index 434
-#define FramebufferTextureLayerEXT_remap_index 435
-#define ColorMaskIndexedEXT_remap_index 436
-#define DisableIndexedEXT_remap_index 437
-#define EnableIndexedEXT_remap_index 438
-#define GetBooleanIndexedvEXT_remap_index 439
-#define GetIntegerIndexedvEXT_remap_index 440
-#define IsEnabledIndexedEXT_remap_index 441
-#define ClearColorIiEXT_remap_index 442
-#define ClearColorIuiEXT_remap_index 443
-#define GetTexParameterIivEXT_remap_index 444
-#define GetTexParameterIuivEXT_remap_index 445
-#define TexParameterIivEXT_remap_index 446
-#define TexParameterIuivEXT_remap_index 447
-#define BeginConditionalRenderNV_remap_index 448
-#define EndConditionalRenderNV_remap_index 449
-#define BeginTransformFeedbackEXT_remap_index 450
-#define BindBufferBaseEXT_remap_index 451
-#define BindBufferOffsetEXT_remap_index 452
-#define BindBufferRangeEXT_remap_index 453
-#define EndTransformFeedbackEXT_remap_index 454
-#define GetTransformFeedbackVaryingEXT_remap_index 455
-#define TransformFeedbackVaryingsEXT_remap_index 456
-#define ProvokingVertexEXT_remap_index 457
-#define GetTexParameterPointervAPPLE_remap_index 458
-#define TextureRangeAPPLE_remap_index 459
-#define GetObjectParameterivAPPLE_remap_index 460
-#define ObjectPurgeableAPPLE_remap_index 461
-#define ObjectUnpurgeableAPPLE_remap_index 462
-#define ActiveProgramEXT_remap_index 463
-#define CreateShaderProgramEXT_remap_index 464
-#define UseShaderProgramEXT_remap_index 465
-#define StencilFuncSeparateATI_remap_index 466
-#define ProgramEnvParameters4fvEXT_remap_index 467
-#define ProgramLocalParameters4fvEXT_remap_index 468
-#define GetQueryObjecti64vEXT_remap_index 469
-#define GetQueryObjectui64vEXT_remap_index 470
-#define EGLImageTargetRenderbufferStorageOES_remap_index 471
-#define EGLImageTargetTexture2DOES_remap_index 472
+#define ClearDepthf_remap_index 192
+#define DepthRangef_remap_index 193
+#define GetShaderPrecisionFormat_remap_index 194
+#define ReleaseShaderCompiler_remap_index 195
+#define ShaderBinary_remap_index 196
+#define PolygonOffsetEXT_remap_index 197
+#define GetPixelTexGenParameterfvSGIS_remap_index 198
+#define GetPixelTexGenParameterivSGIS_remap_index 199
+#define PixelTexGenParameterfSGIS_remap_index 200
+#define PixelTexGenParameterfvSGIS_remap_index 201
+#define PixelTexGenParameteriSGIS_remap_index 202
+#define PixelTexGenParameterivSGIS_remap_index 203
+#define SampleMaskSGIS_remap_index 204
+#define SamplePatternSGIS_remap_index 205
+#define ColorPointerEXT_remap_index 206
+#define EdgeFlagPointerEXT_remap_index 207
+#define IndexPointerEXT_remap_index 208
+#define NormalPointerEXT_remap_index 209
+#define TexCoordPointerEXT_remap_index 210
+#define VertexPointerEXT_remap_index 211
+#define PointParameterfEXT_remap_index 212
+#define PointParameterfvEXT_remap_index 213
+#define LockArraysEXT_remap_index 214
+#define UnlockArraysEXT_remap_index 215
+#define SecondaryColor3bEXT_remap_index 216
+#define SecondaryColor3bvEXT_remap_index 217
+#define SecondaryColor3dEXT_remap_index 218
+#define SecondaryColor3dvEXT_remap_index 219
+#define SecondaryColor3fEXT_remap_index 220
+#define SecondaryColor3fvEXT_remap_index 221
+#define SecondaryColor3iEXT_remap_index 222
+#define SecondaryColor3ivEXT_remap_index 223
+#define SecondaryColor3sEXT_remap_index 224
+#define SecondaryColor3svEXT_remap_index 225
+#define SecondaryColor3ubEXT_remap_index 226
+#define SecondaryColor3ubvEXT_remap_index 227
+#define SecondaryColor3uiEXT_remap_index 228
+#define SecondaryColor3uivEXT_remap_index 229
+#define SecondaryColor3usEXT_remap_index 230
+#define SecondaryColor3usvEXT_remap_index 231
+#define SecondaryColorPointerEXT_remap_index 232
+#define MultiDrawArraysEXT_remap_index 233
+#define MultiDrawElementsEXT_remap_index 234
+#define FogCoordPointerEXT_remap_index 235
+#define FogCoorddEXT_remap_index 236
+#define FogCoorddvEXT_remap_index 237
+#define FogCoordfEXT_remap_index 238
+#define FogCoordfvEXT_remap_index 239
+#define PixelTexGenSGIX_remap_index 240
+#define BlendFuncSeparateEXT_remap_index 241
+#define FlushVertexArrayRangeNV_remap_index 242
+#define VertexArrayRangeNV_remap_index 243
+#define CombinerInputNV_remap_index 244
+#define CombinerOutputNV_remap_index 245
+#define CombinerParameterfNV_remap_index 246
+#define CombinerParameterfvNV_remap_index 247
+#define CombinerParameteriNV_remap_index 248
+#define CombinerParameterivNV_remap_index 249
+#define FinalCombinerInputNV_remap_index 250
+#define GetCombinerInputParameterfvNV_remap_index 251
+#define GetCombinerInputParameterivNV_remap_index 252
+#define GetCombinerOutputParameterfvNV_remap_index 253
+#define GetCombinerOutputParameterivNV_remap_index 254
+#define GetFinalCombinerInputParameterfvNV_remap_index 255
+#define GetFinalCombinerInputParameterivNV_remap_index 256
+#define ResizeBuffersMESA_remap_index 257
+#define WindowPos2dMESA_remap_index 258
+#define WindowPos2dvMESA_remap_index 259
+#define WindowPos2fMESA_remap_index 260
+#define WindowPos2fvMESA_remap_index 261
+#define WindowPos2iMESA_remap_index 262
+#define WindowPos2ivMESA_remap_index 263
+#define WindowPos2sMESA_remap_index 264
+#define WindowPos2svMESA_remap_index 265
+#define WindowPos3dMESA_remap_index 266
+#define WindowPos3dvMESA_remap_index 267
+#define WindowPos3fMESA_remap_index 268
+#define WindowPos3fvMESA_remap_index 269
+#define WindowPos3iMESA_remap_index 270
+#define WindowPos3ivMESA_remap_index 271
+#define WindowPos3sMESA_remap_index 272
+#define WindowPos3svMESA_remap_index 273
+#define WindowPos4dMESA_remap_index 274
+#define WindowPos4dvMESA_remap_index 275
+#define WindowPos4fMESA_remap_index 276
+#define WindowPos4fvMESA_remap_index 277
+#define WindowPos4iMESA_remap_index 278
+#define WindowPos4ivMESA_remap_index 279
+#define WindowPos4sMESA_remap_index 280
+#define WindowPos4svMESA_remap_index 281
+#define MultiModeDrawArraysIBM_remap_index 282
+#define MultiModeDrawElementsIBM_remap_index 283
+#define DeleteFencesNV_remap_index 284
+#define FinishFenceNV_remap_index 285
+#define GenFencesNV_remap_index 286
+#define GetFenceivNV_remap_index 287
+#define IsFenceNV_remap_index 288
+#define SetFenceNV_remap_index 289
+#define TestFenceNV_remap_index 290
+#define AreProgramsResidentNV_remap_index 291
+#define BindProgramNV_remap_index 292
+#define DeleteProgramsNV_remap_index 293
+#define ExecuteProgramNV_remap_index 294
+#define GenProgramsNV_remap_index 295
+#define GetProgramParameterdvNV_remap_index 296
+#define GetProgramParameterfvNV_remap_index 297
+#define GetProgramStringNV_remap_index 298
+#define GetProgramivNV_remap_index 299
+#define GetTrackMatrixivNV_remap_index 300
+#define GetVertexAttribPointervNV_remap_index 301
+#define GetVertexAttribdvNV_remap_index 302
+#define GetVertexAttribfvNV_remap_index 303
+#define GetVertexAttribivNV_remap_index 304
+#define IsProgramNV_remap_index 305
+#define LoadProgramNV_remap_index 306
+#define ProgramParameters4dvNV_remap_index 307
+#define ProgramParameters4fvNV_remap_index 308
+#define RequestResidentProgramsNV_remap_index 309
+#define TrackMatrixNV_remap_index 310
+#define VertexAttrib1dNV_remap_index 311
+#define VertexAttrib1dvNV_remap_index 312
+#define VertexAttrib1fNV_remap_index 313
+#define VertexAttrib1fvNV_remap_index 314
+#define VertexAttrib1sNV_remap_index 315
+#define VertexAttrib1svNV_remap_index 316
+#define VertexAttrib2dNV_remap_index 317
+#define VertexAttrib2dvNV_remap_index 318
+#define VertexAttrib2fNV_remap_index 319
+#define VertexAttrib2fvNV_remap_index 320
+#define VertexAttrib2sNV_remap_index 321
+#define VertexAttrib2svNV_remap_index 322
+#define VertexAttrib3dNV_remap_index 323
+#define VertexAttrib3dvNV_remap_index 324
+#define VertexAttrib3fNV_remap_index 325
+#define VertexAttrib3fvNV_remap_index 326
+#define VertexAttrib3sNV_remap_index 327
+#define VertexAttrib3svNV_remap_index 328
+#define VertexAttrib4dNV_remap_index 329
+#define VertexAttrib4dvNV_remap_index 330
+#define VertexAttrib4fNV_remap_index 331
+#define VertexAttrib4fvNV_remap_index 332
+#define VertexAttrib4sNV_remap_index 333
+#define VertexAttrib4svNV_remap_index 334
+#define VertexAttrib4ubNV_remap_index 335
+#define VertexAttrib4ubvNV_remap_index 336
+#define VertexAttribPointerNV_remap_index 337
+#define VertexAttribs1dvNV_remap_index 338
+#define VertexAttribs1fvNV_remap_index 339
+#define VertexAttribs1svNV_remap_index 340
+#define VertexAttribs2dvNV_remap_index 341
+#define VertexAttribs2fvNV_remap_index 342
+#define VertexAttribs2svNV_remap_index 343
+#define VertexAttribs3dvNV_remap_index 344
+#define VertexAttribs3fvNV_remap_index 345
+#define VertexAttribs3svNV_remap_index 346
+#define VertexAttribs4dvNV_remap_index 347
+#define VertexAttribs4fvNV_remap_index 348
+#define VertexAttribs4svNV_remap_index 349
+#define VertexAttribs4ubvNV_remap_index 350
+#define GetTexBumpParameterfvATI_remap_index 351
+#define GetTexBumpParameterivATI_remap_index 352
+#define TexBumpParameterfvATI_remap_index 353
+#define TexBumpParameterivATI_remap_index 354
+#define AlphaFragmentOp1ATI_remap_index 355
+#define AlphaFragmentOp2ATI_remap_index 356
+#define AlphaFragmentOp3ATI_remap_index 357
+#define BeginFragmentShaderATI_remap_index 358
+#define BindFragmentShaderATI_remap_index 359
+#define ColorFragmentOp1ATI_remap_index 360
+#define ColorFragmentOp2ATI_remap_index 361
+#define ColorFragmentOp3ATI_remap_index 362
+#define DeleteFragmentShaderATI_remap_index 363
+#define EndFragmentShaderATI_remap_index 364
+#define GenFragmentShadersATI_remap_index 365
+#define PassTexCoordATI_remap_index 366
+#define SampleMapATI_remap_index 367
+#define SetFragmentShaderConstantATI_remap_index 368
+#define PointParameteriNV_remap_index 369
+#define PointParameterivNV_remap_index 370
+#define ActiveStencilFaceEXT_remap_index 371
+#define BindVertexArrayAPPLE_remap_index 372
+#define DeleteVertexArraysAPPLE_remap_index 373
+#define GenVertexArraysAPPLE_remap_index 374
+#define IsVertexArrayAPPLE_remap_index 375
+#define GetProgramNamedParameterdvNV_remap_index 376
+#define GetProgramNamedParameterfvNV_remap_index 377
+#define ProgramNamedParameter4dNV_remap_index 378
+#define ProgramNamedParameter4dvNV_remap_index 379
+#define ProgramNamedParameter4fNV_remap_index 380
+#define ProgramNamedParameter4fvNV_remap_index 381
+#define PrimitiveRestartIndexNV_remap_index 382
+#define PrimitiveRestartNV_remap_index 383
+#define DepthBoundsEXT_remap_index 384
+#define BlendEquationSeparateEXT_remap_index 385
+#define BindFramebufferEXT_remap_index 386
+#define BindRenderbufferEXT_remap_index 387
+#define CheckFramebufferStatusEXT_remap_index 388
+#define DeleteFramebuffersEXT_remap_index 389
+#define DeleteRenderbuffersEXT_remap_index 390
+#define FramebufferRenderbufferEXT_remap_index 391
+#define FramebufferTexture1DEXT_remap_index 392
+#define FramebufferTexture2DEXT_remap_index 393
+#define FramebufferTexture3DEXT_remap_index 394
+#define GenFramebuffersEXT_remap_index 395
+#define GenRenderbuffersEXT_remap_index 396
+#define GenerateMipmapEXT_remap_index 397
+#define GetFramebufferAttachmentParameterivEXT_remap_index 398
+#define GetRenderbufferParameterivEXT_remap_index 399
+#define IsFramebufferEXT_remap_index 400
+#define IsRenderbufferEXT_remap_index 401
+#define RenderbufferStorageEXT_remap_index 402
+#define BlitFramebufferEXT_remap_index 403
+#define BufferParameteriAPPLE_remap_index 404
+#define FlushMappedBufferRangeAPPLE_remap_index 405
+#define BindFragDataLocationEXT_remap_index 406
+#define GetFragDataLocationEXT_remap_index 407
+#define GetUniformuivEXT_remap_index 408
+#define GetVertexAttribIivEXT_remap_index 409
+#define GetVertexAttribIuivEXT_remap_index 410
+#define Uniform1uiEXT_remap_index 411
+#define Uniform1uivEXT_remap_index 412
+#define Uniform2uiEXT_remap_index 413
+#define Uniform2uivEXT_remap_index 414
+#define Uniform3uiEXT_remap_index 415
+#define Uniform3uivEXT_remap_index 416
+#define Uniform4uiEXT_remap_index 417
+#define Uniform4uivEXT_remap_index 418
+#define VertexAttribI1iEXT_remap_index 419
+#define VertexAttribI1ivEXT_remap_index 420
+#define VertexAttribI1uiEXT_remap_index 421
+#define VertexAttribI1uivEXT_remap_index 422
+#define VertexAttribI2iEXT_remap_index 423
+#define VertexAttribI2ivEXT_remap_index 424
+#define VertexAttribI2uiEXT_remap_index 425
+#define VertexAttribI2uivEXT_remap_index 426
+#define VertexAttribI3iEXT_remap_index 427
+#define VertexAttribI3ivEXT_remap_index 428
+#define VertexAttribI3uiEXT_remap_index 429
+#define VertexAttribI3uivEXT_remap_index 430
+#define VertexAttribI4bvEXT_remap_index 431
+#define VertexAttribI4iEXT_remap_index 432
+#define VertexAttribI4ivEXT_remap_index 433
+#define VertexAttribI4svEXT_remap_index 434
+#define VertexAttribI4ubvEXT_remap_index 435
+#define VertexAttribI4uiEXT_remap_index 436
+#define VertexAttribI4uivEXT_remap_index 437
+#define VertexAttribI4usvEXT_remap_index 438
+#define VertexAttribIPointerEXT_remap_index 439
+#define FramebufferTextureLayerEXT_remap_index 440
+#define ColorMaskIndexedEXT_remap_index 441
+#define DisableIndexedEXT_remap_index 442
+#define EnableIndexedEXT_remap_index 443
+#define GetBooleanIndexedvEXT_remap_index 444
+#define GetIntegerIndexedvEXT_remap_index 445
+#define IsEnabledIndexedEXT_remap_index 446
+#define ClearColorIiEXT_remap_index 447
+#define ClearColorIuiEXT_remap_index 448
+#define GetTexParameterIivEXT_remap_index 449
+#define GetTexParameterIuivEXT_remap_index 450
+#define TexParameterIivEXT_remap_index 451
+#define TexParameterIuivEXT_remap_index 452
+#define BeginConditionalRenderNV_remap_index 453
+#define EndConditionalRenderNV_remap_index 454
+#define BeginTransformFeedbackEXT_remap_index 455
+#define BindBufferBaseEXT_remap_index 456
+#define BindBufferOffsetEXT_remap_index 457
+#define BindBufferRangeEXT_remap_index 458
+#define EndTransformFeedbackEXT_remap_index 459
+#define GetTransformFeedbackVaryingEXT_remap_index 460
+#define TransformFeedbackVaryingsEXT_remap_index 461
+#define ProvokingVertexEXT_remap_index 462
+#define GetTexParameterPointervAPPLE_remap_index 463
+#define TextureRangeAPPLE_remap_index 464
+#define GetObjectParameterivAPPLE_remap_index 465
+#define ObjectPurgeableAPPLE_remap_index 466
+#define ObjectUnpurgeableAPPLE_remap_index 467
+#define ActiveProgramEXT_remap_index 468
+#define CreateShaderProgramEXT_remap_index 469
+#define UseShaderProgramEXT_remap_index 470
+#define StencilFuncSeparateATI_remap_index 471
+#define ProgramEnvParameters4fvEXT_remap_index 472
+#define ProgramLocalParameters4fvEXT_remap_index 473
+#define GetQueryObjecti64vEXT_remap_index 474
+#define GetQueryObjectui64vEXT_remap_index 475
+#define EGLImageTargetRenderbufferStorageOES_remap_index 476
+#define EGLImageTargetTexture2DOES_remap_index 477
 
 #define _gloffset_AttachShader driDispatchRemapTable[AttachShader_remap_index]
 #define _gloffset_CreateProgram driDispatchRemapTable[CreateProgram_remap_index]
@@ -1617,6 +1627,11 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define _gloffset_IsTransformFeedback driDispatchRemapTable[IsTransformFeedback_remap_index]
 #define _gloffset_PauseTransformFeedback driDispatchRemapTable[PauseTransformFeedback_remap_index]
 #define _gloffset_ResumeTransformFeedback driDispatchRemapTable[ResumeTransformFeedback_remap_index]
+#define _gloffset_ClearDepthf driDispatchRemapTable[ClearDepthf_remap_index]
+#define _gloffset_DepthRangef driDispatchRemapTable[DepthRangef_remap_index]
+#define _gloffset_GetShaderPrecisionFormat driDispatchRemapTable[GetShaderPrecisionFormat_remap_index]
+#define _gloffset_ReleaseShaderCompiler driDispatchRemapTable[ReleaseShaderCompiler_remap_index]
+#define _gloffset_ShaderBinary driDispatchRemapTable[ShaderBinary_remap_index]
 #define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index]
 #define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]
 #define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]
@@ -3701,6 +3716,21 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
 #define CALL_ResumeTransformFeedback(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), _gloffset_ResumeTransformFeedback, parameters)
 #define GET_ResumeTransformFeedback(disp) GET_by_offset(disp, _gloffset_ResumeTransformFeedback)
 #define SET_ResumeTransformFeedback(disp, fn) SET_by_offset(disp, _gloffset_ResumeTransformFeedback, fn)
+#define CALL_ClearDepthf(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf)), _gloffset_ClearDepthf, parameters)
+#define GET_ClearDepthf(disp) GET_by_offset(disp, _gloffset_ClearDepthf)
+#define SET_ClearDepthf(disp, fn) SET_by_offset(disp, _gloffset_ClearDepthf, fn)
+#define CALL_DepthRangef(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLclampf)), _gloffset_DepthRangef, parameters)
+#define GET_DepthRangef(disp) GET_by_offset(disp, _gloffset_DepthRangef)
+#define SET_DepthRangef(disp, fn) SET_by_offset(disp, _gloffset_DepthRangef, fn)
+#define CALL_GetShaderPrecisionFormat(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *, GLint *)), _gloffset_GetShaderPrecisionFormat, parameters)
+#define GET_GetShaderPrecisionFormat(disp) GET_by_offset(disp, _gloffset_GetShaderPrecisionFormat)
+#define SET_GetShaderPrecisionFormat(disp, fn) SET_by_offset(disp, _gloffset_GetShaderPrecisionFormat, fn)
+#define CALL_ReleaseShaderCompiler(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), _gloffset_ReleaseShaderCompiler, parameters)
+#define GET_ReleaseShaderCompiler(disp) GET_by_offset(disp, _gloffset_ReleaseShaderCompiler)
+#define SET_ReleaseShaderCompiler(disp, fn) SET_by_offset(disp, _gloffset_ReleaseShaderCompiler, fn)
+#define CALL_ShaderBinary(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei)), _gloffset_ShaderBinary, parameters)
+#define GET_ShaderBinary(disp) GET_by_offset(disp, _gloffset_ShaderBinary)
+#define SET_ShaderBinary(disp, fn) SET_by_offset(disp, _gloffset_ShaderBinary, fn)
 #define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), _gloffset_PolygonOffsetEXT, parameters)
 #define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, _gloffset_PolygonOffsetEXT)
 #define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, _gloffset_PolygonOffsetEXT, fn)
index 878f10d4a4387631614914405d141bf5b7330107..bdbd7519d37410cceb740cc9058f8ab7df73ddf5 100644 (file)
@@ -29,6 +29,7 @@
 #include "context.h"
 #include "hint.h"
 #include "imports.h"
+#include "mtypes.h"
 
 
 
index b98e3219c533688aaf413fc4ff34c89321e455d3..75bb92594161bfe004a67185f823683d4e3f0ffe 100644 (file)
@@ -28,6 +28,7 @@
 #include "colormac.h"
 #include "histogram.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "main/dispatch.h"
 
 
index df1527b47f1b1ec899d58b615c92656e07618709..909c18e7e60606792742bd37050160b1bc827e2f 100644 (file)
@@ -35,6 +35,8 @@
 #include "image.h"
 #include "imports.h"
 #include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 
 
 /**
@@ -154,6 +156,8 @@ _mesa_sizeof_type( GLenum type )
         return sizeof(GLdouble);
       case GL_HALF_FLOAT_ARB:
         return sizeof(GLhalfARB);
+      case GL_FIXED:
+        return sizeof(GLfixed);
       default:
          return -1;
    }
index bcca4edc1aa77dd3b898a1c5ea355f93672adba0..bd1fd7cfbf8d359b730b5563ce97b623b2c5e5a1 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "imports.h"
 #include "context.h"
+#include "mtypes.h"
 #include "version.h"
 
 #ifdef _GNU_SOURCE
@@ -88,7 +89,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
 #if defined(HAVE_POSIX_MEMALIGN)
    void *mem;
    int err = posix_memalign(& mem, alignment, bytes);
-   (void) err;
+   if (err)
+      return NULL;
    return mem;
 #elif defined(_WIN32) && defined(_MSC_VER)
    return _aligned_malloc(bytes, alignment);
index 105d4a327fbd02a5e430a8625342f6609a3ac0b8..76c7e1c9d1b44b2d8d94571e40e57ac48b04dc32 100644 (file)
@@ -40,6 +40,7 @@
 #include "context.h"
 #include "enums.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "matrix.h"
 #include "mtypes.h"
 #include "math/m_matrix.h"
index ad63b178df8c688d78947c93a342704e31380588..e073e17039f4c93dfba65d608e8e8dc26600e56f 100644 (file)
@@ -30,6 +30,7 @@
 #include "imports.h"
 #include "formats.h"
 #include "mipmap.h"
+#include "mtypes.h"
 #include "teximage.h"
 #include "texstore.h"
 #include "image.h"
index 417f8df8e341565b2efd94a01c4df20f4cf5a428..1522332e8a11f2e284bd3d8d51e9916dd61382d2 100644 (file)
@@ -40,6 +40,7 @@
 #include "glapi/glapi.h"
 #include "math/m_matrix.h"     /* GLmatrix */
 #include "main/simple_list.h"  /* struct simple_node */
+#include "main/formats.h"       /* MESA_FORMAT_COUNT */
 
 
 /**
@@ -2211,6 +2212,7 @@ struct gl_shader_compiler_options
    GLboolean EmitNoCont;                  /**< Emit CONT opcode? */
    GLboolean EmitNoMainReturn;            /**< Emit CONT/RET opcodes? */
    GLboolean EmitNoNoise;                 /**< Emit NOISE opcodes? */
+   GLboolean EmitNoPow;                   /**< Emit POW opcodes? */
 
    /**
     * \name Forms of indirect addressing the driver cannot do.
@@ -2580,6 +2582,7 @@ struct gl_program_constants
  */
 struct gl_constants
 {
+   GLint MaxTextureMbytes;      /**< Max memory per image, in MB */
    GLint MaxTextureLevels;      /**< Max mipmap levels. */ 
    GLint Max3DTextureLevels;    /**< Max mipmap levels for 3D textures */
    GLint MaxCubeTextureLevels;  /**< Max mipmap levels for cube textures */
@@ -2666,6 +2669,9 @@ struct gl_constants
 struct gl_extensions
 {
    GLboolean dummy;  /* don't remove this! */
+   GLboolean dummy_true;  /* Set true by _mesa_init_extensions(). */
+   GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
+   GLboolean ARB_ES2_compatibility;
    GLboolean ARB_blend_func_extended;
    GLboolean ARB_copy_buffer;
    GLboolean ARB_depth_buffer_float;
@@ -2781,6 +2787,7 @@ struct gl_extensions
    GLboolean EXT_vertex_array;
    GLboolean EXT_vertex_array_bgra;
    GLboolean EXT_vertex_array_set;
+   GLboolean OES_standard_derivatives;
    /* vendor extensions */
    GLboolean APPLE_client_storage;
    GLboolean APPLE_packed_pixels;
@@ -2820,6 +2827,7 @@ struct gl_extensions
    GLboolean OES_EGL_image;
    GLboolean OES_draw_texture;
    GLboolean EXT_texture_format_BGRA8888;
+   GLboolean extension_sentinel;
    /** The extension string */
    const GLubyte *String;
    /** Number of supported extensions */
@@ -3252,6 +3260,8 @@ struct gl_context
    /** software compression/decompression supported or not */
    GLboolean Mesa_DXTn;
 
+   GLboolean TextureFormatSupported[MESA_FORMAT_COUNT];
+
    /** 
     * Use dp4 (rather than mul/mad) instructions for position
     * transformation?
index 5487d45f56b54408ff1d28a500b70acf78a32020..67fdb8c9db9288cffc41aa890e28d274a573060c 100644 (file)
@@ -27,6 +27,7 @@
 #include "main/context.h"
 #include "main/macros.h"
 #include "main/multisample.h"
+#include "main/mtypes.h"
 
 
 /**
index 36cea3bb9a61007761239c8788c89224a9718795..dd198b8141ab76108039181758f777d31388f8cc 100644 (file)
@@ -42,6 +42,7 @@
 #include "main/hash.h"
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/mtypes.h"
 #include "main/nvprogram.h"
 #include "program/arbprogparse.h"
 #include "program/nvfragparse.h"
index fdb647c7ea855a82fdb34bc1b77314f11dd491f6..512835cb803d135e9e976bab2d3a307817c19246 100644 (file)
@@ -34,6 +34,7 @@
 #include "enums.h"
 #include "image.h"
 #include "imports.h"
+#include "mtypes.h"
 #include "pack.h"
 #include "pixeltransfer.h"
 #include "imports.h"
@@ -484,11 +485,25 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                            const struct gl_pixelstore_attrib *dstPacking,
                            GLbitfield transferOps)
 {
-   GLfloat luminance[MAX_WIDTH];
+   GLfloat *luminance;
    const GLint comps = _mesa_components_in_format(dstFormat);
    const GLboolean intDstFormat = _mesa_is_integer_format(dstFormat);
    GLuint i;
 
+   if (dstFormat == GL_LUMINANCE ||
+       dstFormat == GL_LUMINANCE_ALPHA ||
+       dstFormat == GL_LUMINANCE_INTEGER_EXT ||
+       dstFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT) {
+      luminance = (GLfloat *) malloc(n * sizeof(GLfloat));
+      if (!luminance) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
+         return;
+      }
+   }
+   else {
+      luminance = NULL;
+   }
+
    /* XXX
     * This test should probably go away.  Have the caller set/clear the
     * IMAGE_CLAMP_BIT as needed.
@@ -1907,6 +1922,8 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
          }
       }
    }
+
+   free(luminance);
 }
 
 
@@ -3462,7 +3479,12 @@ _mesa_unpack_color_span_chan( struct gl_context *ctx,
    {
       GLint dstComponents;
       GLint rDst, gDst, bDst, aDst, lDst, iDst;
-      GLfloat rgba[MAX_WIDTH][4];
+      GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+
+      if (!rgba) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+         return;
+      }
 
       dstComponents = _mesa_components_in_format( dstFormat );
       /* source & dest image formats should have been error checked by now */
@@ -3471,9 +3493,14 @@ _mesa_unpack_color_span_chan( struct gl_context *ctx,
       /*
        * Extract image data and convert to RGBA floats
        */
-      assert(n <= MAX_WIDTH);
       if (srcFormat == GL_COLOR_INDEX) {
-         GLuint indexes[MAX_WIDTH];
+         GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+
+         if (!indexes) {
+            _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+            return;
+         }
+
          extract_uint_indexes(n, indexes, srcFormat, srcType, source,
                               srcPacking);
 
@@ -3484,6 +3511,8 @@ _mesa_unpack_color_span_chan( struct gl_context *ctx,
             for (i = 0; i < n; i++) {
                dest[i] = (GLchan) (indexes[i] & 0xff);
             }
+            free(indexes);
+            free(rgba);
             return;
          }
          else {
@@ -3498,6 +3527,8 @@ _mesa_unpack_color_span_chan( struct gl_context *ctx,
           * with color indexes.
           */
          transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT);
+
+         free(indexes);
       }
       else {
          /* non-color index data */
@@ -3575,6 +3606,8 @@ _mesa_unpack_color_span_chan( struct gl_context *ctx,
             dst += dstComponents;
          }
       }
+
+      free(rgba);
    }
 }
 
@@ -3652,7 +3685,12 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
    {
       GLint dstComponents;
       GLint rDst, gDst, bDst, aDst, lDst, iDst;
-      GLfloat rgba[MAX_WIDTH][4];
+      GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+
+      if (!rgba) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+         return;
+      }
 
       dstComponents = _mesa_components_in_format( dstFormat );
       /* source & dest image formats should have been error checked by now */
@@ -3661,9 +3699,15 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
       /*
        * Extract image data and convert to RGBA floats
        */
-      assert(n <= MAX_WIDTH);
       if (srcFormat == GL_COLOR_INDEX) {
-         GLuint indexes[MAX_WIDTH];
+         GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+
+         if (!indexes) {
+            _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+            free(rgba);
+            return;
+         }
+
          extract_uint_indexes(n, indexes, srcFormat, srcType, source,
                               srcPacking);
 
@@ -3674,6 +3718,8 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
             for (i = 0; i < n; i++) {
                dest[i] = (GLchan) (indexes[i] & 0xff);
             }
+            free(indexes);
+            free(rgba);
             return;
          }
          else {
@@ -3688,6 +3734,8 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
           * with color indexes.
           */
          transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT);
+
+         free(indexes);
       }
       else {
          /* non-color index data */
@@ -3760,6 +3808,8 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
             dst += dstComponents;
          }
       }
+
+      free(rgba);
    }
 }
 
@@ -3776,9 +3826,12 @@ _mesa_unpack_color_span_uint(struct gl_context *ctx,
                              const GLvoid *source,
                              const struct gl_pixelstore_attrib *srcPacking)
 {
-   GLuint rgba[MAX_WIDTH][4];
+   GLuint (*rgba)[4] = (GLuint (*)[4]) malloc(n * 4 * sizeof(GLfloat));
 
-   ASSERT(n <= MAX_WIDTH);
+   if (!rgba) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+      return;
+   }
 
    ASSERT(dstFormat == GL_ALPHA ||
           dstFormat == GL_LUMINANCE ||
@@ -3912,6 +3965,8 @@ _mesa_unpack_color_span_uint(struct gl_context *ctx,
          }
       }
    }
+
+   free(rgba);
 }
 
 
@@ -3943,9 +3998,14 @@ _mesa_unpack_dudv_span_byte( struct gl_context *ctx,
    /* general solution */
    {
       GLint dstComponents;
-      GLfloat rgba[MAX_WIDTH][4];
       GLbyte *dst = dest;
       GLuint i;
+      GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+
+      if (!rgba) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+         return;
+      }
 
       dstComponents = _mesa_components_in_format( dstFormat );
       /* source & dest image formats should have been error checked by now */
@@ -3954,7 +4014,6 @@ _mesa_unpack_dudv_span_byte( struct gl_context *ctx,
       /*
        * Extract image data and convert to RGBA floats
        */
-      assert(n <= MAX_WIDTH);
       extract_float_rgba(n, rgba, srcFormat, srcType, source,
                          srcPacking->SwapBytes);
 
@@ -3970,6 +4029,8 @@ _mesa_unpack_dudv_span_byte( struct gl_context *ctx,
          dst[1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
          dst += dstComponents;
       }
+
+      free(rgba);
    }
 }
 
@@ -3988,7 +4049,7 @@ _mesa_unpack_dudv_span_byte( struct gl_context *ctx,
  *        transferOps - the pixel transfer operations to apply
  */
 void
-_mesa_unpack_index_span( const struct gl_context *ctx, GLuint n,
+_mesa_unpack_index_span( struct gl_context *ctx, GLuint n,
                          GLenum dstType, GLvoid *dest,
                          GLenum srcType, const GLvoid *source,
                          const struct gl_pixelstore_attrib *srcPacking,
@@ -4026,8 +4087,12 @@ _mesa_unpack_index_span( const struct gl_context *ctx, GLuint n,
       /*
        * general solution
        */
-      GLuint indexes[MAX_WIDTH];
-      assert(n <= MAX_WIDTH);
+      GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+
+      if (!indexes) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+         return;
+      }
 
       extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source,
                            srcPacking);
@@ -4061,19 +4126,24 @@ _mesa_unpack_index_span( const struct gl_context *ctx, GLuint n,
          default:
             _mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span");
       }
+
+      free(indexes);
    }
 }
 
 
 void
-_mesa_pack_index_span( const struct gl_context *ctx, GLuint n,
+_mesa_pack_index_span( struct gl_context *ctx, GLuint n,
                        GLenum dstType, GLvoid *dest, const GLuint *source,
                        const struct gl_pixelstore_attrib *dstPacking,
                        GLbitfield transferOps )
 {
-   GLuint indexes[MAX_WIDTH];
+   GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
 
-   ASSERT(n <= MAX_WIDTH);
+   if (!indexes) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
+      return;
+   }
 
    transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
 
@@ -4178,6 +4248,8 @@ _mesa_pack_index_span( const struct gl_context *ctx, GLuint n,
    default:
       _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
    }
+
+   free(indexes);
 }
 
 
@@ -4196,7 +4268,7 @@ _mesa_pack_index_span( const struct gl_context *ctx, GLuint n,
  *        transferOps - apply offset/bias/lookup ops?
  */
 void
-_mesa_unpack_stencil_span( const struct gl_context *ctx, GLuint n,
+_mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n,
                            GLenum dstType, GLvoid *dest,
                            GLenum srcType, const GLvoid *source,
                            const struct gl_pixelstore_attrib *srcPacking,
@@ -4240,8 +4312,12 @@ _mesa_unpack_stencil_span( const struct gl_context *ctx, GLuint n,
       /*
        * general solution
        */
-      GLuint indexes[MAX_WIDTH];
-      assert(n <= MAX_WIDTH);
+      GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+
+      if (!indexes) {
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil unpacking");
+         return;
+      }
 
       extract_uint_indexes(n, indexes, GL_STENCIL_INDEX, srcType, source,
                            srcPacking);
@@ -4286,18 +4362,23 @@ _mesa_unpack_stencil_span( const struct gl_context *ctx, GLuint n,
          default:
             _mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
       }
+
+      free(indexes);
    }
 }
 
 
 void
-_mesa_pack_stencil_span( const struct gl_context *ctx, GLuint n,
+_mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
                          GLenum dstType, GLvoid *dest, const GLstencil *source,
                          const struct gl_pixelstore_attrib *dstPacking )
 {
-   GLstencil stencil[MAX_WIDTH];
+   GLstencil *stencil = (GLstencil *) malloc(n * sizeof(GLstencil));
 
-   ASSERT(n <= MAX_WIDTH);
+   if (!stencil) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil packing");
+      return;
+   }
 
    if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset ||
        ctx->Pixel.MapStencilFlag) {
@@ -4436,6 +4517,8 @@ _mesa_pack_stencil_span( const struct gl_context *ctx, GLuint n,
    default:
       _mesa_problem(ctx, "bad type in _mesa_pack_index_span");
    }
+
+   free(stencil);
 }
 
 #define DEPTH_VALUES(GLTYPE, GLTYPE2FLOAT)                              \
@@ -4466,12 +4549,12 @@ _mesa_pack_stencil_span( const struct gl_context *ctx, GLuint n,
  *                  (ignored for GLfloat).
  */
 void
-_mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n,
+_mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
                          GLenum dstType, GLvoid *dest, GLuint depthMax,
                          GLenum srcType, const GLvoid *source,
                          const struct gl_pixelstore_attrib *srcPacking )
 {
-   GLfloat depthTemp[MAX_WIDTH], *depthValues;
+   GLfloat *depthTemp, *depthValues;
    GLboolean needClamp = GL_FALSE;
 
    /* Look for special cases first.
@@ -4517,6 +4600,12 @@ _mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n,
 
    /* general case path follows */
 
+   depthTemp = (GLfloat *) malloc(n * sizeof(GLfloat));
+   if (!depthTemp) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+      return;
+   }
+
    if (dstType == GL_FLOAT) {
       depthValues = (GLfloat *) dest;
    }
@@ -4599,6 +4688,7 @@ _mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n,
          break;
       default:
          _mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()");
+         free(depthTemp);
          return;
    }
 
@@ -4658,6 +4748,8 @@ _mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n,
       ASSERT(dstType == GL_FLOAT);
       /*ASSERT(depthMax == 1.0F);*/
    }
+
+   free(depthTemp);
 }
 
 
@@ -4665,13 +4757,15 @@ _mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n,
  * Pack an array of depth values.  The values are floats in [0,1].
  */
 void
-_mesa_pack_depth_span( const struct gl_context *ctx, GLuint n, GLvoid *dest,
+_mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest,
                        GLenum dstType, const GLfloat *depthSpan,
                        const struct gl_pixelstore_attrib *dstPacking )
 {
-   GLfloat depthCopy[MAX_WIDTH];
-
-   ASSERT(n <= MAX_WIDTH);
+   GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
+   if (!depthCopy) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
+      return;
+   }
 
    if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
       memcpy(depthCopy, depthSpan, n * sizeof(GLfloat));
@@ -4773,6 +4867,8 @@ _mesa_pack_depth_span( const struct gl_context *ctx, GLuint n, GLvoid *dest,
    default:
       _mesa_problem(ctx, "bad type in _mesa_pack_depth_span");
    }
+
+   free(depthCopy);
 }
 
 
@@ -4781,16 +4877,21 @@ _mesa_pack_depth_span( const struct gl_context *ctx, GLuint n, GLvoid *dest,
  * Pack depth and stencil values as GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8.
  */
 void
-_mesa_pack_depth_stencil_span(const struct gl_context *ctx, GLuint n, GLuint *dest,
+_mesa_pack_depth_stencil_span(struct gl_context *ctx, GLuint n, GLuint *dest,
                               const GLfloat *depthVals,
                               const GLstencil *stencilVals,
                               const struct gl_pixelstore_attrib *dstPacking)
 {
-   GLfloat depthCopy[MAX_WIDTH];
-   GLstencil stencilCopy[MAX_WIDTH];
+   GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
+   GLstencil *stencilCopy = (GLstencil *) malloc(n * sizeof(GLstencil));
    GLuint i;
 
-   ASSERT(n <= MAX_WIDTH);
+   if (!depthCopy || !stencilCopy) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
+      free(depthCopy);
+      free(stencilCopy);
+      return;
+   }
 
    if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
       memcpy(depthCopy, depthVals, n * sizeof(GLfloat));
@@ -4814,6 +4915,9 @@ _mesa_pack_depth_stencil_span(const struct gl_context *ctx, GLuint n, GLuint *de
    if (dstPacking->SwapBytes) {
       _mesa_swap4(dest, n);
    }
+
+   free(depthCopy);
+   free(stencilCopy);
 }
 
 
index 65d3f7a0fb2dbbd90c53b1c28616ab7374333a44..78238ea5839566088ff813a7800878884d260a84 100644 (file)
@@ -90,7 +90,7 @@ _mesa_unpack_dudv_span_byte(struct gl_context *ctx,
                             GLbitfield transferOps);
 
 extern void
-_mesa_unpack_index_span(const struct gl_context *ctx, GLuint n,
+_mesa_unpack_index_span(struct gl_context *ctx, GLuint n,
                         GLenum dstType, GLvoid *dest,
                         GLenum srcType, const GLvoid *source,
                         const struct gl_pixelstore_attrib *srcPacking,
@@ -98,39 +98,39 @@ _mesa_unpack_index_span(const struct gl_context *ctx, GLuint n,
 
 
 extern void
-_mesa_pack_index_span(const struct gl_context *ctx, GLuint n,
+_mesa_pack_index_span(struct gl_context *ctx, GLuint n,
                       GLenum dstType, GLvoid *dest, const GLuint *source,
                       const struct gl_pixelstore_attrib *dstPacking,
                       GLbitfield transferOps);
 
 
 extern void
-_mesa_unpack_stencil_span(const struct gl_context *ctx, GLuint n,
+_mesa_unpack_stencil_span(struct gl_context *ctx, GLuint n,
                           GLenum dstType, GLvoid *dest,
                           GLenum srcType, const GLvoid *source,
                           const struct gl_pixelstore_attrib *srcPacking,
                           GLbitfield transferOps);
 
 extern void
-_mesa_pack_stencil_span(const struct gl_context *ctx, GLuint n,
+_mesa_pack_stencil_span(struct gl_context *ctx, GLuint n,
                         GLenum dstType, GLvoid *dest, const GLstencil *source,
                         const struct gl_pixelstore_attrib *dstPacking);
 
 
 extern void
-_mesa_unpack_depth_span(const struct gl_context *ctx, GLuint n,
+_mesa_unpack_depth_span(struct gl_context *ctx, GLuint n,
                         GLenum dstType, GLvoid *dest, GLuint depthMax,
                         GLenum srcType, const GLvoid *source,
                         const struct gl_pixelstore_attrib *srcPacking);
 
 extern void
-_mesa_pack_depth_span(const struct gl_context *ctx, GLuint n, GLvoid *dest,
+_mesa_pack_depth_span(struct gl_context *ctx, GLuint n, GLvoid *dest,
                       GLenum dstType, const GLfloat *depthSpan,
                       const struct gl_pixelstore_attrib *dstPacking);
 
 
 extern void
-_mesa_pack_depth_stencil_span(const struct gl_context *ctx,
+_mesa_pack_depth_stencil_span(struct gl_context *ctx,
                               GLuint n, GLuint *dest,
                               const GLfloat *depthVals,
                               const GLstencil *stencilVals,
index 5f824b34294fe5cbe6d9f23c72420e584c99a118..0254980b89da6a88285e6426296a76d70d0bbd7d 100644 (file)
@@ -33,6 +33,7 @@
 #include "colormac.h"
 #include "context.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "pixel.h"
 #include "mtypes.h"
 #include "main/dispatch.h"
index b16d27a4ea5eaa62a9160db4cee879a181cb0059..9d78eec7fead4ff1f6b2c0fecf3a322b7052f4d9 100644 (file)
@@ -32,6 +32,7 @@
 #include "bufferobj.h"
 #include "context.h"
 #include "pixelstore.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 
 
index 711181fd89e1c6ad24ee96ea1eb7fc9bd93ccc73..c1832972f5b831992fbb0e98e5bc7c7dae73aa7e 100644 (file)
@@ -33,6 +33,7 @@
 #include "colormac.h"
 #include "pixeltransfer.h"
 #include "imports.h"
+#include "mtypes.h"
 
 
 /*
index 8874397720633fe65e36118388fd84b878ff07f8..ef6460b2f97fd213eafe7cabe0582d286667f18f 100644 (file)
@@ -28,6 +28,7 @@
 #include "hash.h"
 #include "imports.h"
 #include "queryobj.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "main/dispatch.h"
 
@@ -143,6 +144,11 @@ get_query_binding_point(struct gl_context *ctx, GLenum target)
          return &ctx->Query.CurrentOcclusionObject;
       else
          return NULL;
+   case GL_ANY_SAMPLES_PASSED:
+      if (ctx->Extensions.ARB_occlusion_query2)
+         return &ctx->Query.CurrentOcclusionObject;
+      else
+         return NULL;
    case GL_TIME_ELAPSED_EXT:
       if (ctx->Extensions.EXT_timer_query)
          return &ctx->Query.CurrentTimerObject;
@@ -378,11 +384,18 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
          if (!q->Ready)
             ctx->Driver.WaitQuery(ctx, q);
          /* if result is too large for returned type, clamp to max value */
-         if (q->Result > 0x7fffffff) {
-            *params = 0x7fffffff;
-         }
-         else {
-            *params = (GLint)q->Result;
+         if (q->Target == GL_ANY_SAMPLES_PASSED) {
+            if (q->Result)
+               *params = GL_TRUE;
+            else
+               *params = GL_FALSE;
+         } else {
+            if (q->Result > 0x7fffffff) {
+               *params = 0x7fffffff;
+            }
+            else {
+               *params = (GLint)q->Result;
+            }
          }
          break;
       case GL_QUERY_RESULT_AVAILABLE_ARB:
@@ -418,11 +431,18 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
          if (!q->Ready)
             ctx->Driver.WaitQuery(ctx, q);
          /* if result is too large for returned type, clamp to max value */
-         if (q->Result > 0xffffffff) {
-            *params = 0xffffffff;
-         }
-         else {
-            *params = (GLuint)q->Result;
+         if (q->Target == GL_ANY_SAMPLES_PASSED) {
+            if (q->Result)
+               *params = GL_TRUE;
+            else
+               *params = GL_FALSE;
+         } else {
+            if (q->Result > 0xffffffff) {
+               *params = 0xffffffff;
+            }
+            else {
+               *params = (GLuint)q->Result;
+            }
          }
          break;
       case GL_QUERY_RESULT_AVAILABLE_ARB:
index e289625731a18c40c43cdf4c6a2a71b79a30ea08..e4ad96ba5a32ab4db66bd1e9013da1dd00940d68 100644 (file)
@@ -27,6 +27,7 @@
 #define QUERYOBJ_H
 
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "main/hash.h"
 
index 6f52f07dfabf571f1648b62cf50bc96c3139952e..a1f6f4234160fb9894139826be20e7f05470390d 100644 (file)
@@ -32,6 +32,8 @@
 #include "context.h"
 #include "feedback.h"
 #include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "rastpos.h"
 #include "state.h"
 #include "main/dispatch.h"
index a5612e34ecf0a708689c19f816d066657557c185..e5b85ca32b47b04643ababcee2250990150fff30 100644 (file)
@@ -30,6 +30,7 @@
 #include "framebuffer.h"
 #include "formats.h"
 #include "image.h"
+#include "mtypes.h"
 #include "state.h"
 
 
index 7368c76e7e7473d48ddba5bad2bbc685396b0cfa..a332f5da64bf46462178dc3455a4ee1206885459 100644 (file)
@@ -70,4666 +70,4686 @@ static const char _mesa_function_pool[] =
    "\0"
    "glLoadIdentity\0"
    "\0"
-   /* _mesa_function_pool[216]: SampleCoverageARB (will be remapped) */
+   /* _mesa_function_pool[216]: GetCombinerOutputParameterfvNV (will be remapped) */
+   "iiip\0"
+   "glGetCombinerOutputParameterfvNV\0"
+   "\0"
+   /* _mesa_function_pool[255]: SampleCoverageARB (will be remapped) */
    "fi\0"
    "glSampleCoverage\0"
    "glSampleCoverageARB\0"
    "\0"
-   /* _mesa_function_pool[257]: ConvolutionFilter1D (offset 348) */
+   /* _mesa_function_pool[296]: ConvolutionFilter1D (offset 348) */
    "iiiiip\0"
    "glConvolutionFilter1D\0"
    "glConvolutionFilter1DEXT\0"
    "\0"
-   /* _mesa_function_pool[312]: BeginQueryARB (will be remapped) */
+   /* _mesa_function_pool[351]: BeginQueryARB (will be remapped) */
    "ii\0"
    "glBeginQuery\0"
    "glBeginQueryARB\0"
    "\0"
-   /* _mesa_function_pool[345]: RasterPos3dv (offset 71) */
+   /* _mesa_function_pool[384]: RasterPos3dv (offset 71) */
    "p\0"
    "glRasterPos3dv\0"
    "\0"
-   /* _mesa_function_pool[363]: PointParameteriNV (will be remapped) */
+   /* _mesa_function_pool[402]: PointParameteriNV (will be remapped) */
    "ii\0"
    "glPointParameteri\0"
    "glPointParameteriNV\0"
    "\0"
-   /* _mesa_function_pool[405]: GetProgramiv (will be remapped) */
+   /* _mesa_function_pool[444]: GetProgramiv (will be remapped) */
    "iip\0"
    "glGetProgramiv\0"
    "\0"
-   /* _mesa_function_pool[425]: MultiTexCoord3sARB (offset 398) */
+   /* _mesa_function_pool[464]: MultiTexCoord3sARB (offset 398) */
    "iiii\0"
    "glMultiTexCoord3s\0"
    "glMultiTexCoord3sARB\0"
    "\0"
-   /* _mesa_function_pool[470]: SecondaryColor3iEXT (will be remapped) */
+   /* _mesa_function_pool[509]: SecondaryColor3iEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3i\0"
    "glSecondaryColor3iEXT\0"
    "\0"
-   /* _mesa_function_pool[516]: WindowPos3fMESA (will be remapped) */
+   /* _mesa_function_pool[555]: WindowPos3fMESA (will be remapped) */
    "fff\0"
    "glWindowPos3f\0"
    "glWindowPos3fARB\0"
    "glWindowPos3fMESA\0"
    "\0"
-   /* _mesa_function_pool[570]: TexCoord1iv (offset 99) */
+   /* _mesa_function_pool[609]: TexCoord1iv (offset 99) */
    "p\0"
    "glTexCoord1iv\0"
    "\0"
-   /* _mesa_function_pool[587]: TexCoord4sv (offset 125) */
+   /* _mesa_function_pool[626]: TexCoord4sv (offset 125) */
    "p\0"
    "glTexCoord4sv\0"
    "\0"
-   /* _mesa_function_pool[604]: RasterPos4s (offset 84) */
+   /* _mesa_function_pool[643]: RasterPos4s (offset 84) */
    "iiii\0"
    "glRasterPos4s\0"
    "\0"
-   /* _mesa_function_pool[624]: PixelTexGenParameterfvSGIS (will be remapped) */
+   /* _mesa_function_pool[663]: PixelTexGenParameterfvSGIS (will be remapped) */
    "ip\0"
    "glPixelTexGenParameterfvSGIS\0"
    "\0"
-   /* _mesa_function_pool[657]: ActiveTextureARB (offset 374) */
+   /* _mesa_function_pool[696]: ActiveTextureARB (offset 374) */
    "i\0"
    "glActiveTexture\0"
    "glActiveTextureARB\0"
    "\0"
-   /* _mesa_function_pool[695]: BlitFramebufferEXT (will be remapped) */
+   /* _mesa_function_pool[734]: BlitFramebufferEXT (will be remapped) */
    "iiiiiiiiii\0"
    "glBlitFramebuffer\0"
    "glBlitFramebufferEXT\0"
    "\0"
-   /* _mesa_function_pool[746]: TexCoord1f (offset 96) */
+   /* _mesa_function_pool[785]: TexCoord1f (offset 96) */
    "f\0"
    "glTexCoord1f\0"
    "\0"
-   /* _mesa_function_pool[762]: TexCoord1d (offset 94) */
+   /* _mesa_function_pool[801]: TexCoord1d (offset 94) */
    "d\0"
    "glTexCoord1d\0"
    "\0"
-   /* _mesa_function_pool[778]: VertexAttrib4ubvNV (will be remapped) */
+   /* _mesa_function_pool[817]: VertexAttrib4ubvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib4ubvNV\0"
    "\0"
-   /* _mesa_function_pool[803]: TexCoord1i (offset 98) */
+   /* _mesa_function_pool[842]: TexCoord1i (offset 98) */
    "i\0"
    "glTexCoord1i\0"
    "\0"
-   /* _mesa_function_pool[819]: GetProgramNamedParameterdvNV (will be remapped) */
+   /* _mesa_function_pool[858]: GetProgramNamedParameterdvNV (will be remapped) */
    "iipp\0"
    "glGetProgramNamedParameterdvNV\0"
    "\0"
-   /* _mesa_function_pool[856]: Histogram (offset 367) */
+   /* _mesa_function_pool[895]: Histogram (offset 367) */
    "iiii\0"
    "glHistogram\0"
    "glHistogramEXT\0"
    "\0"
-   /* _mesa_function_pool[889]: TexCoord1s (offset 100) */
+   /* _mesa_function_pool[928]: TexCoord1s (offset 100) */
    "i\0"
    "glTexCoord1s\0"
    "\0"
-   /* _mesa_function_pool[905]: GetMapfv (offset 267) */
+   /* _mesa_function_pool[944]: GetMapfv (offset 267) */
    "iip\0"
    "glGetMapfv\0"
    "\0"
-   /* _mesa_function_pool[921]: EvalCoord1f (offset 230) */
+   /* _mesa_function_pool[960]: EvalCoord1f (offset 230) */
    "f\0"
    "glEvalCoord1f\0"
    "\0"
-   /* _mesa_function_pool[938]: FramebufferTexture (will be remapped) */
+   /* _mesa_function_pool[977]: FramebufferTexture (will be remapped) */
    "iiii\0"
    "glFramebufferTexture\0"
    "\0"
-   /* _mesa_function_pool[965]: VertexAttribI1ivEXT (will be remapped) */
+   /* _mesa_function_pool[1004]: VertexAttribI1ivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI1ivEXT\0"
    "glVertexAttribI1iv\0"
    "\0"
-   /* _mesa_function_pool[1010]: TexImage4DSGIS (dynamic) */
+   /* _mesa_function_pool[1049]: TexImage4DSGIS (dynamic) */
    "iiiiiiiiiip\0"
    "glTexImage4DSGIS\0"
    "\0"
-   /* _mesa_function_pool[1040]: PolygonStipple (offset 175) */
+   /* _mesa_function_pool[1079]: PolygonStipple (offset 175) */
    "p\0"
    "glPolygonStipple\0"
    "\0"
-   /* _mesa_function_pool[1060]: WindowPos2dvMESA (will be remapped) */
+   /* _mesa_function_pool[1099]: WindowPos2dvMESA (will be remapped) */
    "p\0"
    "glWindowPos2dv\0"
    "glWindowPos2dvARB\0"
    "glWindowPos2dvMESA\0"
    "\0"
-   /* _mesa_function_pool[1115]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[1154]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiColor3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1159]: BlendEquationSeparateEXT (will be remapped) */
+   /* _mesa_function_pool[1198]: BlendEquationSeparateEXT (will be remapped) */
    "ii\0"
    "glBlendEquationSeparate\0"
    "glBlendEquationSeparateEXT\0"
    "glBlendEquationSeparateATI\0"
    "\0"
-   /* _mesa_function_pool[1241]: ListParameterfSGIX (dynamic) */
+   /* _mesa_function_pool[1280]: ListParameterfSGIX (dynamic) */
    "iif\0"
    "glListParameterfSGIX\0"
    "\0"
-   /* _mesa_function_pool[1267]: SecondaryColor3bEXT (will be remapped) */
+   /* _mesa_function_pool[1306]: SecondaryColor3bEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3b\0"
    "glSecondaryColor3bEXT\0"
    "\0"
-   /* _mesa_function_pool[1313]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */
+   /* _mesa_function_pool[1352]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */
    "pppp\0"
    "glTexCoord4fColor4fNormal3fVertex4fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1359]: GetPixelMapfv (offset 271) */
+   /* _mesa_function_pool[1398]: GetPixelMapfv (offset 271) */
    "ip\0"
    "glGetPixelMapfv\0"
    "\0"
-   /* _mesa_function_pool[1379]: Color3uiv (offset 22) */
+   /* _mesa_function_pool[1418]: Color3uiv (offset 22) */
    "p\0"
    "glColor3uiv\0"
    "\0"
-   /* _mesa_function_pool[1394]: IsEnabled (offset 286) */
+   /* _mesa_function_pool[1433]: IsEnabled (offset 286) */
    "i\0"
    "glIsEnabled\0"
    "\0"
-   /* _mesa_function_pool[1409]: VertexAttrib4svNV (will be remapped) */
+   /* _mesa_function_pool[1448]: VertexAttrib4svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib4svNV\0"
    "\0"
-   /* _mesa_function_pool[1433]: EvalCoord2fv (offset 235) */
+   /* _mesa_function_pool[1472]: EvalCoord2fv (offset 235) */
    "p\0"
    "glEvalCoord2fv\0"
    "\0"
-   /* _mesa_function_pool[1451]: GetBufferSubDataARB (will be remapped) */
+   /* _mesa_function_pool[1490]: GetBufferSubDataARB (will be remapped) */
    "iiip\0"
    "glGetBufferSubData\0"
    "glGetBufferSubDataARB\0"
    "\0"
-   /* _mesa_function_pool[1498]: BufferSubDataARB (will be remapped) */
+   /* _mesa_function_pool[1537]: BufferSubDataARB (will be remapped) */
    "iiip\0"
    "glBufferSubData\0"
    "glBufferSubDataARB\0"
    "\0"
-   /* _mesa_function_pool[1539]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[1578]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */
    "ppp\0"
    "glTexCoord2fColor4ubVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1577]: AttachShader (will be remapped) */
+   /* _mesa_function_pool[1616]: AttachShader (will be remapped) */
    "ii\0"
    "glAttachShader\0"
    "\0"
-   /* _mesa_function_pool[1596]: VertexAttrib2fARB (will be remapped) */
+   /* _mesa_function_pool[1635]: VertexAttrib2fARB (will be remapped) */
    "iff\0"
    "glVertexAttrib2f\0"
    "glVertexAttrib2fARB\0"
    "\0"
-   /* _mesa_function_pool[1638]: GetDebugLogLengthMESA (dynamic) */
+   /* _mesa_function_pool[1677]: GetDebugLogLengthMESA (dynamic) */
    "iii\0"
    "glGetDebugLogLengthMESA\0"
    "\0"
-   /* _mesa_function_pool[1667]: GetMapiv (offset 268) */
+   /* _mesa_function_pool[1706]: GetMapiv (offset 268) */
    "iip\0"
    "glGetMapiv\0"
    "\0"
-   /* _mesa_function_pool[1683]: VertexAttrib3fARB (will be remapped) */
+   /* _mesa_function_pool[1722]: VertexAttrib3fARB (will be remapped) */
    "ifff\0"
    "glVertexAttrib3f\0"
    "glVertexAttrib3fARB\0"
    "\0"
-   /* _mesa_function_pool[1726]: Indexubv (offset 316) */
+   /* _mesa_function_pool[1765]: Indexubv (offset 316) */
    "p\0"
    "glIndexubv\0"
    "\0"
-   /* _mesa_function_pool[1740]: GetQueryivARB (will be remapped) */
+   /* _mesa_function_pool[1779]: GetQueryivARB (will be remapped) */
    "iip\0"
    "glGetQueryiv\0"
    "glGetQueryivARB\0"
    "\0"
-   /* _mesa_function_pool[1774]: TexImage3D (offset 371) */
+   /* _mesa_function_pool[1813]: TexImage3D (offset 371) */
    "iiiiiiiiip\0"
    "glTexImage3D\0"
    "glTexImage3DEXT\0"
    "\0"
-   /* _mesa_function_pool[1815]: BindFragDataLocationEXT (will be remapped) */
+   /* _mesa_function_pool[1854]: BindFragDataLocationEXT (will be remapped) */
    "iip\0"
    "glBindFragDataLocationEXT\0"
    "glBindFragDataLocation\0"
    "\0"
-   /* _mesa_function_pool[1869]: ReplacementCodeuiVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[1908]: ReplacementCodeuiVertex3fvSUN (dynamic) */
    "pp\0"
    "glReplacementCodeuiVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[1905]: EdgeFlagPointer (offset 312) */
+   /* _mesa_function_pool[1944]: EdgeFlagPointer (offset 312) */
    "ip\0"
    "glEdgeFlagPointer\0"
    "\0"
-   /* _mesa_function_pool[1927]: Color3ubv (offset 20) */
+   /* _mesa_function_pool[1966]: Color3ubv (offset 20) */
    "p\0"
    "glColor3ubv\0"
    "\0"
-   /* _mesa_function_pool[1942]: GetQueryObjectivARB (will be remapped) */
+   /* _mesa_function_pool[1981]: GetQueryObjectivARB (will be remapped) */
    "iip\0"
    "glGetQueryObjectiv\0"
    "glGetQueryObjectivARB\0"
    "\0"
-   /* _mesa_function_pool[1988]: Vertex3dv (offset 135) */
+   /* _mesa_function_pool[2027]: Vertex3dv (offset 135) */
    "p\0"
    "glVertex3dv\0"
    "\0"
-   /* _mesa_function_pool[2003]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[2042]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiTexCoord2fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[2050]: CompressedTexSubImage2DARB (will be remapped) */
+   /* _mesa_function_pool[2089]: CompressedTexSubImage2DARB (will be remapped) */
    "iiiiiiiip\0"
    "glCompressedTexSubImage2D\0"
    "glCompressedTexSubImage2DARB\0"
    "\0"
-   /* _mesa_function_pool[2116]: CombinerOutputNV (will be remapped) */
+   /* _mesa_function_pool[2155]: CombinerOutputNV (will be remapped) */
    "iiiiiiiiii\0"
    "glCombinerOutputNV\0"
    "\0"
-   /* _mesa_function_pool[2147]: VertexAttribs3fvNV (will be remapped) */
+   /* _mesa_function_pool[2186]: VertexAttribs3fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs3fvNV\0"
    "\0"
-   /* _mesa_function_pool[2173]: Uniform2fARB (will be remapped) */
+   /* _mesa_function_pool[2212]: Uniform2fARB (will be remapped) */
    "iff\0"
    "glUniform2f\0"
    "glUniform2fARB\0"
    "\0"
-   /* _mesa_function_pool[2205]: LightModeliv (offset 166) */
+   /* _mesa_function_pool[2244]: LightModeliv (offset 166) */
    "ip\0"
    "glLightModeliv\0"
    "\0"
-   /* _mesa_function_pool[2224]: VertexAttrib1svARB (will be remapped) */
+   /* _mesa_function_pool[2263]: VertexAttrib1svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib1sv\0"
    "glVertexAttrib1svARB\0"
    "\0"
-   /* _mesa_function_pool[2267]: VertexAttribs1dvNV (will be remapped) */
+   /* _mesa_function_pool[2306]: VertexAttribs1dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs1dvNV\0"
    "\0"
-   /* _mesa_function_pool[2293]: Uniform2ivARB (will be remapped) */
+   /* _mesa_function_pool[2332]: Uniform2ivARB (will be remapped) */
    "iip\0"
    "glUniform2iv\0"
    "glUniform2ivARB\0"
    "\0"
-   /* _mesa_function_pool[2327]: GetImageTransformParameterfvHP (dynamic) */
+   /* _mesa_function_pool[2366]: GetImageTransformParameterfvHP (dynamic) */
    "iip\0"
    "glGetImageTransformParameterfvHP\0"
    "\0"
-   /* _mesa_function_pool[2365]: Normal3bv (offset 53) */
+   /* _mesa_function_pool[2404]: Normal3bv (offset 53) */
    "p\0"
    "glNormal3bv\0"
    "\0"
-   /* _mesa_function_pool[2380]: TexGeniv (offset 193) */
+   /* _mesa_function_pool[2419]: TexGeniv (offset 193) */
    "iip\0"
    "glTexGeniv\0"
    "\0"
-   /* _mesa_function_pool[2396]: WeightubvARB (dynamic) */
+   /* _mesa_function_pool[2435]: WeightubvARB (dynamic) */
    "ip\0"
    "glWeightubvARB\0"
    "\0"
-   /* _mesa_function_pool[2415]: VertexAttrib1fvNV (will be remapped) */
+   /* _mesa_function_pool[2454]: VertexAttrib1fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib1fvNV\0"
    "\0"
-   /* _mesa_function_pool[2439]: Vertex3iv (offset 139) */
+   /* _mesa_function_pool[2478]: Vertex3iv (offset 139) */
    "p\0"
    "glVertex3iv\0"
    "\0"
-   /* _mesa_function_pool[2454]: CopyConvolutionFilter1D (offset 354) */
+   /* _mesa_function_pool[2493]: CopyConvolutionFilter1D (offset 354) */
    "iiiii\0"
    "glCopyConvolutionFilter1D\0"
    "glCopyConvolutionFilter1DEXT\0"
    "\0"
-   /* _mesa_function_pool[2516]: VertexAttribI1uiEXT (will be remapped) */
+   /* _mesa_function_pool[2555]: VertexAttribI1uiEXT (will be remapped) */
    "ii\0"
    "glVertexAttribI1uiEXT\0"
    "glVertexAttribI1ui\0"
    "\0"
-   /* _mesa_function_pool[2561]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[2600]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */
    "iffffff\0"
    "glReplacementCodeuiNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[2609]: DeleteSync (will be remapped) */
+   /* _mesa_function_pool[2648]: DeleteSync (will be remapped) */
    "i\0"
    "glDeleteSync\0"
    "\0"
-   /* _mesa_function_pool[2625]: FragmentMaterialfvSGIX (dynamic) */
+   /* _mesa_function_pool[2664]: FragmentMaterialfvSGIX (dynamic) */
    "iip\0"
    "glFragmentMaterialfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[2655]: BlendColor (offset 336) */
+   /* _mesa_function_pool[2694]: BlendColor (offset 336) */
    "ffff\0"
    "glBlendColor\0"
    "glBlendColorEXT\0"
    "\0"
-   /* _mesa_function_pool[2690]: UniformMatrix4fvARB (will be remapped) */
+   /* _mesa_function_pool[2729]: UniformMatrix4fvARB (will be remapped) */
    "iiip\0"
    "glUniformMatrix4fv\0"
    "glUniformMatrix4fvARB\0"
    "\0"
-   /* _mesa_function_pool[2737]: DeleteVertexArraysAPPLE (will be remapped) */
+   /* _mesa_function_pool[2776]: DeleteVertexArraysAPPLE (will be remapped) */
    "ip\0"
    "glDeleteVertexArrays\0"
    "glDeleteVertexArraysAPPLE\0"
    "\0"
-   /* _mesa_function_pool[2788]: TexBuffer (will be remapped) */
+   /* _mesa_function_pool[2827]: TexBuffer (will be remapped) */
    "iii\0"
    "glTexBuffer\0"
    "\0"
-   /* _mesa_function_pool[2805]: ReadInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[2844]: ReadInstrumentsSGIX (dynamic) */
    "i\0"
    "glReadInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[2830]: CallLists (offset 3) */
+   /* _mesa_function_pool[2869]: CallLists (offset 3) */
    "iip\0"
    "glCallLists\0"
    "\0"
-   /* _mesa_function_pool[2847]: UniformMatrix2x4fv (will be remapped) */
+   /* _mesa_function_pool[2886]: UniformMatrix2x4fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix2x4fv\0"
    "\0"
-   /* _mesa_function_pool[2874]: Color4ubVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[2913]: Color4ubVertex3fvSUN (dynamic) */
    "pp\0"
    "glColor4ubVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[2901]: Normal3iv (offset 59) */
+   /* _mesa_function_pool[2940]: Normal3iv (offset 59) */
    "p\0"
    "glNormal3iv\0"
    "\0"
-   /* _mesa_function_pool[2916]: PassThrough (offset 199) */
+   /* _mesa_function_pool[2955]: PassThrough (offset 199) */
    "f\0"
    "glPassThrough\0"
    "\0"
-   /* _mesa_function_pool[2933]: GetVertexAttribIivEXT (will be remapped) */
+   /* _mesa_function_pool[2972]: GetVertexAttribIivEXT (will be remapped) */
    "iip\0"
    "glGetVertexAttribIivEXT\0"
    "glGetVertexAttribIiv\0"
    "\0"
-   /* _mesa_function_pool[2983]: TexParameterIivEXT (will be remapped) */
+   /* _mesa_function_pool[3022]: TexParameterIivEXT (will be remapped) */
    "iip\0"
    "glTexParameterIivEXT\0"
    "glTexParameterIiv\0"
    "\0"
-   /* _mesa_function_pool[3027]: FramebufferTextureLayerEXT (will be remapped) */
+   /* _mesa_function_pool[3066]: FramebufferTextureLayerEXT (will be remapped) */
    "iiiii\0"
    "glFramebufferTextureLayer\0"
    "glFramebufferTextureLayerEXT\0"
    "\0"
-   /* _mesa_function_pool[3089]: GetListParameterfvSGIX (dynamic) */
+   /* _mesa_function_pool[3128]: GetListParameterfvSGIX (dynamic) */
    "iip\0"
    "glGetListParameterfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[3119]: Viewport (offset 305) */
+   /* _mesa_function_pool[3158]: Viewport (offset 305) */
    "iiii\0"
    "glViewport\0"
    "\0"
-   /* _mesa_function_pool[3136]: VertexAttrib4NusvARB (will be remapped) */
+   /* _mesa_function_pool[3175]: VertexAttrib4NusvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nusv\0"
    "glVertexAttrib4NusvARB\0"
    "\0"
-   /* _mesa_function_pool[3183]: WindowPos4svMESA (will be remapped) */
+   /* _mesa_function_pool[3222]: WindowPos4svMESA (will be remapped) */
    "p\0"
    "glWindowPos4svMESA\0"
    "\0"
-   /* _mesa_function_pool[3205]: CreateProgramObjectARB (will be remapped) */
+   /* _mesa_function_pool[3244]: CreateProgramObjectARB (will be remapped) */
    "\0"
    "glCreateProgramObjectARB\0"
    "\0"
-   /* _mesa_function_pool[3232]: DeleteTransformFeedbacks (will be remapped) */
+   /* _mesa_function_pool[3271]: DeleteTransformFeedbacks (will be remapped) */
    "ip\0"
    "glDeleteTransformFeedbacks\0"
    "\0"
-   /* _mesa_function_pool[3263]: UniformMatrix4x3fv (will be remapped) */
+   /* _mesa_function_pool[3302]: UniformMatrix4x3fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix4x3fv\0"
    "\0"
-   /* _mesa_function_pool[3290]: PrioritizeTextures (offset 331) */
+   /* _mesa_function_pool[3329]: PrioritizeTextures (offset 331) */
    "ipp\0"
    "glPrioritizeTextures\0"
    "glPrioritizeTexturesEXT\0"
    "\0"
-   /* _mesa_function_pool[3340]: VertexAttribI3uiEXT (will be remapped) */
+   /* _mesa_function_pool[3379]: VertexAttribI3uiEXT (will be remapped) */
    "iiii\0"
    "glVertexAttribI3uiEXT\0"
    "glVertexAttribI3ui\0"
    "\0"
-   /* _mesa_function_pool[3387]: AsyncMarkerSGIX (dynamic) */
+   /* _mesa_function_pool[3426]: AsyncMarkerSGIX (dynamic) */
    "i\0"
    "glAsyncMarkerSGIX\0"
    "\0"
-   /* _mesa_function_pool[3408]: GlobalAlphaFactorubSUN (dynamic) */
+   /* _mesa_function_pool[3447]: GlobalAlphaFactorubSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorubSUN\0"
    "\0"
-   /* _mesa_function_pool[3436]: ClearColorIuiEXT (will be remapped) */
+   /* _mesa_function_pool[3475]: ClearColorIuiEXT (will be remapped) */
    "iiii\0"
    "glClearColorIuiEXT\0"
    "\0"
-   /* _mesa_function_pool[3461]: ClearDebugLogMESA (dynamic) */
+   /* _mesa_function_pool[3500]: ClearDebugLogMESA (dynamic) */
    "iii\0"
    "glClearDebugLogMESA\0"
    "\0"
-   /* _mesa_function_pool[3486]: Uniform4uiEXT (will be remapped) */
+   /* _mesa_function_pool[3525]: Uniform4uiEXT (will be remapped) */
    "iiiii\0"
    "glUniform4uiEXT\0"
    "glUniform4ui\0"
    "\0"
-   /* _mesa_function_pool[3522]: ResetHistogram (offset 369) */
+   /* _mesa_function_pool[3561]: ResetHistogram (offset 369) */
    "i\0"
    "glResetHistogram\0"
    "glResetHistogramEXT\0"
    "\0"
-   /* _mesa_function_pool[3562]: GetProgramNamedParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[3601]: GetProgramNamedParameterfvNV (will be remapped) */
    "iipp\0"
    "glGetProgramNamedParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[3599]: PointParameterfEXT (will be remapped) */
+   /* _mesa_function_pool[3638]: PointParameterfEXT (will be remapped) */
    "if\0"
    "glPointParameterf\0"
    "glPointParameterfARB\0"
    "glPointParameterfEXT\0"
    "glPointParameterfSGIS\0"
    "\0"
-   /* _mesa_function_pool[3685]: LoadIdentityDeformationMapSGIX (dynamic) */
+   /* _mesa_function_pool[3724]: LoadIdentityDeformationMapSGIX (dynamic) */
    "i\0"
    "glLoadIdentityDeformationMapSGIX\0"
    "\0"
-   /* _mesa_function_pool[3721]: GenFencesNV (will be remapped) */
+   /* _mesa_function_pool[3760]: GenFencesNV (will be remapped) */
    "ip\0"
    "glGenFencesNV\0"
    "\0"
-   /* _mesa_function_pool[3739]: ImageTransformParameterfHP (dynamic) */
+   /* _mesa_function_pool[3778]: ImageTransformParameterfHP (dynamic) */
    "iif\0"
    "glImageTransformParameterfHP\0"
    "\0"
-   /* _mesa_function_pool[3773]: MatrixIndexusvARB (dynamic) */
+   /* _mesa_function_pool[3812]: MatrixIndexusvARB (dynamic) */
    "ip\0"
    "glMatrixIndexusvARB\0"
    "\0"
-   /* _mesa_function_pool[3797]: DrawElementsBaseVertex (will be remapped) */
+   /* _mesa_function_pool[3836]: DrawElementsBaseVertex (will be remapped) */
    "iiipi\0"
    "glDrawElementsBaseVertex\0"
    "\0"
-   /* _mesa_function_pool[3829]: DisableVertexAttribArrayARB (will be remapped) */
+   /* _mesa_function_pool[3868]: DisableVertexAttribArrayARB (will be remapped) */
    "i\0"
    "glDisableVertexAttribArray\0"
    "glDisableVertexAttribArrayARB\0"
    "\0"
-   /* _mesa_function_pool[3889]: TexCoord2sv (offset 109) */
+   /* _mesa_function_pool[3928]: TexCoord2sv (offset 109) */
    "p\0"
    "glTexCoord2sv\0"
    "\0"
-   /* _mesa_function_pool[3906]: Vertex4dv (offset 143) */
+   /* _mesa_function_pool[3945]: Vertex4dv (offset 143) */
    "p\0"
    "glVertex4dv\0"
    "\0"
-   /* _mesa_function_pool[3921]: StencilMaskSeparate (will be remapped) */
+   /* _mesa_function_pool[3960]: StencilMaskSeparate (will be remapped) */
    "ii\0"
    "glStencilMaskSeparate\0"
    "\0"
-   /* _mesa_function_pool[3947]: ProgramLocalParameter4dARB (will be remapped) */
+   /* _mesa_function_pool[3986]: ProgramLocalParameter4dARB (will be remapped) */
    "iidddd\0"
    "glProgramLocalParameter4dARB\0"
    "\0"
-   /* _mesa_function_pool[3984]: CompressedTexImage3DARB (will be remapped) */
+   /* _mesa_function_pool[4023]: CompressedTexImage3DARB (will be remapped) */
    "iiiiiiiip\0"
    "glCompressedTexImage3D\0"
    "glCompressedTexImage3DARB\0"
    "\0"
-   /* _mesa_function_pool[4044]: Color3sv (offset 18) */
+   /* _mesa_function_pool[4083]: Color3sv (offset 18) */
    "p\0"
    "glColor3sv\0"
    "\0"
-   /* _mesa_function_pool[4058]: GetConvolutionParameteriv (offset 358) */
+   /* _mesa_function_pool[4097]: GetConvolutionParameteriv (offset 358) */
    "iip\0"
    "glGetConvolutionParameteriv\0"
    "glGetConvolutionParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[4122]: VertexAttrib1fARB (will be remapped) */
+   /* _mesa_function_pool[4161]: VertexAttrib1fARB (will be remapped) */
    "if\0"
    "glVertexAttrib1f\0"
    "glVertexAttrib1fARB\0"
    "\0"
-   /* _mesa_function_pool[4163]: Vertex2dv (offset 127) */
+   /* _mesa_function_pool[4202]: Vertex2dv (offset 127) */
    "p\0"
    "glVertex2dv\0"
    "\0"
-   /* _mesa_function_pool[4178]: TestFenceNV (will be remapped) */
+   /* _mesa_function_pool[4217]: TestFenceNV (will be remapped) */
    "i\0"
    "glTestFenceNV\0"
    "\0"
-   /* _mesa_function_pool[4195]: GetVertexAttribIuivEXT (will be remapped) */
-   "iip\0"
-   "glGetVertexAttribIuivEXT\0"
-   "glGetVertexAttribIuiv\0"
-   "\0"
-   /* _mesa_function_pool[4247]: MultiTexCoord1fvARB (offset 379) */
+   /* _mesa_function_pool[4234]: MultiTexCoord1fvARB (offset 379) */
    "ip\0"
    "glMultiTexCoord1fv\0"
    "glMultiTexCoord1fvARB\0"
    "\0"
-   /* _mesa_function_pool[4292]: TexCoord3iv (offset 115) */
+   /* _mesa_function_pool[4279]: TexCoord3iv (offset 115) */
    "p\0"
    "glTexCoord3iv\0"
    "\0"
-   /* _mesa_function_pool[4309]: Uniform2uivEXT (will be remapped) */
+   /* _mesa_function_pool[4296]: Uniform2uivEXT (will be remapped) */
    "iip\0"
    "glUniform2uivEXT\0"
    "glUniform2uiv\0"
    "\0"
-   /* _mesa_function_pool[4345]: ColorFragmentOp2ATI (will be remapped) */
+   /* _mesa_function_pool[4332]: ColorFragmentOp2ATI (will be remapped) */
    "iiiiiiiiii\0"
    "glColorFragmentOp2ATI\0"
    "\0"
-   /* _mesa_function_pool[4379]: SecondaryColorPointerListIBM (dynamic) */
+   /* _mesa_function_pool[4366]: SecondaryColorPointerListIBM (dynamic) */
    "iiipi\0"
    "glSecondaryColorPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[4417]: GetPixelTexGenParameterivSGIS (will be remapped) */
+   /* _mesa_function_pool[4404]: GetPixelTexGenParameterivSGIS (will be remapped) */
    "ip\0"
    "glGetPixelTexGenParameterivSGIS\0"
    "\0"
-   /* _mesa_function_pool[4453]: Color3fv (offset 14) */
+   /* _mesa_function_pool[4440]: Color3fv (offset 14) */
    "p\0"
    "glColor3fv\0"
    "\0"
-   /* _mesa_function_pool[4467]: VertexAttrib4fNV (will be remapped) */
+   /* _mesa_function_pool[4454]: VertexAttrib4fNV (will be remapped) */
    "iffff\0"
    "glVertexAttrib4fNV\0"
    "\0"
-   /* _mesa_function_pool[4493]: ReplacementCodeubSUN (dynamic) */
+   /* _mesa_function_pool[4480]: ReplacementCodeubSUN (dynamic) */
    "i\0"
    "glReplacementCodeubSUN\0"
    "\0"
-   /* _mesa_function_pool[4519]: FinishAsyncSGIX (dynamic) */
+   /* _mesa_function_pool[4506]: FinishAsyncSGIX (dynamic) */
    "p\0"
    "glFinishAsyncSGIX\0"
    "\0"
-   /* _mesa_function_pool[4540]: GetDebugLogMESA (dynamic) */
+   /* _mesa_function_pool[4527]: GetDebugLogMESA (dynamic) */
    "iiiipp\0"
    "glGetDebugLogMESA\0"
    "\0"
-   /* _mesa_function_pool[4566]: FogCoorddEXT (will be remapped) */
+   /* _mesa_function_pool[4553]: FogCoorddEXT (will be remapped) */
    "d\0"
    "glFogCoordd\0"
    "glFogCoorddEXT\0"
    "\0"
-   /* _mesa_function_pool[4596]: BeginConditionalRenderNV (will be remapped) */
+   /* _mesa_function_pool[4583]: BeginConditionalRenderNV (will be remapped) */
    "ii\0"
    "glBeginConditionalRenderNV\0"
    "glBeginConditionalRender\0"
    "\0"
-   /* _mesa_function_pool[4652]: Color4ubVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[4639]: Color4ubVertex3fSUN (dynamic) */
    "iiiifff\0"
    "glColor4ubVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[4683]: FogCoordfEXT (will be remapped) */
+   /* _mesa_function_pool[4670]: FogCoordfEXT (will be remapped) */
    "f\0"
    "glFogCoordf\0"
    "glFogCoordfEXT\0"
    "\0"
-   /* _mesa_function_pool[4713]: PointSize (offset 173) */
+   /* _mesa_function_pool[4700]: PointSize (offset 173) */
    "f\0"
    "glPointSize\0"
    "\0"
-   /* _mesa_function_pool[4728]: VertexAttribI2uivEXT (will be remapped) */
+   /* _mesa_function_pool[4715]: VertexAttribI2uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI2uivEXT\0"
    "glVertexAttribI2uiv\0"
    "\0"
-   /* _mesa_function_pool[4775]: TexCoord2fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[4762]: TexCoord2fVertex3fSUN (dynamic) */
    "fffff\0"
    "glTexCoord2fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[4806]: PopName (offset 200) */
+   /* _mesa_function_pool[4793]: PopName (offset 200) */
    "\0"
    "glPopName\0"
    "\0"
-   /* _mesa_function_pool[4818]: GlobalAlphaFactoriSUN (dynamic) */
+   /* _mesa_function_pool[4805]: GlobalAlphaFactoriSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactoriSUN\0"
    "\0"
-   /* _mesa_function_pool[4845]: VertexAttrib2dNV (will be remapped) */
+   /* _mesa_function_pool[4832]: VertexAttrib2dNV (will be remapped) */
    "idd\0"
    "glVertexAttrib2dNV\0"
    "\0"
-   /* _mesa_function_pool[4869]: GetProgramInfoLog (will be remapped) */
+   /* _mesa_function_pool[4856]: GetProgramInfoLog (will be remapped) */
    "iipp\0"
    "glGetProgramInfoLog\0"
    "\0"
-   /* _mesa_function_pool[4895]: VertexAttrib4NbvARB (will be remapped) */
+   /* _mesa_function_pool[4882]: VertexAttrib4NbvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nbv\0"
    "glVertexAttrib4NbvARB\0"
    "\0"
-   /* _mesa_function_pool[4940]: GetActiveAttribARB (will be remapped) */
+   /* _mesa_function_pool[4927]: GetActiveAttribARB (will be remapped) */
    "iiipppp\0"
    "glGetActiveAttrib\0"
    "glGetActiveAttribARB\0"
    "\0"
-   /* _mesa_function_pool[4988]: Vertex4sv (offset 149) */
+   /* _mesa_function_pool[4975]: Vertex4sv (offset 149) */
    "p\0"
    "glVertex4sv\0"
    "\0"
-   /* _mesa_function_pool[5003]: VertexAttrib4ubNV (will be remapped) */
+   /* _mesa_function_pool[4990]: VertexAttrib4ubNV (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4ubNV\0"
    "\0"
-   /* _mesa_function_pool[5030]: ClampColor (will be remapped) */
+   /* _mesa_function_pool[5017]: ClampColor (will be remapped) */
    "ii\0"
    "glClampColor\0"
    "\0"
-   /* _mesa_function_pool[5047]: TextureRangeAPPLE (will be remapped) */
+   /* _mesa_function_pool[5034]: TextureRangeAPPLE (will be remapped) */
    "iip\0"
    "glTextureRangeAPPLE\0"
    "\0"
-   /* _mesa_function_pool[5072]: GetTexEnvfv (offset 276) */
+   /* _mesa_function_pool[5059]: GetTexEnvfv (offset 276) */
    "iip\0"
    "glGetTexEnvfv\0"
    "\0"
-   /* _mesa_function_pool[5091]: BindTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[5078]: BindTransformFeedback (will be remapped) */
    "ii\0"
    "glBindTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[5119]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[5106]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
    "ffffffffffff\0"
    "glTexCoord2fColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[5172]: Indexub (offset 315) */
+   /* _mesa_function_pool[5159]: Indexub (offset 315) */
    "i\0"
    "glIndexub\0"
    "\0"
-   /* _mesa_function_pool[5185]: TexEnvi (offset 186) */
+   /* _mesa_function_pool[5172]: ColorMaskIndexedEXT (will be remapped) */
+   "iiiii\0"
+   "glColorMaskIndexedEXT\0"
+   "glColorMaski\0"
+   "\0"
+   /* _mesa_function_pool[5214]: TexEnvi (offset 186) */
    "iii\0"
    "glTexEnvi\0"
    "\0"
-   /* _mesa_function_pool[5200]: GetClipPlane (offset 259) */
+   /* _mesa_function_pool[5229]: GetClipPlane (offset 259) */
    "ip\0"
    "glGetClipPlane\0"
    "\0"
-   /* _mesa_function_pool[5219]: CombinerParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[5248]: CombinerParameterfvNV (will be remapped) */
    "ip\0"
    "glCombinerParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[5247]: VertexAttribs3dvNV (will be remapped) */
+   /* _mesa_function_pool[5276]: VertexAttribs3dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs3dvNV\0"
    "\0"
-   /* _mesa_function_pool[5273]: VertexAttribI2uiEXT (will be remapped) */
+   /* _mesa_function_pool[5302]: VertexAttribI2uiEXT (will be remapped) */
    "iii\0"
    "glVertexAttribI2uiEXT\0"
    "glVertexAttribI2ui\0"
    "\0"
-   /* _mesa_function_pool[5319]: VertexAttribs4fvNV (will be remapped) */
+   /* _mesa_function_pool[5348]: VertexAttribs4fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4fvNV\0"
    "\0"
-   /* _mesa_function_pool[5345]: VertexArrayRangeNV (will be remapped) */
+   /* _mesa_function_pool[5374]: VertexArrayRangeNV (will be remapped) */
    "ip\0"
    "glVertexArrayRangeNV\0"
    "\0"
-   /* _mesa_function_pool[5370]: FragmentLightiSGIX (dynamic) */
+   /* _mesa_function_pool[5399]: FragmentLightiSGIX (dynamic) */
    "iii\0"
    "glFragmentLightiSGIX\0"
    "\0"
-   /* _mesa_function_pool[5396]: PolygonOffsetEXT (will be remapped) */
+   /* _mesa_function_pool[5425]: PolygonOffsetEXT (will be remapped) */
    "ff\0"
    "glPolygonOffsetEXT\0"
    "\0"
-   /* _mesa_function_pool[5419]: VertexAttribI4uivEXT (will be remapped) */
+   /* _mesa_function_pool[5448]: VertexAttribI4uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4uivEXT\0"
    "glVertexAttribI4uiv\0"
    "\0"
-   /* _mesa_function_pool[5466]: PollAsyncSGIX (dynamic) */
+   /* _mesa_function_pool[5495]: PollAsyncSGIX (dynamic) */
    "p\0"
    "glPollAsyncSGIX\0"
    "\0"
-   /* _mesa_function_pool[5485]: DeleteFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[5514]: DeleteFragmentShaderATI (will be remapped) */
    "i\0"
    "glDeleteFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[5514]: Scaled (offset 301) */
+   /* _mesa_function_pool[5543]: Scaled (offset 301) */
    "ddd\0"
    "glScaled\0"
    "\0"
-   /* _mesa_function_pool[5528]: ResumeTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[5557]: ResumeTransformFeedback (will be remapped) */
    "\0"
    "glResumeTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[5556]: Scalef (offset 302) */
+   /* _mesa_function_pool[5585]: Scalef (offset 302) */
    "fff\0"
    "glScalef\0"
    "\0"
-   /* _mesa_function_pool[5570]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[5599]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glTexCoord2fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[5608]: MultTransposeMatrixdARB (will be remapped) */
+   /* _mesa_function_pool[5637]: MultTransposeMatrixdARB (will be remapped) */
    "p\0"
    "glMultTransposeMatrixd\0"
    "glMultTransposeMatrixdARB\0"
    "\0"
-   /* _mesa_function_pool[5660]: ColorMaskIndexedEXT (will be remapped) */
-   "iiiii\0"
-   "glColorMaskIndexedEXT\0"
-   "glColorMaski\0"
-   "\0"
-   /* _mesa_function_pool[5702]: ObjectUnpurgeableAPPLE (will be remapped) */
+   /* _mesa_function_pool[5689]: ObjectUnpurgeableAPPLE (will be remapped) */
    "iii\0"
    "glObjectUnpurgeableAPPLE\0"
    "\0"
-   /* _mesa_function_pool[5732]: AlphaFunc (offset 240) */
+   /* _mesa_function_pool[5719]: AlphaFunc (offset 240) */
    "if\0"
    "glAlphaFunc\0"
    "\0"
-   /* _mesa_function_pool[5748]: WindowPos2svMESA (will be remapped) */
+   /* _mesa_function_pool[5735]: WindowPos2svMESA (will be remapped) */
    "p\0"
    "glWindowPos2sv\0"
    "glWindowPos2svARB\0"
    "glWindowPos2svMESA\0"
    "\0"
-   /* _mesa_function_pool[5803]: EdgeFlag (offset 41) */
+   /* _mesa_function_pool[5790]: EdgeFlag (offset 41) */
    "i\0"
    "glEdgeFlag\0"
    "\0"
-   /* _mesa_function_pool[5817]: TexCoord2iv (offset 107) */
+   /* _mesa_function_pool[5804]: TexCoord2iv (offset 107) */
    "p\0"
    "glTexCoord2iv\0"
    "\0"
-   /* _mesa_function_pool[5834]: CompressedTexImage1DARB (will be remapped) */
+   /* _mesa_function_pool[5821]: CompressedTexImage1DARB (will be remapped) */
    "iiiiiip\0"
    "glCompressedTexImage1D\0"
    "glCompressedTexImage1DARB\0"
    "\0"
-   /* _mesa_function_pool[5892]: Rotated (offset 299) */
+   /* _mesa_function_pool[5879]: Rotated (offset 299) */
    "dddd\0"
    "glRotated\0"
    "\0"
-   /* _mesa_function_pool[5908]: GetTexParameterIuivEXT (will be remapped) */
+   /* _mesa_function_pool[5895]: GetTexParameterIuivEXT (will be remapped) */
    "iip\0"
    "glGetTexParameterIuivEXT\0"
    "glGetTexParameterIuiv\0"
    "\0"
-   /* _mesa_function_pool[5960]: VertexAttrib2sNV (will be remapped) */
+   /* _mesa_function_pool[5947]: VertexAttrib2sNV (will be remapped) */
    "iii\0"
    "glVertexAttrib2sNV\0"
    "\0"
-   /* _mesa_function_pool[5984]: ReadPixels (offset 256) */
+   /* _mesa_function_pool[5971]: ReadPixels (offset 256) */
    "iiiiiip\0"
    "glReadPixels\0"
    "\0"
-   /* _mesa_function_pool[6006]: EdgeFlagv (offset 42) */
+   /* _mesa_function_pool[5993]: EdgeFlagv (offset 42) */
    "p\0"
    "glEdgeFlagv\0"
    "\0"
-   /* _mesa_function_pool[6021]: NormalPointerListIBM (dynamic) */
+   /* _mesa_function_pool[6008]: NormalPointerListIBM (dynamic) */
    "iipi\0"
    "glNormalPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[6050]: IndexPointerEXT (will be remapped) */
+   /* _mesa_function_pool[6037]: IndexPointerEXT (will be remapped) */
    "iiip\0"
    "glIndexPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[6074]: Color4iv (offset 32) */
+   /* _mesa_function_pool[6061]: Color4iv (offset 32) */
    "p\0"
    "glColor4iv\0"
    "\0"
-   /* _mesa_function_pool[6088]: TexParameterf (offset 178) */
+   /* _mesa_function_pool[6075]: TexParameterf (offset 178) */
    "iif\0"
    "glTexParameterf\0"
    "\0"
-   /* _mesa_function_pool[6109]: TexParameteri (offset 180) */
+   /* _mesa_function_pool[6096]: TexParameteri (offset 180) */
    "iii\0"
    "glTexParameteri\0"
    "\0"
-   /* _mesa_function_pool[6130]: NormalPointerEXT (will be remapped) */
+   /* _mesa_function_pool[6117]: NormalPointerEXT (will be remapped) */
    "iiip\0"
    "glNormalPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[6155]: MultiTexCoord3dARB (offset 392) */
+   /* _mesa_function_pool[6142]: MultiTexCoord3dARB (offset 392) */
    "iddd\0"
    "glMultiTexCoord3d\0"
    "glMultiTexCoord3dARB\0"
    "\0"
-   /* _mesa_function_pool[6200]: MultiTexCoord2iARB (offset 388) */
+   /* _mesa_function_pool[6187]: MultiTexCoord2iARB (offset 388) */
    "iii\0"
    "glMultiTexCoord2i\0"
    "glMultiTexCoord2iARB\0"
    "\0"
-   /* _mesa_function_pool[6244]: DrawPixels (offset 257) */
+   /* _mesa_function_pool[6231]: DrawPixels (offset 257) */
    "iiiip\0"
    "glDrawPixels\0"
    "\0"
-   /* _mesa_function_pool[6264]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[6251]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */
    "iffffffff\0"
    "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[6324]: MultiTexCoord2svARB (offset 391) */
+   /* _mesa_function_pool[6311]: MultiTexCoord2svARB (offset 391) */
    "ip\0"
    "glMultiTexCoord2sv\0"
    "glMultiTexCoord2svARB\0"
    "\0"
-   /* _mesa_function_pool[6369]: ReplacementCodeubvSUN (dynamic) */
+   /* _mesa_function_pool[6356]: ReplacementCodeubvSUN (dynamic) */
    "p\0"
    "glReplacementCodeubvSUN\0"
    "\0"
-   /* _mesa_function_pool[6396]: Uniform3iARB (will be remapped) */
+   /* _mesa_function_pool[6383]: Uniform3iARB (will be remapped) */
    "iiii\0"
    "glUniform3i\0"
    "glUniform3iARB\0"
    "\0"
-   /* _mesa_function_pool[6429]: DrawTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[6416]: DrawTransformFeedback (will be remapped) */
    "ii\0"
    "glDrawTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[6457]: DrawElementsInstancedARB (will be remapped) */
+   /* _mesa_function_pool[6444]: DrawElementsInstancedARB (will be remapped) */
    "iiipi\0"
    "glDrawElementsInstancedARB\0"
    "glDrawElementsInstancedEXT\0"
    "glDrawElementsInstanced\0"
    "\0"
-   /* _mesa_function_pool[6542]: GetShaderInfoLog (will be remapped) */
+   /* _mesa_function_pool[6529]: GetShaderInfoLog (will be remapped) */
    "iipp\0"
    "glGetShaderInfoLog\0"
    "\0"
-   /* _mesa_function_pool[6567]: WeightivARB (dynamic) */
+   /* _mesa_function_pool[6554]: WeightivARB (dynamic) */
    "ip\0"
    "glWeightivARB\0"
    "\0"
-   /* _mesa_function_pool[6585]: PollInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[6572]: PollInstrumentsSGIX (dynamic) */
    "p\0"
    "glPollInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[6610]: GlobalAlphaFactordSUN (dynamic) */
+   /* _mesa_function_pool[6597]: GlobalAlphaFactordSUN (dynamic) */
    "d\0"
    "glGlobalAlphaFactordSUN\0"
    "\0"
-   /* _mesa_function_pool[6637]: GetFinalCombinerInputParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[6624]: GetFinalCombinerInputParameterfvNV (will be remapped) */
    "iip\0"
    "glGetFinalCombinerInputParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[6679]: GenerateMipmapEXT (will be remapped) */
+   /* _mesa_function_pool[6666]: GenerateMipmapEXT (will be remapped) */
    "i\0"
    "glGenerateMipmap\0"
    "glGenerateMipmapEXT\0"
    "\0"
-   /* _mesa_function_pool[6719]: GenLists (offset 5) */
+   /* _mesa_function_pool[6706]: GenLists (offset 5) */
    "i\0"
    "glGenLists\0"
    "\0"
-   /* _mesa_function_pool[6733]: SetFragmentShaderConstantATI (will be remapped) */
-   "ip\0"
-   "glSetFragmentShaderConstantATI\0"
+   /* _mesa_function_pool[6720]: DepthRangef (will be remapped) */
+   "ff\0"
+   "glDepthRangef\0"
    "\0"
-   /* _mesa_function_pool[6768]: GetMapAttribParameterivNV (dynamic) */
+   /* _mesa_function_pool[6738]: GetMapAttribParameterivNV (dynamic) */
    "iiip\0"
    "glGetMapAttribParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[6802]: CreateShaderObjectARB (will be remapped) */
+   /* _mesa_function_pool[6772]: CreateShaderObjectARB (will be remapped) */
    "i\0"
    "glCreateShaderObjectARB\0"
    "\0"
-   /* _mesa_function_pool[6829]: GetSharpenTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[6799]: GetSharpenTexFuncSGIS (dynamic) */
    "ip\0"
    "glGetSharpenTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[6857]: BufferDataARB (will be remapped) */
+   /* _mesa_function_pool[6827]: BufferDataARB (will be remapped) */
    "iipi\0"
    "glBufferData\0"
    "glBufferDataARB\0"
    "\0"
-   /* _mesa_function_pool[6892]: FlushVertexArrayRangeNV (will be remapped) */
+   /* _mesa_function_pool[6862]: FlushVertexArrayRangeNV (will be remapped) */
    "\0"
    "glFlushVertexArrayRangeNV\0"
    "\0"
-   /* _mesa_function_pool[6920]: MapGrid2d (offset 226) */
+   /* _mesa_function_pool[6890]: MapGrid2d (offset 226) */
    "iddidd\0"
    "glMapGrid2d\0"
    "\0"
-   /* _mesa_function_pool[6940]: MapGrid2f (offset 227) */
+   /* _mesa_function_pool[6910]: MapGrid2f (offset 227) */
    "iffiff\0"
    "glMapGrid2f\0"
    "\0"
-   /* _mesa_function_pool[6960]: SampleMapATI (will be remapped) */
+   /* _mesa_function_pool[6930]: SampleMapATI (will be remapped) */
    "iii\0"
    "glSampleMapATI\0"
    "\0"
-   /* _mesa_function_pool[6980]: VertexPointerEXT (will be remapped) */
+   /* _mesa_function_pool[6950]: VertexPointerEXT (will be remapped) */
    "iiiip\0"
    "glVertexPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[7006]: GetTexFilterFuncSGIS (dynamic) */
+   /* _mesa_function_pool[6976]: GetTexFilterFuncSGIS (dynamic) */
    "iip\0"
    "glGetTexFilterFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[7034]: Scissor (offset 176) */
+   /* _mesa_function_pool[7004]: Scissor (offset 176) */
    "iiii\0"
    "glScissor\0"
    "\0"
-   /* _mesa_function_pool[7050]: Fogf (offset 153) */
+   /* _mesa_function_pool[7020]: Fogf (offset 153) */
    "if\0"
    "glFogf\0"
    "\0"
-   /* _mesa_function_pool[7061]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[7031]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiColor4ubVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[7106]: TexSubImage1D (offset 332) */
+   /* _mesa_function_pool[7076]: TexSubImage1D (offset 332) */
    "iiiiiip\0"
    "glTexSubImage1D\0"
    "glTexSubImage1DEXT\0"
    "\0"
-   /* _mesa_function_pool[7150]: VertexAttrib1sARB (will be remapped) */
+   /* _mesa_function_pool[7120]: VertexAttrib1sARB (will be remapped) */
    "ii\0"
    "glVertexAttrib1s\0"
    "glVertexAttrib1sARB\0"
    "\0"
-   /* _mesa_function_pool[7191]: FenceSync (will be remapped) */
+   /* _mesa_function_pool[7161]: FenceSync (will be remapped) */
    "ii\0"
    "glFenceSync\0"
    "\0"
-   /* _mesa_function_pool[7207]: Color4usv (offset 40) */
+   /* _mesa_function_pool[7177]: Color4usv (offset 40) */
    "p\0"
    "glColor4usv\0"
    "\0"
-   /* _mesa_function_pool[7222]: Fogi (offset 155) */
+   /* _mesa_function_pool[7192]: Fogi (offset 155) */
    "ii\0"
    "glFogi\0"
    "\0"
-   /* _mesa_function_pool[7233]: DepthRange (offset 288) */
+   /* _mesa_function_pool[7203]: DepthRange (offset 288) */
    "dd\0"
    "glDepthRange\0"
    "\0"
-   /* _mesa_function_pool[7250]: RasterPos3iv (offset 75) */
+   /* _mesa_function_pool[7220]: RasterPos3iv (offset 75) */
    "p\0"
    "glRasterPos3iv\0"
    "\0"
-   /* _mesa_function_pool[7268]: FinalCombinerInputNV (will be remapped) */
+   /* _mesa_function_pool[7238]: FinalCombinerInputNV (will be remapped) */
    "iiii\0"
    "glFinalCombinerInputNV\0"
    "\0"
-   /* _mesa_function_pool[7297]: TexCoord2i (offset 106) */
+   /* _mesa_function_pool[7267]: TexCoord2i (offset 106) */
    "ii\0"
    "glTexCoord2i\0"
    "\0"
-   /* _mesa_function_pool[7314]: PixelMapfv (offset 251) */
+   /* _mesa_function_pool[7284]: PixelMapfv (offset 251) */
    "iip\0"
    "glPixelMapfv\0"
    "\0"
-   /* _mesa_function_pool[7332]: Color4ui (offset 37) */
+   /* _mesa_function_pool[7302]: Color4ui (offset 37) */
    "iiii\0"
    "glColor4ui\0"
    "\0"
-   /* _mesa_function_pool[7349]: RasterPos3s (offset 76) */
+   /* _mesa_function_pool[7319]: RasterPos3s (offset 76) */
    "iii\0"
    "glRasterPos3s\0"
    "\0"
-   /* _mesa_function_pool[7368]: Color3usv (offset 24) */
+   /* _mesa_function_pool[7338]: Color3usv (offset 24) */
    "p\0"
    "glColor3usv\0"
    "\0"
-   /* _mesa_function_pool[7383]: FlushRasterSGIX (dynamic) */
+   /* _mesa_function_pool[7353]: FlushRasterSGIX (dynamic) */
    "\0"
    "glFlushRasterSGIX\0"
    "\0"
-   /* _mesa_function_pool[7403]: TexCoord2f (offset 104) */
+   /* _mesa_function_pool[7373]: TexCoord2f (offset 104) */
    "ff\0"
    "glTexCoord2f\0"
    "\0"
-   /* _mesa_function_pool[7420]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[7390]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */
    "ifffff\0"
    "glReplacementCodeuiTexCoord2fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[7469]: TexCoord2d (offset 102) */
+   /* _mesa_function_pool[7439]: TexCoord2d (offset 102) */
    "dd\0"
    "glTexCoord2d\0"
    "\0"
-   /* _mesa_function_pool[7486]: RasterPos3d (offset 70) */
+   /* _mesa_function_pool[7456]: RasterPos3d (offset 70) */
    "ddd\0"
    "glRasterPos3d\0"
    "\0"
-   /* _mesa_function_pool[7505]: RasterPos3f (offset 72) */
+   /* _mesa_function_pool[7475]: RasterPos3f (offset 72) */
    "fff\0"
    "glRasterPos3f\0"
    "\0"
-   /* _mesa_function_pool[7524]: Uniform1fARB (will be remapped) */
+   /* _mesa_function_pool[7494]: Uniform1fARB (will be remapped) */
    "if\0"
    "glUniform1f\0"
    "glUniform1fARB\0"
    "\0"
-   /* _mesa_function_pool[7555]: AreTexturesResident (offset 322) */
+   /* _mesa_function_pool[7525]: AreTexturesResident (offset 322) */
    "ipp\0"
    "glAreTexturesResident\0"
    "glAreTexturesResidentEXT\0"
    "\0"
-   /* _mesa_function_pool[7607]: TexCoord2s (offset 108) */
+   /* _mesa_function_pool[7577]: TexCoord2s (offset 108) */
    "ii\0"
    "glTexCoord2s\0"
    "\0"
-   /* _mesa_function_pool[7624]: StencilOpSeparate (will be remapped) */
+   /* _mesa_function_pool[7594]: StencilOpSeparate (will be remapped) */
    "iiii\0"
    "glStencilOpSeparate\0"
    "glStencilOpSeparateATI\0"
    "\0"
-   /* _mesa_function_pool[7673]: ColorTableParameteriv (offset 341) */
+   /* _mesa_function_pool[7643]: ColorTableParameteriv (offset 341) */
    "iip\0"
    "glColorTableParameteriv\0"
    "glColorTableParameterivSGI\0"
    "\0"
-   /* _mesa_function_pool[7729]: FogCoordPointerListIBM (dynamic) */
+   /* _mesa_function_pool[7699]: FogCoordPointerListIBM (dynamic) */
    "iipi\0"
    "glFogCoordPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[7760]: WindowPos3dMESA (will be remapped) */
+   /* _mesa_function_pool[7730]: WindowPos3dMESA (will be remapped) */
    "ddd\0"
    "glWindowPos3d\0"
    "glWindowPos3dARB\0"
    "glWindowPos3dMESA\0"
    "\0"
-   /* _mesa_function_pool[7814]: Color4us (offset 39) */
+   /* _mesa_function_pool[7784]: Color4us (offset 39) */
    "iiii\0"
    "glColor4us\0"
    "\0"
-   /* _mesa_function_pool[7831]: PointParameterfvEXT (will be remapped) */
+   /* _mesa_function_pool[7801]: PointParameterfvEXT (will be remapped) */
    "ip\0"
    "glPointParameterfv\0"
    "glPointParameterfvARB\0"
    "glPointParameterfvEXT\0"
    "glPointParameterfvSGIS\0"
    "\0"
-   /* _mesa_function_pool[7921]: Color3bv (offset 10) */
+   /* _mesa_function_pool[7891]: Color3bv (offset 10) */
    "p\0"
    "glColor3bv\0"
    "\0"
-   /* _mesa_function_pool[7935]: WindowPos2fvMESA (will be remapped) */
+   /* _mesa_function_pool[7905]: WindowPos2fvMESA (will be remapped) */
    "p\0"
    "glWindowPos2fv\0"
    "glWindowPos2fvARB\0"
    "glWindowPos2fvMESA\0"
    "\0"
-   /* _mesa_function_pool[7990]: SecondaryColor3bvEXT (will be remapped) */
+   /* _mesa_function_pool[7960]: SecondaryColor3bvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3bv\0"
    "glSecondaryColor3bvEXT\0"
    "\0"
-   /* _mesa_function_pool[8036]: VertexPointerListIBM (dynamic) */
+   /* _mesa_function_pool[8006]: VertexPointerListIBM (dynamic) */
    "iiipi\0"
    "glVertexPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[8066]: GetProgramLocalParameterfvARB (will be remapped) */
+   /* _mesa_function_pool[8036]: GetProgramLocalParameterfvARB (will be remapped) */
    "iip\0"
    "glGetProgramLocalParameterfvARB\0"
    "\0"
-   /* _mesa_function_pool[8103]: FragmentMaterialfSGIX (dynamic) */
+   /* _mesa_function_pool[8073]: FragmentMaterialfSGIX (dynamic) */
    "iif\0"
    "glFragmentMaterialfSGIX\0"
    "\0"
-   /* _mesa_function_pool[8132]: TexCoord2fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[8102]: TexCoord2fNormal3fVertex3fSUN (dynamic) */
    "ffffffff\0"
    "glTexCoord2fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[8174]: RenderbufferStorageEXT (will be remapped) */
+   /* _mesa_function_pool[8144]: RenderbufferStorageEXT (will be remapped) */
    "iiii\0"
    "glRenderbufferStorage\0"
    "glRenderbufferStorageEXT\0"
    "\0"
-   /* _mesa_function_pool[8227]: IsFenceNV (will be remapped) */
+   /* _mesa_function_pool[8197]: IsFenceNV (will be remapped) */
    "i\0"
    "glIsFenceNV\0"
    "\0"
-   /* _mesa_function_pool[8242]: AttachObjectARB (will be remapped) */
+   /* _mesa_function_pool[8212]: AttachObjectARB (will be remapped) */
    "ii\0"
    "glAttachObjectARB\0"
    "\0"
-   /* _mesa_function_pool[8264]: GetFragmentLightivSGIX (dynamic) */
+   /* _mesa_function_pool[8234]: GetFragmentLightivSGIX (dynamic) */
    "iip\0"
    "glGetFragmentLightivSGIX\0"
    "\0"
-   /* _mesa_function_pool[8294]: UniformMatrix2fvARB (will be remapped) */
+   /* _mesa_function_pool[8264]: UniformMatrix2fvARB (will be remapped) */
    "iiip\0"
    "glUniformMatrix2fv\0"
    "glUniformMatrix2fvARB\0"
    "\0"
-   /* _mesa_function_pool[8341]: MultiTexCoord2fARB (offset 386) */
+   /* _mesa_function_pool[8311]: MultiTexCoord2fARB (offset 386) */
    "iff\0"
    "glMultiTexCoord2f\0"
    "glMultiTexCoord2fARB\0"
    "\0"
-   /* _mesa_function_pool[8385]: ColorTable (offset 339) */
+   /* _mesa_function_pool[8355]: ColorTable (offset 339) */
    "iiiiip\0"
    "glColorTable\0"
    "glColorTableSGI\0"
    "glColorTableEXT\0"
    "\0"
-   /* _mesa_function_pool[8438]: IndexPointer (offset 314) */
+   /* _mesa_function_pool[8408]: IndexPointer (offset 314) */
    "iip\0"
    "glIndexPointer\0"
    "\0"
-   /* _mesa_function_pool[8458]: Accum (offset 213) */
+   /* _mesa_function_pool[8428]: Accum (offset 213) */
    "if\0"
    "glAccum\0"
    "\0"
-   /* _mesa_function_pool[8470]: GetTexImage (offset 281) */
+   /* _mesa_function_pool[8440]: GetTexImage (offset 281) */
    "iiiip\0"
    "glGetTexImage\0"
    "\0"
-   /* _mesa_function_pool[8491]: MapControlPointsNV (dynamic) */
+   /* _mesa_function_pool[8461]: MapControlPointsNV (dynamic) */
    "iiiiiiiip\0"
    "glMapControlPointsNV\0"
    "\0"
-   /* _mesa_function_pool[8523]: ConvolutionFilter2D (offset 349) */
+   /* _mesa_function_pool[8493]: ConvolutionFilter2D (offset 349) */
    "iiiiiip\0"
    "glConvolutionFilter2D\0"
    "glConvolutionFilter2DEXT\0"
    "\0"
-   /* _mesa_function_pool[8579]: Finish (offset 216) */
+   /* _mesa_function_pool[8549]: Finish (offset 216) */
    "\0"
    "glFinish\0"
    "\0"
-   /* _mesa_function_pool[8590]: MapParameterfvNV (dynamic) */
+   /* _mesa_function_pool[8560]: MapParameterfvNV (dynamic) */
    "iip\0"
    "glMapParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[8614]: ClearStencil (offset 207) */
+   /* _mesa_function_pool[8584]: ClearStencil (offset 207) */
    "i\0"
    "glClearStencil\0"
    "\0"
-   /* _mesa_function_pool[8632]: VertexAttrib3dvARB (will be remapped) */
+   /* _mesa_function_pool[8602]: VertexAttrib3dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib3dv\0"
    "glVertexAttrib3dvARB\0"
    "\0"
-   /* _mesa_function_pool[8675]: Uniform4uivEXT (will be remapped) */
+   /* _mesa_function_pool[8645]: Uniform4uivEXT (will be remapped) */
    "iip\0"
    "glUniform4uivEXT\0"
    "glUniform4uiv\0"
    "\0"
-   /* _mesa_function_pool[8711]: HintPGI (dynamic) */
+   /* _mesa_function_pool[8681]: HintPGI (dynamic) */
    "ii\0"
    "glHintPGI\0"
    "\0"
-   /* _mesa_function_pool[8725]: ConvolutionParameteriv (offset 353) */
+   /* _mesa_function_pool[8695]: ConvolutionParameteriv (offset 353) */
    "iip\0"
    "glConvolutionParameteriv\0"
    "glConvolutionParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[8783]: Color4s (offset 33) */
+   /* _mesa_function_pool[8753]: Color4s (offset 33) */
    "iiii\0"
    "glColor4s\0"
    "\0"
-   /* _mesa_function_pool[8799]: InterleavedArrays (offset 317) */
+   /* _mesa_function_pool[8769]: InterleavedArrays (offset 317) */
    "iip\0"
    "glInterleavedArrays\0"
    "\0"
-   /* _mesa_function_pool[8824]: RasterPos2fv (offset 65) */
+   /* _mesa_function_pool[8794]: RasterPos2fv (offset 65) */
    "p\0"
    "glRasterPos2fv\0"
    "\0"
-   /* _mesa_function_pool[8842]: TexCoord1fv (offset 97) */
+   /* _mesa_function_pool[8812]: TexCoord1fv (offset 97) */
    "p\0"
    "glTexCoord1fv\0"
    "\0"
-   /* _mesa_function_pool[8859]: Vertex2d (offset 126) */
+   /* _mesa_function_pool[8829]: Vertex2d (offset 126) */
    "dd\0"
    "glVertex2d\0"
    "\0"
-   /* _mesa_function_pool[8874]: CullParameterdvEXT (dynamic) */
+   /* _mesa_function_pool[8844]: CullParameterdvEXT (dynamic) */
    "ip\0"
    "glCullParameterdvEXT\0"
    "\0"
-   /* _mesa_function_pool[8899]: ProgramNamedParameter4fNV (will be remapped) */
+   /* _mesa_function_pool[8869]: ProgramNamedParameter4fNV (will be remapped) */
    "iipffff\0"
    "glProgramNamedParameter4fNV\0"
    "\0"
-   /* _mesa_function_pool[8936]: Color3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[8906]: Color3fVertex3fSUN (dynamic) */
    "ffffff\0"
    "glColor3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[8965]: ProgramEnvParameter4fvARB (will be remapped) */
+   /* _mesa_function_pool[8935]: ProgramEnvParameter4fvARB (will be remapped) */
    "iip\0"
    "glProgramEnvParameter4fvARB\0"
    "glProgramParameter4fvNV\0"
    "\0"
-   /* _mesa_function_pool[9022]: Color4i (offset 31) */
+   /* _mesa_function_pool[8992]: Color4i (offset 31) */
    "iiii\0"
    "glColor4i\0"
    "\0"
-   /* _mesa_function_pool[9038]: Color4f (offset 29) */
+   /* _mesa_function_pool[9008]: Color4f (offset 29) */
    "ffff\0"
    "glColor4f\0"
    "\0"
-   /* _mesa_function_pool[9054]: RasterPos4fv (offset 81) */
+   /* _mesa_function_pool[9024]: RasterPos4fv (offset 81) */
    "p\0"
    "glRasterPos4fv\0"
    "\0"
-   /* _mesa_function_pool[9072]: Color4d (offset 27) */
+   /* _mesa_function_pool[9042]: Color4d (offset 27) */
    "dddd\0"
    "glColor4d\0"
    "\0"
-   /* _mesa_function_pool[9088]: ClearIndex (offset 205) */
+   /* _mesa_function_pool[9058]: ClearIndex (offset 205) */
    "f\0"
    "glClearIndex\0"
    "\0"
-   /* _mesa_function_pool[9104]: Color4b (offset 25) */
+   /* _mesa_function_pool[9074]: Color4b (offset 25) */
    "iiii\0"
    "glColor4b\0"
    "\0"
-   /* _mesa_function_pool[9120]: LoadMatrixd (offset 292) */
+   /* _mesa_function_pool[9090]: LoadMatrixd (offset 292) */
    "p\0"
    "glLoadMatrixd\0"
    "\0"
-   /* _mesa_function_pool[9137]: FragmentLightModeliSGIX (dynamic) */
+   /* _mesa_function_pool[9107]: FragmentLightModeliSGIX (dynamic) */
    "ii\0"
    "glFragmentLightModeliSGIX\0"
    "\0"
-   /* _mesa_function_pool[9167]: RasterPos2dv (offset 63) */
+   /* _mesa_function_pool[9137]: RasterPos2dv (offset 63) */
    "p\0"
    "glRasterPos2dv\0"
    "\0"
-   /* _mesa_function_pool[9185]: ConvolutionParameterfv (offset 351) */
+   /* _mesa_function_pool[9155]: ConvolutionParameterfv (offset 351) */
    "iip\0"
    "glConvolutionParameterfv\0"
    "glConvolutionParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[9243]: TbufferMask3DFX (dynamic) */
+   /* _mesa_function_pool[9213]: TbufferMask3DFX (dynamic) */
    "i\0"
    "glTbufferMask3DFX\0"
    "\0"
-   /* _mesa_function_pool[9264]: GetTexGendv (offset 278) */
+   /* _mesa_function_pool[9234]: GetTexGendv (offset 278) */
    "iip\0"
    "glGetTexGendv\0"
    "\0"
-   /* _mesa_function_pool[9283]: GetVertexAttribfvNV (will be remapped) */
+   /* _mesa_function_pool[9253]: GetVertexAttribfvNV (will be remapped) */
    "iip\0"
    "glGetVertexAttribfvNV\0"
    "\0"
-   /* _mesa_function_pool[9310]: BeginTransformFeedbackEXT (will be remapped) */
+   /* _mesa_function_pool[9280]: BeginTransformFeedbackEXT (will be remapped) */
    "i\0"
    "glBeginTransformFeedbackEXT\0"
    "glBeginTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[9366]: LoadProgramNV (will be remapped) */
+   /* _mesa_function_pool[9336]: LoadProgramNV (will be remapped) */
    "iiip\0"
    "glLoadProgramNV\0"
    "\0"
-   /* _mesa_function_pool[9388]: WaitSync (will be remapped) */
+   /* _mesa_function_pool[9358]: WaitSync (will be remapped) */
    "iii\0"
    "glWaitSync\0"
    "\0"
-   /* _mesa_function_pool[9404]: EndList (offset 1) */
+   /* _mesa_function_pool[9374]: EndList (offset 1) */
    "\0"
    "glEndList\0"
    "\0"
-   /* _mesa_function_pool[9416]: VertexAttrib4fvNV (will be remapped) */
+   /* _mesa_function_pool[9386]: VertexAttrib4fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib4fvNV\0"
    "\0"
-   /* _mesa_function_pool[9440]: GetAttachedObjectsARB (will be remapped) */
+   /* _mesa_function_pool[9410]: GetAttachedObjectsARB (will be remapped) */
    "iipp\0"
    "glGetAttachedObjectsARB\0"
    "\0"
-   /* _mesa_function_pool[9470]: Uniform3fvARB (will be remapped) */
+   /* _mesa_function_pool[9440]: Uniform3fvARB (will be remapped) */
    "iip\0"
    "glUniform3fv\0"
    "glUniform3fvARB\0"
    "\0"
-   /* _mesa_function_pool[9504]: EvalCoord1fv (offset 231) */
+   /* _mesa_function_pool[9474]: EvalCoord1fv (offset 231) */
    "p\0"
    "glEvalCoord1fv\0"
    "\0"
-   /* _mesa_function_pool[9522]: DrawRangeElements (offset 338) */
+   /* _mesa_function_pool[9492]: DrawRangeElements (offset 338) */
    "iiiiip\0"
    "glDrawRangeElements\0"
    "glDrawRangeElementsEXT\0"
    "\0"
-   /* _mesa_function_pool[9573]: EvalMesh2 (offset 238) */
+   /* _mesa_function_pool[9543]: EvalMesh2 (offset 238) */
    "iiiii\0"
    "glEvalMesh2\0"
    "\0"
-   /* _mesa_function_pool[9592]: Vertex4fv (offset 145) */
+   /* _mesa_function_pool[9562]: Vertex4fv (offset 145) */
    "p\0"
    "glVertex4fv\0"
    "\0"
-   /* _mesa_function_pool[9607]: GenTransformFeedbacks (will be remapped) */
+   /* _mesa_function_pool[9577]: GenTransformFeedbacks (will be remapped) */
    "ip\0"
    "glGenTransformFeedbacks\0"
    "\0"
-   /* _mesa_function_pool[9635]: SpriteParameterfvSGIX (dynamic) */
+   /* _mesa_function_pool[9605]: SpriteParameterfvSGIX (dynamic) */
    "ip\0"
    "glSpriteParameterfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[9663]: CheckFramebufferStatusEXT (will be remapped) */
+   /* _mesa_function_pool[9633]: CheckFramebufferStatusEXT (will be remapped) */
    "i\0"
    "glCheckFramebufferStatus\0"
    "glCheckFramebufferStatusEXT\0"
    "\0"
-   /* _mesa_function_pool[9719]: GlobalAlphaFactoruiSUN (dynamic) */
+   /* _mesa_function_pool[9689]: GlobalAlphaFactoruiSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactoruiSUN\0"
    "\0"
-   /* _mesa_function_pool[9747]: GetHandleARB (will be remapped) */
+   /* _mesa_function_pool[9717]: GetHandleARB (will be remapped) */
    "i\0"
    "glGetHandleARB\0"
    "\0"
-   /* _mesa_function_pool[9765]: GetVertexAttribivARB (will be remapped) */
+   /* _mesa_function_pool[9735]: GetVertexAttribivARB (will be remapped) */
    "iip\0"
    "glGetVertexAttribiv\0"
    "glGetVertexAttribivARB\0"
    "\0"
-   /* _mesa_function_pool[9813]: GetCombinerInputParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[9783]: GetCombinerInputParameterfvNV (will be remapped) */
    "iiiip\0"
    "glGetCombinerInputParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[9852]: GetTexParameterIivEXT (will be remapped) */
+   /* _mesa_function_pool[9822]: GetTexParameterIivEXT (will be remapped) */
    "iip\0"
    "glGetTexParameterIivEXT\0"
    "glGetTexParameterIiv\0"
    "\0"
-   /* _mesa_function_pool[9902]: CreateProgram (will be remapped) */
+   /* _mesa_function_pool[9872]: CreateProgram (will be remapped) */
    "\0"
    "glCreateProgram\0"
    "\0"
-   /* _mesa_function_pool[9920]: LoadTransposeMatrixdARB (will be remapped) */
+   /* _mesa_function_pool[9890]: LoadTransposeMatrixdARB (will be remapped) */
    "p\0"
    "glLoadTransposeMatrixd\0"
    "glLoadTransposeMatrixdARB\0"
    "\0"
-   /* _mesa_function_pool[9972]: GetMinmax (offset 364) */
+   /* _mesa_function_pool[9942]: ReleaseShaderCompiler (will be remapped) */
+   "\0"
+   "glReleaseShaderCompiler\0"
+   "\0"
+   /* _mesa_function_pool[9968]: GetMinmax (offset 364) */
    "iiiip\0"
    "glGetMinmax\0"
    "glGetMinmaxEXT\0"
    "\0"
-   /* _mesa_function_pool[10006]: StencilFuncSeparate (will be remapped) */
+   /* _mesa_function_pool[10002]: StencilFuncSeparate (will be remapped) */
    "iiii\0"
    "glStencilFuncSeparate\0"
    "\0"
-   /* _mesa_function_pool[10034]: SecondaryColor3sEXT (will be remapped) */
+   /* _mesa_function_pool[10030]: SecondaryColor3sEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3s\0"
    "glSecondaryColor3sEXT\0"
    "\0"
-   /* _mesa_function_pool[10080]: Color3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[10076]: Color3fVertex3fvSUN (dynamic) */
    "pp\0"
    "glColor3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[10106]: GetInteger64i_v (will be remapped) */
+   /* _mesa_function_pool[10102]: GetInteger64i_v (will be remapped) */
    "iip\0"
    "glGetInteger64i_v\0"
    "\0"
-   /* _mesa_function_pool[10129]: Normal3fv (offset 57) */
+   /* _mesa_function_pool[10125]: Normal3fv (offset 57) */
    "p\0"
    "glNormal3fv\0"
    "\0"
-   /* _mesa_function_pool[10144]: GlobalAlphaFactorbSUN (dynamic) */
+   /* _mesa_function_pool[10140]: GlobalAlphaFactorbSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorbSUN\0"
    "\0"
-   /* _mesa_function_pool[10171]: Color3us (offset 23) */
+   /* _mesa_function_pool[10167]: Color3us (offset 23) */
    "iii\0"
    "glColor3us\0"
    "\0"
-   /* _mesa_function_pool[10187]: ImageTransformParameterfvHP (dynamic) */
+   /* _mesa_function_pool[10183]: ImageTransformParameterfvHP (dynamic) */
    "iip\0"
    "glImageTransformParameterfvHP\0"
    "\0"
-   /* _mesa_function_pool[10222]: VertexAttrib4ivARB (will be remapped) */
+   /* _mesa_function_pool[10218]: VertexAttrib4ivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4iv\0"
    "glVertexAttrib4ivARB\0"
    "\0"
-   /* _mesa_function_pool[10265]: End (offset 43) */
+   /* _mesa_function_pool[10261]: End (offset 43) */
    "\0"
    "glEnd\0"
    "\0"
-   /* _mesa_function_pool[10273]: VertexAttrib3fNV (will be remapped) */
+   /* _mesa_function_pool[10269]: VertexAttrib3fNV (will be remapped) */
    "ifff\0"
    "glVertexAttrib3fNV\0"
    "\0"
-   /* _mesa_function_pool[10298]: VertexAttribs2dvNV (will be remapped) */
+   /* _mesa_function_pool[10294]: VertexAttribs2dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs2dvNV\0"
    "\0"
-   /* _mesa_function_pool[10324]: GetQueryObjectui64vEXT (will be remapped) */
+   /* _mesa_function_pool[10320]: GetQueryObjectui64vEXT (will be remapped) */
    "iip\0"
    "glGetQueryObjectui64vEXT\0"
    "\0"
-   /* _mesa_function_pool[10354]: MultiTexCoord3fvARB (offset 395) */
+   /* _mesa_function_pool[10350]: MultiTexCoord3fvARB (offset 395) */
    "ip\0"
    "glMultiTexCoord3fv\0"
    "glMultiTexCoord3fvARB\0"
    "\0"
-   /* _mesa_function_pool[10399]: SecondaryColor3dEXT (will be remapped) */
+   /* _mesa_function_pool[10395]: SecondaryColor3dEXT (will be remapped) */
    "ddd\0"
    "glSecondaryColor3d\0"
    "glSecondaryColor3dEXT\0"
    "\0"
-   /* _mesa_function_pool[10445]: Color3ub (offset 19) */
+   /* _mesa_function_pool[10441]: Color3ub (offset 19) */
    "iii\0"
    "glColor3ub\0"
    "\0"
-   /* _mesa_function_pool[10461]: GetProgramParameterfvNV (will be remapped) */
+   /* _mesa_function_pool[10457]: GetProgramParameterfvNV (will be remapped) */
    "iiip\0"
    "glGetProgramParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[10493]: TangentPointerEXT (dynamic) */
+   /* _mesa_function_pool[10489]: TangentPointerEXT (dynamic) */
    "iip\0"
    "glTangentPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[10518]: Color4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[10514]: Color4fNormal3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[10553]: GetInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[10549]: GetInstrumentsSGIX (dynamic) */
    "\0"
    "glGetInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[10576]: GetUniformuivEXT (will be remapped) */
+   /* _mesa_function_pool[10572]: GetUniformuivEXT (will be remapped) */
    "iip\0"
    "glGetUniformuivEXT\0"
    "glGetUniformuiv\0"
    "\0"
-   /* _mesa_function_pool[10616]: Color3ui (offset 21) */
+   /* _mesa_function_pool[10612]: Color3ui (offset 21) */
    "iii\0"
    "glColor3ui\0"
    "\0"
-   /* _mesa_function_pool[10632]: EvalMapsNV (dynamic) */
+   /* _mesa_function_pool[10628]: EvalMapsNV (dynamic) */
    "ii\0"
    "glEvalMapsNV\0"
    "\0"
-   /* _mesa_function_pool[10649]: TexSubImage2D (offset 333) */
+   /* _mesa_function_pool[10645]: TexSubImage2D (offset 333) */
    "iiiiiiiip\0"
    "glTexSubImage2D\0"
    "glTexSubImage2DEXT\0"
    "\0"
-   /* _mesa_function_pool[10695]: FragmentLightivSGIX (dynamic) */
+   /* _mesa_function_pool[10691]: FragmentLightivSGIX (dynamic) */
    "iip\0"
    "glFragmentLightivSGIX\0"
    "\0"
-   /* _mesa_function_pool[10722]: GetTexParameterPointervAPPLE (will be remapped) */
+   /* _mesa_function_pool[10718]: GetTexParameterPointervAPPLE (will be remapped) */
    "iip\0"
    "glGetTexParameterPointervAPPLE\0"
    "\0"
-   /* _mesa_function_pool[10758]: TexGenfv (offset 191) */
+   /* _mesa_function_pool[10754]: TexGenfv (offset 191) */
    "iip\0"
    "glTexGenfv\0"
    "\0"
-   /* _mesa_function_pool[10774]: GetTransformFeedbackVaryingEXT (will be remapped) */
+   /* _mesa_function_pool[10770]: GetTransformFeedbackVaryingEXT (will be remapped) */
    "iiipppp\0"
    "glGetTransformFeedbackVaryingEXT\0"
    "glGetTransformFeedbackVarying\0"
    "\0"
-   /* _mesa_function_pool[10846]: VertexAttrib4bvARB (will be remapped) */
+   /* _mesa_function_pool[10842]: VertexAttrib4bvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4bv\0"
    "glVertexAttrib4bvARB\0"
    "\0"
-   /* _mesa_function_pool[10889]: AlphaFragmentOp2ATI (will be remapped) */
-   "iiiiiiiii\0"
-   "glAlphaFragmentOp2ATI\0"
+   /* _mesa_function_pool[10885]: ShaderBinary (will be remapped) */
+   "ipipi\0"
+   "glShaderBinary\0"
    "\0"
-   /* _mesa_function_pool[10922]: GetIntegerIndexedvEXT (will be remapped) */
+   /* _mesa_function_pool[10907]: GetIntegerIndexedvEXT (will be remapped) */
    "iip\0"
    "glGetIntegerIndexedvEXT\0"
    "glGetIntegeri_v\0"
    "\0"
-   /* _mesa_function_pool[10967]: MultiTexCoord4sARB (offset 406) */
+   /* _mesa_function_pool[10952]: MultiTexCoord4sARB (offset 406) */
    "iiiii\0"
    "glMultiTexCoord4s\0"
    "glMultiTexCoord4sARB\0"
    "\0"
-   /* _mesa_function_pool[11013]: GetFragmentMaterialivSGIX (dynamic) */
+   /* _mesa_function_pool[10998]: GetFragmentMaterialivSGIX (dynamic) */
    "iip\0"
    "glGetFragmentMaterialivSGIX\0"
    "\0"
-   /* _mesa_function_pool[11046]: WindowPos4dMESA (will be remapped) */
+   /* _mesa_function_pool[11031]: WindowPos4dMESA (will be remapped) */
    "dddd\0"
    "glWindowPos4dMESA\0"
    "\0"
-   /* _mesa_function_pool[11070]: WeightPointerARB (dynamic) */
+   /* _mesa_function_pool[11055]: WeightPointerARB (dynamic) */
    "iiip\0"
    "glWeightPointerARB\0"
    "\0"
-   /* _mesa_function_pool[11095]: WindowPos2dMESA (will be remapped) */
+   /* _mesa_function_pool[11080]: WindowPos2dMESA (will be remapped) */
    "dd\0"
    "glWindowPos2d\0"
    "glWindowPos2dARB\0"
    "glWindowPos2dMESA\0"
    "\0"
-   /* _mesa_function_pool[11148]: FramebufferTexture3DEXT (will be remapped) */
+   /* _mesa_function_pool[11133]: FramebufferTexture3DEXT (will be remapped) */
    "iiiiii\0"
    "glFramebufferTexture3D\0"
    "glFramebufferTexture3DEXT\0"
    "\0"
-   /* _mesa_function_pool[11205]: BlendEquation (offset 337) */
+   /* _mesa_function_pool[11190]: BlendEquation (offset 337) */
    "i\0"
    "glBlendEquation\0"
    "glBlendEquationEXT\0"
    "\0"
-   /* _mesa_function_pool[11243]: VertexAttrib3dNV (will be remapped) */
+   /* _mesa_function_pool[11228]: VertexAttrib3dNV (will be remapped) */
    "iddd\0"
    "glVertexAttrib3dNV\0"
    "\0"
-   /* _mesa_function_pool[11268]: VertexAttrib3dARB (will be remapped) */
+   /* _mesa_function_pool[11253]: VertexAttrib3dARB (will be remapped) */
    "iddd\0"
    "glVertexAttrib3d\0"
    "glVertexAttrib3dARB\0"
    "\0"
-   /* _mesa_function_pool[11311]: VertexAttribI4usvEXT (will be remapped) */
+   /* _mesa_function_pool[11296]: VertexAttribI4usvEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4usvEXT\0"
    "glVertexAttribI4usv\0"
    "\0"
-   /* _mesa_function_pool[11358]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[11343]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
    "ppppp\0"
    "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[11422]: VertexAttrib4fARB (will be remapped) */
+   /* _mesa_function_pool[11407]: VertexAttrib4fARB (will be remapped) */
    "iffff\0"
    "glVertexAttrib4f\0"
    "glVertexAttrib4fARB\0"
    "\0"
-   /* _mesa_function_pool[11466]: GetError (offset 261) */
+   /* _mesa_function_pool[11451]: GetError (offset 261) */
    "\0"
    "glGetError\0"
    "\0"
-   /* _mesa_function_pool[11479]: IndexFuncEXT (dynamic) */
+   /* _mesa_function_pool[11464]: IndexFuncEXT (dynamic) */
    "if\0"
    "glIndexFuncEXT\0"
    "\0"
-   /* _mesa_function_pool[11498]: TexCoord3dv (offset 111) */
+   /* _mesa_function_pool[11483]: TexCoord3dv (offset 111) */
    "p\0"
    "glTexCoord3dv\0"
    "\0"
-   /* _mesa_function_pool[11515]: Indexdv (offset 45) */
+   /* _mesa_function_pool[11500]: Indexdv (offset 45) */
    "p\0"
    "glIndexdv\0"
    "\0"
-   /* _mesa_function_pool[11528]: FramebufferTexture2DEXT (will be remapped) */
+   /* _mesa_function_pool[11513]: FramebufferTexture2DEXT (will be remapped) */
    "iiiii\0"
    "glFramebufferTexture2D\0"
    "glFramebufferTexture2DEXT\0"
    "\0"
-   /* _mesa_function_pool[11584]: Normal3s (offset 60) */
+   /* _mesa_function_pool[11569]: Normal3s (offset 60) */
    "iii\0"
    "glNormal3s\0"
    "\0"
-   /* _mesa_function_pool[11600]: GetObjectParameterivAPPLE (will be remapped) */
+   /* _mesa_function_pool[11585]: GetObjectParameterivAPPLE (will be remapped) */
    "iiip\0"
    "glGetObjectParameterivAPPLE\0"
    "\0"
-   /* _mesa_function_pool[11634]: PushName (offset 201) */
+   /* _mesa_function_pool[11619]: PushName (offset 201) */
    "i\0"
    "glPushName\0"
    "\0"
-   /* _mesa_function_pool[11648]: MultiTexCoord2dvARB (offset 385) */
+   /* _mesa_function_pool[11633]: MultiTexCoord2dvARB (offset 385) */
    "ip\0"
    "glMultiTexCoord2dv\0"
    "glMultiTexCoord2dvARB\0"
    "\0"
-   /* _mesa_function_pool[11693]: CullParameterfvEXT (dynamic) */
+   /* _mesa_function_pool[11678]: CullParameterfvEXT (dynamic) */
    "ip\0"
    "glCullParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[11718]: Normal3i (offset 58) */
+   /* _mesa_function_pool[11703]: Normal3i (offset 58) */
    "iii\0"
    "glNormal3i\0"
    "\0"
-   /* _mesa_function_pool[11734]: ProgramNamedParameter4fvNV (will be remapped) */
+   /* _mesa_function_pool[11719]: ProgramNamedParameter4fvNV (will be remapped) */
    "iipp\0"
    "glProgramNamedParameter4fvNV\0"
    "\0"
-   /* _mesa_function_pool[11769]: SecondaryColorPointerEXT (will be remapped) */
+   /* _mesa_function_pool[11754]: SecondaryColorPointerEXT (will be remapped) */
    "iiip\0"
    "glSecondaryColorPointer\0"
    "glSecondaryColorPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[11826]: VertexAttrib4fvARB (will be remapped) */
+   /* _mesa_function_pool[11811]: VertexAttrib4fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4fv\0"
    "glVertexAttrib4fvARB\0"
    "\0"
-   /* _mesa_function_pool[11869]: ColorPointerListIBM (dynamic) */
+   /* _mesa_function_pool[11854]: ColorPointerListIBM (dynamic) */
    "iiipi\0"
    "glColorPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[11898]: GetActiveUniformARB (will be remapped) */
+   /* _mesa_function_pool[11883]: GetActiveUniformARB (will be remapped) */
    "iiipppp\0"
    "glGetActiveUniform\0"
    "glGetActiveUniformARB\0"
    "\0"
-   /* _mesa_function_pool[11948]: ImageTransformParameteriHP (dynamic) */
+   /* _mesa_function_pool[11933]: ImageTransformParameteriHP (dynamic) */
    "iii\0"
    "glImageTransformParameteriHP\0"
    "\0"
-   /* _mesa_function_pool[11982]: Normal3b (offset 52) */
+   /* _mesa_function_pool[11967]: Normal3b (offset 52) */
    "iii\0"
    "glNormal3b\0"
    "\0"
-   /* _mesa_function_pool[11998]: Normal3d (offset 54) */
+   /* _mesa_function_pool[11983]: Normal3d (offset 54) */
    "ddd\0"
    "glNormal3d\0"
    "\0"
-   /* _mesa_function_pool[12014]: Uniform1uiEXT (will be remapped) */
+   /* _mesa_function_pool[11999]: Uniform1uiEXT (will be remapped) */
    "ii\0"
    "glUniform1uiEXT\0"
    "glUniform1ui\0"
    "\0"
-   /* _mesa_function_pool[12047]: Normal3f (offset 56) */
+   /* _mesa_function_pool[12032]: Normal3f (offset 56) */
    "fff\0"
    "glNormal3f\0"
    "\0"
-   /* _mesa_function_pool[12063]: MultiTexCoord1svARB (offset 383) */
+   /* _mesa_function_pool[12048]: MultiTexCoord1svARB (offset 383) */
    "ip\0"
    "glMultiTexCoord1sv\0"
    "glMultiTexCoord1svARB\0"
    "\0"
-   /* _mesa_function_pool[12108]: Indexi (offset 48) */
+   /* _mesa_function_pool[12093]: Indexi (offset 48) */
    "i\0"
    "glIndexi\0"
    "\0"
-   /* _mesa_function_pool[12120]: EGLImageTargetTexture2DOES (will be remapped) */
+   /* _mesa_function_pool[12105]: EGLImageTargetTexture2DOES (will be remapped) */
    "ip\0"
    "glEGLImageTargetTexture2DOES\0"
    "\0"
-   /* _mesa_function_pool[12153]: EndQueryARB (will be remapped) */
+   /* _mesa_function_pool[12138]: EndQueryARB (will be remapped) */
    "i\0"
    "glEndQuery\0"
    "glEndQueryARB\0"
    "\0"
-   /* _mesa_function_pool[12181]: DeleteFencesNV (will be remapped) */
+   /* _mesa_function_pool[12166]: DeleteFencesNV (will be remapped) */
    "ip\0"
    "glDeleteFencesNV\0"
    "\0"
-   /* _mesa_function_pool[12202]: BindBufferRangeEXT (will be remapped) */
+   /* _mesa_function_pool[12187]: DeformationMap3dSGIX (dynamic) */
+   "iddiiddiiddiip\0"
+   "glDeformationMap3dSGIX\0"
+   "\0"
+   /* _mesa_function_pool[12226]: BindBufferRangeEXT (will be remapped) */
    "iiiii\0"
    "glBindBufferRangeEXT\0"
    "glBindBufferRange\0"
    "\0"
-   /* _mesa_function_pool[12248]: DepthMask (offset 211) */
+   /* _mesa_function_pool[12272]: DepthMask (offset 211) */
    "i\0"
    "glDepthMask\0"
    "\0"
-   /* _mesa_function_pool[12263]: IsShader (will be remapped) */
+   /* _mesa_function_pool[12287]: IsShader (will be remapped) */
    "i\0"
    "glIsShader\0"
    "\0"
-   /* _mesa_function_pool[12277]: Indexf (offset 46) */
+   /* _mesa_function_pool[12301]: Indexf (offset 46) */
    "f\0"
    "glIndexf\0"
    "\0"
-   /* _mesa_function_pool[12289]: GetImageTransformParameterivHP (dynamic) */
+   /* _mesa_function_pool[12313]: GetImageTransformParameterivHP (dynamic) */
    "iip\0"
    "glGetImageTransformParameterivHP\0"
    "\0"
-   /* _mesa_function_pool[12327]: Indexd (offset 44) */
+   /* _mesa_function_pool[12351]: Indexd (offset 44) */
    "d\0"
    "glIndexd\0"
    "\0"
-   /* _mesa_function_pool[12339]: GetMaterialiv (offset 270) */
+   /* _mesa_function_pool[12363]: GetMaterialiv (offset 270) */
    "iip\0"
    "glGetMaterialiv\0"
    "\0"
-   /* _mesa_function_pool[12360]: StencilOp (offset 244) */
+   /* _mesa_function_pool[12384]: StencilOp (offset 244) */
    "iii\0"
    "glStencilOp\0"
    "\0"
-   /* _mesa_function_pool[12377]: WindowPos4ivMESA (will be remapped) */
+   /* _mesa_function_pool[12401]: WindowPos4ivMESA (will be remapped) */
    "p\0"
    "glWindowPos4ivMESA\0"
    "\0"
-   /* _mesa_function_pool[12399]: FramebufferTextureLayer (dynamic) */
+   /* _mesa_function_pool[12423]: FramebufferTextureLayer (dynamic) */
    "iiiii\0"
    "glFramebufferTextureLayerARB\0"
    "\0"
-   /* _mesa_function_pool[12435]: MultiTexCoord3svARB (offset 399) */
+   /* _mesa_function_pool[12459]: MultiTexCoord3svARB (offset 399) */
    "ip\0"
    "glMultiTexCoord3sv\0"
    "glMultiTexCoord3svARB\0"
    "\0"
-   /* _mesa_function_pool[12480]: TexEnvfv (offset 185) */
+   /* _mesa_function_pool[12504]: TexEnvfv (offset 185) */
    "iip\0"
    "glTexEnvfv\0"
    "\0"
-   /* _mesa_function_pool[12496]: MultiTexCoord4iARB (offset 404) */
+   /* _mesa_function_pool[12520]: MultiTexCoord4iARB (offset 404) */
    "iiiii\0"
    "glMultiTexCoord4i\0"
    "glMultiTexCoord4iARB\0"
    "\0"
-   /* _mesa_function_pool[12542]: Indexs (offset 50) */
+   /* _mesa_function_pool[12566]: Indexs (offset 50) */
    "i\0"
    "glIndexs\0"
    "\0"
-   /* _mesa_function_pool[12554]: Binormal3ivEXT (dynamic) */
+   /* _mesa_function_pool[12578]: Binormal3ivEXT (dynamic) */
    "p\0"
    "glBinormal3ivEXT\0"
    "\0"
-   /* _mesa_function_pool[12574]: ResizeBuffersMESA (will be remapped) */
+   /* _mesa_function_pool[12598]: ResizeBuffersMESA (will be remapped) */
    "\0"
    "glResizeBuffersMESA\0"
    "\0"
-   /* _mesa_function_pool[12596]: GetUniformivARB (will be remapped) */
+   /* _mesa_function_pool[12620]: GetUniformivARB (will be remapped) */
    "iip\0"
    "glGetUniformiv\0"
    "glGetUniformivARB\0"
    "\0"
-   /* _mesa_function_pool[12634]: PixelTexGenParameteriSGIS (will be remapped) */
+   /* _mesa_function_pool[12658]: PixelTexGenParameteriSGIS (will be remapped) */
    "ii\0"
    "glPixelTexGenParameteriSGIS\0"
    "\0"
-   /* _mesa_function_pool[12666]: VertexPointervINTEL (dynamic) */
+   /* _mesa_function_pool[12690]: VertexPointervINTEL (dynamic) */
    "iip\0"
    "glVertexPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[12693]: Vertex2i (offset 130) */
+   /* _mesa_function_pool[12717]: Vertex2i (offset 130) */
    "ii\0"
    "glVertex2i\0"
    "\0"
-   /* _mesa_function_pool[12708]: LoadMatrixf (offset 291) */
+   /* _mesa_function_pool[12732]: LoadMatrixf (offset 291) */
    "p\0"
    "glLoadMatrixf\0"
    "\0"
-   /* _mesa_function_pool[12725]: VertexAttribI1uivEXT (will be remapped) */
+   /* _mesa_function_pool[12749]: VertexAttribI1uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI1uivEXT\0"
    "glVertexAttribI1uiv\0"
    "\0"
-   /* _mesa_function_pool[12772]: Vertex2f (offset 128) */
+   /* _mesa_function_pool[12796]: Vertex2f (offset 128) */
    "ff\0"
    "glVertex2f\0"
    "\0"
-   /* _mesa_function_pool[12787]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[12811]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
    "pppp\0"
    "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[12840]: Color4bv (offset 26) */
+   /* _mesa_function_pool[12864]: Color4bv (offset 26) */
    "p\0"
    "glColor4bv\0"
    "\0"
-   /* _mesa_function_pool[12854]: VertexPointer (offset 321) */
+   /* _mesa_function_pool[12878]: VertexPointer (offset 321) */
    "iiip\0"
    "glVertexPointer\0"
    "\0"
-   /* _mesa_function_pool[12876]: SecondaryColor3uiEXT (will be remapped) */
+   /* _mesa_function_pool[12900]: SecondaryColor3uiEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3ui\0"
    "glSecondaryColor3uiEXT\0"
    "\0"
-   /* _mesa_function_pool[12924]: StartInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[12948]: StartInstrumentsSGIX (dynamic) */
    "\0"
    "glStartInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[12949]: SecondaryColor3usvEXT (will be remapped) */
+   /* _mesa_function_pool[12973]: SecondaryColor3usvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3usv\0"
    "glSecondaryColor3usvEXT\0"
    "\0"
-   /* _mesa_function_pool[12997]: VertexAttrib2fvNV (will be remapped) */
+   /* _mesa_function_pool[13021]: VertexAttrib2fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib2fvNV\0"
    "\0"
-   /* _mesa_function_pool[13021]: ProgramLocalParameter4dvARB (will be remapped) */
+   /* _mesa_function_pool[13045]: ProgramLocalParameter4dvARB (will be remapped) */
    "iip\0"
    "glProgramLocalParameter4dvARB\0"
    "\0"
-   /* _mesa_function_pool[13056]: DeleteLists (offset 4) */
+   /* _mesa_function_pool[13080]: DeleteLists (offset 4) */
    "ii\0"
    "glDeleteLists\0"
    "\0"
-   /* _mesa_function_pool[13074]: LogicOp (offset 242) */
+   /* _mesa_function_pool[13098]: LogicOp (offset 242) */
    "i\0"
    "glLogicOp\0"
    "\0"
-   /* _mesa_function_pool[13087]: MatrixIndexuivARB (dynamic) */
+   /* _mesa_function_pool[13111]: MatrixIndexuivARB (dynamic) */
    "ip\0"
    "glMatrixIndexuivARB\0"
    "\0"
-   /* _mesa_function_pool[13111]: Vertex2s (offset 132) */
+   /* _mesa_function_pool[13135]: Vertex2s (offset 132) */
    "ii\0"
    "glVertex2s\0"
    "\0"
-   /* _mesa_function_pool[13126]: RenderbufferStorageMultisample (will be remapped) */
+   /* _mesa_function_pool[13150]: RenderbufferStorageMultisample (will be remapped) */
    "iiiii\0"
    "glRenderbufferStorageMultisample\0"
    "glRenderbufferStorageMultisampleEXT\0"
    "\0"
-   /* _mesa_function_pool[13202]: TexCoord4fv (offset 121) */
+   /* _mesa_function_pool[13226]: TexCoord4fv (offset 121) */
    "p\0"
    "glTexCoord4fv\0"
    "\0"
-   /* _mesa_function_pool[13219]: Tangent3sEXT (dynamic) */
+   /* _mesa_function_pool[13243]: Tangent3sEXT (dynamic) */
    "iii\0"
    "glTangent3sEXT\0"
    "\0"
-   /* _mesa_function_pool[13239]: GlobalAlphaFactorfSUN (dynamic) */
+   /* _mesa_function_pool[13263]: GlobalAlphaFactorfSUN (dynamic) */
    "f\0"
    "glGlobalAlphaFactorfSUN\0"
    "\0"
-   /* _mesa_function_pool[13266]: MultiTexCoord3iARB (offset 396) */
+   /* _mesa_function_pool[13290]: MultiTexCoord3iARB (offset 396) */
    "iiii\0"
    "glMultiTexCoord3i\0"
    "glMultiTexCoord3iARB\0"
    "\0"
-   /* _mesa_function_pool[13311]: IsProgram (will be remapped) */
+   /* _mesa_function_pool[13335]: IsProgram (will be remapped) */
    "i\0"
    "glIsProgram\0"
    "\0"
-   /* _mesa_function_pool[13326]: TexCoordPointerListIBM (dynamic) */
+   /* _mesa_function_pool[13350]: TexCoordPointerListIBM (dynamic) */
    "iiipi\0"
    "glTexCoordPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[13358]: VertexAttribI4svEXT (will be remapped) */
+   /* _mesa_function_pool[13382]: VertexAttribI4svEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4svEXT\0"
    "glVertexAttribI4sv\0"
    "\0"
-   /* _mesa_function_pool[13403]: GlobalAlphaFactorusSUN (dynamic) */
+   /* _mesa_function_pool[13427]: GlobalAlphaFactorusSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorusSUN\0"
    "\0"
-   /* _mesa_function_pool[13431]: VertexAttrib2dvNV (will be remapped) */
+   /* _mesa_function_pool[13455]: VertexAttrib2dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib2dvNV\0"
    "\0"
-   /* _mesa_function_pool[13455]: FramebufferRenderbufferEXT (will be remapped) */
+   /* _mesa_function_pool[13479]: FramebufferRenderbufferEXT (will be remapped) */
    "iiii\0"
    "glFramebufferRenderbuffer\0"
    "glFramebufferRenderbufferEXT\0"
    "\0"
-   /* _mesa_function_pool[13516]: ClearBufferuiv (will be remapped) */
+   /* _mesa_function_pool[13540]: ClearBufferuiv (will be remapped) */
    "iip\0"
    "glClearBufferuiv\0"
    "\0"
-   /* _mesa_function_pool[13538]: VertexAttrib1dvNV (will be remapped) */
+   /* _mesa_function_pool[13562]: VertexAttrib1dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib1dvNV\0"
    "\0"
-   /* _mesa_function_pool[13562]: GenTextures (offset 328) */
+   /* _mesa_function_pool[13586]: GenTextures (offset 328) */
    "ip\0"
    "glGenTextures\0"
    "glGenTexturesEXT\0"
    "\0"
-   /* _mesa_function_pool[13597]: FramebufferTextureARB (will be remapped) */
+   /* _mesa_function_pool[13621]: FramebufferTextureARB (will be remapped) */
    "iiii\0"
    "glFramebufferTextureARB\0"
    "\0"
-   /* _mesa_function_pool[13627]: SetFenceNV (will be remapped) */
+   /* _mesa_function_pool[13651]: SetFenceNV (will be remapped) */
    "ii\0"
    "glSetFenceNV\0"
    "\0"
-   /* _mesa_function_pool[13644]: FramebufferTexture1DEXT (will be remapped) */
+   /* _mesa_function_pool[13668]: FramebufferTexture1DEXT (will be remapped) */
    "iiiii\0"
    "glFramebufferTexture1D\0"
    "glFramebufferTexture1DEXT\0"
    "\0"
-   /* _mesa_function_pool[13700]: GetCombinerOutputParameterivNV (will be remapped) */
+   /* _mesa_function_pool[13724]: GetCombinerOutputParameterivNV (will be remapped) */
    "iiip\0"
    "glGetCombinerOutputParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[13739]: MultiModeDrawArraysIBM (will be remapped) */
-   "pppii\0"
-   "glMultiModeDrawArraysIBM\0"
-   "\0"
-   /* _mesa_function_pool[13771]: PixelTexGenParameterivSGIS (will be remapped) */
+   /* _mesa_function_pool[13763]: PixelTexGenParameterivSGIS (will be remapped) */
    "ip\0"
    "glPixelTexGenParameterivSGIS\0"
    "\0"
-   /* _mesa_function_pool[13804]: TextureNormalEXT (dynamic) */
+   /* _mesa_function_pool[13796]: TextureNormalEXT (dynamic) */
    "i\0"
    "glTextureNormalEXT\0"
    "\0"
-   /* _mesa_function_pool[13826]: IndexPointerListIBM (dynamic) */
+   /* _mesa_function_pool[13818]: IndexPointerListIBM (dynamic) */
    "iipi\0"
    "glIndexPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[13854]: WeightfvARB (dynamic) */
+   /* _mesa_function_pool[13846]: WeightfvARB (dynamic) */
    "ip\0"
    "glWeightfvARB\0"
    "\0"
-   /* _mesa_function_pool[13872]: GetCombinerOutputParameterfvNV (will be remapped) */
-   "iiip\0"
-   "glGetCombinerOutputParameterfvNV\0"
-   "\0"
-   /* _mesa_function_pool[13911]: RasterPos2sv (offset 69) */
+   /* _mesa_function_pool[13864]: RasterPos2sv (offset 69) */
    "p\0"
    "glRasterPos2sv\0"
    "\0"
-   /* _mesa_function_pool[13929]: Color4ubv (offset 36) */
+   /* _mesa_function_pool[13882]: Color4ubv (offset 36) */
    "p\0"
    "glColor4ubv\0"
    "\0"
-   /* _mesa_function_pool[13944]: DrawBuffer (offset 202) */
+   /* _mesa_function_pool[13897]: DrawBuffer (offset 202) */
    "i\0"
    "glDrawBuffer\0"
    "\0"
-   /* _mesa_function_pool[13960]: TexCoord2fv (offset 105) */
+   /* _mesa_function_pool[13913]: TexCoord2fv (offset 105) */
    "p\0"
    "glTexCoord2fv\0"
    "\0"
-   /* _mesa_function_pool[13977]: WindowPos4fMESA (will be remapped) */
+   /* _mesa_function_pool[13930]: WindowPos4fMESA (will be remapped) */
    "ffff\0"
    "glWindowPos4fMESA\0"
    "\0"
-   /* _mesa_function_pool[14001]: TexCoord1sv (offset 101) */
+   /* _mesa_function_pool[13954]: TexCoord1sv (offset 101) */
    "p\0"
    "glTexCoord1sv\0"
    "\0"
-   /* _mesa_function_pool[14018]: WindowPos3dvMESA (will be remapped) */
+   /* _mesa_function_pool[13971]: WindowPos3dvMESA (will be remapped) */
    "p\0"
    "glWindowPos3dv\0"
    "glWindowPos3dvARB\0"
    "glWindowPos3dvMESA\0"
    "\0"
-   /* _mesa_function_pool[14073]: DepthFunc (offset 245) */
+   /* _mesa_function_pool[14026]: DepthFunc (offset 245) */
    "i\0"
    "glDepthFunc\0"
    "\0"
-   /* _mesa_function_pool[14088]: PixelMapusv (offset 253) */
+   /* _mesa_function_pool[14041]: PixelMapusv (offset 253) */
    "iip\0"
    "glPixelMapusv\0"
    "\0"
-   /* _mesa_function_pool[14107]: GetQueryObjecti64vEXT (will be remapped) */
+   /* _mesa_function_pool[14060]: GetQueryObjecti64vEXT (will be remapped) */
    "iip\0"
    "glGetQueryObjecti64vEXT\0"
    "\0"
-   /* _mesa_function_pool[14136]: MultiTexCoord1dARB (offset 376) */
+   /* _mesa_function_pool[14089]: MultiTexCoord1dARB (offset 376) */
    "id\0"
    "glMultiTexCoord1d\0"
    "glMultiTexCoord1dARB\0"
    "\0"
-   /* _mesa_function_pool[14179]: PointParameterivNV (will be remapped) */
+   /* _mesa_function_pool[14132]: PointParameterivNV (will be remapped) */
    "ip\0"
    "glPointParameteriv\0"
    "glPointParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[14223]: BlendFunc (offset 241) */
+   /* _mesa_function_pool[14176]: BlendFunc (offset 241) */
    "ii\0"
    "glBlendFunc\0"
    "\0"
-   /* _mesa_function_pool[14239]: EndTransformFeedbackEXT (will be remapped) */
+   /* _mesa_function_pool[14192]: EndTransformFeedbackEXT (will be remapped) */
    "\0"
    "glEndTransformFeedbackEXT\0"
    "glEndTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[14290]: Uniform2fvARB (will be remapped) */
+   /* _mesa_function_pool[14243]: Uniform2fvARB (will be remapped) */
    "iip\0"
    "glUniform2fv\0"
    "glUniform2fvARB\0"
    "\0"
-   /* _mesa_function_pool[14324]: BufferParameteriAPPLE (will be remapped) */
+   /* _mesa_function_pool[14277]: BufferParameteriAPPLE (will be remapped) */
    "iii\0"
    "glBufferParameteriAPPLE\0"
    "\0"
-   /* _mesa_function_pool[14353]: MultiTexCoord3dvARB (offset 393) */
+   /* _mesa_function_pool[14306]: MultiTexCoord3dvARB (offset 393) */
    "ip\0"
    "glMultiTexCoord3dv\0"
    "glMultiTexCoord3dvARB\0"
    "\0"
-   /* _mesa_function_pool[14398]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[14351]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
    "pppp\0"
    "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[14454]: DeleteObjectARB (will be remapped) */
+   /* _mesa_function_pool[14407]: DeleteObjectARB (will be remapped) */
    "i\0"
    "glDeleteObjectARB\0"
    "\0"
-   /* _mesa_function_pool[14475]: MatrixIndexPointerARB (dynamic) */
+   /* _mesa_function_pool[14428]: GetShaderPrecisionFormat (will be remapped) */
+   "iipp\0"
+   "glGetShaderPrecisionFormat\0"
+   "\0"
+   /* _mesa_function_pool[14461]: MatrixIndexPointerARB (dynamic) */
    "iiip\0"
    "glMatrixIndexPointerARB\0"
    "\0"
-   /* _mesa_function_pool[14505]: ProgramNamedParameter4dvNV (will be remapped) */
+   /* _mesa_function_pool[14491]: ProgramNamedParameter4dvNV (will be remapped) */
    "iipp\0"
    "glProgramNamedParameter4dvNV\0"
    "\0"
-   /* _mesa_function_pool[14540]: Tangent3fvEXT (dynamic) */
+   /* _mesa_function_pool[14526]: Tangent3fvEXT (dynamic) */
    "p\0"
    "glTangent3fvEXT\0"
    "\0"
-   /* _mesa_function_pool[14559]: Flush (offset 217) */
+   /* _mesa_function_pool[14545]: Flush (offset 217) */
    "\0"
    "glFlush\0"
    "\0"
-   /* _mesa_function_pool[14569]: Color4uiv (offset 38) */
+   /* _mesa_function_pool[14555]: Color4uiv (offset 38) */
    "p\0"
    "glColor4uiv\0"
    "\0"
-   /* _mesa_function_pool[14584]: VertexAttribI4iEXT (will be remapped) */
+   /* _mesa_function_pool[14570]: VertexAttribI4iEXT (will be remapped) */
    "iiiii\0"
    "glVertexAttribI4iEXT\0"
    "glVertexAttribI4i\0"
    "\0"
-   /* _mesa_function_pool[14630]: GenVertexArrays (will be remapped) */
+   /* _mesa_function_pool[14616]: GenVertexArrays (will be remapped) */
    "ip\0"
    "glGenVertexArrays\0"
    "\0"
-   /* _mesa_function_pool[14652]: Uniform3uivEXT (will be remapped) */
+   /* _mesa_function_pool[14638]: Uniform3uivEXT (will be remapped) */
    "iip\0"
    "glUniform3uivEXT\0"
    "glUniform3uiv\0"
    "\0"
-   /* _mesa_function_pool[14688]: RasterPos3sv (offset 77) */
+   /* _mesa_function_pool[14674]: RasterPos3sv (offset 77) */
    "p\0"
    "glRasterPos3sv\0"
    "\0"
-   /* _mesa_function_pool[14706]: BindFramebufferEXT (will be remapped) */
+   /* _mesa_function_pool[14692]: BindFramebufferEXT (will be remapped) */
    "ii\0"
    "glBindFramebuffer\0"
    "glBindFramebufferEXT\0"
    "\0"
-   /* _mesa_function_pool[14749]: ReferencePlaneSGIX (dynamic) */
+   /* _mesa_function_pool[14735]: ReferencePlaneSGIX (dynamic) */
    "p\0"
    "glReferencePlaneSGIX\0"
    "\0"
-   /* _mesa_function_pool[14773]: PushAttrib (offset 219) */
+   /* _mesa_function_pool[14759]: PushAttrib (offset 219) */
    "i\0"
    "glPushAttrib\0"
    "\0"
-   /* _mesa_function_pool[14789]: RasterPos2i (offset 66) */
+   /* _mesa_function_pool[14775]: RasterPos2i (offset 66) */
    "ii\0"
    "glRasterPos2i\0"
    "\0"
-   /* _mesa_function_pool[14807]: ValidateProgramARB (will be remapped) */
+   /* _mesa_function_pool[14793]: ValidateProgramARB (will be remapped) */
    "i\0"
    "glValidateProgram\0"
    "glValidateProgramARB\0"
    "\0"
-   /* _mesa_function_pool[14849]: TexParameteriv (offset 181) */
+   /* _mesa_function_pool[14835]: TexParameteriv (offset 181) */
    "iip\0"
    "glTexParameteriv\0"
    "\0"
-   /* _mesa_function_pool[14871]: UnlockArraysEXT (will be remapped) */
+   /* _mesa_function_pool[14857]: UnlockArraysEXT (will be remapped) */
    "\0"
    "glUnlockArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[14891]: TexCoord2fColor3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[14877]: TexCoord2fColor3fVertex3fSUN (dynamic) */
    "ffffffff\0"
    "glTexCoord2fColor3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[14932]: WindowPos3fvMESA (will be remapped) */
+   /* _mesa_function_pool[14918]: WindowPos3fvMESA (will be remapped) */
    "p\0"
    "glWindowPos3fv\0"
    "glWindowPos3fvARB\0"
    "glWindowPos3fvMESA\0"
    "\0"
-   /* _mesa_function_pool[14987]: RasterPos2f (offset 64) */
+   /* _mesa_function_pool[14973]: RasterPos2f (offset 64) */
    "ff\0"
    "glRasterPos2f\0"
    "\0"
-   /* _mesa_function_pool[15005]: VertexAttrib1svNV (will be remapped) */
+   /* _mesa_function_pool[14991]: VertexAttrib1svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib1svNV\0"
    "\0"
-   /* _mesa_function_pool[15029]: RasterPos2d (offset 62) */
+   /* _mesa_function_pool[15015]: RasterPos2d (offset 62) */
    "dd\0"
    "glRasterPos2d\0"
    "\0"
-   /* _mesa_function_pool[15047]: RasterPos3fv (offset 73) */
+   /* _mesa_function_pool[15033]: RasterPos3fv (offset 73) */
    "p\0"
    "glRasterPos3fv\0"
    "\0"
-   /* _mesa_function_pool[15065]: CopyTexSubImage3D (offset 373) */
+   /* _mesa_function_pool[15051]: CopyTexSubImage3D (offset 373) */
    "iiiiiiiii\0"
    "glCopyTexSubImage3D\0"
    "glCopyTexSubImage3DEXT\0"
    "\0"
-   /* _mesa_function_pool[15119]: VertexAttrib2dARB (will be remapped) */
+   /* _mesa_function_pool[15105]: VertexAttrib2dARB (will be remapped) */
    "idd\0"
    "glVertexAttrib2d\0"
    "glVertexAttrib2dARB\0"
    "\0"
-   /* _mesa_function_pool[15161]: Color4ub (offset 35) */
+   /* _mesa_function_pool[15147]: Color4ub (offset 35) */
    "iiii\0"
    "glColor4ub\0"
    "\0"
-   /* _mesa_function_pool[15178]: GetInteger64v (will be remapped) */
+   /* _mesa_function_pool[15164]: GetInteger64v (will be remapped) */
    "ip\0"
    "glGetInteger64v\0"
    "\0"
-   /* _mesa_function_pool[15198]: TextureColorMaskSGIS (dynamic) */
+   /* _mesa_function_pool[15184]: TextureColorMaskSGIS (dynamic) */
    "iiii\0"
    "glTextureColorMaskSGIS\0"
    "\0"
-   /* _mesa_function_pool[15227]: RasterPos2s (offset 68) */
+   /* _mesa_function_pool[15213]: RasterPos2s (offset 68) */
    "ii\0"
    "glRasterPos2s\0"
    "\0"
-   /* _mesa_function_pool[15245]: GetColorTable (offset 343) */
+   /* _mesa_function_pool[15231]: GetColorTable (offset 343) */
    "iiip\0"
    "glGetColorTable\0"
    "glGetColorTableSGI\0"
    "glGetColorTableEXT\0"
    "\0"
-   /* _mesa_function_pool[15305]: SelectBuffer (offset 195) */
+   /* _mesa_function_pool[15291]: SelectBuffer (offset 195) */
    "ip\0"
    "glSelectBuffer\0"
    "\0"
-   /* _mesa_function_pool[15324]: Indexiv (offset 49) */
+   /* _mesa_function_pool[15310]: Indexiv (offset 49) */
    "p\0"
    "glIndexiv\0"
    "\0"
-   /* _mesa_function_pool[15337]: TexCoord3i (offset 114) */
+   /* _mesa_function_pool[15323]: TexCoord3i (offset 114) */
    "iii\0"
    "glTexCoord3i\0"
    "\0"
-   /* _mesa_function_pool[15355]: CopyColorTable (offset 342) */
+   /* _mesa_function_pool[15341]: CopyColorTable (offset 342) */
    "iiiii\0"
    "glCopyColorTable\0"
    "glCopyColorTableSGI\0"
    "\0"
-   /* _mesa_function_pool[15399]: GetHistogramParameterfv (offset 362) */
+   /* _mesa_function_pool[15385]: GetHistogramParameterfv (offset 362) */
    "iip\0"
    "glGetHistogramParameterfv\0"
    "glGetHistogramParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[15459]: Frustum (offset 289) */
+   /* _mesa_function_pool[15445]: Frustum (offset 289) */
    "dddddd\0"
    "glFrustum\0"
    "\0"
-   /* _mesa_function_pool[15477]: GetString (offset 275) */
+   /* _mesa_function_pool[15463]: GetString (offset 275) */
    "i\0"
    "glGetString\0"
    "\0"
-   /* _mesa_function_pool[15492]: ColorPointervINTEL (dynamic) */
+   /* _mesa_function_pool[15478]: ColorPointervINTEL (dynamic) */
    "iip\0"
    "glColorPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[15518]: TexEnvf (offset 184) */
+   /* _mesa_function_pool[15504]: TexEnvf (offset 184) */
    "iif\0"
    "glTexEnvf\0"
    "\0"
-   /* _mesa_function_pool[15533]: TexCoord3d (offset 110) */
+   /* _mesa_function_pool[15519]: TexCoord3d (offset 110) */
    "ddd\0"
    "glTexCoord3d\0"
    "\0"
-   /* _mesa_function_pool[15551]: AlphaFragmentOp1ATI (will be remapped) */
+   /* _mesa_function_pool[15537]: AlphaFragmentOp1ATI (will be remapped) */
    "iiiiii\0"
    "glAlphaFragmentOp1ATI\0"
    "\0"
-   /* _mesa_function_pool[15581]: TexCoord3f (offset 112) */
+   /* _mesa_function_pool[15567]: TexCoord3f (offset 112) */
    "fff\0"
    "glTexCoord3f\0"
    "\0"
-   /* _mesa_function_pool[15599]: MultiTexCoord3ivARB (offset 397) */
+   /* _mesa_function_pool[15585]: MultiTexCoord3ivARB (offset 397) */
    "ip\0"
    "glMultiTexCoord3iv\0"
    "glMultiTexCoord3ivARB\0"
    "\0"
-   /* _mesa_function_pool[15644]: MultiTexCoord2sARB (offset 390) */
+   /* _mesa_function_pool[15630]: MultiTexCoord2sARB (offset 390) */
    "iii\0"
    "glMultiTexCoord2s\0"
    "glMultiTexCoord2sARB\0"
    "\0"
-   /* _mesa_function_pool[15688]: VertexAttrib1dvARB (will be remapped) */
+   /* _mesa_function_pool[15674]: VertexAttrib1dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib1dv\0"
    "glVertexAttrib1dvARB\0"
    "\0"
-   /* _mesa_function_pool[15731]: DeleteTextures (offset 327) */
+   /* _mesa_function_pool[15717]: DeleteTextures (offset 327) */
    "ip\0"
    "glDeleteTextures\0"
    "glDeleteTexturesEXT\0"
    "\0"
-   /* _mesa_function_pool[15772]: TexCoordPointerEXT (will be remapped) */
+   /* _mesa_function_pool[15758]: TexCoordPointerEXT (will be remapped) */
    "iiiip\0"
    "glTexCoordPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[15800]: TexSubImage4DSGIS (dynamic) */
+   /* _mesa_function_pool[15786]: TexSubImage4DSGIS (dynamic) */
    "iiiiiiiiiiiip\0"
    "glTexSubImage4DSGIS\0"
    "\0"
-   /* _mesa_function_pool[15835]: TexCoord3s (offset 116) */
+   /* _mesa_function_pool[15821]: TexCoord3s (offset 116) */
    "iii\0"
    "glTexCoord3s\0"
    "\0"
-   /* _mesa_function_pool[15853]: GetTexLevelParameteriv (offset 285) */
+   /* _mesa_function_pool[15839]: GetTexLevelParameteriv (offset 285) */
    "iiip\0"
    "glGetTexLevelParameteriv\0"
    "\0"
-   /* _mesa_function_pool[15884]: CombinerStageParameterfvNV (dynamic) */
+   /* _mesa_function_pool[15870]: CombinerStageParameterfvNV (dynamic) */
    "iip\0"
    "glCombinerStageParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[15918]: StopInstrumentsSGIX (dynamic) */
+   /* _mesa_function_pool[15904]: StopInstrumentsSGIX (dynamic) */
    "i\0"
    "glStopInstrumentsSGIX\0"
    "\0"
-   /* _mesa_function_pool[15943]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
+   /* _mesa_function_pool[15929]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
    "fffffffffffffff\0"
    "glTexCoord4fColor4fNormal3fVertex4fSUN\0"
    "\0"
-   /* _mesa_function_pool[15999]: ClearAccum (offset 204) */
+   /* _mesa_function_pool[15985]: ClearAccum (offset 204) */
    "ffff\0"
    "glClearAccum\0"
    "\0"
-   /* _mesa_function_pool[16018]: DeformSGIX (dynamic) */
+   /* _mesa_function_pool[16004]: DeformSGIX (dynamic) */
    "i\0"
    "glDeformSGIX\0"
    "\0"
-   /* _mesa_function_pool[16034]: GetVertexAttribfvARB (will be remapped) */
+   /* _mesa_function_pool[16020]: GetVertexAttribfvARB (will be remapped) */
    "iip\0"
    "glGetVertexAttribfv\0"
    "glGetVertexAttribfvARB\0"
    "\0"
-   /* _mesa_function_pool[16082]: SecondaryColor3ivEXT (will be remapped) */
+   /* _mesa_function_pool[16068]: SecondaryColor3ivEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3iv\0"
    "glSecondaryColor3ivEXT\0"
    "\0"
-   /* _mesa_function_pool[16128]: TexCoord4iv (offset 123) */
+   /* _mesa_function_pool[16114]: TexCoord4iv (offset 123) */
    "p\0"
    "glTexCoord4iv\0"
    "\0"
-   /* _mesa_function_pool[16145]: VertexAttribI4uiEXT (will be remapped) */
+   /* _mesa_function_pool[16131]: VertexAttribI4uiEXT (will be remapped) */
    "iiiii\0"
    "glVertexAttribI4uiEXT\0"
    "glVertexAttribI4ui\0"
    "\0"
-   /* _mesa_function_pool[16193]: GetFragmentMaterialfvSGIX (dynamic) */
+   /* _mesa_function_pool[16179]: GetFragmentMaterialfvSGIX (dynamic) */
    "iip\0"
    "glGetFragmentMaterialfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[16226]: UniformMatrix4x2fv (will be remapped) */
+   /* _mesa_function_pool[16212]: UniformMatrix4x2fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix4x2fv\0"
    "\0"
-   /* _mesa_function_pool[16253]: GetDetailTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[16239]: GetDetailTexFuncSGIS (dynamic) */
    "ip\0"
    "glGetDetailTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[16280]: GetCombinerStageParameterfvNV (dynamic) */
+   /* _mesa_function_pool[16266]: GetCombinerStageParameterfvNV (dynamic) */
    "iip\0"
    "glGetCombinerStageParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[16317]: PolygonOffset (offset 319) */
+   /* _mesa_function_pool[16303]: PolygonOffset (offset 319) */
    "ff\0"
    "glPolygonOffset\0"
    "\0"
-   /* _mesa_function_pool[16337]: BindVertexArray (will be remapped) */
+   /* _mesa_function_pool[16323]: BindVertexArray (will be remapped) */
    "i\0"
    "glBindVertexArray\0"
    "\0"
-   /* _mesa_function_pool[16358]: Color4ubVertex2fvSUN (dynamic) */
+   /* _mesa_function_pool[16344]: Color4ubVertex2fvSUN (dynamic) */
    "pp\0"
    "glColor4ubVertex2fvSUN\0"
    "\0"
-   /* _mesa_function_pool[16385]: Rectd (offset 86) */
+   /* _mesa_function_pool[16371]: Rectd (offset 86) */
    "dddd\0"
    "glRectd\0"
    "\0"
-   /* _mesa_function_pool[16399]: TexFilterFuncSGIS (dynamic) */
+   /* _mesa_function_pool[16385]: TexFilterFuncSGIS (dynamic) */
    "iiip\0"
    "glTexFilterFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[16425]: SampleMaskSGIS (will be remapped) */
+   /* _mesa_function_pool[16411]: SampleMaskSGIS (will be remapped) */
    "fi\0"
    "glSampleMaskSGIS\0"
    "glSampleMaskEXT\0"
    "\0"
-   /* _mesa_function_pool[16462]: VertexAttribI4ubvEXT (will be remapped) */
+   /* _mesa_function_pool[16448]: VertexAttribI4ubvEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4ubvEXT\0"
    "glVertexAttribI4ubv\0"
    "\0"
-   /* _mesa_function_pool[16509]: GetAttribLocationARB (will be remapped) */
+   /* _mesa_function_pool[16495]: GetAttribLocationARB (will be remapped) */
    "ip\0"
    "glGetAttribLocation\0"
    "glGetAttribLocationARB\0"
    "\0"
-   /* _mesa_function_pool[16556]: RasterPos3i (offset 74) */
+   /* _mesa_function_pool[16542]: RasterPos3i (offset 74) */
    "iii\0"
    "glRasterPos3i\0"
    "\0"
-   /* _mesa_function_pool[16575]: VertexAttrib4ubvARB (will be remapped) */
+   /* _mesa_function_pool[16561]: VertexAttrib4ubvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4ubv\0"
    "glVertexAttrib4ubvARB\0"
    "\0"
-   /* _mesa_function_pool[16620]: DetailTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[16606]: DetailTexFuncSGIS (dynamic) */
    "iip\0"
    "glDetailTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[16645]: Normal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[16631]: Normal3fVertex3fSUN (dynamic) */
    "ffffff\0"
    "glNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[16675]: CopyTexImage2D (offset 324) */
+   /* _mesa_function_pool[16661]: CopyTexImage2D (offset 324) */
    "iiiiiiii\0"
    "glCopyTexImage2D\0"
    "glCopyTexImage2DEXT\0"
    "\0"
-   /* _mesa_function_pool[16722]: GetBufferPointervARB (will be remapped) */
+   /* _mesa_function_pool[16708]: GetBufferPointervARB (will be remapped) */
    "iip\0"
    "glGetBufferPointerv\0"
    "glGetBufferPointervARB\0"
    "\0"
-   /* _mesa_function_pool[16770]: ProgramEnvParameter4fARB (will be remapped) */
+   /* _mesa_function_pool[16756]: ProgramEnvParameter4fARB (will be remapped) */
    "iiffff\0"
    "glProgramEnvParameter4fARB\0"
    "glProgramParameter4fNV\0"
    "\0"
-   /* _mesa_function_pool[16828]: Uniform3ivARB (will be remapped) */
+   /* _mesa_function_pool[16814]: Uniform3ivARB (will be remapped) */
    "iip\0"
    "glUniform3iv\0"
    "glUniform3ivARB\0"
    "\0"
-   /* _mesa_function_pool[16862]: Lightfv (offset 160) */
+   /* _mesa_function_pool[16848]: Lightfv (offset 160) */
    "iip\0"
    "glLightfv\0"
    "\0"
-   /* _mesa_function_pool[16877]: PrimitiveRestartIndexNV (will be remapped) */
+   /* _mesa_function_pool[16863]: PrimitiveRestartIndexNV (will be remapped) */
    "i\0"
    "glPrimitiveRestartIndexNV\0"
    "glPrimitiveRestartIndex\0"
    "\0"
-   /* _mesa_function_pool[16930]: ClearDepth (offset 208) */
+   /* _mesa_function_pool[16916]: ClearDepth (offset 208) */
    "d\0"
    "glClearDepth\0"
    "\0"
-   /* _mesa_function_pool[16946]: GetFenceivNV (will be remapped) */
+   /* _mesa_function_pool[16932]: GetFenceivNV (will be remapped) */
    "iip\0"
    "glGetFenceivNV\0"
    "\0"
-   /* _mesa_function_pool[16966]: WindowPos4dvMESA (will be remapped) */
+   /* _mesa_function_pool[16952]: WindowPos4dvMESA (will be remapped) */
    "p\0"
    "glWindowPos4dvMESA\0"
    "\0"
-   /* _mesa_function_pool[16988]: ColorSubTable (offset 346) */
+   /* _mesa_function_pool[16974]: ColorSubTable (offset 346) */
    "iiiiip\0"
    "glColorSubTable\0"
    "glColorSubTableEXT\0"
    "\0"
-   /* _mesa_function_pool[17031]: Color4fv (offset 30) */
+   /* _mesa_function_pool[17017]: Color4fv (offset 30) */
    "p\0"
    "glColor4fv\0"
    "\0"
-   /* _mesa_function_pool[17045]: MultiTexCoord4ivARB (offset 405) */
+   /* _mesa_function_pool[17031]: MultiTexCoord4ivARB (offset 405) */
    "ip\0"
    "glMultiTexCoord4iv\0"
    "glMultiTexCoord4ivARB\0"
    "\0"
-   /* _mesa_function_pool[17090]: ProgramLocalParameters4fvEXT (will be remapped) */
+   /* _mesa_function_pool[17076]: ProgramLocalParameters4fvEXT (will be remapped) */
    "iiip\0"
    "glProgramLocalParameters4fvEXT\0"
    "\0"
-   /* _mesa_function_pool[17127]: ColorPointer (offset 308) */
+   /* _mesa_function_pool[17113]: ColorPointer (offset 308) */
    "iiip\0"
    "glColorPointer\0"
    "\0"
-   /* _mesa_function_pool[17148]: Rects (offset 92) */
+   /* _mesa_function_pool[17134]: Rects (offset 92) */
    "iiii\0"
    "glRects\0"
    "\0"
-   /* _mesa_function_pool[17162]: GetMapAttribParameterfvNV (dynamic) */
+   /* _mesa_function_pool[17148]: GetMapAttribParameterfvNV (dynamic) */
    "iiip\0"
    "glGetMapAttribParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[17196]: CreateShaderProgramEXT (will be remapped) */
+   /* _mesa_function_pool[17182]: CreateShaderProgramEXT (will be remapped) */
    "ip\0"
    "glCreateShaderProgramEXT\0"
    "\0"
-   /* _mesa_function_pool[17225]: ActiveProgramEXT (will be remapped) */
+   /* _mesa_function_pool[17211]: ActiveProgramEXT (will be remapped) */
    "i\0"
    "glActiveProgramEXT\0"
    "\0"
-   /* _mesa_function_pool[17247]: Lightiv (offset 162) */
+   /* _mesa_function_pool[17233]: Lightiv (offset 162) */
    "iip\0"
    "glLightiv\0"
    "\0"
-   /* _mesa_function_pool[17262]: VertexAttrib4sARB (will be remapped) */
+   /* _mesa_function_pool[17248]: VertexAttrib4sARB (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4s\0"
    "glVertexAttrib4sARB\0"
    "\0"
-   /* _mesa_function_pool[17306]: GetQueryObjectuivARB (will be remapped) */
+   /* _mesa_function_pool[17292]: GetQueryObjectuivARB (will be remapped) */
    "iip\0"
    "glGetQueryObjectuiv\0"
    "glGetQueryObjectuivARB\0"
    "\0"
-   /* _mesa_function_pool[17354]: GetTexParameteriv (offset 283) */
+   /* _mesa_function_pool[17340]: GetTexParameteriv (offset 283) */
    "iip\0"
    "glGetTexParameteriv\0"
    "\0"
-   /* _mesa_function_pool[17379]: MapParameterivNV (dynamic) */
+   /* _mesa_function_pool[17365]: MapParameterivNV (dynamic) */
    "iip\0"
    "glMapParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[17403]: GenRenderbuffersEXT (will be remapped) */
+   /* _mesa_function_pool[17389]: GenRenderbuffersEXT (will be remapped) */
    "ip\0"
    "glGenRenderbuffers\0"
    "glGenRenderbuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[17448]: ClearBufferfv (will be remapped) */
+   /* _mesa_function_pool[17434]: ClearBufferfv (will be remapped) */
    "iip\0"
    "glClearBufferfv\0"
    "\0"
-   /* _mesa_function_pool[17469]: VertexAttrib2dvARB (will be remapped) */
+   /* _mesa_function_pool[17455]: VertexAttrib2dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib2dv\0"
    "glVertexAttrib2dvARB\0"
    "\0"
-   /* _mesa_function_pool[17512]: EdgeFlagPointerEXT (will be remapped) */
+   /* _mesa_function_pool[17498]: EdgeFlagPointerEXT (will be remapped) */
    "iip\0"
    "glEdgeFlagPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[17538]: VertexAttribs2svNV (will be remapped) */
+   /* _mesa_function_pool[17524]: VertexAttribs2svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs2svNV\0"
    "\0"
-   /* _mesa_function_pool[17564]: WeightbvARB (dynamic) */
+   /* _mesa_function_pool[17550]: WeightbvARB (dynamic) */
    "ip\0"
    "glWeightbvARB\0"
    "\0"
-   /* _mesa_function_pool[17582]: VertexAttrib2fvARB (will be remapped) */
+   /* _mesa_function_pool[17568]: VertexAttrib2fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib2fv\0"
    "glVertexAttrib2fvARB\0"
    "\0"
-   /* _mesa_function_pool[17625]: GetBufferParameterivARB (will be remapped) */
+   /* _mesa_function_pool[17611]: GetBufferParameterivARB (will be remapped) */
    "iip\0"
    "glGetBufferParameteriv\0"
    "glGetBufferParameterivARB\0"
    "\0"
-   /* _mesa_function_pool[17679]: Rectdv (offset 87) */
+   /* _mesa_function_pool[17665]: Rectdv (offset 87) */
    "pp\0"
    "glRectdv\0"
    "\0"
-   /* _mesa_function_pool[17692]: ListParameteriSGIX (dynamic) */
+   /* _mesa_function_pool[17678]: ListParameteriSGIX (dynamic) */
    "iii\0"
    "glListParameteriSGIX\0"
    "\0"
-   /* _mesa_function_pool[17718]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[17704]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
    "iffffffffff\0"
    "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[17777]: InstrumentsBufferSGIX (dynamic) */
+   /* _mesa_function_pool[17763]: InstrumentsBufferSGIX (dynamic) */
    "ip\0"
    "glInstrumentsBufferSGIX\0"
    "\0"
-   /* _mesa_function_pool[17805]: VertexAttrib4NivARB (will be remapped) */
+   /* _mesa_function_pool[17791]: VertexAttrib4NivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Niv\0"
    "glVertexAttrib4NivARB\0"
    "\0"
-   /* _mesa_function_pool[17850]: DrawArraysInstancedARB (will be remapped) */
+   /* _mesa_function_pool[17836]: DrawArraysInstancedARB (will be remapped) */
    "iiii\0"
    "glDrawArraysInstancedARB\0"
    "glDrawArraysInstancedEXT\0"
    "glDrawArraysInstanced\0"
    "\0"
-   /* _mesa_function_pool[17928]: GetAttachedShaders (will be remapped) */
+   /* _mesa_function_pool[17914]: GetAttachedShaders (will be remapped) */
    "iipp\0"
    "glGetAttachedShaders\0"
    "\0"
-   /* _mesa_function_pool[17955]: GenVertexArraysAPPLE (will be remapped) */
+   /* _mesa_function_pool[17941]: GenVertexArraysAPPLE (will be remapped) */
    "ip\0"
    "glGenVertexArraysAPPLE\0"
    "\0"
-   /* _mesa_function_pool[17982]: ClearBufferfi (will be remapped) */
+   /* _mesa_function_pool[17968]: ClearBufferfi (will be remapped) */
    "iifi\0"
    "glClearBufferfi\0"
    "\0"
-   /* _mesa_function_pool[18004]: Materialiv (offset 172) */
+   /* _mesa_function_pool[17990]: Materialiv (offset 172) */
    "iip\0"
    "glMaterialiv\0"
    "\0"
-   /* _mesa_function_pool[18022]: PushClientAttrib (offset 335) */
+   /* _mesa_function_pool[18008]: PushClientAttrib (offset 335) */
    "i\0"
    "glPushClientAttrib\0"
    "\0"
-   /* _mesa_function_pool[18044]: ProgramEnvParameters4fvEXT (will be remapped) */
+   /* _mesa_function_pool[18030]: ProgramEnvParameters4fvEXT (will be remapped) */
    "iiip\0"
    "glProgramEnvParameters4fvEXT\0"
    "\0"
-   /* _mesa_function_pool[18079]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[18065]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
    "pppp\0"
    "glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[18125]: WindowPos2iMESA (will be remapped) */
+   /* _mesa_function_pool[18111]: WindowPos2iMESA (will be remapped) */
    "ii\0"
    "glWindowPos2i\0"
    "glWindowPos2iARB\0"
    "glWindowPos2iMESA\0"
    "\0"
-   /* _mesa_function_pool[18178]: SecondaryColor3fvEXT (will be remapped) */
+   /* _mesa_function_pool[18164]: SecondaryColor3fvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3fv\0"
    "glSecondaryColor3fvEXT\0"
    "\0"
-   /* _mesa_function_pool[18224]: PolygonMode (offset 174) */
+   /* _mesa_function_pool[18210]: PolygonMode (offset 174) */
    "ii\0"
    "glPolygonMode\0"
    "\0"
-   /* _mesa_function_pool[18242]: CompressedTexSubImage1DARB (will be remapped) */
+   /* _mesa_function_pool[18228]: CompressedTexSubImage1DARB (will be remapped) */
    "iiiiiip\0"
    "glCompressedTexSubImage1D\0"
    "glCompressedTexSubImage1DARB\0"
    "\0"
-   /* _mesa_function_pool[18306]: VertexAttribI1iEXT (will be remapped) */
+   /* _mesa_function_pool[18292]: VertexAttribI1iEXT (will be remapped) */
    "ii\0"
    "glVertexAttribI1iEXT\0"
    "glVertexAttribI1i\0"
    "\0"
-   /* _mesa_function_pool[18349]: GetVertexAttribivNV (will be remapped) */
+   /* _mesa_function_pool[18335]: GetVertexAttribivNV (will be remapped) */
    "iip\0"
    "glGetVertexAttribivNV\0"
    "\0"
-   /* _mesa_function_pool[18376]: GetProgramStringARB (will be remapped) */
+   /* _mesa_function_pool[18362]: GetProgramStringARB (will be remapped) */
    "iip\0"
    "glGetProgramStringARB\0"
    "\0"
-   /* _mesa_function_pool[18403]: VertexAttribIPointerEXT (will be remapped) */
+   /* _mesa_function_pool[18389]: VertexAttribIPointerEXT (will be remapped) */
    "iiiip\0"
    "glVertexAttribIPointerEXT\0"
    "glVertexAttribIPointer\0"
    "\0"
-   /* _mesa_function_pool[18459]: TexBumpParameterfvATI (will be remapped) */
+   /* _mesa_function_pool[18445]: TexBumpParameterfvATI (will be remapped) */
    "ip\0"
    "glTexBumpParameterfvATI\0"
    "\0"
-   /* _mesa_function_pool[18487]: CompileShaderARB (will be remapped) */
+   /* _mesa_function_pool[18473]: CompileShaderARB (will be remapped) */
    "i\0"
    "glCompileShader\0"
    "glCompileShaderARB\0"
    "\0"
-   /* _mesa_function_pool[18525]: DeleteShader (will be remapped) */
+   /* _mesa_function_pool[18511]: DeleteShader (will be remapped) */
    "i\0"
    "glDeleteShader\0"
    "\0"
-   /* _mesa_function_pool[18543]: DisableClientState (offset 309) */
+   /* _mesa_function_pool[18529]: DisableClientState (offset 309) */
    "i\0"
    "glDisableClientState\0"
    "\0"
-   /* _mesa_function_pool[18567]: TexGeni (offset 192) */
+   /* _mesa_function_pool[18553]: TexGeni (offset 192) */
    "iii\0"
    "glTexGeni\0"
    "\0"
-   /* _mesa_function_pool[18582]: TexGenf (offset 190) */
+   /* _mesa_function_pool[18568]: TexGenf (offset 190) */
    "iif\0"
    "glTexGenf\0"
    "\0"
-   /* _mesa_function_pool[18597]: Uniform3fARB (will be remapped) */
+   /* _mesa_function_pool[18583]: Uniform3fARB (will be remapped) */
    "ifff\0"
    "glUniform3f\0"
    "glUniform3fARB\0"
    "\0"
-   /* _mesa_function_pool[18630]: TexGend (offset 188) */
+   /* _mesa_function_pool[18616]: TexGend (offset 188) */
    "iid\0"
    "glTexGend\0"
    "\0"
-   /* _mesa_function_pool[18645]: ListParameterfvSGIX (dynamic) */
+   /* _mesa_function_pool[18631]: ListParameterfvSGIX (dynamic) */
    "iip\0"
    "glListParameterfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[18672]: GetPolygonStipple (offset 274) */
+   /* _mesa_function_pool[18658]: GetPolygonStipple (offset 274) */
    "p\0"
    "glGetPolygonStipple\0"
    "\0"
-   /* _mesa_function_pool[18695]: Tangent3dvEXT (dynamic) */
+   /* _mesa_function_pool[18681]: Tangent3dvEXT (dynamic) */
    "p\0"
    "glTangent3dvEXT\0"
    "\0"
-   /* _mesa_function_pool[18714]: BindBufferOffsetEXT (will be remapped) */
+   /* _mesa_function_pool[18700]: BindBufferOffsetEXT (will be remapped) */
    "iiii\0"
    "glBindBufferOffsetEXT\0"
    "\0"
-   /* _mesa_function_pool[18742]: WindowPos3sMESA (will be remapped) */
+   /* _mesa_function_pool[18728]: WindowPos3sMESA (will be remapped) */
    "iii\0"
    "glWindowPos3s\0"
    "glWindowPos3sARB\0"
    "glWindowPos3sMESA\0"
    "\0"
-   /* _mesa_function_pool[18796]: VertexAttrib2svNV (will be remapped) */
+   /* _mesa_function_pool[18782]: VertexAttrib2svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib2svNV\0"
    "\0"
-   /* _mesa_function_pool[18820]: DisableIndexedEXT (will be remapped) */
+   /* _mesa_function_pool[18806]: DisableIndexedEXT (will be remapped) */
    "ii\0"
    "glDisableIndexedEXT\0"
    "glDisablei\0"
    "\0"
-   /* _mesa_function_pool[18855]: BindBufferBaseEXT (will be remapped) */
+   /* _mesa_function_pool[18841]: BindBufferBaseEXT (will be remapped) */
    "iii\0"
    "glBindBufferBaseEXT\0"
    "glBindBufferBase\0"
    "\0"
-   /* _mesa_function_pool[18897]: TexCoord2fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[18883]: TexCoord2fVertex3fvSUN (dynamic) */
    "pp\0"
    "glTexCoord2fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[18926]: WindowPos4sMESA (will be remapped) */
+   /* _mesa_function_pool[18912]: WindowPos4sMESA (will be remapped) */
    "iiii\0"
    "glWindowPos4sMESA\0"
    "\0"
-   /* _mesa_function_pool[18950]: VertexAttrib4NuivARB (will be remapped) */
+   /* _mesa_function_pool[18936]: VertexAttrib4NuivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nuiv\0"
    "glVertexAttrib4NuivARB\0"
    "\0"
-   /* _mesa_function_pool[18997]: ClientActiveTextureARB (offset 375) */
+   /* _mesa_function_pool[18983]: ClientActiveTextureARB (offset 375) */
    "i\0"
    "glClientActiveTexture\0"
    "glClientActiveTextureARB\0"
    "\0"
-   /* _mesa_function_pool[19047]: PixelTexGenSGIX (will be remapped) */
+   /* _mesa_function_pool[19033]: PixelTexGenSGIX (will be remapped) */
    "i\0"
    "glPixelTexGenSGIX\0"
    "\0"
-   /* _mesa_function_pool[19068]: ReplacementCodeusvSUN (dynamic) */
+   /* _mesa_function_pool[19054]: ReplacementCodeusvSUN (dynamic) */
    "p\0"
    "glReplacementCodeusvSUN\0"
    "\0"
-   /* _mesa_function_pool[19095]: Uniform4fARB (will be remapped) */
+   /* _mesa_function_pool[19081]: Uniform4fARB (will be remapped) */
    "iffff\0"
    "glUniform4f\0"
    "glUniform4fARB\0"
    "\0"
-   /* _mesa_function_pool[19129]: Color4sv (offset 34) */
+   /* _mesa_function_pool[19115]: Color4sv (offset 34) */
    "p\0"
    "glColor4sv\0"
    "\0"
-   /* _mesa_function_pool[19143]: FlushMappedBufferRange (will be remapped) */
+   /* _mesa_function_pool[19129]: FlushMappedBufferRange (will be remapped) */
    "iii\0"
    "glFlushMappedBufferRange\0"
    "\0"
-   /* _mesa_function_pool[19173]: IsProgramNV (will be remapped) */
+   /* _mesa_function_pool[19159]: IsProgramNV (will be remapped) */
    "i\0"
    "glIsProgramARB\0"
    "glIsProgramNV\0"
    "\0"
-   /* _mesa_function_pool[19205]: FlushMappedBufferRangeAPPLE (will be remapped) */
+   /* _mesa_function_pool[19191]: FlushMappedBufferRangeAPPLE (will be remapped) */
    "iii\0"
    "glFlushMappedBufferRangeAPPLE\0"
    "\0"
-   /* _mesa_function_pool[19240]: PixelZoom (offset 246) */
+   /* _mesa_function_pool[19226]: PixelZoom (offset 246) */
    "ff\0"
    "glPixelZoom\0"
    "\0"
-   /* _mesa_function_pool[19256]: ReplacementCodePointerSUN (dynamic) */
+   /* _mesa_function_pool[19242]: ReplacementCodePointerSUN (dynamic) */
    "iip\0"
    "glReplacementCodePointerSUN\0"
    "\0"
-   /* _mesa_function_pool[19289]: ProgramEnvParameter4dARB (will be remapped) */
+   /* _mesa_function_pool[19275]: ProgramEnvParameter4dARB (will be remapped) */
    "iidddd\0"
    "glProgramEnvParameter4dARB\0"
    "glProgramParameter4dNV\0"
    "\0"
-   /* _mesa_function_pool[19347]: ColorTableParameterfv (offset 340) */
+   /* _mesa_function_pool[19333]: ColorTableParameterfv (offset 340) */
    "iip\0"
    "glColorTableParameterfv\0"
    "glColorTableParameterfvSGI\0"
    "\0"
-   /* _mesa_function_pool[19403]: FragmentLightModelfSGIX (dynamic) */
+   /* _mesa_function_pool[19389]: FragmentLightModelfSGIX (dynamic) */
    "if\0"
    "glFragmentLightModelfSGIX\0"
    "\0"
-   /* _mesa_function_pool[19433]: Binormal3bvEXT (dynamic) */
+   /* _mesa_function_pool[19419]: Binormal3bvEXT (dynamic) */
    "p\0"
    "glBinormal3bvEXT\0"
    "\0"
-   /* _mesa_function_pool[19453]: PixelMapuiv (offset 252) */
+   /* _mesa_function_pool[19439]: PixelMapuiv (offset 252) */
    "iip\0"
    "glPixelMapuiv\0"
    "\0"
-   /* _mesa_function_pool[19472]: Color3dv (offset 12) */
+   /* _mesa_function_pool[19458]: Color3dv (offset 12) */
    "p\0"
    "glColor3dv\0"
    "\0"
-   /* _mesa_function_pool[19486]: IsTexture (offset 330) */
+   /* _mesa_function_pool[19472]: IsTexture (offset 330) */
    "i\0"
    "glIsTexture\0"
    "glIsTextureEXT\0"
    "\0"
-   /* _mesa_function_pool[19516]: VertexWeightfvEXT (dynamic) */
+   /* _mesa_function_pool[19502]: VertexWeightfvEXT (dynamic) */
    "p\0"
    "glVertexWeightfvEXT\0"
    "\0"
-   /* _mesa_function_pool[19539]: VertexAttrib1dARB (will be remapped) */
+   /* _mesa_function_pool[19525]: VertexAttrib1dARB (will be remapped) */
    "id\0"
    "glVertexAttrib1d\0"
    "glVertexAttrib1dARB\0"
    "\0"
-   /* _mesa_function_pool[19580]: ImageTransformParameterivHP (dynamic) */
+   /* _mesa_function_pool[19566]: ImageTransformParameterivHP (dynamic) */
    "iip\0"
    "glImageTransformParameterivHP\0"
    "\0"
-   /* _mesa_function_pool[19615]: TexCoord4i (offset 122) */
+   /* _mesa_function_pool[19601]: TexCoord4i (offset 122) */
    "iiii\0"
    "glTexCoord4i\0"
    "\0"
-   /* _mesa_function_pool[19634]: DeleteQueriesARB (will be remapped) */
+   /* _mesa_function_pool[19620]: DeleteQueriesARB (will be remapped) */
    "ip\0"
    "glDeleteQueries\0"
    "glDeleteQueriesARB\0"
    "\0"
-   /* _mesa_function_pool[19673]: Color4ubVertex2fSUN (dynamic) */
+   /* _mesa_function_pool[19659]: Color4ubVertex2fSUN (dynamic) */
    "iiiiff\0"
    "glColor4ubVertex2fSUN\0"
    "\0"
-   /* _mesa_function_pool[19703]: FragmentColorMaterialSGIX (dynamic) */
+   /* _mesa_function_pool[19689]: FragmentColorMaterialSGIX (dynamic) */
    "ii\0"
    "glFragmentColorMaterialSGIX\0"
    "\0"
-   /* _mesa_function_pool[19735]: CurrentPaletteMatrixARB (dynamic) */
+   /* _mesa_function_pool[19721]: CurrentPaletteMatrixARB (dynamic) */
    "i\0"
    "glCurrentPaletteMatrixARB\0"
    "\0"
-   /* _mesa_function_pool[19764]: GetMapdv (offset 266) */
+   /* _mesa_function_pool[19750]: GetMapdv (offset 266) */
    "iip\0"
    "glGetMapdv\0"
    "\0"
-   /* _mesa_function_pool[19780]: ObjectPurgeableAPPLE (will be remapped) */
+   /* _mesa_function_pool[19766]: ObjectPurgeableAPPLE (will be remapped) */
    "iii\0"
    "glObjectPurgeableAPPLE\0"
    "\0"
-   /* _mesa_function_pool[19808]: GetStringi (will be remapped) */
+   /* _mesa_function_pool[19794]: GetStringi (will be remapped) */
    "ii\0"
    "glGetStringi\0"
    "\0"
-   /* _mesa_function_pool[19825]: SamplePatternSGIS (will be remapped) */
+   /* _mesa_function_pool[19811]: SamplePatternSGIS (will be remapped) */
    "i\0"
    "glSamplePatternSGIS\0"
    "glSamplePatternEXT\0"
    "\0"
-   /* _mesa_function_pool[19867]: PixelStoref (offset 249) */
+   /* _mesa_function_pool[19853]: PixelStoref (offset 249) */
    "if\0"
    "glPixelStoref\0"
    "\0"
-   /* _mesa_function_pool[19885]: IsQueryARB (will be remapped) */
+   /* _mesa_function_pool[19871]: IsQueryARB (will be remapped) */
    "i\0"
    "glIsQuery\0"
    "glIsQueryARB\0"
    "\0"
-   /* _mesa_function_pool[19911]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[19897]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
    "iiiiifff\0"
    "glReplacementCodeuiColor4ubVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[19960]: PixelStorei (offset 250) */
+   /* _mesa_function_pool[19946]: PixelStorei (offset 250) */
    "ii\0"
    "glPixelStorei\0"
    "\0"
-   /* _mesa_function_pool[19978]: VertexAttrib4usvARB (will be remapped) */
+   /* _mesa_function_pool[19964]: VertexAttrib4usvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4usv\0"
    "glVertexAttrib4usvARB\0"
    "\0"
-   /* _mesa_function_pool[20023]: LinkProgramARB (will be remapped) */
+   /* _mesa_function_pool[20009]: LinkProgramARB (will be remapped) */
    "i\0"
    "glLinkProgram\0"
    "glLinkProgramARB\0"
    "\0"
-   /* _mesa_function_pool[20057]: VertexAttrib2fNV (will be remapped) */
+   /* _mesa_function_pool[20043]: VertexAttrib2fNV (will be remapped) */
    "iff\0"
    "glVertexAttrib2fNV\0"
    "\0"
-   /* _mesa_function_pool[20081]: ShaderSourceARB (will be remapped) */
+   /* _mesa_function_pool[20067]: ShaderSourceARB (will be remapped) */
    "iipp\0"
    "glShaderSource\0"
    "glShaderSourceARB\0"
    "\0"
-   /* _mesa_function_pool[20120]: FragmentMaterialiSGIX (dynamic) */
+   /* _mesa_function_pool[20106]: FragmentMaterialiSGIX (dynamic) */
    "iii\0"
    "glFragmentMaterialiSGIX\0"
    "\0"
-   /* _mesa_function_pool[20149]: EvalCoord2dv (offset 233) */
+   /* _mesa_function_pool[20135]: EvalCoord2dv (offset 233) */
    "p\0"
    "glEvalCoord2dv\0"
    "\0"
-   /* _mesa_function_pool[20167]: VertexAttrib3svARB (will be remapped) */
+   /* _mesa_function_pool[20153]: VertexAttrib3svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib3sv\0"
    "glVertexAttrib3svARB\0"
    "\0"
-   /* _mesa_function_pool[20210]: ColorMaterial (offset 151) */
+   /* _mesa_function_pool[20196]: ColorMaterial (offset 151) */
    "ii\0"
    "glColorMaterial\0"
    "\0"
-   /* _mesa_function_pool[20230]: CompressedTexSubImage3DARB (will be remapped) */
+   /* _mesa_function_pool[20216]: CompressedTexSubImage3DARB (will be remapped) */
    "iiiiiiiiiip\0"
    "glCompressedTexSubImage3D\0"
    "glCompressedTexSubImage3DARB\0"
    "\0"
-   /* _mesa_function_pool[20298]: WindowPos2ivMESA (will be remapped) */
+   /* _mesa_function_pool[20284]: WindowPos2ivMESA (will be remapped) */
    "p\0"
    "glWindowPos2iv\0"
    "glWindowPos2ivARB\0"
    "glWindowPos2ivMESA\0"
    "\0"
-   /* _mesa_function_pool[20353]: IsFramebufferEXT (will be remapped) */
+   /* _mesa_function_pool[20339]: IsFramebufferEXT (will be remapped) */
    "i\0"
    "glIsFramebuffer\0"
    "glIsFramebufferEXT\0"
    "\0"
-   /* _mesa_function_pool[20391]: Uniform4ivARB (will be remapped) */
+   /* _mesa_function_pool[20377]: Uniform4ivARB (will be remapped) */
    "iip\0"
    "glUniform4iv\0"
    "glUniform4ivARB\0"
    "\0"
-   /* _mesa_function_pool[20425]: GetVertexAttribdvARB (will be remapped) */
+   /* _mesa_function_pool[20411]: GetVertexAttribdvARB (will be remapped) */
    "iip\0"
    "glGetVertexAttribdv\0"
    "glGetVertexAttribdvARB\0"
    "\0"
-   /* _mesa_function_pool[20473]: TexBumpParameterivATI (will be remapped) */
+   /* _mesa_function_pool[20459]: TexBumpParameterivATI (will be remapped) */
    "ip\0"
    "glTexBumpParameterivATI\0"
    "\0"
-   /* _mesa_function_pool[20501]: GetSeparableFilter (offset 359) */
+   /* _mesa_function_pool[20487]: GetSeparableFilter (offset 359) */
    "iiippp\0"
    "glGetSeparableFilter\0"
    "glGetSeparableFilterEXT\0"
    "\0"
-   /* _mesa_function_pool[20554]: Binormal3dEXT (dynamic) */
+   /* _mesa_function_pool[20540]: Binormal3dEXT (dynamic) */
    "ddd\0"
    "glBinormal3dEXT\0"
    "\0"
-   /* _mesa_function_pool[20575]: SpriteParameteriSGIX (dynamic) */
+   /* _mesa_function_pool[20561]: SpriteParameteriSGIX (dynamic) */
    "ii\0"
    "glSpriteParameteriSGIX\0"
    "\0"
-   /* _mesa_function_pool[20602]: RequestResidentProgramsNV (will be remapped) */
+   /* _mesa_function_pool[20588]: RequestResidentProgramsNV (will be remapped) */
    "ip\0"
    "glRequestResidentProgramsNV\0"
    "\0"
-   /* _mesa_function_pool[20634]: TagSampleBufferSGIX (dynamic) */
+   /* _mesa_function_pool[20620]: TagSampleBufferSGIX (dynamic) */
    "\0"
    "glTagSampleBufferSGIX\0"
    "\0"
-   /* _mesa_function_pool[20658]: TransformFeedbackVaryingsEXT (will be remapped) */
+   /* _mesa_function_pool[20644]: TransformFeedbackVaryingsEXT (will be remapped) */
    "iipi\0"
    "glTransformFeedbackVaryingsEXT\0"
    "glTransformFeedbackVaryings\0"
    "\0"
-   /* _mesa_function_pool[20723]: FeedbackBuffer (offset 194) */
+   /* _mesa_function_pool[20709]: FeedbackBuffer (offset 194) */
    "iip\0"
    "glFeedbackBuffer\0"
    "\0"
-   /* _mesa_function_pool[20745]: RasterPos2iv (offset 67) */
+   /* _mesa_function_pool[20731]: RasterPos2iv (offset 67) */
    "p\0"
    "glRasterPos2iv\0"
    "\0"
-   /* _mesa_function_pool[20763]: TexImage1D (offset 182) */
+   /* _mesa_function_pool[20749]: TexImage1D (offset 182) */
    "iiiiiiip\0"
    "glTexImage1D\0"
    "\0"
-   /* _mesa_function_pool[20786]: ListParameterivSGIX (dynamic) */
+   /* _mesa_function_pool[20772]: ListParameterivSGIX (dynamic) */
    "iip\0"
    "glListParameterivSGIX\0"
    "\0"
-   /* _mesa_function_pool[20813]: MultiDrawElementsEXT (will be remapped) */
+   /* _mesa_function_pool[20799]: MultiDrawElementsEXT (will be remapped) */
    "ipipi\0"
    "glMultiDrawElements\0"
    "glMultiDrawElementsEXT\0"
    "\0"
-   /* _mesa_function_pool[20863]: Color3s (offset 17) */
+   /* _mesa_function_pool[20849]: Color3s (offset 17) */
    "iii\0"
    "glColor3s\0"
    "\0"
-   /* _mesa_function_pool[20878]: Uniform1ivARB (will be remapped) */
+   /* _mesa_function_pool[20864]: Uniform1ivARB (will be remapped) */
    "iip\0"
    "glUniform1iv\0"
    "glUniform1ivARB\0"
    "\0"
-   /* _mesa_function_pool[20912]: WindowPos2sMESA (will be remapped) */
+   /* _mesa_function_pool[20898]: WindowPos2sMESA (will be remapped) */
    "ii\0"
    "glWindowPos2s\0"
    "glWindowPos2sARB\0"
    "glWindowPos2sMESA\0"
    "\0"
-   /* _mesa_function_pool[20965]: WeightusvARB (dynamic) */
+   /* _mesa_function_pool[20951]: WeightusvARB (dynamic) */
    "ip\0"
    "glWeightusvARB\0"
    "\0"
-   /* _mesa_function_pool[20984]: TexCoordPointer (offset 320) */
+   /* _mesa_function_pool[20970]: TexCoordPointer (offset 320) */
    "iiip\0"
    "glTexCoordPointer\0"
    "\0"
-   /* _mesa_function_pool[21008]: FogCoordPointerEXT (will be remapped) */
+   /* _mesa_function_pool[20994]: FogCoordPointerEXT (will be remapped) */
    "iip\0"
    "glFogCoordPointer\0"
    "glFogCoordPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[21052]: IndexMaterialEXT (dynamic) */
+   /* _mesa_function_pool[21038]: IndexMaterialEXT (dynamic) */
    "ii\0"
    "glIndexMaterialEXT\0"
    "\0"
-   /* _mesa_function_pool[21075]: Color3i (offset 15) */
+   /* _mesa_function_pool[21061]: Color3i (offset 15) */
    "iii\0"
    "glColor3i\0"
    "\0"
-   /* _mesa_function_pool[21090]: FrontFace (offset 157) */
+   /* _mesa_function_pool[21076]: FrontFace (offset 157) */
    "i\0"
    "glFrontFace\0"
    "\0"
-   /* _mesa_function_pool[21105]: EvalCoord2d (offset 232) */
+   /* _mesa_function_pool[21091]: EvalCoord2d (offset 232) */
    "dd\0"
    "glEvalCoord2d\0"
    "\0"
-   /* _mesa_function_pool[21123]: SecondaryColor3ubvEXT (will be remapped) */
+   /* _mesa_function_pool[21109]: SecondaryColor3ubvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3ubv\0"
    "glSecondaryColor3ubvEXT\0"
    "\0"
-   /* _mesa_function_pool[21171]: EvalCoord2f (offset 234) */
+   /* _mesa_function_pool[21157]: EvalCoord2f (offset 234) */
    "ff\0"
    "glEvalCoord2f\0"
    "\0"
-   /* _mesa_function_pool[21189]: VertexAttrib4dvARB (will be remapped) */
+   /* _mesa_function_pool[21175]: VertexAttrib4dvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4dv\0"
    "glVertexAttrib4dvARB\0"
    "\0"
-   /* _mesa_function_pool[21232]: BindAttribLocationARB (will be remapped) */
+   /* _mesa_function_pool[21218]: BindAttribLocationARB (will be remapped) */
    "iip\0"
    "glBindAttribLocation\0"
    "glBindAttribLocationARB\0"
    "\0"
-   /* _mesa_function_pool[21282]: Color3b (offset 9) */
+   /* _mesa_function_pool[21268]: Color3b (offset 9) */
    "iii\0"
    "glColor3b\0"
    "\0"
-   /* _mesa_function_pool[21297]: MultiTexCoord2dARB (offset 384) */
+   /* _mesa_function_pool[21283]: MultiTexCoord2dARB (offset 384) */
    "idd\0"
    "glMultiTexCoord2d\0"
    "glMultiTexCoord2dARB\0"
    "\0"
-   /* _mesa_function_pool[21341]: ExecuteProgramNV (will be remapped) */
+   /* _mesa_function_pool[21327]: ExecuteProgramNV (will be remapped) */
    "iip\0"
    "glExecuteProgramNV\0"
    "\0"
-   /* _mesa_function_pool[21365]: Color3f (offset 13) */
+   /* _mesa_function_pool[21351]: Color3f (offset 13) */
    "fff\0"
    "glColor3f\0"
    "\0"
-   /* _mesa_function_pool[21380]: LightEnviSGIX (dynamic) */
+   /* _mesa_function_pool[21366]: LightEnviSGIX (dynamic) */
    "ii\0"
    "glLightEnviSGIX\0"
    "\0"
-   /* _mesa_function_pool[21400]: Color3d (offset 11) */
+   /* _mesa_function_pool[21386]: Color3d (offset 11) */
    "ddd\0"
    "glColor3d\0"
    "\0"
-   /* _mesa_function_pool[21415]: Normal3dv (offset 55) */
+   /* _mesa_function_pool[21401]: Normal3dv (offset 55) */
    "p\0"
    "glNormal3dv\0"
    "\0"
-   /* _mesa_function_pool[21430]: Lightf (offset 159) */
+   /* _mesa_function_pool[21416]: Lightf (offset 159) */
    "iif\0"
    "glLightf\0"
    "\0"
-   /* _mesa_function_pool[21444]: ReplacementCodeuiSUN (dynamic) */
+   /* _mesa_function_pool[21430]: ReplacementCodeuiSUN (dynamic) */
    "i\0"
    "glReplacementCodeuiSUN\0"
    "\0"
-   /* _mesa_function_pool[21470]: MatrixMode (offset 293) */
+   /* _mesa_function_pool[21456]: MatrixMode (offset 293) */
    "i\0"
    "glMatrixMode\0"
    "\0"
-   /* _mesa_function_pool[21486]: GetPixelMapusv (offset 273) */
+   /* _mesa_function_pool[21472]: GetPixelMapusv (offset 273) */
    "ip\0"
    "glGetPixelMapusv\0"
    "\0"
-   /* _mesa_function_pool[21507]: Lighti (offset 161) */
+   /* _mesa_function_pool[21493]: Lighti (offset 161) */
    "iii\0"
    "glLighti\0"
    "\0"
-   /* _mesa_function_pool[21521]: VertexAttribPointerNV (will be remapped) */
+   /* _mesa_function_pool[21507]: VertexAttribPointerNV (will be remapped) */
    "iiiip\0"
    "glVertexAttribPointerNV\0"
    "\0"
-   /* _mesa_function_pool[21552]: GetBooleanIndexedvEXT (will be remapped) */
+   /* _mesa_function_pool[21538]: ClearDepthf (will be remapped) */
+   "f\0"
+   "glClearDepthf\0"
+   "\0"
+   /* _mesa_function_pool[21555]: GetBooleanIndexedvEXT (will be remapped) */
    "iip\0"
    "glGetBooleanIndexedvEXT\0"
    "glGetBooleani_v\0"
    "\0"
-   /* _mesa_function_pool[21597]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
+   /* _mesa_function_pool[21600]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
    "iiip\0"
    "glGetFramebufferAttachmentParameteriv\0"
    "glGetFramebufferAttachmentParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[21682]: PixelTransformParameterfEXT (dynamic) */
+   /* _mesa_function_pool[21685]: PixelTransformParameterfEXT (dynamic) */
    "iif\0"
    "glPixelTransformParameterfEXT\0"
    "\0"
-   /* _mesa_function_pool[21717]: MultiTexCoord4dvARB (offset 401) */
+   /* _mesa_function_pool[21720]: MultiTexCoord4dvARB (offset 401) */
    "ip\0"
    "glMultiTexCoord4dv\0"
    "glMultiTexCoord4dvARB\0"
    "\0"
-   /* _mesa_function_pool[21762]: PixelTransformParameteriEXT (dynamic) */
+   /* _mesa_function_pool[21765]: PixelTransformParameteriEXT (dynamic) */
    "iii\0"
    "glPixelTransformParameteriEXT\0"
    "\0"
-   /* _mesa_function_pool[21797]: GetDoublev (offset 260) */
+   /* _mesa_function_pool[21800]: GetDoublev (offset 260) */
    "ip\0"
    "glGetDoublev\0"
    "\0"
-   /* _mesa_function_pool[21814]: MultMatrixd (offset 295) */
+   /* _mesa_function_pool[21817]: MultMatrixd (offset 295) */
    "p\0"
    "glMultMatrixd\0"
    "\0"
-   /* _mesa_function_pool[21831]: MultMatrixf (offset 294) */
+   /* _mesa_function_pool[21834]: MultMatrixf (offset 294) */
    "p\0"
    "glMultMatrixf\0"
    "\0"
-   /* _mesa_function_pool[21848]: VertexAttribI4bvEXT (will be remapped) */
+   /* _mesa_function_pool[21851]: VertexAttribI4bvEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4bvEXT\0"
    "glVertexAttribI4bv\0"
    "\0"
-   /* _mesa_function_pool[21893]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[21896]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
    "ffiiiifff\0"
    "glTexCoord2fColor4ubVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[21936]: Uniform1iARB (will be remapped) */
+   /* _mesa_function_pool[21939]: Uniform1iARB (will be remapped) */
    "ii\0"
    "glUniform1i\0"
    "glUniform1iARB\0"
    "\0"
-   /* _mesa_function_pool[21967]: VertexAttribPointerARB (will be remapped) */
+   /* _mesa_function_pool[21970]: VertexAttribPointerARB (will be remapped) */
    "iiiiip\0"
    "glVertexAttribPointer\0"
    "glVertexAttribPointerARB\0"
    "\0"
-   /* _mesa_function_pool[22022]: VertexAttrib3sNV (will be remapped) */
+   /* _mesa_function_pool[22025]: VertexAttrib3sNV (will be remapped) */
    "iiii\0"
    "glVertexAttrib3sNV\0"
    "\0"
-   /* _mesa_function_pool[22047]: SharpenTexFuncSGIS (dynamic) */
+   /* _mesa_function_pool[22050]: SharpenTexFuncSGIS (dynamic) */
    "iip\0"
    "glSharpenTexFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[22073]: MultiTexCoord4fvARB (offset 403) */
+   /* _mesa_function_pool[22076]: MultiTexCoord4fvARB (offset 403) */
    "ip\0"
    "glMultiTexCoord4fv\0"
    "glMultiTexCoord4fvARB\0"
    "\0"
-   /* _mesa_function_pool[22118]: Uniform2uiEXT (will be remapped) */
+   /* _mesa_function_pool[22121]: Uniform2uiEXT (will be remapped) */
    "iii\0"
    "glUniform2uiEXT\0"
    "glUniform2ui\0"
    "\0"
-   /* _mesa_function_pool[22152]: UniformMatrix2x3fv (will be remapped) */
+   /* _mesa_function_pool[22155]: UniformMatrix2x3fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix2x3fv\0"
    "\0"
-   /* _mesa_function_pool[22179]: TrackMatrixNV (will be remapped) */
+   /* _mesa_function_pool[22182]: TrackMatrixNV (will be remapped) */
    "iiii\0"
    "glTrackMatrixNV\0"
    "\0"
-   /* _mesa_function_pool[22201]: CombinerParameteriNV (will be remapped) */
+   /* _mesa_function_pool[22204]: CombinerParameteriNV (will be remapped) */
    "ii\0"
    "glCombinerParameteriNV\0"
    "\0"
-   /* _mesa_function_pool[22228]: DeleteAsyncMarkersSGIX (dynamic) */
+   /* _mesa_function_pool[22231]: DeleteAsyncMarkersSGIX (dynamic) */
    "ii\0"
    "glDeleteAsyncMarkersSGIX\0"
    "\0"
-   /* _mesa_function_pool[22257]: ReplacementCodeusSUN (dynamic) */
+   /* _mesa_function_pool[22260]: ReplacementCodeusSUN (dynamic) */
    "i\0"
    "glReplacementCodeusSUN\0"
    "\0"
-   /* _mesa_function_pool[22283]: IsAsyncMarkerSGIX (dynamic) */
+   /* _mesa_function_pool[22286]: IsAsyncMarkerSGIX (dynamic) */
    "i\0"
    "glIsAsyncMarkerSGIX\0"
    "\0"
-   /* _mesa_function_pool[22306]: FrameZoomSGIX (dynamic) */
+   /* _mesa_function_pool[22309]: FrameZoomSGIX (dynamic) */
    "i\0"
    "glFrameZoomSGIX\0"
    "\0"
-   /* _mesa_function_pool[22325]: Normal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[22328]: Normal3fVertex3fvSUN (dynamic) */
    "pp\0"
    "glNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[22352]: RasterPos4sv (offset 85) */
+   /* _mesa_function_pool[22355]: RasterPos4sv (offset 85) */
    "p\0"
    "glRasterPos4sv\0"
    "\0"
-   /* _mesa_function_pool[22370]: VertexAttrib4NsvARB (will be remapped) */
+   /* _mesa_function_pool[22373]: VertexAttrib4NsvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nsv\0"
    "glVertexAttrib4NsvARB\0"
    "\0"
-   /* _mesa_function_pool[22415]: VertexAttrib3fvARB (will be remapped) */
+   /* _mesa_function_pool[22418]: VertexAttrib3fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib3fv\0"
    "glVertexAttrib3fvARB\0"
    "\0"
-   /* _mesa_function_pool[22458]: ClearColor (offset 206) */
+   /* _mesa_function_pool[22461]: ClearColor (offset 206) */
    "ffff\0"
    "glClearColor\0"
    "\0"
-   /* _mesa_function_pool[22477]: GetSynciv (will be remapped) */
+   /* _mesa_function_pool[22480]: GetSynciv (will be remapped) */
    "iiipp\0"
    "glGetSynciv\0"
    "\0"
-   /* _mesa_function_pool[22496]: ClearColorIiEXT (will be remapped) */
+   /* _mesa_function_pool[22499]: ClearColorIiEXT (will be remapped) */
    "iiii\0"
    "glClearColorIiEXT\0"
    "\0"
-   /* _mesa_function_pool[22520]: DeleteFramebuffersEXT (will be remapped) */
+   /* _mesa_function_pool[22523]: DeleteFramebuffersEXT (will be remapped) */
    "ip\0"
    "glDeleteFramebuffers\0"
    "glDeleteFramebuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[22569]: GlobalAlphaFactorsSUN (dynamic) */
+   /* _mesa_function_pool[22572]: GlobalAlphaFactorsSUN (dynamic) */
    "i\0"
    "glGlobalAlphaFactorsSUN\0"
    "\0"
-   /* _mesa_function_pool[22596]: IsEnabledIndexedEXT (will be remapped) */
+   /* _mesa_function_pool[22599]: IsEnabledIndexedEXT (will be remapped) */
    "ii\0"
    "glIsEnabledIndexedEXT\0"
    "glIsEnabledi\0"
    "\0"
-   /* _mesa_function_pool[22635]: TexEnviv (offset 187) */
+   /* _mesa_function_pool[22638]: TexEnviv (offset 187) */
    "iip\0"
    "glTexEnviv\0"
    "\0"
-   /* _mesa_function_pool[22651]: TexSubImage3D (offset 372) */
+   /* _mesa_function_pool[22654]: TexSubImage3D (offset 372) */
    "iiiiiiiiiip\0"
    "glTexSubImage3D\0"
    "glTexSubImage3DEXT\0"
    "\0"
-   /* _mesa_function_pool[22699]: Tangent3fEXT (dynamic) */
+   /* _mesa_function_pool[22702]: Tangent3fEXT (dynamic) */
    "fff\0"
    "glTangent3fEXT\0"
    "\0"
-   /* _mesa_function_pool[22719]: SecondaryColor3uivEXT (will be remapped) */
+   /* _mesa_function_pool[22722]: SecondaryColor3uivEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3uiv\0"
    "glSecondaryColor3uivEXT\0"
    "\0"
-   /* _mesa_function_pool[22767]: MatrixIndexubvARB (dynamic) */
+   /* _mesa_function_pool[22770]: MatrixIndexubvARB (dynamic) */
    "ip\0"
    "glMatrixIndexubvARB\0"
    "\0"
-   /* _mesa_function_pool[22791]: Color4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[22794]: Color4fNormal3fVertex3fSUN (dynamic) */
    "ffffffffff\0"
    "glColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[22832]: PixelTexGenParameterfSGIS (will be remapped) */
+   /* _mesa_function_pool[22835]: PixelTexGenParameterfSGIS (will be remapped) */
    "if\0"
    "glPixelTexGenParameterfSGIS\0"
    "\0"
-   /* _mesa_function_pool[22864]: CreateShader (will be remapped) */
+   /* _mesa_function_pool[22867]: CreateShader (will be remapped) */
    "i\0"
    "glCreateShader\0"
    "\0"
-   /* _mesa_function_pool[22882]: GetColorTableParameterfv (offset 344) */
+   /* _mesa_function_pool[22885]: GetColorTableParameterfv (offset 344) */
    "iip\0"
    "glGetColorTableParameterfv\0"
    "glGetColorTableParameterfvSGI\0"
    "glGetColorTableParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[22974]: FragmentLightModelfvSGIX (dynamic) */
+   /* _mesa_function_pool[22977]: FragmentLightModelfvSGIX (dynamic) */
    "ip\0"
    "glFragmentLightModelfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[23005]: Bitmap (offset 8) */
+   /* _mesa_function_pool[23008]: Bitmap (offset 8) */
    "iiffffp\0"
    "glBitmap\0"
    "\0"
-   /* _mesa_function_pool[23023]: MultiTexCoord3fARB (offset 394) */
+   /* _mesa_function_pool[23026]: MultiTexCoord3fARB (offset 394) */
    "ifff\0"
    "glMultiTexCoord3f\0"
    "glMultiTexCoord3fARB\0"
    "\0"
-   /* _mesa_function_pool[23068]: GetTexLevelParameterfv (offset 284) */
+   /* _mesa_function_pool[23071]: GetTexLevelParameterfv (offset 284) */
    "iiip\0"
    "glGetTexLevelParameterfv\0"
    "\0"
-   /* _mesa_function_pool[23099]: GetPixelTexGenParameterfvSGIS (will be remapped) */
+   /* _mesa_function_pool[23102]: GetPixelTexGenParameterfvSGIS (will be remapped) */
    "ip\0"
    "glGetPixelTexGenParameterfvSGIS\0"
    "\0"
-   /* _mesa_function_pool[23135]: GenFramebuffersEXT (will be remapped) */
+   /* _mesa_function_pool[23138]: GenFramebuffersEXT (will be remapped) */
    "ip\0"
    "glGenFramebuffers\0"
    "glGenFramebuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[23178]: VertexAttribDivisor (will be remapped) */
+   /* _mesa_function_pool[23181]: VertexAttribDivisor (will be remapped) */
    "ii\0"
    "glVertexAttribDivisor\0"
    "\0"
-   /* _mesa_function_pool[23204]: GetProgramParameterdvNV (will be remapped) */
+   /* _mesa_function_pool[23207]: GetProgramParameterdvNV (will be remapped) */
    "iiip\0"
    "glGetProgramParameterdvNV\0"
    "\0"
-   /* _mesa_function_pool[23236]: Vertex2sv (offset 133) */
+   /* _mesa_function_pool[23239]: Vertex2sv (offset 133) */
    "p\0"
    "glVertex2sv\0"
    "\0"
-   /* _mesa_function_pool[23251]: GetIntegerv (offset 263) */
+   /* _mesa_function_pool[23254]: GetIntegerv (offset 263) */
    "ip\0"
    "glGetIntegerv\0"
    "\0"
-   /* _mesa_function_pool[23269]: IsVertexArrayAPPLE (will be remapped) */
+   /* _mesa_function_pool[23272]: IsVertexArrayAPPLE (will be remapped) */
    "i\0"
    "glIsVertexArray\0"
    "glIsVertexArrayAPPLE\0"
    "\0"
-   /* _mesa_function_pool[23309]: FragmentLightfvSGIX (dynamic) */
+   /* _mesa_function_pool[23312]: FragmentLightfvSGIX (dynamic) */
    "iip\0"
    "glFragmentLightfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[23336]: DetachShader (will be remapped) */
+   /* _mesa_function_pool[23339]: DetachShader (will be remapped) */
    "ii\0"
    "glDetachShader\0"
    "\0"
-   /* _mesa_function_pool[23355]: VertexAttrib4NubARB (will be remapped) */
+   /* _mesa_function_pool[23358]: VertexAttrib4NubARB (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4Nub\0"
    "glVertexAttrib4NubARB\0"
    "\0"
-   /* _mesa_function_pool[23403]: GetProgramEnvParameterfvARB (will be remapped) */
+   /* _mesa_function_pool[23406]: GetProgramEnvParameterfvARB (will be remapped) */
    "iip\0"
    "glGetProgramEnvParameterfvARB\0"
    "\0"
-   /* _mesa_function_pool[23438]: GetTrackMatrixivNV (will be remapped) */
+   /* _mesa_function_pool[23441]: GetTrackMatrixivNV (will be remapped) */
    "iiip\0"
    "glGetTrackMatrixivNV\0"
    "\0"
-   /* _mesa_function_pool[23465]: VertexAttrib3svNV (will be remapped) */
+   /* _mesa_function_pool[23468]: VertexAttrib3svNV (will be remapped) */
    "ip\0"
    "glVertexAttrib3svNV\0"
    "\0"
-   /* _mesa_function_pool[23489]: Uniform4fvARB (will be remapped) */
+   /* _mesa_function_pool[23492]: Uniform4fvARB (will be remapped) */
    "iip\0"
    "glUniform4fv\0"
    "glUniform4fvARB\0"
    "\0"
-   /* _mesa_function_pool[23523]: MultTransposeMatrixfARB (will be remapped) */
+   /* _mesa_function_pool[23526]: MultTransposeMatrixfARB (will be remapped) */
    "p\0"
    "glMultTransposeMatrixf\0"
    "glMultTransposeMatrixfARB\0"
    "\0"
-   /* _mesa_function_pool[23575]: GetTexEnviv (offset 277) */
+   /* _mesa_function_pool[23578]: GetTexEnviv (offset 277) */
    "iip\0"
    "glGetTexEnviv\0"
    "\0"
-   /* _mesa_function_pool[23594]: ColorFragmentOp1ATI (will be remapped) */
+   /* _mesa_function_pool[23597]: ColorFragmentOp1ATI (will be remapped) */
    "iiiiiii\0"
    "glColorFragmentOp1ATI\0"
    "\0"
-   /* _mesa_function_pool[23625]: GetUniformfvARB (will be remapped) */
+   /* _mesa_function_pool[23628]: GetUniformfvARB (will be remapped) */
    "iip\0"
    "glGetUniformfv\0"
    "glGetUniformfvARB\0"
    "\0"
-   /* _mesa_function_pool[23663]: EGLImageTargetRenderbufferStorageOES (will be remapped) */
+   /* _mesa_function_pool[23666]: EGLImageTargetRenderbufferStorageOES (will be remapped) */
    "ip\0"
    "glEGLImageTargetRenderbufferStorageOES\0"
    "\0"
-   /* _mesa_function_pool[23706]: VertexAttribI2ivEXT (will be remapped) */
+   /* _mesa_function_pool[23709]: VertexAttribI2ivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI2ivEXT\0"
    "glVertexAttribI2iv\0"
    "\0"
-   /* _mesa_function_pool[23751]: PopClientAttrib (offset 334) */
+   /* _mesa_function_pool[23754]: PopClientAttrib (offset 334) */
    "\0"
    "glPopClientAttrib\0"
    "\0"
-   /* _mesa_function_pool[23771]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[23774]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
    "iffffffffffff\0"
    "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[23842]: DetachObjectARB (will be remapped) */
+   /* _mesa_function_pool[23845]: DetachObjectARB (will be remapped) */
    "ii\0"
    "glDetachObjectARB\0"
    "\0"
-   /* _mesa_function_pool[23864]: VertexBlendARB (dynamic) */
+   /* _mesa_function_pool[23867]: VertexBlendARB (dynamic) */
    "i\0"
    "glVertexBlendARB\0"
    "\0"
-   /* _mesa_function_pool[23884]: WindowPos3iMESA (will be remapped) */
+   /* _mesa_function_pool[23887]: WindowPos3iMESA (will be remapped) */
    "iii\0"
    "glWindowPos3i\0"
    "glWindowPos3iARB\0"
    "glWindowPos3iMESA\0"
    "\0"
-   /* _mesa_function_pool[23938]: SeparableFilter2D (offset 360) */
+   /* _mesa_function_pool[23941]: SeparableFilter2D (offset 360) */
    "iiiiiipp\0"
    "glSeparableFilter2D\0"
    "glSeparableFilter2DEXT\0"
    "\0"
-   /* _mesa_function_pool[23991]: ProgramParameteriARB (will be remapped) */
+   /* _mesa_function_pool[23994]: ProgramParameteriARB (will be remapped) */
    "iii\0"
    "glProgramParameteriARB\0"
    "\0"
-   /* _mesa_function_pool[24019]: Map1d (offset 220) */
+   /* _mesa_function_pool[24022]: Map1d (offset 220) */
    "iddiip\0"
    "glMap1d\0"
    "\0"
-   /* _mesa_function_pool[24035]: Map1f (offset 221) */
+   /* _mesa_function_pool[24038]: Map1f (offset 221) */
    "iffiip\0"
    "glMap1f\0"
    "\0"
-   /* _mesa_function_pool[24051]: CompressedTexImage2DARB (will be remapped) */
+   /* _mesa_function_pool[24054]: CompressedTexImage2DARB (will be remapped) */
    "iiiiiiip\0"
    "glCompressedTexImage2D\0"
    "glCompressedTexImage2DARB\0"
    "\0"
-   /* _mesa_function_pool[24110]: ArrayElement (offset 306) */
+   /* _mesa_function_pool[24113]: ArrayElement (offset 306) */
    "i\0"
    "glArrayElement\0"
    "glArrayElementEXT\0"
    "\0"
-   /* _mesa_function_pool[24146]: TexImage2D (offset 183) */
+   /* _mesa_function_pool[24149]: TexImage2D (offset 183) */
    "iiiiiiiip\0"
    "glTexImage2D\0"
    "\0"
-   /* _mesa_function_pool[24170]: DepthBoundsEXT (will be remapped) */
+   /* _mesa_function_pool[24173]: DepthBoundsEXT (will be remapped) */
    "dd\0"
    "glDepthBoundsEXT\0"
    "\0"
-   /* _mesa_function_pool[24191]: ProgramParameters4fvNV (will be remapped) */
+   /* _mesa_function_pool[24194]: ProgramParameters4fvNV (will be remapped) */
    "iiip\0"
    "glProgramParameters4fvNV\0"
    "\0"
-   /* _mesa_function_pool[24222]: DeformationMap3fSGIX (dynamic) */
+   /* _mesa_function_pool[24225]: DeformationMap3fSGIX (dynamic) */
    "iffiiffiiffiip\0"
    "glDeformationMap3fSGIX\0"
    "\0"
-   /* _mesa_function_pool[24261]: GetProgramivNV (will be remapped) */
+   /* _mesa_function_pool[24264]: GetProgramivNV (will be remapped) */
    "iip\0"
    "glGetProgramivNV\0"
    "\0"
-   /* _mesa_function_pool[24283]: GetFragDataLocationEXT (will be remapped) */
+   /* _mesa_function_pool[24286]: GetFragDataLocationEXT (will be remapped) */
    "ip\0"
    "glGetFragDataLocationEXT\0"
    "glGetFragDataLocation\0"
    "\0"
-   /* _mesa_function_pool[24334]: GetMinmaxParameteriv (offset 366) */
+   /* _mesa_function_pool[24337]: GetMinmaxParameteriv (offset 366) */
    "iip\0"
    "glGetMinmaxParameteriv\0"
    "glGetMinmaxParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[24388]: PixelTransferf (offset 247) */
+   /* _mesa_function_pool[24391]: PixelTransferf (offset 247) */
    "if\0"
    "glPixelTransferf\0"
    "\0"
-   /* _mesa_function_pool[24409]: CopyTexImage1D (offset 323) */
+   /* _mesa_function_pool[24412]: CopyTexImage1D (offset 323) */
    "iiiiiii\0"
    "glCopyTexImage1D\0"
    "glCopyTexImage1DEXT\0"
    "\0"
-   /* _mesa_function_pool[24455]: PushMatrix (offset 298) */
+   /* _mesa_function_pool[24458]: PushMatrix (offset 298) */
    "\0"
    "glPushMatrix\0"
    "\0"
-   /* _mesa_function_pool[24470]: Fogiv (offset 156) */
+   /* _mesa_function_pool[24473]: Fogiv (offset 156) */
    "ip\0"
    "glFogiv\0"
    "\0"
-   /* _mesa_function_pool[24482]: TexCoord1dv (offset 95) */
+   /* _mesa_function_pool[24485]: TexCoord1dv (offset 95) */
    "p\0"
    "glTexCoord1dv\0"
    "\0"
-   /* _mesa_function_pool[24499]: AlphaFragmentOp3ATI (will be remapped) */
+   /* _mesa_function_pool[24502]: AlphaFragmentOp3ATI (will be remapped) */
    "iiiiiiiiiiii\0"
    "glAlphaFragmentOp3ATI\0"
    "\0"
-   /* _mesa_function_pool[24535]: PixelTransferi (offset 248) */
+   /* _mesa_function_pool[24538]: PixelTransferi (offset 248) */
    "ii\0"
    "glPixelTransferi\0"
    "\0"
-   /* _mesa_function_pool[24556]: GetVertexAttribdvNV (will be remapped) */
+   /* _mesa_function_pool[24559]: GetVertexAttribdvNV (will be remapped) */
    "iip\0"
    "glGetVertexAttribdvNV\0"
    "\0"
-   /* _mesa_function_pool[24583]: VertexAttrib3fvNV (will be remapped) */
+   /* _mesa_function_pool[24586]: VertexAttrib3fvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib3fvNV\0"
    "\0"
-   /* _mesa_function_pool[24607]: Rotatef (offset 300) */
+   /* _mesa_function_pool[24610]: Rotatef (offset 300) */
    "ffff\0"
    "glRotatef\0"
    "\0"
-   /* _mesa_function_pool[24623]: GetFinalCombinerInputParameterivNV (will be remapped) */
+   /* _mesa_function_pool[24626]: GetFinalCombinerInputParameterivNV (will be remapped) */
    "iip\0"
    "glGetFinalCombinerInputParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[24665]: Vertex3i (offset 138) */
+   /* _mesa_function_pool[24668]: Vertex3i (offset 138) */
    "iii\0"
    "glVertex3i\0"
    "\0"
-   /* _mesa_function_pool[24681]: Vertex3f (offset 136) */
+   /* _mesa_function_pool[24684]: Vertex3f (offset 136) */
    "fff\0"
    "glVertex3f\0"
    "\0"
-   /* _mesa_function_pool[24697]: Clear (offset 203) */
+   /* _mesa_function_pool[24700]: Clear (offset 203) */
    "i\0"
    "glClear\0"
    "\0"
-   /* _mesa_function_pool[24708]: Vertex3d (offset 134) */
+   /* _mesa_function_pool[24711]: Vertex3d (offset 134) */
    "ddd\0"
    "glVertex3d\0"
    "\0"
-   /* _mesa_function_pool[24724]: GetMapParameterivNV (dynamic) */
+   /* _mesa_function_pool[24727]: GetMapParameterivNV (dynamic) */
    "iip\0"
    "glGetMapParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[24751]: Uniform4iARB (will be remapped) */
+   /* _mesa_function_pool[24754]: Uniform4iARB (will be remapped) */
    "iiiii\0"
    "glUniform4i\0"
    "glUniform4iARB\0"
    "\0"
-   /* _mesa_function_pool[24785]: ReadBuffer (offset 254) */
+   /* _mesa_function_pool[24788]: ReadBuffer (offset 254) */
    "i\0"
    "glReadBuffer\0"
    "\0"
-   /* _mesa_function_pool[24801]: ConvolutionParameteri (offset 352) */
+   /* _mesa_function_pool[24804]: ConvolutionParameteri (offset 352) */
    "iii\0"
    "glConvolutionParameteri\0"
    "glConvolutionParameteriEXT\0"
    "\0"
-   /* _mesa_function_pool[24857]: Ortho (offset 296) */
+   /* _mesa_function_pool[24860]: Ortho (offset 296) */
    "dddddd\0"
    "glOrtho\0"
    "\0"
-   /* _mesa_function_pool[24873]: Binormal3sEXT (dynamic) */
+   /* _mesa_function_pool[24876]: Binormal3sEXT (dynamic) */
    "iii\0"
    "glBinormal3sEXT\0"
    "\0"
-   /* _mesa_function_pool[24894]: ListBase (offset 6) */
+   /* _mesa_function_pool[24897]: ListBase (offset 6) */
    "i\0"
    "glListBase\0"
    "\0"
-   /* _mesa_function_pool[24908]: Vertex3s (offset 140) */
+   /* _mesa_function_pool[24911]: Vertex3s (offset 140) */
    "iii\0"
    "glVertex3s\0"
    "\0"
-   /* _mesa_function_pool[24924]: ConvolutionParameterf (offset 350) */
+   /* _mesa_function_pool[24927]: ConvolutionParameterf (offset 350) */
    "iif\0"
    "glConvolutionParameterf\0"
    "glConvolutionParameterfEXT\0"
    "\0"
-   /* _mesa_function_pool[24980]: GetColorTableParameteriv (offset 345) */
+   /* _mesa_function_pool[24983]: GetColorTableParameteriv (offset 345) */
    "iip\0"
    "glGetColorTableParameteriv\0"
    "glGetColorTableParameterivSGI\0"
    "glGetColorTableParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[25072]: ProgramEnvParameter4dvARB (will be remapped) */
+   /* _mesa_function_pool[25075]: ProgramEnvParameter4dvARB (will be remapped) */
    "iip\0"
    "glProgramEnvParameter4dvARB\0"
    "glProgramParameter4dvNV\0"
    "\0"
-   /* _mesa_function_pool[25129]: ShadeModel (offset 177) */
+   /* _mesa_function_pool[25132]: ShadeModel (offset 177) */
    "i\0"
    "glShadeModel\0"
    "\0"
-   /* _mesa_function_pool[25145]: VertexAttribs2fvNV (will be remapped) */
+   /* _mesa_function_pool[25148]: VertexAttribs2fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs2fvNV\0"
    "\0"
-   /* _mesa_function_pool[25171]: Rectiv (offset 91) */
+   /* _mesa_function_pool[25174]: Rectiv (offset 91) */
    "pp\0"
    "glRectiv\0"
    "\0"
-   /* _mesa_function_pool[25184]: UseProgramObjectARB (will be remapped) */
+   /* _mesa_function_pool[25187]: UseProgramObjectARB (will be remapped) */
    "i\0"
    "glUseProgram\0"
    "glUseProgramObjectARB\0"
    "\0"
-   /* _mesa_function_pool[25222]: GetMapParameterfvNV (dynamic) */
+   /* _mesa_function_pool[25225]: GetMapParameterfvNV (dynamic) */
    "iip\0"
    "glGetMapParameterfvNV\0"
    "\0"
-   /* _mesa_function_pool[25249]: EndConditionalRenderNV (will be remapped) */
+   /* _mesa_function_pool[25252]: EndConditionalRenderNV (will be remapped) */
    "\0"
    "glEndConditionalRenderNV\0"
    "glEndConditionalRender\0"
    "\0"
-   /* _mesa_function_pool[25299]: PassTexCoordATI (will be remapped) */
+   /* _mesa_function_pool[25302]: PassTexCoordATI (will be remapped) */
    "iii\0"
    "glPassTexCoordATI\0"
    "\0"
-   /* _mesa_function_pool[25322]: DeleteProgram (will be remapped) */
+   /* _mesa_function_pool[25325]: DeleteProgram (will be remapped) */
    "i\0"
    "glDeleteProgram\0"
    "\0"
-   /* _mesa_function_pool[25341]: Tangent3ivEXT (dynamic) */
+   /* _mesa_function_pool[25344]: Tangent3ivEXT (dynamic) */
    "p\0"
    "glTangent3ivEXT\0"
    "\0"
-   /* _mesa_function_pool[25360]: Tangent3dEXT (dynamic) */
+   /* _mesa_function_pool[25363]: Tangent3dEXT (dynamic) */
    "ddd\0"
    "glTangent3dEXT\0"
    "\0"
-   /* _mesa_function_pool[25380]: SecondaryColor3dvEXT (will be remapped) */
+   /* _mesa_function_pool[25383]: SecondaryColor3dvEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3dv\0"
    "glSecondaryColor3dvEXT\0"
    "\0"
-   /* _mesa_function_pool[25426]: Vertex2fv (offset 129) */
+   /* _mesa_function_pool[25429]: AlphaFragmentOp2ATI (will be remapped) */
+   "iiiiiiiii\0"
+   "glAlphaFragmentOp2ATI\0"
+   "\0"
+   /* _mesa_function_pool[25462]: Vertex2fv (offset 129) */
    "p\0"
    "glVertex2fv\0"
    "\0"
-   /* _mesa_function_pool[25441]: MultiDrawArraysEXT (will be remapped) */
+   /* _mesa_function_pool[25477]: MultiDrawArraysEXT (will be remapped) */
    "ippi\0"
    "glMultiDrawArrays\0"
    "glMultiDrawArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[25486]: BindRenderbufferEXT (will be remapped) */
+   /* _mesa_function_pool[25522]: BindRenderbufferEXT (will be remapped) */
    "ii\0"
    "glBindRenderbuffer\0"
    "glBindRenderbufferEXT\0"
    "\0"
-   /* _mesa_function_pool[25531]: MultiTexCoord4dARB (offset 400) */
+   /* _mesa_function_pool[25567]: MultiTexCoord4dARB (offset 400) */
    "idddd\0"
    "glMultiTexCoord4d\0"
    "glMultiTexCoord4dARB\0"
    "\0"
-   /* _mesa_function_pool[25577]: FramebufferTextureFaceARB (will be remapped) */
+   /* _mesa_function_pool[25613]: FramebufferTextureFaceARB (will be remapped) */
    "iiiii\0"
    "glFramebufferTextureFaceARB\0"
    "\0"
-   /* _mesa_function_pool[25612]: Vertex3sv (offset 141) */
+   /* _mesa_function_pool[25648]: Vertex3sv (offset 141) */
    "p\0"
    "glVertex3sv\0"
    "\0"
-   /* _mesa_function_pool[25627]: SecondaryColor3usEXT (will be remapped) */
+   /* _mesa_function_pool[25663]: SecondaryColor3usEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3us\0"
    "glSecondaryColor3usEXT\0"
    "\0"
-   /* _mesa_function_pool[25675]: ProgramLocalParameter4fvARB (will be remapped) */
+   /* _mesa_function_pool[25711]: ProgramLocalParameter4fvARB (will be remapped) */
    "iip\0"
    "glProgramLocalParameter4fvARB\0"
    "\0"
-   /* _mesa_function_pool[25710]: DeleteProgramsNV (will be remapped) */
+   /* _mesa_function_pool[25746]: DeleteProgramsNV (will be remapped) */
    "ip\0"
    "glDeleteProgramsARB\0"
    "glDeleteProgramsNV\0"
    "\0"
-   /* _mesa_function_pool[25753]: EvalMesh1 (offset 236) */
+   /* _mesa_function_pool[25789]: EvalMesh1 (offset 236) */
    "iii\0"
    "glEvalMesh1\0"
    "\0"
-   /* _mesa_function_pool[25770]: PauseTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[25806]: PauseTransformFeedback (will be remapped) */
    "\0"
    "glPauseTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[25797]: MultiTexCoord1sARB (offset 382) */
+   /* _mesa_function_pool[25833]: MultiTexCoord1sARB (offset 382) */
    "ii\0"
    "glMultiTexCoord1s\0"
    "glMultiTexCoord1sARB\0"
    "\0"
-   /* _mesa_function_pool[25840]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[25876]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
    "iffffff\0"
    "glReplacementCodeuiColor3fVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[25887]: GetVertexAttribPointervNV (will be remapped) */
+   /* _mesa_function_pool[25923]: GetVertexAttribPointervNV (will be remapped) */
    "iip\0"
    "glGetVertexAttribPointerv\0"
    "glGetVertexAttribPointervARB\0"
    "glGetVertexAttribPointervNV\0"
    "\0"
-   /* _mesa_function_pool[25975]: VertexAttribs1fvNV (will be remapped) */
+   /* _mesa_function_pool[26011]: VertexAttribs1fvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs1fvNV\0"
    "\0"
-   /* _mesa_function_pool[26001]: MultiTexCoord1dvARB (offset 377) */
+   /* _mesa_function_pool[26037]: MultiTexCoord1dvARB (offset 377) */
    "ip\0"
    "glMultiTexCoord1dv\0"
    "glMultiTexCoord1dvARB\0"
    "\0"
-   /* _mesa_function_pool[26046]: Uniform2iARB (will be remapped) */
+   /* _mesa_function_pool[26082]: Uniform2iARB (will be remapped) */
    "iii\0"
    "glUniform2i\0"
    "glUniform2iARB\0"
    "\0"
-   /* _mesa_function_pool[26078]: Vertex2iv (offset 131) */
+   /* _mesa_function_pool[26114]: Vertex2iv (offset 131) */
    "p\0"
    "glVertex2iv\0"
    "\0"
-   /* _mesa_function_pool[26093]: GetProgramStringNV (will be remapped) */
+   /* _mesa_function_pool[26129]: GetProgramStringNV (will be remapped) */
    "iip\0"
    "glGetProgramStringNV\0"
    "\0"
-   /* _mesa_function_pool[26119]: ColorPointerEXT (will be remapped) */
+   /* _mesa_function_pool[26155]: ColorPointerEXT (will be remapped) */
    "iiiip\0"
    "glColorPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[26144]: LineWidth (offset 168) */
+   /* _mesa_function_pool[26180]: LineWidth (offset 168) */
    "f\0"
    "glLineWidth\0"
    "\0"
-   /* _mesa_function_pool[26159]: MapBufferARB (will be remapped) */
+   /* _mesa_function_pool[26195]: MapBufferARB (will be remapped) */
    "ii\0"
    "glMapBuffer\0"
    "glMapBufferARB\0"
    "\0"
-   /* _mesa_function_pool[26190]: MultiDrawElementsBaseVertex (will be remapped) */
+   /* _mesa_function_pool[26226]: MultiDrawElementsBaseVertex (will be remapped) */
    "ipipip\0"
    "glMultiDrawElementsBaseVertex\0"
    "\0"
-   /* _mesa_function_pool[26228]: TexParameterIuivEXT (will be remapped) */
+   /* _mesa_function_pool[26264]: TexParameterIuivEXT (will be remapped) */
    "iip\0"
    "glTexParameterIuivEXT\0"
    "glTexParameterIuiv\0"
    "\0"
-   /* _mesa_function_pool[26274]: Binormal3svEXT (dynamic) */
+   /* _mesa_function_pool[26310]: Binormal3svEXT (dynamic) */
    "p\0"
    "glBinormal3svEXT\0"
    "\0"
-   /* _mesa_function_pool[26294]: ApplyTextureEXT (dynamic) */
+   /* _mesa_function_pool[26330]: ApplyTextureEXT (dynamic) */
    "i\0"
    "glApplyTextureEXT\0"
    "\0"
-   /* _mesa_function_pool[26315]: GetBufferParameteri64v (will be remapped) */
+   /* _mesa_function_pool[26351]: GetBufferParameteri64v (will be remapped) */
    "iip\0"
    "glGetBufferParameteri64v\0"
    "\0"
-   /* _mesa_function_pool[26345]: TexGendv (offset 189) */
+   /* _mesa_function_pool[26381]: TexGendv (offset 189) */
    "iip\0"
    "glTexGendv\0"
    "\0"
-   /* _mesa_function_pool[26361]: VertexAttribI3iEXT (will be remapped) */
+   /* _mesa_function_pool[26397]: VertexAttribI3iEXT (will be remapped) */
    "iiii\0"
    "glVertexAttribI3iEXT\0"
    "glVertexAttribI3i\0"
    "\0"
-   /* _mesa_function_pool[26406]: EnableIndexedEXT (will be remapped) */
+   /* _mesa_function_pool[26442]: EnableIndexedEXT (will be remapped) */
    "ii\0"
    "glEnableIndexedEXT\0"
    "glEnablei\0"
    "\0"
-   /* _mesa_function_pool[26439]: TextureMaterialEXT (dynamic) */
+   /* _mesa_function_pool[26475]: TextureMaterialEXT (dynamic) */
    "ii\0"
    "glTextureMaterialEXT\0"
    "\0"
-   /* _mesa_function_pool[26464]: TextureLightEXT (dynamic) */
+   /* _mesa_function_pool[26500]: TextureLightEXT (dynamic) */
    "i\0"
    "glTextureLightEXT\0"
    "\0"
-   /* _mesa_function_pool[26485]: ResetMinmax (offset 370) */
+   /* _mesa_function_pool[26521]: ResetMinmax (offset 370) */
    "i\0"
    "glResetMinmax\0"
    "glResetMinmaxEXT\0"
    "\0"
-   /* _mesa_function_pool[26519]: SpriteParameterfSGIX (dynamic) */
+   /* _mesa_function_pool[26555]: SpriteParameterfSGIX (dynamic) */
    "if\0"
    "glSpriteParameterfSGIX\0"
    "\0"
-   /* _mesa_function_pool[26546]: EnableClientState (offset 313) */
+   /* _mesa_function_pool[26582]: EnableClientState (offset 313) */
    "i\0"
    "glEnableClientState\0"
    "\0"
-   /* _mesa_function_pool[26569]: VertexAttrib4sNV (will be remapped) */
+   /* _mesa_function_pool[26605]: VertexAttrib4sNV (will be remapped) */
    "iiiii\0"
    "glVertexAttrib4sNV\0"
    "\0"
-   /* _mesa_function_pool[26595]: GetConvolutionParameterfv (offset 357) */
+   /* _mesa_function_pool[26631]: GetConvolutionParameterfv (offset 357) */
    "iip\0"
    "glGetConvolutionParameterfv\0"
    "glGetConvolutionParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[26659]: VertexAttribs4dvNV (will be remapped) */
+   /* _mesa_function_pool[26695]: VertexAttribs4dvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4dvNV\0"
    "\0"
-   /* _mesa_function_pool[26685]: VertexAttrib4dARB (will be remapped) */
+   /* _mesa_function_pool[26721]: MultiModeDrawArraysIBM (will be remapped) */
+   "pppii\0"
+   "glMultiModeDrawArraysIBM\0"
+   "\0"
+   /* _mesa_function_pool[26753]: VertexAttrib4dARB (will be remapped) */
    "idddd\0"
    "glVertexAttrib4d\0"
    "glVertexAttrib4dARB\0"
    "\0"
-   /* _mesa_function_pool[26729]: GetTexBumpParameterfvATI (will be remapped) */
+   /* _mesa_function_pool[26797]: GetTexBumpParameterfvATI (will be remapped) */
    "ip\0"
    "glGetTexBumpParameterfvATI\0"
    "\0"
-   /* _mesa_function_pool[26760]: ProgramNamedParameter4dNV (will be remapped) */
+   /* _mesa_function_pool[26828]: ProgramNamedParameter4dNV (will be remapped) */
    "iipdddd\0"
    "glProgramNamedParameter4dNV\0"
    "\0"
-   /* _mesa_function_pool[26797]: GetMaterialfv (offset 269) */
+   /* _mesa_function_pool[26865]: GetMaterialfv (offset 269) */
    "iip\0"
    "glGetMaterialfv\0"
    "\0"
-   /* _mesa_function_pool[26818]: VertexWeightfEXT (dynamic) */
+   /* _mesa_function_pool[26886]: VertexWeightfEXT (dynamic) */
    "f\0"
    "glVertexWeightfEXT\0"
    "\0"
-   /* _mesa_function_pool[26840]: Binormal3fEXT (dynamic) */
+   /* _mesa_function_pool[26908]: SetFragmentShaderConstantATI (will be remapped) */
+   "ip\0"
+   "glSetFragmentShaderConstantATI\0"
+   "\0"
+   /* _mesa_function_pool[26943]: Binormal3fEXT (dynamic) */
    "fff\0"
    "glBinormal3fEXT\0"
    "\0"
-   /* _mesa_function_pool[26861]: CallList (offset 2) */
+   /* _mesa_function_pool[26964]: CallList (offset 2) */
    "i\0"
    "glCallList\0"
    "\0"
-   /* _mesa_function_pool[26875]: Materialfv (offset 170) */
+   /* _mesa_function_pool[26978]: Materialfv (offset 170) */
    "iip\0"
    "glMaterialfv\0"
    "\0"
-   /* _mesa_function_pool[26893]: TexCoord3fv (offset 113) */
+   /* _mesa_function_pool[26996]: TexCoord3fv (offset 113) */
    "p\0"
    "glTexCoord3fv\0"
    "\0"
-   /* _mesa_function_pool[26910]: FogCoordfvEXT (will be remapped) */
+   /* _mesa_function_pool[27013]: FogCoordfvEXT (will be remapped) */
    "p\0"
    "glFogCoordfv\0"
    "glFogCoordfvEXT\0"
    "\0"
-   /* _mesa_function_pool[26942]: MultiTexCoord1ivARB (offset 381) */
+   /* _mesa_function_pool[27045]: MultiTexCoord1ivARB (offset 381) */
    "ip\0"
    "glMultiTexCoord1iv\0"
    "glMultiTexCoord1ivARB\0"
    "\0"
-   /* _mesa_function_pool[26987]: SecondaryColor3ubEXT (will be remapped) */
+   /* _mesa_function_pool[27090]: SecondaryColor3ubEXT (will be remapped) */
    "iii\0"
    "glSecondaryColor3ub\0"
    "glSecondaryColor3ubEXT\0"
    "\0"
-   /* _mesa_function_pool[27035]: MultiTexCoord2ivARB (offset 389) */
+   /* _mesa_function_pool[27138]: MultiTexCoord2ivARB (offset 389) */
    "ip\0"
    "glMultiTexCoord2iv\0"
    "glMultiTexCoord2ivARB\0"
    "\0"
-   /* _mesa_function_pool[27080]: FogFuncSGIS (dynamic) */
+   /* _mesa_function_pool[27183]: FogFuncSGIS (dynamic) */
    "ip\0"
    "glFogFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[27098]: CopyTexSubImage2D (offset 326) */
+   /* _mesa_function_pool[27201]: CopyTexSubImage2D (offset 326) */
    "iiiiiiii\0"
    "glCopyTexSubImage2D\0"
    "glCopyTexSubImage2DEXT\0"
    "\0"
-   /* _mesa_function_pool[27151]: GetObjectParameterivARB (will be remapped) */
+   /* _mesa_function_pool[27254]: GetObjectParameterivARB (will be remapped) */
    "iip\0"
    "glGetObjectParameterivARB\0"
    "\0"
-   /* _mesa_function_pool[27182]: Color3iv (offset 16) */
+   /* _mesa_function_pool[27285]: Color3iv (offset 16) */
    "p\0"
    "glColor3iv\0"
    "\0"
-   /* _mesa_function_pool[27196]: TexCoord4fVertex4fSUN (dynamic) */
+   /* _mesa_function_pool[27299]: TexCoord4fVertex4fSUN (dynamic) */
    "ffffffff\0"
    "glTexCoord4fVertex4fSUN\0"
    "\0"
-   /* _mesa_function_pool[27230]: DrawElements (offset 311) */
+   /* _mesa_function_pool[27333]: DrawElements (offset 311) */
    "iiip\0"
    "glDrawElements\0"
    "\0"
-   /* _mesa_function_pool[27251]: BindVertexArrayAPPLE (will be remapped) */
+   /* _mesa_function_pool[27354]: BindVertexArrayAPPLE (will be remapped) */
    "i\0"
    "glBindVertexArrayAPPLE\0"
    "\0"
-   /* _mesa_function_pool[27277]: GetProgramLocalParameterdvARB (will be remapped) */
+   /* _mesa_function_pool[27380]: GetProgramLocalParameterdvARB (will be remapped) */
    "iip\0"
    "glGetProgramLocalParameterdvARB\0"
    "\0"
-   /* _mesa_function_pool[27314]: GetHistogramParameteriv (offset 363) */
+   /* _mesa_function_pool[27417]: GetHistogramParameteriv (offset 363) */
    "iip\0"
    "glGetHistogramParameteriv\0"
    "glGetHistogramParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[27374]: MultiTexCoord1iARB (offset 380) */
+   /* _mesa_function_pool[27477]: MultiTexCoord1iARB (offset 380) */
    "ii\0"
    "glMultiTexCoord1i\0"
    "glMultiTexCoord1iARB\0"
    "\0"
-   /* _mesa_function_pool[27417]: GetConvolutionFilter (offset 356) */
+   /* _mesa_function_pool[27520]: GetConvolutionFilter (offset 356) */
    "iiip\0"
    "glGetConvolutionFilter\0"
    "glGetConvolutionFilterEXT\0"
    "\0"
-   /* _mesa_function_pool[27472]: GetProgramivARB (will be remapped) */
+   /* _mesa_function_pool[27575]: GetProgramivARB (will be remapped) */
    "iip\0"
    "glGetProgramivARB\0"
    "\0"
-   /* _mesa_function_pool[27495]: BlendFuncSeparateEXT (will be remapped) */
+   /* _mesa_function_pool[27598]: BlendFuncSeparateEXT (will be remapped) */
    "iiii\0"
    "glBlendFuncSeparate\0"
    "glBlendFuncSeparateEXT\0"
    "glBlendFuncSeparateINGR\0"
    "\0"
-   /* _mesa_function_pool[27568]: MapBufferRange (will be remapped) */
+   /* _mesa_function_pool[27671]: MapBufferRange (will be remapped) */
    "iiii\0"
    "glMapBufferRange\0"
    "\0"
-   /* _mesa_function_pool[27591]: ProgramParameters4dvNV (will be remapped) */
+   /* _mesa_function_pool[27694]: ProgramParameters4dvNV (will be remapped) */
    "iiip\0"
    "glProgramParameters4dvNV\0"
    "\0"
-   /* _mesa_function_pool[27622]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[27725]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glTexCoord2fColor3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[27659]: EvalPoint2 (offset 239) */
+   /* _mesa_function_pool[27762]: EvalPoint2 (offset 239) */
    "ii\0"
    "glEvalPoint2\0"
    "\0"
-   /* _mesa_function_pool[27676]: Uniform1uivEXT (will be remapped) */
+   /* _mesa_function_pool[27779]: Uniform1uivEXT (will be remapped) */
    "iip\0"
    "glUniform1uivEXT\0"
    "glUniform1uiv\0"
    "\0"
-   /* _mesa_function_pool[27712]: EvalPoint1 (offset 237) */
+   /* _mesa_function_pool[27815]: EvalPoint1 (offset 237) */
    "i\0"
    "glEvalPoint1\0"
    "\0"
-   /* _mesa_function_pool[27728]: Binormal3dvEXT (dynamic) */
+   /* _mesa_function_pool[27831]: Binormal3dvEXT (dynamic) */
    "p\0"
    "glBinormal3dvEXT\0"
    "\0"
-   /* _mesa_function_pool[27748]: PopMatrix (offset 297) */
+   /* _mesa_function_pool[27851]: PopMatrix (offset 297) */
    "\0"
    "glPopMatrix\0"
    "\0"
-   /* _mesa_function_pool[27762]: FinishFenceNV (will be remapped) */
+   /* _mesa_function_pool[27865]: GetVertexAttribIuivEXT (will be remapped) */
+   "iip\0"
+   "glGetVertexAttribIuivEXT\0"
+   "glGetVertexAttribIuiv\0"
+   "\0"
+   /* _mesa_function_pool[27917]: FinishFenceNV (will be remapped) */
    "i\0"
    "glFinishFenceNV\0"
    "\0"
-   /* _mesa_function_pool[27781]: GetFogFuncSGIS (dynamic) */
+   /* _mesa_function_pool[27936]: GetFogFuncSGIS (dynamic) */
    "p\0"
    "glGetFogFuncSGIS\0"
    "\0"
-   /* _mesa_function_pool[27801]: GetUniformLocationARB (will be remapped) */
+   /* _mesa_function_pool[27956]: GetUniformLocationARB (will be remapped) */
    "ip\0"
    "glGetUniformLocation\0"
    "glGetUniformLocationARB\0"
    "\0"
-   /* _mesa_function_pool[27850]: SecondaryColor3fEXT (will be remapped) */
+   /* _mesa_function_pool[28005]: SecondaryColor3fEXT (will be remapped) */
    "fff\0"
    "glSecondaryColor3f\0"
    "glSecondaryColor3fEXT\0"
    "\0"
-   /* _mesa_function_pool[27896]: GetTexGeniv (offset 280) */
+   /* _mesa_function_pool[28051]: GetTexGeniv (offset 280) */
    "iip\0"
    "glGetTexGeniv\0"
    "\0"
-   /* _mesa_function_pool[27915]: CombinerInputNV (will be remapped) */
+   /* _mesa_function_pool[28070]: CombinerInputNV (will be remapped) */
    "iiiiii\0"
    "glCombinerInputNV\0"
    "\0"
-   /* _mesa_function_pool[27941]: VertexAttrib3sARB (will be remapped) */
+   /* _mesa_function_pool[28096]: VertexAttrib3sARB (will be remapped) */
    "iiii\0"
    "glVertexAttrib3s\0"
    "glVertexAttrib3sARB\0"
    "\0"
-   /* _mesa_function_pool[27984]: IsTransformFeedback (will be remapped) */
+   /* _mesa_function_pool[28139]: IsTransformFeedback (will be remapped) */
    "i\0"
    "glIsTransformFeedback\0"
    "\0"
-   /* _mesa_function_pool[28009]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
+   /* _mesa_function_pool[28164]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
    "ppp\0"
    "glReplacementCodeuiNormal3fVertex3fvSUN\0"
    "\0"
-   /* _mesa_function_pool[28054]: Map2d (offset 222) */
+   /* _mesa_function_pool[28209]: Map2d (offset 222) */
    "iddiiddiip\0"
    "glMap2d\0"
    "\0"
-   /* _mesa_function_pool[28074]: Map2f (offset 223) */
+   /* _mesa_function_pool[28229]: Map2f (offset 223) */
    "iffiiffiip\0"
    "glMap2f\0"
    "\0"
-   /* _mesa_function_pool[28094]: ProgramStringARB (will be remapped) */
+   /* _mesa_function_pool[28249]: ProgramStringARB (will be remapped) */
    "iiip\0"
    "glProgramStringARB\0"
    "\0"
-   /* _mesa_function_pool[28119]: Vertex4s (offset 148) */
+   /* _mesa_function_pool[28274]: Vertex4s (offset 148) */
    "iiii\0"
    "glVertex4s\0"
    "\0"
-   /* _mesa_function_pool[28136]: TexCoord4fVertex4fvSUN (dynamic) */
+   /* _mesa_function_pool[28291]: TexCoord4fVertex4fvSUN (dynamic) */
    "pp\0"
    "glTexCoord4fVertex4fvSUN\0"
    "\0"
-   /* _mesa_function_pool[28165]: FragmentLightModelivSGIX (dynamic) */
+   /* _mesa_function_pool[28320]: FragmentLightModelivSGIX (dynamic) */
    "ip\0"
    "glFragmentLightModelivSGIX\0"
    "\0"
-   /* _mesa_function_pool[28196]: VertexAttrib1fNV (will be remapped) */
+   /* _mesa_function_pool[28351]: VertexAttrib1fNV (will be remapped) */
    "if\0"
    "glVertexAttrib1fNV\0"
    "\0"
-   /* _mesa_function_pool[28219]: Vertex4f (offset 144) */
+   /* _mesa_function_pool[28374]: Vertex4f (offset 144) */
    "ffff\0"
    "glVertex4f\0"
    "\0"
-   /* _mesa_function_pool[28236]: EvalCoord1d (offset 228) */
+   /* _mesa_function_pool[28391]: EvalCoord1d (offset 228) */
    "d\0"
    "glEvalCoord1d\0"
    "\0"
-   /* _mesa_function_pool[28253]: Vertex4d (offset 142) */
+   /* _mesa_function_pool[28408]: Vertex4d (offset 142) */
    "dddd\0"
    "glVertex4d\0"
    "\0"
-   /* _mesa_function_pool[28270]: RasterPos4dv (offset 79) */
+   /* _mesa_function_pool[28425]: RasterPos4dv (offset 79) */
    "p\0"
    "glRasterPos4dv\0"
    "\0"
-   /* _mesa_function_pool[28288]: UseShaderProgramEXT (will be remapped) */
+   /* _mesa_function_pool[28443]: UseShaderProgramEXT (will be remapped) */
    "ii\0"
    "glUseShaderProgramEXT\0"
    "\0"
-   /* _mesa_function_pool[28314]: FragmentLightfSGIX (dynamic) */
+   /* _mesa_function_pool[28469]: FragmentLightfSGIX (dynamic) */
    "iif\0"
    "glFragmentLightfSGIX\0"
    "\0"
-   /* _mesa_function_pool[28340]: GetCompressedTexImageARB (will be remapped) */
+   /* _mesa_function_pool[28495]: GetCompressedTexImageARB (will be remapped) */
    "iip\0"
    "glGetCompressedTexImage\0"
    "glGetCompressedTexImageARB\0"
    "\0"
-   /* _mesa_function_pool[28396]: GetTexGenfv (offset 279) */
+   /* _mesa_function_pool[28551]: GetTexGenfv (offset 279) */
    "iip\0"
    "glGetTexGenfv\0"
    "\0"
-   /* _mesa_function_pool[28415]: Vertex4i (offset 146) */
+   /* _mesa_function_pool[28570]: Vertex4i (offset 146) */
    "iiii\0"
    "glVertex4i\0"
    "\0"
-   /* _mesa_function_pool[28432]: VertexWeightPointerEXT (dynamic) */
+   /* _mesa_function_pool[28587]: VertexWeightPointerEXT (dynamic) */
    "iiip\0"
    "glVertexWeightPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[28463]: GetHistogram (offset 361) */
+   /* _mesa_function_pool[28618]: GetHistogram (offset 361) */
    "iiiip\0"
    "glGetHistogram\0"
    "glGetHistogramEXT\0"
    "\0"
-   /* _mesa_function_pool[28503]: ActiveStencilFaceEXT (will be remapped) */
+   /* _mesa_function_pool[28658]: ActiveStencilFaceEXT (will be remapped) */
    "i\0"
    "glActiveStencilFaceEXT\0"
    "\0"
-   /* _mesa_function_pool[28529]: StencilFuncSeparateATI (will be remapped) */
+   /* _mesa_function_pool[28684]: StencilFuncSeparateATI (will be remapped) */
    "iiii\0"
    "glStencilFuncSeparateATI\0"
    "\0"
-   /* _mesa_function_pool[28560]: Materialf (offset 169) */
+   /* _mesa_function_pool[28715]: Materialf (offset 169) */
    "iif\0"
    "glMaterialf\0"
    "\0"
-   /* _mesa_function_pool[28577]: GetShaderSourceARB (will be remapped) */
+   /* _mesa_function_pool[28732]: GetShaderSourceARB (will be remapped) */
    "iipp\0"
    "glGetShaderSource\0"
    "glGetShaderSourceARB\0"
    "\0"
-   /* _mesa_function_pool[28622]: IglooInterfaceSGIX (dynamic) */
+   /* _mesa_function_pool[28777]: IglooInterfaceSGIX (dynamic) */
    "ip\0"
    "glIglooInterfaceSGIX\0"
    "\0"
-   /* _mesa_function_pool[28647]: Materiali (offset 171) */
+   /* _mesa_function_pool[28802]: Materiali (offset 171) */
    "iii\0"
    "glMateriali\0"
    "\0"
-   /* _mesa_function_pool[28664]: VertexAttrib4dNV (will be remapped) */
+   /* _mesa_function_pool[28819]: VertexAttrib4dNV (will be remapped) */
    "idddd\0"
    "glVertexAttrib4dNV\0"
    "\0"
-   /* _mesa_function_pool[28690]: MultiModeDrawElementsIBM (will be remapped) */
+   /* _mesa_function_pool[28845]: MultiModeDrawElementsIBM (will be remapped) */
    "ppipii\0"
    "glMultiModeDrawElementsIBM\0"
    "\0"
-   /* _mesa_function_pool[28725]: Indexsv (offset 51) */
+   /* _mesa_function_pool[28880]: Indexsv (offset 51) */
    "p\0"
    "glIndexsv\0"
    "\0"
-   /* _mesa_function_pool[28738]: MultiTexCoord4svARB (offset 407) */
+   /* _mesa_function_pool[28893]: MultiTexCoord4svARB (offset 407) */
    "ip\0"
    "glMultiTexCoord4sv\0"
    "glMultiTexCoord4svARB\0"
    "\0"
-   /* _mesa_function_pool[28783]: LightModelfv (offset 164) */
+   /* _mesa_function_pool[28938]: LightModelfv (offset 164) */
    "ip\0"
    "glLightModelfv\0"
    "\0"
-   /* _mesa_function_pool[28802]: TexCoord2dv (offset 103) */
+   /* _mesa_function_pool[28957]: TexCoord2dv (offset 103) */
    "p\0"
    "glTexCoord2dv\0"
    "\0"
-   /* _mesa_function_pool[28819]: GenQueriesARB (will be remapped) */
+   /* _mesa_function_pool[28974]: GenQueriesARB (will be remapped) */
    "ip\0"
    "glGenQueries\0"
    "glGenQueriesARB\0"
    "\0"
-   /* _mesa_function_pool[28852]: EvalCoord1dv (offset 229) */
+   /* _mesa_function_pool[29007]: EvalCoord1dv (offset 229) */
    "p\0"
    "glEvalCoord1dv\0"
    "\0"
-   /* _mesa_function_pool[28870]: ReplacementCodeuiVertex3fSUN (dynamic) */
+   /* _mesa_function_pool[29025]: ReplacementCodeuiVertex3fSUN (dynamic) */
    "ifff\0"
    "glReplacementCodeuiVertex3fSUN\0"
    "\0"
-   /* _mesa_function_pool[28907]: Translated (offset 303) */
+   /* _mesa_function_pool[29062]: Translated (offset 303) */
    "ddd\0"
    "glTranslated\0"
    "\0"
-   /* _mesa_function_pool[28925]: Translatef (offset 304) */
+   /* _mesa_function_pool[29080]: Translatef (offset 304) */
    "fff\0"
    "glTranslatef\0"
    "\0"
-   /* _mesa_function_pool[28943]: Uniform3uiEXT (will be remapped) */
+   /* _mesa_function_pool[29098]: Uniform3uiEXT (will be remapped) */
    "iiii\0"
    "glUniform3uiEXT\0"
    "glUniform3ui\0"
    "\0"
-   /* _mesa_function_pool[28978]: StencilMask (offset 209) */
+   /* _mesa_function_pool[29133]: StencilMask (offset 209) */
    "i\0"
    "glStencilMask\0"
    "\0"
-   /* _mesa_function_pool[28995]: Tangent3iEXT (dynamic) */
+   /* _mesa_function_pool[29150]: Tangent3iEXT (dynamic) */
    "iii\0"
    "glTangent3iEXT\0"
    "\0"
-   /* _mesa_function_pool[29015]: GetLightiv (offset 265) */
+   /* _mesa_function_pool[29170]: GetLightiv (offset 265) */
    "iip\0"
    "glGetLightiv\0"
    "\0"
-   /* _mesa_function_pool[29033]: DrawMeshArraysSUN (dynamic) */
+   /* _mesa_function_pool[29188]: DrawMeshArraysSUN (dynamic) */
    "iiii\0"
    "glDrawMeshArraysSUN\0"
    "\0"
-   /* _mesa_function_pool[29059]: IsList (offset 287) */
+   /* _mesa_function_pool[29214]: IsList (offset 287) */
    "i\0"
    "glIsList\0"
    "\0"
-   /* _mesa_function_pool[29071]: IsSync (will be remapped) */
+   /* _mesa_function_pool[29226]: IsSync (will be remapped) */
    "i\0"
    "glIsSync\0"
    "\0"
-   /* _mesa_function_pool[29083]: RenderMode (offset 196) */
+   /* _mesa_function_pool[29238]: RenderMode (offset 196) */
    "i\0"
    "glRenderMode\0"
    "\0"
-   /* _mesa_function_pool[29099]: GetMapControlPointsNV (dynamic) */
+   /* _mesa_function_pool[29254]: GetMapControlPointsNV (dynamic) */
    "iiiiiip\0"
    "glGetMapControlPointsNV\0"
    "\0"
-   /* _mesa_function_pool[29132]: DrawBuffersARB (will be remapped) */
+   /* _mesa_function_pool[29287]: DrawBuffersARB (will be remapped) */
    "ip\0"
    "glDrawBuffers\0"
    "glDrawBuffersARB\0"
    "glDrawBuffersATI\0"
    "\0"
-   /* _mesa_function_pool[29184]: ClearBufferiv (will be remapped) */
+   /* _mesa_function_pool[29339]: ClearBufferiv (will be remapped) */
    "iip\0"
    "glClearBufferiv\0"
    "\0"
-   /* _mesa_function_pool[29205]: ProgramLocalParameter4fARB (will be remapped) */
+   /* _mesa_function_pool[29360]: ProgramLocalParameter4fARB (will be remapped) */
    "iiffff\0"
    "glProgramLocalParameter4fARB\0"
    "\0"
-   /* _mesa_function_pool[29242]: SpriteParameterivSGIX (dynamic) */
+   /* _mesa_function_pool[29397]: SpriteParameterivSGIX (dynamic) */
    "ip\0"
    "glSpriteParameterivSGIX\0"
    "\0"
-   /* _mesa_function_pool[29270]: ProvokingVertexEXT (will be remapped) */
+   /* _mesa_function_pool[29425]: ProvokingVertexEXT (will be remapped) */
    "i\0"
    "glProvokingVertexEXT\0"
    "glProvokingVertex\0"
    "\0"
-   /* _mesa_function_pool[29312]: MultiTexCoord1fARB (offset 378) */
+   /* _mesa_function_pool[29467]: MultiTexCoord1fARB (offset 378) */
    "if\0"
    "glMultiTexCoord1f\0"
    "glMultiTexCoord1fARB\0"
    "\0"
-   /* _mesa_function_pool[29355]: LoadName (offset 198) */
+   /* _mesa_function_pool[29510]: LoadName (offset 198) */
    "i\0"
    "glLoadName\0"
    "\0"
-   /* _mesa_function_pool[29369]: VertexAttribs4ubvNV (will be remapped) */
+   /* _mesa_function_pool[29524]: VertexAttribs4ubvNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4ubvNV\0"
    "\0"
-   /* _mesa_function_pool[29396]: WeightsvARB (dynamic) */
+   /* _mesa_function_pool[29551]: WeightsvARB (dynamic) */
    "ip\0"
    "glWeightsvARB\0"
    "\0"
-   /* _mesa_function_pool[29414]: Uniform1fvARB (will be remapped) */
+   /* _mesa_function_pool[29569]: Uniform1fvARB (will be remapped) */
    "iip\0"
    "glUniform1fv\0"
    "glUniform1fvARB\0"
    "\0"
-   /* _mesa_function_pool[29448]: CopyTexSubImage1D (offset 325) */
+   /* _mesa_function_pool[29603]: CopyTexSubImage1D (offset 325) */
    "iiiiii\0"
    "glCopyTexSubImage1D\0"
    "glCopyTexSubImage1DEXT\0"
    "\0"
-   /* _mesa_function_pool[29499]: CullFace (offset 152) */
+   /* _mesa_function_pool[29654]: CullFace (offset 152) */
    "i\0"
    "glCullFace\0"
    "\0"
-   /* _mesa_function_pool[29513]: BindTexture (offset 307) */
+   /* _mesa_function_pool[29668]: BindTexture (offset 307) */
    "ii\0"
    "glBindTexture\0"
    "glBindTextureEXT\0"
    "\0"
-   /* _mesa_function_pool[29548]: BeginFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[29703]: BeginFragmentShaderATI (will be remapped) */
    "\0"
    "glBeginFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[29575]: MultiTexCoord4fARB (offset 402) */
+   /* _mesa_function_pool[29730]: MultiTexCoord4fARB (offset 402) */
    "iffff\0"
    "glMultiTexCoord4f\0"
    "glMultiTexCoord4fARB\0"
    "\0"
-   /* _mesa_function_pool[29621]: VertexAttribs3svNV (will be remapped) */
+   /* _mesa_function_pool[29776]: VertexAttribs3svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs3svNV\0"
    "\0"
-   /* _mesa_function_pool[29647]: StencilFunc (offset 243) */
+   /* _mesa_function_pool[29802]: StencilFunc (offset 243) */
    "iii\0"
    "glStencilFunc\0"
    "\0"
-   /* _mesa_function_pool[29666]: CopyPixels (offset 255) */
+   /* _mesa_function_pool[29821]: CopyPixels (offset 255) */
    "iiiii\0"
    "glCopyPixels\0"
    "\0"
-   /* _mesa_function_pool[29686]: Rectsv (offset 93) */
+   /* _mesa_function_pool[29841]: Rectsv (offset 93) */
    "pp\0"
    "glRectsv\0"
    "\0"
-   /* _mesa_function_pool[29699]: ReplacementCodeuivSUN (dynamic) */
+   /* _mesa_function_pool[29854]: ReplacementCodeuivSUN (dynamic) */
    "p\0"
    "glReplacementCodeuivSUN\0"
    "\0"
-   /* _mesa_function_pool[29726]: EnableVertexAttribArrayARB (will be remapped) */
+   /* _mesa_function_pool[29881]: EnableVertexAttribArrayARB (will be remapped) */
    "i\0"
    "glEnableVertexAttribArray\0"
    "glEnableVertexAttribArrayARB\0"
    "\0"
-   /* _mesa_function_pool[29784]: NormalPointervINTEL (dynamic) */
+   /* _mesa_function_pool[29939]: NormalPointervINTEL (dynamic) */
    "ip\0"
    "glNormalPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[29810]: CopyConvolutionFilter2D (offset 355) */
+   /* _mesa_function_pool[29965]: CopyConvolutionFilter2D (offset 355) */
    "iiiiii\0"
    "glCopyConvolutionFilter2D\0"
    "glCopyConvolutionFilter2DEXT\0"
    "\0"
-   /* _mesa_function_pool[29873]: WindowPos3ivMESA (will be remapped) */
+   /* _mesa_function_pool[30028]: WindowPos3ivMESA (will be remapped) */
    "p\0"
    "glWindowPos3iv\0"
    "glWindowPos3ivARB\0"
    "glWindowPos3ivMESA\0"
    "\0"
-   /* _mesa_function_pool[29928]: CopyBufferSubData (will be remapped) */
+   /* _mesa_function_pool[30083]: CopyBufferSubData (will be remapped) */
    "iiiii\0"
    "glCopyBufferSubData\0"
    "\0"
-   /* _mesa_function_pool[29955]: NormalPointer (offset 318) */
+   /* _mesa_function_pool[30110]: NormalPointer (offset 318) */
    "iip\0"
    "glNormalPointer\0"
    "\0"
-   /* _mesa_function_pool[29976]: TexParameterfv (offset 179) */
+   /* _mesa_function_pool[30131]: TexParameterfv (offset 179) */
    "iip\0"
    "glTexParameterfv\0"
    "\0"
-   /* _mesa_function_pool[29998]: IsBufferARB (will be remapped) */
+   /* _mesa_function_pool[30153]: IsBufferARB (will be remapped) */
    "i\0"
    "glIsBuffer\0"
    "glIsBufferARB\0"
    "\0"
-   /* _mesa_function_pool[30026]: WindowPos4iMESA (will be remapped) */
+   /* _mesa_function_pool[30181]: WindowPos4iMESA (will be remapped) */
    "iiii\0"
    "glWindowPos4iMESA\0"
    "\0"
-   /* _mesa_function_pool[30050]: VertexAttrib4uivARB (will be remapped) */
+   /* _mesa_function_pool[30205]: VertexAttrib4uivARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4uiv\0"
    "glVertexAttrib4uivARB\0"
    "\0"
-   /* _mesa_function_pool[30095]: Tangent3bvEXT (dynamic) */
+   /* _mesa_function_pool[30250]: Tangent3bvEXT (dynamic) */
    "p\0"
    "glTangent3bvEXT\0"
    "\0"
-   /* _mesa_function_pool[30114]: VertexAttribI3uivEXT (will be remapped) */
+   /* _mesa_function_pool[30269]: VertexAttribI3uivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI3uivEXT\0"
    "glVertexAttribI3uiv\0"
    "\0"
-   /* _mesa_function_pool[30161]: UniformMatrix3x4fv (will be remapped) */
+   /* _mesa_function_pool[30316]: UniformMatrix3x4fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix3x4fv\0"
    "\0"
-   /* _mesa_function_pool[30188]: ClipPlane (offset 150) */
+   /* _mesa_function_pool[30343]: ClipPlane (offset 150) */
    "ip\0"
    "glClipPlane\0"
    "\0"
-   /* _mesa_function_pool[30204]: Recti (offset 90) */
+   /* _mesa_function_pool[30359]: Recti (offset 90) */
    "iiii\0"
    "glRecti\0"
    "\0"
-   /* _mesa_function_pool[30218]: VertexAttribI3ivEXT (will be remapped) */
+   /* _mesa_function_pool[30373]: VertexAttribI3ivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI3ivEXT\0"
    "glVertexAttribI3iv\0"
    "\0"
-   /* _mesa_function_pool[30263]: DrawRangeElementsBaseVertex (will be remapped) */
+   /* _mesa_function_pool[30418]: DrawRangeElementsBaseVertex (will be remapped) */
    "iiiiipi\0"
    "glDrawRangeElementsBaseVertex\0"
    "\0"
-   /* _mesa_function_pool[30302]: TexCoordPointervINTEL (dynamic) */
+   /* _mesa_function_pool[30457]: TexCoordPointervINTEL (dynamic) */
    "iip\0"
    "glTexCoordPointervINTEL\0"
    "\0"
-   /* _mesa_function_pool[30331]: DeleteBuffersARB (will be remapped) */
+   /* _mesa_function_pool[30486]: DeleteBuffersARB (will be remapped) */
    "ip\0"
    "glDeleteBuffers\0"
    "glDeleteBuffersARB\0"
    "\0"
-   /* _mesa_function_pool[30370]: PixelTransformParameterfvEXT (dynamic) */
+   /* _mesa_function_pool[30525]: PixelTransformParameterfvEXT (dynamic) */
    "iip\0"
    "glPixelTransformParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[30406]: PrimitiveRestartNV (will be remapped) */
+   /* _mesa_function_pool[30561]: PrimitiveRestartNV (will be remapped) */
    "\0"
    "glPrimitiveRestartNV\0"
    "\0"
-   /* _mesa_function_pool[30429]: WindowPos4fvMESA (will be remapped) */
+   /* _mesa_function_pool[30584]: WindowPos4fvMESA (will be remapped) */
    "p\0"
    "glWindowPos4fvMESA\0"
    "\0"
-   /* _mesa_function_pool[30451]: GetPixelMapuiv (offset 272) */
+   /* _mesa_function_pool[30606]: GetPixelMapuiv (offset 272) */
    "ip\0"
    "glGetPixelMapuiv\0"
    "\0"
-   /* _mesa_function_pool[30472]: Rectf (offset 88) */
+   /* _mesa_function_pool[30627]: Rectf (offset 88) */
    "ffff\0"
    "glRectf\0"
    "\0"
-   /* _mesa_function_pool[30486]: VertexAttrib1sNV (will be remapped) */
+   /* _mesa_function_pool[30641]: VertexAttrib1sNV (will be remapped) */
    "ii\0"
    "glVertexAttrib1sNV\0"
    "\0"
-   /* _mesa_function_pool[30509]: Indexfv (offset 47) */
+   /* _mesa_function_pool[30664]: Indexfv (offset 47) */
    "p\0"
    "glIndexfv\0"
    "\0"
-   /* _mesa_function_pool[30522]: SecondaryColor3svEXT (will be remapped) */
+   /* _mesa_function_pool[30677]: SecondaryColor3svEXT (will be remapped) */
    "p\0"
    "glSecondaryColor3sv\0"
    "glSecondaryColor3svEXT\0"
    "\0"
-   /* _mesa_function_pool[30568]: LoadTransposeMatrixfARB (will be remapped) */
+   /* _mesa_function_pool[30723]: LoadTransposeMatrixfARB (will be remapped) */
    "p\0"
    "glLoadTransposeMatrixf\0"
    "glLoadTransposeMatrixfARB\0"
    "\0"
-   /* _mesa_function_pool[30620]: GetPointerv (offset 329) */
+   /* _mesa_function_pool[30775]: GetPointerv (offset 329) */
    "ip\0"
    "glGetPointerv\0"
    "glGetPointervEXT\0"
    "\0"
-   /* _mesa_function_pool[30655]: Tangent3bEXT (dynamic) */
+   /* _mesa_function_pool[30810]: Tangent3bEXT (dynamic) */
    "iii\0"
    "glTangent3bEXT\0"
    "\0"
-   /* _mesa_function_pool[30675]: CombinerParameterfNV (will be remapped) */
+   /* _mesa_function_pool[30830]: CombinerParameterfNV (will be remapped) */
    "if\0"
    "glCombinerParameterfNV\0"
    "\0"
-   /* _mesa_function_pool[30702]: IndexMask (offset 212) */
+   /* _mesa_function_pool[30857]: IndexMask (offset 212) */
    "i\0"
    "glIndexMask\0"
    "\0"
-   /* _mesa_function_pool[30717]: BindProgramNV (will be remapped) */
+   /* _mesa_function_pool[30872]: BindProgramNV (will be remapped) */
    "ii\0"
    "glBindProgramARB\0"
    "glBindProgramNV\0"
    "\0"
-   /* _mesa_function_pool[30754]: VertexAttrib4svARB (will be remapped) */
+   /* _mesa_function_pool[30909]: VertexAttrib4svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4sv\0"
    "glVertexAttrib4svARB\0"
    "\0"
-   /* _mesa_function_pool[30797]: GetFloatv (offset 262) */
+   /* _mesa_function_pool[30952]: GetFloatv (offset 262) */
    "ip\0"
    "glGetFloatv\0"
    "\0"
-   /* _mesa_function_pool[30813]: CreateDebugObjectMESA (dynamic) */
+   /* _mesa_function_pool[30968]: CreateDebugObjectMESA (dynamic) */
    "\0"
    "glCreateDebugObjectMESA\0"
    "\0"
-   /* _mesa_function_pool[30839]: GetShaderiv (will be remapped) */
+   /* _mesa_function_pool[30994]: GetShaderiv (will be remapped) */
    "iip\0"
    "glGetShaderiv\0"
    "\0"
-   /* _mesa_function_pool[30858]: ClientWaitSync (will be remapped) */
+   /* _mesa_function_pool[31013]: ClientWaitSync (will be remapped) */
    "iii\0"
    "glClientWaitSync\0"
    "\0"
-   /* _mesa_function_pool[30880]: TexCoord4s (offset 124) */
+   /* _mesa_function_pool[31035]: TexCoord4s (offset 124) */
    "iiii\0"
    "glTexCoord4s\0"
    "\0"
-   /* _mesa_function_pool[30899]: TexCoord3sv (offset 117) */
+   /* _mesa_function_pool[31054]: TexCoord3sv (offset 117) */
    "p\0"
    "glTexCoord3sv\0"
    "\0"
-   /* _mesa_function_pool[30916]: BindFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[31071]: BindFragmentShaderATI (will be remapped) */
    "i\0"
    "glBindFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[30943]: PopAttrib (offset 218) */
+   /* _mesa_function_pool[31098]: PopAttrib (offset 218) */
    "\0"
    "glPopAttrib\0"
    "\0"
-   /* _mesa_function_pool[30957]: Fogfv (offset 154) */
+   /* _mesa_function_pool[31112]: Fogfv (offset 154) */
    "ip\0"
    "glFogfv\0"
    "\0"
-   /* _mesa_function_pool[30969]: UnmapBufferARB (will be remapped) */
+   /* _mesa_function_pool[31124]: UnmapBufferARB (will be remapped) */
    "i\0"
    "glUnmapBuffer\0"
    "glUnmapBufferARB\0"
    "\0"
-   /* _mesa_function_pool[31003]: InitNames (offset 197) */
+   /* _mesa_function_pool[31158]: InitNames (offset 197) */
    "\0"
    "glInitNames\0"
    "\0"
-   /* _mesa_function_pool[31017]: Normal3sv (offset 61) */
+   /* _mesa_function_pool[31172]: Normal3sv (offset 61) */
    "p\0"
    "glNormal3sv\0"
    "\0"
-   /* _mesa_function_pool[31032]: Minmax (offset 368) */
+   /* _mesa_function_pool[31187]: Minmax (offset 368) */
    "iii\0"
    "glMinmax\0"
    "glMinmaxEXT\0"
    "\0"
-   /* _mesa_function_pool[31058]: TexCoord4d (offset 118) */
+   /* _mesa_function_pool[31213]: TexCoord4d (offset 118) */
    "dddd\0"
    "glTexCoord4d\0"
    "\0"
-   /* _mesa_function_pool[31077]: DeformationMap3dSGIX (dynamic) */
-   "iddiiddiiddiip\0"
-   "glDeformationMap3dSGIX\0"
-   "\0"
-   /* _mesa_function_pool[31116]: TexCoord4f (offset 120) */
+   /* _mesa_function_pool[31232]: TexCoord4f (offset 120) */
    "ffff\0"
    "glTexCoord4f\0"
    "\0"
-   /* _mesa_function_pool[31135]: FogCoorddvEXT (will be remapped) */
+   /* _mesa_function_pool[31251]: FogCoorddvEXT (will be remapped) */
    "p\0"
    "glFogCoorddv\0"
    "glFogCoorddvEXT\0"
    "\0"
-   /* _mesa_function_pool[31167]: FinishTextureSUNX (dynamic) */
+   /* _mesa_function_pool[31283]: FinishTextureSUNX (dynamic) */
    "\0"
    "glFinishTextureSUNX\0"
    "\0"
-   /* _mesa_function_pool[31189]: GetFragmentLightfvSGIX (dynamic) */
+   /* _mesa_function_pool[31305]: GetFragmentLightfvSGIX (dynamic) */
    "iip\0"
    "glGetFragmentLightfvSGIX\0"
    "\0"
-   /* _mesa_function_pool[31219]: Binormal3fvEXT (dynamic) */
+   /* _mesa_function_pool[31335]: Binormal3fvEXT (dynamic) */
    "p\0"
    "glBinormal3fvEXT\0"
    "\0"
-   /* _mesa_function_pool[31239]: GetBooleanv (offset 258) */
+   /* _mesa_function_pool[31355]: GetBooleanv (offset 258) */
    "ip\0"
    "glGetBooleanv\0"
    "\0"
-   /* _mesa_function_pool[31257]: ColorFragmentOp3ATI (will be remapped) */
+   /* _mesa_function_pool[31373]: ColorFragmentOp3ATI (will be remapped) */
    "iiiiiiiiiiiii\0"
    "glColorFragmentOp3ATI\0"
    "\0"
-   /* _mesa_function_pool[31294]: Hint (offset 158) */
+   /* _mesa_function_pool[31410]: Hint (offset 158) */
    "ii\0"
    "glHint\0"
    "\0"
-   /* _mesa_function_pool[31305]: Color4dv (offset 28) */
+   /* _mesa_function_pool[31421]: Color4dv (offset 28) */
    "p\0"
    "glColor4dv\0"
    "\0"
-   /* _mesa_function_pool[31319]: VertexAttrib2svARB (will be remapped) */
+   /* _mesa_function_pool[31435]: VertexAttrib2svARB (will be remapped) */
    "ip\0"
    "glVertexAttrib2sv\0"
    "glVertexAttrib2svARB\0"
    "\0"
-   /* _mesa_function_pool[31362]: AreProgramsResidentNV (will be remapped) */
+   /* _mesa_function_pool[31478]: AreProgramsResidentNV (will be remapped) */
    "ipp\0"
    "glAreProgramsResidentNV\0"
    "\0"
-   /* _mesa_function_pool[31391]: WindowPos3svMESA (will be remapped) */
+   /* _mesa_function_pool[31507]: WindowPos3svMESA (will be remapped) */
    "p\0"
    "glWindowPos3sv\0"
    "glWindowPos3svARB\0"
    "glWindowPos3svMESA\0"
    "\0"
-   /* _mesa_function_pool[31446]: CopyColorSubTable (offset 347) */
+   /* _mesa_function_pool[31562]: CopyColorSubTable (offset 347) */
    "iiiii\0"
    "glCopyColorSubTable\0"
    "glCopyColorSubTableEXT\0"
    "\0"
-   /* _mesa_function_pool[31496]: WeightdvARB (dynamic) */
+   /* _mesa_function_pool[31612]: WeightdvARB (dynamic) */
    "ip\0"
    "glWeightdvARB\0"
    "\0"
-   /* _mesa_function_pool[31514]: DeleteRenderbuffersEXT (will be remapped) */
+   /* _mesa_function_pool[31630]: DeleteRenderbuffersEXT (will be remapped) */
    "ip\0"
    "glDeleteRenderbuffers\0"
    "glDeleteRenderbuffersEXT\0"
    "\0"
-   /* _mesa_function_pool[31565]: VertexAttrib4NubvARB (will be remapped) */
+   /* _mesa_function_pool[31681]: VertexAttrib4NubvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib4Nubv\0"
    "glVertexAttrib4NubvARB\0"
    "\0"
-   /* _mesa_function_pool[31612]: VertexAttrib3dvNV (will be remapped) */
+   /* _mesa_function_pool[31728]: VertexAttrib3dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib3dvNV\0"
    "\0"
-   /* _mesa_function_pool[31636]: GetObjectParameterfvARB (will be remapped) */
+   /* _mesa_function_pool[31752]: GetObjectParameterfvARB (will be remapped) */
    "iip\0"
    "glGetObjectParameterfvARB\0"
    "\0"
-   /* _mesa_function_pool[31667]: Vertex4iv (offset 147) */
+   /* _mesa_function_pool[31783]: Vertex4iv (offset 147) */
    "p\0"
    "glVertex4iv\0"
    "\0"
-   /* _mesa_function_pool[31682]: GetProgramEnvParameterdvARB (will be remapped) */
+   /* _mesa_function_pool[31798]: GetProgramEnvParameterdvARB (will be remapped) */
    "iip\0"
    "glGetProgramEnvParameterdvARB\0"
    "\0"
-   /* _mesa_function_pool[31717]: TexCoord4dv (offset 119) */
+   /* _mesa_function_pool[31833]: TexCoord4dv (offset 119) */
    "p\0"
    "glTexCoord4dv\0"
    "\0"
-   /* _mesa_function_pool[31734]: LockArraysEXT (will be remapped) */
+   /* _mesa_function_pool[31850]: LockArraysEXT (will be remapped) */
    "ii\0"
    "glLockArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[31754]: Begin (offset 7) */
+   /* _mesa_function_pool[31870]: Begin (offset 7) */
    "i\0"
    "glBegin\0"
    "\0"
-   /* _mesa_function_pool[31765]: LightModeli (offset 165) */
+   /* _mesa_function_pool[31881]: LightModeli (offset 165) */
    "ii\0"
    "glLightModeli\0"
    "\0"
-   /* _mesa_function_pool[31783]: VertexAttribI4ivEXT (will be remapped) */
+   /* _mesa_function_pool[31899]: VertexAttribI4ivEXT (will be remapped) */
    "ip\0"
    "glVertexAttribI4ivEXT\0"
    "glVertexAttribI4iv\0"
    "\0"
-   /* _mesa_function_pool[31828]: Rectfv (offset 89) */
+   /* _mesa_function_pool[31944]: Rectfv (offset 89) */
    "pp\0"
    "glRectfv\0"
    "\0"
-   /* _mesa_function_pool[31841]: LightModelf (offset 163) */
+   /* _mesa_function_pool[31957]: LightModelf (offset 163) */
    "if\0"
    "glLightModelf\0"
    "\0"
-   /* _mesa_function_pool[31859]: GetTexParameterfv (offset 282) */
+   /* _mesa_function_pool[31975]: GetTexParameterfv (offset 282) */
    "iip\0"
    "glGetTexParameterfv\0"
    "\0"
-   /* _mesa_function_pool[31884]: GetLightfv (offset 264) */
+   /* _mesa_function_pool[32000]: GetLightfv (offset 264) */
    "iip\0"
    "glGetLightfv\0"
    "\0"
-   /* _mesa_function_pool[31902]: PixelTransformParameterivEXT (dynamic) */
+   /* _mesa_function_pool[32018]: PixelTransformParameterivEXT (dynamic) */
    "iip\0"
    "glPixelTransformParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[31938]: BinormalPointerEXT (dynamic) */
+   /* _mesa_function_pool[32054]: BinormalPointerEXT (dynamic) */
    "iip\0"
    "glBinormalPointerEXT\0"
    "\0"
-   /* _mesa_function_pool[31964]: VertexAttrib1dNV (will be remapped) */
+   /* _mesa_function_pool[32080]: VertexAttrib1dNV (will be remapped) */
    "id\0"
    "glVertexAttrib1dNV\0"
    "\0"
-   /* _mesa_function_pool[31987]: GetCombinerInputParameterivNV (will be remapped) */
+   /* _mesa_function_pool[32103]: GetCombinerInputParameterivNV (will be remapped) */
    "iiiip\0"
    "glGetCombinerInputParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[32026]: Disable (offset 214) */
+   /* _mesa_function_pool[32142]: Disable (offset 214) */
    "i\0"
    "glDisable\0"
    "\0"
-   /* _mesa_function_pool[32039]: MultiTexCoord2fvARB (offset 387) */
+   /* _mesa_function_pool[32155]: MultiTexCoord2fvARB (offset 387) */
    "ip\0"
    "glMultiTexCoord2fv\0"
    "glMultiTexCoord2fvARB\0"
    "\0"
-   /* _mesa_function_pool[32084]: GetRenderbufferParameterivEXT (will be remapped) */
+   /* _mesa_function_pool[32200]: GetRenderbufferParameterivEXT (will be remapped) */
    "iip\0"
    "glGetRenderbufferParameteriv\0"
    "glGetRenderbufferParameterivEXT\0"
    "\0"
-   /* _mesa_function_pool[32150]: CombinerParameterivNV (will be remapped) */
+   /* _mesa_function_pool[32266]: CombinerParameterivNV (will be remapped) */
    "ip\0"
    "glCombinerParameterivNV\0"
    "\0"
-   /* _mesa_function_pool[32178]: GenFragmentShadersATI (will be remapped) */
+   /* _mesa_function_pool[32294]: GenFragmentShadersATI (will be remapped) */
    "i\0"
    "glGenFragmentShadersATI\0"
    "\0"
-   /* _mesa_function_pool[32205]: DrawArrays (offset 310) */
+   /* _mesa_function_pool[32321]: DrawArrays (offset 310) */
    "iii\0"
    "glDrawArrays\0"
    "glDrawArraysEXT\0"
    "\0"
-   /* _mesa_function_pool[32239]: WeightuivARB (dynamic) */
+   /* _mesa_function_pool[32355]: WeightuivARB (dynamic) */
    "ip\0"
    "glWeightuivARB\0"
    "\0"
-   /* _mesa_function_pool[32258]: VertexAttrib2sARB (will be remapped) */
+   /* _mesa_function_pool[32374]: VertexAttrib2sARB (will be remapped) */
    "iii\0"
    "glVertexAttrib2s\0"
    "glVertexAttrib2sARB\0"
    "\0"
-   /* _mesa_function_pool[32300]: ColorMask (offset 210) */
+   /* _mesa_function_pool[32416]: ColorMask (offset 210) */
    "iiii\0"
    "glColorMask\0"
    "\0"
-   /* _mesa_function_pool[32318]: GenAsyncMarkersSGIX (dynamic) */
+   /* _mesa_function_pool[32434]: GenAsyncMarkersSGIX (dynamic) */
    "i\0"
    "glGenAsyncMarkersSGIX\0"
    "\0"
-   /* _mesa_function_pool[32343]: Tangent3svEXT (dynamic) */
+   /* _mesa_function_pool[32459]: Tangent3svEXT (dynamic) */
    "p\0"
    "glTangent3svEXT\0"
    "\0"
-   /* _mesa_function_pool[32362]: GetListParameterivSGIX (dynamic) */
+   /* _mesa_function_pool[32478]: GetListParameterivSGIX (dynamic) */
    "iip\0"
    "glGetListParameterivSGIX\0"
    "\0"
-   /* _mesa_function_pool[32392]: BindBufferARB (will be remapped) */
+   /* _mesa_function_pool[32508]: BindBufferARB (will be remapped) */
    "ii\0"
    "glBindBuffer\0"
    "glBindBufferARB\0"
    "\0"
-   /* _mesa_function_pool[32425]: GetInfoLogARB (will be remapped) */
+   /* _mesa_function_pool[32541]: GetInfoLogARB (will be remapped) */
    "iipp\0"
    "glGetInfoLogARB\0"
    "\0"
-   /* _mesa_function_pool[32447]: RasterPos4iv (offset 83) */
+   /* _mesa_function_pool[32563]: RasterPos4iv (offset 83) */
    "p\0"
    "glRasterPos4iv\0"
    "\0"
-   /* _mesa_function_pool[32465]: Enable (offset 215) */
+   /* _mesa_function_pool[32581]: Enable (offset 215) */
    "i\0"
    "glEnable\0"
    "\0"
-   /* _mesa_function_pool[32477]: LineStipple (offset 167) */
+   /* _mesa_function_pool[32593]: LineStipple (offset 167) */
    "ii\0"
    "glLineStipple\0"
    "\0"
-   /* _mesa_function_pool[32495]: VertexAttribs4svNV (will be remapped) */
+   /* _mesa_function_pool[32611]: VertexAttribs4svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs4svNV\0"
    "\0"
-   /* _mesa_function_pool[32521]: EdgeFlagPointerListIBM (dynamic) */
+   /* _mesa_function_pool[32637]: EdgeFlagPointerListIBM (dynamic) */
    "ipi\0"
    "glEdgeFlagPointerListIBM\0"
    "\0"
-   /* _mesa_function_pool[32551]: UniformMatrix3x2fv (will be remapped) */
+   /* _mesa_function_pool[32667]: UniformMatrix3x2fv (will be remapped) */
    "iiip\0"
    "glUniformMatrix3x2fv\0"
    "\0"
-   /* _mesa_function_pool[32578]: GetMinmaxParameterfv (offset 365) */
+   /* _mesa_function_pool[32694]: GetMinmaxParameterfv (offset 365) */
    "iip\0"
    "glGetMinmaxParameterfv\0"
    "glGetMinmaxParameterfvEXT\0"
    "\0"
-   /* _mesa_function_pool[32632]: VertexAttrib1fvARB (will be remapped) */
+   /* _mesa_function_pool[32748]: VertexAttrib1fvARB (will be remapped) */
    "ip\0"
    "glVertexAttrib1fv\0"
    "glVertexAttrib1fvARB\0"
    "\0"
-   /* _mesa_function_pool[32675]: GenBuffersARB (will be remapped) */
+   /* _mesa_function_pool[32791]: GenBuffersARB (will be remapped) */
    "ip\0"
    "glGenBuffers\0"
    "glGenBuffersARB\0"
    "\0"
-   /* _mesa_function_pool[32708]: VertexAttribs1svNV (will be remapped) */
+   /* _mesa_function_pool[32824]: VertexAttribs1svNV (will be remapped) */
    "iip\0"
    "glVertexAttribs1svNV\0"
    "\0"
-   /* _mesa_function_pool[32734]: Vertex3fv (offset 137) */
+   /* _mesa_function_pool[32850]: Vertex3fv (offset 137) */
    "p\0"
    "glVertex3fv\0"
    "\0"
-   /* _mesa_function_pool[32749]: GetTexBumpParameterivATI (will be remapped) */
+   /* _mesa_function_pool[32865]: GetTexBumpParameterivATI (will be remapped) */
    "ip\0"
    "glGetTexBumpParameterivATI\0"
    "\0"
-   /* _mesa_function_pool[32780]: Binormal3bEXT (dynamic) */
+   /* _mesa_function_pool[32896]: Binormal3bEXT (dynamic) */
    "iii\0"
    "glBinormal3bEXT\0"
    "\0"
-   /* _mesa_function_pool[32801]: FragmentMaterialivSGIX (dynamic) */
+   /* _mesa_function_pool[32917]: FragmentMaterialivSGIX (dynamic) */
    "iip\0"
    "glFragmentMaterialivSGIX\0"
    "\0"
-   /* _mesa_function_pool[32831]: IsRenderbufferEXT (will be remapped) */
+   /* _mesa_function_pool[32947]: IsRenderbufferEXT (will be remapped) */
    "i\0"
    "glIsRenderbuffer\0"
    "glIsRenderbufferEXT\0"
    "\0"
-   /* _mesa_function_pool[32871]: GenProgramsNV (will be remapped) */
+   /* _mesa_function_pool[32987]: GenProgramsNV (will be remapped) */
    "ip\0"
    "glGenProgramsARB\0"
    "glGenProgramsNV\0"
    "\0"
-   /* _mesa_function_pool[32908]: VertexAttrib4dvNV (will be remapped) */
+   /* _mesa_function_pool[33024]: VertexAttrib4dvNV (will be remapped) */
    "ip\0"
    "glVertexAttrib4dvNV\0"
    "\0"
-   /* _mesa_function_pool[32932]: EndFragmentShaderATI (will be remapped) */
+   /* _mesa_function_pool[33048]: EndFragmentShaderATI (will be remapped) */
    "\0"
    "glEndFragmentShaderATI\0"
    "\0"
-   /* _mesa_function_pool[32957]: Binormal3iEXT (dynamic) */
+   /* _mesa_function_pool[33073]: Binormal3iEXT (dynamic) */
    "iii\0"
    "glBinormal3iEXT\0"
    "\0"
-   /* _mesa_function_pool[32978]: WindowPos2fMESA (will be remapped) */
+   /* _mesa_function_pool[33094]: WindowPos2fMESA (will be remapped) */
    "ff\0"
    "glWindowPos2f\0"
    "glWindowPos2fARB\0"
@@ -4739,589 +4759,594 @@ static const char _mesa_function_pool[] =
 
 /* these functions need to be remapped */
 static const struct gl_function_pool_remap MESA_remap_table_functions[] = {
-   {  1577, AttachShader_remap_index },
-   {  9902, CreateProgram_remap_index },
-   { 22864, CreateShader_remap_index },
-   { 25322, DeleteProgram_remap_index },
-   { 18525, DeleteShader_remap_index },
-   { 23336, DetachShader_remap_index },
-   { 17928, GetAttachedShaders_remap_index },
-   {  4869, GetProgramInfoLog_remap_index },
-   {   405, GetProgramiv_remap_index },
-   {  6542, GetShaderInfoLog_remap_index },
-   { 30839, GetShaderiv_remap_index },
-   { 13311, IsProgram_remap_index },
-   { 12263, IsShader_remap_index },
-   { 10006, StencilFuncSeparate_remap_index },
-   {  3921, StencilMaskSeparate_remap_index },
-   {  7624, StencilOpSeparate_remap_index },
-   { 22152, UniformMatrix2x3fv_remap_index },
-   {  2847, UniformMatrix2x4fv_remap_index },
-   { 32551, UniformMatrix3x2fv_remap_index },
-   { 30161, UniformMatrix3x4fv_remap_index },
-   { 16226, UniformMatrix4x2fv_remap_index },
-   {  3263, UniformMatrix4x3fv_remap_index },
-   {  5030, ClampColor_remap_index },
-   { 17982, ClearBufferfi_remap_index },
-   { 17448, ClearBufferfv_remap_index },
-   { 29184, ClearBufferiv_remap_index },
-   { 13516, ClearBufferuiv_remap_index },
-   { 19808, GetStringi_remap_index },
-   {  2788, TexBuffer_remap_index },
-   {   938, FramebufferTexture_remap_index },
-   { 26315, GetBufferParameteri64v_remap_index },
-   { 10106, GetInteger64i_v_remap_index },
-   { 23178, VertexAttribDivisor_remap_index },
-   {  9920, LoadTransposeMatrixdARB_remap_index },
-   { 30568, LoadTransposeMatrixfARB_remap_index },
-   {  5608, MultTransposeMatrixdARB_remap_index },
-   { 23523, MultTransposeMatrixfARB_remap_index },
-   {   216, SampleCoverageARB_remap_index },
-   {  5834, CompressedTexImage1DARB_remap_index },
-   { 24051, CompressedTexImage2DARB_remap_index },
-   {  3984, CompressedTexImage3DARB_remap_index },
-   { 18242, CompressedTexSubImage1DARB_remap_index },
-   {  2050, CompressedTexSubImage2DARB_remap_index },
-   { 20230, CompressedTexSubImage3DARB_remap_index },
-   { 28340, GetCompressedTexImageARB_remap_index },
-   {  3829, DisableVertexAttribArrayARB_remap_index },
-   { 29726, EnableVertexAttribArrayARB_remap_index },
-   { 31682, GetProgramEnvParameterdvARB_remap_index },
-   { 23403, GetProgramEnvParameterfvARB_remap_index },
-   { 27277, GetProgramLocalParameterdvARB_remap_index },
-   {  8066, GetProgramLocalParameterfvARB_remap_index },
-   { 18376, GetProgramStringARB_remap_index },
-   { 27472, GetProgramivARB_remap_index },
-   { 20425, GetVertexAttribdvARB_remap_index },
-   { 16034, GetVertexAttribfvARB_remap_index },
-   {  9765, GetVertexAttribivARB_remap_index },
-   { 19289, ProgramEnvParameter4dARB_remap_index },
-   { 25072, ProgramEnvParameter4dvARB_remap_index },
-   { 16770, ProgramEnvParameter4fARB_remap_index },
-   {  8965, ProgramEnvParameter4fvARB_remap_index },
-   {  3947, ProgramLocalParameter4dARB_remap_index },
-   { 13021, ProgramLocalParameter4dvARB_remap_index },
-   { 29205, ProgramLocalParameter4fARB_remap_index },
-   { 25675, ProgramLocalParameter4fvARB_remap_index },
-   { 28094, ProgramStringARB_remap_index },
-   { 19539, VertexAttrib1dARB_remap_index },
-   { 15688, VertexAttrib1dvARB_remap_index },
-   {  4122, VertexAttrib1fARB_remap_index },
-   { 32632, VertexAttrib1fvARB_remap_index },
-   {  7150, VertexAttrib1sARB_remap_index },
-   {  2224, VertexAttrib1svARB_remap_index },
-   { 15119, VertexAttrib2dARB_remap_index },
-   { 17469, VertexAttrib2dvARB_remap_index },
-   {  1596, VertexAttrib2fARB_remap_index },
-   { 17582, VertexAttrib2fvARB_remap_index },
-   { 32258, VertexAttrib2sARB_remap_index },
-   { 31319, VertexAttrib2svARB_remap_index },
-   { 11268, VertexAttrib3dARB_remap_index },
-   {  8632, VertexAttrib3dvARB_remap_index },
-   {  1683, VertexAttrib3fARB_remap_index },
-   { 22415, VertexAttrib3fvARB_remap_index },
-   { 27941, VertexAttrib3sARB_remap_index },
-   { 20167, VertexAttrib3svARB_remap_index },
-   {  4895, VertexAttrib4NbvARB_remap_index },
-   { 17805, VertexAttrib4NivARB_remap_index },
-   { 22370, VertexAttrib4NsvARB_remap_index },
-   { 23355, VertexAttrib4NubARB_remap_index },
-   { 31565, VertexAttrib4NubvARB_remap_index },
-   { 18950, VertexAttrib4NuivARB_remap_index },
-   {  3136, VertexAttrib4NusvARB_remap_index },
-   { 10846, VertexAttrib4bvARB_remap_index },
-   { 26685, VertexAttrib4dARB_remap_index },
-   { 21189, VertexAttrib4dvARB_remap_index },
-   { 11422, VertexAttrib4fARB_remap_index },
-   { 11826, VertexAttrib4fvARB_remap_index },
-   { 10222, VertexAttrib4ivARB_remap_index },
-   { 17262, VertexAttrib4sARB_remap_index },
-   { 30754, VertexAttrib4svARB_remap_index },
-   { 16575, VertexAttrib4ubvARB_remap_index },
-   { 30050, VertexAttrib4uivARB_remap_index },
-   { 19978, VertexAttrib4usvARB_remap_index },
-   { 21967, VertexAttribPointerARB_remap_index },
-   { 32392, BindBufferARB_remap_index },
-   {  6857, BufferDataARB_remap_index },
-   {  1498, BufferSubDataARB_remap_index },
-   { 30331, DeleteBuffersARB_remap_index },
-   { 32675, GenBuffersARB_remap_index },
-   { 17625, GetBufferParameterivARB_remap_index },
-   { 16722, GetBufferPointervARB_remap_index },
-   {  1451, GetBufferSubDataARB_remap_index },
-   { 29998, IsBufferARB_remap_index },
-   { 26159, MapBufferARB_remap_index },
-   { 30969, UnmapBufferARB_remap_index },
-   {   312, BeginQueryARB_remap_index },
-   { 19634, DeleteQueriesARB_remap_index },
-   { 12153, EndQueryARB_remap_index },
-   { 28819, GenQueriesARB_remap_index },
-   {  1942, GetQueryObjectivARB_remap_index },
-   { 17306, GetQueryObjectuivARB_remap_index },
-   {  1740, GetQueryivARB_remap_index },
-   { 19885, IsQueryARB_remap_index },
-   {  8242, AttachObjectARB_remap_index },
-   { 18487, CompileShaderARB_remap_index },
-   {  3205, CreateProgramObjectARB_remap_index },
-   {  6802, CreateShaderObjectARB_remap_index },
-   { 14454, DeleteObjectARB_remap_index },
-   { 23842, DetachObjectARB_remap_index },
-   { 11898, GetActiveUniformARB_remap_index },
-   {  9440, GetAttachedObjectsARB_remap_index },
-   {  9747, GetHandleARB_remap_index },
-   { 32425, GetInfoLogARB_remap_index },
-   { 31636, GetObjectParameterfvARB_remap_index },
-   { 27151, GetObjectParameterivARB_remap_index },
-   { 28577, GetShaderSourceARB_remap_index },
-   { 27801, GetUniformLocationARB_remap_index },
-   { 23625, GetUniformfvARB_remap_index },
-   { 12596, GetUniformivARB_remap_index },
-   { 20023, LinkProgramARB_remap_index },
-   { 20081, ShaderSourceARB_remap_index },
-   {  7524, Uniform1fARB_remap_index },
-   { 29414, Uniform1fvARB_remap_index },
-   { 21936, Uniform1iARB_remap_index },
-   { 20878, Uniform1ivARB_remap_index },
-   {  2173, Uniform2fARB_remap_index },
-   { 14290, Uniform2fvARB_remap_index },
-   { 26046, Uniform2iARB_remap_index },
-   {  2293, Uniform2ivARB_remap_index },
-   { 18597, Uniform3fARB_remap_index },
-   {  9470, Uniform3fvARB_remap_index },
-   {  6396, Uniform3iARB_remap_index },
-   { 16828, Uniform3ivARB_remap_index },
-   { 19095, Uniform4fARB_remap_index },
-   { 23489, Uniform4fvARB_remap_index },
-   { 24751, Uniform4iARB_remap_index },
-   { 20391, Uniform4ivARB_remap_index },
-   {  8294, UniformMatrix2fvARB_remap_index },
+   {  1616, AttachShader_remap_index },
+   {  9872, CreateProgram_remap_index },
+   { 22867, CreateShader_remap_index },
+   { 25325, DeleteProgram_remap_index },
+   { 18511, DeleteShader_remap_index },
+   { 23339, DetachShader_remap_index },
+   { 17914, GetAttachedShaders_remap_index },
+   {  4856, GetProgramInfoLog_remap_index },
+   {   444, GetProgramiv_remap_index },
+   {  6529, GetShaderInfoLog_remap_index },
+   { 30994, GetShaderiv_remap_index },
+   { 13335, IsProgram_remap_index },
+   { 12287, IsShader_remap_index },
+   { 10002, StencilFuncSeparate_remap_index },
+   {  3960, StencilMaskSeparate_remap_index },
+   {  7594, StencilOpSeparate_remap_index },
+   { 22155, UniformMatrix2x3fv_remap_index },
+   {  2886, UniformMatrix2x4fv_remap_index },
+   { 32667, UniformMatrix3x2fv_remap_index },
+   { 30316, UniformMatrix3x4fv_remap_index },
+   { 16212, UniformMatrix4x2fv_remap_index },
+   {  3302, UniformMatrix4x3fv_remap_index },
+   {  5017, ClampColor_remap_index },
+   { 17968, ClearBufferfi_remap_index },
+   { 17434, ClearBufferfv_remap_index },
+   { 29339, ClearBufferiv_remap_index },
+   { 13540, ClearBufferuiv_remap_index },
+   { 19794, GetStringi_remap_index },
+   {  2827, TexBuffer_remap_index },
+   {   977, FramebufferTexture_remap_index },
+   { 26351, GetBufferParameteri64v_remap_index },
+   { 10102, GetInteger64i_v_remap_index },
+   { 23181, VertexAttribDivisor_remap_index },
+   {  9890, LoadTransposeMatrixdARB_remap_index },
+   { 30723, LoadTransposeMatrixfARB_remap_index },
+   {  5637, MultTransposeMatrixdARB_remap_index },
+   { 23526, MultTransposeMatrixfARB_remap_index },
+   {   255, SampleCoverageARB_remap_index },
+   {  5821, CompressedTexImage1DARB_remap_index },
+   { 24054, CompressedTexImage2DARB_remap_index },
+   {  4023, CompressedTexImage3DARB_remap_index },
+   { 18228, CompressedTexSubImage1DARB_remap_index },
+   {  2089, CompressedTexSubImage2DARB_remap_index },
+   { 20216, CompressedTexSubImage3DARB_remap_index },
+   { 28495, GetCompressedTexImageARB_remap_index },
+   {  3868, DisableVertexAttribArrayARB_remap_index },
+   { 29881, EnableVertexAttribArrayARB_remap_index },
+   { 31798, GetProgramEnvParameterdvARB_remap_index },
+   { 23406, GetProgramEnvParameterfvARB_remap_index },
+   { 27380, GetProgramLocalParameterdvARB_remap_index },
+   {  8036, GetProgramLocalParameterfvARB_remap_index },
+   { 18362, GetProgramStringARB_remap_index },
+   { 27575, GetProgramivARB_remap_index },
+   { 20411, GetVertexAttribdvARB_remap_index },
+   { 16020, GetVertexAttribfvARB_remap_index },
+   {  9735, GetVertexAttribivARB_remap_index },
+   { 19275, ProgramEnvParameter4dARB_remap_index },
+   { 25075, ProgramEnvParameter4dvARB_remap_index },
+   { 16756, ProgramEnvParameter4fARB_remap_index },
+   {  8935, ProgramEnvParameter4fvARB_remap_index },
+   {  3986, ProgramLocalParameter4dARB_remap_index },
+   { 13045, ProgramLocalParameter4dvARB_remap_index },
+   { 29360, ProgramLocalParameter4fARB_remap_index },
+   { 25711, ProgramLocalParameter4fvARB_remap_index },
+   { 28249, ProgramStringARB_remap_index },
+   { 19525, VertexAttrib1dARB_remap_index },
+   { 15674, VertexAttrib1dvARB_remap_index },
+   {  4161, VertexAttrib1fARB_remap_index },
+   { 32748, VertexAttrib1fvARB_remap_index },
+   {  7120, VertexAttrib1sARB_remap_index },
+   {  2263, VertexAttrib1svARB_remap_index },
+   { 15105, VertexAttrib2dARB_remap_index },
+   { 17455, VertexAttrib2dvARB_remap_index },
+   {  1635, VertexAttrib2fARB_remap_index },
+   { 17568, VertexAttrib2fvARB_remap_index },
+   { 32374, VertexAttrib2sARB_remap_index },
+   { 31435, VertexAttrib2svARB_remap_index },
+   { 11253, VertexAttrib3dARB_remap_index },
+   {  8602, VertexAttrib3dvARB_remap_index },
+   {  1722, VertexAttrib3fARB_remap_index },
+   { 22418, VertexAttrib3fvARB_remap_index },
+   { 28096, VertexAttrib3sARB_remap_index },
+   { 20153, VertexAttrib3svARB_remap_index },
+   {  4882, VertexAttrib4NbvARB_remap_index },
+   { 17791, VertexAttrib4NivARB_remap_index },
+   { 22373, VertexAttrib4NsvARB_remap_index },
+   { 23358, VertexAttrib4NubARB_remap_index },
+   { 31681, VertexAttrib4NubvARB_remap_index },
+   { 18936, VertexAttrib4NuivARB_remap_index },
+   {  3175, VertexAttrib4NusvARB_remap_index },
+   { 10842, VertexAttrib4bvARB_remap_index },
+   { 26753, VertexAttrib4dARB_remap_index },
+   { 21175, VertexAttrib4dvARB_remap_index },
+   { 11407, VertexAttrib4fARB_remap_index },
+   { 11811, VertexAttrib4fvARB_remap_index },
+   { 10218, VertexAttrib4ivARB_remap_index },
+   { 17248, VertexAttrib4sARB_remap_index },
+   { 30909, VertexAttrib4svARB_remap_index },
+   { 16561, VertexAttrib4ubvARB_remap_index },
+   { 30205, VertexAttrib4uivARB_remap_index },
+   { 19964, VertexAttrib4usvARB_remap_index },
+   { 21970, VertexAttribPointerARB_remap_index },
+   { 32508, BindBufferARB_remap_index },
+   {  6827, BufferDataARB_remap_index },
+   {  1537, BufferSubDataARB_remap_index },
+   { 30486, DeleteBuffersARB_remap_index },
+   { 32791, GenBuffersARB_remap_index },
+   { 17611, GetBufferParameterivARB_remap_index },
+   { 16708, GetBufferPointervARB_remap_index },
+   {  1490, GetBufferSubDataARB_remap_index },
+   { 30153, IsBufferARB_remap_index },
+   { 26195, MapBufferARB_remap_index },
+   { 31124, UnmapBufferARB_remap_index },
+   {   351, BeginQueryARB_remap_index },
+   { 19620, DeleteQueriesARB_remap_index },
+   { 12138, EndQueryARB_remap_index },
+   { 28974, GenQueriesARB_remap_index },
+   {  1981, GetQueryObjectivARB_remap_index },
+   { 17292, GetQueryObjectuivARB_remap_index },
+   {  1779, GetQueryivARB_remap_index },
+   { 19871, IsQueryARB_remap_index },
+   {  8212, AttachObjectARB_remap_index },
+   { 18473, CompileShaderARB_remap_index },
+   {  3244, CreateProgramObjectARB_remap_index },
+   {  6772, CreateShaderObjectARB_remap_index },
+   { 14407, DeleteObjectARB_remap_index },
+   { 23845, DetachObjectARB_remap_index },
+   { 11883, GetActiveUniformARB_remap_index },
+   {  9410, GetAttachedObjectsARB_remap_index },
+   {  9717, GetHandleARB_remap_index },
+   { 32541, GetInfoLogARB_remap_index },
+   { 31752, GetObjectParameterfvARB_remap_index },
+   { 27254, GetObjectParameterivARB_remap_index },
+   { 28732, GetShaderSourceARB_remap_index },
+   { 27956, GetUniformLocationARB_remap_index },
+   { 23628, GetUniformfvARB_remap_index },
+   { 12620, GetUniformivARB_remap_index },
+   { 20009, LinkProgramARB_remap_index },
+   { 20067, ShaderSourceARB_remap_index },
+   {  7494, Uniform1fARB_remap_index },
+   { 29569, Uniform1fvARB_remap_index },
+   { 21939, Uniform1iARB_remap_index },
+   { 20864, Uniform1ivARB_remap_index },
+   {  2212, Uniform2fARB_remap_index },
+   { 14243, Uniform2fvARB_remap_index },
+   { 26082, Uniform2iARB_remap_index },
+   {  2332, Uniform2ivARB_remap_index },
+   { 18583, Uniform3fARB_remap_index },
+   {  9440, Uniform3fvARB_remap_index },
+   {  6383, Uniform3iARB_remap_index },
+   { 16814, Uniform3ivARB_remap_index },
+   { 19081, Uniform4fARB_remap_index },
+   { 23492, Uniform4fvARB_remap_index },
+   { 24754, Uniform4iARB_remap_index },
+   { 20377, Uniform4ivARB_remap_index },
+   {  8264, UniformMatrix2fvARB_remap_index },
    {    17, UniformMatrix3fvARB_remap_index },
-   {  2690, UniformMatrix4fvARB_remap_index },
-   { 25184, UseProgramObjectARB_remap_index },
-   { 14807, ValidateProgramARB_remap_index },
-   { 21232, BindAttribLocationARB_remap_index },
-   {  4940, GetActiveAttribARB_remap_index },
-   { 16509, GetAttribLocationARB_remap_index },
-   { 29132, DrawBuffersARB_remap_index },
-   { 17850, DrawArraysInstancedARB_remap_index },
-   {  6457, DrawElementsInstancedARB_remap_index },
-   { 13126, RenderbufferStorageMultisample_remap_index },
-   { 13597, FramebufferTextureARB_remap_index },
-   { 25577, FramebufferTextureFaceARB_remap_index },
-   { 23991, ProgramParameteriARB_remap_index },
-   { 19143, FlushMappedBufferRange_remap_index },
-   { 27568, MapBufferRange_remap_index },
-   { 16337, BindVertexArray_remap_index },
-   { 14630, GenVertexArrays_remap_index },
-   { 29928, CopyBufferSubData_remap_index },
-   { 30858, ClientWaitSync_remap_index },
-   {  2609, DeleteSync_remap_index },
-   {  7191, FenceSync_remap_index },
-   { 15178, GetInteger64v_remap_index },
-   { 22477, GetSynciv_remap_index },
-   { 29071, IsSync_remap_index },
-   {  9388, WaitSync_remap_index },
-   {  3797, DrawElementsBaseVertex_remap_index },
-   { 30263, DrawRangeElementsBaseVertex_remap_index },
-   { 26190, MultiDrawElementsBaseVertex_remap_index },
-   {  5091, BindTransformFeedback_remap_index },
-   {  3232, DeleteTransformFeedbacks_remap_index },
-   {  6429, DrawTransformFeedback_remap_index },
-   {  9607, GenTransformFeedbacks_remap_index },
-   { 27984, IsTransformFeedback_remap_index },
-   { 25770, PauseTransformFeedback_remap_index },
-   {  5528, ResumeTransformFeedback_remap_index },
-   {  5396, PolygonOffsetEXT_remap_index },
-   { 23099, GetPixelTexGenParameterfvSGIS_remap_index },
-   {  4417, GetPixelTexGenParameterivSGIS_remap_index },
-   { 22832, PixelTexGenParameterfSGIS_remap_index },
-   {   624, PixelTexGenParameterfvSGIS_remap_index },
-   { 12634, PixelTexGenParameteriSGIS_remap_index },
-   { 13771, PixelTexGenParameterivSGIS_remap_index },
-   { 16425, SampleMaskSGIS_remap_index },
-   { 19825, SamplePatternSGIS_remap_index },
-   { 26119, ColorPointerEXT_remap_index },
-   { 17512, EdgeFlagPointerEXT_remap_index },
-   {  6050, IndexPointerEXT_remap_index },
-   {  6130, NormalPointerEXT_remap_index },
-   { 15772, TexCoordPointerEXT_remap_index },
-   {  6980, VertexPointerEXT_remap_index },
-   {  3599, PointParameterfEXT_remap_index },
-   {  7831, PointParameterfvEXT_remap_index },
-   { 31734, LockArraysEXT_remap_index },
-   { 14871, UnlockArraysEXT_remap_index },
-   {  1267, SecondaryColor3bEXT_remap_index },
-   {  7990, SecondaryColor3bvEXT_remap_index },
-   { 10399, SecondaryColor3dEXT_remap_index },
-   { 25380, SecondaryColor3dvEXT_remap_index },
-   { 27850, SecondaryColor3fEXT_remap_index },
-   { 18178, SecondaryColor3fvEXT_remap_index },
-   {   470, SecondaryColor3iEXT_remap_index },
-   { 16082, SecondaryColor3ivEXT_remap_index },
-   { 10034, SecondaryColor3sEXT_remap_index },
-   { 30522, SecondaryColor3svEXT_remap_index },
-   { 26987, SecondaryColor3ubEXT_remap_index },
-   { 21123, SecondaryColor3ubvEXT_remap_index },
-   { 12876, SecondaryColor3uiEXT_remap_index },
-   { 22719, SecondaryColor3uivEXT_remap_index },
-   { 25627, SecondaryColor3usEXT_remap_index },
-   { 12949, SecondaryColor3usvEXT_remap_index },
-   { 11769, SecondaryColorPointerEXT_remap_index },
-   { 25441, MultiDrawArraysEXT_remap_index },
-   { 20813, MultiDrawElementsEXT_remap_index },
-   { 21008, FogCoordPointerEXT_remap_index },
-   {  4566, FogCoorddEXT_remap_index },
-   { 31135, FogCoorddvEXT_remap_index },
-   {  4683, FogCoordfEXT_remap_index },
-   { 26910, FogCoordfvEXT_remap_index },
-   { 19047, PixelTexGenSGIX_remap_index },
-   { 27495, BlendFuncSeparateEXT_remap_index },
-   {  6892, FlushVertexArrayRangeNV_remap_index },
-   {  5345, VertexArrayRangeNV_remap_index },
-   { 27915, CombinerInputNV_remap_index },
-   {  2116, CombinerOutputNV_remap_index },
-   { 30675, CombinerParameterfNV_remap_index },
-   {  5219, CombinerParameterfvNV_remap_index },
-   { 22201, CombinerParameteriNV_remap_index },
-   { 32150, CombinerParameterivNV_remap_index },
-   {  7268, FinalCombinerInputNV_remap_index },
-   {  9813, GetCombinerInputParameterfvNV_remap_index },
-   { 31987, GetCombinerInputParameterivNV_remap_index },
-   { 13872, GetCombinerOutputParameterfvNV_remap_index },
-   { 13700, GetCombinerOutputParameterivNV_remap_index },
-   {  6637, GetFinalCombinerInputParameterfvNV_remap_index },
-   { 24623, GetFinalCombinerInputParameterivNV_remap_index },
-   { 12574, ResizeBuffersMESA_remap_index },
-   { 11095, WindowPos2dMESA_remap_index },
-   {  1060, WindowPos2dvMESA_remap_index },
-   { 32978, WindowPos2fMESA_remap_index },
-   {  7935, WindowPos2fvMESA_remap_index },
-   { 18125, WindowPos2iMESA_remap_index },
-   { 20298, WindowPos2ivMESA_remap_index },
-   { 20912, WindowPos2sMESA_remap_index },
-   {  5748, WindowPos2svMESA_remap_index },
-   {  7760, WindowPos3dMESA_remap_index },
-   { 14018, WindowPos3dvMESA_remap_index },
-   {   516, WindowPos3fMESA_remap_index },
-   { 14932, WindowPos3fvMESA_remap_index },
-   { 23884, WindowPos3iMESA_remap_index },
-   { 29873, WindowPos3ivMESA_remap_index },
-   { 18742, WindowPos3sMESA_remap_index },
-   { 31391, WindowPos3svMESA_remap_index },
-   { 11046, WindowPos4dMESA_remap_index },
-   { 16966, WindowPos4dvMESA_remap_index },
-   { 13977, WindowPos4fMESA_remap_index },
-   { 30429, WindowPos4fvMESA_remap_index },
-   { 30026, WindowPos4iMESA_remap_index },
-   { 12377, WindowPos4ivMESA_remap_index },
-   { 18926, WindowPos4sMESA_remap_index },
-   {  3183, WindowPos4svMESA_remap_index },
-   { 13739, MultiModeDrawArraysIBM_remap_index },
-   { 28690, MultiModeDrawElementsIBM_remap_index },
-   { 12181, DeleteFencesNV_remap_index },
-   { 27762, FinishFenceNV_remap_index },
-   {  3721, GenFencesNV_remap_index },
-   { 16946, GetFenceivNV_remap_index },
-   {  8227, IsFenceNV_remap_index },
-   { 13627, SetFenceNV_remap_index },
-   {  4178, TestFenceNV_remap_index },
-   { 31362, AreProgramsResidentNV_remap_index },
-   { 30717, BindProgramNV_remap_index },
-   { 25710, DeleteProgramsNV_remap_index },
-   { 21341, ExecuteProgramNV_remap_index },
-   { 32871, GenProgramsNV_remap_index },
-   { 23204, GetProgramParameterdvNV_remap_index },
-   { 10461, GetProgramParameterfvNV_remap_index },
-   { 26093, GetProgramStringNV_remap_index },
-   { 24261, GetProgramivNV_remap_index },
-   { 23438, GetTrackMatrixivNV_remap_index },
-   { 25887, GetVertexAttribPointervNV_remap_index },
-   { 24556, GetVertexAttribdvNV_remap_index },
-   {  9283, GetVertexAttribfvNV_remap_index },
-   { 18349, GetVertexAttribivNV_remap_index },
-   { 19173, IsProgramNV_remap_index },
-   {  9366, LoadProgramNV_remap_index },
-   { 27591, ProgramParameters4dvNV_remap_index },
-   { 24191, ProgramParameters4fvNV_remap_index },
-   { 20602, RequestResidentProgramsNV_remap_index },
-   { 22179, TrackMatrixNV_remap_index },
-   { 31964, VertexAttrib1dNV_remap_index },
-   { 13538, VertexAttrib1dvNV_remap_index },
-   { 28196, VertexAttrib1fNV_remap_index },
-   {  2415, VertexAttrib1fvNV_remap_index },
-   { 30486, VertexAttrib1sNV_remap_index },
-   { 15005, VertexAttrib1svNV_remap_index },
-   {  4845, VertexAttrib2dNV_remap_index },
-   { 13431, VertexAttrib2dvNV_remap_index },
-   { 20057, VertexAttrib2fNV_remap_index },
-   { 12997, VertexAttrib2fvNV_remap_index },
-   {  5960, VertexAttrib2sNV_remap_index },
-   { 18796, VertexAttrib2svNV_remap_index },
-   { 11243, VertexAttrib3dNV_remap_index },
-   { 31612, VertexAttrib3dvNV_remap_index },
-   { 10273, VertexAttrib3fNV_remap_index },
-   { 24583, VertexAttrib3fvNV_remap_index },
-   { 22022, VertexAttrib3sNV_remap_index },
-   { 23465, VertexAttrib3svNV_remap_index },
-   { 28664, VertexAttrib4dNV_remap_index },
-   { 32908, VertexAttrib4dvNV_remap_index },
-   {  4467, VertexAttrib4fNV_remap_index },
-   {  9416, VertexAttrib4fvNV_remap_index },
-   { 26569, VertexAttrib4sNV_remap_index },
-   {  1409, VertexAttrib4svNV_remap_index },
-   {  5003, VertexAttrib4ubNV_remap_index },
-   {   778, VertexAttrib4ubvNV_remap_index },
-   { 21521, VertexAttribPointerNV_remap_index },
-   {  2267, VertexAttribs1dvNV_remap_index },
-   { 25975, VertexAttribs1fvNV_remap_index },
-   { 32708, VertexAttribs1svNV_remap_index },
-   { 10298, VertexAttribs2dvNV_remap_index },
-   { 25145, VertexAttribs2fvNV_remap_index },
-   { 17538, VertexAttribs2svNV_remap_index },
-   {  5247, VertexAttribs3dvNV_remap_index },
-   {  2147, VertexAttribs3fvNV_remap_index },
-   { 29621, VertexAttribs3svNV_remap_index },
-   { 26659, VertexAttribs4dvNV_remap_index },
-   {  5319, VertexAttribs4fvNV_remap_index },
-   { 32495, VertexAttribs4svNV_remap_index },
-   { 29369, VertexAttribs4ubvNV_remap_index },
-   { 26729, GetTexBumpParameterfvATI_remap_index },
-   { 32749, GetTexBumpParameterivATI_remap_index },
-   { 18459, TexBumpParameterfvATI_remap_index },
-   { 20473, TexBumpParameterivATI_remap_index },
-   { 15551, AlphaFragmentOp1ATI_remap_index },
-   { 10889, AlphaFragmentOp2ATI_remap_index },
-   { 24499, AlphaFragmentOp3ATI_remap_index },
-   { 29548, BeginFragmentShaderATI_remap_index },
-   { 30916, BindFragmentShaderATI_remap_index },
-   { 23594, ColorFragmentOp1ATI_remap_index },
-   {  4345, ColorFragmentOp2ATI_remap_index },
-   { 31257, ColorFragmentOp3ATI_remap_index },
-   {  5485, DeleteFragmentShaderATI_remap_index },
-   { 32932, EndFragmentShaderATI_remap_index },
-   { 32178, GenFragmentShadersATI_remap_index },
-   { 25299, PassTexCoordATI_remap_index },
-   {  6960, SampleMapATI_remap_index },
-   {  6733, SetFragmentShaderConstantATI_remap_index },
-   {   363, PointParameteriNV_remap_index },
-   { 14179, PointParameterivNV_remap_index },
-   { 28503, ActiveStencilFaceEXT_remap_index },
-   { 27251, BindVertexArrayAPPLE_remap_index },
-   {  2737, DeleteVertexArraysAPPLE_remap_index },
-   { 17955, GenVertexArraysAPPLE_remap_index },
-   { 23269, IsVertexArrayAPPLE_remap_index },
-   {   819, GetProgramNamedParameterdvNV_remap_index },
-   {  3562, GetProgramNamedParameterfvNV_remap_index },
-   { 26760, ProgramNamedParameter4dNV_remap_index },
-   { 14505, ProgramNamedParameter4dvNV_remap_index },
-   {  8899, ProgramNamedParameter4fNV_remap_index },
-   { 11734, ProgramNamedParameter4fvNV_remap_index },
-   { 16877, PrimitiveRestartIndexNV_remap_index },
-   { 30406, PrimitiveRestartNV_remap_index },
-   { 24170, DepthBoundsEXT_remap_index },
-   {  1159, BlendEquationSeparateEXT_remap_index },
-   { 14706, BindFramebufferEXT_remap_index },
-   { 25486, BindRenderbufferEXT_remap_index },
-   {  9663, CheckFramebufferStatusEXT_remap_index },
-   { 22520, DeleteFramebuffersEXT_remap_index },
-   { 31514, DeleteRenderbuffersEXT_remap_index },
-   { 13455, FramebufferRenderbufferEXT_remap_index },
-   { 13644, FramebufferTexture1DEXT_remap_index },
-   { 11528, FramebufferTexture2DEXT_remap_index },
-   { 11148, FramebufferTexture3DEXT_remap_index },
-   { 23135, GenFramebuffersEXT_remap_index },
-   { 17403, GenRenderbuffersEXT_remap_index },
-   {  6679, GenerateMipmapEXT_remap_index },
-   { 21597, GetFramebufferAttachmentParameterivEXT_remap_index },
-   { 32084, GetRenderbufferParameterivEXT_remap_index },
-   { 20353, IsFramebufferEXT_remap_index },
-   { 32831, IsRenderbufferEXT_remap_index },
-   {  8174, RenderbufferStorageEXT_remap_index },
-   {   695, BlitFramebufferEXT_remap_index },
-   { 14324, BufferParameteriAPPLE_remap_index },
-   { 19205, FlushMappedBufferRangeAPPLE_remap_index },
-   {  1815, BindFragDataLocationEXT_remap_index },
-   { 24283, GetFragDataLocationEXT_remap_index },
-   { 10576, GetUniformuivEXT_remap_index },
-   {  2933, GetVertexAttribIivEXT_remap_index },
-   {  4195, GetVertexAttribIuivEXT_remap_index },
-   { 12014, Uniform1uiEXT_remap_index },
-   { 27676, Uniform1uivEXT_remap_index },
-   { 22118, Uniform2uiEXT_remap_index },
-   {  4309, Uniform2uivEXT_remap_index },
-   { 28943, Uniform3uiEXT_remap_index },
-   { 14652, Uniform3uivEXT_remap_index },
-   {  3486, Uniform4uiEXT_remap_index },
-   {  8675, Uniform4uivEXT_remap_index },
-   { 18306, VertexAttribI1iEXT_remap_index },
-   {   965, VertexAttribI1ivEXT_remap_index },
-   {  2516, VertexAttribI1uiEXT_remap_index },
-   { 12725, VertexAttribI1uivEXT_remap_index },
+   {  2729, UniformMatrix4fvARB_remap_index },
+   { 25187, UseProgramObjectARB_remap_index },
+   { 14793, ValidateProgramARB_remap_index },
+   { 21218, BindAttribLocationARB_remap_index },
+   {  4927, GetActiveAttribARB_remap_index },
+   { 16495, GetAttribLocationARB_remap_index },
+   { 29287, DrawBuffersARB_remap_index },
+   { 17836, DrawArraysInstancedARB_remap_index },
+   {  6444, DrawElementsInstancedARB_remap_index },
+   { 13150, RenderbufferStorageMultisample_remap_index },
+   { 13621, FramebufferTextureARB_remap_index },
+   { 25613, FramebufferTextureFaceARB_remap_index },
+   { 23994, ProgramParameteriARB_remap_index },
+   { 19129, FlushMappedBufferRange_remap_index },
+   { 27671, MapBufferRange_remap_index },
+   { 16323, BindVertexArray_remap_index },
+   { 14616, GenVertexArrays_remap_index },
+   { 30083, CopyBufferSubData_remap_index },
+   { 31013, ClientWaitSync_remap_index },
+   {  2648, DeleteSync_remap_index },
+   {  7161, FenceSync_remap_index },
+   { 15164, GetInteger64v_remap_index },
+   { 22480, GetSynciv_remap_index },
+   { 29226, IsSync_remap_index },
+   {  9358, WaitSync_remap_index },
+   {  3836, DrawElementsBaseVertex_remap_index },
+   { 30418, DrawRangeElementsBaseVertex_remap_index },
+   { 26226, MultiDrawElementsBaseVertex_remap_index },
+   {  5078, BindTransformFeedback_remap_index },
+   {  3271, DeleteTransformFeedbacks_remap_index },
+   {  6416, DrawTransformFeedback_remap_index },
+   {  9577, GenTransformFeedbacks_remap_index },
+   { 28139, IsTransformFeedback_remap_index },
+   { 25806, PauseTransformFeedback_remap_index },
+   {  5557, ResumeTransformFeedback_remap_index },
+   { 21538, ClearDepthf_remap_index },
+   {  6720, DepthRangef_remap_index },
+   { 14428, GetShaderPrecisionFormat_remap_index },
+   {  9942, ReleaseShaderCompiler_remap_index },
+   { 10885, ShaderBinary_remap_index },
+   {  5425, PolygonOffsetEXT_remap_index },
+   { 23102, GetPixelTexGenParameterfvSGIS_remap_index },
+   {  4404, GetPixelTexGenParameterivSGIS_remap_index },
+   { 22835, PixelTexGenParameterfSGIS_remap_index },
+   {   663, PixelTexGenParameterfvSGIS_remap_index },
+   { 12658, PixelTexGenParameteriSGIS_remap_index },
+   { 13763, PixelTexGenParameterivSGIS_remap_index },
+   { 16411, SampleMaskSGIS_remap_index },
+   { 19811, SamplePatternSGIS_remap_index },
+   { 26155, ColorPointerEXT_remap_index },
+   { 17498, EdgeFlagPointerEXT_remap_index },
+   {  6037, IndexPointerEXT_remap_index },
+   {  6117, NormalPointerEXT_remap_index },
+   { 15758, TexCoordPointerEXT_remap_index },
+   {  6950, VertexPointerEXT_remap_index },
+   {  3638, PointParameterfEXT_remap_index },
+   {  7801, PointParameterfvEXT_remap_index },
+   { 31850, LockArraysEXT_remap_index },
+   { 14857, UnlockArraysEXT_remap_index },
+   {  1306, SecondaryColor3bEXT_remap_index },
+   {  7960, SecondaryColor3bvEXT_remap_index },
+   { 10395, SecondaryColor3dEXT_remap_index },
+   { 25383, SecondaryColor3dvEXT_remap_index },
+   { 28005, SecondaryColor3fEXT_remap_index },
+   { 18164, SecondaryColor3fvEXT_remap_index },
+   {   509, SecondaryColor3iEXT_remap_index },
+   { 16068, SecondaryColor3ivEXT_remap_index },
+   { 10030, SecondaryColor3sEXT_remap_index },
+   { 30677, SecondaryColor3svEXT_remap_index },
+   { 27090, SecondaryColor3ubEXT_remap_index },
+   { 21109, SecondaryColor3ubvEXT_remap_index },
+   { 12900, SecondaryColor3uiEXT_remap_index },
+   { 22722, SecondaryColor3uivEXT_remap_index },
+   { 25663, SecondaryColor3usEXT_remap_index },
+   { 12973, SecondaryColor3usvEXT_remap_index },
+   { 11754, SecondaryColorPointerEXT_remap_index },
+   { 25477, MultiDrawArraysEXT_remap_index },
+   { 20799, MultiDrawElementsEXT_remap_index },
+   { 20994, FogCoordPointerEXT_remap_index },
+   {  4553, FogCoorddEXT_remap_index },
+   { 31251, FogCoorddvEXT_remap_index },
+   {  4670, FogCoordfEXT_remap_index },
+   { 27013, FogCoordfvEXT_remap_index },
+   { 19033, PixelTexGenSGIX_remap_index },
+   { 27598, BlendFuncSeparateEXT_remap_index },
+   {  6862, FlushVertexArrayRangeNV_remap_index },
+   {  5374, VertexArrayRangeNV_remap_index },
+   { 28070, CombinerInputNV_remap_index },
+   {  2155, CombinerOutputNV_remap_index },
+   { 30830, CombinerParameterfNV_remap_index },
+   {  5248, CombinerParameterfvNV_remap_index },
+   { 22204, CombinerParameteriNV_remap_index },
+   { 32266, CombinerParameterivNV_remap_index },
+   {  7238, FinalCombinerInputNV_remap_index },
+   {  9783, GetCombinerInputParameterfvNV_remap_index },
+   { 32103, GetCombinerInputParameterivNV_remap_index },
+   {   216, GetCombinerOutputParameterfvNV_remap_index },
+   { 13724, GetCombinerOutputParameterivNV_remap_index },
+   {  6624, GetFinalCombinerInputParameterfvNV_remap_index },
+   { 24626, GetFinalCombinerInputParameterivNV_remap_index },
+   { 12598, ResizeBuffersMESA_remap_index },
+   { 11080, WindowPos2dMESA_remap_index },
+   {  1099, WindowPos2dvMESA_remap_index },
+   { 33094, WindowPos2fMESA_remap_index },
+   {  7905, WindowPos2fvMESA_remap_index },
+   { 18111, WindowPos2iMESA_remap_index },
+   { 20284, WindowPos2ivMESA_remap_index },
+   { 20898, WindowPos2sMESA_remap_index },
+   {  5735, WindowPos2svMESA_remap_index },
+   {  7730, WindowPos3dMESA_remap_index },
+   { 13971, WindowPos3dvMESA_remap_index },
+   {   555, WindowPos3fMESA_remap_index },
+   { 14918, WindowPos3fvMESA_remap_index },
+   { 23887, WindowPos3iMESA_remap_index },
+   { 30028, WindowPos3ivMESA_remap_index },
+   { 18728, WindowPos3sMESA_remap_index },
+   { 31507, WindowPos3svMESA_remap_index },
+   { 11031, WindowPos4dMESA_remap_index },
+   { 16952, WindowPos4dvMESA_remap_index },
+   { 13930, WindowPos4fMESA_remap_index },
+   { 30584, WindowPos4fvMESA_remap_index },
+   { 30181, WindowPos4iMESA_remap_index },
+   { 12401, WindowPos4ivMESA_remap_index },
+   { 18912, WindowPos4sMESA_remap_index },
+   {  3222, WindowPos4svMESA_remap_index },
+   { 26721, MultiModeDrawArraysIBM_remap_index },
+   { 28845, MultiModeDrawElementsIBM_remap_index },
+   { 12166, DeleteFencesNV_remap_index },
+   { 27917, FinishFenceNV_remap_index },
+   {  3760, GenFencesNV_remap_index },
+   { 16932, GetFenceivNV_remap_index },
+   {  8197, IsFenceNV_remap_index },
+   { 13651, SetFenceNV_remap_index },
+   {  4217, TestFenceNV_remap_index },
+   { 31478, AreProgramsResidentNV_remap_index },
+   { 30872, BindProgramNV_remap_index },
+   { 25746, DeleteProgramsNV_remap_index },
+   { 21327, ExecuteProgramNV_remap_index },
+   { 32987, GenProgramsNV_remap_index },
+   { 23207, GetProgramParameterdvNV_remap_index },
+   { 10457, GetProgramParameterfvNV_remap_index },
+   { 26129, GetProgramStringNV_remap_index },
+   { 24264, GetProgramivNV_remap_index },
+   { 23441, GetTrackMatrixivNV_remap_index },
+   { 25923, GetVertexAttribPointervNV_remap_index },
+   { 24559, GetVertexAttribdvNV_remap_index },
+   {  9253, GetVertexAttribfvNV_remap_index },
+   { 18335, GetVertexAttribivNV_remap_index },
+   { 19159, IsProgramNV_remap_index },
+   {  9336, LoadProgramNV_remap_index },
+   { 27694, ProgramParameters4dvNV_remap_index },
+   { 24194, ProgramParameters4fvNV_remap_index },
+   { 20588, RequestResidentProgramsNV_remap_index },
+   { 22182, TrackMatrixNV_remap_index },
+   { 32080, VertexAttrib1dNV_remap_index },
+   { 13562, VertexAttrib1dvNV_remap_index },
+   { 28351, VertexAttrib1fNV_remap_index },
+   {  2454, VertexAttrib1fvNV_remap_index },
+   { 30641, VertexAttrib1sNV_remap_index },
+   { 14991, VertexAttrib1svNV_remap_index },
+   {  4832, VertexAttrib2dNV_remap_index },
+   { 13455, VertexAttrib2dvNV_remap_index },
+   { 20043, VertexAttrib2fNV_remap_index },
+   { 13021, VertexAttrib2fvNV_remap_index },
+   {  5947, VertexAttrib2sNV_remap_index },
+   { 18782, VertexAttrib2svNV_remap_index },
+   { 11228, VertexAttrib3dNV_remap_index },
+   { 31728, VertexAttrib3dvNV_remap_index },
+   { 10269, VertexAttrib3fNV_remap_index },
+   { 24586, VertexAttrib3fvNV_remap_index },
+   { 22025, VertexAttrib3sNV_remap_index },
+   { 23468, VertexAttrib3svNV_remap_index },
+   { 28819, VertexAttrib4dNV_remap_index },
+   { 33024, VertexAttrib4dvNV_remap_index },
+   {  4454, VertexAttrib4fNV_remap_index },
+   {  9386, VertexAttrib4fvNV_remap_index },
+   { 26605, VertexAttrib4sNV_remap_index },
+   {  1448, VertexAttrib4svNV_remap_index },
+   {  4990, VertexAttrib4ubNV_remap_index },
+   {   817, VertexAttrib4ubvNV_remap_index },
+   { 21507, VertexAttribPointerNV_remap_index },
+   {  2306, VertexAttribs1dvNV_remap_index },
+   { 26011, VertexAttribs1fvNV_remap_index },
+   { 32824, VertexAttribs1svNV_remap_index },
+   { 10294, VertexAttribs2dvNV_remap_index },
+   { 25148, VertexAttribs2fvNV_remap_index },
+   { 17524, VertexAttribs2svNV_remap_index },
+   {  5276, VertexAttribs3dvNV_remap_index },
+   {  2186, VertexAttribs3fvNV_remap_index },
+   { 29776, VertexAttribs3svNV_remap_index },
+   { 26695, VertexAttribs4dvNV_remap_index },
+   {  5348, VertexAttribs4fvNV_remap_index },
+   { 32611, VertexAttribs4svNV_remap_index },
+   { 29524, VertexAttribs4ubvNV_remap_index },
+   { 26797, GetTexBumpParameterfvATI_remap_index },
+   { 32865, GetTexBumpParameterivATI_remap_index },
+   { 18445, TexBumpParameterfvATI_remap_index },
+   { 20459, TexBumpParameterivATI_remap_index },
+   { 15537, AlphaFragmentOp1ATI_remap_index },
+   { 25429, AlphaFragmentOp2ATI_remap_index },
+   { 24502, AlphaFragmentOp3ATI_remap_index },
+   { 29703, BeginFragmentShaderATI_remap_index },
+   { 31071, BindFragmentShaderATI_remap_index },
+   { 23597, ColorFragmentOp1ATI_remap_index },
+   {  4332, ColorFragmentOp2ATI_remap_index },
+   { 31373, ColorFragmentOp3ATI_remap_index },
+   {  5514, DeleteFragmentShaderATI_remap_index },
+   { 33048, EndFragmentShaderATI_remap_index },
+   { 32294, GenFragmentShadersATI_remap_index },
+   { 25302, PassTexCoordATI_remap_index },
+   {  6930, SampleMapATI_remap_index },
+   { 26908, SetFragmentShaderConstantATI_remap_index },
+   {   402, PointParameteriNV_remap_index },
+   { 14132, PointParameterivNV_remap_index },
+   { 28658, ActiveStencilFaceEXT_remap_index },
+   { 27354, BindVertexArrayAPPLE_remap_index },
+   {  2776, DeleteVertexArraysAPPLE_remap_index },
+   { 17941, GenVertexArraysAPPLE_remap_index },
+   { 23272, IsVertexArrayAPPLE_remap_index },
+   {   858, GetProgramNamedParameterdvNV_remap_index },
+   {  3601, GetProgramNamedParameterfvNV_remap_index },
+   { 26828, ProgramNamedParameter4dNV_remap_index },
+   { 14491, ProgramNamedParameter4dvNV_remap_index },
+   {  8869, ProgramNamedParameter4fNV_remap_index },
+   { 11719, ProgramNamedParameter4fvNV_remap_index },
+   { 16863, PrimitiveRestartIndexNV_remap_index },
+   { 30561, PrimitiveRestartNV_remap_index },
+   { 24173, DepthBoundsEXT_remap_index },
+   {  1198, BlendEquationSeparateEXT_remap_index },
+   { 14692, BindFramebufferEXT_remap_index },
+   { 25522, BindRenderbufferEXT_remap_index },
+   {  9633, CheckFramebufferStatusEXT_remap_index },
+   { 22523, DeleteFramebuffersEXT_remap_index },
+   { 31630, DeleteRenderbuffersEXT_remap_index },
+   { 13479, FramebufferRenderbufferEXT_remap_index },
+   { 13668, FramebufferTexture1DEXT_remap_index },
+   { 11513, FramebufferTexture2DEXT_remap_index },
+   { 11133, FramebufferTexture3DEXT_remap_index },
+   { 23138, GenFramebuffersEXT_remap_index },
+   { 17389, GenRenderbuffersEXT_remap_index },
+   {  6666, GenerateMipmapEXT_remap_index },
+   { 21600, GetFramebufferAttachmentParameterivEXT_remap_index },
+   { 32200, GetRenderbufferParameterivEXT_remap_index },
+   { 20339, IsFramebufferEXT_remap_index },
+   { 32947, IsRenderbufferEXT_remap_index },
+   {  8144, RenderbufferStorageEXT_remap_index },
+   {   734, BlitFramebufferEXT_remap_index },
+   { 14277, BufferParameteriAPPLE_remap_index },
+   { 19191, FlushMappedBufferRangeAPPLE_remap_index },
+   {  1854, BindFragDataLocationEXT_remap_index },
+   { 24286, GetFragDataLocationEXT_remap_index },
+   { 10572, GetUniformuivEXT_remap_index },
+   {  2972, GetVertexAttribIivEXT_remap_index },
+   { 27865, GetVertexAttribIuivEXT_remap_index },
+   { 11999, Uniform1uiEXT_remap_index },
+   { 27779, Uniform1uivEXT_remap_index },
+   { 22121, Uniform2uiEXT_remap_index },
+   {  4296, Uniform2uivEXT_remap_index },
+   { 29098, Uniform3uiEXT_remap_index },
+   { 14638, Uniform3uivEXT_remap_index },
+   {  3525, Uniform4uiEXT_remap_index },
+   {  8645, Uniform4uivEXT_remap_index },
+   { 18292, VertexAttribI1iEXT_remap_index },
+   {  1004, VertexAttribI1ivEXT_remap_index },
+   {  2555, VertexAttribI1uiEXT_remap_index },
+   { 12749, VertexAttribI1uivEXT_remap_index },
    {    81, VertexAttribI2iEXT_remap_index },
-   { 23706, VertexAttribI2ivEXT_remap_index },
-   {  5273, VertexAttribI2uiEXT_remap_index },
-   {  4728, VertexAttribI2uivEXT_remap_index },
-   { 26361, VertexAttribI3iEXT_remap_index },
-   { 30218, VertexAttribI3ivEXT_remap_index },
-   {  3340, VertexAttribI3uiEXT_remap_index },
-   { 30114, VertexAttribI3uivEXT_remap_index },
-   { 21848, VertexAttribI4bvEXT_remap_index },
-   { 14584, VertexAttribI4iEXT_remap_index },
-   { 31783, VertexAttribI4ivEXT_remap_index },
-   { 13358, VertexAttribI4svEXT_remap_index },
-   { 16462, VertexAttribI4ubvEXT_remap_index },
-   { 16145, VertexAttribI4uiEXT_remap_index },
-   {  5419, VertexAttribI4uivEXT_remap_index },
-   { 11311, VertexAttribI4usvEXT_remap_index },
-   { 18403, VertexAttribIPointerEXT_remap_index },
-   {  3027, FramebufferTextureLayerEXT_remap_index },
-   {  5660, ColorMaskIndexedEXT_remap_index },
-   { 18820, DisableIndexedEXT_remap_index },
-   { 26406, EnableIndexedEXT_remap_index },
-   { 21552, GetBooleanIndexedvEXT_remap_index },
-   { 10922, GetIntegerIndexedvEXT_remap_index },
-   { 22596, IsEnabledIndexedEXT_remap_index },
-   { 22496, ClearColorIiEXT_remap_index },
-   {  3436, ClearColorIuiEXT_remap_index },
-   {  9852, GetTexParameterIivEXT_remap_index },
-   {  5908, GetTexParameterIuivEXT_remap_index },
-   {  2983, TexParameterIivEXT_remap_index },
-   { 26228, TexParameterIuivEXT_remap_index },
-   {  4596, BeginConditionalRenderNV_remap_index },
-   { 25249, EndConditionalRenderNV_remap_index },
-   {  9310, BeginTransformFeedbackEXT_remap_index },
-   { 18855, BindBufferBaseEXT_remap_index },
-   { 18714, BindBufferOffsetEXT_remap_index },
-   { 12202, BindBufferRangeEXT_remap_index },
-   { 14239, EndTransformFeedbackEXT_remap_index },
-   { 10774, GetTransformFeedbackVaryingEXT_remap_index },
-   { 20658, TransformFeedbackVaryingsEXT_remap_index },
-   { 29270, ProvokingVertexEXT_remap_index },
-   { 10722, GetTexParameterPointervAPPLE_remap_index },
-   {  5047, TextureRangeAPPLE_remap_index },
-   { 11600, GetObjectParameterivAPPLE_remap_index },
-   { 19780, ObjectPurgeableAPPLE_remap_index },
-   {  5702, ObjectUnpurgeableAPPLE_remap_index },
-   { 17225, ActiveProgramEXT_remap_index },
-   { 17196, CreateShaderProgramEXT_remap_index },
-   { 28288, UseShaderProgramEXT_remap_index },
-   { 28529, StencilFuncSeparateATI_remap_index },
-   { 18044, ProgramEnvParameters4fvEXT_remap_index },
-   { 17090, ProgramLocalParameters4fvEXT_remap_index },
-   { 14107, GetQueryObjecti64vEXT_remap_index },
-   { 10324, GetQueryObjectui64vEXT_remap_index },
-   { 23663, EGLImageTargetRenderbufferStorageOES_remap_index },
-   { 12120, EGLImageTargetTexture2DOES_remap_index },
+   { 23709, VertexAttribI2ivEXT_remap_index },
+   {  5302, VertexAttribI2uiEXT_remap_index },
+   {  4715, VertexAttribI2uivEXT_remap_index },
+   { 26397, VertexAttribI3iEXT_remap_index },
+   { 30373, VertexAttribI3ivEXT_remap_index },
+   {  3379, VertexAttribI3uiEXT_remap_index },
+   { 30269, VertexAttribI3uivEXT_remap_index },
+   { 21851, VertexAttribI4bvEXT_remap_index },
+   { 14570, VertexAttribI4iEXT_remap_index },
+   { 31899, VertexAttribI4ivEXT_remap_index },
+   { 13382, VertexAttribI4svEXT_remap_index },
+   { 16448, VertexAttribI4ubvEXT_remap_index },
+   { 16131, VertexAttribI4uiEXT_remap_index },
+   {  5448, VertexAttribI4uivEXT_remap_index },
+   { 11296, VertexAttribI4usvEXT_remap_index },
+   { 18389, VertexAttribIPointerEXT_remap_index },
+   {  3066, FramebufferTextureLayerEXT_remap_index },
+   {  5172, ColorMaskIndexedEXT_remap_index },
+   { 18806, DisableIndexedEXT_remap_index },
+   { 26442, EnableIndexedEXT_remap_index },
+   { 21555, GetBooleanIndexedvEXT_remap_index },
+   { 10907, GetIntegerIndexedvEXT_remap_index },
+   { 22599, IsEnabledIndexedEXT_remap_index },
+   { 22499, ClearColorIiEXT_remap_index },
+   {  3475, ClearColorIuiEXT_remap_index },
+   {  9822, GetTexParameterIivEXT_remap_index },
+   {  5895, GetTexParameterIuivEXT_remap_index },
+   {  3022, TexParameterIivEXT_remap_index },
+   { 26264, TexParameterIuivEXT_remap_index },
+   {  4583, BeginConditionalRenderNV_remap_index },
+   { 25252, EndConditionalRenderNV_remap_index },
+   {  9280, BeginTransformFeedbackEXT_remap_index },
+   { 18841, BindBufferBaseEXT_remap_index },
+   { 18700, BindBufferOffsetEXT_remap_index },
+   { 12226, BindBufferRangeEXT_remap_index },
+   { 14192, EndTransformFeedbackEXT_remap_index },
+   { 10770, GetTransformFeedbackVaryingEXT_remap_index },
+   { 20644, TransformFeedbackVaryingsEXT_remap_index },
+   { 29425, ProvokingVertexEXT_remap_index },
+   { 10718, GetTexParameterPointervAPPLE_remap_index },
+   {  5034, TextureRangeAPPLE_remap_index },
+   { 11585, GetObjectParameterivAPPLE_remap_index },
+   { 19766, ObjectPurgeableAPPLE_remap_index },
+   {  5689, ObjectUnpurgeableAPPLE_remap_index },
+   { 17211, ActiveProgramEXT_remap_index },
+   { 17182, CreateShaderProgramEXT_remap_index },
+   { 28443, UseShaderProgramEXT_remap_index },
+   { 28684, StencilFuncSeparateATI_remap_index },
+   { 18030, ProgramEnvParameters4fvEXT_remap_index },
+   { 17076, ProgramLocalParameters4fvEXT_remap_index },
+   { 14060, GetQueryObjecti64vEXT_remap_index },
+   { 10320, GetQueryObjectui64vEXT_remap_index },
+   { 23666, EGLImageTargetRenderbufferStorageOES_remap_index },
+   { 12105, EGLImageTargetTexture2DOES_remap_index },
    {    -1, -1 }
 };
 
 /* these functions are in the ABI, but have alternative names */
 static const struct gl_function_remap MESA_alt_functions[] = {
    /* from GL_EXT_blend_color */
-   {  2655, _gloffset_BlendColor },
+   {  2694, _gloffset_BlendColor },
    /* from GL_EXT_blend_minmax */
-   { 11205, _gloffset_BlendEquation },
+   { 11190, _gloffset_BlendEquation },
    /* from GL_EXT_color_subtable */
-   { 16988, _gloffset_ColorSubTable },
-   { 31446, _gloffset_CopyColorSubTable },
+   { 16974, _gloffset_ColorSubTable },
+   { 31562, _gloffset_CopyColorSubTable },
    /* from GL_EXT_convolution */
-   {   257, _gloffset_ConvolutionFilter1D },
-   {  2454, _gloffset_CopyConvolutionFilter1D },
-   {  4058, _gloffset_GetConvolutionParameteriv },
-   {  8523, _gloffset_ConvolutionFilter2D },
-   {  8725, _gloffset_ConvolutionParameteriv },
-   {  9185, _gloffset_ConvolutionParameterfv },
-   { 20501, _gloffset_GetSeparableFilter },
-   { 23938, _gloffset_SeparableFilter2D },
-   { 24801, _gloffset_ConvolutionParameteri },
-   { 24924, _gloffset_ConvolutionParameterf },
-   { 26595, _gloffset_GetConvolutionParameterfv },
-   { 27417, _gloffset_GetConvolutionFilter },
-   { 29810, _gloffset_CopyConvolutionFilter2D },
+   {   296, _gloffset_ConvolutionFilter1D },
+   {  2493, _gloffset_CopyConvolutionFilter1D },
+   {  4097, _gloffset_GetConvolutionParameteriv },
+   {  8493, _gloffset_ConvolutionFilter2D },
+   {  8695, _gloffset_ConvolutionParameteriv },
+   {  9155, _gloffset_ConvolutionParameterfv },
+   { 20487, _gloffset_GetSeparableFilter },
+   { 23941, _gloffset_SeparableFilter2D },
+   { 24804, _gloffset_ConvolutionParameteri },
+   { 24927, _gloffset_ConvolutionParameterf },
+   { 26631, _gloffset_GetConvolutionParameterfv },
+   { 27520, _gloffset_GetConvolutionFilter },
+   { 29965, _gloffset_CopyConvolutionFilter2D },
    /* from GL_EXT_copy_texture */
-   { 15065, _gloffset_CopyTexSubImage3D },
-   { 16675, _gloffset_CopyTexImage2D },
-   { 24409, _gloffset_CopyTexImage1D },
-   { 27098, _gloffset_CopyTexSubImage2D },
-   { 29448, _gloffset_CopyTexSubImage1D },
+   { 15051, _gloffset_CopyTexSubImage3D },
+   { 16661, _gloffset_CopyTexImage2D },
+   { 24412, _gloffset_CopyTexImage1D },
+   { 27201, _gloffset_CopyTexSubImage2D },
+   { 29603, _gloffset_CopyTexSubImage1D },
    /* from GL_EXT_draw_range_elements */
-   {  9522, _gloffset_DrawRangeElements },
+   {  9492, _gloffset_DrawRangeElements },
    /* from GL_EXT_histogram */
-   {   856, _gloffset_Histogram },
-   {  3522, _gloffset_ResetHistogram },
-   {  9972, _gloffset_GetMinmax },
-   { 15399, _gloffset_GetHistogramParameterfv },
-   { 24334, _gloffset_GetMinmaxParameteriv },
-   { 26485, _gloffset_ResetMinmax },
-   { 27314, _gloffset_GetHistogramParameteriv },
-   { 28463, _gloffset_GetHistogram },
-   { 31032, _gloffset_Minmax },
-   { 32578, _gloffset_GetMinmaxParameterfv },
+   {   895, _gloffset_Histogram },
+   {  3561, _gloffset_ResetHistogram },
+   {  9968, _gloffset_GetMinmax },
+   { 15385, _gloffset_GetHistogramParameterfv },
+   { 24337, _gloffset_GetMinmaxParameteriv },
+   { 26521, _gloffset_ResetMinmax },
+   { 27417, _gloffset_GetHistogramParameteriv },
+   { 28618, _gloffset_GetHistogram },
+   { 31187, _gloffset_Minmax },
+   { 32694, _gloffset_GetMinmaxParameterfv },
    /* from GL_EXT_paletted_texture */
-   {  8385, _gloffset_ColorTable },
-   { 15245, _gloffset_GetColorTable },
-   { 22882, _gloffset_GetColorTableParameterfv },
-   { 24980, _gloffset_GetColorTableParameteriv },
+   {  8355, _gloffset_ColorTable },
+   { 15231, _gloffset_GetColorTable },
+   { 22885, _gloffset_GetColorTableParameterfv },
+   { 24983, _gloffset_GetColorTableParameteriv },
    /* from GL_EXT_subtexture */
-   {  7106, _gloffset_TexSubImage1D },
-   { 10649, _gloffset_TexSubImage2D },
+   {  7076, _gloffset_TexSubImage1D },
+   { 10645, _gloffset_TexSubImage2D },
    /* from GL_EXT_texture3D */
-   {  1774, _gloffset_TexImage3D },
-   { 22651, _gloffset_TexSubImage3D },
+   {  1813, _gloffset_TexImage3D },
+   { 22654, _gloffset_TexSubImage3D },
    /* from GL_EXT_texture_object */
-   {  3290, _gloffset_PrioritizeTextures },
-   {  7555, _gloffset_AreTexturesResident },
-   { 13562, _gloffset_GenTextures },
-   { 15731, _gloffset_DeleteTextures },
-   { 19486, _gloffset_IsTexture },
-   { 29513, _gloffset_BindTexture },
+   {  3329, _gloffset_PrioritizeTextures },
+   {  7525, _gloffset_AreTexturesResident },
+   { 13586, _gloffset_GenTextures },
+   { 15717, _gloffset_DeleteTextures },
+   { 19472, _gloffset_IsTexture },
+   { 29668, _gloffset_BindTexture },
    /* from GL_EXT_vertex_array */
-   { 24110, _gloffset_ArrayElement },
-   { 30620, _gloffset_GetPointerv },
-   { 32205, _gloffset_DrawArrays },
+   { 24113, _gloffset_ArrayElement },
+   { 30775, _gloffset_GetPointerv },
+   { 32321, _gloffset_DrawArrays },
    /* from GL_SGI_color_table */
-   {  7673, _gloffset_ColorTableParameteriv },
-   {  8385, _gloffset_ColorTable },
-   { 15245, _gloffset_GetColorTable },
-   { 15355, _gloffset_CopyColorTable },
-   { 19347, _gloffset_ColorTableParameterfv },
-   { 22882, _gloffset_GetColorTableParameterfv },
-   { 24980, _gloffset_GetColorTableParameteriv },
+   {  7643, _gloffset_ColorTableParameteriv },
+   {  8355, _gloffset_ColorTable },
+   { 15231, _gloffset_GetColorTable },
+   { 15341, _gloffset_CopyColorTable },
+   { 19333, _gloffset_ColorTableParameterfv },
+   { 22885, _gloffset_GetColorTableParameterfv },
+   { 24983, _gloffset_GetColorTableParameteriv },
    /* from GL_VERSION_1_3 */
-   {   425, _gloffset_MultiTexCoord3sARB },
-   {   657, _gloffset_ActiveTextureARB },
-   {  4247, _gloffset_MultiTexCoord1fvARB },
-   {  6155, _gloffset_MultiTexCoord3dARB },
-   {  6200, _gloffset_MultiTexCoord2iARB },
-   {  6324, _gloffset_MultiTexCoord2svARB },
-   {  8341, _gloffset_MultiTexCoord2fARB },
-   { 10354, _gloffset_MultiTexCoord3fvARB },
-   { 10967, _gloffset_MultiTexCoord4sARB },
-   { 11648, _gloffset_MultiTexCoord2dvARB },
-   { 12063, _gloffset_MultiTexCoord1svARB },
-   { 12435, _gloffset_MultiTexCoord3svARB },
-   { 12496, _gloffset_MultiTexCoord4iARB },
-   { 13266, _gloffset_MultiTexCoord3iARB },
-   { 14136, _gloffset_MultiTexCoord1dARB },
-   { 14353, _gloffset_MultiTexCoord3dvARB },
-   { 15599, _gloffset_MultiTexCoord3ivARB },
-   { 15644, _gloffset_MultiTexCoord2sARB },
-   { 17045, _gloffset_MultiTexCoord4ivARB },
-   { 18997, _gloffset_ClientActiveTextureARB },
-   { 21297, _gloffset_MultiTexCoord2dARB },
-   { 21717, _gloffset_MultiTexCoord4dvARB },
-   { 22073, _gloffset_MultiTexCoord4fvARB },
-   { 23023, _gloffset_MultiTexCoord3fARB },
-   { 25531, _gloffset_MultiTexCoord4dARB },
-   { 25797, _gloffset_MultiTexCoord1sARB },
-   { 26001, _gloffset_MultiTexCoord1dvARB },
-   { 26942, _gloffset_MultiTexCoord1ivARB },
-   { 27035, _gloffset_MultiTexCoord2ivARB },
-   { 27374, _gloffset_MultiTexCoord1iARB },
-   { 28738, _gloffset_MultiTexCoord4svARB },
-   { 29312, _gloffset_MultiTexCoord1fARB },
-   { 29575, _gloffset_MultiTexCoord4fARB },
-   { 32039, _gloffset_MultiTexCoord2fvARB },
+   {   464, _gloffset_MultiTexCoord3sARB },
+   {   696, _gloffset_ActiveTextureARB },
+   {  4234, _gloffset_MultiTexCoord1fvARB },
+   {  6142, _gloffset_MultiTexCoord3dARB },
+   {  6187, _gloffset_MultiTexCoord2iARB },
+   {  6311, _gloffset_MultiTexCoord2svARB },
+   {  8311, _gloffset_MultiTexCoord2fARB },
+   { 10350, _gloffset_MultiTexCoord3fvARB },
+   { 10952, _gloffset_MultiTexCoord4sARB },
+   { 11633, _gloffset_MultiTexCoord2dvARB },
+   { 12048, _gloffset_MultiTexCoord1svARB },
+   { 12459, _gloffset_MultiTexCoord3svARB },
+   { 12520, _gloffset_MultiTexCoord4iARB },
+   { 13290, _gloffset_MultiTexCoord3iARB },
+   { 14089, _gloffset_MultiTexCoord1dARB },
+   { 14306, _gloffset_MultiTexCoord3dvARB },
+   { 15585, _gloffset_MultiTexCoord3ivARB },
+   { 15630, _gloffset_MultiTexCoord2sARB },
+   { 17031, _gloffset_MultiTexCoord4ivARB },
+   { 18983, _gloffset_ClientActiveTextureARB },
+   { 21283, _gloffset_MultiTexCoord2dARB },
+   { 21720, _gloffset_MultiTexCoord4dvARB },
+   { 22076, _gloffset_MultiTexCoord4fvARB },
+   { 23026, _gloffset_MultiTexCoord3fARB },
+   { 25567, _gloffset_MultiTexCoord4dARB },
+   { 25833, _gloffset_MultiTexCoord1sARB },
+   { 26037, _gloffset_MultiTexCoord1dvARB },
+   { 27045, _gloffset_MultiTexCoord1ivARB },
+   { 27138, _gloffset_MultiTexCoord2ivARB },
+   { 27477, _gloffset_MultiTexCoord1iARB },
+   { 28893, _gloffset_MultiTexCoord4svARB },
+   { 29467, _gloffset_MultiTexCoord1fARB },
+   { 29730, _gloffset_MultiTexCoord4fARB },
+   { 32155, _gloffset_MultiTexCoord2fvARB },
    {    -1, -1 }
 };
 
@@ -5329,7 +5354,7 @@ static const struct gl_function_remap MESA_alt_functions[] = {
 
 #if defined(need_GL_3DFX_tbuffer)
 static const struct gl_function_remap GL_3DFX_tbuffer_functions[] = {
-   {  9243, -1 }, /* TbufferMask3DFX */
+   {  9213, -1 }, /* TbufferMask3DFX */
    {    -1, -1 }
 };
 #endif
@@ -5362,6 +5387,13 @@ static const struct gl_function_remap GL_APPLE_vertex_array_object_functions[] =
 };
 #endif
 
+#if defined(need_GL_ARB_ES2_compatibility)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_ARB_ES2_compatibility_functions[] = {
+   {    -1, -1 }
+};
+#endif
+
 #if defined(need_GL_ARB_copy_buffer)
 /* functions defined in MESA_remap_table_functions are excluded */
 static const struct gl_function_remap GL_ARB_copy_buffer_functions[] = {
@@ -5400,7 +5432,7 @@ static const struct gl_function_remap GL_ARB_framebuffer_object_functions[] = {
 #if defined(need_GL_ARB_geometry_shader4)
 /* functions defined in MESA_remap_table_functions are excluded */
 static const struct gl_function_remap GL_ARB_geometry_shader4_functions[] = {
-   { 12399, -1 }, /* FramebufferTextureLayer */
+   { 12423, -1 }, /* FramebufferTextureLayer */
    {    -1, -1 }
 };
 #endif
@@ -5414,11 +5446,11 @@ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = {
 
 #if defined(need_GL_ARB_matrix_palette)
 static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = {
-   {  3773, -1 }, /* MatrixIndexusvARB */
-   { 13087, -1 }, /* MatrixIndexuivARB */
-   { 14475, -1 }, /* MatrixIndexPointerARB */
-   { 19735, -1 }, /* CurrentPaletteMatrixARB */
-   { 22767, -1 }, /* MatrixIndexubvARB */
+   {  3812, -1 }, /* MatrixIndexusvARB */
+   { 13111, -1 }, /* MatrixIndexuivARB */
+   { 14461, -1 }, /* MatrixIndexPointerARB */
+   { 19721, -1 }, /* CurrentPaletteMatrixARB */
+   { 22770, -1 }, /* MatrixIndexubvARB */
    {    -1, -1 }
 };
 #endif
@@ -5495,16 +5527,16 @@ static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = {
 
 #if defined(need_GL_ARB_vertex_blend)
 static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = {
-   {  2396, -1 }, /* WeightubvARB */
-   {  6567, -1 }, /* WeightivARB */
-   { 11070, -1 }, /* WeightPointerARB */
-   { 13854, -1 }, /* WeightfvARB */
-   { 17564, -1 }, /* WeightbvARB */
-   { 20965, -1 }, /* WeightusvARB */
-   { 23864, -1 }, /* VertexBlendARB */
-   { 29396, -1 }, /* WeightsvARB */
-   { 31496, -1 }, /* WeightdvARB */
-   { 32239, -1 }, /* WeightuivARB */
+   {  2435, -1 }, /* WeightubvARB */
+   {  6554, -1 }, /* WeightivARB */
+   { 11055, -1 }, /* WeightPointerARB */
+   { 13846, -1 }, /* WeightfvARB */
+   { 17550, -1 }, /* WeightbvARB */
+   { 20951, -1 }, /* WeightusvARB */
+   { 23867, -1 }, /* VertexBlendARB */
+   { 29551, -1 }, /* WeightsvARB */
+   { 31612, -1 }, /* WeightdvARB */
+   { 32355, -1 }, /* WeightuivARB */
    {    -1, -1 }
 };
 #endif
@@ -5574,7 +5606,7 @@ static const struct gl_function_remap GL_ATI_separate_stencil_functions[] = {
 
 #if defined(need_GL_EXT_blend_color)
 static const struct gl_function_remap GL_EXT_blend_color_functions[] = {
-   {  2655, _gloffset_BlendColor },
+   {  2694, _gloffset_BlendColor },
    {    -1, -1 }
 };
 #endif
@@ -5595,15 +5627,15 @@ static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = {
 
 #if defined(need_GL_EXT_blend_minmax)
 static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = {
-   { 11205, _gloffset_BlendEquation },
+   { 11190, _gloffset_BlendEquation },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_color_subtable)
 static const struct gl_function_remap GL_EXT_color_subtable_functions[] = {
-   { 16988, _gloffset_ColorSubTable },
-   { 31446, _gloffset_CopyColorSubTable },
+   { 16974, _gloffset_ColorSubTable },
+   { 31562, _gloffset_CopyColorSubTable },
    {    -1, -1 }
 };
 #endif
@@ -5617,66 +5649,66 @@ static const struct gl_function_remap GL_EXT_compiled_vertex_array_functions[] =
 
 #if defined(need_GL_EXT_convolution)
 static const struct gl_function_remap GL_EXT_convolution_functions[] = {
-   {   257, _gloffset_ConvolutionFilter1D },
-   {  2454, _gloffset_CopyConvolutionFilter1D },
-   {  4058, _gloffset_GetConvolutionParameteriv },
-   {  8523, _gloffset_ConvolutionFilter2D },
-   {  8725, _gloffset_ConvolutionParameteriv },
-   {  9185, _gloffset_ConvolutionParameterfv },
-   { 20501, _gloffset_GetSeparableFilter },
-   { 23938, _gloffset_SeparableFilter2D },
-   { 24801, _gloffset_ConvolutionParameteri },
-   { 24924, _gloffset_ConvolutionParameterf },
-   { 26595, _gloffset_GetConvolutionParameterfv },
-   { 27417, _gloffset_GetConvolutionFilter },
-   { 29810, _gloffset_CopyConvolutionFilter2D },
+   {   296, _gloffset_ConvolutionFilter1D },
+   {  2493, _gloffset_CopyConvolutionFilter1D },
+   {  4097, _gloffset_GetConvolutionParameteriv },
+   {  8493, _gloffset_ConvolutionFilter2D },
+   {  8695, _gloffset_ConvolutionParameteriv },
+   {  9155, _gloffset_ConvolutionParameterfv },
+   { 20487, _gloffset_GetSeparableFilter },
+   { 23941, _gloffset_SeparableFilter2D },
+   { 24804, _gloffset_ConvolutionParameteri },
+   { 24927, _gloffset_ConvolutionParameterf },
+   { 26631, _gloffset_GetConvolutionParameterfv },
+   { 27520, _gloffset_GetConvolutionFilter },
+   { 29965, _gloffset_CopyConvolutionFilter2D },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_coordinate_frame)
 static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = {
-   { 10493, -1 }, /* TangentPointerEXT */
-   { 12554, -1 }, /* Binormal3ivEXT */
-   { 13219, -1 }, /* Tangent3sEXT */
-   { 14540, -1 }, /* Tangent3fvEXT */
-   { 18695, -1 }, /* Tangent3dvEXT */
-   { 19433, -1 }, /* Binormal3bvEXT */
-   { 20554, -1 }, /* Binormal3dEXT */
-   { 22699, -1 }, /* Tangent3fEXT */
-   { 24873, -1 }, /* Binormal3sEXT */
-   { 25341, -1 }, /* Tangent3ivEXT */
-   { 25360, -1 }, /* Tangent3dEXT */
-   { 26274, -1 }, /* Binormal3svEXT */
-   { 26840, -1 }, /* Binormal3fEXT */
-   { 27728, -1 }, /* Binormal3dvEXT */
-   { 28995, -1 }, /* Tangent3iEXT */
-   { 30095, -1 }, /* Tangent3bvEXT */
-   { 30655, -1 }, /* Tangent3bEXT */
-   { 31219, -1 }, /* Binormal3fvEXT */
-   { 31938, -1 }, /* BinormalPointerEXT */
-   { 32343, -1 }, /* Tangent3svEXT */
-   { 32780, -1 }, /* Binormal3bEXT */
-   { 32957, -1 }, /* Binormal3iEXT */
+   { 10489, -1 }, /* TangentPointerEXT */
+   { 12578, -1 }, /* Binormal3ivEXT */
+   { 13243, -1 }, /* Tangent3sEXT */
+   { 14526, -1 }, /* Tangent3fvEXT */
+   { 18681, -1 }, /* Tangent3dvEXT */
+   { 19419, -1 }, /* Binormal3bvEXT */
+   { 20540, -1 }, /* Binormal3dEXT */
+   { 22702, -1 }, /* Tangent3fEXT */
+   { 24876, -1 }, /* Binormal3sEXT */
+   { 25344, -1 }, /* Tangent3ivEXT */
+   { 25363, -1 }, /* Tangent3dEXT */
+   { 26310, -1 }, /* Binormal3svEXT */
+   { 26943, -1 }, /* Binormal3fEXT */
+   { 27831, -1 }, /* Binormal3dvEXT */
+   { 29150, -1 }, /* Tangent3iEXT */
+   { 30250, -1 }, /* Tangent3bvEXT */
+   { 30810, -1 }, /* Tangent3bEXT */
+   { 31335, -1 }, /* Binormal3fvEXT */
+   { 32054, -1 }, /* BinormalPointerEXT */
+   { 32459, -1 }, /* Tangent3svEXT */
+   { 32896, -1 }, /* Binormal3bEXT */
+   { 33073, -1 }, /* Binormal3iEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_copy_texture)
 static const struct gl_function_remap GL_EXT_copy_texture_functions[] = {
-   { 15065, _gloffset_CopyTexSubImage3D },
-   { 16675, _gloffset_CopyTexImage2D },
-   { 24409, _gloffset_CopyTexImage1D },
-   { 27098, _gloffset_CopyTexSubImage2D },
-   { 29448, _gloffset_CopyTexSubImage1D },
+   { 15051, _gloffset_CopyTexSubImage3D },
+   { 16661, _gloffset_CopyTexImage2D },
+   { 24412, _gloffset_CopyTexImage1D },
+   { 27201, _gloffset_CopyTexSubImage2D },
+   { 29603, _gloffset_CopyTexSubImage1D },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_cull_vertex)
 static const struct gl_function_remap GL_EXT_cull_vertex_functions[] = {
-   {  8874, -1 }, /* CullParameterdvEXT */
-   { 11693, -1 }, /* CullParameterfvEXT */
+   {  8844, -1 }, /* CullParameterdvEXT */
+   { 11678, -1 }, /* CullParameterfvEXT */
    {    -1, -1 }
 };
 #endif
@@ -5704,7 +5736,7 @@ static const struct gl_function_remap GL_EXT_draw_instanced_functions[] = {
 
 #if defined(need_GL_EXT_draw_range_elements)
 static const struct gl_function_remap GL_EXT_draw_range_elements_functions[] = {
-   {  9522, _gloffset_DrawRangeElements },
+   {  9492, _gloffset_DrawRangeElements },
    {    -1, -1 }
 };
 #endif
@@ -5753,39 +5785,39 @@ static const struct gl_function_remap GL_EXT_gpu_shader4_functions[] = {
 
 #if defined(need_GL_EXT_histogram)
 static const struct gl_function_remap GL_EXT_histogram_functions[] = {
-   {   856, _gloffset_Histogram },
-   {  3522, _gloffset_ResetHistogram },
-   {  9972, _gloffset_GetMinmax },
-   { 15399, _gloffset_GetHistogramParameterfv },
-   { 24334, _gloffset_GetMinmaxParameteriv },
-   { 26485, _gloffset_ResetMinmax },
-   { 27314, _gloffset_GetHistogramParameteriv },
-   { 28463, _gloffset_GetHistogram },
-   { 31032, _gloffset_Minmax },
-   { 32578, _gloffset_GetMinmaxParameterfv },
+   {   895, _gloffset_Histogram },
+   {  3561, _gloffset_ResetHistogram },
+   {  9968, _gloffset_GetMinmax },
+   { 15385, _gloffset_GetHistogramParameterfv },
+   { 24337, _gloffset_GetMinmaxParameteriv },
+   { 26521, _gloffset_ResetMinmax },
+   { 27417, _gloffset_GetHistogramParameteriv },
+   { 28618, _gloffset_GetHistogram },
+   { 31187, _gloffset_Minmax },
+   { 32694, _gloffset_GetMinmaxParameterfv },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_index_func)
 static const struct gl_function_remap GL_EXT_index_func_functions[] = {
-   { 11479, -1 }, /* IndexFuncEXT */
+   { 11464, -1 }, /* IndexFuncEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_index_material)
 static const struct gl_function_remap GL_EXT_index_material_functions[] = {
-   { 21052, -1 }, /* IndexMaterialEXT */
+   { 21038, -1 }, /* IndexMaterialEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_light_texture)
 static const struct gl_function_remap GL_EXT_light_texture_functions[] = {
-   { 26294, -1 }, /* ApplyTextureEXT */
-   { 26439, -1 }, /* TextureMaterialEXT */
-   { 26464, -1 }, /* TextureLightEXT */
+   { 26330, -1 }, /* ApplyTextureEXT */
+   { 26475, -1 }, /* TextureMaterialEXT */
+   { 26500, -1 }, /* TextureLightEXT */
    {    -1, -1 }
 };
 #endif
@@ -5806,20 +5838,20 @@ static const struct gl_function_remap GL_EXT_multisample_functions[] = {
 
 #if defined(need_GL_EXT_paletted_texture)
 static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = {
-   {  8385, _gloffset_ColorTable },
-   { 15245, _gloffset_GetColorTable },
-   { 22882, _gloffset_GetColorTableParameterfv },
-   { 24980, _gloffset_GetColorTableParameteriv },
+   {  8355, _gloffset_ColorTable },
+   { 15231, _gloffset_GetColorTable },
+   { 22885, _gloffset_GetColorTableParameterfv },
+   { 24983, _gloffset_GetColorTableParameteriv },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_pixel_transform)
 static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = {
-   { 21682, -1 }, /* PixelTransformParameterfEXT */
-   { 21762, -1 }, /* PixelTransformParameteriEXT */
-   { 30370, -1 }, /* PixelTransformParameterfvEXT */
-   { 31902, -1 }, /* PixelTransformParameterivEXT */
+   { 21685, -1 }, /* PixelTransformParameterfEXT */
+   { 21765, -1 }, /* PixelTransformParameteriEXT */
+   { 30525, -1 }, /* PixelTransformParameterfvEXT */
+   { 32018, -1 }, /* PixelTransformParameterivEXT */
    {    -1, -1 }
 };
 #endif
@@ -5868,16 +5900,16 @@ static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = {
 
 #if defined(need_GL_EXT_subtexture)
 static const struct gl_function_remap GL_EXT_subtexture_functions[] = {
-   {  7106, _gloffset_TexSubImage1D },
-   { 10649, _gloffset_TexSubImage2D },
+   {  7076, _gloffset_TexSubImage1D },
+   { 10645, _gloffset_TexSubImage2D },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_texture3D)
 static const struct gl_function_remap GL_EXT_texture3D_functions[] = {
-   {  1774, _gloffset_TexImage3D },
-   { 22651, _gloffset_TexSubImage3D },
+   {  1813, _gloffset_TexImage3D },
+   { 22654, _gloffset_TexSubImage3D },
    {    -1, -1 }
 };
 #endif
@@ -5898,19 +5930,19 @@ static const struct gl_function_remap GL_EXT_texture_integer_functions[] = {
 
 #if defined(need_GL_EXT_texture_object)
 static const struct gl_function_remap GL_EXT_texture_object_functions[] = {
-   {  3290, _gloffset_PrioritizeTextures },
-   {  7555, _gloffset_AreTexturesResident },
-   { 13562, _gloffset_GenTextures },
-   { 15731, _gloffset_DeleteTextures },
-   { 19486, _gloffset_IsTexture },
-   { 29513, _gloffset_BindTexture },
+   {  3329, _gloffset_PrioritizeTextures },
+   {  7525, _gloffset_AreTexturesResident },
+   { 13586, _gloffset_GenTextures },
+   { 15717, _gloffset_DeleteTextures },
+   { 19472, _gloffset_IsTexture },
+   { 29668, _gloffset_BindTexture },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_texture_perturb_normal)
 static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = {
-   { 13804, -1 }, /* TextureNormalEXT */
+   { 13796, -1 }, /* TextureNormalEXT */
    {    -1, -1 }
 };
 #endif
@@ -5932,30 +5964,30 @@ static const struct gl_function_remap GL_EXT_transform_feedback_functions[] = {
 #if defined(need_GL_EXT_vertex_array)
 /* functions defined in MESA_remap_table_functions are excluded */
 static const struct gl_function_remap GL_EXT_vertex_array_functions[] = {
-   { 24110, _gloffset_ArrayElement },
-   { 30620, _gloffset_GetPointerv },
-   { 32205, _gloffset_DrawArrays },
+   { 24113, _gloffset_ArrayElement },
+   { 30775, _gloffset_GetPointerv },
+   { 32321, _gloffset_DrawArrays },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_EXT_vertex_weighting)
 static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = {
-   { 19516, -1 }, /* VertexWeightfvEXT */
-   { 26818, -1 }, /* VertexWeightfEXT */
-   { 28432, -1 }, /* VertexWeightPointerEXT */
+   { 19502, -1 }, /* VertexWeightfvEXT */
+   { 26886, -1 }, /* VertexWeightfEXT */
+   { 28587, -1 }, /* VertexWeightPointerEXT */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_HP_image_transform)
 static const struct gl_function_remap GL_HP_image_transform_functions[] = {
-   {  2327, -1 }, /* GetImageTransformParameterfvHP */
-   {  3739, -1 }, /* ImageTransformParameterfHP */
-   { 10187, -1 }, /* ImageTransformParameterfvHP */
-   { 11948, -1 }, /* ImageTransformParameteriHP */
-   { 12289, -1 }, /* GetImageTransformParameterivHP */
-   { 19580, -1 }, /* ImageTransformParameterivHP */
+   {  2366, -1 }, /* GetImageTransformParameterfvHP */
+   {  3778, -1 }, /* ImageTransformParameterfHP */
+   { 10183, -1 }, /* ImageTransformParameterfvHP */
+   { 11933, -1 }, /* ImageTransformParameteriHP */
+   { 12313, -1 }, /* GetImageTransformParameterivHP */
+   { 19566, -1 }, /* ImageTransformParameterivHP */
    {    -1, -1 }
 };
 #endif
@@ -5969,14 +6001,14 @@ static const struct gl_function_remap GL_IBM_multimode_draw_arrays_functions[] =
 
 #if defined(need_GL_IBM_vertex_array_lists)
 static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = {
-   {  4379, -1 }, /* SecondaryColorPointerListIBM */
-   {  6021, -1 }, /* NormalPointerListIBM */
-   {  7729, -1 }, /* FogCoordPointerListIBM */
-   {  8036, -1 }, /* VertexPointerListIBM */
-   { 11869, -1 }, /* ColorPointerListIBM */
-   { 13326, -1 }, /* TexCoordPointerListIBM */
-   { 13826, -1 }, /* IndexPointerListIBM */
-   { 32521, -1 }, /* EdgeFlagPointerListIBM */
+   {  4366, -1 }, /* SecondaryColorPointerListIBM */
+   {  6008, -1 }, /* NormalPointerListIBM */
+   {  7699, -1 }, /* FogCoordPointerListIBM */
+   {  8006, -1 }, /* VertexPointerListIBM */
+   { 11854, -1 }, /* ColorPointerListIBM */
+   { 13350, -1 }, /* TexCoordPointerListIBM */
+   { 13818, -1 }, /* IndexPointerListIBM */
+   { 32637, -1 }, /* EdgeFlagPointerListIBM */
    {    -1, -1 }
 };
 #endif
@@ -5990,10 +6022,10 @@ static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] =
 
 #if defined(need_GL_INTEL_parallel_arrays)
 static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = {
-   { 12666, -1 }, /* VertexPointervINTEL */
-   { 15492, -1 }, /* ColorPointervINTEL */
-   { 29784, -1 }, /* NormalPointervINTEL */
-   { 30302, -1 }, /* TexCoordPointervINTEL */
+   { 12690, -1 }, /* VertexPointervINTEL */
+   { 15478, -1 }, /* ColorPointervINTEL */
+   { 29939, -1 }, /* NormalPointervINTEL */
+   { 30457, -1 }, /* TexCoordPointervINTEL */
    {    -1, -1 }
 };
 #endif
@@ -6007,10 +6039,10 @@ static const struct gl_function_remap GL_MESA_resize_buffers_functions[] = {
 
 #if defined(need_GL_MESA_shader_debug)
 static const struct gl_function_remap GL_MESA_shader_debug_functions[] = {
-   {  1638, -1 }, /* GetDebugLogLengthMESA */
-   {  3461, -1 }, /* ClearDebugLogMESA */
-   {  4540, -1 }, /* GetDebugLogMESA */
-   { 30813, -1 }, /* CreateDebugObjectMESA */
+   {  1677, -1 }, /* GetDebugLogLengthMESA */
+   {  3500, -1 }, /* ClearDebugLogMESA */
+   {  4527, -1 }, /* GetDebugLogMESA */
+   { 30968, -1 }, /* CreateDebugObjectMESA */
    {    -1, -1 }
 };
 #endif
@@ -6031,15 +6063,15 @@ static const struct gl_function_remap GL_NV_condtitional_render_functions[] = {
 
 #if defined(need_GL_NV_evaluators)
 static const struct gl_function_remap GL_NV_evaluators_functions[] = {
-   {  6768, -1 }, /* GetMapAttribParameterivNV */
-   {  8491, -1 }, /* MapControlPointsNV */
-   {  8590, -1 }, /* MapParameterfvNV */
-   { 10632, -1 }, /* EvalMapsNV */
-   { 17162, -1 }, /* GetMapAttribParameterfvNV */
-   { 17379, -1 }, /* MapParameterivNV */
-   { 24724, -1 }, /* GetMapParameterivNV */
-   { 25222, -1 }, /* GetMapParameterfvNV */
-   { 29099, -1 }, /* GetMapControlPointsNV */
+   {  6738, -1 }, /* GetMapAttribParameterivNV */
+   {  8461, -1 }, /* MapControlPointsNV */
+   {  8560, -1 }, /* MapParameterfvNV */
+   { 10628, -1 }, /* EvalMapsNV */
+   { 17148, -1 }, /* GetMapAttribParameterfvNV */
+   { 17365, -1 }, /* MapParameterivNV */
+   { 24727, -1 }, /* GetMapParameterivNV */
+   { 25225, -1 }, /* GetMapParameterfvNV */
+   { 29254, -1 }, /* GetMapControlPointsNV */
    {    -1, -1 }
 };
 #endif
@@ -6081,8 +6113,8 @@ static const struct gl_function_remap GL_NV_register_combiners_functions[] = {
 
 #if defined(need_GL_NV_register_combiners2)
 static const struct gl_function_remap GL_NV_register_combiners2_functions[] = {
-   { 15884, -1 }, /* CombinerStageParameterfvNV */
-   { 16280, -1 }, /* GetCombinerStageParameterfvNV */
+   { 15870, -1 }, /* CombinerStageParameterfvNV */
+   { 16266, -1 }, /* GetCombinerStageParameterfvNV */
    {    -1, -1 }
 };
 #endif
@@ -6110,23 +6142,23 @@ static const struct gl_function_remap GL_OES_EGL_image_functions[] = {
 
 #if defined(need_GL_PGI_misc_hints)
 static const struct gl_function_remap GL_PGI_misc_hints_functions[] = {
-   {  8711, -1 }, /* HintPGI */
+   {  8681, -1 }, /* HintPGI */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_detail_texture)
 static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = {
-   { 16253, -1 }, /* GetDetailTexFuncSGIS */
-   { 16620, -1 }, /* DetailTexFuncSGIS */
+   { 16239, -1 }, /* GetDetailTexFuncSGIS */
+   { 16606, -1 }, /* DetailTexFuncSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_fog_function)
 static const struct gl_function_remap GL_SGIS_fog_function_functions[] = {
-   { 27080, -1 }, /* FogFuncSGIS */
-   { 27781, -1 }, /* GetFogFuncSGIS */
+   { 27183, -1 }, /* FogFuncSGIS */
+   { 27936, -1 }, /* GetFogFuncSGIS */
    {    -1, -1 }
 };
 #endif
@@ -6154,112 +6186,112 @@ static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = {
 
 #if defined(need_GL_SGIS_sharpen_texture)
 static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
-   {  6829, -1 }, /* GetSharpenTexFuncSGIS */
-   { 22047, -1 }, /* SharpenTexFuncSGIS */
+   {  6799, -1 }, /* GetSharpenTexFuncSGIS */
+   { 22050, -1 }, /* SharpenTexFuncSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_texture4D)
 static const struct gl_function_remap GL_SGIS_texture4D_functions[] = {
-   {  1010, -1 }, /* TexImage4DSGIS */
-   { 15800, -1 }, /* TexSubImage4DSGIS */
+   {  1049, -1 }, /* TexImage4DSGIS */
+   { 15786, -1 }, /* TexSubImage4DSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_texture_color_mask)
 static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = {
-   { 15198, -1 }, /* TextureColorMaskSGIS */
+   { 15184, -1 }, /* TextureColorMaskSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIS_texture_filter4)
 static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = {
-   {  7006, -1 }, /* GetTexFilterFuncSGIS */
-   { 16399, -1 }, /* TexFilterFuncSGIS */
+   {  6976, -1 }, /* GetTexFilterFuncSGIS */
+   { 16385, -1 }, /* TexFilterFuncSGIS */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_async)
 static const struct gl_function_remap GL_SGIX_async_functions[] = {
-   {  3387, -1 }, /* AsyncMarkerSGIX */
-   {  4519, -1 }, /* FinishAsyncSGIX */
-   {  5466, -1 }, /* PollAsyncSGIX */
-   { 22228, -1 }, /* DeleteAsyncMarkersSGIX */
-   { 22283, -1 }, /* IsAsyncMarkerSGIX */
-   { 32318, -1 }, /* GenAsyncMarkersSGIX */
+   {  3426, -1 }, /* AsyncMarkerSGIX */
+   {  4506, -1 }, /* FinishAsyncSGIX */
+   {  5495, -1 }, /* PollAsyncSGIX */
+   { 22231, -1 }, /* DeleteAsyncMarkersSGIX */
+   { 22286, -1 }, /* IsAsyncMarkerSGIX */
+   { 32434, -1 }, /* GenAsyncMarkersSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_flush_raster)
 static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = {
-   {  7383, -1 }, /* FlushRasterSGIX */
+   {  7353, -1 }, /* FlushRasterSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_fragment_lighting)
 static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = {
-   {  2625, -1 }, /* FragmentMaterialfvSGIX */
-   {  5370, -1 }, /* FragmentLightiSGIX */
-   {  8103, -1 }, /* FragmentMaterialfSGIX */
-   {  8264, -1 }, /* GetFragmentLightivSGIX */
-   {  9137, -1 }, /* FragmentLightModeliSGIX */
-   { 10695, -1 }, /* FragmentLightivSGIX */
-   { 11013, -1 }, /* GetFragmentMaterialivSGIX */
-   { 16193, -1 }, /* GetFragmentMaterialfvSGIX */
-   { 19403, -1 }, /* FragmentLightModelfSGIX */
-   { 19703, -1 }, /* FragmentColorMaterialSGIX */
-   { 20120, -1 }, /* FragmentMaterialiSGIX */
-   { 21380, -1 }, /* LightEnviSGIX */
-   { 22974, -1 }, /* FragmentLightModelfvSGIX */
-   { 23309, -1 }, /* FragmentLightfvSGIX */
-   { 28165, -1 }, /* FragmentLightModelivSGIX */
-   { 28314, -1 }, /* FragmentLightfSGIX */
-   { 31189, -1 }, /* GetFragmentLightfvSGIX */
-   { 32801, -1 }, /* FragmentMaterialivSGIX */
+   {  2664, -1 }, /* FragmentMaterialfvSGIX */
+   {  5399, -1 }, /* FragmentLightiSGIX */
+   {  8073, -1 }, /* FragmentMaterialfSGIX */
+   {  8234, -1 }, /* GetFragmentLightivSGIX */
+   {  9107, -1 }, /* FragmentLightModeliSGIX */
+   { 10691, -1 }, /* FragmentLightivSGIX */
+   { 10998, -1 }, /* GetFragmentMaterialivSGIX */
+   { 16179, -1 }, /* GetFragmentMaterialfvSGIX */
+   { 19389, -1 }, /* FragmentLightModelfSGIX */
+   { 19689, -1 }, /* FragmentColorMaterialSGIX */
+   { 20106, -1 }, /* FragmentMaterialiSGIX */
+   { 21366, -1 }, /* LightEnviSGIX */
+   { 22977, -1 }, /* FragmentLightModelfvSGIX */
+   { 23312, -1 }, /* FragmentLightfvSGIX */
+   { 28320, -1 }, /* FragmentLightModelivSGIX */
+   { 28469, -1 }, /* FragmentLightfSGIX */
+   { 31305, -1 }, /* GetFragmentLightfvSGIX */
+   { 32917, -1 }, /* FragmentMaterialivSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_framezoom)
 static const struct gl_function_remap GL_SGIX_framezoom_functions[] = {
-   { 22306, -1 }, /* FrameZoomSGIX */
+   { 22309, -1 }, /* FrameZoomSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_igloo_interface)
 static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = {
-   { 28622, -1 }, /* IglooInterfaceSGIX */
+   { 28777, -1 }, /* IglooInterfaceSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_instruments)
 static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
-   {  2805, -1 }, /* ReadInstrumentsSGIX */
-   {  6585, -1 }, /* PollInstrumentsSGIX */
-   { 10553, -1 }, /* GetInstrumentsSGIX */
-   { 12924, -1 }, /* StartInstrumentsSGIX */
-   { 15918, -1 }, /* StopInstrumentsSGIX */
-   { 17777, -1 }, /* InstrumentsBufferSGIX */
+   {  2844, -1 }, /* ReadInstrumentsSGIX */
+   {  6572, -1 }, /* PollInstrumentsSGIX */
+   { 10549, -1 }, /* GetInstrumentsSGIX */
+   { 12948, -1 }, /* StartInstrumentsSGIX */
+   { 15904, -1 }, /* StopInstrumentsSGIX */
+   { 17763, -1 }, /* InstrumentsBufferSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_list_priority)
 static const struct gl_function_remap GL_SGIX_list_priority_functions[] = {
-   {  1241, -1 }, /* ListParameterfSGIX */
-   {  3089, -1 }, /* GetListParameterfvSGIX */
-   { 17692, -1 }, /* ListParameteriSGIX */
-   { 18645, -1 }, /* ListParameterfvSGIX */
-   { 20786, -1 }, /* ListParameterivSGIX */
-   { 32362, -1 }, /* GetListParameterivSGIX */
+   {  1280, -1 }, /* ListParameterfSGIX */
+   {  3128, -1 }, /* GetListParameterfvSGIX */
+   { 17678, -1 }, /* ListParameteriSGIX */
+   { 18631, -1 }, /* ListParameterfvSGIX */
+   { 20772, -1 }, /* ListParameterivSGIX */
+   { 32478, -1 }, /* GetListParameterivSGIX */
    {    -1, -1 }
 };
 #endif
@@ -6273,134 +6305,134 @@ static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = {
 
 #if defined(need_GL_SGIX_polynomial_ffd)
 static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = {
-   {  3685, -1 }, /* LoadIdentityDeformationMapSGIX */
-   { 16018, -1 }, /* DeformSGIX */
-   { 24222, -1 }, /* DeformationMap3fSGIX */
-   { 31077, -1 }, /* DeformationMap3dSGIX */
+   {  3724, -1 }, /* LoadIdentityDeformationMapSGIX */
+   { 12187, -1 }, /* DeformationMap3dSGIX */
+   { 16004, -1 }, /* DeformSGIX */
+   { 24225, -1 }, /* DeformationMap3fSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_reference_plane)
 static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = {
-   { 14749, -1 }, /* ReferencePlaneSGIX */
+   { 14735, -1 }, /* ReferencePlaneSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_sprite)
 static const struct gl_function_remap GL_SGIX_sprite_functions[] = {
-   {  9635, -1 }, /* SpriteParameterfvSGIX */
-   { 20575, -1 }, /* SpriteParameteriSGIX */
-   { 26519, -1 }, /* SpriteParameterfSGIX */
-   { 29242, -1 }, /* SpriteParameterivSGIX */
+   {  9605, -1 }, /* SpriteParameterfvSGIX */
+   { 20561, -1 }, /* SpriteParameteriSGIX */
+   { 26555, -1 }, /* SpriteParameterfSGIX */
+   { 29397, -1 }, /* SpriteParameterivSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGIX_tag_sample_buffer)
 static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = {
-   { 20634, -1 }, /* TagSampleBufferSGIX */
+   { 20620, -1 }, /* TagSampleBufferSGIX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SGI_color_table)
 static const struct gl_function_remap GL_SGI_color_table_functions[] = {
-   {  7673, _gloffset_ColorTableParameteriv },
-   {  8385, _gloffset_ColorTable },
-   { 15245, _gloffset_GetColorTable },
-   { 15355, _gloffset_CopyColorTable },
-   { 19347, _gloffset_ColorTableParameterfv },
-   { 22882, _gloffset_GetColorTableParameterfv },
-   { 24980, _gloffset_GetColorTableParameteriv },
+   {  7643, _gloffset_ColorTableParameteriv },
+   {  8355, _gloffset_ColorTable },
+   { 15231, _gloffset_GetColorTable },
+   { 15341, _gloffset_CopyColorTable },
+   { 19333, _gloffset_ColorTableParameterfv },
+   { 22885, _gloffset_GetColorTableParameterfv },
+   { 24983, _gloffset_GetColorTableParameteriv },
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUNX_constant_data)
 static const struct gl_function_remap GL_SUNX_constant_data_functions[] = {
-   { 31167, -1 }, /* FinishTextureSUNX */
+   { 31283, -1 }, /* FinishTextureSUNX */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_global_alpha)
 static const struct gl_function_remap GL_SUN_global_alpha_functions[] = {
-   {  3408, -1 }, /* GlobalAlphaFactorubSUN */
-   {  4818, -1 }, /* GlobalAlphaFactoriSUN */
-   {  6610, -1 }, /* GlobalAlphaFactordSUN */
-   {  9719, -1 }, /* GlobalAlphaFactoruiSUN */
-   { 10144, -1 }, /* GlobalAlphaFactorbSUN */
-   { 13239, -1 }, /* GlobalAlphaFactorfSUN */
-   { 13403, -1 }, /* GlobalAlphaFactorusSUN */
-   { 22569, -1 }, /* GlobalAlphaFactorsSUN */
+   {  3447, -1 }, /* GlobalAlphaFactorubSUN */
+   {  4805, -1 }, /* GlobalAlphaFactoriSUN */
+   {  6597, -1 }, /* GlobalAlphaFactordSUN */
+   {  9689, -1 }, /* GlobalAlphaFactoruiSUN */
+   { 10140, -1 }, /* GlobalAlphaFactorbSUN */
+   { 13263, -1 }, /* GlobalAlphaFactorfSUN */
+   { 13427, -1 }, /* GlobalAlphaFactorusSUN */
+   { 22572, -1 }, /* GlobalAlphaFactorsSUN */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_mesh_array)
 static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
-   { 29033, -1 }, /* DrawMeshArraysSUN */
+   { 29188, -1 }, /* DrawMeshArraysSUN */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_triangle_list)
 static const struct gl_function_remap GL_SUN_triangle_list_functions[] = {
-   {  4493, -1 }, /* ReplacementCodeubSUN */
-   {  6369, -1 }, /* ReplacementCodeubvSUN */
-   { 19068, -1 }, /* ReplacementCodeusvSUN */
-   { 19256, -1 }, /* ReplacementCodePointerSUN */
-   { 21444, -1 }, /* ReplacementCodeuiSUN */
-   { 22257, -1 }, /* ReplacementCodeusSUN */
-   { 29699, -1 }, /* ReplacementCodeuivSUN */
+   {  4480, -1 }, /* ReplacementCodeubSUN */
+   {  6356, -1 }, /* ReplacementCodeubvSUN */
+   { 19054, -1 }, /* ReplacementCodeusvSUN */
+   { 19242, -1 }, /* ReplacementCodePointerSUN */
+   { 21430, -1 }, /* ReplacementCodeuiSUN */
+   { 22260, -1 }, /* ReplacementCodeusSUN */
+   { 29854, -1 }, /* ReplacementCodeuivSUN */
    {    -1, -1 }
 };
 #endif
 
 #if defined(need_GL_SUN_vertex)
 static const struct gl_function_remap GL_SUN_vertex_functions[] = {
-   {  1115, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */
-   {  1313, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */
-   {  1539, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */
-   {  1869, -1 }, /* ReplacementCodeuiVertex3fvSUN */
-   {  2003, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */
-   {  2561, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */
-   {  2874, -1 }, /* Color4ubVertex3fvSUN */
-   {  4652, -1 }, /* Color4ubVertex3fSUN */
-   {  4775, -1 }, /* TexCoord2fVertex3fSUN */
-   {  5119, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */
-   {  5570, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */
-   {  6264, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */
-   {  7061, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
-   {  7420, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */
-   {  8132, -1 }, /* TexCoord2fNormal3fVertex3fSUN */
-   {  8936, -1 }, /* Color3fVertex3fSUN */
-   { 10080, -1 }, /* Color3fVertex3fvSUN */
-   { 10518, -1 }, /* Color4fNormal3fVertex3fvSUN */
-   { 11358, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
-   { 12787, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
-   { 14398, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
-   { 14891, -1 }, /* TexCoord2fColor3fVertex3fSUN */
-   { 15943, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
-   { 16358, -1 }, /* Color4ubVertex2fvSUN */
-   { 16645, -1 }, /* Normal3fVertex3fSUN */
-   { 17718, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
-   { 18079, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
-   { 18897, -1 }, /* TexCoord2fVertex3fvSUN */
-   { 19673, -1 }, /* Color4ubVertex2fSUN */
-   { 19911, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
-   { 21893, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
-   { 22325, -1 }, /* Normal3fVertex3fvSUN */
-   { 22791, -1 }, /* Color4fNormal3fVertex3fSUN */
-   { 23771, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
-   { 25840, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
-   { 27196, -1 }, /* TexCoord4fVertex4fSUN */
-   { 27622, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
-   { 28009, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
-   { 28136, -1 }, /* TexCoord4fVertex4fvSUN */
-   { 28870, -1 }, /* ReplacementCodeuiVertex3fSUN */
+   {  1154, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */
+   {  1352, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */
+   {  1578, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */
+   {  1908, -1 }, /* ReplacementCodeuiVertex3fvSUN */
+   {  2042, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */
+   {  2600, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */
+   {  2913, -1 }, /* Color4ubVertex3fvSUN */
+   {  4639, -1 }, /* Color4ubVertex3fSUN */
+   {  4762, -1 }, /* TexCoord2fVertex3fSUN */
+   {  5106, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */
+   {  5599, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */
+   {  6251, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */
+   {  7031, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
+   {  7390, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */
+   {  8102, -1 }, /* TexCoord2fNormal3fVertex3fSUN */
+   {  8906, -1 }, /* Color3fVertex3fSUN */
+   { 10076, -1 }, /* Color3fVertex3fvSUN */
+   { 10514, -1 }, /* Color4fNormal3fVertex3fvSUN */
+   { 11343, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
+   { 12811, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
+   { 14351, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
+   { 14877, -1 }, /* TexCoord2fColor3fVertex3fSUN */
+   { 15929, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
+   { 16344, -1 }, /* Color4ubVertex2fvSUN */
+   { 16631, -1 }, /* Normal3fVertex3fSUN */
+   { 17704, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
+   { 18065, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
+   { 18883, -1 }, /* TexCoord2fVertex3fvSUN */
+   { 19659, -1 }, /* Color4ubVertex2fSUN */
+   { 19897, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
+   { 21896, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
+   { 22328, -1 }, /* Normal3fVertex3fvSUN */
+   { 22794, -1 }, /* Color4fNormal3fVertex3fSUN */
+   { 23774, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
+   { 25876, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
+   { 27299, -1 }, /* TexCoord4fVertex4fSUN */
+   { 27725, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
+   { 28164, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
+   { 28291, -1 }, /* TexCoord4fVertex4fvSUN */
+   { 29025, -1 }, /* ReplacementCodeuiVertex3fSUN */
    {    -1, -1 }
 };
 #endif
@@ -6408,40 +6440,40 @@ static const struct gl_function_remap GL_SUN_vertex_functions[] = {
 #if defined(need_GL_VERSION_1_3)
 /* functions defined in MESA_remap_table_functions are excluded */
 static const struct gl_function_remap GL_VERSION_1_3_functions[] = {
-   {   425, _gloffset_MultiTexCoord3sARB },
-   {   657, _gloffset_ActiveTextureARB },
-   {  4247, _gloffset_MultiTexCoord1fvARB },
-   {  6155, _gloffset_MultiTexCoord3dARB },
-   {  6200, _gloffset_MultiTexCoord2iARB },
-   {  6324, _gloffset_MultiTexCoord2svARB },
-   {  8341, _gloffset_MultiTexCoord2fARB },
-   { 10354, _gloffset_MultiTexCoord3fvARB },
-   { 10967, _gloffset_MultiTexCoord4sARB },
-   { 11648, _gloffset_MultiTexCoord2dvARB },
-   { 12063, _gloffset_MultiTexCoord1svARB },
-   { 12435, _gloffset_MultiTexCoord3svARB },
-   { 12496, _gloffset_MultiTexCoord4iARB },
-   { 13266, _gloffset_MultiTexCoord3iARB },
-   { 14136, _gloffset_MultiTexCoord1dARB },
-   { 14353, _gloffset_MultiTexCoord3dvARB },
-   { 15599, _gloffset_MultiTexCoord3ivARB },
-   { 15644, _gloffset_MultiTexCoord2sARB },
-   { 17045, _gloffset_MultiTexCoord4ivARB },
-   { 18997, _gloffset_ClientActiveTextureARB },
-   { 21297, _gloffset_MultiTexCoord2dARB },
-   { 21717, _gloffset_MultiTexCoord4dvARB },
-   { 22073, _gloffset_MultiTexCoord4fvARB },
-   { 23023, _gloffset_MultiTexCoord3fARB },
-   { 25531, _gloffset_MultiTexCoord4dARB },
-   { 25797, _gloffset_MultiTexCoord1sARB },
-   { 26001, _gloffset_MultiTexCoord1dvARB },
-   { 26942, _gloffset_MultiTexCoord1ivARB },
-   { 27035, _gloffset_MultiTexCoord2ivARB },
-   { 27374, _gloffset_MultiTexCoord1iARB },
-   { 28738, _gloffset_MultiTexCoord4svARB },
-   { 29312, _gloffset_MultiTexCoord1fARB },
-   { 29575, _gloffset_MultiTexCoord4fARB },
-   { 32039, _gloffset_MultiTexCoord2fvARB },
+   {   464, _gloffset_MultiTexCoord3sARB },
+   {   696, _gloffset_ActiveTextureARB },
+   {  4234, _gloffset_MultiTexCoord1fvARB },
+   {  6142, _gloffset_MultiTexCoord3dARB },
+   {  6187, _gloffset_MultiTexCoord2iARB },
+   {  6311, _gloffset_MultiTexCoord2svARB },
+   {  8311, _gloffset_MultiTexCoord2fARB },
+   { 10350, _gloffset_MultiTexCoord3fvARB },
+   { 10952, _gloffset_MultiTexCoord4sARB },
+   { 11633, _gloffset_MultiTexCoord2dvARB },
+   { 12048, _gloffset_MultiTexCoord1svARB },
+   { 12459, _gloffset_MultiTexCoord3svARB },
+   { 12520, _gloffset_MultiTexCoord4iARB },
+   { 13290, _gloffset_MultiTexCoord3iARB },
+   { 14089, _gloffset_MultiTexCoord1dARB },
+   { 14306, _gloffset_MultiTexCoord3dvARB },
+   { 15585, _gloffset_MultiTexCoord3ivARB },
+   { 15630, _gloffset_MultiTexCoord2sARB },
+   { 17031, _gloffset_MultiTexCoord4ivARB },
+   { 18983, _gloffset_ClientActiveTextureARB },
+   { 21283, _gloffset_MultiTexCoord2dARB },
+   { 21720, _gloffset_MultiTexCoord4dvARB },
+   { 22076, _gloffset_MultiTexCoord4fvARB },
+   { 23026, _gloffset_MultiTexCoord3fARB },
+   { 25567, _gloffset_MultiTexCoord4dARB },
+   { 25833, _gloffset_MultiTexCoord1sARB },
+   { 26037, _gloffset_MultiTexCoord1dvARB },
+   { 27045, _gloffset_MultiTexCoord1ivARB },
+   { 27138, _gloffset_MultiTexCoord2ivARB },
+   { 27477, _gloffset_MultiTexCoord1iARB },
+   { 28893, _gloffset_MultiTexCoord4svARB },
+   { 29467, _gloffset_MultiTexCoord1fARB },
+   { 29730, _gloffset_MultiTexCoord4fARB },
+   { 32155, _gloffset_MultiTexCoord2fvARB },
    {    -1, -1 }
 };
 #endif
index 3d1a8f85923a7f3dad191cc437baa4296843cfc9..23c662bab7fe1b02140b7cf691993cd51cf48895 100644 (file)
@@ -1481,7 +1481,7 @@ _mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
                               GLboolean frontLeft, GLboolean backLeft,
                               GLboolean frontRight, GLboolean backRight)
 {
-   GLuint b;
+   gl_buffer_index b;
 
    if (rgbBits > 16 || alphaBits > 16) {
       _mesa_problem(ctx,
@@ -1545,7 +1545,7 @@ _mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
                               GLboolean frontLeft, GLboolean backLeft,
                               GLboolean frontRight, GLboolean backRight)
 {
-   GLuint b;
+   gl_buffer_index b;
 
    /* for window system framebuffers only! */
    assert(fb->Name == 0);
@@ -1883,10 +1883,11 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
 
 /**
  * Attach a renderbuffer to a framebuffer.
+ * \param bufferName  one of the BUFFER_x tokens
  */
 void
 _mesa_add_renderbuffer(struct gl_framebuffer *fb,
-                       GLuint bufferName, struct gl_renderbuffer *rb)
+                       gl_buffer_index bufferName, struct gl_renderbuffer *rb)
 {
    assert(fb);
    assert(rb);
@@ -1916,9 +1917,11 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb,
 
 /**
  * Remove the named renderbuffer from the given framebuffer.
+ * \param bufferName  one of the BUFFER_x tokens
  */
 void
-_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName)
+_mesa_remove_renderbuffer(struct gl_framebuffer *fb,
+                          gl_buffer_index bufferName)
 {
    struct gl_renderbuffer *rb;
 
index 62e812f93a285f92d3daae1c2789a2d2a201b6b0..4702a8e952a247f9ac25176153b4844f5d648639 100644 (file)
@@ -27,6 +27,7 @@
 #define RENDERBUFFER_H
 
 #include "glheader.h"
+#include "mtypes.h"
 
 struct gl_context;
 struct gl_framebuffer;
@@ -95,10 +96,11 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
 
 extern void
 _mesa_add_renderbuffer(struct gl_framebuffer *fb,
-                       GLuint bufferName, struct gl_renderbuffer *rb);
+                       gl_buffer_index bufferName, struct gl_renderbuffer *rb);
 
 extern void
-_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName);
+_mesa_remove_renderbuffer(struct gl_framebuffer *fb,
+                          gl_buffer_index bufferName);
 
 extern void
 _mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
index 4cf0bc2528c680cba51583f953dd93918b2f0d86..df665994a95395ca70a5d00ccc46be93186e0257 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "main/glheader.h"
 #include "main/context.h"
+#include "main/mtypes.h"
 #include "main/scissor.h"
 
 
index 96df58d35c241b9cb80772264c19fdb748656fe5..2ffd8be0eb40aad83240989d83dc9d4c28022211 100644 (file)
@@ -41,6 +41,8 @@
 #include "main/dispatch.h"
 #include "main/enums.h"
 #include "main/hash.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
 #include "main/shaderapi.h"
 #include "main/shaderobj.h"
 #include "program/program.h"
@@ -48,6 +50,7 @@
 #include "program/prog_uniform.h"
 #include "talloc.h"
 #include <stdbool.h>
+#include "../glsl/glsl_parser_extras.h"
 
 /** Define this to enable shader substitution (see below) */
 #define SHADER_SUBST 0
@@ -1637,8 +1640,7 @@ _mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
 void GLAPIENTRY
 _mesa_ReleaseShaderCompiler(void)
 {
-   GET_CURRENT_CONTEXT(ctx);
-   _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
+   _mesa_destroy_shader_compiler_caches();
 }
 
 
@@ -1881,6 +1883,9 @@ _mesa_init_shader_dispatch(struct _glapi_table *exec)
    SET_BindFragDataLocationEXT(exec, _mesa_BindFragDataLocation);
    SET_GetFragDataLocationEXT(exec, _mesa_GetFragDataLocation);
 
+   /* GL_ARB_ES2_compatibility */
+   SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler);
+
 #endif /* FEATURE_GL */
 }
 
index 216bbce003299a4501b0a259726f3606c2cf4d5e..647fd31cab42fd2a18a184724c4d614ce46a9ca9 100644 (file)
@@ -32,6 +32,8 @@
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/hash.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
 #include "main/shaderobj.h"
 #include "program/program.h"
 #include "program/prog_parameter.h"
index 3abee0178eb861bf38739d730e3d172d9a16e655..ce9fc4de327474b61e8f5f0b8d5e41b02532670f 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #include "imports.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "hash.h"
 #if FEATURE_ATI_fragment_shader
index 2c8bcbeaf7cbc2fcf5850886e851f0254fb2e452..e1a5c6c0f92db0b3ebdcd38b696fed2e3dbf0ade 100644 (file)
 #include "imports.h"
 #include "context.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "get.h"
 #include "dispatch.h"
+#include "mtypes.h"
 
 #if FEATURE_ARB_sync
 #include "syncobj.h"
index e3d2a786b3eb7883614ebc7a6bb3762a2eb9f7d5..7a0b522a2d8ea0873c40187e6961e7cb0628887d 100644 (file)
@@ -34,6 +34,8 @@
 #include "imports.h"
 #include "colormac.h"
 #include "formats.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "texcompress.h"
 
 
index 83856429c54cb987547edf8fde867200e4ffebef..19b08bbadf62ae3d8e9746fae46ec5e06d298fe9 100644 (file)
 #ifndef TEXCOMPRESS_H
 #define TEXCOMPRESS_H
 
-#include "mtypes.h"
 #include "formats.h"
+#include "glheader.h"
+#include "mfeatures.h"
+
+struct gl_context;
 
 #if _HAVE_FULL_GL
 
index 33f46d4c8bbeb46af5f4d4a03c85963fbed4f746..bb7fb567f25e391ad29234cc165224a909788de0 100644 (file)
@@ -34,6 +34,7 @@
 #include "colormac.h"
 #include "image.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "mipmap.h"
 #include "texcompress.h"
 #include "texcompress_fxt1.h"
index 38048b26ccb4fe46c65012ae22347b4d665d707d..b991f4c67ec9d66cda5dedcfa277c41170bec2d8 100644 (file)
@@ -26,6 +26,7 @@
 #define TEXCOMPRESS_FXT1_H
 
 #include "glheader.h"
+#include "mfeatures.h"
 #include "texstore.h"
 
 struct gl_texture_image;
index 0e893a59fa3780619f02d6bac958652422aea821..25257ecc3d36276c0396223082ba6975d2f0894a 100644 (file)
@@ -39,6 +39,8 @@
 #include "dlopen.h"
 #include "image.h"
 #include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "texcompress.h"
 #include "texcompress_s3tc.h"
 #include "texstore.h"
index d0a5b186b719b5a6f7b1d2c564e4a816f5f8ee59..74a0343b9b99032363b867d4636ff88248db397a 100644 (file)
 #ifndef TEXCOMPRESS_S3TC_H
 #define TEXCOMPRESS_S3TC_H
 
-#include "main/mtypes.h"
+#include "compiler.h"
+#include "glheader.h"
+#include "mfeatures.h"
 #include "texstore.h"
 
+struct gl_context;
+struct gl_texture_image;
 
 #if FEATURE_texture_s3tc
 
index 508dbf4887de50ee7750c86324361cd2048ca0f1..194bcbea9831ccc463411221edf9bc8eeeb5f158 100644 (file)
@@ -34,6 +34,7 @@
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/macros.h"
+#include "main/mtypes.h"
 #include "main/texenv.h"
 #include "main/texstate.h"
 
index a8bffe416d9015e877eb2522d11cd0bfb9680874..c1380f2a645547dfc19a403e31fe455004c3b2aa 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "glheader.h"
 #include "imports.h"
+#include "mtypes.h"
 #include "program/program.h"
 #include "program/prog_parameter.h"
 #include "program/prog_cache.h"
@@ -1466,7 +1467,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key,
    p.last_tex_stage = 0;
    release_temps(ctx, &p);
 
-   if (key->enabled_units) {
+   if (key->enabled_units && key->num_draw_buffers) {
       GLboolean needbumpstage = GL_FALSE;
 
       /* Zeroth pass - bump map textures first */
@@ -1559,7 +1560,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key,
    _mesa_copy_instructions(p.program->Base.Instructions, instBuffer,
                            p.program->Base.NumInstructions);
 
-   if (p.program->FogOption) {
+   if (key->num_draw_buffers && p.program->FogOption) {
       _mesa_append_fog_code(ctx, p.program);
       p.program->FogOption = GL_NONE;
    }
index abfb916d21ba0257f7873d3cc718f11df73b5c63..22e30a519439efbb0ebeb1bc61a9531f35fb39da 100644 (file)
@@ -27,7 +27,7 @@
 #define TEXENVPROGRAM_H
 
 
-#include "mtypes.h"
+struct gl_context;
 
 extern struct gl_fragment_program *
 _mesa_get_fixed_func_fragment_program(struct gl_context *ctx);
index 372ef2654a78462b2c11c3c0e6c57f7763c5603b..113512090b269b9523e674f0c6a923399dd80e3f 100644 (file)
@@ -236,6 +236,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
       fetch_texel_3d_f_argb1555_rev,
       store_texel_argb1555_rev
    },
+   {
+      MESA_FORMAT_AL44,
+      fetch_texel_1d_f_al44,
+      fetch_texel_2d_f_al44,
+      fetch_texel_3d_f_al44,
+      store_texel_al44
+   },
    {
       MESA_FORMAT_AL88,
       fetch_texel_1d_f_al88,
@@ -278,6 +285,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
       fetch_texel_3d_f_a8,
       store_texel_a8
    },
+   {
+      MESA_FORMAT_A16,
+      fetch_texel_1d_f_a16,
+      fetch_texel_2d_f_a16,
+      fetch_texel_3d_f_a16,
+      store_texel_a16
+   },
    {
       MESA_FORMAT_L8,
       fetch_texel_1d_f_l8,
@@ -285,6 +299,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
       fetch_texel_3d_f_l8,
       store_texel_l8
    },
+   {
+      MESA_FORMAT_L16,
+      fetch_texel_1d_f_l16,
+      fetch_texel_2d_f_l16,
+      fetch_texel_3d_f_l16,
+      store_texel_l16
+   },
    {
       MESA_FORMAT_I8,
       fetch_texel_1d_f_i8,
@@ -292,6 +313,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
       fetch_texel_3d_f_i8,
       store_texel_i8
    },
+   {
+      MESA_FORMAT_I16,
+      fetch_texel_1d_f_i16,
+      fetch_texel_2d_f_i16,
+      fetch_texel_3d_f_i16,
+      store_texel_i16
+   },
    {
       MESA_FORMAT_CI8,
       fetch_texel_1d_f_ci8,
@@ -355,6 +383,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
       fetch_texel_3d_f_rg1616_rev,
       store_texel_rg1616_rev,
    },
+   {
+      MESA_FORMAT_ARGB2101010,
+      fetch_texel_1d_f_argb2101010,
+      fetch_texel_2d_f_argb2101010,
+      fetch_texel_3d_f_argb2101010,
+      store_texel_argb2101010
+   },
    {
       MESA_FORMAT_Z24_S8,
       fetch_texel_1d_f_z24_s8,
@@ -724,7 +759,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
 };
 
 
-static FetchTexelFuncF
+FetchTexelFuncF
 _mesa_get_texel_fetch_func(gl_format format, GLuint dims)
 {
 #ifdef DEBUG
index ef13bf27fec72cc8a113e3103128ab941fe10411..e78079ae5ab3e88d144a35f000f69feaaa34e379 100644 (file)
@@ -34,6 +34,9 @@
 extern StoreTexelFunc
 _mesa_get_texel_store_func(gl_format format);
 
+extern FetchTexelFuncF
+_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
+
 extern void
 _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
 
index 2f583ed52230c71033e147d2df1bc823e390f76a..36dede57f002eb8a005f4a78258791583a83c915 100644 (file)
@@ -135,7 +135,7 @@ static void store_texel_rgba_f32(struct gl_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *depth = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
    dst[0] = depth[RCOMP];
    dst[1] = depth[GCOMP];
    dst[2] = depth[BCOMP];
@@ -163,9 +163,12 @@ static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
 static void store_texel_rgba_f16(struct gl_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(*depth);
+   const GLfloat *src = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
+   dst[0] = _mesa_float_to_half(src[RCOMP]);
+   dst[1] = _mesa_float_to_half(src[GCOMP]);
+   dst[2] = _mesa_float_to_half(src[BCOMP]);
+   dst[3] = _mesa_float_to_half(src[ACOMP]);
 }
 #endif
 
@@ -188,9 +191,11 @@ static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
 static void store_texel_rgb_f32(struct gl_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = *depth;
+   const GLfloat *src = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
+   dst[0] = src[RCOMP];
+   dst[1] = src[GCOMP];
+   dst[2] = src[BCOMP];
 }
 #endif
 
@@ -214,9 +219,11 @@ static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
 static void store_texel_rgb_f16(struct gl_texture_image *texImage,
                                 GLint i, GLint j, GLint k, const void *texel)
 {
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(*depth);
+   const GLfloat *src = (const GLfloat *) texel;
+   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
+   dst[0] = _mesa_float_to_half(src[RCOMP]);
+   dst[1] = _mesa_float_to_half(src[GCOMP]);
+   dst[2] = _mesa_float_to_half(src[BCOMP]);
 }
 #endif
 
@@ -810,6 +817,31 @@ static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
 #endif
 
 
+/* MESA_FORMAT_ARGB2101010 ***************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */
+static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage,
+                                  GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   const GLuint s = *src;
+   texel[RCOMP] = ((s >> 20) & 0x3ff) * (1.0F / 1023.0F);
+   texel[GCOMP] = ((s >> 10) & 0x3ff) * (1.0F / 1023.0F);
+   texel[BCOMP] = ((s >>  0) & 0x3ff) * (1.0F / 1023.0F);
+   texel[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F);
+}
+
+#if DIM == 3
+static void store_texel_argb2101010(struct gl_texture_image *texImage,
+                                    GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_2101010_UB(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+}
+#endif
+
+
 /* MESA_FORMAT_RG88 **********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
@@ -858,6 +890,30 @@ static void store_texel_rg88_rev(struct gl_texture_image *texImage,
 #endif
 
 
+/* MESA_FORMAT_AL44 **********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D al44 texture, return 4 GLchans */
+static void FETCH(f_al44)( const struct gl_texture_image *texImage,
+                           GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = (s & 0xf) * (1.0F / 15.0F);
+   texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
+}
+
+#if DIM == 3
+static void store_texel_al44(struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_44(rgba[ACOMP], rgba[RCOMP]);
+}
+#endif
+
+
 /* MESA_FORMAT_AL88 **********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
@@ -1099,6 +1155,30 @@ static void store_texel_a8(struct gl_texture_image *texImage,
 #endif
 
 
+/* MESA_FORMAT_A16 ************************************************************/
+
+/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
+static void FETCH(f_a16)( const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = 0.0F;
+   texel[ACOMP] = USHORT_TO_FLOAT( src[0] );
+}
+
+#if DIM == 3
+static void store_texel_a16(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLushort *rgba = (const GLushort *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = rgba[ACOMP];
+}
+#endif
+
+
 /* MESA_FORMAT_L8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
@@ -1123,6 +1203,30 @@ static void store_texel_l8(struct gl_texture_image *texImage,
 #endif
 
 
+/* MESA_FORMAT_L16 ***********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */
+static void FETCH(f_l16)( const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = USHORT_TO_FLOAT( src[0] );
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_l16(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLushort *rgba = (const GLushort *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = rgba[RCOMP];
+}
+#endif
+
+
 /* MESA_FORMAT_I8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
@@ -1147,6 +1251,30 @@ static void store_texel_i8(struct gl_texture_image *texImage,
 #endif
 
 
+/* MESA_FORMAT_I16 ***********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */
+static void FETCH(f_i16)( const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] =
+   texel[ACOMP] = USHORT_TO_FLOAT( src[0] );
+}
+
+#if DIM == 3
+static void store_texel_i16(struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLushort *rgba = (const GLushort *) texel;
+   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+   *dst = rgba[RCOMP];
+}
+#endif
+
+
 /* MESA_FORMAT_CI8 ***********************************************************/
 
 /* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
index 894c0130b4774902049d5325af48d58b4f98d9be..146b2b340e7102e3537b02632c2ea6d83e4fff7c 100644 (file)
 
 
 #include "context.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "texcompress.h"
 #include "texformat.h"
 
+#define RETURN_IF_SUPPORTED(f) do {            \
+   if (ctx->TextureFormatSupported[f])         \
+      return f;                                        \
+} while (0)
 
 /**
  * Choose an appropriate texture format given the format, type and
@@ -64,75 +70,132 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       /* shallow RGBA formats */
       case 4:
       case GL_RGBA:
+        if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
+           RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+        } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
+           RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
+        }
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
+
       case GL_RGBA8:
-         return MESA_FORMAT_RGBA8888;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
       case GL_RGB5_A1:
-         return MESA_FORMAT_ARGB1555;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
+        break;
       case GL_RGBA2:
-         return MESA_FORMAT_ARGB4444_REV; /* just to test another format*/
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444_REV); /* just to test another format*/
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+        break;
       case GL_RGBA4:
-         return MESA_FORMAT_ARGB4444;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+        break;
 
       /* deep RGBA formats */
       case GL_RGB10_A2:
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
       case GL_RGBA12:
       case GL_RGBA16:
-         return MESA_FORMAT_RGBA_16;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
 
       /* shallow RGB formats */
       case 3:
       case GL_RGB:
       case GL_RGB8:
-         return MESA_FORMAT_RGB888;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
       case GL_R3_G3_B2:
-         return MESA_FORMAT_RGB332;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
       case GL_RGB4:
-         return MESA_FORMAT_RGB565_REV; /* just to test another format */
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); /* just to test another format */
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
+        break;
       case GL_RGB5:
-         return MESA_FORMAT_RGB565;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
+        break;
 
       /* deep RGB formats */
       case GL_RGB10:
       case GL_RGB12:
       case GL_RGB16:
-         return MESA_FORMAT_RGBA_16;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
 
       /* Alpha formats */
       case GL_ALPHA:
       case GL_ALPHA4:
+      case GL_ALPHA8:
+        RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+        break;
+
       case GL_ALPHA12:
       case GL_ALPHA16:
-      case GL_ALPHA8:
-         return MESA_FORMAT_A8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_A16);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+        break;
 
       /* Luminance formats */
       case 1:
       case GL_LUMINANCE:
       case GL_LUMINANCE4:
+      case GL_LUMINANCE8:
+        RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+        break;
+
       case GL_LUMINANCE12:
       case GL_LUMINANCE16:
-      case GL_LUMINANCE8:
-         return MESA_FORMAT_L8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_L16);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+        break;
 
       /* Luminance/Alpha formats */
+      case GL_LUMINANCE4_ALPHA4:
+        RETURN_IF_SUPPORTED(MESA_FORMAT_AL44);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+        break;
+
       case 2:
       case GL_LUMINANCE_ALPHA:
-      case GL_LUMINANCE4_ALPHA4:
       case GL_LUMINANCE6_ALPHA2:
       case GL_LUMINANCE8_ALPHA8:
-         return MESA_FORMAT_AL88;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+        break;
 
       case GL_LUMINANCE12_ALPHA4:
       case GL_LUMINANCE12_ALPHA12:
       case GL_LUMINANCE16_ALPHA16:
-         return MESA_FORMAT_AL1616;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_AL1616);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+        break;
 
       case GL_INTENSITY:
       case GL_INTENSITY4:
+      case GL_INTENSITY8:
+        RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+        break;
+
       case GL_INTENSITY12:
       case GL_INTENSITY16:
-      case GL_INTENSITY8:
-         return MESA_FORMAT_I8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_I16);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+        break;
 
       case GL_COLOR_INDEX:
       case GL_COLOR_INDEX1_EXT:
@@ -141,7 +204,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       case GL_COLOR_INDEX12_EXT:
       case GL_COLOR_INDEX16_EXT:
       case GL_COLOR_INDEX8_EXT:
-         return MESA_FORMAT_CI8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_CI8);
+        break;
 
       default:
          ; /* fallthrough */
@@ -152,9 +216,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
          case GL_DEPTH_COMPONENT:
          case GL_DEPTH_COMPONENT24:
          case GL_DEPTH_COMPONENT32:
-            return MESA_FORMAT_Z32;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_Z32);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
+           break;
          case GL_DEPTH_COMPONENT16:
-            return MESA_FORMAT_Z16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_Z16);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
          default:
             ; /* fallthrough */
       }
@@ -162,27 +229,36 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
 
    switch (internalFormat) {
       case GL_COMPRESSED_ALPHA_ARB:
-         return MESA_FORMAT_A8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+        break;
       case GL_COMPRESSED_LUMINANCE_ARB:
-         return MESA_FORMAT_L8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+        break;
       case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
-         return MESA_FORMAT_AL88;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+        break;
       case GL_COMPRESSED_INTENSITY_ARB:
-         return MESA_FORMAT_I8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+        break;
       case GL_COMPRESSED_RGB_ARB:
          if (ctx->Extensions.EXT_texture_compression_s3tc ||
              ctx->Extensions.S3_s3tc)
-            return MESA_FORMAT_RGB_DXT1;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
          if (ctx->Extensions.TDFX_texture_compression_FXT1)
-            return MESA_FORMAT_RGB_FXT1;
-         return MESA_FORMAT_RGB888;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
       case GL_COMPRESSED_RGBA_ARB:
          if (ctx->Extensions.EXT_texture_compression_s3tc ||
              ctx->Extensions.S3_s3tc)
-            return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
          if (ctx->Extensions.TDFX_texture_compression_FXT1)
-            return MESA_FORMAT_RGBA_FXT1;
-         return MESA_FORMAT_RGBA8888;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+        RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+        break;
       default:
          ; /* fallthrough */
    }
@@ -190,9 +266,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
    if (ctx->Extensions.MESA_ycbcr_texture) {
       if (internalFormat == GL_YCBCR_MESA) {
          if (type == GL_UNSIGNED_SHORT_8_8_MESA)
-            return MESA_FORMAT_YCBCR;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR);
          else
-            return MESA_FORMAT_YCBCR_REV;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV);
       }
    }
 
@@ -200,9 +276,11 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
    if (ctx->Extensions.TDFX_texture_compression_FXT1) {
       switch (internalFormat) {
          case GL_COMPRESSED_RGB_FXT1_3DFX:
-            return MESA_FORMAT_RGB_FXT1;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+        break;
          case GL_COMPRESSED_RGBA_FXT1_3DFX:
-            return MESA_FORMAT_RGBA_FXT1;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+        break;
          default:
             ; /* fallthrough */
       }
@@ -213,13 +291,17 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
    if (ctx->Extensions.EXT_texture_compression_s3tc) {
       switch (internalFormat) {
          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-            return MESA_FORMAT_RGB_DXT1;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+           break;
          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-            return MESA_FORMAT_RGBA_DXT1;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT1);
+           break;
          case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-            return MESA_FORMAT_RGBA_DXT3;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
+           break;
          case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-            return MESA_FORMAT_RGBA_DXT5;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT5);
+           break;
          default:
             ; /* fallthrough */
       }
@@ -229,10 +311,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_RGB_S3TC:
          case GL_RGB4_S3TC:
-            return MESA_FORMAT_RGB_DXT1;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+           break;
          case GL_RGBA_S3TC:
          case GL_RGBA4_S3TC:
-            return MESA_FORMAT_RGBA_DXT3;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
+           break;
          default:
             ; /* fallthrough */
       }
@@ -242,29 +326,41 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
    if (ctx->Extensions.ARB_texture_float) {
       switch (internalFormat) {
          case GL_ALPHA16F_ARB:
-            return MESA_FORMAT_ALPHA_FLOAT16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
+           break;
          case GL_ALPHA32F_ARB:
-            return MESA_FORMAT_ALPHA_FLOAT32;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
+           break;
          case GL_LUMINANCE16F_ARB:
-            return MESA_FORMAT_LUMINANCE_FLOAT16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
+           break;
          case GL_LUMINANCE32F_ARB:
-            return MESA_FORMAT_LUMINANCE_FLOAT32;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
+           break;
          case GL_LUMINANCE_ALPHA16F_ARB:
-            return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
+           break;
          case GL_LUMINANCE_ALPHA32F_ARB:
-            return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
+           break;
          case GL_INTENSITY16F_ARB:
-            return MESA_FORMAT_INTENSITY_FLOAT16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
+           break;
          case GL_INTENSITY32F_ARB:
-            return MESA_FORMAT_INTENSITY_FLOAT32;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
+           break;
          case GL_RGB16F_ARB:
-            return MESA_FORMAT_RGB_FLOAT16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
+           break;
          case GL_RGB32F_ARB:
-            return MESA_FORMAT_RGB_FLOAT32;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
+           break;
          case GL_RGBA16F_ARB:
-            return MESA_FORMAT_RGBA_FLOAT16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
+           break;
          case GL_RGBA32F_ARB:
-            return MESA_FORMAT_RGBA_FLOAT32;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+           break;
          default:
             ; /* fallthrough */
       }
@@ -274,7 +370,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_DEPTH_STENCIL_EXT:
          case GL_DEPTH24_STENCIL8_EXT:
-            return MESA_FORMAT_Z24_S8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_S8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
+           break;
          default:
             ; /* fallthrough */
       }
@@ -284,7 +382,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_DUDV_ATI:
          case GL_DU8DV8_ATI:
-            return MESA_FORMAT_DUDV8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_DUDV8);
+           break;
          default:
             ; /* fallthrough */
       }
@@ -294,7 +393,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_RGBA_SNORM:
          case GL_RGBA8_SNORM:
-            return MESA_FORMAT_SIGNED_RGBA8888;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+           break;
          default:
             ; /* fallthrough */
       }
@@ -304,24 +405,32 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_RED_SNORM:
          case GL_R8_SNORM:
-            return MESA_FORMAT_SIGNED_R8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R8);
+           break;
          case GL_RG_SNORM:
          case GL_RG8_SNORM:
-            return MESA_FORMAT_SIGNED_RG88;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88);
+           break;
          case GL_RGB_SNORM:
          case GL_RGB8_SNORM:
-            return MESA_FORMAT_SIGNED_RGBX8888;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);
+           break;
          case GL_RGBA_SNORM:
          case GL_RGBA8_SNORM:
-            return MESA_FORMAT_SIGNED_RGBA8888;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+           break;
          case GL_R16_SNORM:
-            return MESA_FORMAT_SIGNED_R_16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R_16);
+           break;
          case GL_RG16_SNORM:
-            return MESA_FORMAT_SIGNED_RG_16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG_16);
+           break;
          case GL_RGB16_SNORM:
-            return MESA_FORMAT_SIGNED_RGB_16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16);
+           break;
          case GL_RGBA16_SNORM:
-            return MESA_FORMAT_SIGNED_RGBA_16;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
+           break;
          default:
             ; /* fall-through */
       }
@@ -332,48 +441,68 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       switch (internalFormat) {
          case GL_SRGB_EXT:
          case GL_SRGB8_EXT:
-            return MESA_FORMAT_SRGB8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
          case GL_SRGB_ALPHA_EXT:
          case GL_SRGB8_ALPHA8_EXT:
-            return MESA_FORMAT_SRGBA8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
          case GL_SLUMINANCE_EXT:
          case GL_SLUMINANCE8_EXT:
-            return MESA_FORMAT_SL8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
          case GL_SLUMINANCE_ALPHA_EXT:
          case GL_SLUMINANCE8_ALPHA8_EXT:
-            return MESA_FORMAT_SLA8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
          case GL_COMPRESSED_SLUMINANCE_EXT:
-            return MESA_FORMAT_SL8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
          case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
-            return MESA_FORMAT_SLA8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
          case GL_COMPRESSED_SRGB_EXT:
 #if FEATURE_texture_s3tc
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return MESA_FORMAT_SRGB_DXT1;
+              RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
 #endif
-            return MESA_FORMAT_SRGB8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
          case GL_COMPRESSED_SRGB_ALPHA_EXT:
 #if FEATURE_texture_s3tc
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return MESA_FORMAT_SRGBA_DXT3; /* Not srgba_dxt1, see spec */
+              RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
 #endif
-            return MESA_FORMAT_SRGBA8;
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+           break;
 #if FEATURE_texture_s3tc
          case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return MESA_FORMAT_SRGB_DXT1;
+              RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return MESA_FORMAT_SRGBA_DXT1;
+              RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT1);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return MESA_FORMAT_SRGBA_DXT3;
+              RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
             if (ctx->Extensions.EXT_texture_compression_s3tc)
-               return MESA_FORMAT_SRGBA_DXT5;
+              RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5);
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
 #endif
          default:
@@ -390,42 +519,48 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       case GL_INTENSITY32UI_EXT:
       case GL_LUMINANCE32UI_EXT:
       case GL_LUMINANCE_ALPHA32UI_EXT:
-         return MESA_FORMAT_RGBA_UINT32;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+        break;
       case GL_RGBA16UI_EXT:
       case GL_RGB16UI_EXT:
       case GL_ALPHA16UI_EXT:
       case GL_INTENSITY16UI_EXT:
       case GL_LUMINANCE16UI_EXT:
       case GL_LUMINANCE_ALPHA16UI_EXT:
-         return MESA_FORMAT_RGBA_UINT16;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+        break;
       case GL_RGBA8UI_EXT:
       case GL_RGB8UI_EXT:
       case GL_ALPHA8UI_EXT:
       case GL_INTENSITY8UI_EXT:
       case GL_LUMINANCE8UI_EXT:
       case GL_LUMINANCE_ALPHA8UI_EXT:
-         return MESA_FORMAT_RGBA_UINT8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+        break;
       case GL_RGBA32I_EXT:
       case GL_RGB32I_EXT:
       case GL_ALPHA32I_EXT:
       case GL_INTENSITY32I_EXT:
       case GL_LUMINANCE32I_EXT:
       case GL_LUMINANCE_ALPHA32I_EXT:
-         return MESA_FORMAT_RGBA_INT32;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+        break;
       case GL_RGBA16I_EXT:
       case GL_RGB16I_EXT:
       case GL_ALPHA16I_EXT:
       case GL_INTENSITY16I_EXT:
       case GL_LUMINANCE16I_EXT:
       case GL_LUMINANCE_ALPHA16I_EXT:
-         return MESA_FORMAT_RGBA_INT16;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+        break;
       case GL_RGBA8I_EXT:
       case GL_RGB8I_EXT:
       case GL_ALPHA8I_EXT:
       case GL_INTENSITY8I_EXT:
       case GL_LUMINANCE8I_EXT:
       case GL_LUMINANCE_ALPHA8I_EXT:
-         return MESA_FORMAT_RGBA_INT8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+        break;
       }
    }
 
@@ -434,18 +569,22 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       case GL_R8:
       case GL_RED:
       case GL_COMPRESSED_RED:
-        return MESA_FORMAT_R8;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
+        break;
 
       case GL_R16:
-         return MESA_FORMAT_R16;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_R16);
+        break;
 
       case GL_RG:
       case GL_RG8:
       case GL_COMPRESSED_RG:
-        return MESA_FORMAT_RG88;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
+        break;
 
       case GL_RG16:
-        return MESA_FORMAT_RG1616;
+        RETURN_IF_SUPPORTED(MESA_FORMAT_RG1616);
+        break;
 
       default:
          ; /* fallthrough */
index 8bd1507675343755d94d134d31c6f9ebb8a1e96e..3cf09213ac49725435754599e94c6e4d9b283469 100644 (file)
@@ -27,9 +27,9 @@
 #define TEXFORMAT_H
 
 
-#include "mtypes.h"
 #include "formats.h"
 
+struct gl_context;
 
 extern gl_format
 _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
index 108ea4cd42c85bb6d562123a6c5bf751c7bf1b8f..0ace0b9364d5f2a7c0e2b9f233d791e42db62b82 100644 (file)
@@ -34,6 +34,7 @@
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/texgen.h"
 #include "main/texstate.h"
 #include "math/m_matrix.h"
index 9ed80238363bd4d48dc022e05039fe0b1303b56b..336ffce924507de4ebde7068c1df1e4c4f443dd0 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "compiler.h"
 #include "glheader.h"
+#include "mfeatures.h"
 
 struct _glapi_table;
 
index 879ac529a01cd52faaa42d1f3bbcad3ed7bf3fd1..da610798e1232822da5eb0d6e7416731bc68197e 100644 (file)
@@ -35,6 +35,8 @@
 #include "context.h"
 #include "formats.h"
 #include "image.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "pack.h"
 #include "texgetimage.h"
 #include "teximage.h"
@@ -120,10 +122,15 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
    const GLint height = texImage->Height;
    const GLint depth = texImage->Depth;
    GLint img, row, col;
+   GLfloat *depthRow = (GLfloat *) malloc(width * sizeof(GLfloat));
+
+   if (!depthRow) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+      return;
+   }
 
    for (img = 0; img < depth; img++) {
       for (row = 0; row < height; row++) {
-         GLfloat depthRow[MAX_WIDTH];
          void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
                                           width, height, format, type,
                                           img, row, 0);
@@ -135,6 +142,8 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
          _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack);
       }
    }
+
+   free(depthRow);
 }
 
 
@@ -244,6 +253,12 @@ get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
    const GLint depth = texImage->Depth;
    const GLbitfield transferOps = 0x0;
    GLint img, row;
+   GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+
+   if (!rgba) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+      return;
+   }
 
    for (img = 0; img < depth; img++) {
       for (row = 0; row < height; row++) {
@@ -251,7 +266,6 @@ get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
                                           width, height, format, type,
                                           img, row, 0);
 
-         GLfloat rgba[MAX_WIDTH][4];
          GLint col;
 
          /* convert row to RGBA format */
@@ -279,6 +293,8 @@ get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
                                     &ctx->Pack, transferOps);
       }
    }
+
+   free(rgba);
 }
 
 
@@ -314,13 +330,18 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
     */
    GLbitfield transferOps = 0x0;
    GLint img, row;
+   GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+
+   if (!rgba) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage");
+      return;
+   }
 
    for (img = 0; img < depth; img++) {
       for (row = 0; row < height; row++) {
          void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
                                           width, height, format, type,
                                           img, row, 0);
-         GLfloat rgba[MAX_WIDTH][4];
          GLint col;
          GLenum dataType = _mesa_get_format_datatype(texImage->TexFormat);
 
@@ -364,6 +385,8 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
                                     &ctx->Pack, transferOps);
       }
    }
+
+   free(rgba);
 }
 
 
@@ -411,11 +434,21 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixel
                type == GL_UNSIGNED_BYTE) {
          memCopy = GL_TRUE;
       }
+      else if (texImage->TexFormat == MESA_FORMAT_L16 &&
+               format == GL_LUMINANCE &&
+               type == GL_UNSIGNED_SHORT) {
+         memCopy = GL_TRUE;
+      }
       else if (texImage->TexFormat == MESA_FORMAT_A8 &&
                format == GL_ALPHA &&
                type == GL_UNSIGNED_BYTE) {
          memCopy = GL_TRUE;
       }
+      else if (texImage->TexFormat == MESA_FORMAT_A16 &&
+               format == GL_ALPHA &&
+               type == GL_UNSIGNED_SHORT) {
+         memCopy = GL_TRUE;
+      }
    }
 
    if (memCopy) {
index 81a3bbbd9a77471bf7e7cbf5057af5fd2e98c73d..ef420ddabf5fbcca55cc3e92c7a28a74467878b2 100644 (file)
 #ifndef TEXGETIMAGE_H
 #define TEXGETIMAGE_H
 
-#include "mtypes.h"
+#include "glheader.h"
+
+struct gl_context;
+struct gl_texture_image;
+struct gl_texture_object;
 
 extern void
 _mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
index 060f34b7f9766ca89fbd5389185d3c9a12231b5c..47d509396a788857a4e2a4d3416b4053cb4229fb 100644 (file)
@@ -40,6 +40,7 @@
 #include "image.h"
 #include "imports.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "state.h"
 #include "texcompress.h"
 #include "texfetch.h"
@@ -340,11 +341,11 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
          return GL_RGBA;
       case GL_SLUMINANCE_ALPHA_EXT:
       case GL_SLUMINANCE8_ALPHA8_EXT:
-      case GL_COMPRESSED_SLUMINANCE_EXT:
       case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
          return GL_LUMINANCE_ALPHA;
       case GL_SLUMINANCE_EXT:
       case GL_SLUMINANCE8_EXT:
+      case GL_COMPRESSED_SLUMINANCE_EXT:
          return GL_LUMINANCE;
       default:
          ; /* fallthrough */
@@ -635,6 +636,47 @@ _mesa_is_proxy_texture(GLenum target)
 }
 
 
+/**
+ * Return the proxy target which corresponds to the given texture target
+ */
+static GLenum
+get_proxy_target(GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_1D:
+   case GL_PROXY_TEXTURE_1D:
+      return GL_PROXY_TEXTURE_1D;
+   case GL_TEXTURE_2D:
+   case GL_PROXY_TEXTURE_2D:
+      return GL_PROXY_TEXTURE_2D;
+   case GL_TEXTURE_3D:
+   case GL_PROXY_TEXTURE_3D:
+      return GL_PROXY_TEXTURE_3D;
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+   case GL_TEXTURE_CUBE_MAP_ARB:
+   case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+      return GL_PROXY_TEXTURE_CUBE_MAP_ARB;
+   case GL_TEXTURE_RECTANGLE_NV:
+   case GL_PROXY_TEXTURE_RECTANGLE_NV:
+      return GL_PROXY_TEXTURE_RECTANGLE_NV;
+   case GL_TEXTURE_1D_ARRAY_EXT:
+   case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+      return GL_PROXY_TEXTURE_1D_ARRAY_EXT;
+   case GL_TEXTURE_2D_ARRAY_EXT:
+   case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+      return GL_PROXY_TEXTURE_2D_ARRAY_EXT;
+   default:
+      _mesa_problem(NULL, "unexpected target in get_proxy_target()");
+      return 0;
+   }
+}
+
+
 /**
  * Get the texture object that corresponds to the target of the given
  * texture unit.
@@ -890,8 +932,8 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
 /**
  * Return number of dimensions per mipmap level for the given texture target.
  */
-static GLint
-get_texture_dimensions(GLenum target)
+GLint
+_mesa_get_texture_dimensions(GLenum target)
 {
    switch (target) {
    case GL_TEXTURE_1D:
@@ -1116,7 +1158,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
 
    img->TexFormat = format;
 
-   dims = get_texture_dimensions(target);
+   dims = _mesa_get_texture_dimensions(target);
 
    _mesa_set_fetch_functions(img, dims);
 }
@@ -1178,94 +1220,110 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
    switch (target) {
    case GL_PROXY_TEXTURE_1D:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           width >0 && !_mesa_is_pow_two(width - 2 * border)) ||
-          level >= ctx->Const.MaxTextureLevels) {
-         /* bad width or level */
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
          return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
       }
       return GL_TRUE;
+
    case GL_PROXY_TEXTURE_2D:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           width > 0 && !_mesa_is_pow_two(width - 2 * border)) ||
-          height < 2 * border || height > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           height > 0 && !_mesa_is_pow_two(height - 2 * border)) ||
-          level >= ctx->Const.MaxTextureLevels) {
-         /* bad width or height or level */
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 2 * border || height > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
          return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
       }
       return GL_TRUE;
+
    case GL_PROXY_TEXTURE_3D:
       maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           width > 0 && !_mesa_is_pow_two(width - 2 * border)) ||
-          height < 2 * border || height > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           height > 0 && !_mesa_is_pow_two(height - 2 * border)) ||
-          depth < 2 * border || depth > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           depth > 0 && !_mesa_is_pow_two(depth - 2 * border)) ||
-          level >= ctx->Const.Max3DTextureLevels) {
-         /* bad width or height or depth or level */
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 2 * border || height > 2 + maxSize)
+         return GL_FALSE;
+      if (depth < 2 * border || depth > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.Max3DTextureLevels)
          return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
+         if (depth > 0 && !_mesa_is_pow_two(depth - 2 * border))
+            return GL_FALSE;
       }
       return GL_TRUE;
+
    case GL_PROXY_TEXTURE_RECTANGLE_NV:
-      if (width < 0 || width > ctx->Const.MaxTextureRectSize ||
-          height < 0 || height > ctx->Const.MaxTextureRectSize ||
-          level != 0) {
-         /* bad width or height or level */
+      maxSize = ctx->Const.MaxTextureRectSize;
+      if (width < 0 || width > maxSize)
+         return GL_FALSE;
+      if (height < 0 || height > maxSize)
+         return GL_FALSE;
+      if (level != 0)
          return GL_FALSE;
-      }
       return GL_TRUE;
+
    case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
       maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           width > 0 && !_mesa_is_pow_two(width - 2 * border)) ||
-          height < 2 * border || height > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           height > 0 && !_mesa_is_pow_two(height - 2 * border)) ||
-          level >= ctx->Const.MaxCubeTextureLevels) {
-         /* bad width or height */
+      if (width < 2 * border || width > 2 + maxSize)
+         return GL_FALSE;
+      if (height < 2 * border || height > 2 + maxSize)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxCubeTextureLevels)
          return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
       }
       return GL_TRUE;
+
    case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           width > 0 && !_mesa_is_pow_two(width - 2 * border)) ||
-          level >= ctx->Const.MaxTextureLevels) {
-         /* bad width or level */
+      if (width < 2 * border || width > 2 + maxSize)
          return GL_FALSE;
-      }
-
-      if (height < 1 || height > ctx->Const.MaxArrayTextureLayers) {
+      if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
          return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
       }
       return GL_TRUE;
+
    case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           width > 0 && !_mesa_is_pow_two(width - 2 * border)) ||
-          height < 2 * border || height > 2 + maxSize ||
-          (!ctx->Extensions.ARB_texture_non_power_of_two &&
-           height > 0 && !_mesa_is_pow_two(height - 2 * border)) ||
-          level >= ctx->Const.MaxTextureLevels) {
-         /* bad width or height or level */
+      if (width < 2 * border || width > 2 + maxSize)
          return GL_FALSE;
-      }
-      if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers) {
+      if (height < 2 * border || height > 2 + maxSize)
          return GL_FALSE;
+      if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
+         return GL_FALSE;
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
+      if (!ctx->Extensions.ARB_texture_non_power_of_two) {
+         if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
+            return GL_FALSE;
+         if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
+            return GL_FALSE;
       }
       return GL_TRUE;
+
    default:
       _mesa_problem(ctx, "Invalid target in _mesa_test_proxy_teximage");
       return GL_FALSE;
@@ -1274,15 +1332,37 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 
 
 /**
- * Helper function to determine whether a target supports compressed textures
+ * Check if the memory used by the texture would exceed the driver's limit.
+ * This lets us support a max 3D texture size of 8K (for example) but
+ * prevents allocating a full 8K x 8K x 8K texture.
+ * XXX this could be rolled into the proxy texture size test (above) but
+ * we don't have the actual texture internal format at that point.
  */
 static GLboolean
-target_can_be_compressed(struct gl_context *ctx, GLenum target)
+legal_texture_size(struct gl_context *ctx, gl_format format,
+                   GLint width, GLint height, GLint depth)
 {
+   uint64_t bytes = _mesa_format_image_size64(format, width, height, depth);
+   uint64_t mbytes = bytes / (1024 * 1024); /* convert to MB */
+   return mbytes <= (uint64_t) ctx->Const.MaxTextureMbytes;
+}
+
+
+
+/**
+ * Helper function to determine whether a target and specific compression
+ * format are supported.
+ */
+static GLboolean
+target_can_be_compressed(const struct gl_context *ctx, GLenum target,
+                         GLenum intFormat)
+{
+   (void) intFormat;  /* not used yet */
+
    switch (target) {
    case GL_TEXTURE_2D:
    case GL_PROXY_TEXTURE_2D:
-      return GL_TRUE;
+      return GL_TRUE; /* true for any compressed format so far */
    case GL_PROXY_TEXTURE_CUBE_MAP:
    case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
@@ -1300,6 +1380,109 @@ target_can_be_compressed(struct gl_context *ctx, GLenum target)
 }
 
 
+/**
+ * Check if the given texture target value is legal for a
+ * glTexImage1/2/3D call.
+ */
+static GLboolean
+legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
+{
+   switch (dims) {
+   case 1:
+      switch (target) {
+      case GL_TEXTURE_1D:
+      case GL_PROXY_TEXTURE_1D:
+         return GL_TRUE;
+      default:
+         return GL_FALSE;
+      }
+   case 2:
+      switch (target) {
+      case GL_TEXTURE_2D:
+      case GL_PROXY_TEXTURE_2D:
+         return GL_TRUE;
+      case GL_PROXY_TEXTURE_CUBE_MAP:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+         return ctx->Extensions.ARB_texture_cube_map;
+      case GL_TEXTURE_RECTANGLE_NV:
+      case GL_PROXY_TEXTURE_RECTANGLE_NV:
+         return ctx->Extensions.NV_texture_rectangle;
+      case GL_TEXTURE_1D_ARRAY_EXT:
+      case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+         return ctx->Extensions.MESA_texture_array;
+      default:
+         return GL_FALSE;
+      }
+   case 3:
+      switch (target) {
+      case GL_TEXTURE_3D:
+      case GL_PROXY_TEXTURE_3D:
+         return GL_TRUE;
+      case GL_TEXTURE_2D_ARRAY_EXT:
+      case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+         return ctx->Extensions.MESA_texture_array;
+      default:
+         return GL_FALSE;
+      }
+   default:
+      _mesa_problem(ctx, "invalid dims=%u in legal_teximage_target()", dims);
+      return GL_FALSE;
+   }
+}
+
+
+/**
+ * Check if the given texture target value is legal for a
+ * glTexSubImage, glCopyTexSubImage or glCopyTexImage call.
+ * The difference compared to legal_teximage_target() above is that
+ * proxy targets are not supported.
+ */
+static GLboolean
+legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
+{
+   switch (dims) {
+   case 1:
+      return target == GL_TEXTURE_1D;
+   case 2:
+      switch (target) {
+      case GL_TEXTURE_2D:
+         return GL_TRUE;
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+         return ctx->Extensions.ARB_texture_cube_map;
+      case GL_TEXTURE_RECTANGLE_NV:
+         return ctx->Extensions.NV_texture_rectangle;
+      case GL_TEXTURE_1D_ARRAY_EXT:
+         return ctx->Extensions.MESA_texture_array;
+      default:
+         return GL_FALSE;
+      }
+   case 3:
+      switch (target) {
+      case GL_TEXTURE_3D:
+         return GL_TRUE;
+      case GL_TEXTURE_2D_ARRAY_EXT:
+         return ctx->Extensions.MESA_texture_array;
+      default:
+         return GL_FALSE;
+      }
+   default:
+      _mesa_problem(ctx, "invalid dims=%u in legal_texsubimage_target()",
+                    dims);
+      return GL_FALSE;
+   }
+}
+
+
 /**
  * Test the glTexImage[123]D() parameters for errors.
  * 
@@ -1329,10 +1512,10 @@ texture_error_check( struct gl_context *ctx,
                      GLint width, GLint height,
                      GLint depth, GLint border )
 {
-   const GLboolean isProxy = _mesa_is_proxy_texture(target);
+   const GLenum proxyTarget = get_proxy_target(target);
+   const GLboolean isProxy = target == proxyTarget;
    GLboolean sizeOK = GL_TRUE;
    GLboolean colorFormat, indexFormat;
-   GLenum proxy_target;
 
    /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
    if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
@@ -1362,71 +1545,16 @@ texture_error_check( struct gl_context *ctx,
       return GL_TRUE;
    }
 
-   /* Check target and call ctx->Driver.TestProxyTexImage() to check the
-    * level, width, height and depth.
-    */
-   if (dimensions == 1) {
-      if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) {
-         proxy_target = GL_PROXY_TEXTURE_1D;
-         height = 1;
-         depth = 1;
-      }
-      else {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else if (dimensions == 2) {
-      depth = 1;
-      if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) {
-         proxy_target = GL_PROXY_TEXTURE_2D;
-      }
-      else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
-               (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-                target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
-         if (!ctx->Extensions.ARB_texture_cube_map) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
-            return GL_TRUE;
-         }
-         proxy_target = GL_PROXY_TEXTURE_CUBE_MAP_ARB;
-         sizeOK = (width == height);
-      }
-      else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV ||
-               target == GL_TEXTURE_RECTANGLE_NV) {
-         if (!ctx->Extensions.NV_texture_rectangle) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
-            return GL_TRUE;
-         }
-         proxy_target = GL_PROXY_TEXTURE_RECTANGLE_NV;
-      }
-      else if (target == GL_PROXY_TEXTURE_1D_ARRAY_EXT ||
-               target == GL_TEXTURE_1D_ARRAY_EXT) {
-         proxy_target = GL_PROXY_TEXTURE_1D_ARRAY_EXT;
-      }
-      else {
-         _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
-         return GL_TRUE;
-      }
-   }
-   else if (dimensions == 3) {
-      if (target == GL_PROXY_TEXTURE_3D || target == GL_TEXTURE_3D) {
-         proxy_target = GL_PROXY_TEXTURE_3D;
-      }
-      else if (target == GL_PROXY_TEXTURE_2D_ARRAY_EXT ||
-               target == GL_TEXTURE_2D_ARRAY_EXT) {
-         proxy_target = GL_PROXY_TEXTURE_2D_ARRAY_EXT;
-      }
-      else {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else {
-      _mesa_problem( ctx, "bad dims in texture_error_check" );
-      return GL_TRUE;
+   /* Do this simple check before calling the TestProxyTexImage() function */
+   if (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+      sizeOK = (width == height);
    }
 
-   sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxy_target, level,
+   /*
+    * Use the proxy texture driver hook to see if the size/level/etc are
+    * legal.
+    */
+   sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
                                                     internalFormat, format,
                                                     type, width, height,
                                                     depth, border);
@@ -1531,9 +1659,10 @@ texture_error_check( struct gl_context *ctx,
 
    /* additional checks for compressed textures */
    if (_mesa_is_compressed_format(ctx, internalFormat)) {
-      if (!target_can_be_compressed(ctx, target) && !isProxy) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glTexImage%dD(target)", dimensions);
+      if (!target_can_be_compressed(ctx, target, internalFormat)) {
+         if (!isProxy)
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glTexImage%dD(target)", dimensions);
          return GL_TRUE;
       }
       if (border != 0) {
@@ -1591,61 +1720,13 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
                         GLint width, GLint height, GLint depth,
                         GLenum format, GLenum type )
 {
-   /* Check target */
-   if (dimensions == 1) {
-      if (target != GL_TEXTURE_1D) {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage1D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else if (dimensions == 2) {
-      if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-          target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
-            return GL_TRUE;
-         }
-      }
-      else if (target == GL_TEXTURE_RECTANGLE_NV) {
-         if (!ctx->Extensions.NV_texture_rectangle) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
-            return GL_TRUE;
-         }
-      }
-      else if (target == GL_TEXTURE_1D_ARRAY_EXT) {
-        if (!ctx->Extensions.MESA_texture_array) {
-           _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
-           return GL_TRUE;
-        }
-      }
-      else if (target != GL_TEXTURE_2D) {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else if (dimensions == 3) {
-      if (target == GL_TEXTURE_2D_ARRAY_EXT) {
-         if (!ctx->Extensions.MESA_texture_array) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" );
-            return GL_TRUE;
-         }
-      }
-      else if (target != GL_TEXTURE_3D) {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else {
-      _mesa_problem( ctx, "invalid dims in texture_error_check" );
-      return GL_TRUE;
-   }
-
    /* Basic level check */
    if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level);
       return GL_TRUE;
    }
 
+   /* Check for negative sizes */
    if (width < 0) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                   "glTexSubImage%dD(width=%d)", dimensions, width);
@@ -1732,13 +1813,6 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
    if (_mesa_is_format_compressed(destTex->TexFormat)) {
       GLuint bw, bh;
 
-      if (!target_can_be_compressed(ctx, target)) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glTexSubImage%dD(target=%s)", dimensions,
-                     _mesa_lookup_enum_by_nr(target));
-         return GL_TRUE;
-      }
-
       /* do tests which depend on compression block size */
       _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh);
 
@@ -1789,10 +1863,18 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
                          GLenum target, GLint level, GLint internalFormat,
                          GLint width, GLint height, GLint border )
 {
-   GLenum type;
+   const GLenum proxyTarget = get_proxy_target(target);
+   const GLenum type = GL_FLOAT;
    GLboolean sizeOK;
    GLint format;
 
+   /* check target */
+   if (!legal_texsubimage_target(ctx, dimensions, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%uD(target=%s)",
+                  dimensions, _mesa_lookup_enum_by_nr(target));
+      return GL_TRUE;
+   }       
+
    /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
    if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
       _mesa_error(ctx, GL_INVALID_VALUE,
@@ -1830,75 +1912,14 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
       return GL_TRUE;
    }
 
-   /* NOTE: the format and type aren't really significant for
-    * TestProxyTexImage().  Only the internalformat really matters.
-    */
-   type = GL_FLOAT;
+   /* Do size, level checking */
+   sizeOK = (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB)
+      ? (width == height) : 1;
 
-   /* Check target and call ctx->Driver.TestProxyTexImage() to check the
-    * level, width, height and depth.
-    */
-   if (dimensions == 1) {
-      if (target == GL_TEXTURE_1D) {
-         sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D,
-                                                level, internalFormat,
-                                                format, type,
-                                                width, 1, 1, border);
-      }
-      else {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else if (dimensions == 2) {
-      if (target == GL_TEXTURE_2D) {
-         sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D,
-                                                level, internalFormat,
-                                                format, type,
-                                                width, height, 1, border);
-      }
-      else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-               target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
-            return GL_TRUE;
-         }
-         sizeOK = (width == height) &&
-            ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB,
-                                          level, internalFormat, format, type,
-                                          width, height, 1, border);
-      }
-      else if (target == GL_TEXTURE_RECTANGLE_NV) {
-         if (!ctx->Extensions.NV_texture_rectangle) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
-            return GL_TRUE;
-         }
-         sizeOK = ctx->Driver.TestProxyTexImage(ctx,
-                                                GL_PROXY_TEXTURE_RECTANGLE_NV,
-                                                level, internalFormat,
-                                                format, type,
-                                                width, height, 1, border);
-      }
-      else if (target == GL_TEXTURE_1D_ARRAY_EXT) {
-         if (!ctx->Extensions.MESA_texture_array) {
-            _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)");
-            return GL_TRUE;
-         }
-         sizeOK = ctx->Driver.TestProxyTexImage(ctx,
-                                                GL_PROXY_TEXTURE_1D_ARRAY_EXT,
-                                                level, internalFormat,
-                                                format, type,
-                                                width, height, 1, border);
-      }
-      else {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else {
-      _mesa_problem(ctx, "invalid dimensions in copytexture_error_check");
-      return GL_TRUE;
-   }
+   sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
+                                                    internalFormat, format,
+                                                    type, width, height,
+                                                    1, border);
 
    if (!sizeOK) {
       if (dimensions == 1) {
@@ -1914,7 +1935,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
    }
 
    if (_mesa_is_compressed_format(ctx, internalFormat)) {
-      if (!target_can_be_compressed(ctx, target)) {
+      if (!target_can_be_compressed(ctx, target, internalFormat)) {
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "glCopyTexImage%dD(target)", dimensions);
          return GL_TRUE;
@@ -1973,45 +1994,11 @@ copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions,
       }
    }
 
-   /* Check target */
-   if (dimensions == 1) {
-      if (target != GL_TEXTURE_1D) {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else if (dimensions == 2) {
-      if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-          target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" );
-            return GL_TRUE;
-         }
-      }
-      else if (target == GL_TEXTURE_RECTANGLE_NV) {
-         if (!ctx->Extensions.NV_texture_rectangle) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" );
-            return GL_TRUE;
-         }
-      }
-      else if (target == GL_TEXTURE_1D_ARRAY_EXT) {
-         if (!ctx->Extensions.MESA_texture_array) {
-            _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" );
-            return GL_TRUE;
-         }
-      }
-      else if (target != GL_TEXTURE_2D) {
-         _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" );
-         return GL_TRUE;
-      }
-   }
-   else if (dimensions == 3) {
-      if (((target != GL_TEXTURE_2D_ARRAY_EXT) ||
-          (!ctx->Extensions.MESA_texture_array))
-         && (target != GL_TEXTURE_3D)) {
-        _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" );
-        return GL_TRUE;
-      }
+   /* check target (proxies not allowed) */
+   if (!legal_texsubimage_target(ctx, dimensions, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%uD(target=%s)",
+                  dimensions, _mesa_lookup_enum_by_nr(target));
+      return GL_TRUE;
    }
 
    /* Check level */
@@ -2100,11 +2087,6 @@ copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
    }
 
    if (_mesa_is_format_compressed(teximage->TexFormat)) {
-      if (!target_can_be_compressed(ctx, target)) {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                     "glCopyTexSubImage%dD(target)", dimensions);
-         return GL_TRUE;
-      }
       /* offset must be multiple of 4 */
       if ((xoffset & 3) || (yoffset & 3)) {
          _mesa_error(ctx, GL_INVALID_VALUE,
@@ -2337,89 +2319,48 @@ _mesa_choose_texture_format(struct gl_context *ctx,
 }
 
 
-
-/*
- * Called from the API.  Note that width includes the border.
+/**
+ * Common code to implement all the glTexImage1D/2D/3D functions.
  */
-void GLAPIENTRY
-_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
-                  GLsizei width, GLint border, GLenum format,
-                  GLenum type, const GLvoid *pixels )
+static void
+teximage(struct gl_context *ctx, GLuint dims,
+         GLenum target, GLint level, GLint internalFormat,
+         GLsizei width, GLsizei height, GLsizei depth,
+         GLint border, GLenum format, GLenum type,
+         const GLvoid *pixels)
 {
-   GET_CURRENT_CONTEXT(ctx);
+   GLboolean error;
+
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexImage1D %s %d %s %d %d %s %s %p\n",
+      _mesa_debug(ctx, "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n",
+                  dims,
                   _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat), width, border,
+                  _mesa_lookup_enum_by_nr(internalFormat),
+                  width, height, depth, border,
                   _mesa_lookup_enum_by_nr(format),
                   _mesa_lookup_enum_by_nr(type), pixels);
 
-   internalFormat = override_internal_format(internalFormat, width, 1);
+   internalFormat = override_internal_format(internalFormat, width, height);
 
-   if (target == GL_TEXTURE_1D) {
-      /* non-proxy target */
-      struct gl_texture_object *texObj;
-      struct gl_texture_image *texImage;
-      const GLuint face = _mesa_tex_target_to_face(target);
+   /* target error checking */
+   if (!legal_teximage_target(ctx, dims, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%uD(target=%s)",
+                  dims, _mesa_lookup_enum_by_nr(target));
+      return;
+   }
 
-      if (texture_error_check(ctx, 1, target, level, internalFormat,
-                              format, type, width, 1, 1, border)) {
-         return;   /* error was recorded */
-      }
+   /* general error checking */
+   error = texture_error_check(ctx, dims, target, level, internalFormat,
+                               format, type, width, height, depth, border);
 
-      if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
-        _mesa_update_state(ctx);
-
-      texObj = _mesa_get_current_tex_object(ctx, target);
-      _mesa_lock_texture(ctx, texObj);
-      {
-        texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-        if (!texImage) {
-           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
-        }
-         else {
-            gl_format texFormat;
-
-            if (texImage->Data) {
-               ctx->Driver.FreeTexImageData( ctx, texImage );
-            }
-
-            ASSERT(texImage->Data == NULL);
-
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, format,
-                                                    type);
-
-            _mesa_init_teximage_fields(ctx, target, texImage,
-                                       width, 1, 1,
-                                       border, internalFormat,
-                                       texFormat);
-
-            /* Give the texture to the driver.  <pixels> may be null. */
-            ASSERT(ctx->Driver.TexImage1D);
-            ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
-                                   width, border, format, type, pixels,
-                                   &ctx->Unpack, texObj, texImage);
-
-            check_gen_mipmap(ctx, target, texObj, level);
-
-            update_fbo_texture(ctx, texObj, face, level);
+   if (_mesa_is_proxy_texture(target)) {
+      /* Proxy texture: just clear or set state depending on error checking */
+      struct gl_texture_image *texImage =
+         _mesa_get_proxy_tex_image(ctx, target, level);
 
-            /* state update */
-            texObj->_Complete = GL_FALSE;
-            ctx->NewState |= _NEW_TEXTURE;
-         }
-      }
-      _mesa_unlock_texture(ctx, texObj);
-   }
-   else if (target == GL_PROXY_TEXTURE_1D) {
-      /* Proxy texture: check for errors and update proxy state */
-      struct gl_texture_image *texImage;
-      texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-      if (texture_error_check(ctx, 1, target, level, internalFormat,
-                              format, type, width, 1, 1, border)) {
+      if (error) {
          /* when error, clear all proxy texture image parameters */
          if (texImage)
             clear_teximage_fields(texImage);
@@ -2428,54 +2369,28 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
          /* no error, set the tex image parameters */
          struct gl_texture_object *texObj =
             _mesa_get_current_tex_object(ctx, target);
-         gl_format texFormat = _mesa_choose_texture_format(ctx, texObj, target,
-                                                           level,
+         gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
+                                                           target, level,
                                                            internalFormat,
                                                            format, type);
-         _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
-                                    border, internalFormat, texFormat);
+
+         if (legal_texture_size(ctx, texFormat, width, height, depth)) {
+            _mesa_init_teximage_fields(ctx, target, texImage, width, height,
+                                       depth, border, internalFormat,
+                                       texFormat);
+         }
+         else if (texImage) {
+            clear_teximage_fields(texImage);
+         }
       }
    }
    else {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
-      return;
-   }
-}
-
-
-void GLAPIENTRY
-_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
-                  GLsizei width, GLsizei height, GLint border,
-                  GLenum format, GLenum type,
-                  const GLvoid *pixels )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexImage2D %s %d %s %d %d %d %s %s %p\n",
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat), width, height,
-                  border, _mesa_lookup_enum_by_nr(format),
-                  _mesa_lookup_enum_by_nr(type), pixels);
-
-   internalFormat = override_internal_format(internalFormat, width, height);
-
-   if (target == GL_TEXTURE_2D ||
-       (ctx->Extensions.ARB_texture_cube_map &&
-        target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-        target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ||
-       (ctx->Extensions.NV_texture_rectangle &&
-        target == GL_TEXTURE_RECTANGLE_NV) ||
-       (ctx->Extensions.MESA_texture_array &&
-        target == GL_TEXTURE_1D_ARRAY_EXT)) {
       /* non-proxy target */
+      const GLuint face = _mesa_tex_target_to_face(target);
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
-      const GLuint face = _mesa_tex_target_to_face(target);
 
-      if (texture_error_check(ctx, 2, target, level, internalFormat,
-                              format, type, width, height, 1, border)) {
+      if (error) {
          return;   /* error was recorded */
       }
 
@@ -2483,11 +2398,13 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
         _mesa_update_state(ctx);
 
       texObj = _mesa_get_current_tex_object(ctx, target);
+
       _mesa_lock_texture(ctx, texObj);
       {
         texImage = _mesa_get_tex_image(ctx, texObj, target, level);
+
         if (!texImage) {
-           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
         }
          else {
             gl_format texFormat;
@@ -2497,63 +2414,81 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
             }
 
             ASSERT(texImage->Data == NULL);
-
             texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
                                                     internalFormat, format,
                                                     type);
 
-            _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
-                                       border, internalFormat, texFormat);
+            if (legal_texture_size(ctx, texFormat, width, height, depth)) {
+               _mesa_init_teximage_fields(ctx, target, texImage,
+                                          width, height, depth,
+                                          border, internalFormat, texFormat);
+
+               /* Give the texture to the driver.  <pixels> may be null. */
+               ASSERT(ctx->Driver.TexImage3D);
+               switch (dims) {
+               case 1:
+                  ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+                                         width, border, format,
+                                         type, pixels, &ctx->Unpack, texObj,
+                                         texImage);
+                  break;
+               case 2:
+                  ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+                                         width, height, border, format,
+                                         type, pixels, &ctx->Unpack, texObj,
+                                         texImage);
+                  break;
+               case 3:
+                  ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
+                                         width, height, depth, border, format,
+                                         type, pixels, &ctx->Unpack, texObj,
+                                         texImage);
+                  break;
+               default:
+                  _mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
+               }
 
-            /* Give the texture to the driver.  <pixels> may be null. */
-            ASSERT(ctx->Driver.TexImage2D);
-            ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
-                                   width, height, border, format, type,
-                                   pixels, &ctx->Unpack, texObj, texImage);
+               check_gen_mipmap(ctx, target, texObj, level);
 
-            check_gen_mipmap(ctx, target, texObj, level);
+               update_fbo_texture(ctx, texObj, face, level);
 
-            update_fbo_texture(ctx, texObj, face, level);
-
-            /* state update */
-            texObj->_Complete = GL_FALSE;
-            ctx->NewState |= _NEW_TEXTURE;
+               /* state update */
+               texObj->_Complete = GL_FALSE;
+               ctx->NewState |= _NEW_TEXTURE;
+            }
+            else {
+               _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
+            }
          }
       }
       _mesa_unlock_texture(ctx, texObj);
    }
-   else if (target == GL_PROXY_TEXTURE_2D ||
-            (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB &&
-             ctx->Extensions.ARB_texture_cube_map) ||
-            (target == GL_PROXY_TEXTURE_RECTANGLE_NV &&
-             ctx->Extensions.NV_texture_rectangle) ||
-            (ctx->Extensions.MESA_texture_array &&
-             target == GL_PROXY_TEXTURE_1D_ARRAY_EXT)) {
-      /* Proxy texture: check for errors and update proxy state */
-      struct gl_texture_image *texImage;
-      texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-      if (texture_error_check(ctx, 2, target, level, internalFormat,
-                              format, type, width, height, 1, border)) {
-         /* when error, clear all proxy texture image parameters */
-         if (texImage)
-            clear_teximage_fields(texImage);
-      }
-      else {
-         /* no error, set the tex image parameters */
-         struct gl_texture_object *texObj =
-            _mesa_get_current_tex_object(ctx, target);
-         gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
-                                                           target, level,
-                                                           internalFormat,
-                                                           format, type);
-         _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
-                                    border, internalFormat, texFormat);
-      }
-   }
-   else {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" );
-      return;
-   }
+}
+
+
+/*
+ * Called from the API.  Note that width includes the border.
+ */
+void GLAPIENTRY
+_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
+                  GLsizei width, GLint border, GLenum format,
+                  GLenum type, const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   teximage(ctx, 1, target, level, internalFormat, width, 1, 1,
+            border, format, type, pixels);
+}
+
+
+void GLAPIENTRY
+_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
+                  GLsizei width, GLsizei height, GLint border,
+                  GLenum format, GLenum type,
+                  const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   teximage(ctx, 2, target, level, internalFormat, width, height, 1,
+            border, format, type, pixels);
 }
 
 
@@ -2568,100 +2503,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
                   const GLvoid *pixels )
 {
    GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexImage3D %s %d %s %d %d %d %d %s %s %p\n",
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat), width, height,
-                  depth, border, _mesa_lookup_enum_by_nr(format),
-                  _mesa_lookup_enum_by_nr(type), pixels);
-
-   internalFormat = override_internal_format(internalFormat, width, height);
-
-   if (target == GL_TEXTURE_3D ||
-       (ctx->Extensions.MESA_texture_array &&
-        target == GL_TEXTURE_2D_ARRAY_EXT)) {
-      /* non-proxy target */
-      struct gl_texture_object *texObj;
-      struct gl_texture_image *texImage;
-      const GLuint face = _mesa_tex_target_to_face(target);
-
-      if (texture_error_check(ctx, 3, target, level, (GLint) internalFormat,
-                              format, type, width, height, depth, border)) {
-         return;   /* error was recorded */
-      }
-
-      if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
-        _mesa_update_state(ctx);
-
-      texObj = _mesa_get_current_tex_object(ctx, target);
-      _mesa_lock_texture(ctx, texObj);
-      {
-        texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-        if (!texImage) {
-           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
-        }
-         else {
-            gl_format texFormat;
-
-            if (texImage->Data) {
-               ctx->Driver.FreeTexImageData( ctx, texImage );
-            }
-
-            ASSERT(texImage->Data == NULL);
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, format,
-                                                    type);
-            _mesa_init_teximage_fields(ctx, target, texImage,
-                                       width, height, depth,
-                                       border, internalFormat, texFormat);
-
-            /* Give the texture to the driver.  <pixels> may be null. */
-            ASSERT(ctx->Driver.TexImage3D);
-            ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
-                                   width, height, depth, border, format, type,
-                                   pixels, &ctx->Unpack, texObj, texImage);
-
-            check_gen_mipmap(ctx, target, texObj, level);
-
-            update_fbo_texture(ctx, texObj, face, level);
-
-            /* state update */
-            texObj->_Complete = GL_FALSE;
-            ctx->NewState |= _NEW_TEXTURE;
-         }
-      }
-      _mesa_unlock_texture(ctx, texObj);
-   }
-   else if (target == GL_PROXY_TEXTURE_3D ||
-       (ctx->Extensions.MESA_texture_array &&
-        target == GL_PROXY_TEXTURE_2D_ARRAY_EXT)) {
-      /* Proxy texture: check for errors and update proxy state */
-      struct gl_texture_image *texImage;
-      texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-      if (texture_error_check(ctx, 3, target, level, internalFormat,
-                              format, type, width, height, depth, border)) {
-         /* when error, clear all proxy texture image parameters */
-         if (texImage)
-            clear_teximage_fields(texImage);
-      }
-      else {
-         /* no error, set the tex image parameters */
-         struct gl_texture_object *texObj =
-            _mesa_get_current_tex_object(ctx, target);
-         gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
-                                                           target, level,
-                                                           internalFormat,
-                                                           format, type);
-         _mesa_init_teximage_fields(ctx, target, texImage, width, height,
-                                    depth, border, internalFormat, texFormat);
-      }
-   }
-   else {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" );
-      return;
-   }
+   teximage(ctx, 3, target, level, internalFormat, width, height, depth,
+            border, format, type, pixels);
 }
 
 
@@ -2724,141 +2567,40 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
 #endif
 
 
-void GLAPIENTRY
-_mesa_TexSubImage1D( GLenum target, GLint level,
-                     GLint xoffset, GLsizei width,
-                     GLenum format, GLenum type,
-                     const GLvoid *pixels )
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexSubImage1D %s %d %d %d %s %s %p\n",
-                  _mesa_lookup_enum_by_nr(target), level,
-                  xoffset, width, _mesa_lookup_enum_by_nr(format),
-                  _mesa_lookup_enum_by_nr(type), pixels);
-
-   if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
-      _mesa_update_state(ctx);
-
-   if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0,
-                              width, 1, 1, format, type)) {
-      return;   /* error was detected */
-   }
-
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-   assert(texObj);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-      if (subtexture_error_check2(ctx, 1, target, level, xoffset, 0, 0,
-                                 width, 1, 1, format, type, texImage)) {
-         /* error was recorded */
-      }
-      else if (width > 0) {
-         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-         xoffset += texImage->Border;
-
-         ASSERT(ctx->Driver.TexSubImage1D);
-         ctx->Driver.TexSubImage1D(ctx, target, level, xoffset, width,
-                                   format, type, pixels, &ctx->Unpack,
-                                   texObj, texImage);
-
-         check_gen_mipmap(ctx, target, texObj, level);
-
-         ctx->NewState |= _NEW_TEXTURE;
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
-
 
-void GLAPIENTRY
-_mesa_TexSubImage2D( GLenum target, GLint level,
-                     GLint xoffset, GLint yoffset,
-                     GLsizei width, GLsizei height,
-                     GLenum format, GLenum type,
-                     const GLvoid *pixels )
+/**
+ * Implement all the glTexSubImage1/2/3D() functions.
+ */
+static void
+texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
+            GLint xoffset, GLint yoffset, GLint zoffset,
+            GLsizei width, GLsizei height, GLsizei depth,
+            GLenum format, GLenum type, const GLvoid *pixels )
 {
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexSubImage2D %s %d %d %d %d %d %s %s %p\n",
-                  _mesa_lookup_enum_by_nr(target), level,
-                  xoffset, yoffset, width, height,
-                  _mesa_lookup_enum_by_nr(format),
-                  _mesa_lookup_enum_by_nr(type), pixels);
-
-   if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
-      _mesa_update_state(ctx);
-
-   if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
-                             width, height, 1, format, type)) {
-      return;   /* error was detected */
-   }
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-      if (subtexture_error_check2(ctx, 2, target, level, xoffset, yoffset, 0,
-                                 width, height, 1, format, type, texImage)) {
-        /* error was recorded */
-      }
-      else if (width > 0 && height >= 0) {
-         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-         xoffset += texImage->Border;
-         yoffset += texImage->Border;
-
-         ASSERT(ctx->Driver.TexSubImage2D);
-         ctx->Driver.TexSubImage2D(ctx, target, level, xoffset, yoffset,
-                                   width, height, format, type, pixels,
-                                   &ctx->Unpack, texObj, texImage);
-
-         check_gen_mipmap(ctx, target, texObj, level);
-
-         ctx->NewState |= _NEW_TEXTURE;
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
-}
-
-
-
-void GLAPIENTRY
-_mesa_TexSubImage3D( GLenum target, GLint level,
-                     GLint xoffset, GLint yoffset, GLint zoffset,
-                     GLsizei width, GLsizei height, GLsizei depth,
-                     GLenum format, GLenum type,
-                     const GLvoid *pixels )
-{
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glTexSubImage3D %s %d %d %d %d %d %d %d %s %s %p\n",
+      _mesa_debug(ctx, "glTexSubImage%uD %s %d %d %d %d %d %d %d %s %s %p\n",
+                  dims,
                   _mesa_lookup_enum_by_nr(target), level,
                   xoffset, yoffset, zoffset, width, height, depth,
                   _mesa_lookup_enum_by_nr(format),
                   _mesa_lookup_enum_by_nr(type), pixels);
 
+   /* check target (proxies not allowed) */
+   if (!legal_texsubimage_target(ctx, dims, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(target=%s)",
+                  dims, _mesa_lookup_enum_by_nr(target));
+      return;
+   }       
+
    if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
       _mesa_update_state(ctx);
 
-   if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset,
+   if (subtexture_error_check(ctx, dims, target, level, xoffset, yoffset, zoffset,
                               width, height, depth, format, type)) {
       return;   /* error was detected */
    }
@@ -2869,24 +2611,48 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
-      if (subtexture_error_check2(ctx, 3, target, level,
+      if (subtexture_error_check2(ctx, dims, target, level,
                                   xoffset, yoffset, zoffset,
                                  width, height, depth,
                                   format, type, texImage)) {
          /* error was recorded */
       }
       else if (width > 0 && height > 0 && height > 0) {
-         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-         xoffset += texImage->Border;
-         yoffset += texImage->Border;
-         zoffset += texImage->Border;
-
-         ASSERT(ctx->Driver.TexSubImage3D);
-         ctx->Driver.TexSubImage3D(ctx, target, level,
-                                   xoffset, yoffset, zoffset,
-                                   width, height, depth,
-                                   format, type, pixels,
-                                   &ctx->Unpack, texObj, texImage );
+         /* If we have a border, offset=-1 is legal.  Bias by border width. */
+         switch (dims) {
+         case 3:
+            zoffset += texImage->Border;
+            /* fall-through */
+         case 2:
+            yoffset += texImage->Border;
+            /* fall-through */
+         case 1:
+            xoffset += texImage->Border;
+         }
+
+         switch (dims) {
+         case 1:
+            ctx->Driver.TexSubImage1D(ctx, target, level,
+                                      xoffset, width,
+                                      format, type, pixels,
+                                      &ctx->Unpack, texObj, texImage );
+            break;
+         case 2:
+            ctx->Driver.TexSubImage2D(ctx, target, level,
+                                      xoffset, yoffset, width, height,
+                                      format, type, pixels,
+                                      &ctx->Unpack, texObj, texImage );
+            break;
+         case 3:
+            ctx->Driver.TexSubImage3D(ctx, target, level,
+                                      xoffset, yoffset, zoffset,
+                                      width, height, depth,
+                                      format, type, pixels,
+                                      &ctx->Unpack, texObj, texImage );
+            break;
+         default:
+            _mesa_problem(ctx, "unexpected dims in subteximage()");
+         }
 
          check_gen_mipmap(ctx, target, texObj, level);
 
@@ -2897,87 +2663,69 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
 }
 
 
-
 void GLAPIENTRY
-_mesa_CopyTexImage1D( GLenum target, GLint level,
-                      GLenum internalFormat,
-                      GLint x, GLint y,
-                      GLsizei width, GLint border )
+_mesa_TexSubImage1D( GLenum target, GLint level,
+                     GLint xoffset, GLsizei width,
+                     GLenum format, GLenum type,
+                     const GLvoid *pixels )
 {
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   const GLuint face = _mesa_tex_target_to_face(target);
    GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCopyTexImage1D %s %d %s %d %d %d %d\n",
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat),
-                  x, y, width, border);
-
-   if (ctx->NewState & NEW_COPY_TEX_STATE)
-      _mesa_update_state(ctx);
-
-   if (copytexture_error_check(ctx, 1, target, level, internalFormat,
-                               width, 1, border))
-      return;
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-      if (!texImage) {
-        _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D");
-      }
-      else {
-         gl_format texFormat;
-
-         if (texImage->Data) {
-            ctx->Driver.FreeTexImageData( ctx, texImage );
-         }
-
-         ASSERT(texImage->Data == NULL);
-
-         texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                 internalFormat, GL_NONE,
-                                                 GL_NONE);
+   texsubimage(ctx, 1, target, level,
+               xoffset, 0, 0,
+               width, 1, 1,
+               format, type, pixels);
+}
 
-         _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
-                                    border, internalFormat, texFormat);
 
-         ASSERT(ctx->Driver.CopyTexImage1D);
-         ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
-                                    x, y, width, border);
+void GLAPIENTRY
+_mesa_TexSubImage2D( GLenum target, GLint level,
+                     GLint xoffset, GLint yoffset,
+                     GLsizei width, GLsizei height,
+                     GLenum format, GLenum type,
+                     const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   texsubimage(ctx, 2, target, level,
+               xoffset, yoffset, 0,
+               width, height, 1,
+               format, type, pixels);
+}
 
-         check_gen_mipmap(ctx, target, texObj, level);
 
-         update_fbo_texture(ctx, texObj, face, level);
 
-         /* state update */
-         texObj->_Complete = GL_FALSE;
-         ctx->NewState |= _NEW_TEXTURE;
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
+void GLAPIENTRY
+_mesa_TexSubImage3D( GLenum target, GLint level,
+                     GLint xoffset, GLint yoffset, GLint zoffset,
+                     GLsizei width, GLsizei height, GLsizei depth,
+                     GLenum format, GLenum type,
+                     const GLvoid *pixels )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   texsubimage(ctx, 3, target, level,
+               xoffset, yoffset, zoffset,
+               width, height, depth,
+               format, type, pixels);
 }
 
 
 
-void GLAPIENTRY
-_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
-                      GLint x, GLint y, GLsizei width, GLsizei height,
-                      GLint border )
+/**
+ * Implement the glCopyTexImage1/2D() functions.
+ */
+static void
+copyteximage(struct gl_context *ctx, GLuint dims,
+             GLenum target, GLint level, GLenum internalFormat,
+             GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
 {
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
    const GLuint face = _mesa_tex_target_to_face(target);
-   GET_CURRENT_CONTEXT(ctx);
+
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCopyTexImage2D %s %d %s %d %d %d %d %d\n",
+      _mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n",
+                  dims,
                   _mesa_lookup_enum_by_nr(target), level,
                   _mesa_lookup_enum_by_nr(internalFormat),
                   x, y, width, height, border);
@@ -2985,7 +2733,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);
 
-   if (copytexture_error_check(ctx, 2, target, level, internalFormat,
+   if (copytexture_error_check(ctx, dims, target, level, internalFormat,
                                width, height, border))
       return;
 
@@ -2996,7 +2744,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
       texImage = _mesa_get_tex_image(ctx, texObj, target, level);
 
       if (!texImage) {
-        _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D");
+        _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
       }
       else {
          gl_format texFormat;
@@ -3011,99 +2759,83 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
                                                  internalFormat, GL_NONE,
                                                  GL_NONE);
 
-         _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
-                                    border, internalFormat, texFormat);
+         if (legal_texture_size(ctx, texFormat, width, height, 1)) {
+            _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
+                                       border, internalFormat, texFormat);
 
-         ASSERT(ctx->Driver.CopyTexImage2D);
-         ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
-                                    x, y, width, height, border);
+            ASSERT(ctx->Driver.CopyTexImage2D);
+            if (dims == 1)
+               ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
+                                          x, y, width, border);
+            else
+               ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
+                                          x, y, width, height, border);
 
-         check_gen_mipmap(ctx, target, texObj, level);
+            check_gen_mipmap(ctx, target, texObj, level);
 
-         update_fbo_texture(ctx, texObj, face, level);
+            update_fbo_texture(ctx, texObj, face, level);
 
-         /* state update */
-         texObj->_Complete = GL_FALSE;
-         ctx->NewState |= _NEW_TEXTURE;
+            /* state update */
+            texObj->_Complete = GL_FALSE;
+            ctx->NewState |= _NEW_TEXTURE;
+         }
+         else {
+            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
+         }
       }
    }
    _mesa_unlock_texture(ctx, texObj);
 }
 
 
+
 void GLAPIENTRY
-_mesa_CopyTexSubImage1D( GLenum target, GLint level,
-                         GLint xoffset, GLint x, GLint y, GLsizei width )
+_mesa_CopyTexImage1D( GLenum target, GLint level,
+                      GLenum internalFormat,
+                      GLint x, GLint y,
+                      GLsizei width, GLint border )
 {
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
-   GLint yoffset = 0;
-   GLsizei height = 1;
-
    GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCopyTexSubImage1D %s %d %d %d %d %d\n",
-                  _mesa_lookup_enum_by_nr(target),
-                  level, xoffset, x, y, width);
-
-   if (ctx->NewState & NEW_COPY_TEX_STATE)
-      _mesa_update_state(ctx);
-
-   if (copytexsubimage_error_check1(ctx, 1, target, level))
-      return;
-
-   texObj = _mesa_get_current_tex_object(ctx, target);
-
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
-      if (copytexsubimage_error_check2(ctx, 1, target, level,
-                                      xoffset, 0, 0, width, 1, texImage)) {
-         /* error was recorded */
-      }
-      else {
-         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-         xoffset += texImage->Border;
+   copyteximage(ctx, 1, target, level, internalFormat, x, y, width, 1, border);
+}
 
-         if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
-                                        &width, &height)) {
-            ASSERT(ctx->Driver.CopyTexSubImage1D);
-            ctx->Driver.CopyTexSubImage1D(ctx, target, level,
-                                          xoffset, x, y, width);
 
-            check_gen_mipmap(ctx, target, texObj, level);
 
-            ctx->NewState |= _NEW_TEXTURE;
-         }
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
+void GLAPIENTRY
+_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
+                      GLint x, GLint y, GLsizei width, GLsizei height,
+                      GLint border )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copyteximage(ctx, 2, target, level, internalFormat,
+                x, y, width, height, border);
 }
 
 
 
-void GLAPIENTRY
-_mesa_CopyTexSubImage2D( GLenum target, GLint level,
-                         GLint xoffset, GLint yoffset,
-                         GLint x, GLint y, GLsizei width, GLsizei height )
+/**
+ * Implementation for glCopyTexSubImage1/2/3D() functions.
+ */
+static void
+copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
+                GLint xoffset, GLint yoffset, GLint zoffset,
+                GLint x, GLint y, GLsizei width, GLsizei height)
 {
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
-   GET_CURRENT_CONTEXT(ctx);
+
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCopyTexSubImage2D %s %d %d %d %d %d %d %d\n",
+      _mesa_debug(ctx, "glCopyTexSubImage%uD %s %d %d %d %d %d %d %d %d\n",
+                  dims,
                   _mesa_lookup_enum_by_nr(target),
-                  level, xoffset, yoffset, x, y, width, height);
+                  level, xoffset, yoffset, zoffset, x, y, width, height);
 
    if (ctx->NewState & NEW_COPY_TEX_STATE)
       _mesa_update_state(ctx);
 
-   if (copytexsubimage_error_check1(ctx, 2, target, level))
+   if (copytexsubimage_error_check1(ctx, dims, target, level))
       return;
 
    texObj = _mesa_get_current_tex_object(ctx, target);
@@ -3112,21 +2844,43 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
    {
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
-      if (copytexsubimage_error_check2(ctx, 2, target, level,
-                                       xoffset, yoffset, 0,
-                                      width, height, texImage)) {
-         /* error was recorded */
+      if (copytexsubimage_error_check2(ctx, dims, target, level, xoffset, yoffset,
+                                      zoffset, width, height, texImage)) {
+         /* error was recored */
       }
       else {
-         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-         xoffset += texImage->Border;
-         yoffset += texImage->Border;
+         /* If we have a border, offset=-1 is legal.  Bias by border width. */
+         switch (dims) {
+         case 3:
+            zoffset += texImage->Border;
+            /* fall-through */
+         case 2:
+            yoffset += texImage->Border;
+            /* fall-through */
+         case 1:
+            xoffset += texImage->Border;
+         }
 
          if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
                                         &width, &height)) {
-            ASSERT(ctx->Driver.CopyTexSubImage2D);
-            ctx->Driver.CopyTexSubImage2D(ctx, target, level, xoffset, yoffset,
-                                          x, y, width, height);
+            switch (dims) {
+            case 1:
+               ctx->Driver.CopyTexSubImage1D(ctx, target, level,
+                                             xoffset, x, y, width);
+               break;
+            case 2:
+               ctx->Driver.CopyTexSubImage2D(ctx, target, level,
+                                             xoffset, yoffset,
+                                             x, y, width, height);
+               break;
+            case 3:
+               ctx->Driver.CopyTexSubImage3D(ctx, target, level,
+                                             xoffset, yoffset, zoffset,
+                                             x, y, width, height);
+               break;
+            default:
+               _mesa_problem(ctx, "bad dims in copytexsubimage()");
+            }
 
             check_gen_mipmap(ctx, target, texObj, level);
 
@@ -3138,58 +2892,36 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
 }
 
 
-
 void GLAPIENTRY
-_mesa_CopyTexSubImage3D( GLenum target, GLint level,
-                         GLint xoffset, GLint yoffset, GLint zoffset,
-                         GLint x, GLint y, GLsizei width, GLsizei height )
+_mesa_CopyTexSubImage1D( GLenum target, GLint level,
+                         GLint xoffset, GLint x, GLint y, GLsizei width )
 {
-   struct gl_texture_object *texObj;
-   struct gl_texture_image *texImage;
    GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCopyTexSubImage3D %s %d %d %d %d %d %d %d %d\n",
-                  _mesa_lookup_enum_by_nr(target),
-                  level, xoffset, yoffset, zoffset, x, y, width, height);
-
-   if (ctx->NewState & NEW_COPY_TEX_STATE)
-      _mesa_update_state(ctx);
-
-   if (copytexsubimage_error_check1(ctx, 3, target, level))
-      return;
+   copytexsubimage(ctx, 1, target, level, xoffset, 0, 0, x, y, width, 1);
+}
 
-   texObj = _mesa_get_current_tex_object(ctx, target);
 
-   _mesa_lock_texture(ctx, texObj);
-   {
-      texImage = _mesa_select_tex_image(ctx, texObj, target, level);
 
-      if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset,
-                                      zoffset, width, height, texImage)) {
-         /* error was recored */
-      }
-      else {
-         /* If we have a border, xoffset=-1 is legal.  Bias by border width */
-         xoffset += texImage->Border;
-         yoffset += texImage->Border;
-         zoffset += texImage->Border;
+void GLAPIENTRY
+_mesa_CopyTexSubImage2D( GLenum target, GLint level,
+                         GLint xoffset, GLint yoffset,
+                         GLint x, GLint y, GLsizei width, GLsizei height )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copytexsubimage(ctx, 2, target, level, xoffset, yoffset, 0, x, y,
+                   width, height);
+}
 
-         if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
-                                        &width, &height)) {
-            ASSERT(ctx->Driver.CopyTexSubImage3D);
-            ctx->Driver.CopyTexSubImage3D(ctx, target, level,
-                                          xoffset, yoffset, zoffset,
-                                          x, y, width, height);
 
-            check_gen_mipmap(ctx, target, texObj, level);
 
-            ctx->NewState |= _NEW_TEXTURE;
-         }
-      }
-   }
-   _mesa_unlock_texture(ctx, texObj);
+void GLAPIENTRY
+_mesa_CopyTexSubImage3D( GLenum target, GLint level,
+                         GLint xoffset, GLint yoffset, GLint zoffset,
+                         GLint x, GLint y, GLsizei width, GLsizei height )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   copytexsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
+                   x, y, width, height);
 }
 
 
@@ -3224,55 +2956,28 @@ get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
 
 
 /**
- * Error checking for glCompressedTexImage[123]D().
- * \return error code or GL_NO_ERROR.
- */
-static GLenum
-compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
-                               GLenum target, GLint level,
-                               GLenum internalFormat, GLsizei width,
-                               GLsizei height, GLsizei depth, GLint border,
-                               GLsizei imageSize)
-{
-   GLint expectedSize, maxLevels = 0, maxTextureSize;
-
-   if (dimensions == 1) {
-      /* 1D compressed textures not allowed */
-      return GL_INVALID_ENUM;
-   }
-   else if (dimensions == 2) {
-      if (target == GL_PROXY_TEXTURE_2D) {
-         maxLevels = ctx->Const.MaxTextureLevels;
-      }
-      else if (target == GL_TEXTURE_2D) {
-         maxLevels = ctx->Const.MaxTextureLevels;
-      }
-      else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map)
-            return GL_INVALID_ENUM; /*target*/
-         maxLevels = ctx->Const.MaxCubeTextureLevels;
-      }
-      else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-               target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map)
-            return GL_INVALID_ENUM; /*target*/
-         maxLevels = ctx->Const.MaxCubeTextureLevels;
-      }
-      else {
-         return GL_INVALID_ENUM; /*target*/
-      }
-   }
-   else if (dimensions == 3) {
-      /* 3D compressed textures not allowed */
-      return GL_INVALID_ENUM;
-   }
-   else {
-      assert(0);
+ * Error checking for glCompressedTexImage[123]D().
+ * \return error code or GL_NO_ERROR.
+ */
+static GLenum
+compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
+                               GLenum target, GLint level,
+                               GLenum internalFormat, GLsizei width,
+                               GLsizei height, GLsizei depth, GLint border,
+                               GLsizei imageSize)
+{
+   const GLenum proxyTarget = get_proxy_target(target);
+   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
+   GLint expectedSize;
+
+   /* check level */
+   if (level < 0 || level >= maxLevels)
+      return GL_INVALID_VALUE;
+
+   if (!target_can_be_compressed(ctx, target, internalFormat)) {
       return GL_INVALID_ENUM;
    }
 
-   maxTextureSize = 1 << (maxLevels - 1);
-
    /* This will detect any invalid internalFormat value */
    if (!_mesa_is_compressed_format(ctx, internalFormat))
       return GL_INVALID_ENUM;
@@ -3281,47 +2986,51 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
    if (_mesa_base_tex_format(ctx, internalFormat) < 0)
       return GL_INVALID_ENUM;
 
+   /* No compressed formats support borders at this time */
    if (border != 0)
       return GL_INVALID_VALUE;
 
-   /*
-    * XXX We should probably use the proxy texture error check function here.
-    */
-   if (width < 1 || width > maxTextureSize ||
-       (!ctx->Extensions.ARB_texture_non_power_of_two && !_mesa_is_pow_two(width)))
-      return GL_INVALID_VALUE;
-
-   if ((height < 1 || height > maxTextureSize ||
-       (!ctx->Extensions.ARB_texture_non_power_of_two && !_mesa_is_pow_two(height)))
-       && dimensions > 1)
-      return GL_INVALID_VALUE;
-
-   if ((depth < 1 || depth > maxTextureSize ||
-       (!ctx->Extensions.ARB_texture_non_power_of_two && !_mesa_is_pow_two(depth)))
-       && dimensions > 2)
-      return GL_INVALID_VALUE;
-
    /* For cube map, width must equal height */
    if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
        target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height)
       return GL_INVALID_VALUE;
 
-   if (level < 0 || level >= maxLevels)
-      return GL_INVALID_VALUE;
+   /* check image size against compression block size */
+   {
+      gl_format texFormat =
+         ctx->Driver.ChooseTextureFormat(ctx, internalFormat,
+                                         GL_NONE, GL_NONE);
+      GLuint bw, bh;
 
-   expectedSize = compressed_tex_size(width, height, depth, internalFormat);
-   if (expectedSize != imageSize)
-      return GL_INVALID_VALUE;
+      _mesa_get_format_block_size(texFormat, &bw, &bh);
+      if ((width > bw && width % bw > 0) ||
+          (height > bh && height % bh > 0)) {
+         /*
+          * Per GL_ARB_texture_compression:  GL_INVALID_OPERATION is
+          * generated [...] if any parameter combinations are not
+          * supported by the specific compressed internal format. 
+          */
+         return GL_INVALID_OPERATION;
+      }
+   }
 
-#if FEATURE_EXT_texture_sRGB
-   if ((internalFormat == GL_COMPRESSED_SRGB_S3TC_DXT1_EXT ||
-        internalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT ||
-        internalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT ||
-        internalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT)
-       && border != 0) {
+   /* check image sizes */
+   if (!ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
+                                      internalFormat, GL_NONE, GL_NONE,
+                                      width, height, depth, border)) {
+      /* See error comment above */
       return GL_INVALID_OPERATION;
    }
-#endif
+
+   /* check image size in bytes */
+   expectedSize = compressed_tex_size(width, height, depth, internalFormat);
+   if (expectedSize != imageSize) {
+      /* Per GL_ARB_texture_compression:  GL_INVALID_VALUE is generated [...]
+       * if <imageSize> is not consistent with the format, dimensions, and
+       * contents of the specified image.
+       */
+      return GL_INVALID_VALUE;
+   }
 
    return GL_NO_ERROR;
 }
@@ -3463,159 +3172,101 @@ compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
 }
 
 
-
-void GLAPIENTRY
-_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
-                              GLenum internalFormat, GLsizei width,
-                              GLint border, GLsizei imageSize,
-                              const GLvoid *data)
+/**
+ * Implementation of the glCompressedTexImage1/2/3D() functions.
+ */
+static void
+compressedteximage(struct gl_context *ctx, GLuint dims,
+                   GLenum target, GLint level,
+                   GLenum internalFormat, GLsizei width,
+                   GLsizei height, GLsizei depth, GLint border,
+                   GLsizei imageSize, const GLvoid *data)
 {
-   GET_CURRENT_CONTEXT(ctx);
+   GLenum error;
+
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCompressedTexImage1DARB %s %d %s %d %d %d %p\n",
+      _mesa_debug(ctx,
+                  "glCompressedTexImage%uDARB %s %d %s %d %d %d %d %d %p\n",
+                  dims,
                   _mesa_lookup_enum_by_nr(target), level,
                   _mesa_lookup_enum_by_nr(internalFormat),
-                  width, border, imageSize, data);
-
-   if (target == GL_TEXTURE_1D) {
-      /* non-proxy target */
-      struct gl_texture_object *texObj;
-      struct gl_texture_image *texImage;
-      GLenum error = compressed_texture_error_check(ctx, 1, target, level,
-                               internalFormat, width, 1, 1, border, imageSize);
-      if (error) {
-         _mesa_error(ctx, error, "glCompressedTexImage1D");
-         return;
-      }
-
-      texObj = _mesa_get_current_tex_object(ctx, target);
-
-      _mesa_lock_texture(ctx, texObj);
-      {
-        texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-        if (!texImage) {
-           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D");
-        }
-         else {
-            gl_format texFormat;
-
-            if (texImage->Data) {
-               ctx->Driver.FreeTexImageData( ctx, texImage );
-            }
-            ASSERT(texImage->Data == NULL);
-
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, GL_NONE,
-                                                    GL_NONE);
+                  width, height, depth, border, imageSize, data);
 
-            _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
-                                       border, internalFormat, texFormat);
+   /* check target */
+   if (!legal_teximage_target(ctx, dims, target)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target=%s)",
+                  dims, _mesa_lookup_enum_by_nr(target));
+      return;
+   }
 
-            ASSERT(ctx->Driver.CompressedTexImage1D);
-            ctx->Driver.CompressedTexImage1D(ctx, target, level,
-                                             internalFormat, width, border,
-                                             imageSize, data,
-                                             texObj, texImage);
+   error = compressed_texture_error_check(ctx, dims, target, level,
+                                          internalFormat, width, height, depth,
+                                          border, imageSize);
 
-            check_gen_mipmap(ctx, target, texObj, level);
+#if FEATURE_ES
+   /* XXX this is kind of a hack */
+   if (error) {
+      _mesa_error(ctx, error, "glTexImage2D");
+      return;
+   }
 
-            /* state update */
-            texObj->_Complete = GL_FALSE;
-            ctx->NewState |= _NEW_TEXTURE;
-         }
+   if (dims == 2) {
+      switch (internalFormat) {
+      case GL_PALETTE4_RGB8_OES:
+      case GL_PALETTE4_RGBA8_OES:
+      case GL_PALETTE4_R5_G6_B5_OES:
+      case GL_PALETTE4_RGBA4_OES:
+      case GL_PALETTE4_RGB5_A1_OES:
+      case GL_PALETTE8_RGB8_OES:
+      case GL_PALETTE8_RGBA8_OES:
+      case GL_PALETTE8_R5_G6_B5_OES:
+      case GL_PALETTE8_RGBA4_OES:
+      case GL_PALETTE8_RGB5_A1_OES:
+         _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
+                                          width, height, imageSize, data);
+         return;
       }
-      _mesa_unlock_texture(ctx, texObj);
    }
-   else if (target == GL_PROXY_TEXTURE_1D) {
-      /* Proxy texture: check for errors and update proxy state */
-      GLenum error = compressed_texture_error_check(ctx, 1, target, level,
-                               internalFormat, width, 1, 1, border, imageSize);
+#endif
+
+   if (_mesa_is_proxy_texture(target)) {
+      /* Proxy texture: just check for errors and update proxy state */
+      struct gl_texture_image *texImage;
+
       if (!error) {
-         ASSERT(ctx->Driver.TestProxyTexImage);
-         error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
-                                             internalFormat, GL_NONE, GL_NONE,
-                                             width, 1, 1, border);
-      }
-      if (error) {
-         /* if error, clear all proxy texture image parameters */
-         struct gl_texture_image *texImage;
-         texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-         if (texImage)
-            clear_teximage_fields(texImage);
+         struct gl_texture_object *texObj =
+            _mesa_get_current_tex_object(ctx, target);
+         gl_format texFormat =
+            _mesa_choose_texture_format(ctx, texObj, target, level,
+                                        internalFormat, GL_NONE, GL_NONE);
+         if (!legal_texture_size(ctx, texFormat, width, height, depth)) {
+            error = GL_OUT_OF_MEMORY;
+         }
       }
-      else {
-         /* store the teximage parameters */
-         struct gl_texture_object *texObj;
-         struct gl_texture_image *texImage;
-         gl_format texFormat;
 
-         texObj = _mesa_get_current_tex_object(ctx, target);
-
-        _mesa_lock_texture(ctx, texObj);
-        {
-           texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, GL_NONE,
-                                                    GL_NONE);
-           _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
-                                      border, internalFormat, texFormat);
-        }
-        _mesa_unlock_texture(ctx, texObj);
+      texImage = _mesa_get_proxy_tex_image(ctx, target, level);
+      if (texImage) {
+         if (error) {
+            /* if error, clear all proxy texture image parameters */
+            clear_teximage_fields(texImage);
+         }
+         else {
+            /* no error: store the teximage parameters */
+            _mesa_init_teximage_fields(ctx, target, texImage, width, height,
+                                       depth, border, internalFormat,
+                                       MESA_FORMAT_NONE);
+         }
       }
    }
    else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)");
-      return;
-   }
-}
-
-void GLAPIENTRY
-_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
-                              GLenum internalFormat, GLsizei width,
-                              GLsizei height, GLint border, GLsizei imageSize,
-                              const GLvoid *data)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCompressedTexImage2DARB %s %d %s %d %d %d %d %p\n",
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat),
-                  width, height, border, imageSize, data);
-
-#if FEATURE_ES
-   switch (internalFormat) {
-   case GL_PALETTE4_RGB8_OES:
-   case GL_PALETTE4_RGBA8_OES:
-   case GL_PALETTE4_R5_G6_B5_OES:
-   case GL_PALETTE4_RGBA4_OES:
-   case GL_PALETTE4_RGB5_A1_OES:
-   case GL_PALETTE8_RGB8_OES:
-   case GL_PALETTE8_RGBA8_OES:
-   case GL_PALETTE8_R5_G6_B5_OES:
-   case GL_PALETTE8_RGBA4_OES:
-   case GL_PALETTE8_RGB5_A1_OES:
-      _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
-                                      width, height, imageSize, data);
-      return;
-   }
-#endif
-
-   if (target == GL_TEXTURE_2D ||
-       (ctx->Extensions.ARB_texture_cube_map &&
-        target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
-        target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
       /* non-proxy target */
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
 
-      GLenum error = compressed_texture_error_check(ctx, 2, target, level,
-                          internalFormat, width, height, 1, border, imageSize);
       if (error) {
-         _mesa_error(ctx, error, "glCompressedTexImage2D");
+         _mesa_error(ctx, error, "glCompressedTexImage%uD", dims);
          return;
       }
 
@@ -3625,7 +3276,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
       {
         texImage = _mesa_get_tex_image(ctx, texObj, target, level);
         if (!texImage) {
-           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
+           _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                        "glCompressedTexImage%uD", dims);
         }
          else {
             gl_format texFormat;
@@ -3639,67 +3291,78 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
                                                     internalFormat, GL_NONE,
                                                     GL_NONE);
 
-            _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
-                                       border, internalFormat, texFormat);
-
-            ASSERT(ctx->Driver.CompressedTexImage2D);
-            ctx->Driver.CompressedTexImage2D(ctx, target, level,
-                                             internalFormat, width, height,
-                                             border, imageSize, data,
-                                             texObj, texImage);
+            if (legal_texture_size(ctx, texFormat, width, height, depth)) {
+               _mesa_init_teximage_fields(ctx, target, texImage,
+                                          width, height, depth,
+                                          border, internalFormat, texFormat);
+
+               switch (dims) {
+               case 1:
+                  ASSERT(ctx->Driver.CompressedTexImage1D);
+                  ctx->Driver.CompressedTexImage1D(ctx, target, level,
+                                                   internalFormat,
+                                                   width,
+                                                   border, imageSize, data,
+                                                   texObj, texImage);
+                  break;
+               case 2:
+                  ASSERT(ctx->Driver.CompressedTexImage2D);
+                  ctx->Driver.CompressedTexImage2D(ctx, target, level,
+                                                   internalFormat,
+                                                   width, height,
+                                                   border, imageSize, data,
+                                                   texObj, texImage);
+                  break;
+               case 3:
+                  ASSERT(ctx->Driver.CompressedTexImage3D);
+                  ctx->Driver.CompressedTexImage3D(ctx, target, level,
+                                                   internalFormat,
+                                                   width, height, depth,
+                                                   border, imageSize, data,
+                                                   texObj, texImage);
+                  break;
+               default:
+                  _mesa_problem(ctx, "bad dims in compressedteximage");
+               }
 
-            check_gen_mipmap(ctx, target, texObj, level);
+               check_gen_mipmap(ctx, target, texObj, level);
 
-            /* state update */
-            texObj->_Complete = GL_FALSE;
-            ctx->NewState |= _NEW_TEXTURE;
+               /* state update */
+               texObj->_Complete = GL_FALSE;
+               ctx->NewState |= _NEW_TEXTURE;
+            }
+            else {
+               _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                           "glCompressedTexImage%uD", dims);
+            }
          }
       }
       _mesa_unlock_texture(ctx, texObj);
    }
-   else if (target == GL_PROXY_TEXTURE_2D ||
-            (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB &&
-             ctx->Extensions.ARB_texture_cube_map)) {
-      /* Proxy texture: check for errors and update proxy state */
-      GLenum error = compressed_texture_error_check(ctx, 2, target, level,
-                          internalFormat, width, height, 1, border, imageSize);
-      if (!error) {
-         ASSERT(ctx->Driver.TestProxyTexImage);
-         error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
-                                              internalFormat, GL_NONE, GL_NONE,
-                                              width, height, 1, border);
-      }
-      if (error) {
-         /* if error, clear all proxy texture image parameters */
-         struct gl_texture_image *texImage;
-         texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-         if (texImage)
-            clear_teximage_fields(texImage);
-      }
-      else {
-         /* store the teximage parameters */
-         struct gl_texture_object *texObj;
-         struct gl_texture_image *texImage;
-         gl_format texFormat;
+}
 
-         texObj = _mesa_get_current_tex_object(ctx, target);
 
-        _mesa_lock_texture(ctx, texObj);
-        {
-           texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, GL_NONE,
-                                                    GL_NONE);
-           _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
-                                      border, internalFormat, texFormat);
-        }
-        _mesa_unlock_texture(ctx, texObj);
-      }
-   }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(target)");
-      return;
-   }
+void GLAPIENTRY
+_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
+                              GLenum internalFormat, GLsizei width,
+                              GLint border, GLsizei imageSize,
+                              const GLvoid *data)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   compressedteximage(ctx, 1, target, level, internalFormat,
+                      width, 1, 1, border, imageSize, data);
+}
+
+
+void GLAPIENTRY
+_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
+                              GLenum internalFormat, GLsizei width,
+                              GLsizei height, GLint border, GLsizei imageSize,
+                              const GLvoid *data)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   compressedteximage(ctx, 2, target, level, internalFormat,
+                      width, height, 1, border, imageSize, data);
 }
 
 
@@ -3710,107 +3373,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
                               GLsizei imageSize, const GLvoid *data)
 {
    GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
-   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
-      _mesa_debug(ctx, "glCompressedTexImage3DARB %s %d %s %d %d %d %d %d %p\n",
-                  _mesa_lookup_enum_by_nr(target), level,
-                  _mesa_lookup_enum_by_nr(internalFormat),
-                  width, height, depth, border, imageSize, data);
-
-   if (target == GL_TEXTURE_3D) {
-      /* non-proxy target */
-      struct gl_texture_object *texObj;
-      struct gl_texture_image *texImage;
-      GLenum error = compressed_texture_error_check(ctx, 3, target, level,
-                      internalFormat, width, height, depth, border, imageSize);
-      if (error) {
-         _mesa_error(ctx, error, "glCompressedTexImage3D");
-         return;
-      }
-
-      texObj = _mesa_get_current_tex_object(ctx, target);
-
-      _mesa_lock_texture(ctx, texObj);
-      {
-        texImage = _mesa_get_tex_image(ctx, texObj, target, level);
-        if (!texImage) {
-           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D");
-        }
-         else {
-            gl_format texFormat;
-
-            if (texImage->Data) {
-               ctx->Driver.FreeTexImageData( ctx, texImage );
-            }
-            ASSERT(texImage->Data == NULL);
-
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, GL_NONE,
-                                                    GL_NONE);
-
-            _mesa_init_teximage_fields(ctx, target, texImage,
-                                       width, height, depth,
-                                       border, internalFormat, texFormat);
-
-            ASSERT(ctx->Driver.CompressedTexImage3D);
-            ctx->Driver.CompressedTexImage3D(ctx, target, level,
-                                             internalFormat,
-                                             width, height, depth,
-                                             border, imageSize, data,
-                                             texObj, texImage);
-
-            check_gen_mipmap(ctx, target, texObj, level);
-
-            /* state update */
-            texObj->_Complete = GL_FALSE;
-            ctx->NewState |= _NEW_TEXTURE;
-         }
-      }
-      _mesa_unlock_texture(ctx, texObj);
-   }
-   else if (target == GL_PROXY_TEXTURE_3D) {
-      /* Proxy texture: check for errors and update proxy state */
-      GLenum error = compressed_texture_error_check(ctx, 3, target, level,
-                      internalFormat, width, height, depth, border, imageSize);
-      if (!error) {
-         ASSERT(ctx->Driver.TestProxyTexImage);
-         error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
-                                             internalFormat, GL_NONE, GL_NONE,
-                                             width, height, depth, border);
-      }
-      if (error) {
-         /* if error, clear all proxy texture image parameters */
-         struct gl_texture_image *texImage;
-         texImage = _mesa_get_proxy_tex_image(ctx, target, level);
-         if (texImage)
-            clear_teximage_fields(texImage);
-      }
-      else {
-         /* store the teximage parameters */
-         struct gl_texture_object *texObj;
-         struct gl_texture_image *texImage;
-         gl_format texFormat;
-
-         texObj = _mesa_get_current_tex_object(ctx, target);
-
-        _mesa_lock_texture(ctx, texObj);
-        {
-           texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-            texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
-                                                    internalFormat, GL_NONE,
-                                                    GL_NONE);
-           _mesa_init_teximage_fields(ctx, target, texImage, width, height,
-                                      depth, border, internalFormat,
-                                       texFormat);
-        }
-        _mesa_unlock_texture(ctx, texObj);
-      }
-   }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3D(target)");
-      return;
-   }
+   compressedteximage(ctx, 3, target, level, internalFormat,
+                      width, height, depth, border, imageSize, data);
 }
 
 
index 5bb9d492e932f8680a934e82b5742d5fa10ddf93..bb5509e5be679d67f376a270250ca0184d9f6baf 100644 (file)
@@ -126,6 +126,8 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 extern GLuint
 _mesa_tex_target_to_face(GLenum target);
 
+extern GLint
+_mesa_get_texture_dimensions(GLenum target);
 
 /**
  * Lock a texture for updating.  See also _mesa_lock_context_textures().
index 72dbf10cc4b40e3cd8b85cbaa24070548e99f784..f61e0237add44fd21542a8082a7d29a19cc8f8eb 100644 (file)
@@ -372,15 +372,12 @@ _mesa_reference_texobj(struct gl_texture_object **ptr,
 
 
 /**
- * Report why a texture object is incomplete.  
- *
- * \param t texture object.
- * \param why string describing why it's incomplete.
- *
- * \note For debug purposes only.
+ * Mark a texture object as incomplete.
+ * \param t  texture object
+ * \param fmt...  string describing why it's incomplete (for debugging).
  */
 static void
-incomplete(const struct gl_texture_object *t, const char *fmt, ...)
+incomplete(struct gl_texture_object *t, const char *fmt, ...)
 {
 #if 0
    va_list args;
@@ -392,6 +389,7 @@ incomplete(const struct gl_texture_object *t, const char *fmt, ...)
 
    printf("Texture Obj %d incomplete because: %s\n", t->Name, s);
 #endif
+   t->_Complete = GL_FALSE;
 }
 
 
@@ -421,14 +419,12 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
     */
    if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) {
       incomplete(t, "base level = %d is invalid", baseLevel);
-      t->_Complete = GL_FALSE;
       return;
    }
 
    /* Always need the base level image */
    if (!t->Image[0][baseLevel]) {
       incomplete(t, "Image[baseLevel=%d] == NULL", baseLevel);
-      t->_Complete = GL_FALSE;
       return;
    }
 
@@ -437,7 +433,6 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
        t->Image[0][baseLevel]->Height == 0 ||
        t->Image[0][baseLevel]->Depth == 0) {
       incomplete(t, "texture width = 0");
-      t->_Complete = GL_FALSE;
       return;
    }
 
@@ -475,6 +470,12 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
 
    ASSERT(maxLevels > 0);
 
+   if (t->MaxLevel < t->BaseLevel) {
+      incomplete(t, "MAX_LEVEL (%d) < BASE_LEVEL (%d)",
+                t->MaxLevel, t->BaseLevel);
+      return;
+   }
+
    t->_MaxLevel = baseLevel + maxLog2;
    t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel);
    t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1);
@@ -491,7 +492,6 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
          if (t->Image[face][baseLevel] == NULL ||
              t->Image[face][baseLevel]->Width2 != w ||
              t->Image[face][baseLevel]->Height2 != h) {
-            t->_Complete = GL_FALSE;
             incomplete(t, "Cube face missing or mismatched size");
             return;
          }
@@ -508,7 +508,6 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
       GLint maxLevel = t->_MaxLevel;
 
       if (minLevel > maxLevel) {
-         t->_Complete = GL_FALSE;
          incomplete(t, "minLevel > maxLevel");
          return;
       }
@@ -517,12 +516,10 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
       for (i = minLevel; i <= maxLevel; i++) {
          if (t->Image[0][i]) {
             if (t->Image[0][i]->TexFormat != t->Image[0][baseLevel]->TexFormat) {
-               t->_Complete = GL_FALSE;
                incomplete(t, "Format[i] != Format[baseLevel]");
                return;
             }
             if (t->Image[0][i]->Border != t->Image[0][baseLevel]->Border) {
-               t->_Complete = GL_FALSE;
                incomplete(t, "Border[i] != Border[baseLevel]");
                return;
             }
@@ -540,12 +537,10 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
             }
             if (i >= minLevel && i <= maxLevel) {
                if (!t->Image[0][i]) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "1D Image[0][i] == NULL");
                   return;
                }
                if (t->Image[0][i]->Width2 != width ) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "1D Image[0][i] bad width");
                   return;
                }
@@ -569,17 +564,14 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
             }
             if (i >= minLevel && i <= maxLevel) {
                if (!t->Image[0][i]) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "2D Image[0][i] == NULL");
                   return;
                }
                if (t->Image[0][i]->Width2 != width) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "2D Image[0][i] bad width");
                   return;
                }
                if (t->Image[0][i]->Height2 != height) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "2D Image[0][i] bad height");
                   return;
                }
@@ -607,26 +599,21 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
             if (i >= minLevel && i <= maxLevel) {
                if (!t->Image[0][i]) {
                   incomplete(t, "3D Image[0][i] == NULL");
-                  t->_Complete = GL_FALSE;
                   return;
                }
                if (t->Image[0][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
                   return;
                }
                if (t->Image[0][i]->Width2 != width) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "3D Image[0][i] bad width");
                   return;
                }
                if (t->Image[0][i]->Height2 != height) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "3D Image[0][i] bad height");
                   return;
                }
                if (t->Image[0][i]->Depth2 != depth) {
-                  t->_Complete = GL_FALSE;
                   incomplete(t, "3D Image[0][i] bad depth");
                   return;
                }
@@ -652,20 +639,17 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
               for (face = 0; face < 6; face++) {
                  /* check that we have images defined */
                  if (!t->Image[face][i]) {
-                    t->_Complete = GL_FALSE;
                     incomplete(t, "CubeMap Image[n][i] == NULL");
                     return;
                  }
                  /* Don't support GL_DEPTH_COMPONENT for cube maps */
                  if (t->Image[face][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
-                    t->_Complete = GL_FALSE;
                     incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
                     return;
                  }
                  /* check that all six images have same size */
                   if (t->Image[face][i]->Width2 != width || 
                       t->Image[face][i]->Height2 != height) {
-                    t->_Complete = GL_FALSE;
                     incomplete(t, "CubeMap Image[n][i] bad size");
                     return;
                  }
@@ -687,6 +671,44 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
 }
 
 
+/**
+ * Check if the given cube map texture is "cube complete" as defined in
+ * the OpenGL specification.
+ */
+GLboolean
+_mesa_cube_complete(const struct gl_texture_object *texObj)
+{
+   const GLint baseLevel = texObj->BaseLevel;
+   const struct gl_texture_image *img0, *img;
+   GLuint face;
+
+   if (texObj->Target != GL_TEXTURE_CUBE_MAP)
+      return GL_FALSE;
+
+   if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS))
+      return GL_FALSE;
+
+   /* check first face */
+   img0 = texObj->Image[0][baseLevel];
+   if (!img0 ||
+       img0->Width < 1 ||
+       img0->Width != img0->Height)
+      return GL_FALSE;
+
+   /* check remaining faces vs. first face */
+   for (face = 1; face < 6; face++) {
+      img = texObj->Image[face][baseLevel];
+      if (!img ||
+          img->Width != img0->Width ||
+          img->Height != img0->Height ||
+          img->TexFormat != img0->TexFormat)
+         return GL_FALSE;
+   }
+
+   return GL_TRUE;
+}
+
+
 /**
  * Mark a texture object dirty.  It forces the object to be incomplete
  * and optionally forces the context to re-validate its state.
index 821b35caa366f1ad790bd908af85831179e866ee..2461b063efdc97a9676ba67d6c8e63839e0890bd 100644 (file)
@@ -32,8 +32,9 @@
 #define TEXTOBJ_H
 
 
-#include "mtypes.h"
+#include "glheader.h"
 
+struct gl_context;
 
 /**
  * \name Internal functions
@@ -68,6 +69,9 @@ extern void
 _mesa_test_texobj_completeness( const struct gl_context *ctx,
                                 struct gl_texture_object *obj );
 
+extern GLboolean
+_mesa_cube_complete(const struct gl_texture_object *texObj);
+
 extern void
 _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
                    GLboolean invalidate_state);
index a25e7aa4ff88da023cc019e1c278bddc73b3e0bb..b2112f957a2ce8a8cefe70450327be9931e86c3c 100644 (file)
@@ -18,6 +18,7 @@
 #include "glheader.h"
 #include "compiler.h" /* for ASSERT */
 #include "context.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "imports.h"
 #include "pixelstore.h"
index d5c83de97f78ed730b199aeb01dddcc29f50f5cc..d2b8b5ca4ad828b3bada55af65a870003d9a1819 100644 (file)
@@ -35,6 +35,8 @@
 #include "main/context.h"
 #include "main/formats.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
 #include "main/texcompress.h"
 #include "main/texparam.h"
 #include "main/teximage.h"
index 8961b926487b9e8d3be1ecd18c687c54f2b36980..8cec24c3e247ccae5a9ad7d6068ba791cdc55fca 100644 (file)
@@ -3,6 +3,7 @@
 #include "colormac.h"
 #include "macros.h"
 #include "texfetch.h"
+#include "teximage.h"
 #include "texrender.h"
 #include "renderbuffer.h"
 
@@ -20,6 +21,7 @@ struct texture_renderbuffer
    struct gl_renderbuffer Base;   /**< Base class object */
    struct gl_texture_image *TexImage;
    StoreTexelFunc Store;
+   FetchTexelFuncF Fetchf;
    GLint Yoffset;                 /**< Layer for 1D array textures. */
    GLint Zoffset;                 /**< Layer for 2D array textures, or slice
                                   * for 3D textures
@@ -48,7 +50,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
       GLchan *rgbaOut = (GLchan *) values;
       for (i = 0; i < count; i++) {
          GLfloat rgba[4];
-         trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, rgba);
+         trb->Fetchf(trb->TexImage, x + i, y, z, rgba);
          UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
       }
    }
@@ -56,7 +58,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
       GLushort *zValues = (GLushort *) values;
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+         trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
          zValues[i] = (GLushort) (flt * 0xffff);
       }
    }
@@ -67,7 +69,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
       */
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+         trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
 #if 0
          /* this should work, but doesn't (overflow due to low precision) */
          zValues[i] = (GLuint) (flt * scale);
@@ -81,7 +83,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
       GLuint *zValues = (GLuint *) values;
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+         trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
          zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
       }
    }
@@ -89,7 +91,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
       GLuint *zValues = (GLuint *) values;
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+         trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
          zValues[i] = (GLuint) (flt * 0xffffff);
       }
    }
@@ -112,7 +114,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
       GLchan *rgbaOut = (GLchan *) values;
       for (i = 0; i < count; i++) {
          GLfloat rgba[4];
-         trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+         trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
                                    z, rgba);
          UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
       }
@@ -121,7 +123,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
       GLushort *zValues = (GLushort *) values;
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+         trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
                                    z, &flt);
          zValues[i] = (GLushort) (flt * 0xffff);
       }
@@ -130,7 +132,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
       GLuint *zValues = (GLuint *) values;
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+         trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
                                    z, &flt);
 #if 0
          zValues[i] = (GLuint) (flt * 0xffffffff);
@@ -143,7 +145,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
       GLuint *zValues = (GLuint *) values;
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+         trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
                                    z, &flt);
          zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
       }
@@ -152,7 +154,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
       GLuint *zValues = (GLuint *) values;
       for (i = 0; i < count; i++) {
          GLfloat flt;
-         trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+         trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
                                    z, &flt);
          zValues[i] = (GLuint) (flt * 0xffffff);
       }
@@ -517,8 +519,6 @@ wrap_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
    _mesa_reference_renderbuffer(&att->Renderbuffer, &(trb->Base));
 }
 
-
-
 /**
  * Update the renderbuffer wrapper for rendering to a texture.
  * For example, update the width, height of the RB based on the texture size,
@@ -542,6 +542,8 @@ update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment *
       trb->Store = store_nop;
    }
 
+   trb->Fetchf = trb->TexImage->FetchTexelf;
+
    if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) {
       trb->Yoffset = att->Zoffset;
       trb->Zoffset = 0;
@@ -582,6 +584,22 @@ update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment *
       trb->Base.DataType = GL_UNSIGNED_INT;
       trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
       break;
+   /* SRGB formats pre EXT_framebuffer_sRGB don't do sRGB translations on FBO readback */
+   case MESA_FORMAT_SRGB8:
+      trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_RGB888, _mesa_get_texture_dimensions(att->Texture->Target));
+      trb->Base.DataType = CHAN_TYPE;
+      trb->Base._BaseFormat = GL_RGBA;
+      break;
+   case MESA_FORMAT_SRGBA8:
+      trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_RGBA8888, _mesa_get_texture_dimensions(att->Texture->Target));
+      trb->Base.DataType = CHAN_TYPE;
+      trb->Base._BaseFormat = GL_RGBA;
+      break;
+   case MESA_FORMAT_SARGB8:
+      trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_ARGB8888, _mesa_get_texture_dimensions(att->Texture->Target));
+      trb->Base.DataType = CHAN_TYPE;
+      trb->Base._BaseFormat = GL_RGBA;
+      break;
    default:
       trb->Base.DataType = CHAN_TYPE;
       trb->Base._BaseFormat = GL_RGBA;
index 5e68fb03b5784184ba659de13f771dff22771449..cacd091160e77d83662516c3cdc27c80bf1dd474 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef TEXRENDER_H
 #define TEXRENDER_H
 
-#include "mtypes.h"
+struct gl_context;
+struct gl_framebuffer;
+struct gl_renderbuffer_attachment;
 
 extern void
 _mesa_render_texture(struct gl_context *ctx,
index 89677c519e5e7b35acec31beccd00cd472843f68..7dd4a1fa6506d1b3f3157a543f2b0121244c84da 100644 (file)
@@ -58,6 +58,8 @@
 #include "image.h"
 #include "macros.h"
 #include "mipmap.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "pack.h"
 #include "imports.h"
 #include "pack.h"
@@ -2038,6 +2040,132 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
 }
 
 
+static GLboolean
+_mesa_texstore_argb2101010(TEXSTORE_PARAMS)
+{
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_ARGB2101010);
+   ASSERT(texelBytes == 4);
+
+   if (!ctx->_ImageTransferState &&
+       !srcPacking->SwapBytes &&
+       dstFormat == MESA_FORMAT_ARGB2101010 &&
+       srcFormat == GL_BGRA &&
+       srcType == GL_UNSIGNED_INT_2_10_10_10_REV &&
+       baseInternalFormat == GL_RGBA) {
+      /* simple memcpy path */
+      memcpy_texture(ctx, dims,
+                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                     dstRowStride,
+                     dstImageOffsets,
+                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+                     srcAddr, srcPacking);
+   }
+   else {
+      /* general path */
+      const GLfloat *tempImage = make_temp_float_image(ctx, dims,
+                                                 baseInternalFormat,
+                                                 baseFormat,
+                                                 srcWidth, srcHeight, srcDepth,
+                                                 srcFormat, srcType, srcAddr,
+                                                 srcPacking,
+                                                 ctx->_ImageTransferState);
+      const GLfloat *src = tempImage;
+      GLint img, row, col;
+      if (!tempImage)
+         return GL_FALSE;
+      for (img = 0; img < srcDepth; img++) {
+         GLubyte *dstRow = (GLubyte *) dstAddr
+            + dstImageOffsets[dstZoffset + img] * texelBytes
+            + dstYoffset * dstRowStride
+            + dstXoffset * texelBytes;
+         if (baseInternalFormat == GL_RGBA) {
+            for (row = 0; row < srcHeight; row++) {
+               GLuint *dstUI = (GLuint *) dstRow;
+               for (col = 0; col < srcWidth; col++) {
+                  GLushort a,r,g,b;
+
+                  UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
+                  UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+                  UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+                  UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+                  dstUI[col] = PACK_COLOR_2101010_US(a, r, g, b);
+                  src += 4;
+               }
+               dstRow += dstRowStride;
+            }
+         } else if (baseInternalFormat == GL_RGB) {
+            for (row = 0; row < srcHeight; row++) {
+               GLuint *dstUI = (GLuint *) dstRow;
+               for (col = 0; col < srcWidth; col++) {
+                  GLushort r,g,b;
+
+                  UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+                  UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+                  UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+                  dstUI[col] = PACK_COLOR_2101010_US(0xffff, r, g, b);
+                  src += 4;
+               }
+               dstRow += dstRowStride;
+            }
+         } else {
+            ASSERT(0);
+         }
+      }
+      free((void *) tempImage);
+   }
+   return GL_TRUE;
+}
+
+
+/**
+ * Do texstore for 2-channel, 4-bit/channel, unsigned normalized formats.
+ */
+static GLboolean
+_mesa_texstore_unorm44(TEXSTORE_PARAMS)
+{
+   const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+   const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+   ASSERT(dstFormat == MESA_FORMAT_AL44);
+   ASSERT(texelBytes == 1);
+
+   {
+      /* general path */
+      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+                                                 baseInternalFormat,
+                                                 baseFormat,
+                                                 srcWidth, srcHeight, srcDepth,
+                                                 srcFormat, srcType, srcAddr,
+                                                 srcPacking);
+      const GLchan *src = tempImage;
+      GLint img, row, col;
+      if (!tempImage)
+         return GL_FALSE;
+      for (img = 0; img < srcDepth; img++) {
+         GLubyte *dstRow = (GLubyte *) dstAddr
+            + dstImageOffsets[dstZoffset + img] * texelBytes
+            + dstYoffset * dstRowStride
+            + dstXoffset * texelBytes;
+         for (row = 0; row < srcHeight; row++) {
+            GLubyte *dstUS = (GLubyte *) dstRow;
+            for (col = 0; col < srcWidth; col++) {
+               /* src[0] is luminance, src[1] is alpha */
+               dstUS[col] = PACK_COLOR_44( CHAN_TO_UBYTE(src[1]),
+                                           CHAN_TO_UBYTE(src[0]) );
+               src += 2;
+            }
+            dstRow += dstRowStride;
+         }
+      }
+      free((void *) tempImage);
+   }
+   return GL_TRUE;
+}
+
+
 /**
  * Do texstore for 2-channel, 8-bit/channel, unsigned normalized formats.
  */
@@ -2237,21 +2365,23 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS)
 }
 
 
+/* Texstore for R16, A16, L16, I16. */
 static GLboolean
-_mesa_texstore_r16(TEXSTORE_PARAMS)
+_mesa_texstore_unorm16(TEXSTORE_PARAMS)
 {
    const GLboolean littleEndian = _mesa_little_endian();
    const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
    const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
 
-   ASSERT(dstFormat == MESA_FORMAT_R16);
+   ASSERT(dstFormat == MESA_FORMAT_R16 ||
+          dstFormat == MESA_FORMAT_A16 ||
+          dstFormat == MESA_FORMAT_L16 ||
+          dstFormat == MESA_FORMAT_I16);
    ASSERT(texelBytes == 2);
 
    if (!ctx->_ImageTransferState &&
        !srcPacking->SwapBytes &&
-       dstFormat == MESA_FORMAT_R16 &&
-       baseInternalFormat == GL_RED &&
-       srcFormat == GL_RED &&
+       baseInternalFormat == srcFormat &&
        srcType == GL_UNSIGNED_SHORT &&
        littleEndian) {
       /* simple memcpy path */
@@ -3921,23 +4051,28 @@ texstore_funcs[MESA_FORMAT_COUNT] =
    { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 },
    { MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 },
    { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 },
+   { MESA_FORMAT_AL44, _mesa_texstore_unorm44 },
    { MESA_FORMAT_AL88, _mesa_texstore_unorm88 },
    { MESA_FORMAT_AL88_REV, _mesa_texstore_unorm88 },
    { MESA_FORMAT_AL1616, _mesa_texstore_unorm1616 },
    { MESA_FORMAT_AL1616_REV, _mesa_texstore_unorm1616 },
    { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 },
    { MESA_FORMAT_A8, _mesa_texstore_a8 },
+   { MESA_FORMAT_A16, _mesa_texstore_unorm16 },
    { MESA_FORMAT_L8, _mesa_texstore_a8 },
+   { MESA_FORMAT_L16, _mesa_texstore_unorm16 },
    { MESA_FORMAT_I8, _mesa_texstore_a8 },
+   { MESA_FORMAT_I16, _mesa_texstore_unorm16 },
    { MESA_FORMAT_CI8, _mesa_texstore_ci8 },
    { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr },
    { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr },
    { MESA_FORMAT_R8, _mesa_texstore_a8 },
    { MESA_FORMAT_RG88, _mesa_texstore_unorm88 },
    { MESA_FORMAT_RG88_REV, _mesa_texstore_unorm88 },
-   { MESA_FORMAT_R16, _mesa_texstore_r16 },
+   { MESA_FORMAT_R16, _mesa_texstore_unorm16 },
    { MESA_FORMAT_RG1616, _mesa_texstore_unorm1616 },
    { MESA_FORMAT_RG1616_REV, _mesa_texstore_unorm1616 },
+   { MESA_FORMAT_ARGB2101010, _mesa_texstore_argb2101010 },
    { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 },
    { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 },
    { MESA_FORMAT_Z16, _mesa_texstore_z16 },
index d297b5ed71234913d379774789bbf92e81dc7864..fbd70d56ca9863e3d129b6862ba6f271ab329dbe 100644 (file)
@@ -34,6 +34,8 @@
 #include "bufferobj.h"
 #include "context.h"
 #include "hash.h"
+#include "mfeatures.h"
+#include "mtypes.h"
 #include "transformfeedback.h"
 #include "shaderapi.h"
 #include "shaderobj.h"
index 752cd4e201f012e773a21ca37a93d26a42488bc5..b0d5b70f2b7104878ef262c984a730953f151b84 100644 (file)
 #ifndef TRANSFORM_FEEDBACK_H
 #define TRANSFORM_FEEDBACK_H
 
-#include "main/mtypes.h"
+#include "compiler.h"
+#include "glheader.h"
+#include "mfeatures.h"
 
+struct _glapi_table;
+struct dd_function_table;
+struct gl_context;
 
 extern void
 _mesa_init_transform_feedback(struct gl_context *ctx);
index d61856d0ebca4fda58b332f7bb195850a38b14ed..aee2e6b4e9bc52579e3154c6a3204f733e8c76a8 100644 (file)
@@ -39,6 +39,8 @@
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/dispatch.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
 #include "main/shaderapi.h"
 #include "main/shaderobj.h"
 #include "main/uniforms.h"
@@ -511,7 +513,7 @@ get_uniform_rows_cols(const struct gl_program_parameter *p,
          *cols = p->Size;
       }
       else {
-         *rows = p->Size / 4 + 1;
+         *rows = (p->Size + 3) / 4;
          if (p->Size % 4 == 0)
             *cols = 4;
          else
index 340c3fe1d39bfe9bd33f57dc51ab264b2cabcede..bcde65adc70107948b6a06f37ffdae56d290b15e 100644 (file)
@@ -33,6 +33,7 @@
 #include "hash.h"
 #include "image.h"
 #include "macros.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "varray.h"
 #include "arrayobj.h"
@@ -127,8 +128,8 @@ update_array(struct gl_context *ctx,
    GLsizei elementSize;
    GLenum format = GL_RGBA;
 
-   if (ctx->API != API_OPENGLES) {
-      /* fixed point arrays / data is only allowed with OpenGL ES 1.x */
+   if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
+      /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
       legalTypesMask &= ~FIXED_BIT;
    }
 
@@ -297,7 +298,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
                       const GLvoid *ptr)
 {
    GLbitfield legalTypes = (SHORT_BIT | INT_BIT |
-                            HALF_BIT | FLOAT_BIT | DOUBLE_BIT);
+                            HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
+                            FIXED_BIT);
    GET_CURRENT_CONTEXT(ctx);
    const GLuint unit = ctx->Array.ActiveTexture;
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
index fb96478cfc33dd2aec161a9a6f55bd6af4643386..af9324134ec77b721696eee7fe6aeee5e30909ba 100644 (file)
 #define VARRAY_H
 
 
-#include "mtypes.h"
+#include "glheader.h"
+#include "mfeatures.h"
+
+struct gl_client_array;
+struct gl_context;
 
 #if _HAVE_FULL_GL
 
index 69a28da84c63ffad7fa90dfc38222d221b41f59f..a10b86e761e29ddf1687ec58a051de9ef29a0f96 100644 (file)
@@ -22,7 +22,8 @@
  */
 
 
-#include "context.h"
+#include "imports.h"
+#include "mtypes.h"
 #include "version.h"
 
 
index 1b5350809919da0922ca7862f027b7ecf2082e2d..2e6335846e3a50ffd44e79864bcda9ee6d29d555 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.10
+ * Version:  7.11
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
@@ -33,9 +33,9 @@ struct gl_context;
 
 /* Mesa version */
 #define MESA_MAJOR 7
-#define MESA_MINOR 10
+#define MESA_MINOR 11
 #define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.10-devel"
+#define MESA_VERSION_STRING "7.11-devel"
 
 /* To make version comparison easy */
 #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
index 4747022d0b42c02aa2711925d825f02acc846625..a58697ab3704036f11848b4323e3ed99736dcb89 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "context.h"
 #include "macros.h"
+#include "mtypes.h"
 #include "viewport.h"
 
 
@@ -145,7 +146,11 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval)
    }
 }
 
-
+void GLAPIENTRY
+_mesa_DepthRangef(GLclampf nearval, GLclampf farval)
+{
+   _mesa_DepthRange(nearval, farval);
+}
 
 /** 
  * Initialize the context viewport attribute group.
index ccfa37588b8059fb9782cdb071e44a1a0e25bf8e..db4507beaaf64d599287d468eadb50045f2efd0d 100644 (file)
@@ -28,7 +28,8 @@
 #define VIEWPORT_H
 
 #include "glheader.h"
-#include "mtypes.h"
+
+struct gl_context;
 
 extern void GLAPIENTRY
 _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
@@ -42,6 +43,9 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
 extern void GLAPIENTRY
 _mesa_DepthRange(GLclampd nearval, GLclampd farval);
 
+extern void GLAPIENTRY
+_mesa_DepthRangef(GLclampf nearval, GLclampf farval);
+
 
 extern void 
 _mesa_init_viewport(struct gl_context *ctx);
index 8a72641862bb399cdda109213db0dfd7986649b0..692ce080c9f83c07eea74336afc0e18e3688ad7c 100644 (file)
@@ -30,6 +30,7 @@
 #include "api_arrayelt.h"
 #include "context.h"
 #include "imports.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 #include "vtxfmt.h"
 #include "eval.h"
index 147385cee9656dc89e24a9043a49594de727f64c..8bbc54964daa789a68fba2522a5d312e9f7fd5d3 100644 (file)
@@ -34,6 +34,7 @@
 #define _VTXFMT_H_
 
 #include "compiler.h"
+#include "mfeatures.h"
 #include "mtypes.h"
 
 #if FEATURE_beginend
index e97afafac3cb981a200c5b2ab7a15b648194c994..bbad6ef024bb20dc606e7875efbfe730ecb2eeba 100644 (file)
@@ -208,6 +208,24 @@ ALIGN16(static GLfloat, d[TEST_COUNT][4]);
 ALIGN16(static GLfloat, r[TEST_COUNT][4]);
 
 
+/**
+ * Check if X, Y or Z component of the coordinate is close to W, in terms
+ * of the clip test.
+ */
+static GLboolean
+xyz_close_to_w(const GLfloat c[4])
+{
+   float k = 0.0001;
+   return (fabs(c[0] - c[3]) < k ||
+           fabs(c[1] - c[3]) < k ||
+           fabs(c[2] - c[3]) < k ||
+           fabs(-c[0] - c[3]) < k ||
+           fabs(-c[1] - c[3]) < k ||
+           fabs(-c[2] - c[3]) < k);
+}
+
+
+
 static int test_cliptest_function( clip_func func, int np,
                                   int psize, long *cycles )
 {
@@ -281,9 +299,18 @@ static int test_cliptest_function( clip_func func, int np,
    }
    for ( i = 0 ; i < TEST_COUNT ; i++ ) {
       if ( dm[i] != rm[i] ) {
+         GLfloat *c = source->start;
+         STRIDE_F(c, source->stride * i);
+         if (psize == 4 && xyz_close_to_w(c)) {
+            /* The coordinate is very close to the clip plane.  The clipmask
+             * may vary depending on code path, but that's OK.
+             */
+            continue;
+         }
         printf( "\n-----------------------------\n" );
-        printf( "(i = %i)\n", i );
-        printf( "dm = 0x%02x   rm = 0x%02x\n", dm[i], rm[i] );
+        printf( "mask[%d] = 0x%02x   ref mask[%d] = 0x%02x\n", i, dm[i], i,rm[i] );
+         printf(" coord = %f, %f, %f, %f\n",
+                c[0], c[1], c[2], c[3]);
         return 0;
       }
    }
index 08e25a1c168c61bf1cd6bfc3959f2201b29e3346..4c0c3007205b6bcc20798b47dd6bda0022ad7108 100644 (file)
 #ifndef ARBPROGPARSE_H
 #define ARBPROGPARSE_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
+
+struct gl_context;
+struct gl_fragment_program;
+struct gl_vertex_program;
 
 extern void
 _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
index a5b17bb3284075260dab0ed8983a649bf896bded..786fdfbd231d9b71e84d1c82f8f66de6b0ff712d 100644 (file)
@@ -295,6 +295,8 @@ public:
 
    bool process_move_condition(ir_rvalue *ir);
 
+   void copy_propagate(void);
+
    void *mem_ctx;
 };
 
@@ -1574,7 +1576,13 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir)
         break;
       offset += type_size(struct_type->fields.structure[i].type);
    }
-   this->result.swizzle = swizzle_for_size(ir->type->vector_elements);
+
+   /* If the type is smaller than a vec4, replicate the last channel out. */
+   if (ir->type->is_scalar() || ir->type->is_vector())
+      this->result.swizzle = swizzle_for_size(ir->type->vector_elements);
+   else
+      this->result.swizzle = SWIZZLE_NOOP;
+
    this->result.index += offset;
 }
 
@@ -2171,9 +2179,14 @@ ir_to_mesa_visitor::visit(ir_discard *ir)
 {
    struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
 
-   assert(ir->condition == NULL); /* FINISHME */
+   if (ir->condition) {
+      ir->condition->accept(this);
+      this->result.negate = ~this->result.negate;
+      ir_to_mesa_emit_op1(ir, OPCODE_KIL, ir_to_mesa_undef_dst, this->result);
+   } else {
+      ir_to_mesa_emit_op0(ir, OPCODE_KIL_NV);
+   }
 
-   ir_to_mesa_emit_op0(ir, OPCODE_KIL_NV);
    fp->UsesKill = GL_TRUE;
 }
 
@@ -2610,6 +2623,133 @@ set_uniform_initializers(struct gl_context *ctx,
    talloc_free(mem_ctx);
 }
 
+/*
+ * On a basic block basis, tracks available PROGRAM_TEMPORARY register
+ * channels for copy propagation and updates following instructions to
+ * use the original versions.
+ *
+ * The ir_to_mesa_visitor lazily produces code assuming that this pass
+ * will occur.  As an example, a TXP production before this pass:
+ *
+ * 0: MOV TEMP[1], INPUT[4].xyyy;
+ * 1: MOV TEMP[1].w, INPUT[4].wwww;
+ * 2: TXP TEMP[2], TEMP[1], texture[0], 2D;
+ *
+ * and after:
+ *
+ * 0: MOV TEMP[1], INPUT[4].xyyy;
+ * 1: MOV TEMP[1].w, INPUT[4].wwww;
+ * 2: TXP TEMP[2], INPUT[4].xyyw, texture[0], 2D;
+ *
+ * which allows for dead code elimination on TEMP[1]'s writes.
+ */
+void
+ir_to_mesa_visitor::copy_propagate(void)
+{
+   ir_to_mesa_instruction **acp = talloc_zero_array(mem_ctx,
+                                                   ir_to_mesa_instruction *,
+                                                   this->next_temp * 4);
+
+   foreach_iter(exec_list_iterator, iter, this->instructions) {
+      ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get();
+
+      /* First, do any copy propagation possible into the src regs. */
+      for (int r = 0; r < 3; r++) {
+        ir_to_mesa_instruction *first = NULL;
+        bool good = true;
+        int acp_base = inst->src_reg[r].index * 4;
+
+        if (inst->src_reg[r].file != PROGRAM_TEMPORARY ||
+            inst->src_reg[r].reladdr)
+           continue;
+
+        /* See if we can find entries in the ACP consisting of MOVs
+         * from the same src register for all the swizzled channels
+         * of this src register reference.
+         */
+        for (int i = 0; i < 4; i++) {
+           int src_chan = GET_SWZ(inst->src_reg[r].swizzle, i);
+           ir_to_mesa_instruction *copy_chan = acp[acp_base + src_chan];
+
+           if (!copy_chan) {
+              good = false;
+              break;
+           }
+
+           if (!first) {
+              first = copy_chan;
+           } else {
+              if (first->src_reg[0].file != copy_chan->src_reg[0].file ||
+                  first->src_reg[0].index != copy_chan->src_reg[0].index) {
+                 good = false;
+                 break;
+              }
+           }
+        }
+
+        if (good) {
+           /* We've now validated that we can copy-propagate to
+            * replace this src register reference.  Do it.
+            */
+           inst->src_reg[r].file = first->src_reg[0].file;
+           inst->src_reg[r].index = first->src_reg[0].index;
+
+           int swizzle = 0;
+           for (int i = 0; i < 4; i++) {
+              int src_chan = GET_SWZ(inst->src_reg[r].swizzle, i);
+              ir_to_mesa_instruction *copy_inst = acp[acp_base + src_chan];
+              swizzle |= (GET_SWZ(copy_inst->src_reg[0].swizzle, src_chan) <<
+                          (3 * i));
+           }
+           inst->src_reg[r].swizzle = swizzle;
+        }
+      }
+
+      switch (inst->op) {
+      case OPCODE_BGNLOOP:
+      case OPCODE_ENDLOOP:
+      case OPCODE_ELSE:
+      case OPCODE_ENDIF:
+        /* End of a basic block, clear the ACP entirely. */
+        memset(acp, 0, sizeof(*acp) * this->next_temp * 4);
+        break;
+
+      default:
+        /* Continuing the block, clear any written channels from
+         * the ACP.
+         */
+        if (inst->dst_reg.file == PROGRAM_TEMPORARY) {
+           if (inst->dst_reg.reladdr) {
+              memset(acp, 0, sizeof(*acp) * this->next_temp * 4);
+           } else {
+              for (int i = 0; i < 4; i++) {
+                 if (inst->dst_reg.writemask & (1 << i)) {
+                    acp[4 * inst->dst_reg.index + i] = NULL;
+                 }
+              }
+           }
+        }
+        break;
+      }
+
+      /* If this is a copy, add it to the ACP. */
+      if (inst->op == OPCODE_MOV &&
+         inst->dst_reg.file == PROGRAM_TEMPORARY &&
+         !inst->dst_reg.reladdr &&
+         !inst->saturate &&
+         !inst->src_reg[0].reladdr &&
+         !inst->src_reg[0].negate) {
+        for (int i = 0; i < 4; i++) {
+           if (inst->dst_reg.writemask & (1 << i)) {
+              acp[4 * inst->dst_reg.index + i] = inst;
+           }
+        }
+      }
+   }
+
+   talloc_free(acp);
+}
+
 
 /**
  * Convert a shader's GLSL IR into a Mesa gl_program.
@@ -2709,6 +2849,8 @@ get_mesa_program(struct gl_context *ctx,
    mesa_instruction_annotation = talloc_array(v.mem_ctx, ir_instruction *,
                                              num_instructions);
 
+   v.copy_propagate();
+
    /* Convert ir_mesa_instructions into prog_instructions.
     */
    mesa_inst = mesa_instructions;
@@ -2849,8 +2991,9 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
         /* Lowering */
         do_mat_op_to_vec(ir);
-        lower_instructions(ir, MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
-                             | LOG_TO_LOG2);
+        lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
+                                | LOG_TO_LOG2
+                                | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
 
         progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
 
@@ -2858,8 +3001,10 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
         progress = lower_quadop_vector(ir, true) || progress;
 
-        if (options->EmitNoIfs)
-           progress = do_if_to_cond_assign(ir) || progress;
+        if (options->EmitNoIfs) {
+           progress = lower_discard(ir) || progress;
+           progress = lower_if_to_cond_assign(ir) || progress;
+        }
 
         if (options->EmitNoNoise)
            progress = lower_noise(ir) || progress;
index 7197615f94907627ac993e86573ee330e0949162..7410e149735ca3886bf543e3830eb74bc7101727 100644 (file)
 extern "C" {
 #endif
 
-#include "main/config.h"
-#include "main/mtypes.h"
+#include "main/glheader.h"
+
+struct gl_context;
+struct gl_shader;
+struct gl_shader_program;
 
 void _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *sh);
 void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
index 3e85dd2c30b75c7e53b68d0f29ebfd79a9a2977e..088e7527d5bd9ef41fba08cea44239a540450f0b 100644 (file)
 #ifndef NVFRAGPARSE_H
 #define NVFRAGPARSE_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
+
+struct gl_context;
+struct gl_fragment_program;
 
 extern void
 _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target,
index e98e867320fe8c050b836fa2e9df8b2cd40a0284..7318e14941661ea0cada03cb2044c09be60767f8 100644 (file)
 #ifndef NVVERTPARSE_H
 #define NVVERTPARSE_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
+
+struct gl_context;
+struct gl_vertex_program;
 
 extern void
 _mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target,
index 4907ae3030e5f2d12bda7cfc99be3b1c89882167..0167334827952a76c03bcb3dbfd18590af9ef0a2 100644 (file)
@@ -30,8 +30,9 @@
 #define PROG_CACHE_H
 
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 
+struct gl_context;
 
 /** Opaque type */
 struct gl_program_cache;
index c20347fe67882585566de056ee49791f99a3f04d..e7553c69dbed71622f4e898b7b3ffa4453b0d423 100644 (file)
@@ -1674,6 +1674,18 @@ _mesa_execute_program(struct gl_context * ctx,
 
             fetch_texel(ctx, machine, inst, texcoord, lodBias, color);
 
+            if (DEBUG_PROG) {
+               printf("TXB (%g, %g, %g, %g) = texture[%d][%g %g %g %g]"
+                      "  bias %g\n",
+                      color[0], color[1], color[2], color[3],
+                      inst->TexSrcUnit,
+                      texcoord[0],
+                      texcoord[1],
+                      texcoord[2],
+                      texcoord[3],
+                      lodBias);
+            }
+
             store_vector4(inst, machine, color);
          }
          break;
index ca90de7ce1c6a4295e6eef1cb17c14f5017a4ca3..a383828e34425f1c65b6802f8b7f4dcd199935c6 100644 (file)
@@ -247,7 +247,7 @@ typedef enum prog_opcode {
  * Number of bits for the src/dst register Index field.
  * This limits the size of temp/uniform register files.
  */
-#define INST_INDEX_BITS 10
+#define INST_INDEX_BITS 11
 
 
 /**
index 00f1080449b716e980900bd25a789d5d3a4c9429..463f5fc51c4a8c9ebc473934f6b265f14e3177af 100644 (file)
 
 
 #include "main/config.h"
-#include "main/mtypes.h"
+#include "main/glheader.h"
 
 
+struct gl_context;
 struct gl_program;
 struct prog_instruction;
 
index baac29ff0dd5dc3d6daea105bae86c9ffb9977c1..c310acb01d4fdc619c4b9c47ebabb63ae9a2991a 100644 (file)
@@ -572,6 +572,24 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
          value[3] = 0.0F;
          return;
 
+      case STATE_FB_WPOS_Y_TRANSFORM:
+         /* A driver may negate this conditional by using ZW swizzle
+          * instead of XY (based on e.g. some other state). */
+         if (ctx->DrawBuffer->Name != 0) {
+            /* Identity (XY) followed by flipping Y upside down (ZW). */
+            value[0] = 1.0F;
+            value[1] = 0.0F;
+            value[2] = -1.0F;
+            value[3] = (GLfloat) (ctx->DrawBuffer->Height - 1);
+         } else {
+            /* Flipping Y upside down (XY) followed by identity (ZW). */
+            value[0] = -1.0F;
+            value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
+            value[2] = 1.0F;
+            value[3] = 0.0F;
+         }
+         return;
+
       case STATE_ROT_MATRIX_0:
          {
             const int unit = (int) state[2];
@@ -695,6 +713,7 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
          return _NEW_PIXEL;
 
       case STATE_FB_SIZE:
+      case STATE_FB_WPOS_Y_TRANSFORM:
          return _NEW_BUFFERS;
 
       default:
@@ -900,6 +919,9 @@ append_token(char *dst, gl_state_index k)
    case STATE_FB_SIZE:
       append(dst, "FbSize");
       break;
+   case STATE_FB_WPOS_Y_TRANSFORM:
+      append(dst, "FbWposYTransform");
+      break;
    case STATE_ROT_MATRIX_0:
       append(dst, "rotMatrixRow0");
       break;
@@ -1046,7 +1068,9 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
  * Loop over all the parameters in a parameter list.  If the parameter
  * is a GL state reference, look up the current value of that state
  * variable and put it into the parameter's Value[4] array.
- * This would be called at glBegin time when using a fragment program.
+ * Other parameter types never change or are explicitly set by the user
+ * with glUniform() or glProgramParameter(), etc.
+ * This would be called at glBegin time.
  */
 void
 _mesa_load_state_parameters(struct gl_context *ctx,
@@ -1057,12 +1081,10 @@ _mesa_load_state_parameters(struct gl_context *ctx,
    if (!paramList)
       return;
 
-   /*assert(ctx->Driver.NeedFlush == 0);*/
-
    for (i = 0; i < paramList->NumParameters; i++) {
       if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) {
          _mesa_fetch_state(ctx,
-                          (gl_state_index *) paramList->Parameters[i].StateIndexes,
+                          paramList->Parameters[i].StateIndexes,
                            paramList->ParameterValues[i]);
       }
    }
index 6e5be53630c1517991c824dedc90c451437b6ae9..f2407af9c8758cacb503ac255d782be06661b2f4 100644 (file)
 #ifndef PROG_STATEVARS_H
 #define PROG_STATEVARS_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 
+struct gl_context;
+struct gl_program_parameter_list;
 
 /**
  * Number of STATE_* values we need to address any GL state.
@@ -117,6 +119,7 @@ typedef enum gl_state_index_ {
    STATE_PT_BIAS,               /**< Pixel transfer RGBA bias */
    STATE_SHADOW_AMBIENT,        /**< ARB_shadow_ambient fail value; token[2] is texture unit index */
    STATE_FB_SIZE,               /**< (width-1, height-1, 0, 0) */
+   STATE_FB_WPOS_Y_TRANSFORM,   /**< (1, 0, -1, height-1) if a FBO is bound, (-1, height-1, 1, 0) otherwise */
    STATE_ROT_MATRIX_0,          /**< ATI_envmap_bumpmap, rot matrix row 0 */
    STATE_ROT_MATRIX_1,          /**< ATI_envmap_bumpmap, rot matrix row 1 */
    STATE_INTERNAL_DRIVER       /* first available state index for drivers (must be last) */
index 9ffa49bb013cd81e2b63f5a2228e918d11865c15..52254e9365f9bb249303e4b857e2d3d957a509ea 100644 (file)
@@ -32,6 +32,7 @@
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/hash.h"
+#include "main/mfeatures.h"
 #include "program.h"
 #include "prog_cache.h"
 #include "prog_parameter.h"
index 09e7cb44ef399f68e7a69117ef0e47525e479b83..004f1f8fa7b535bc399fd96425cdfc060b04e4fb 100644 (file)
@@ -336,12 +336,12 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table,
     check_symbol_table(table);
 
     if (hdr == NULL) {
-        hdr = calloc(1, sizeof(*hdr));
-        hdr->name = strdup(name);
+       hdr = calloc(1, sizeof(*hdr));
+       hdr->name = strdup(name);
 
-        hash_table_insert(table->ht, hdr, hdr->name);
-       hdr->next = table->hdr;
-       table->hdr = hdr;
+       hash_table_insert(table->ht, hdr, hdr->name);
+       hdr->next = table->hdr;
+       table->hdr = hdr;
     }
 
     check_symbol_table(table);
@@ -376,6 +376,81 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table,
 }
 
 
+int
+_mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table,
+                                    int name_space, const char *name,
+                                    void *declaration)
+{
+    struct symbol_header *hdr;
+    struct symbol *sym;
+    struct symbol *curr;
+    struct scope_level *top_scope;
+
+    check_symbol_table(table);
+
+    hdr = find_symbol(table, name);
+
+    check_symbol_table(table);
+
+    if (hdr == NULL) {
+        hdr = calloc(1, sizeof(*hdr));
+        hdr->name = strdup(name);
+
+        hash_table_insert(table->ht, hdr, hdr->name);
+        hdr->next = table->hdr;
+        table->hdr = hdr;
+    }
+
+    check_symbol_table(table);
+
+    /* If the symbol already exists in this namespace at this scope, it cannot
+     * be added to the table.
+     */
+    for (sym = hdr->symbols
+        ; (sym != NULL) && (sym->name_space != name_space)
+        ; sym = sym->next_with_same_name) {
+       /* empty */
+    }
+
+    if (sym && sym->depth == 0)
+       return -1;
+
+    /* Find the top-level scope */
+    for (top_scope = table->current_scope
+        ; top_scope->next != NULL
+        ; top_scope = top_scope->next) {
+       /* empty */
+    }
+
+    sym = calloc(1, sizeof(*sym));
+    sym->next_with_same_scope = top_scope->symbols;
+    sym->hdr = hdr;
+    sym->name_space = name_space;
+    sym->data = declaration;
+
+    assert(sym->hdr == hdr);
+
+    /* Since next_with_same_name is ordered by scope, we need to append the
+     * new symbol to the _end_ of the list.
+     */
+    if (hdr->symbols == NULL) {
+       hdr->symbols = sym;
+    } else {
+       for (curr = hdr->symbols
+           ; curr->next_with_same_name != NULL
+           ; curr = curr->next_with_same_name) {
+         /* empty */
+       }
+       curr->next_with_same_name = sym;
+    }
+    top_scope->symbols = sym;
+
+    check_symbol_table(table);
+    return 0;
+}
+
+
+
 struct _mesa_symbol_table *
 _mesa_symbol_table_ctor(void)
 {
index 1d570fc1a09ecfe4364c832076280296c31a876d..f9d91649bbc13d1d36e87e80264941974cb7d4f2 100644 (file)
@@ -33,6 +33,10 @@ extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table);
 extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab,
     int name_space, const char *name, void *declaration);
 
+extern int _mesa_symbol_table_add_global_symbol(
+    struct _mesa_symbol_table *symtab, int name_space, const char *name,
+    void *declaration);
+
 extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table,
     int name_space, const char *name);
 
index e29ab46ef9985584542b01d9cc55694c6ada321a..bf160fe10809bcbe6c576918f628c69fe3618c05 100644 (file)
@@ -147,7 +147,11 @@ void st_validate_state( struct st_context *st )
 
    /*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
 
+#ifdef NDEBUG
+   if (0) {
+#else
    if (1) {
+#endif
       /* Debug version which enforces various sanity checks on the
        * state flags which are generated and checked to help ensure
        * state atoms are ordered correctly in the list.
index 8d1dc792bc84fb525b3e07963eedcfd49fbee3e0..05667a743053b59b2a751fd7b8a3cc220dab67e5 100644 (file)
@@ -56,7 +56,6 @@ void st_upload_constants( struct st_context *st,
                           unsigned shader_type)
 {
    struct pipe_context *pipe = st->pipe;
-   struct pipe_resource **cbuf = &st->state.constants[shader_type];
 
    assert(shader_type == PIPE_SHADER_VERTEX ||
           shader_type == PIPE_SHADER_FRAGMENT ||
@@ -64,17 +63,24 @@ void st_upload_constants( struct st_context *st,
 
    /* update constants */
    if (params && params->NumParameters) {
+      struct pipe_resource *cbuf;
       const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4;
 
+      /* Update the constants which come from fixed-function state, such as
+       * transformation matrices, fog factors, etc.  The rest of the values in
+       * the parameters list are explicitly set by the user with glUniform,
+       * glProgramParameter(), etc.
+       */
       _mesa_load_state_parameters(st->ctx, params);
 
       /* We always need to get a new buffer, to keep the drivers simple and
        * avoid gratuitous rendering synchronization.
+       * Let's use a user buffer to avoid an unnecessary copy.
        */
-      pipe_resource_reference(cbuf, NULL );
-      *cbuf = pipe_buffer_create(pipe->screen,
-                                PIPE_BIND_CONSTANT_BUFFER,
-                                paramBytes );
+      cbuf = pipe_user_buffer_create(pipe->screen,
+                                     params->ParameterValues,
+                                     paramBytes,
+                                     PIPE_BIND_CONSTANT_BUFFER);
 
       if (ST_DEBUG & DEBUG_CONSTANTS) {
         debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n", 
@@ -83,17 +89,15 @@ void st_upload_constants( struct st_context *st,
          _mesa_print_parameter_list(params);
       }
 
-      /* load Mesa constants into the constant buffer */
-      pipe_buffer_write(st->pipe, *cbuf,
-                                   0, paramBytes,
-                                   params->ParameterValues);
+      st->pipe->set_constant_buffer(st->pipe, shader_type, 0, cbuf);
+      pipe_resource_reference(&cbuf, NULL);
 
-      st->pipe->set_constant_buffer(st->pipe, shader_type, 0, *cbuf);
+      st->state.constants[shader_type].ptr = params->ParameterValues;
+      st->state.constants[shader_type].size = paramBytes;
    }
-   else if (*cbuf) {
-      st->constants.tracked_state[shader_type].dirty.mesa = 0x0;
-
-      pipe_resource_reference(cbuf, NULL);
+   else if (st->state.constants[shader_type].ptr) {
+      st->state.constants[shader_type].ptr = NULL;
+      st->state.constants[shader_type].size = 0;
       st->pipe->set_constant_buffer(st->pipe, shader_type, 0, NULL);
    }
 }
index 036bc60049abb044281d2a26e1a31d5b40b75fc5..2843b7b1764b321878f058bba1f833950d5eae73 100644 (file)
@@ -51,7 +51,7 @@ static void
 update_renderbuffer_surface(struct st_context *st,
                             struct st_renderbuffer *strb)
 {
-   struct pipe_screen *screen = st->pipe->screen;
+   struct pipe_context *pipe = st->pipe;
    struct pipe_resource *resource = strb->rtt->pt;
    int rtt_width = strb->Base.Width;
    int rtt_height = strb->Base.Height;
@@ -65,15 +65,19 @@ update_renderbuffer_surface(struct st_context *st,
       for (level = 0; level <= resource->last_level; level++) {
          if (u_minify(resource->width0, level) == rtt_width &&
              u_minify(resource->height0, level) == rtt_height) {
+            struct pipe_surface surf_tmpl;
+            memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+            surf_tmpl.format = resource->format;
+            surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+            surf_tmpl.u.tex.level = level;
+            surf_tmpl.u.tex.first_layer = strb->rtt_face + strb->rtt_slice;
+            surf_tmpl.u.tex.last_layer = strb->rtt_face + strb->rtt_slice;
 
             pipe_surface_reference(&strb->surface, NULL);
 
-            strb->surface = screen->get_tex_surface(screen,
-                                                   resource,
-                                                   strb->rtt_face,
-                                                   level,
-                                                   strb->rtt_slice,
-                                                   PIPE_BIND_RENDER_TARGET);
+            strb->surface = pipe->create_surface(pipe,
+                                                 resource,
+                                                 &surf_tmpl);
 #if 0
             printf("-- alloc new surface %d x %d into tex %p\n",
                    strb->surface->width, strb->surface->height,
index 6be03376d0177966e4bf06cc110bf8e23757c78c..378b30e57ccf406fd9f2f1037302063c8a332053 100644 (file)
@@ -122,8 +122,8 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
    uint i, j;
 
    transfer = pipe_get_transfer(st_context(ctx)->pipe,
-                                            pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
-                                            0, 0, texSize, texSize);
+                                pt, 0, 0, PIPE_TRANSFER_WRITE,
+                                0, 0, texSize, texSize);
    dest = (uint *) pipe_transfer_map(pipe, transfer);
 
    /* Pack four 1D maps into a 2D texture:
index f147d76808469dcf86affa59d20bd90b179ae2e8..b67068df373d7a358c701a08b7714efceda81404 100644 (file)
@@ -121,6 +121,18 @@ static void
 xlate_border_color(const GLfloat *colorIn, GLenum baseFormat, GLfloat *colorOut)
 {
    switch (baseFormat) {
+   case GL_RED:
+      colorOut[0] = colorIn[0];
+      colorOut[1] = 0.0F;
+      colorOut[2] = 0.0F;
+      colorOut[3] = 1.0F;
+      break;
+   case GL_RG:
+      colorOut[0] = colorIn[0];
+      colorOut[1] = colorIn[1];
+      colorOut[2] = 0.0F;
+      colorOut[3] = 1.0F;
+      break;
    case GL_RGB:
       colorOut[0] = colorIn[0];
       colorOut[1] = colorIn[1];
index 05442ef91b5739e51611641dacc6f2905a14d7ca..c311d04393107efa4ee882c7af49170e084ed44c 100644 (file)
 #include "st_program.h"
 
 
-
-/**
- * Translate fragment program if needed.
- */
-static void
-translate_fp(struct st_context *st,
-             struct st_fragment_program *stfp)
-{
-   if (!stfp->tgsi.tokens) {
-      assert(stfp->Base.Base.NumInstructions > 0);
-
-      st_translate_fragment_program(st, stfp);
-   }
-}
-
-/*
- * Translate geometry program if needed.
- */
-static void
-translate_gp(struct st_context *st,
-             struct st_geometry_program *stgp)
-{
-   if (!stgp->tgsi.tokens) {
-      assert(stgp->Base.Base.NumInstructions > 1);
-
-      st_translate_geometry_program(st, stgp);
-   }
-}
-
-/**
- * Find a translated vertex program that corresponds to stvp and
- * has outputs matched to stfp's inputs.
- * This performs vertex and fragment translation (to TGSI) when needed.
- */
-static struct st_vp_varient *
-find_translated_vp(struct st_context *st,
-                   struct st_vertex_program *stvp )
-{
-   struct st_vp_varient *vpv;
-   struct st_vp_varient_key key;
-
-   /* Nothing in our key yet.  This will change:
-    */
-   memset(&key, 0, sizeof key);
-
-   /* When this is true, we will add an extra input to the vertex
-    * shader translation (for edgeflags), an extra output with
-    * edgeflag semantics, and extend the vertex shader to pass through
-    * the input to the output.  We'll need to use similar logic to set
-    * up the extra vertex_element input for edgeflags.
-    * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA
-    */
-   key.passthrough_edgeflags = (st->vertdata_edgeflags && (
-                                st->ctx->Polygon.FrontMode != GL_FILL ||
-                                st->ctx->Polygon.BackMode != GL_FILL));
-
-
-   /* Do we need to throw away old translations after a change in the
-    * GL program string?
-    */
-   if (stvp->serialNo != stvp->lastSerialNo) {
-      /* These may have changed if the program string changed.
-       */
-      st_prepare_vertex_program( st, stvp );
-
-      /* We are now up-to-date:
-       */
-      stvp->lastSerialNo = stvp->serialNo;
-   }
-   
-   /* See if we've got a translated vertex program whose outputs match
-    * the fragment program's inputs.
-    */
-   for (vpv = stvp->varients; vpv; vpv = vpv->next) {
-      if (memcmp(&vpv->key, &key, sizeof key) == 0) {
-         break;
-      }
-   }
-
-   /* No?  Perform new translation here. */
-   if (!vpv) {
-      vpv = st_translate_vertex_program(st, stvp, &key);
-      if (!vpv)
-         return NULL;
-      
-      vpv->next = stvp->varients;
-      stvp->varients = vpv;
-   }
-
-   return vpv;
-}
-
-
 /**
  * Return pointer to a pass-through fragment shader.
  * This shader is used when a texture is missing/incomplete.
@@ -167,12 +74,16 @@ static void
 update_fp( struct st_context *st )
 {
    struct st_fragment_program *stfp;
+   struct st_fp_variant_key key;
 
    assert(st->ctx->FragmentProgram._Current);
    stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
    assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB);
 
-   translate_fp(st, stfp);
+   memset(&key, 0, sizeof(key));
+   key.st = st;
+
+   st->fp_variant = st_get_fp_variant(st, stfp, &key);
 
    st_reference_fragprog(st, &st->fp, stfp);
 
@@ -182,7 +93,8 @@ update_fp( struct st_context *st )
       cso_set_fragment_shader_handle(st->cso_context, fs);
    }
    else {
-      cso_set_fragment_shader_handle(st->cso_context, stfp->driver_shader);
+      cso_set_fragment_shader_handle(st->cso_context,
+                                     st->fp_variant->driver_shader);
    }
 }
 
@@ -206,6 +118,7 @@ static void
 update_vp( struct st_context *st )
 {
    struct st_vertex_program *stvp;
+   struct st_vp_variant_key key;
 
    /* find active shader and params -- Should be covered by
     * ST_NEW_VERTEX_PROGRAM
@@ -214,12 +127,26 @@ update_vp( struct st_context *st )
    stvp = st_vertex_program(st->ctx->VertexProgram._Current);
    assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
 
-   st->vp_varient = find_translated_vp(st, stvp);
+   memset(&key, 0, sizeof key);
+   key.st = st;  /* variants are per-context */
+
+   /* When this is true, we will add an extra input to the vertex
+    * shader translation (for edgeflags), an extra output with
+    * edgeflag semantics, and extend the vertex shader to pass through
+    * the input to the output.  We'll need to use similar logic to set
+    * up the extra vertex_element input for edgeflags.
+    * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA
+    */
+   key.passthrough_edgeflags = (st->vertdata_edgeflags && (
+                                st->ctx->Polygon.FrontMode != GL_FILL ||
+                                st->ctx->Polygon.BackMode != GL_FILL));
+
+   st->vp_variant = st_get_vp_variant(st, stvp, &key);
 
    st_reference_vertprog(st, &st->vp, stvp);
 
    cso_set_vertex_shader_handle(st->cso_context, 
-                                st->vp_varient->driver_shader);
+                                st->vp_variant->driver_shader);
 
    st->vertex_result_to_slot = stvp->result_to_output;
 }
@@ -231,14 +158,16 @@ const struct st_tracked_state st_update_vp = {
       _NEW_POLYGON,                                    /* mesa */
       ST_NEW_VERTEX_PROGRAM | ST_NEW_EDGEFLAGS_DATA    /* st */
    },
-   update_vp                                   /* update */
+   update_vp                                           /* update */
 };
 
+
+
 static void
 update_gp( struct st_context *st )
 {
-
    struct st_geometry_program *stgp;
+   struct st_gp_variant_key key;
 
    if (!st->ctx->GeometryProgram._Current) {
       cso_set_geometry_shader_handle(st->cso_context, NULL);
@@ -248,18 +177,22 @@ update_gp( struct st_context *st )
    stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
    assert(stgp->Base.Base.Target == MESA_GEOMETRY_PROGRAM);
 
-   translate_gp(st, stgp);
+   memset(&key, 0, sizeof(key));
+   key.st = st;
+
+   st->gp_variant = st_get_gp_variant(st, stgp, &key);
 
    st_reference_geomprog(st, &st->gp, stgp);
 
-   cso_set_geometry_shader_handle(st->cso_context, stgp->driver_shader);
+   cso_set_geometry_shader_handle(st->cso_context,
+                                  st->gp_variant->driver_shader);
 }
 
 const struct st_tracked_state st_update_gp = {
-   "st_update_gp",                                     /* name */
-   {                                                   /* dirty */
-      0,                                               /* mesa */
-      ST_NEW_GEOMETRY_PROGRAM                           /* st */
+   "st_update_gp",                     /* name */
+   {                                   /* dirty */
+      0,                               /* mesa */
+      ST_NEW_GEOMETRY_PROGRAM           /* st */
    },
-   update_gp                                   /* update */
+   update_gp                           /* update */
 };
index 6c5caf42e354330164671a2124b639535ed36851..35921f4f614dfd9156a4b1e53c525c34e96bd664 100644 (file)
@@ -33,6 +33,7 @@
 #include "main/imports.h"
 #include "main/image.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 
 #include "st_debug.h"
 #include "st_context.h"
@@ -138,10 +139,10 @@ accum_accum(struct st_context *st, GLfloat value,
       debug_printf("%s: fallback processing\n", __FUNCTION__);
 
    color_trans = pipe_get_transfer(st->pipe,
-                                               color_strb->texture,
-                                               0, 0, 0,
-                                               PIPE_TRANSFER_READ, xpos, ypos,
-                                               width, height);
+                                   color_strb->texture,
+                                   0, 0,
+                                   PIPE_TRANSFER_READ, xpos, ypos,
+                                   width, height);
 
    buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
@@ -187,9 +188,9 @@ accum_load(struct st_context *st, GLfloat value,
       debug_printf("%s: fallback processing\n", __FUNCTION__);
 
    color_trans = pipe_get_transfer(st->pipe, color_strb->texture,
-                                               0, 0, 0,
-                                               PIPE_TRANSFER_READ, xpos, ypos,
-                                               width, height);
+                                   0, 0,
+                                   PIPE_TRANSFER_READ, xpos, ypos,
+                                   width, height);
 
    buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 
@@ -241,12 +242,12 @@ accum_return(struct gl_context *ctx, GLfloat value,
       usage = PIPE_TRANSFER_READ_WRITE;
    else
       usage = PIPE_TRANSFER_WRITE;
-   
+
    color_trans = pipe_get_transfer(st_context(ctx)->pipe,
-                                               color_strb->texture, 0, 0, 0,
-                                               usage,
-                                               xpos, ypos,
-                                               width, height);
+                                   color_strb->texture, 0, 0,
+                                   usage,
+                                   xpos, ypos,
+                                   width, height);
 
    if (usage & PIPE_TRANSFER_READ)
       pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
index b8c9c350031c229d212d50f805f07c9c2a166211..050a21483e4993e099de6c04fab1411db4fcfb37 100644 (file)
 #define ST_CB_ACCUM_H
 
 
-#include "main/mtypes.h"
+#include "main/mfeatures.h"
+
+struct dd_function_table;
+struct gl_context;
+struct gl_renderbuffer;
 
 #if FEATURE_accum
 
index 3c0ee6c288387fafb21398eeb006e5294b28514a..e23fe86daebc3a88a07ca9b8a3adbd87a7a31ff9 100644 (file)
@@ -34,6 +34,7 @@
 #include "main/image.h"
 #include "main/bufferobj.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "program/program.h"
 #include "program/prog_print.h"
 
@@ -185,48 +186,47 @@ find_free_bit(uint bitfield)
 
 /**
  * Combine basic bitmap fragment program with the user-defined program.
+ * \param st  current context
+ * \param fpIn  the incoming fragment program
+ * \param fpOut  the new fragment program which does fragment culling
+ * \param bitmap_sampler  sampler number for the bitmap texture
  */
-static struct st_fragment_program *
-combined_bitmap_fragment_program(struct gl_context *ctx)
+void
+st_make_bitmap_fragment_program(struct st_context *st,
+                                struct gl_fragment_program *fpIn,
+                                struct gl_fragment_program **fpOut,
+                                GLuint *bitmap_sampler)
 {
-   struct st_context *st = st_context(ctx);
-   struct st_fragment_program *stfp = st->fp;
-
-   if (!stfp->bitmap_program) {
-      /*
-       * Generate new program which is the user-defined program prefixed
-       * with the bitmap sampler/kill instructions.
-       */
-      struct st_fragment_program *bitmap_prog;
-      uint sampler;
-
-      sampler = find_free_bit(st->fp->Base.Base.SamplersUsed);
-      bitmap_prog = make_bitmap_fragment_program(ctx, sampler);
+   struct st_fragment_program *bitmap_prog;
+   struct gl_program *newProg;
+   uint sampler;
 
-      stfp->bitmap_program = (struct st_fragment_program *)
-         _mesa_combine_programs(ctx,
-                                &bitmap_prog->Base.Base, &stfp->Base.Base);
-      stfp->bitmap_program->bitmap_sampler = sampler;
+   /*
+    * Generate new program which is the user-defined program prefixed
+    * with the bitmap sampler/kill instructions.
+    */
+   sampler = find_free_bit(fpIn->Base.SamplersUsed);
+   bitmap_prog = make_bitmap_fragment_program(st->ctx, sampler);
 
-      /* done with this after combining */
-      st_reference_fragprog(st, &bitmap_prog, NULL);
+   newProg = _mesa_combine_programs(st->ctx,
+                                    &bitmap_prog->Base.Base,
+                                    &fpIn->Base);
+   /* done with this after combining */
+   st_reference_fragprog(st, &bitmap_prog, NULL);
 
 #if 0
-      {
-         struct gl_program *p = &stfp->bitmap_program->Base.Base;
-         printf("Combined bitmap program:\n");
-         _mesa_print_program(p);
-         printf("InputsRead: 0x%x\n", p->InputsRead);
-         printf("OutputsWritten: 0x%x\n", p->OutputsWritten);
-         _mesa_print_parameter_list(p->Parameters);
-      }
-#endif
-
-      /* translate to TGSI tokens */
-      st_translate_fragment_program(st, stfp->bitmap_program);
+   {
+      printf("Combined bitmap program:\n");
+      _mesa_print_program(newProg);
+      printf("InputsRead: 0x%x\n", newProg->InputsRead);
+      printf("OutputsWritten: 0x%x\n", newProg->OutputsWritten);
+      _mesa_print_parameter_list(newProg->Parameters);
    }
+#endif
 
-   return stfp->bitmap_program;
+   /* return results */
+   *fpOut = (struct gl_fragment_program *) newProg;
+   *bitmap_sampler = sampler;
 }
 
 
@@ -283,9 +283,9 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
       return NULL;
    }
 
-   transfer = pipe_get_transfer(st->pipe, pt, 0, 0, 0,
-                                          PIPE_TRANSFER_WRITE,
-                                          0, 0, width, height);
+   transfer = pipe_get_transfer(st->pipe, pt, 0, 0,
+                                PIPE_TRANSFER_WRITE,
+                                0, 0, width, height);
 
    dest = pipe_transfer_map(pipe, transfer);
 
@@ -349,7 +349,8 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized,
    if (!st->bitmap.vbuf) {
       st->bitmap.vbuf = pipe_buffer_create(pipe->screen, 
                                            PIPE_BIND_VERTEX_BUFFER,
-                                           max_slots * sizeof(st->bitmap.vertices));
+                                           max_slots *
+                                           sizeof(st->bitmap.vertices));
    }
 
    /* Positions are in clip coords since we need to do clipping in case
@@ -389,10 +390,11 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized,
 
    /* put vertex data into vbuf */
    pipe_buffer_write_nooverlap(st->pipe,
-                                           st->bitmap.vbuf,
-                                           st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
-                                           sizeof st->bitmap.vertices,
-                                           st->bitmap.vertices);
+                               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;
 }
@@ -411,11 +413,16 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
    struct cso_context *cso = st->cso_context;
-   struct st_fragment_program *stfp;
+   struct st_fp_variant *fpv;
+   struct st_fp_variant_key key;
    GLuint maxSize;
    GLuint offset;
 
-   stfp = combined_bitmap_fragment_program(ctx);
+   memset(&key, 0, sizeof(key));
+   key.st = st;
+   key.bitmap = GL_TRUE;
+
+   fpv = st_get_fp_variant(st, st->fp, &key);
 
    /* As an optimization, Mesa's fragment programs will sometimes get the
     * primary color from a statevar/constant rather than a varying variable.
@@ -428,7 +435,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
       GLfloat colorSave[4];
       COPY_4V(colorSave, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
       COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color);
-      st_upload_constants(st, stfp->Base.Base.Parameters, PIPE_SHADER_FRAGMENT);
+      st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
       COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], colorSave);
    }
 
@@ -437,7 +444,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
    /* XXX if the bitmap is larger than the max texture size, break
     * it up into chunks.
     */
-   maxSize = 1 << (pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+   maxSize = 1 << (pipe->screen->get_param(pipe->screen,
+                                    PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
    assert(width <= (GLsizei)maxSize);
    assert(height <= (GLsizei)maxSize);
 
@@ -454,7 +462,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
    cso_set_rasterizer(cso, &st->bitmap.rasterizer);
 
    /* fragment shader state: TEX lookup program */
-   cso_set_fragment_shader_handle(cso, stfp->driver_shader);
+   cso_set_fragment_shader_handle(cso, fpv->driver_shader);
 
    /* vertex shader state: position + texcoord pass-through */
    cso_set_vertex_shader_handle(cso, st->bitmap.vs);
@@ -462,21 +470,22 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
    /* user samplers, plus our bitmap sampler */
    {
       struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
-      uint num = MAX2(stfp->bitmap_sampler + 1, st->state.num_samplers);
+      uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_samplers);
       uint i;
       for (i = 0; i < st->state.num_samplers; i++) {
          samplers[i] = &st->state.samplers[i];
       }
-      samplers[stfp->bitmap_sampler] = &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
+      samplers[fpv->bitmap_sampler] =
+         &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
       cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers);
    }
 
    /* user textures, plus the bitmap texture */
    {
       struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
-      uint num = MAX2(stfp->bitmap_sampler + 1, st->state.num_textures);
+      uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_textures);
       memcpy(sampler_views, st->state.sampler_views, sizeof(sampler_views));
-      sampler_views[stfp->bitmap_sampler] = sv;
+      sampler_views[fpv->bitmap_sampler] = sv;
       cso_set_fragment_sampler_views(cso, num, sampler_views);
    }
 
@@ -504,7 +513,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
    z = z * 2.0 - 1.0;
 
    /* draw textured quad */
-   offset = setup_bitmap_vertex_data(st, sv->texture->target != PIPE_TEXTURE_RECT, x, y, width, height, z, color);
+   offset = setup_bitmap_vertex_data(st,
+                                     sv->texture->target != PIPE_TEXTURE_RECT,
+                                     x, y, width, height, z, color);
 
    util_draw_vertex_buffer(pipe, st->bitmap.vbuf, offset,
                            PIPE_PRIM_TRIANGLE_FAN,
@@ -573,6 +584,9 @@ print_cache(const struct bitmap_cache *cache)
 }
 
 
+/**
+ * Create gallium pipe_transfer object for the bitmap cache.
+ */
 static void
 create_cache_trans(struct st_context *st)
 {
@@ -585,10 +599,10 @@ create_cache_trans(struct st_context *st)
    /* Map the texture transfer.
     * Subsequent glBitmap calls will write into the texture image.
     */
-   cache->trans = pipe_get_transfer(st->pipe, cache->texture, 0, 0, 0,
-                                              PIPE_TRANSFER_WRITE, 0, 0,
-                                              BITMAP_CACHE_WIDTH,
-                                              BITMAP_CACHE_HEIGHT);
+   cache->trans = pipe_get_transfer(st->pipe, cache->texture, 0, 0,
+                                    PIPE_TRANSFER_WRITE, 0, 0,
+                                    BITMAP_CACHE_WIDTH,
+                                    BITMAP_CACHE_HEIGHT);
    cache->buffer = pipe_transfer_map(pipe, cache->trans);
 
    /* init image to all 0xff */
@@ -651,7 +665,9 @@ st_flush_bitmap_cache(struct st_context *st)
    }
 }
 
-/* Flush bitmap cache and release vertex buffer.
+
+/**
+ * Flush bitmap cache and release vertex buffer.
  */
 void
 st_flush_bitmap( struct st_context *st )
@@ -737,7 +753,8 @@ accum_bitmap(struct st_context *st,
  * Called via ctx->Driver.Bitmap()
  */
 static void
-st_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
+st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
+          GLsizei width, GLsizei height,
           const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap )
 {
    struct st_context *st = st_context(ctx);
@@ -764,7 +781,8 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei heigh
 
    pt = make_bitmap_texture(ctx, width, height, unpack, bitmap);
    if (pt) {
-      struct pipe_sampler_view *sv = st_create_texture_sampler_view(st->pipe, pt);
+      struct pipe_sampler_view *sv =
+         st_create_texture_sampler_view(st->pipe, pt);
 
       assert(pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT);
 
@@ -814,15 +832,18 @@ st_init_bitmap(struct st_context *st)
    st->bitmap.rasterizer.gl_rasterization_rules = 1;
 
    /* find a usable texture format */
-   if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 0,
+   if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM,
+                                   PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
       st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
    }
-   else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 0,
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM,
+                                        PIPE_TEXTURE_2D, 0,
                                         PIPE_BIND_SAMPLER_VIEW, 0)) {
       st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
    }
-   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 0,
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM,
+                                        PIPE_TEXTURE_2D, 0,
                                         PIPE_BIND_SAMPLER_VIEW, 0)) {
       st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
    }
@@ -845,8 +866,6 @@ st_destroy_bitmap(struct st_context *st)
    struct pipe_context *pipe = st->pipe;
    struct bitmap_cache *cache = st->bitmap.cache;
 
-
-
    if (st->bitmap.vs) {
       cso_delete_vertex_shader(st->cso_context, st->bitmap.vs);
       st->bitmap.vs = NULL;
index d04b2b677957e74f9dbf0ef6795963c621bf6f7d..ed1415803767f90a77eb4e095f7e67a0c95c27c7 100644 (file)
 
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 struct st_context;
+struct gl_fragment_program;
+struct st_fragment_program;
 
 #if FEATURE_drawpix
 
@@ -46,6 +49,12 @@ st_init_bitmap(struct st_context *st);
 extern void
 st_destroy_bitmap(struct st_context *st);
 
+extern void
+st_make_bitmap_fragment_program(struct st_context *st,
+                                struct gl_fragment_program *fpIn,
+                                struct gl_fragment_program **fpOut,
+                                GLuint *bitmap_sampler);
+
 extern void
 st_flush_bitmap_cache(struct st_context *st);
 
index af41835326a855412f14024af6c2e34b8a36f6b6..6d02a7dccd477e5284ec1723990aaf5530311d4c 100644 (file)
@@ -33,6 +33,7 @@
 #include "main/imports.h"
 #include "main/image.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 
 #include "st_context.h"
 #include "st_texture.h"
@@ -40,7 +41,6 @@
 #include "st_cb_fbo.h"
 
 #include "util/u_blit.h"
-#include "util/u_inlines.h"
 
 
 void
@@ -115,17 +115,14 @@ st_BlitFramebuffer(struct gl_context *ctx,
             st_texture_object(srcAtt->Texture);
          struct st_renderbuffer *dstRb =
             st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
-         struct pipe_subresource srcSub;
          struct pipe_surface *dstSurf = dstRb->surface;
 
          if (!srcObj->pt)
             return;
 
-         srcSub.face = srcAtt->CubeMapFace;
-         srcSub.level = srcAtt->TextureLevel;
-
-         util_blit_pixels(st->blit, srcObj->pt, srcSub,
-                          srcX0, srcY0, srcX1, srcY1, srcAtt->Zoffset,
+         util_blit_pixels(st->blit, srcObj->pt, srcAtt->TextureLevel,
+                          srcX0, srcY0, srcX1, srcY1,
+                          srcAtt->Zoffset + srcAtt->CubeMapFace,
                           dstSurf, dstX0, dstY0, dstX1, dstY1,
                           0.0, pFilter);
       }
@@ -136,14 +133,11 @@ st_BlitFramebuffer(struct gl_context *ctx,
             st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
          struct pipe_surface *srcSurf = srcRb->surface;
          struct pipe_surface *dstSurf = dstRb->surface;
-         struct pipe_subresource srcSub;
-
-         srcSub.face = srcSurf->face;
-         srcSub.level = srcSurf->level;
 
          util_blit_pixels(st->blit,
-                          srcRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1,
-                          srcSurf->zslice,
+                          srcRb->texture, srcSurf->u.tex.level,
+                          srcX0, srcY0, srcX1, srcY1,
+                          srcSurf->u.tex.first_layer,
                           dstSurf, dstX0, dstY0, dstX1, dstY1,
                           0.0, pFilter);
       }
@@ -176,11 +170,11 @@ st_BlitFramebuffer(struct gl_context *ctx,
          /* Blitting depth and stencil values between combined
           * depth/stencil buffers.  This is the ideal case for such buffers.
           */
-         util_blit_pixels(st->blit, srcDepthRb->texture,
-                          u_subresource(srcDepthRb->surface->face,
-                                        srcDepthRb->surface->level),
+         util_blit_pixels(st->blit,
+                          srcDepthRb->texture,
+                          srcDepthRb->surface->u.tex.level,
                           srcX0, srcY0, srcX1, srcY1,
-                          srcDepthRb->surface->zslice,
+                          srcDepthRb->surface->u.tex.first_layer,
                           dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
                           0.0, pFilter);
       }
@@ -189,10 +183,9 @@ st_BlitFramebuffer(struct gl_context *ctx,
 
          if (mask & GL_DEPTH_BUFFER_BIT) {
             util_blit_pixels(st->blit, srcDepthRb->texture,
-                             u_subresource(srcDepthRb->surface->face,
-                                           srcDepthRb->surface->level),
+                             srcDepthRb->surface->u.tex.level,
                              srcX0, srcY0, srcX1, srcY1,
-                             srcDepthRb->surface->zslice,
+                             srcDepthRb->surface->u.tex.first_layer,
                              dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
                              0.0, pFilter);
          }
index c230652cefce25f76c4955b2a79b85d1e1228c5e..c6d9a367955de5ad4d0e1d486838bd8ccf90a398 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 struct st_context;
index 27540c36ce7013ddd56a265831ab30b01685d246..d4d9af4ada385fb15e2c759e42307f4e97293e58 100644 (file)
@@ -210,6 +210,13 @@ st_bufferobj_data(struct gl_context *ctx,
 }
 
 
+/**
+ * Dummy data whose's pointer is used for zero size buffers or ranges.
+ */
+static long st_bufferobj_zero_length = 0;
+
+
+
 /**
  * Called via glMapBufferARB().
  */
@@ -233,10 +240,16 @@ st_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access,
       break;      
    }
 
-   obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
-                                  st_obj->buffer,
-                                  flags,
-                                  &st_obj->transfer);
+   /* Handle zero-size buffers here rather than in drivers */
+   if (obj->Size == 0) {
+      obj->Pointer = &st_bufferobj_zero_length;
+   }
+   else {
+      obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
+                                     st_obj->buffer,
+                                     flags,
+                                     &st_obj->transfer);
+   }
 
    if (obj->Pointer) {
       obj->Offset = 0;
@@ -246,13 +259,6 @@ st_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access,
 }
 
 
-/**
- * Dummy data whose's pointer is used for zero length ranges.
- */
-static long
-st_bufferobj_zero_length_range = 0;
-
-
 /**
  * Called via glMapBufferRange().
  */
@@ -273,6 +279,12 @@ st_bufferobj_map_range(struct gl_context *ctx, GLenum target,
 
    if (access & GL_MAP_FLUSH_EXPLICIT_BIT)
       flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;
+
+   if (access & GL_MAP_INVALIDATE_RANGE_BIT)
+      flags |= PIPE_TRANSFER_DISCARD;
+
+   if (access & GL_MAP_INVALIDATE_BUFFER_BIT)
+      flags |= PIPE_TRANSFER_DISCARD;
    
    if (access & GL_MAP_UNSYNCHRONIZED_BIT)
       flags |= PIPE_TRANSFER_UNSYNCHRONIZED;
@@ -293,7 +305,7 @@ st_bufferobj_map_range(struct gl_context *ctx, GLenum target,
     * length range from the pipe driver.
     */
    if (!length) {
-      obj->Pointer = &st_bufferobj_zero_length_range;
+      obj->Pointer = &st_bufferobj_zero_length;
    }
    else {
       obj->Pointer = pipe_buffer_map_range(pipe, 
@@ -348,7 +360,7 @@ st_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_objec
    struct st_buffer_object *st_obj = st_buffer_object(obj);
 
    if (obj->Length)
-      pipe_buffer_unmap(pipe, st_obj->buffer, st_obj->transfer);
+      pipe_buffer_unmap(pipe, st_obj->transfer);
 
    st_obj->transfer = NULL;
    obj->Pointer = NULL;
@@ -397,8 +409,8 @@ st_copy_buffer_subdata(struct gl_context *ctx,
    if (srcPtr && dstPtr)
       memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
 
-   pipe_buffer_unmap(pipe, srcObj->buffer, src_transfer);
-   pipe_buffer_unmap(pipe, dstObj->buffer, dst_transfer);
+   pipe_buffer_unmap(pipe, src_transfer);
+   pipe_buffer_unmap(pipe, dst_transfer);
 }
 
 
index bd1dd78b23c8c54fe2ffda174188fd803f1201d7..6571bf237fbd6e969643bc0f7c5f91dc5cfad45f 100644 (file)
@@ -470,13 +470,9 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
          if (mask & (1 << b)) {
             struct gl_renderbuffer *rb
                = ctx->DrawBuffer->Attachment[b].Renderbuffer;
-            struct st_renderbuffer *strb;
+            struct st_renderbuffer *strb = st_renderbuffer(rb);
 
-            assert(rb);
-
-            strb = st_renderbuffer(rb);
-
-            if (!strb->surface)
+            if (!strb || !strb->surface)
                continue;
 
             if (check_clear_color_with_quad( ctx, rb ))
index d80c068ea813546525eaa40dad34c7533521c352..d128ff98f02d0da7e4b73501478017ffb6c85a67 100644 (file)
@@ -34,6 +34,8 @@
 #include "main/image.h"
 #include "main/bufferobj.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
 #include "main/pack.h"
 #include "main/texformat.h"
 #include "main/texstore.h"
@@ -94,88 +96,61 @@ is_passthrough_program(const struct gl_fragment_program *prog)
 /**
  * Make fragment shader for glDraw/CopyPixels.  This shader is made
  * by combining the pixel transfer shader with the user-defined shader.
- * \return pointer to Gallium driver fragment shader
+ * \param fpIn  the current/incoming fragment program
+ * \param fpOut  returns the combined fragment program
  */
-static void *
-combined_drawpix_fragment_program(struct gl_context *ctx)
+void
+st_make_drawpix_fragment_program(struct st_context *st,
+                                 struct gl_fragment_program *fpIn,
+                                 struct gl_fragment_program **fpOut)
 {
-   struct st_context *st = st_context(ctx);
-   struct st_fragment_program *stfp;
+   struct gl_program *newProg;
 
-   if (st->pixel_xfer.program->serialNo == st->pixel_xfer.xfer_prog_sn
-       && st->fp->serialNo == st->pixel_xfer.user_prog_sn) {
-      /* the pixel tranfer program has not changed and the user-defined
-       * program has not changed, so re-use the combined program.
-       */
-      stfp = st->pixel_xfer.combined_prog;
+   if (is_passthrough_program(fpIn)) {
+      newProg = (struct gl_program *) _mesa_clone_fragment_program(st->ctx,
+                                             &st->pixel_xfer.program->Base);
    }
    else {
-      /* Concatenate the pixel transfer program with the current user-
-       * defined program.
-       */
-      if (is_passthrough_program(&st->fp->Base)) {
-         stfp = (struct st_fragment_program *)
-            _mesa_clone_fragment_program(ctx, &st->pixel_xfer.program->Base);
-      }
-      else {
 #if 0
-         printf("Base program:\n");
-         _mesa_print_program(&st->fp->Base.Base);
-         printf("DrawPix program:\n");
-         _mesa_print_program(&st->pixel_xfer.program->Base.Base);
+      /* debug */
+      printf("Base program:\n");
+      _mesa_print_program(&fpIn->Base);
+      printf("DrawPix program:\n");
+      _mesa_print_program(&st->pixel_xfer.program->Base.Base);
 #endif
-         stfp = (struct st_fragment_program *)
-            _mesa_combine_programs(ctx,
-                                   &st->pixel_xfer.program->Base.Base,
-                                   &st->fp->Base.Base);
-      }
+      newProg = _mesa_combine_programs(st->ctx,
+                                       &st->pixel_xfer.program->Base.Base,
+                                       &fpIn->Base);
+   }
 
 #if 0
-      {
-         struct gl_program *p = &stfp->Base.Base;
-         printf("Combined DrawPixels program:\n");
-         _mesa_print_program(p);
-         printf("InputsRead: 0x%x\n", p->InputsRead);
-         printf("OutputsWritten: 0x%x\n", p->OutputsWritten);
-         _mesa_print_parameter_list(p->Parameters);
-      }
+   /* debug */
+   printf("Combined DrawPixels program:\n");
+   _mesa_print_program(newProg);
+   printf("InputsRead: 0x%x\n", newProg->InputsRead);
+   printf("OutputsWritten: 0x%x\n", newProg->OutputsWritten);
+   _mesa_print_parameter_list(newProg->Parameters);
 #endif
 
-      /* translate to TGSI tokens */
-      st_translate_fragment_program(st, stfp);
-
-      /* save new program, update serial numbers */
-      st->pixel_xfer.xfer_prog_sn = st->pixel_xfer.program->serialNo;
-      st->pixel_xfer.user_prog_sn = st->fp->serialNo;
-      st->pixel_xfer.combined_prog_sn = stfp->serialNo;
-      /* can't reference new program directly, already have a reference on it */
-      st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
-      st->pixel_xfer.combined_prog = stfp;
-   }
-
-   /* Ideally we'd have updated the pipe constants during the normal
-    * st/atom mechanism.  But we can't since this is specific to glDrawPixels.
-    */
-   st_upload_constants(st, stfp->Base.Base.Parameters, PIPE_SHADER_FRAGMENT);
-
-   return stfp->driver_shader;
+   *fpOut = (struct gl_fragment_program *) newProg;
 }
 
 
 /**
- * Create fragment shader that does a TEX() instruction to get a Z and/or
+ * Create fragment program that does a TEX() instruction to get a Z and/or
  * stencil value value, then writes to FRAG_RESULT_DEPTH/FRAG_RESULT_STENCIL.
  * Used for glDrawPixels(GL_DEPTH_COMPONENT / GL_STENCIL_INDEX).
  * Pass fragment color through as-is.
- * \return pointer to the Gallium driver fragment shader
+ * \return pointer to the gl_fragment program
  */
-static void *
-make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth,
-                               GLboolean write_stencil)
+struct gl_fragment_program *
+st_make_drawpix_z_stencil_program(struct st_context *st,
+                                  GLboolean write_depth,
+                                  GLboolean write_stencil)
 {
    struct gl_context *ctx = st->ctx;
    struct gl_program *p;
-   struct st_fragment_program *stp;
+   struct gl_fragment_program *fp;
    GLuint ic = 0;
    const GLuint shaderIndex = write_depth * 2 + write_stencil;
 
@@ -183,7 +158,7 @@ make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth,
 
    if (st->drawpix.shaders[shaderIndex]) {
       /* already have the proper shader */
-      return st->drawpix.shaders[shaderIndex]->driver_shader;
+      return st->drawpix.shaders[shaderIndex];
    }
 
    /*
@@ -245,18 +220,15 @@ make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth,
    if (write_stencil)
       p->SamplersUsed |= 1 << 1;
 
-   stp = st_fragment_program((struct gl_fragment_program *) p);
+   fp = (struct gl_fragment_program *) p;
 
    /* save the new shader */
-   st->drawpix.shaders[shaderIndex] = stp;
+   st->drawpix.shaders[shaderIndex] = fp;
 
-   st_translate_fragment_program(st, stp);
-
-   return stp->driver_shader;
+   return fp;
 }
 
 
-
 /**
  * Create a simple vertex shader that just passes through the
  * vertex position and texcoord (and optionally, color).
@@ -427,9 +399,9 @@ make_texture(struct st_context *st,
       /* we'll do pixel transfer in a fragment shader */
       ctx->_ImageTransferState = 0x0;
 
-      transfer = pipe_get_transfer(st->pipe, pt, 0, 0, 0,
-                                             PIPE_TRANSFER_WRITE, 0, 0,
-                                             width, height);
+      transfer = pipe_get_transfer(st->pipe, pt, 0, 0,
+                                   PIPE_TRANSFER_WRITE, 0, 0,
+                                   width, height);
 
       /* map texture transfer */
       dest = pipe_transfer_map(pipe, transfer);
@@ -763,9 +735,9 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
    else
       usage = PIPE_TRANSFER_WRITE;
 
-   pt = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, 0, 0, 0,
-                                      usage, x, y,
-                                      width, height);
+   pt = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, 0, 0,
+                                     usage, x, y,
+                                     width, height);
 
    stmap = pipe_transfer_map(pipe, pt);
 
@@ -872,6 +844,61 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
 }
 
 
+/**
+ * Get fragment program variant for a glDrawPixels or glCopyPixels
+ * command for RGBA data.
+ */
+static struct st_fp_variant *
+get_color_fp_variant(struct st_context *st)
+{
+   struct gl_context *ctx = st->ctx;
+   struct st_fp_variant_key key;
+   struct st_fp_variant *fpv;
+
+   memset(&key, 0, sizeof(key));
+
+   key.st = st;
+   key.drawpixels = 1;
+   key.scaleAndBias = (ctx->Pixel.RedBias != 0.0 ||
+                       ctx->Pixel.RedScale != 1.0 ||
+                       ctx->Pixel.GreenBias != 0.0 ||
+                       ctx->Pixel.GreenScale != 1.0 ||
+                       ctx->Pixel.BlueBias != 0.0 ||
+                       ctx->Pixel.BlueScale != 1.0 ||
+                       ctx->Pixel.AlphaBias != 0.0 ||
+                       ctx->Pixel.AlphaScale != 1.0);
+   key.pixelMaps = ctx->Pixel.MapColorFlag;
+
+   fpv = st_get_fp_variant(st, st->fp, &key);
+
+   return fpv;
+}
+
+
+/**
+ * Get fragment program variant for a glDrawPixels or glCopyPixels
+ * command for depth/stencil data.
+ */
+static struct st_fp_variant *
+get_depth_stencil_fp_variant(struct st_context *st, GLboolean write_depth,
+                             GLboolean write_stencil)
+{
+   struct st_fp_variant_key key;
+   struct st_fp_variant *fpv;
+
+   memset(&key, 0, sizeof(key));
+
+   key.st = st;
+   key.drawpixels = 1;
+   key.drawpixels_z = write_depth;
+   key.drawpixels_stencil = write_stencil;
+
+   fpv = st_get_fp_variant(st, st->fp, &key);
+
+   return fpv;
+}
+
+
 /**
  * Called via ctx->Driver.DrawPixels()
  */
@@ -889,6 +916,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
    struct pipe_sampler_view *sv[2];
    int num_sampler_view = 1;
    enum pipe_format stencil_format = PIPE_FORMAT_NONE;
+   struct st_fp_variant *fpv;
 
    if (format == GL_DEPTH_STENCIL)
       write_stencil = write_depth = GL_TRUE;
@@ -921,14 +949,25 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
 
    st_validate_state(st);
 
+   /*
+    * Get vertex/fragment shaders
+    */
    if (write_depth || write_stencil) {
-      driver_fp = make_fragment_shader_z_stencil(st, write_depth, write_stencil);
+      fpv = get_depth_stencil_fp_variant(st, write_depth, write_stencil);
+
+      driver_fp = fpv->driver_shader;
+
       driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
+
       color = ctx->Current.RasterColor;
    }
    else {
-      driver_fp = combined_drawpix_fragment_program(ctx);
+      fpv = get_color_fp_variant(st);
+
+      driver_fp = fpv->driver_shader;
+
       driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
+
       color = NULL;
       if (st->pixel_xfer.pixelmap_enabled) {
          sv[1] = st->pixel_xfer.pixelmap_sampler_view;
@@ -936,6 +975,9 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
       }
    }
 
+   /* update fragment program constants */
+   st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
+
    /* draw with textured quad */
    {
       struct pipe_resource *pt
@@ -1025,15 +1067,15 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
       usage = PIPE_TRANSFER_READ_WRITE;
    else
       usage = PIPE_TRANSFER_WRITE;
-   
+
    if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
       dsty = rbDraw->Base.Height - dsty - height;
    }
 
    ptDraw = pipe_get_transfer(st_context(ctx)->pipe,
-                                          rbDraw->texture, 0, 0, 0,
-                                          usage, dstx, dsty,
-                                          width, height);
+                              rbDraw->texture, 0, 0,
+                              usage, dstx, dsty,
+                              width, height);
 
    assert(util_format_get_blockwidth(ptDraw->resource->format) == 1);
    assert(util_format_get_blockheight(ptDraw->resource->format) == 1);
@@ -1116,6 +1158,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
    GLint readX, readY, readW, readH;
    GLuint sample_count;
    struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
+   struct st_fp_variant *fpv;
 
    st_validate_state(st);
 
@@ -1125,11 +1168,18 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
       return;
    }
 
+   /*
+    * Get vertex/fragment shaders
+    */
    if (type == GL_COLOR) {
       rbRead = st_get_color_read_renderbuffer(ctx);
       color = NULL;
-      driver_fp = combined_drawpix_fragment_program(ctx);
+
+      fpv = get_color_fp_variant(st);
+      driver_fp = fpv->driver_shader;
+
       driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
+
       if (st->pixel_xfer.pixelmap_enabled) {
          sv[1] = st->pixel_xfer.pixelmap_sampler_view;
          num_sampler_view++;
@@ -1139,10 +1189,17 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
       assert(type == GL_DEPTH);
       rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
       color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
-      driver_fp = make_fragment_shader_z_stencil(st, GL_TRUE, GL_FALSE);
+
+      fpv = get_depth_stencil_fp_variant(st, GL_TRUE, GL_FALSE);
+      driver_fp = fpv->driver_shader;
+
       driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
    }
 
+   /* update fragment program constants */
+   st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
+
+
    if (rbRead->Base.Wrapped)
       rbRead = st_renderbuffer(rbRead->Base.Wrapped);
 
@@ -1209,27 +1266,24 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
    /* Make temporary texture which is a copy of the src region.
     */
    if (srcFormat == texFormat) {
-      struct pipe_subresource srcsub, dstsub;
-      srcsub.face = 0;
-      srcsub.level = 0;
-      dstsub.face = 0;
-      dstsub.level = 0;
-      /* copy source framebuffer surface into mipmap/texture */
+      struct pipe_box src_box;
+      u_box_2d(readX, readY, readW, readH, &src_box);
+    /* copy source framebuffer surface into mipmap/texture */
       pipe->resource_copy_region(pipe,
                                  pt,                                /* dest tex */
-                                 dstsub,
+                                 0,
                                  pack.SkipPixels, pack.SkipRows, 0, /* dest pos */
                                  rbRead->texture,                   /* src tex */
-                                 srcsub,
-                                 readX, readY, 0, readW, readH);    /* src region */
+                                 0,
+                                 &src_box);
 
    }
    else {
       /* CPU-based fallback/conversion */
       struct pipe_transfer *ptRead =
-         pipe_get_transfer(st->pipe, rbRead->texture, 0, 0, 0,
-                                        PIPE_TRANSFER_READ,
-                                        readX, readY, readW, readH);
+         pipe_get_transfer(st->pipe, rbRead->texture, 0, 0,
+                           PIPE_TRANSFER_READ,
+                           readX, readY, readW, readH);
       struct pipe_transfer *ptTex;
       enum pipe_transfer_usage transfer_usage;
 
@@ -1241,8 +1295,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
       else
          transfer_usage = PIPE_TRANSFER_WRITE;
 
-      ptTex = pipe_get_transfer(st->pipe, pt, 0, 0, 0, transfer_usage,
-                                             0, 0, width, height);
+      ptTex = pipe_get_transfer(st->pipe, pt, 0, 0, transfer_usage,
+                                0, 0, width, height);
 
       /* copy image from ptRead surface to ptTex surface */
       if (type == GL_COLOR) {
@@ -1297,7 +1351,7 @@ st_destroy_drawpix(struct st_context *st)
 
    for (i = 0; i < Elements(st->drawpix.shaders); i++) {
       if (st->drawpix.shaders[i])
-         st_reference_fragprog(st, &st->drawpix.shaders[i], NULL);
+         _mesa_reference_fragprog(st->ctx, &st->drawpix.shaders[i], NULL);
    }
 
    st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
index 575f169e08e70234e0d3360777fa9e72abb09900..44d7f5ed1e7ee9f51a7ace5629e53ae6c747e4e9 100644 (file)
@@ -31,6 +31,7 @@
 
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 struct st_context;
@@ -42,6 +43,16 @@ extern void st_init_drawpixels_functions(struct dd_function_table *functions);
 extern void
 st_destroy_drawpix(struct st_context *st);
 
+extern void
+st_make_drawpix_fragment_program(struct st_context *st,
+                                 struct gl_fragment_program *fpIn,
+                                 struct gl_fragment_program **fpOut);
+
+extern struct gl_fragment_program *
+st_make_drawpix_z_stencil_program(struct st_context *st,
+                                  GLboolean write_depth,
+                                  GLboolean write_stencil);
+
 #else
 
 static INLINE void
index 6cad7d3216e5a46f485083f6c34f77f14f7d85ac..b540a79331bb05b6fac13beeb340a8194ca02e57 100644 (file)
@@ -15,6 +15,7 @@
 #include "main/imports.h"
 #include "main/image.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "program/program.h"
 #include "program/prog_print.h"
 
@@ -220,7 +221,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
          }
       }
 
-      pipe_buffer_unmap(pipe, vbuffer, vbuffer_transfer);
+      pipe_buffer_unmap(pipe, vbuffer_transfer);
 
 #undef SET_ATTRIB
    }
index d21262f89770871dcb264f66051c246569b26ce4..455da04e674ddae97f63279071826c5136d030c2 100644 (file)
@@ -11,6 +11,7 @@
 
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 struct st_context;
index c4b84de790c3867a9b8f8f84e9223ce027b83b4e..dfde821fc19ced24dc53a1ada89e265265e93b46 100644 (file)
@@ -26,6 +26,7 @@
  *    Chia-I Wu <olv@lunarg.com>
  */
 
+#include "main/mfeatures.h"
 #include "main/texobj.h"
 #include "main/texfetch.h"
 #include "main/teximage.h"
index b6e44d5aff58d3b1772d12d0623396e5352b5835..48567ed9da52bddc720d79a6bcae9df187440b63 100644 (file)
@@ -30,6 +30,7 @@
 #define ST_CB_EGLIMAGE_H
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 
index 9425f07aee617d753999983681e59795fd6a0c5f..0c7641f86236266dd2904b944d9d22a62f3f8f06 100644 (file)
@@ -38,6 +38,7 @@
 #include "main/fbobject.h"
 #include "main/framebuffer.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/renderbuffer.h"
 
 #include "pipe/p_context.h"
@@ -52,6 +53,7 @@
 
 #include "util/u_format.h"
 #include "util/u_inlines.h"
+#include "util/u_surface.h"
 
 
 /**
  * during window resize.
  */
 static GLboolean
-st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
+st_renderbuffer_alloc_storage(struct gl_context * ctx,
+                              struct gl_renderbuffer *rb,
                               GLenum internalFormat,
                               GLuint width, GLuint height)
 {
    struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
    struct pipe_screen *screen = st->pipe->screen;
    struct st_renderbuffer *strb = st_renderbuffer(rb);
    enum pipe_format format;
+   struct pipe_surface surf_tmpl;
 
    if (strb->format != PIPE_FORMAT_NONE)
       format = strb->format;
    else
-      format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples);
+      format = st_choose_renderbuffer_format(screen, internalFormat,
+                                             rb->NumSamples);
       
    /* init renderbuffer fields */
    strb->Base.Width  = width;
@@ -113,6 +119,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *r
       template.width0 = width;
       template.height0 = height;
       template.depth0 = 1;
+      template.array_size = 1;
       template.last_level = 0;
       template.nr_samples = rb->NumSamples;
       if (util_format_is_depth_or_stencil(format)) {
@@ -120,7 +127,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *r
       }
       else {
          template.bind = (PIPE_BIND_DISPLAY_TARGET |
-                         PIPE_BIND_RENDER_TARGET);
+                          PIPE_BIND_RENDER_TARGET);
       }
 
       strb->texture = screen->resource_create(screen, &template);
@@ -128,10 +135,11 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *r
       if (!strb->texture) 
          return FALSE;
 
-      strb->surface = screen->get_tex_surface(screen,
-                                              strb->texture,
-                                              0, 0, 0,
-                                              template.bind);
+      memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+      u_surface_default_template(&surf_tmpl, strb->texture, template.bind);
+      strb->surface = pipe->create_surface(pipe,
+                                           strb->texture,
+                                           &surf_tmpl);
       if (strb->surface) {
          assert(strb->surface->texture);
          assert(strb->surface->format);
@@ -327,12 +335,12 @@ st_render_texture(struct gl_context *ctx,
 {
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
-   struct pipe_screen *screen = pipe->screen;
    struct st_renderbuffer *strb;
    struct gl_renderbuffer *rb;
    struct pipe_resource *pt = st_get_texobj_resource(att->Texture);
    struct st_texture_object *stObj;
    const struct gl_texture_image *texImage;
+   struct pipe_surface surf_tmpl;
 
    /* When would this fail?  Perhaps assert? */
    if (!pt) 
@@ -381,12 +389,15 @@ st_render_texture(struct gl_context *ctx,
    assert(strb->rtt_level <= strb->texture->last_level);
 
    /* new surface for rendering into the texture */
-   strb->surface = screen->get_tex_surface(screen,
-                                           strb->texture,
-                                           strb->rtt_face,
-                                           strb->rtt_level,
-                                           strb->rtt_slice,
-                                           PIPE_BIND_RENDER_TARGET);
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   surf_tmpl.format = strb->texture->format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = strb->rtt_level;
+   surf_tmpl.u.tex.first_layer = strb->rtt_face + strb->rtt_slice;
+   surf_tmpl.u.tex.last_layer = strb->rtt_face + strb->rtt_slice;
+   strb->surface = pipe->create_surface(pipe,
+                                        strb->texture,
+                                        &surf_tmpl);
 
    strb->format = pt->format;
 
index 5c01856f03381f67ec222a2f861e3b5ee63f6bd0..9b85a39beddf62ca0e94d9caf020f48620ce05d4 100644 (file)
@@ -40,6 +40,7 @@
 #include "main/imports.h"
 #include "main/context.h"
 #include "main/feedback.h"
+#include "main/mfeatures.h"
 
 #include "vbo/vbo.h"
 
index f2342f582385a7a431af88a05fef251b94cab7af..02e34e4027135609fae40f8daf8b8c2056b7c3ec 100644 (file)
@@ -31,6 +31,7 @@
 
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 
index 4d83fcc6ccb053c78337aa23004bcf6c1c54ea43..32694975d1722204c9d66bf1b5f0fd430ab84e37 100644 (file)
 #include "st_cb_program.h"
 
 
-static GLuint SerialNo = 1;
-
 
 /**
  * Called via ctx->Driver.BindProgram() to bind an ARB vertex or
  * fragment program.
  */
-static void st_bind_program( struct gl_context *ctx,
-                            GLenum target, 
-                            struct gl_program *prog )
+static void
+st_bind_program(struct gl_context *ctx, GLenum target, struct gl_program *prog)
 {
    struct st_context *st = st_context(ctx);
 
@@ -77,7 +74,8 @@ static void st_bind_program( struct gl_context *ctx,
  * Called via ctx->Driver.UseProgram() to bind a linked GLSL program
  * (vertex shader + fragment shader).
  */
-static void st_use_program( struct gl_context *ctx, struct gl_shader_program *shProg)
+static void
+st_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
 {
    struct st_context *st = st_context(ctx);
 
@@ -87,48 +85,28 @@ static void st_use_program( struct gl_context *ctx, struct gl_shader_program *sh
 }
 
 
-
 /**
  * Called via ctx->Driver.NewProgram() to allocate a new vertex or
  * fragment program.
  */
-static struct gl_program *st_new_program( struct gl_context *ctx,
-                                         GLenum target,
-                                         GLuint id )
+static struct gl_program *
+st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
 {
    switch (target) {
    case GL_VERTEX_PROGRAM_ARB: {
       struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program);
-
-      prog->serialNo = SerialNo++;
-
-      return _mesa_init_vertex_program( ctx, 
-                                       &prog->Base,
-                                       target, 
-                                       id );
+      return _mesa_init_vertex_program(ctx, &prog->Base, target, id);
    }
 
    case GL_FRAGMENT_PROGRAM_ARB:
    case GL_FRAGMENT_PROGRAM_NV: {
       struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
-
-      prog->serialNo = SerialNo++;
-
-      return _mesa_init_fragment_program( ctx, 
-                                         &prog->Base,
-                                         target, 
-                                         id );
+      return _mesa_init_fragment_program(ctx, &prog->Base, target, id);
    }
 
    case MESA_GEOMETRY_PROGRAM: {
       struct st_geometry_program *prog = ST_CALLOC_STRUCT(st_geometry_program);
-
-      prog->serialNo = SerialNo++;
-
-      return _mesa_init_geometry_program( ctx,
-                                          &prog->Base,
-                                          target,
-                                          id );
+      return _mesa_init_geometry_program(ctx, &prog->Base, target, id);
    }
 
    default:
@@ -138,7 +116,10 @@ static struct gl_program *st_new_program( struct gl_context *ctx,
 }
 
 
-void
+/**
+ * Called via ctx->Driver.DeleteProgram()
+ */
+static void
 st_delete_program(struct gl_context *ctx, struct gl_program *prog)
 {
    struct st_context *st = st_context(ctx);
@@ -147,17 +128,15 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
    case GL_VERTEX_PROGRAM_ARB:
       {
          struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
-         st_vp_release_varients( st, stvp );
+         st_release_vp_variants( st, stvp );
       }
       break;
    case MESA_GEOMETRY_PROGRAM:
       {
-         struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
+         struct st_geometry_program *stgp =
+            (struct st_geometry_program *) prog;
 
-         if (stgp->driver_shader) {
-            cso_delete_geometry_shader(st->cso_context, stgp->driver_shader);
-            stgp->driver_shader = NULL;
-         }
+         st_release_gp_variants(st, stgp);
 
          if (stgp->tgsi.tokens) {
             st_free_tokens((void *) stgp->tgsi.tokens);
@@ -167,23 +146,15 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
       break;
    case GL_FRAGMENT_PROGRAM_ARB:
       {
-         struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
+         struct st_fragment_program *stfp =
+            (struct st_fragment_program *) prog;
 
-         if (stfp->driver_shader) {
-            cso_delete_fragment_shader(st->cso_context, stfp->driver_shader);
-            stfp->driver_shader = NULL;
-         }
+         st_release_fp_variants(st, stfp);
          
          if (stfp->tgsi.tokens) {
             st_free_tokens(stfp->tgsi.tokens);
             stfp->tgsi.tokens = NULL;
          }
-
-         if (stfp->bitmap_program) {
-            struct gl_program *prg = &stfp->bitmap_program->Base.Base;
-            _mesa_reference_program(ctx, &prg, NULL);
-            stfp->bitmap_program = NULL;
-         }
       }
       break;
    default:
@@ -195,15 +166,25 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
 }
 
 
-static GLboolean st_is_program_native( struct gl_context *ctx,
-                                      GLenum target, 
-                                      struct gl_program *prog )
+/**
+ * Called via ctx->Driver.IsProgramNative()
+ */
+static GLboolean
+st_is_program_native(struct gl_context *ctx,
+                     GLenum target, 
+                     struct gl_program *prog)
 {
    return GL_TRUE;
 }
 
 
-static GLboolean st_program_string_notify( struct gl_context *ctx,
+/**
+ * Called via ctx->Driver.ProgramStringNotify()
+ * Called when the program's text/code is changed.  We have to free
+ * all shader variants and corresponding gallium shaders when this happens.
+ */
+static GLboolean
+st_program_string_notify( struct gl_context *ctx,
                                            GLenum target,
                                            struct gl_program *prog )
 {
@@ -212,12 +193,7 @@ static GLboolean st_program_string_notify( struct gl_context *ctx,
    if (target == GL_FRAGMENT_PROGRAM_ARB) {
       struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
 
-      stfp->serialNo++;
-
-      if (stfp->driver_shader) {
-         cso_delete_fragment_shader(st->cso_context, stfp->driver_shader);
-         stfp->driver_shader = NULL;
-      }
+      st_release_fp_variants(st, stfp);
 
       if (stfp->tgsi.tokens) {
          st_free_tokens(stfp->tgsi.tokens);
@@ -230,12 +206,7 @@ static GLboolean st_program_string_notify( struct gl_context *ctx,
    else if (target == MESA_GEOMETRY_PROGRAM) {
       struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
 
-      stgp->serialNo++;
-
-      if (stgp->driver_shader) {
-         cso_delete_geometry_shader(st->cso_context, stgp->driver_shader);
-         stgp->driver_shader = NULL;
-      }
+      st_release_gp_variants(st, stgp);
 
       if (stgp->tgsi.tokens) {
          st_free_tokens((void *) stgp->tgsi.tokens);
@@ -248,9 +219,7 @@ static GLboolean st_program_string_notify( struct gl_context *ctx,
    else if (target == GL_VERTEX_PROGRAM_ARB) {
       struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
 
-      stvp->serialNo++;
-
-      st_vp_release_varients( st, stvp );
+      st_release_vp_variants( st, stvp );
 
       if (st->vp == stvp)
         st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
@@ -261,8 +230,11 @@ static GLboolean st_program_string_notify( struct gl_context *ctx,
 }
 
 
-
-void st_init_program_functions(struct dd_function_table *functions)
+/**
+ * Plug in the program and shader-related device driver functions.
+ */
+void
+st_init_program_functions(struct dd_function_table *functions)
 {
    functions->BindProgram = st_bind_program;
    functions->UseProgram = st_use_program;
index 004afb6d81206cf633bbbe7d5f7d2164c4ae4479..091a4439c48d55940988a9172ec3d91f97fce002 100644 (file)
 #define ST_CB_PROGRAM_H
 
 
-#include "main/mtypes.h"
-
 struct dd_function_table;
 
 extern void
 st_init_program_functions(struct dd_function_table *functions);
 
-extern void
-st_delete_program(struct gl_context *ctx, struct gl_program *prog);
-
 
 #endif
index aa31b3710b594f9bcc806cc358c1494de5b604d3..d0ac253bcecd9ebfe55fa241e3309be3dccc0ae0 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "main/imports.h"
 #include "main/context.h"
+#include "main/mfeatures.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
@@ -84,6 +85,8 @@ st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
 
    /* convert GL query type to Gallium query type */
    switch (q->Target) {
+   case GL_ANY_SAMPLES_PASSED:
+      /* fall-through */
    case GL_SAMPLES_PASSED_ARB:
       type = PIPE_QUERY_OCCLUSION_COUNTER;
       break;
index 017471b0b0655651ae9affc0a213db3355e85a14..03f0be8372b400f75c6629232f3d5256f1380194 100644 (file)
@@ -29,6 +29,7 @@
 #define ST_CB_QUERYOBJ_H
 
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 
 /**
index 15a4f602d1d777a422e4719c397b79ba0c1fc44f..32d465c5cceee5399c67054120409493337855c6 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/feedback.h"
 
 #include "st_context.h"
index 2dc109bb184528ac91b863c52590296c05aef6ef..b61411bd20c46bcbc5c79d8df4ee2b39e18e7d24 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 
index bcd46ac9d54a5a277f37a64e44427d9051734ec9..0507be745783be12d689ce7c19eabe5d01876a63 100644 (file)
@@ -80,7 +80,7 @@ st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
    /* Create a read transfer from the renderbuffer's texture */
 
    pt = pipe_get_transfer(pipe, strb->texture,
-                          0, 0, 0,  /* face, level, zslice */
+                          0, 0,
                           PIPE_TRANSFER_READ,
                           x, y, width, height);
 
@@ -236,7 +236,7 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
       }
 
       trans = pipe_get_transfer(pipe, strb->texture,
-                                0, 0, 0,  /* face, level, zslice */
+                                0, 0,
                                 PIPE_TRANSFER_READ,
                                 x, y, width, height);
       if (!trans) {
@@ -328,7 +328,7 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
 {
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
-   GLfloat temp[MAX_WIDTH][4];
+   GLfloat (*temp)[4];
    const GLbitfield transferOps = ctx->_ImageTransferState;
    GLsizei i, j;
    GLint yStep, dfStride;
@@ -381,6 +381,13 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
       return;
    }
 
+   /* allocate temp pixel row buffer */
+   temp = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
+   if (!temp) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
+      return;
+   }
+
    if (format == GL_RGBA && type == GL_FLOAT) {
       /* write tile(row) directly into user's buffer */
       df = (GLfloat *) _mesa_image_address2d(&clippedPacking, dest, width,
@@ -400,7 +407,7 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
 
    /* Create a read transfer from the renderbuffer's texture */
    trans = pipe_get_transfer(pipe, strb->texture,
-                             0, 0, 0,  /* face, level, zslice */
+                             0, 0,
                              PIPE_TRANSFER_READ,
                              x, y, width, height);
 
@@ -533,6 +540,8 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
       }
    }
 
+   free(temp);
+
    pipe->transfer_destroy(pipe, trans);
 
    _mesa_unmap_pbo_dest(ctx, &clippedPacking);
index 83c9b659e3da3648bde1e6eec550f9e406af7e69..9622ae6feea17ac734aca51b0fb0a1eee19e401a 100644 (file)
 #ifndef ST_CB_READPIXELS_H
 #define ST_CB_READPIXELS_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 
 struct dd_function_table;
+struct gl_context;
+struct gl_pixelstore_attrib;
 
 extern struct st_renderbuffer *
 st_get_color_read_renderbuffer(struct gl_context *ctx);
index 15e69e1fa076e4bf776931254986adb5af8a850a..09a10ba58196d121fb6c48013094043a16b30d82 100644 (file)
@@ -63,7 +63,7 @@
 #include "util/u_surface.h"
 #include "util/u_sampler.h"
 #include "util/u_math.h"
-
+#include "util/u_box.h"
 
 #define DBG if (0) printf
 
@@ -431,7 +431,7 @@ compress_with_blit(struct gl_context * ctx,
    struct pipe_resource *src_tex;
    struct pipe_sampler_view view_templ;
    struct pipe_sampler_view *src_view;
-   struct pipe_surface *dst_surface;
+   struct pipe_surface *dst_surface, surf_tmpl;
    struct pipe_transfer *tex_xfer;
    void *map;
 
@@ -441,9 +441,13 @@ compress_with_blit(struct gl_context * ctx,
    }
 
    /* get destination surface (in the compressed texture) */
-   dst_surface = screen->get_tex_surface(screen, stImage->pt,
-                                         stImage->face, stImage->level, 0,
-                                         0 /* flags */);
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   surf_tmpl.format = stImage->pt->format;
+   surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+   surf_tmpl.u.tex.level = stImage->level;
+   surf_tmpl.u.tex.first_layer = stImage->face;
+   surf_tmpl.u.tex.last_layer = stImage->face;
+   dst_surface = pipe->create_surface(pipe, stImage->pt, &surf_tmpl);
    if (!dst_surface) {
       /* can't render into this format (or other problem) */
       return GL_FALSE;
@@ -464,6 +468,7 @@ compress_with_blit(struct gl_context * ctx,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
    templ.usage = PIPE_USAGE_DEFAULT;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -475,9 +480,9 @@ compress_with_blit(struct gl_context * ctx,
    /* Put user's tex data into the temporary texture
     */
    tex_xfer = pipe_get_transfer(st_context(ctx)->pipe, src_tex,
-                                            0, 0, 0, /* face, level are zero */
-                                            PIPE_TRANSFER_WRITE,
-                                            0, 0, width, height); /* x, y, w, h */
+                                0, 0, /* layer, level are zero */
+                                PIPE_TRANSFER_WRITE,
+                                0, 0, width, height); /* x, y, w, h */
    map = pipe_transfer_map(pipe, tex_xfer);
 
    _mesa_texstore(ctx, 2, GL_RGBA, mesa_format,
@@ -857,7 +862,6 @@ decompress_with_blit(struct gl_context * ctx, GLenum target, GLint level,
 {
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
-   struct pipe_screen *screen = pipe->screen;
    struct st_texture_image *stImage = st_texture_image(texImage);
    struct st_texture_object *stObj = st_texture_object(texObj);
    struct pipe_sampler_view *src_view =
@@ -871,7 +875,7 @@ decompress_with_blit(struct gl_context * ctx, GLenum target, GLint level,
                    PIPE_BIND_TRANSFER_READ);
 
    /* create temp / dest surface */
-   if (!util_create_rgba_surface(screen, width, height, bind,
+   if (!util_create_rgba_surface(pipe, width, height, bind,
                                  &dst_texture, &dst_surface)) {
       _mesa_problem(ctx, "util_create_rgba_surface() failed "
                     "in decompress_with_blit()");
@@ -891,9 +895,9 @@ decompress_with_blit(struct gl_context * ctx, GLenum target, GLint level,
 
    /* map the dst_surface so we can read from it */
    tex_xfer = pipe_get_transfer(st_context(ctx)->pipe,
-                                            dst_texture, 0, 0, 0,
-                                            PIPE_TRANSFER_READ,
-                                            0, 0, width, height);
+                                dst_texture, 0, 0,
+                                PIPE_TRANSFER_READ,
+                                0, 0, width, height);
 
    pixels = _mesa_map_pbo_dest(ctx, &ctx->Pack, pixels);
 
@@ -1310,7 +1314,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level,
    struct pipe_transfer *src_trans;
    GLvoid *texDest;
    enum pipe_transfer_usage transfer_usage;
-   
+
    if (ST_DEBUG & DEBUG_FALLBACK)
       debug_printf("%s: fallback processing\n", __FUNCTION__);
 
@@ -1321,11 +1325,11 @@ fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level,
    }
 
    src_trans = pipe_get_transfer(st_context(ctx)->pipe,
-                                              strb->texture,
-                                              0, 0, 0,
-                                              PIPE_TRANSFER_READ,
-                                              srcX, srcY,
-                                              width, height);
+                                 strb->texture,
+                                 0, 0,
+                                 PIPE_TRANSFER_READ,
+                                 srcX, srcY,
+                                 width, height);
 
    if ((baseFormat == GL_DEPTH_COMPONENT ||
         baseFormat == GL_DEPTH_STENCIL) &&
@@ -1334,7 +1338,8 @@ fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level,
    else
       transfer_usage = PIPE_TRANSFER_WRITE;
 
-   texDest = st_texture_image_map(st, stImage, 0, transfer_usage,
+   /* XXX this used to ignore destZ param */
+   texDest = st_texture_image_map(st, stImage, destZ, transfer_usage,
                                   destX, destY, width, height);
 
    if (baseFormat == GL_DEPTH_COMPONENT ||
@@ -1523,6 +1528,9 @@ st_copy_texsubimage(struct gl_context *ctx,
    if (texBaseFormat == GL_DEPTH_COMPONENT ||
        texBaseFormat == GL_DEPTH_STENCIL) {
       strb = st_renderbuffer(fb->_DepthBuffer);
+      if (strb->Base.Wrapped) {
+         strb = st_renderbuffer(strb->Base.Wrapped);
+      }
    }
    else {
       /* texBaseFormat == GL_RGB, GL_RGBA, GL_ALPHA, etc */
@@ -1592,27 +1600,23 @@ st_copy_texsubimage(struct gl_context *ctx,
 
       if (matching_base_formats &&
           src_format == dest_format &&
-          !do_flip) 
+          !do_flip)
       {
          /* use surface_copy() / blit */
-         struct pipe_subresource subdst, subsrc;
-         subdst.face = stImage->face;
-         subdst.level = stImage->level;
-         subsrc.face = strb->surface->face;
-         subsrc.level = strb->surface->level;
+         struct pipe_box src_box;
+         u_box_2d_zslice(srcX, srcY, strb->surface->u.tex.first_layer,
+                         width, height, &src_box);
 
          /* for resource_copy_region(), y=0=top, always */
          pipe->resource_copy_region(pipe,
                                     /* dest */
                                     stImage->pt,
-                                    subdst,
-                                    destX, destY, destZ,
+                                    stImage->level,
+                                    destX, destY, destZ + stImage->face,
                                     /* src */
                                     strb->texture,
-                                    subsrc,
-                                    srcX, srcY, strb->surface->zslice,
-                                    /* size */
-                                    width, height);
+                                    strb->surface->u.tex.level,
+                                    &src_box);
          use_fallback = GL_FALSE;
       }
       else if (format_writemask &&
@@ -1628,12 +1632,16 @@ st_copy_texsubimage(struct gl_context *ctx,
                                            0)) {
          /* draw textured quad to do the copy */
          GLint srcY0, srcY1;
-         struct pipe_subresource subsrc;
+         struct pipe_surface surf_tmpl;
+         memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+         surf_tmpl.format = stImage->pt->format;
+         surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
+         surf_tmpl.u.tex.level = stImage->level;
+         surf_tmpl.u.tex.first_layer = stImage->face + destZ;
+         surf_tmpl.u.tex.last_layer = stImage->face + destZ;
 
-         dest_surface = screen->get_tex_surface(screen, stImage->pt,
-                                                stImage->face, stImage->level,
-                                                destZ,
-                                                PIPE_BIND_RENDER_TARGET);
+         dest_surface = pipe->create_surface(pipe, stImage->pt,
+                                             &surf_tmpl);
 
          if (do_flip) {
             srcY1 = strb->Base.Height - srcY - height;
@@ -1643,15 +1651,13 @@ st_copy_texsubimage(struct gl_context *ctx,
             srcY0 = srcY;
             srcY1 = srcY0 + height;
          }
-         subsrc.face = strb->surface->face;
-         subsrc.level = strb->surface->level;
 
          util_blit_pixels_writemask(st->blit,
                                     strb->texture,
-                                    subsrc,
+                                    strb->surface->u.tex.level,
                                     srcX, srcY0,
                                     srcX + width, srcY1,
-                                    strb->surface->zslice,
+                                    strb->surface->u.tex.first_layer,
                                     dest_surface,
                                     destX, destY,
                                     destX + width, destY + height,
@@ -1853,7 +1859,7 @@ st_finalize_texture(struct gl_context *ctx,
     */
    if (firstImage->pt &&
        firstImage->pt != stObj->pt &&
-       firstImage->pt->last_level >= stObj->lastLevel) {
+       (!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) {
       pipe_resource_reference(&stObj->pt, firstImage->pt);
       pipe_sampler_view_reference(&stObj->sampler_view, NULL);
    }
index 60987055eb180d85419f1676b865dfe221f5d896..f1502bda788ed53ed9989a94bee8279f1b9c9861 100644 (file)
 
 
 #include "main/glheader.h"
-#include "main/mtypes.h"
 
 struct dd_function_table;
+struct gl_context;
+struct gl_texture_object;
 struct pipe_context;
 struct st_context;
 
index 838a0a4a9341272fe4ebe977509aeffbd32f0db7..e415b186aa73369fe373c71e74a9e52a9186ac4f 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "main/imports.h"
 #include "main/context.h"
+#include "main/mfeatures.h"
 #include "main/transformfeedback.h"
 
 #include "st_cb_xformfb.h"
index 574cf481e18517fbcb3a627ae573731c155a0d1c..1215ebea8715b098c9c943e09dd4990e51e52416 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #include "main/compiler.h"
+#include "main/mfeatures.h"
 
 struct dd_function_table;
 
index d6628b1bff00ac6fe415149d75040761b19caaf2..c7f3949bf9e64b827e5b8a08f918d150a479f759 100644 (file)
@@ -207,12 +207,6 @@ static void st_destroy_context_priv( struct st_context *st )
       pipe_sampler_view_reference(&st->state.sampler_views[i], NULL);
    }
 
-   for (i = 0; i < Elements(st->state.constants); i++) {
-      if (st->state.constants[i]) {
-         pipe_resource_reference(&st->state.constants[i], NULL);
-      }
-   }
-
    if (st->default_texture) {
       st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
       st->default_texture = NULL;
@@ -244,14 +238,15 @@ void st_destroy_context( struct st_context *st )
    pipe->set_index_buffer(pipe, NULL);
 
    for (i = 0; i < PIPE_SHADER_TYPES; i++) {
-      pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, NULL);
-      pipe_resource_reference(&st->state.constants[PIPE_SHADER_VERTEX], NULL);
+      pipe->set_constant_buffer(pipe, i, 0, NULL);
    }
 
    _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
 
    _vbo_DestroyContext(st->ctx);
 
+   st_destroy_program_variants(st);
+
    _mesa_free_context_data(ctx);
 
    st_destroy_context_priv(st);
index d342c0cff1e8a6f0426db11cd7c6d047576ccf42..64a8f790e22bc20e481fa9db984c4869f1c41812 100644 (file)
@@ -1,4 +1,3 @@
-//struct dd_function_table;
 /**************************************************************************
  * 
  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
@@ -93,7 +92,10 @@ struct st_context
       struct pipe_sampler_state             samplers[PIPE_MAX_SAMPLERS];
       struct pipe_sampler_state             *sampler_list[PIPE_MAX_SAMPLERS];
       struct pipe_clip_state clip;
-      struct pipe_resource *constants[PIPE_SHADER_TYPES];
+      struct {
+         void *ptr;
+         unsigned size;
+      } constants[PIPE_SHADER_TYPES];
       struct pipe_framebuffer_state framebuffer;
       struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
       struct pipe_scissor_state scissor;
@@ -106,15 +108,6 @@ struct st_context
       GLuint poly_stipple[32];  /**< In OpenGL's bottom-to-top order */
    } state;
 
-   struct {
-      struct st_tracked_state tracked_state[PIPE_SHADER_TYPES];
-   } constants;
-
-   /* XXX unused: */
-   struct {
-      struct gl_fragment_program *fragment_program;
-   } cb;
-
    char vendor[100];
    char renderer[100];
 
@@ -130,7 +123,9 @@ struct st_context
    struct st_fragment_program *fp;  /**< Currently bound fragment program */
    struct st_geometry_program *gp;  /**< Currently bound geometry program */
 
-   struct st_vp_varient *vp_varient;
+   struct st_vp_variant *vp_variant;
+   struct st_fp_variant *fp_variant;
+   struct st_gp_variant *gp_variant;
 
    struct gl_texture_object *default_texture;
 
@@ -160,7 +155,7 @@ struct st_context
 
    /** for glDraw/CopyPixels */
    struct {
-      struct st_fragment_program *shaders[4];
+      struct gl_fragment_program *shaders[4];
       void *vert_shaders[2];   /**< ureg shaders */
    } drawpix;
 
index df32491d044c4966fe2985afd1df850c8e0df572..e1e373d07d42c851ce15f2cbfd4661591b33efdf 100644 (file)
@@ -89,8 +89,8 @@ st_print_current(void)
    }
 #endif
 
-   if (st->vp->varients)
-      tgsi_dump( st->vp->varients[0].tgsi.tokens, 0 );
+   if (st->vp->variants)
+      tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
    if (st->vp->Base.Base.Parameters)
       _mesa_print_parameter_list(st->vp->Base.Base.Parameters);
 
index 61a0e1b087711c161194515b6aa8d874ebade7ab..db70daacc484986f57bef208e6a5ce54c7f9f972 100644 (file)
@@ -43,6 +43,7 @@
 #include "main/imports.h"
 #include "main/image.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "program/prog_uniform.h"
 
 #include "vbo/vbo.h"
@@ -241,7 +242,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
  */
 static GLboolean
 is_interleaved_arrays(const struct st_vertex_program *vp,
-                      const struct st_vp_varient *vpv,
+                      const struct st_vp_variant *vpv,
                       const struct gl_client_array **arrays,
                       GLboolean *userSpace)
 {
@@ -297,7 +298,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
  */
 static void
 get_arrays_bounds(const struct st_vertex_program *vp,
-                  const struct st_vp_varient *vpv,
+                  const struct st_vp_variant *vpv,
                   const struct gl_client_array **arrays,
                   GLuint max_index,
                   const GLubyte **low, const GLubyte **high)
@@ -343,7 +344,7 @@ get_arrays_bounds(const struct st_vertex_program *vp,
 static void
 setup_interleaved_attribs(struct gl_context *ctx,
                           const struct st_vertex_program *vp,
-                          const struct st_vp_varient *vpv,
+                          const struct st_vp_variant *vpv,
                           const struct gl_client_array **arrays,
                           GLuint max_index,
                           GLboolean userSpace,
@@ -409,7 +410,7 @@ setup_interleaved_attribs(struct gl_context *ctx,
 static void
 setup_non_interleaved_attribs(struct gl_context *ctx,
                               const struct st_vertex_program *vp,
-                              const struct st_vp_varient *vpv,
+                              const struct st_vp_variant *vpv,
                               const struct gl_client_array **arrays,
                               GLuint max_index,
                               GLboolean *userSpace,
@@ -617,7 +618,7 @@ st_draw_vbo(struct gl_context *ctx,
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
    const struct st_vertex_program *vp;
-   const struct st_vp_varient *vpv;
+   const struct st_vp_variant *vpv;
    struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
    GLuint attr;
    struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
@@ -650,7 +651,7 @@ st_draw_vbo(struct gl_context *ctx,
 
    /* must get these after state validation! */
    vp = st->vp;
-   vpv = st->vp_varient;
+   vpv = st->vp_variant;
 
 #if 0
    if (MESA_VERBOSE & VERBOSE_GLSL) {
index 2e4c468cff5a26884677065035ac7e6f1f72a261..5d3c278228f6e352d2baad513ec37f7c7a80451c 100644 (file)
 
 #include "main/compiler.h"
 #include "main/glheader.h"
-#include "main/mtypes.h"
 
 struct _mesa_index_buffer;
 struct _mesa_prim;
+struct gl_client_array;
+struct gl_context;
 struct st_context;
 
 void st_init_draw( struct st_context *st );
index 7f392fc4916510cc8dd1640b2710b68849ae21cb..4e76a050701cf837ac51edd684f1099a659a2092 100644 (file)
@@ -28,6 +28,7 @@
 #include "main/imports.h"
 #include "main/image.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 
 #include "vbo/vbo.h"
 
@@ -109,9 +110,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
    struct pipe_index_buffer ibuffer;
    struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS];
    struct pipe_transfer *ib_transfer = NULL;
-   struct pipe_transfer *cb_transfer;
    GLuint attr, i;
-   ubyte *mapped_constants;
    const void *mapped_indices = NULL;
 
    assert(draw);
@@ -123,10 +122,10 @@ st_feedback_draw_vbo(struct gl_context *ctx,
 
    /* must get these after state validation! */
    vp = st->vp;
-   vs = &st->vp_varient->tgsi;
+   vs = &st->vp_variant->tgsi;
 
-   if (!st->vp_varient->draw_shader) {
-      st->vp_varient->draw_shader = draw_create_vertex_shader(draw, vs);
+   if (!st->vp_variant->draw_shader) {
+      st->vp_variant->draw_shader = draw_create_vertex_shader(draw, vs);
    }
 
    /*
@@ -139,7 +138,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
    draw_set_viewport_state(draw, &st->state.viewport);
    draw_set_clip_state(draw, &st->state.clip);
    draw_set_rasterizer_state(draw, &st->state.rasterizer, NULL);
-   draw_bind_vertex_shader(draw, st->vp_varient->draw_shader);
+   draw_bind_vertex_shader(draw, st->vp_variant->draw_shader);
    set_feedback_vertex_format(ctx);
 
    /* loop over TGSI shader inputs to determine vertex buffer
@@ -242,14 +241,10 @@ st_feedback_draw_vbo(struct gl_context *ctx,
       draw_set_mapped_index_buffer(draw, mapped_indices);
    }
 
-   /* map constant buffers */
-   mapped_constants = pipe_buffer_map(pipe,
-                                      st->state.constants[PIPE_SHADER_VERTEX],
-                                      PIPE_TRANSFER_READ,
-                                     &cb_transfer);
+   /* set the constant buffer */
    draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX, 0,
-                                   mapped_constants,
-                                   st->state.constants[PIPE_SHADER_VERTEX]->width0);
+                                   st->state.constants[PIPE_SHADER_VERTEX].ptr,
+                                   st->state.constants[PIPE_SHADER_VERTEX].size);
 
 
    /* draw here */
@@ -258,17 +253,12 @@ st_feedback_draw_vbo(struct gl_context *ctx,
    }
 
 
-   /* unmap constant buffers */
-   pipe_buffer_unmap(pipe, st->state.constants[PIPE_SHADER_VERTEX],
-                    cb_transfer);
-
    /*
     * unmap vertex/index buffers
     */
    for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
       if (draw->pt.vertex_buffer[i].buffer) {
-         pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer, 
-                          vb_transfer[i]);
+         pipe_buffer_unmap(pipe, vb_transfer[i]);
          pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL);
          draw_set_mapped_vertex_buffer(draw, i, NULL);
       }
@@ -279,7 +269,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
       draw_set_index_buffer(draw, NULL);
 
       if (ib_transfer)
-         pipe_buffer_unmap(pipe, ibuffer.buffer, ib_transfer);
+         pipe_buffer_unmap(pipe, ib_transfer);
       pipe_resource_reference(&ibuffer.buffer, NULL);
    }
 }
index 37a0aa2bc9fe4890a3b2172feb3bee3c660d8acb..df4f5cf8b5ce89531d5c0eb5921a57833de322d7 100644 (file)
@@ -29,6 +29,7 @@
 #include "main/imports.h"
 #include "main/context.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
@@ -224,6 +225,7 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
    ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
    ctx->Extensions.ARB_fragment_program = GL_TRUE;
+   ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
    ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
    ctx->Extensions.ARB_multisample = GL_TRUE;
    ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
@@ -343,6 +345,7 @@ void st_init_extensions(struct st_context *st)
 
    if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY)) {
       ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+      ctx->Extensions.ARB_occlusion_query2 = GL_TRUE;
    }
    if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY)) {
      ctx->Extensions.EXT_timer_query = GL_TRUE;
@@ -442,7 +445,9 @@ void st_init_extensions(struct st_context *st)
 #endif
 
    if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
+#if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */
       ctx->Extensions.ARB_geometry_shader4 = GL_TRUE;
+#endif
    }
 
    if (screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) {
index 955d821a65784f0110e2a082fe4a2460586219e5..2e0a664dd01f52d2c8c616535a2ea764d58fd068 100644 (file)
@@ -37,6 +37,7 @@
 #include "main/texstore.h"
 #include "main/image.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
@@ -146,14 +147,28 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
       return PIPE_FORMAT_B4G4R4A4_UNORM;
    case MESA_FORMAT_RGB565:
       return PIPE_FORMAT_B5G6R5_UNORM;
+   case MESA_FORMAT_RGB332:
+      return PIPE_FORMAT_B2G3R3_UNORM;
+   case MESA_FORMAT_ARGB2101010:
+      return PIPE_FORMAT_B10G10R10A2_UNORM;
+   case MESA_FORMAT_AL44:
+      return PIPE_FORMAT_L4A4_UNORM;
    case MESA_FORMAT_AL88:
       return PIPE_FORMAT_L8A8_UNORM;
+   case MESA_FORMAT_AL1616:
+      return PIPE_FORMAT_L16A16_UNORM;
    case MESA_FORMAT_A8:
       return PIPE_FORMAT_A8_UNORM;
+   case MESA_FORMAT_A16:
+      return PIPE_FORMAT_A16_UNORM;
    case MESA_FORMAT_L8:
       return PIPE_FORMAT_L8_UNORM;
+   case MESA_FORMAT_L16:
+      return PIPE_FORMAT_L16_UNORM;
    case MESA_FORMAT_I8:
       return PIPE_FORMAT_I8_UNORM;
+   case MESA_FORMAT_I16:
+      return PIPE_FORMAT_I16_UNORM;
    case MESA_FORMAT_Z16:
       return PIPE_FORMAT_Z16_UNORM;
    case MESA_FORMAT_Z32:
@@ -261,14 +276,28 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
       return MESA_FORMAT_ARGB4444;
    case PIPE_FORMAT_B5G6R5_UNORM:
       return MESA_FORMAT_RGB565;
+   case PIPE_FORMAT_B2G3R3_UNORM:
+      return MESA_FORMAT_RGB332;
+   case PIPE_FORMAT_B10G10R10A2_UNORM:
+      return MESA_FORMAT_ARGB2101010;
+   case PIPE_FORMAT_L4A4_UNORM:
+      return MESA_FORMAT_AL44;
    case PIPE_FORMAT_L8A8_UNORM:
       return MESA_FORMAT_AL88;
+   case PIPE_FORMAT_L16A16_UNORM:
+      return MESA_FORMAT_AL1616;
    case PIPE_FORMAT_A8_UNORM:
       return MESA_FORMAT_A8;
+   case PIPE_FORMAT_A16_UNORM:
+      return MESA_FORMAT_A16;
    case PIPE_FORMAT_L8_UNORM:
       return MESA_FORMAT_L8;
+   case PIPE_FORMAT_L16_UNORM:
+      return MESA_FORMAT_L16;
    case PIPE_FORMAT_I8_UNORM:
       return MESA_FORMAT_I8;
+   case PIPE_FORMAT_I16_UNORM:
+      return MESA_FORMAT_I16;
    case PIPE_FORMAT_S8_USCALED:
       return MESA_FORMAT_S8;
 
@@ -469,17 +498,27 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    unsigned geom_flags = 0; /* we don't care about POT vs. NPOT here, yet */
 
    switch (internalFormat) {
+   case GL_RGB10:
+   case GL_RGB10_A2:
+      if (screen->is_format_supported( screen, PIPE_FORMAT_B10G10R10A2_UNORM,
+                                       target, sample_count, bindings,
+                                       geom_flags ))
+         return PIPE_FORMAT_B10G10R10A2_UNORM;
+      /* Pass through. */
    case 4:
    case GL_RGBA:
    case GL_RGBA8:
-   case GL_RGB10_A2:
       return default_rgba_format( screen, target, sample_count, bindings,
                                   geom_flags );
 
    case 3:
    case GL_RGB:
+   case GL_RGB8:
       return default_rgb_format( screen, target, sample_count, bindings,
                                  geom_flags );
+
+   case GL_RGB12:
+   case GL_RGB16:
    case GL_RGBA12:
    case GL_RGBA16:
       if (screen->is_format_supported( screen, PIPE_FORMAT_R16G16B16A16_UNORM,
@@ -506,16 +545,14 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
       return default_rgba_format( screen, target, sample_count, bindings,
                                   geom_flags );
 
-   case GL_RGB8:
-   case GL_RGB10:
-   case GL_RGB12:
-   case GL_RGB16:
-      return default_rgb_format( screen, target, sample_count, bindings,
-                                 geom_flags );
-
+   case GL_R3_G3_B2:
+      if (screen->is_format_supported( screen, PIPE_FORMAT_B2G3R3_UNORM,
+                                       target, sample_count, bindings,
+                                       geom_flags ))
+         return PIPE_FORMAT_B2G3R3_UNORM;
+      /* Pass through. */
    case GL_RGB5:
    case GL_RGB4:
-   case GL_R3_G3_B2:
       if (screen->is_format_supported( screen, PIPE_FORMAT_B5G6R5_UNORM,
                                        target, sample_count, bindings,
                                        geom_flags ))
@@ -527,11 +564,15 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
       return default_rgba_format( screen, target, sample_count, bindings,
                                   geom_flags );
 
+   case GL_ALPHA12:
+   case GL_ALPHA16:
+      if (screen->is_format_supported( screen, PIPE_FORMAT_A16_UNORM, target,
+                                       sample_count, bindings, geom_flags ))
+         return PIPE_FORMAT_A16_UNORM;
+      /* Pass through. */
    case GL_ALPHA:
    case GL_ALPHA4:
    case GL_ALPHA8:
-   case GL_ALPHA12:
-   case GL_ALPHA16:
    case GL_COMPRESSED_ALPHA:
       if (screen->is_format_supported( screen, PIPE_FORMAT_A8_UNORM, target,
                                        sample_count, bindings, geom_flags ))
@@ -539,12 +580,16 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
       return default_rgba_format( screen, target, sample_count, bindings,
                                   geom_flags );
 
+   case GL_LUMINANCE12:
+   case GL_LUMINANCE16:
+      if (screen->is_format_supported( screen, PIPE_FORMAT_L16_UNORM, target,
+                                       sample_count, bindings, geom_flags ))
+         return PIPE_FORMAT_L16_UNORM;
+      /* Pass through. */
    case 1:
    case GL_LUMINANCE:
    case GL_LUMINANCE4:
    case GL_LUMINANCE8:
-   case GL_LUMINANCE12:
-   case GL_LUMINANCE16:
    case GL_COMPRESSED_LUMINANCE:
       if (screen->is_format_supported( screen, PIPE_FORMAT_L8_UNORM, target,
                                        sample_count, bindings, geom_flags ))
@@ -552,14 +597,17 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
       return default_rgba_format( screen, target, sample_count, bindings,
                                   geom_flags );
 
+   case GL_LUMINANCE12_ALPHA4:
+   case GL_LUMINANCE12_ALPHA12:
+   case GL_LUMINANCE16_ALPHA16:
+      if (screen->is_format_supported( screen, PIPE_FORMAT_L16A16_UNORM, target,
+                                       sample_count, bindings, geom_flags ))
+         return PIPE_FORMAT_L16A16_UNORM;
+      /* Pass through. */
    case 2:
    case GL_LUMINANCE_ALPHA:
-   case GL_LUMINANCE4_ALPHA4:
    case GL_LUMINANCE6_ALPHA2:
    case GL_LUMINANCE8_ALPHA8:
-   case GL_LUMINANCE12_ALPHA4:
-   case GL_LUMINANCE12_ALPHA12:
-   case GL_LUMINANCE16_ALPHA16:
    case GL_COMPRESSED_LUMINANCE_ALPHA:
       if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target,
                                        sample_count, bindings, geom_flags ))
@@ -567,11 +615,25 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
       return default_rgba_format( screen, target, sample_count, bindings,
                                   geom_flags );
 
+   case GL_LUMINANCE4_ALPHA4:
+      if (screen->is_format_supported( screen, PIPE_FORMAT_L4A4_UNORM, target,
+                                       sample_count, bindings, geom_flags ))
+         return PIPE_FORMAT_L4A4_UNORM;
+      if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target,
+                                       sample_count, bindings, geom_flags ))
+         return PIPE_FORMAT_L8A8_UNORM;
+      return default_rgba_format( screen, target, sample_count, bindings,
+                                  geom_flags );
+
+   case GL_INTENSITY12:
+   case GL_INTENSITY16:
+      if (screen->is_format_supported( screen, PIPE_FORMAT_I16_UNORM, target,
+                                       sample_count, bindings, geom_flags ))
+         return PIPE_FORMAT_I16_UNORM;
+      /* Pass through. */
    case GL_INTENSITY:
    case GL_INTENSITY4:
    case GL_INTENSITY8:
-   case GL_INTENSITY12:
-   case GL_INTENSITY16:
    case GL_COMPRESSED_INTENSITY:
       if (screen->is_format_supported( screen, PIPE_FORMAT_I8_UNORM, target,
                                        sample_count, bindings, geom_flags ))
@@ -680,10 +742,10 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
    case GL_DEPTH_COMPONENT:
       {
          static const enum pipe_format formats[] = {
-            PIPE_FORMAT_Z16_UNORM,
             PIPE_FORMAT_Z32_UNORM,
             PIPE_FORMAT_Z24_UNORM_S8_USCALED,
-            PIPE_FORMAT_S8_USCALED_Z24_UNORM
+            PIPE_FORMAT_S8_USCALED_Z24_UNORM,
+            PIPE_FORMAT_Z16_UNORM
          };
          return find_supported_format(screen, formats, Elements(formats),
                                       target, sample_count, bindings, geom_flags);
@@ -717,18 +779,30 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
 
    case GL_SRGB_EXT:
    case GL_SRGB8_EXT:
-   case GL_COMPRESSED_SRGB_EXT:
-   case GL_COMPRESSED_SRGB_ALPHA_EXT:
    case GL_SRGB_ALPHA_EXT:
    case GL_SRGB8_ALPHA8_EXT:
       return default_srgba_format( screen, target, sample_count, bindings,
                                    geom_flags );
+
+   case GL_COMPRESSED_SRGB_EXT:
    case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
-      return PIPE_FORMAT_DXT1_SRGB;
+      if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_SRGB, target,
+                                      sample_count, bindings, geom_flags))
+         return PIPE_FORMAT_DXT1_SRGB;
+      return default_srgba_format( screen, target, sample_count, bindings,
+                                   geom_flags );
+
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
       return PIPE_FORMAT_DXT1_SRGBA;
+
+   case GL_COMPRESSED_SRGB_ALPHA_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-      return PIPE_FORMAT_DXT3_SRGBA;
+      if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_SRGBA, target,
+                                      sample_count, bindings, geom_flags))
+         return PIPE_FORMAT_DXT3_SRGBA;
+      return default_srgba_format( screen, target, sample_count, bindings,
+                                   geom_flags );
+
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
       return PIPE_FORMAT_DXT5_SRGBA;
 
@@ -955,8 +1029,13 @@ gl_format
 st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
                        GLenum format, GLenum type)
 {
+   boolean want_renderable =
+      internalFormat == 3 || internalFormat == 4 ||
+      internalFormat == GL_RGB || internalFormat == GL_RGBA ||
+      internalFormat == GL_RGB8 || internalFormat == GL_RGBA8;
+
    return st_ChooseTextureFormat_renderable(ctx, internalFormat,
-                                           format, type, GL_TRUE);
+                                           format, type, want_renderable);
 }
 
 /**
index 43fa59b1006d7236f09c90e9200e4f55782c564e..fe195c1069b1d04d688bb8a8e60db3a6f1eeac00 100644 (file)
 #define ST_FORMAT_H
 
 #include "main/formats.h"
-#include "main/mtypes.h"
+#include "main/glheader.h"
 
 #include "pipe/p_defines.h"
 #include "pipe/p_format.h"
 
+struct gl_context;
 struct pipe_screen;
 
 extern GLenum
index 1fc4f40488f7e5940b91dcfb8d64692561ec981a..c5f6008a22224870e814db924ff9d9da262d1881 100644 (file)
@@ -79,11 +79,15 @@ st_render_mipmap(struct st_context *st,
    const uint face = _mesa_tex_target_to_face(target);
 
    assert(psv->texture == stObj->pt);
-   assert(target != GL_TEXTURE_3D); /* not done yet */
+#if 0
+   assert(target != GL_TEXTURE_3D); /* implemented but untested */
+#endif
 
    /* check if we can render in the texture's format */
-   if (!screen->is_format_supported(screen, psv->format, psv->texture->target, 0,
-                                    PIPE_BIND_RENDER_TARGET, 0)) {
+   /* XXX should probably kill this and always use util_gen_mipmap
+      since this implements a sw fallback as well */
+   if (!screen->is_format_supported(screen, psv->format, psv->texture->target,
+                                    0, PIPE_BIND_RENDER_TARGET, 0)) {
       return FALSE;
    }
 
@@ -161,12 +165,12 @@ fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
    struct pipe_resource *pt = st_get_texobj_resource(texObj);
    const uint baseLevel = texObj->BaseLevel;
    const uint lastLevel = pt->last_level;
-   const uint face = _mesa_tex_target_to_face(target), zslice = 0;
+   const uint face = _mesa_tex_target_to_face(target);
    uint dstLevel;
    GLenum datatype;
    GLuint comps;
    GLboolean compressed;
-   
+
    if (ST_DEBUG & DEBUG_FALLBACK)
       debug_printf("%s: fallback processing\n", __FUNCTION__);
 
@@ -198,16 +202,15 @@ fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
       ubyte *dstData;
       int srcStride, dstStride;
 
-      srcTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, face,
-                                               srcLevel, zslice,
-                                               PIPE_TRANSFER_READ, 0, 0,
-                                                srcWidth, srcHeight);
-                                               
+      srcTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, srcLevel,
+                                   face,
+                                   PIPE_TRANSFER_READ, 0, 0,
+                                   srcWidth, srcHeight);
 
-      dstTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, face,
-                                               dstLevel, zslice,
-                                               PIPE_TRANSFER_WRITE, 0, 0,
-                                               dstWidth, dstHeight);
+      dstTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, dstLevel,
+                                   face,
+                                   PIPE_TRANSFER_WRITE, 0, 0,
+                                   dstWidth, dstHeight);
 
       srcData = (ubyte *) pipe_transfer_map(pipe, srcTrans);
       dstData = (ubyte *) pipe_transfer_map(pipe, dstTrans);
@@ -215,6 +218,8 @@ fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
       srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->resource->format);
       dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->resource->format);
 
+     /* this cannot work correctly for 3d since it does
+        not respect layerStride. */
       if (compressed) {
          const enum pipe_format format = pt->format;
          const uint bw = util_format_get_blockwidth(format);
@@ -365,6 +370,12 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
 
       pt = stObj->pt;
    }
+   else {
+      /* Make sure that the base texture image data is present in the
+       * texture buffer.
+       */
+      st_finalize_texture(ctx, st->pipe, texObj);
+   }
 
    assert(pt->last_level >= lastLevel);
 
@@ -372,6 +383,8 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
     * use the software fallback.
     */
    if (!st_render_mipmap(st, target, stObj, baseLevel, lastLevel)) {
+      /* since the util code actually also has a fallback, should
+         probably make it never fail and kill this */
       fallback_generate_mipmap(ctx, target, texObj);
    }
 
index 3ba091da15103fbabcc984b44872a425d000b327..815c6a51638375936858fda703ed0fc5b582f627 100644 (file)
 #define ST_GEN_MIPMAP_H
 
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 
+struct gl_context;
+struct gl_texture_object;
 struct st_context;
 
 extern void
index 05733e818ea1b986884a2324c25d4095c2ffa056..179e5dc83926712dd7559e754af787e984cffa89 100644 (file)
 #include "util/u_pointer.h"
 #include "util/u_inlines.h"
 #include "util/u_atomic.h"
+#include "util/u_surface.h"
 
 #include "main/mtypes.h"
 #include "main/context.h"
+#include "main/mfeatures.h"
 #include "main/texobj.h"
 #include "main/teximage.h"
 #include "main/texstate.h"
@@ -142,7 +144,7 @@ buffer_index_to_attachment(gl_buffer_index index)
 static void
 st_framebuffer_validate(struct st_framebuffer *stfb, struct st_context *st)
 {
-   struct pipe_screen *screen = st->pipe->screen;
+   struct pipe_context *pipe = st->pipe;
    struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
    uint width, height;
    unsigned i;
@@ -160,7 +162,7 @@ st_framebuffer_validate(struct st_framebuffer *stfb, struct st_context *st)
 
    for (i = 0; i < stfb->num_statts; i++) {
       struct st_renderbuffer *strb;
-      struct pipe_surface *ps;
+      struct pipe_surface *ps, surf_tmpl;
       gl_buffer_index idx;
 
       if (!textures[i])
@@ -179,8 +181,10 @@ st_framebuffer_validate(struct st_framebuffer *stfb, struct st_context *st)
          continue;
       }
 
-      ps = screen->get_tex_surface(screen, textures[i], 0, 0, 0,
-                                  PIPE_BIND_RENDER_TARGET);
+      memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+      u_surface_default_template(&surf_tmpl, textures[i],
+                                 PIPE_BIND_RENDER_TARGET);
+      ps = pipe->create_surface(pipe, textures[i], &surf_tmpl);
       if (ps) {
          pipe_surface_reference(&strb->surface, ps);
          pipe_resource_reference(&strb->texture, ps->texture);
@@ -510,7 +514,8 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
 }
 
 static boolean
-st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type target,
+st_context_teximage(struct st_context_iface *stctxi,
+                    enum st_texture_type target,
                     int level, enum pipe_format internal_format,
                     struct pipe_resource *tex, boolean mipmap)
 {
@@ -813,6 +818,7 @@ st_manager_flush_frontbuffer(struct st_context *st)
 
 /**
  * Return the surface of an EGLImage.
+ * FIXME: I think this should operate on resources, not surfaces
  */
 struct pipe_surface *
 st_manager_get_egl_image_surface(struct st_context *st,
@@ -821,7 +827,7 @@ st_manager_get_egl_image_surface(struct st_context *st,
    struct st_manager *smapi =
       (struct st_manager *) st->iface.st_context_private;
    struct st_egl_image stimg;
-   struct pipe_surface *ps;
+   struct pipe_surface *ps, surf_tmpl;
 
    if (!smapi || !smapi->get_egl_image)
       return NULL;
@@ -830,8 +836,13 @@ st_manager_get_egl_image_surface(struct st_context *st,
    if (!smapi->get_egl_image(smapi, eglimg, &stimg))
       return NULL;
 
-   ps = smapi->screen->get_tex_surface(smapi->screen,
-         stimg.texture, stimg.face, stimg.level, stimg.zslice, usage);
+   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+   surf_tmpl.format = stimg.texture->format;
+   surf_tmpl.usage = usage;
+   surf_tmpl.u.tex.level = stimg.level;
+   surf_tmpl.u.tex.first_layer = stimg.layer;
+   surf_tmpl.u.tex.last_layer = stimg.layer;
+   ps = st->pipe->create_surface(st->pipe, stimg.texture, &surf_tmpl);
    pipe_resource_reference(&stimg.texture, NULL);
 
    return ps;
@@ -856,7 +867,8 @@ st_manager_validate_framebuffers(struct st_context *st)
  * Add a color renderbuffer on demand.
  */
 boolean
-st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb,
+st_manager_add_color_renderbuffer(struct st_context *st,
+                                  struct gl_framebuffer *fb,
                                   gl_buffer_index idx)
 {
    struct st_framebuffer *stfb = st_ws_framebuffer(fb);
index 96c8aeb6e8d7cdf7317dd9722e13359b51f4ba77..42f1c2017f8479a2bdc3ab1b80025d44df9afcd9 100644 (file)
@@ -772,10 +772,13 @@ emit_adjusted_wpos( struct st_translate *t,
 
 /**
  * Emit the TGSI instructions for inverting the WPOS y coordinate.
+ * This code is unavoidable because it also depends on whether
+ * a FBO is bound (STATE_FB_WPOS_Y_TRANSFORM).
  */
 static void
-emit_inverted_wpos( struct st_translate *t,
-                    const struct gl_program *program )
+emit_wpos_inversion( struct st_translate *t,
+                     const struct gl_program *program,
+                     boolean invert)
 {
    struct ureg_program *ureg = t->ureg;
 
@@ -783,17 +786,17 @@ emit_inverted_wpos( struct st_translate *t,
     * Need to replace instances of INPUT[WPOS] with temp T
     * where T = INPUT[WPOS] by y is inverted.
     */
-   static const gl_state_index winSizeState[STATE_LENGTH]
-      = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0 };
+   static const gl_state_index wposTransformState[STATE_LENGTH]
+      = { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM, 0, 0, 0 };
    
    /* XXX: note we are modifying the incoming shader here!  Need to
     * do this before emitting the constant decls below, or this
     * will be missed:
     */
-   unsigned winHeightConst = _mesa_add_state_reference(program->Parameters,
-                                                       winSizeState);
+   unsigned wposTransConst = _mesa_add_state_reference(program->Parameters,
+                                                       wposTransformState);
 
-   struct ureg_src winsize = ureg_DECL_constant( ureg, winHeightConst );
+   struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst );
    struct ureg_dst wpos_temp;
    struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
 
@@ -806,12 +809,23 @@ emit_inverted_wpos( struct st_translate *t,
       ureg_MOV( ureg, wpos_temp, wpos_input );
    }
 
-   /* SUB wpos_temp.y, winsize_const, wpos_input
-    */
-   ureg_SUB( ureg,
-             ureg_writemask(wpos_temp, TGSI_WRITEMASK_Y ),
-             winsize,
-             wpos_input);
+   if (invert) {
+      /* MAD wpos_temp.y, wpos_input, wpostrans.xxxx, wpostrans.yyyy
+       */
+      ureg_MAD( ureg,
+                ureg_writemask(wpos_temp, TGSI_WRITEMASK_Y ),
+                wpos_input,
+                ureg_scalar(wpostrans, 0),
+                ureg_scalar(wpostrans, 1));
+   } else {
+      /* MAD wpos_temp.y, wpos_input, wpostrans.zzzz, wpostrans.wwww
+       */
+      ureg_MAD( ureg,
+                ureg_writemask(wpos_temp, TGSI_WRITEMASK_Y ),
+                wpos_input,
+                ureg_scalar(wpostrans, 2),
+                ureg_scalar(wpostrans, 3));
+   }
 
    /* Use wpos_temp as position input from here on:
     */
@@ -873,8 +887,7 @@ emit_wpos(struct st_context *st,
 
    /* we invert after adjustment so that we avoid the MOV to temporary,
     * and reuse the adjustment ADD instead */
-   if (invert)
-      emit_inverted_wpos(t, program);
+   emit_wpos_inversion(t, program, invert);
 }
 
 
index 9bfd4960b604f6b3d4a268c8c51180e71be94162..0615e52ef6297bd5a64c8b078e62b2cc2ddac3fe 100644 (file)
 #ifndef ST_MESA_TO_TGSI_H
 #define ST_MESA_TO_TGSI_H
 
-#include "main/mtypes.h"
-
-#include "pipe/p_compiler.h"
-
-struct ureg_program;
-
 #if defined __cplusplus
 extern "C" {
 #endif
 
-struct tgsi_token;
+#include "main/glheader.h"
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_defines.h"
+
+struct gl_context;
 struct gl_program;
+struct tgsi_token;
+struct ureg_program;
+
 
 enum pipe_error
 st_translate_mesa_program(
index 76799287fe12dff9c69de2254f87eae223596f74..7b32b46838a1ac9beb347a7e17f09c4508d06492 100644 (file)
 
 
 #include "main/imports.h"
+#include "main/hash.h"
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
+#include "program/prog_parameter.h"
 #include "program/prog_print.h"
 #include "program/programopt.h"
 
@@ -44,6 +47,8 @@
 #include "tgsi/tgsi_ureg.h"
 
 #include "st_debug.h"
+#include "st_cb_bitmap.h"
+#include "st_cb_drawpixels.h"
 #include "st_context.h"
 #include "st_program.h"
 #include "st_mesa_to_tgsi.h"
 
 
 
+/**
+ * Delete a vertex program variant.  Note the caller must unlink
+ * the variant from the linked list.
+ */
+static void
+delete_vp_variant(struct st_context *st, struct st_vp_variant *vpv)
+{
+   if (vpv->driver_shader) 
+      cso_delete_vertex_shader(st->cso_context, vpv->driver_shader);
+      
+#if FEATURE_feedback || FEATURE_rastpos
+   if (vpv->draw_shader)
+      draw_delete_vertex_shader( st->draw, vpv->draw_shader );
+#endif
+      
+   if (vpv->tgsi.tokens)
+      st_free_tokens(vpv->tgsi.tokens);
+      
+   FREE( vpv );
+}
+
+
+
 /**
  * Clean out any old compilations:
  */
 void
-st_vp_release_varients( struct st_context *st,
+st_release_vp_variants( struct st_context *st,
                         struct st_vertex_program *stvp )
 {
-   struct st_vp_varient *vpv;
+   struct st_vp_variant *vpv;
 
-   for (vpv = stvp->varients; vpv; ) {
-      struct st_vp_varient *next = vpv->next;
+   for (vpv = stvp->variants; vpv; ) {
+      struct st_vp_variant *next = vpv->next;
+      delete_vp_variant(st, vpv);
+      vpv = next;
+   }
 
-      if (vpv->driver_shader) 
-         cso_delete_vertex_shader(st->cso_context, vpv->driver_shader);
-      
-#if FEATURE_feedback || FEATURE_rastpos
-      if (vpv->draw_shader)
-         draw_delete_vertex_shader( st->draw, vpv->draw_shader );
-#endif
+   stvp->variants = NULL;
+}
+
+
+
+/**
+ * Delete a fragment program variant.  Note the caller must unlink
+ * the variant from the linked list.
+ */
+static void
+delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv)
+{
+   if (fpv->driver_shader) 
+      cso_delete_fragment_shader(st->cso_context, fpv->driver_shader);
       
-      if (vpv->tgsi.tokens)
-         st_free_tokens(vpv->tgsi.tokens);
+   FREE(fpv);
+}
+
+
+/**
+ * Free all variants of a fragment program.
+ */
+void
+st_release_fp_variants(struct st_context *st, struct st_fragment_program *stfp)
+{
+   struct st_fp_variant *fpv;
+
+   for (fpv = stfp->variants; fpv; ) {
+      struct st_fp_variant *next = fpv->next;
+      delete_fp_variant(st, fpv);
+      fpv = next;
+   }
+
+   stfp->variants = NULL;
+}
+
+
+/**
+ * Delete a geometry program variant.  Note the caller must unlink
+ * the variant from the linked list.
+ */
+static void
+delete_gp_variant(struct st_context *st, struct st_gp_variant *gpv)
+{
+   if (gpv->driver_shader) 
+      cso_delete_geometry_shader(st->cso_context, gpv->driver_shader);
       
-      FREE( vpv );
+   FREE(gpv);
+}
 
-      vpv = next;
+
+/**
+ * Free all variants of a geometry program.
+ */
+void
+st_release_gp_variants(struct st_context *st, struct st_geometry_program *stgp)
+{
+   struct st_gp_variant *gpv;
+
+   for (gpv = stgp->variants; gpv; ) {
+      struct st_gp_variant *next = gpv->next;
+      delete_gp_variant(st, gpv);
+      gpv = next;
    }
 
-   stvp->varients = NULL;
+   stgp->variants = NULL;
 }
 
 
@@ -92,7 +172,7 @@ st_vp_release_varients( struct st_context *st,
  * \param tokensOut  destination for TGSI tokens
  * \return  pointer to cached pipe_shader object.
  */
-void
+static void
 st_prepare_vertex_program(struct st_context *st,
                             struct st_vertex_program *stvp)
 {
@@ -196,17 +276,22 @@ st_prepare_vertex_program(struct st_context *st,
 }
 
 
-struct st_vp_varient *
+/**
+ * Translate a vertex program to create a new variant.
+ */
+static struct st_vp_variant *
 st_translate_vertex_program(struct st_context *st,
                             struct st_vertex_program *stvp,
-                            const struct st_vp_varient_key *key)
+                            const struct st_vp_variant_key *key)
 {
-   struct st_vp_varient *vpv = CALLOC_STRUCT(st_vp_varient);
+   struct st_vp_variant *vpv = CALLOC_STRUCT(st_vp_variant);
    struct pipe_context *pipe = st->pipe;
    struct ureg_program *ureg;
    enum pipe_error error;
    unsigned num_outputs;
 
+   st_prepare_vertex_program( st, stvp );
+
    _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT);
    _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_VARYING);
 
@@ -216,6 +301,8 @@ st_translate_vertex_program(struct st_context *st,
       return NULL;
    }
 
+   vpv->key = *key;
+
    vpv->num_inputs = stvp->num_inputs;
    num_outputs = stvp->num_outputs;
    if (key->passthrough_edgeflags) {
@@ -229,23 +316,22 @@ st_translate_vertex_program(struct st_context *st,
       debug_printf("\n");
    }
 
-   error = 
-      st_translate_mesa_program(st->ctx,
-                                TGSI_PROCESSOR_VERTEX,
-                                ureg,
-                                &stvp->Base.Base,
-                                /* inputs */
-                                vpv->num_inputs,
-                                stvp->input_to_index,
-                                NULL, /* input semantic name */
-                                NULL, /* input semantic index */
-                                NULL,
-                                /* outputs */
-                                num_outputs,
-                                stvp->result_to_output,
-                                stvp->output_semantic_name,
-                                stvp->output_semantic_index,
-                                key->passthrough_edgeflags );
+   error = st_translate_mesa_program(st->ctx,
+                                     TGSI_PROCESSOR_VERTEX,
+                                     ureg,
+                                     &stvp->Base.Base,
+                                     /* inputs */
+                                     vpv->num_inputs,
+                                     stvp->input_to_index,
+                                     NULL, /* input semantic name */
+                                     NULL, /* input semantic index */
+                                     NULL,
+                                     /* outputs */
+                                     num_outputs,
+                                     stvp->result_to_output,
+                                     stvp->output_semantic_name,
+                                     stvp->output_semantic_index,
+                                     key->passthrough_edgeflags );
 
    if (error)
       goto fail;
@@ -275,201 +361,317 @@ fail:
 }
 
 
+/**
+ * Find/create a vertex program variant.
+ */
+struct st_vp_variant *
+st_get_vp_variant(struct st_context *st,
+                  struct st_vertex_program *stvp,
+                  const struct st_vp_variant_key *key)
+{
+   struct st_vp_variant *vpv;
+
+   /* Search for existing variant */
+   for (vpv = stvp->variants; vpv; vpv = vpv->next) {
+      if (memcmp(&vpv->key, key, sizeof(*key)) == 0) {
+         break;
+      }
+   }
+
+   if (!vpv) {
+      /* create now */
+      vpv = st_translate_vertex_program(st, stvp, key);
+      if (vpv) {
+         /* insert into list */
+         vpv->next = stvp->variants;
+         stvp->variants = vpv;
+      }
+   }
+
+   return vpv;
+}
+
 
 /**
- * Translate a Mesa fragment shader into a TGSI shader.
- * \return  pointer to cached pipe_shader object.
+ * Translate a Mesa fragment shader into a TGSI shader using extra info in
+ * the key.
+ * \return  new fragment program variant
  */
-void
+static struct st_fp_variant *
 st_translate_fragment_program(struct st_context *st,
-                              struct st_fragment_program *stfp )
+                              struct st_fragment_program *stfp,
+                              const struct st_fp_variant_key *key)
 {
    struct pipe_context *pipe = st->pipe;
-   GLuint outputMapping[FRAG_RESULT_MAX];
-   GLuint inputMapping[FRAG_ATTRIB_MAX];
-   GLuint interpMode[PIPE_MAX_SHADER_INPUTS];  /* XXX size? */
-   GLuint attr;
-   enum pipe_error error;
-   const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
-   struct ureg_program *ureg;
+   struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant);
 
-   ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
-   ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
-   uint fs_num_inputs = 0;
+   if (!variant)
+      return NULL;
 
-   ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
-   ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
-   uint fs_num_outputs = 0;
+   assert(!(key->bitmap && key->drawpixels));
 
-   _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT);
+#if FEATURE_drawpix
+   if (key->bitmap) {
+      /* glBitmap drawing */
+      struct gl_fragment_program *fp;
 
-   /*
-    * Convert Mesa program inputs to TGSI input register semantics.
-    */
-   for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
-      if (inputsRead & (1 << attr)) {
-         const GLuint slot = fs_num_inputs++;
+      st_make_bitmap_fragment_program(st, &stfp->Base,
+                                      &fp, &variant->bitmap_sampler);
 
-         inputMapping[attr] = slot;
+      variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
+      stfp = st_fragment_program(fp);
+   }
+   else if (key->drawpixels) {
+      /* glDrawPixels drawing */
+      struct gl_fragment_program *fp;
 
-         switch (attr) {
-         case FRAG_ATTRIB_WPOS:
-            input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
-            input_semantic_index[slot] = 0;
-            interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
-            break;
-         case FRAG_ATTRIB_COL0:
-            input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
-            input_semantic_index[slot] = 0;
-            interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
-            break;
-         case FRAG_ATTRIB_COL1:
-            input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
-            input_semantic_index[slot] = 1;
-            interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
-            break;
-         case FRAG_ATTRIB_FOGC:
-            input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
-            input_semantic_index[slot] = 0;
-            interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
-            break;
-         case FRAG_ATTRIB_FACE:
-            input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
-            input_semantic_index[slot] = 0;
-            interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
-            break;
-            /* In most cases, there is nothing special about these
-             * inputs, so adopt a convention to use the generic
-             * semantic name and the mesa FRAG_ATTRIB_ number as the
-             * index. 
-             * 
-             * All that is required is that the vertex shader labels
-             * its own outputs similarly, and that the vertex shader
-             * generates at least every output required by the
-             * fragment shader plus fixed-function hardware (such as
-             * BFC).
-             * 
-             * There is no requirement that semantic indexes start at
-             * zero or be restricted to a particular range -- nobody
-             * should be building tables based on semantic index.
-             */
-         case FRAG_ATTRIB_PNTC:
-         case FRAG_ATTRIB_TEX0:
-         case FRAG_ATTRIB_TEX1:
-         case FRAG_ATTRIB_TEX2:
-         case FRAG_ATTRIB_TEX3:
-         case FRAG_ATTRIB_TEX4:
-         case FRAG_ATTRIB_TEX5:
-         case FRAG_ATTRIB_TEX6:
-         case FRAG_ATTRIB_TEX7:
-         case FRAG_ATTRIB_VAR0:
-         default:
-            /* Actually, let's try and zero-base this just for
-             * readability of the generated TGSI.
-             */
-            assert(attr >= FRAG_ATTRIB_TEX0);
-            input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
-            input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
-            if (attr == FRAG_ATTRIB_PNTC)
-               interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
-            else
-               interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
-            break;
-         }
+      if (key->drawpixels_z || key->drawpixels_stencil) {
+         fp = st_make_drawpix_z_stencil_program(st, key->drawpixels_z,
+                                                key->drawpixels_stencil);
       }
       else {
-        inputMapping[attr] = -1;
+         /* RGBA */
+         st_make_drawpix_fragment_program(st, &stfp->Base, &fp);
+         variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
       }
+      stfp = st_fragment_program(fp);
    }
+#endif
 
-   /*
-    * Semantics and mapping for outputs
-    */
-   {
-      uint numColors = 0;
-      GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten;
-
-      /* if z is written, emit that first */
-      if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
-         fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION;
-         fs_output_semantic_index[fs_num_outputs] = 0;
-         outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
-         fs_num_outputs++;
-         outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
-      }
+   if (!stfp->tgsi.tokens) {
+      /* need to translate Mesa instructions to TGSI now */
+      GLuint outputMapping[FRAG_RESULT_MAX];
+      GLuint inputMapping[FRAG_ATTRIB_MAX];
+      GLuint interpMode[PIPE_MAX_SHADER_INPUTS];  /* XXX size? */
+      GLuint attr;
+      enum pipe_error error;
+      const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
+      struct ureg_program *ureg;
+      GLboolean write_all = GL_FALSE;
 
-      if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
-         fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL;
-         fs_output_semantic_index[fs_num_outputs] = 0;
-         outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs;
-         fs_num_outputs++;
-         outputsWritten &= ~(1 << FRAG_RESULT_STENCIL);
-      }
+      ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
+      ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
+      uint fs_num_inputs = 0;
+
+      ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
+      ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
+      uint fs_num_outputs = 0;
+
+
+      _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT);
+
+      /*
+       * Convert Mesa program inputs to TGSI input register semantics.
+       */
+      for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
+         if (inputsRead & (1 << attr)) {
+            const GLuint slot = fs_num_inputs++;
+
+            inputMapping[attr] = slot;
 
-      /* handle remaning outputs (color) */
-      for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
-         if (outputsWritten & BITFIELD64_BIT(attr)) {
             switch (attr) {
-            case FRAG_RESULT_DEPTH:
-            case FRAG_RESULT_STENCIL:
-               /* handled above */
-               assert(0);
+            case FRAG_ATTRIB_WPOS:
+               input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
+               input_semantic_index[slot] = 0;
+               interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+               break;
+            case FRAG_ATTRIB_COL0:
+               input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+               input_semantic_index[slot] = 0;
+               interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+               break;
+            case FRAG_ATTRIB_COL1:
+               input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+               input_semantic_index[slot] = 1;
+               interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+               break;
+            case FRAG_ATTRIB_FOGC:
+               input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
+               input_semantic_index[slot] = 0;
+               interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
                break;
+            case FRAG_ATTRIB_FACE:
+               input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
+               input_semantic_index[slot] = 0;
+               interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
+               break;
+               /* In most cases, there is nothing special about these
+                * inputs, so adopt a convention to use the generic
+                * semantic name and the mesa FRAG_ATTRIB_ number as the
+                * index. 
+                * 
+                * All that is required is that the vertex shader labels
+                * its own outputs similarly, and that the vertex shader
+                * generates at least every output required by the
+                * fragment shader plus fixed-function hardware (such as
+                * BFC).
+                * 
+                * There is no requirement that semantic indexes start at
+                * zero or be restricted to a particular range -- nobody
+                * should be building tables based on semantic index.
+                */
+            case FRAG_ATTRIB_PNTC:
+            case FRAG_ATTRIB_TEX0:
+            case FRAG_ATTRIB_TEX1:
+            case FRAG_ATTRIB_TEX2:
+            case FRAG_ATTRIB_TEX3:
+            case FRAG_ATTRIB_TEX4:
+            case FRAG_ATTRIB_TEX5:
+            case FRAG_ATTRIB_TEX6:
+            case FRAG_ATTRIB_TEX7:
+            case FRAG_ATTRIB_VAR0:
             default:
-               assert(attr == FRAG_RESULT_COLOR ||
-                      (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
-               fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
-               fs_output_semantic_index[fs_num_outputs] = numColors;
-               outputMapping[attr] = fs_num_outputs;
-               numColors++;
+               /* Actually, let's try and zero-base this just for
+                * readability of the generated TGSI.
+                */
+               assert(attr >= FRAG_ATTRIB_TEX0);
+               input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
+               input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
+               if (attr == FRAG_ATTRIB_PNTC)
+                  interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+               else
+                  interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
                break;
             }
+         }
+         else {
+            inputMapping[attr] = -1;
+         }
+      }
+
+      /*
+       * Semantics and mapping for outputs
+       */
+      {
+         uint numColors = 0;
+         GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten;
+
+         /* if z is written, emit that first */
+         if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
+            fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION;
+            fs_output_semantic_index[fs_num_outputs] = 0;
+            outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
+            fs_num_outputs++;
+            outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
+         }
 
+         if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
+            fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL;
+            fs_output_semantic_index[fs_num_outputs] = 0;
+            outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs;
             fs_num_outputs++;
+            outputsWritten &= ~(1 << FRAG_RESULT_STENCIL);
+         }
+
+         /* handle remaning outputs (color) */
+         for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
+            if (outputsWritten & BITFIELD64_BIT(attr)) {
+               switch (attr) {
+               case FRAG_RESULT_DEPTH:
+               case FRAG_RESULT_STENCIL:
+                  /* handled above */
+                  assert(0);
+                  break;
+               case FRAG_RESULT_COLOR:
+                  write_all = GL_TRUE; /* fallthrough */
+               default:
+                  assert(attr == FRAG_RESULT_COLOR ||
+                         (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
+                  fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
+                  fs_output_semantic_index[fs_num_outputs] = numColors;
+                  outputMapping[attr] = fs_num_outputs;
+                  numColors++;
+                  break;
+               }
+
+               fs_num_outputs++;
+            }
          }
       }
-   }
 
-   ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
-   if (ureg == NULL)
-      return;
+      ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
+      if (ureg == NULL)
+         return NULL;
 
-   if (ST_DEBUG & DEBUG_MESA) {
-      _mesa_print_program(&stfp->Base.Base);
-      _mesa_print_program_parameters(st->ctx, &stfp->Base.Base);
-      debug_printf("\n");
+      if (ST_DEBUG & DEBUG_MESA) {
+         _mesa_print_program(&stfp->Base.Base);
+         _mesa_print_program_parameters(st->ctx, &stfp->Base.Base);
+         debug_printf("\n");
+      }
+      if (write_all == GL_TRUE)
+         ureg_property_fs_color0_writes_all_cbufs(ureg, 1);
+
+      error = st_translate_mesa_program(st->ctx,
+                                        TGSI_PROCESSOR_FRAGMENT,
+                                        ureg,
+                                        &stfp->Base.Base,
+                                        /* inputs */
+                                        fs_num_inputs,
+                                        inputMapping,
+                                        input_semantic_name,
+                                        input_semantic_index,
+                                        interpMode,
+                                        /* outputs */
+                                        fs_num_outputs,
+                                        outputMapping,
+                                        fs_output_semantic_name,
+                                        fs_output_semantic_index, FALSE );
+
+      stfp->tgsi.tokens = ureg_get_tokens( ureg, NULL );
+      ureg_destroy( ureg );
    }
 
-   error = 
-      st_translate_mesa_program(st->ctx,
-                                TGSI_PROCESSOR_FRAGMENT,
-                                ureg,
-                                &stfp->Base.Base,
-                                /* inputs */
-                                fs_num_inputs,
-                                inputMapping,
-                                input_semantic_name,
-                                input_semantic_index,
-                                interpMode,
-                                /* outputs */
-                                fs_num_outputs,
-                                outputMapping,
-                                fs_output_semantic_name,
-                                fs_output_semantic_index, FALSE );
-
-   stfp->tgsi.tokens = ureg_get_tokens( ureg, NULL );
-   ureg_destroy( ureg );
-   stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi);
+   /* fill in variant */
+   variant->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi);
+   variant->key = *key;
 
    if (ST_DEBUG & DEBUG_TGSI) {
       tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
       debug_printf("\n");
    }
+
+   return variant;
 }
 
-void
+
+/**
+ * Translate fragment program if needed.
+ */
+struct st_fp_variant *
+st_get_fp_variant(struct st_context *st,
+                  struct st_fragment_program *stfp,
+                  const struct st_fp_variant_key *key)
+{
+   struct st_fp_variant *fpv;
+
+   /* Search for existing variant */
+   for (fpv = stfp->variants; fpv; fpv = fpv->next) {
+      if (memcmp(&fpv->key, key, sizeof(*key)) == 0) {
+         break;
+      }
+   }
+
+   if (!fpv) {
+      /* create new */
+      fpv = st_translate_fragment_program(st, stfp, key);
+      if (fpv) {
+         /* insert into list */
+         fpv->next = stfp->variants;
+         stfp->variants = fpv;
+      }
+   }
+
+   return fpv;
+}
+
+
+/**
+ * Translate a geometry program to create a new variant.
+ */
+static struct st_gp_variant *
 st_translate_geometry_program(struct st_context *st,
-                              struct st_geometry_program *stgp)
+                              struct st_geometry_program *stgp,
+                              const struct st_gp_variant_key *key)
 {
    GLuint inputMapping[GEOM_ATTRIB_MAX];
    GLuint outputMapping[GEOM_RESULT_MAX];
@@ -492,12 +694,19 @@ st_translate_geometry_program(struct st_context *st,
    GLuint maxSlot = 0;
    struct ureg_program *ureg;
 
+   struct st_gp_variant *gpv;
+
+   gpv = CALLOC_STRUCT(st_gp_variant);
+   if (!gpv)
+      return NULL;
+
    _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_OUTPUT);
    _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_VARYING);
 
    ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY );
    if (ureg == NULL) {
-      return;
+      FREE(gpv);
+      return NULL;
    }
 
    /* which vertex output goes to the first geometry input */
@@ -527,7 +736,7 @@ st_translate_geometry_program(struct st_context *st,
          } else
             ++gs_builtin_inputs;
 
-#if 1
+#if 0
          debug_printf("input map at %d = %d\n",
                       slot + gs_array_offset, stgp->input_map[slot + gs_array_offset]);
 #endif
@@ -669,37 +878,35 @@ st_translate_geometry_program(struct st_context *st,
       st_free_tokens(stgp->tgsi.tokens);
       stgp->tgsi.tokens = NULL;
    }
-   if (stgp->driver_shader) {
-      cso_delete_geometry_shader(st->cso_context, stgp->driver_shader);
-      stgp->driver_shader = NULL;
-   }
 
    ureg_property_gs_input_prim(ureg, stgp->Base.InputType);
    ureg_property_gs_output_prim(ureg, stgp->Base.OutputType);
    ureg_property_gs_max_vertices(ureg, stgp->Base.VerticesOut);
 
-   error  = st_translate_mesa_program(st->ctx,
-                                      TGSI_PROCESSOR_GEOMETRY,
-                                      ureg,
-                                      &stgp->Base.Base,
-                                      /* inputs */
-                                      gs_num_inputs,
-                                      inputMapping,
-                                      stgp->input_semantic_name,
-                                      stgp->input_semantic_index,
-                                      NULL,
-                                      /* outputs */
-                                      gs_num_outputs,
-                                      outputMapping,
-                                      gs_output_semantic_name,
-                                      gs_output_semantic_index,
-                                      FALSE);
-
+   error = st_translate_mesa_program(st->ctx,
+                                     TGSI_PROCESSOR_GEOMETRY,
+                                     ureg,
+                                     &stgp->Base.Base,
+                                     /* inputs */
+                                     gs_num_inputs,
+                                     inputMapping,
+                                     stgp->input_semantic_name,
+                                     stgp->input_semantic_index,
+                                     NULL,
+                                     /* outputs */
+                                     gs_num_outputs,
+                                     outputMapping,
+                                     gs_output_semantic_name,
+                                     gs_output_semantic_index,
+                                     FALSE);
 
    stgp->num_inputs = gs_num_inputs;
    stgp->tgsi.tokens = ureg_get_tokens( ureg, NULL );
    ureg_destroy( ureg );
-   stgp->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi);
+
+   /* fill in new variant */
+   gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi);
+   gpv->key = *key;
 
    if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
       _mesa_print_program(&stgp->Base.Base);
@@ -710,8 +917,44 @@ st_translate_geometry_program(struct st_context *st,
       tgsi_dump(stgp->tgsi.tokens, 0);
       debug_printf("\n");
    }
+
+   return gpv;
 }
 
+
+/**
+ * Get/create geometry program variant.
+ */
+struct st_gp_variant *
+st_get_gp_variant(struct st_context *st,
+                  struct st_geometry_program *stgp,
+                  const struct st_gp_variant_key *key)
+{
+   struct st_gp_variant *gpv;
+
+   /* Search for existing variant */
+   for (gpv = stgp->variants; gpv; gpv = gpv->next) {
+      if (memcmp(&gpv->key, key, sizeof(*key)) == 0) {
+         break;
+      }
+   }
+
+   if (!gpv) {
+      /* create new */
+      gpv = st_translate_geometry_program(st, stgp, key);
+      if (gpv) {
+         /* insert into list */
+         gpv->next = stgp->variants;
+         stgp->variants = gpv;
+      }
+   }
+
+   return gpv;
+}
+
+
+
+
 /**
  * Debug- print current shader text
  */
@@ -757,3 +1000,155 @@ st_print_shaders(struct gl_context *ctx)
       }
    }
 }
+
+
+/**
+ * Vert/Geom/Frag programs have per-context variants.  Free all the
+ * variants attached to the given program which match the given context.
+ */
+static void
+destroy_program_variants(struct st_context *st, struct gl_program *program)
+{
+   if (!program)
+      return;
+
+   switch (program->Target) {
+   case GL_VERTEX_PROGRAM_ARB:
+      {
+         struct st_vertex_program *stvp = (struct st_vertex_program *) program;
+         struct st_vp_variant *vpv, **prevPtr = &stvp->variants;
+
+         for (vpv = stvp->variants; vpv; ) {
+            struct st_vp_variant *next = vpv->next;
+            if (vpv->key.st == st) {
+               /* unlink from list */
+               *prevPtr = next;
+               /* destroy this variant */
+               delete_vp_variant(st, vpv);
+            }
+            else {
+               prevPtr = &vpv->next;
+            }
+            vpv = next;
+         }
+      }
+      break;
+   case GL_FRAGMENT_PROGRAM_ARB:
+      {
+         struct st_fragment_program *stfp =
+            (struct st_fragment_program *) program;
+         struct st_fp_variant *fpv, **prevPtr = &stfp->variants;
+
+         for (fpv = stfp->variants; fpv; ) {
+            struct st_fp_variant *next = fpv->next;
+            if (fpv->key.st == st) {
+               /* unlink from list */
+               *prevPtr = next;
+               /* destroy this variant */
+               delete_fp_variant(st, fpv);
+            }
+            else {
+               prevPtr = &fpv->next;
+            }
+            fpv = next;
+         }
+      }
+      break;
+   case MESA_GEOMETRY_PROGRAM:
+      {
+         struct st_geometry_program *stgp =
+            (struct st_geometry_program *) program;
+         struct st_gp_variant *gpv, **prevPtr = &stgp->variants;
+
+         for (gpv = stgp->variants; gpv; ) {
+            struct st_gp_variant *next = gpv->next;
+            if (gpv->key.st == st) {
+               /* unlink from list */
+               *prevPtr = next;
+               /* destroy this variant */
+               delete_gp_variant(st, gpv);
+            }
+            else {
+               prevPtr = &gpv->next;
+            }
+            gpv = next;
+         }
+      }
+      break;
+   default:
+      _mesa_problem(NULL, "Unexpected program target in "
+                    "destroy_program_variants_cb()");
+   }
+}
+
+
+/**
+ * Callback for _mesa_HashWalk.  Free all the shader's program variants
+ * which match the given context.
+ */
+static void
+destroy_shader_program_variants_cb(GLuint key, void *data, void *userData)
+{
+   struct st_context *st = (struct st_context *) userData;
+   struct gl_shader *shader = (struct gl_shader *) data;
+
+   switch (shader->Type) {
+   case GL_SHADER_PROGRAM_MESA:
+      {
+         struct gl_shader_program *shProg = (struct gl_shader_program *) data;
+         GLuint i;
+
+         for (i = 0; i < shProg->NumShaders; i++) {
+            destroy_program_variants(st, shProg->Shaders[i]->Program);
+         }
+
+         destroy_program_variants(st, (struct gl_program *)
+                                  shProg->VertexProgram);
+         destroy_program_variants(st, (struct gl_program *)
+                                  shProg->FragmentProgram);
+         destroy_program_variants(st, (struct gl_program *)
+                                  shProg->GeometryProgram);
+      }
+      break;
+   case GL_VERTEX_SHADER:
+   case GL_FRAGMENT_SHADER:
+   case GL_GEOMETRY_SHADER:
+      {
+         destroy_program_variants(st, shader->Program);
+      }
+      break;
+   default:
+      assert(0);
+   }
+}
+
+
+/**
+ * Callback for _mesa_HashWalk.  Free all the program variants which match
+ * the given context.
+ */
+static void
+destroy_program_variants_cb(GLuint key, void *data, void *userData)
+{
+   struct st_context *st = (struct st_context *) userData;
+   struct gl_program *program = (struct gl_program *) data;
+   destroy_program_variants(st, program);
+}
+
+
+/**
+ * Walk over all shaders and programs to delete any variants which
+ * belong to the given context.
+ * This is called during context tear-down.
+ */
+void
+st_destroy_program_variants(struct st_context *st)
+{
+   /* ARB vert/frag program */
+   _mesa_HashWalk(st->ctx->Shared->Programs,
+                  destroy_program_variants_cb, st);
+
+   /* GLSL vert/frag/geom shaders */
+   _mesa_HashWalk(st->ctx->Shared->ShaderObjects,
+                  destroy_shader_program_variants_cb, st);
+}
index 72dbc715fe1de7920896af586757f3cb6f8ecda3..c4244df939e01a5092bd266d2579fac654225c2d 100644 (file)
 #include "st_context.h"
 
 
+/** Fragment program variant key */
+struct st_fp_variant_key
+{
+   struct st_context *st;         /**< variants are per-context */
+
+   /** for glBitmap */
+   GLuint bitmap:1;               /**< glBitmap variant? */
+
+   /** for glDrawPixels */
+   GLuint drawpixels:1;           /**< glDrawPixels variant */
+   GLuint scaleAndBias:1;         /**< glDrawPixels w/ scale and/or bias? */
+   GLuint pixelMaps:1;            /**< glDrawPixels w/ pixel lookup map? */
+   GLuint drawpixels_z:1;         /**< glDrawPixels(GL_DEPTH) */
+   GLuint drawpixels_stencil:1;   /**< glDrawPixels(GL_STENCIL) */
+};
+
+
+/**
+ * Variant of a fragment program.
+ */
+struct st_fp_variant
+{
+   /** Parameters which generated this version of fragment program */
+   struct st_fp_variant_key key;
+
+   /** Driver's compiled shader */
+   void *driver_shader;
+
+   /** For glBitmap variants */
+   struct gl_program_parameter_list *parameters;
+   uint bitmap_sampler;
+
+   /** next in linked list */
+   struct st_fp_variant *next;
+};
+
+
 /**
  * Derived from Mesa gl_fragment_program:
  */
 struct st_fragment_program
 {
    struct gl_fragment_program Base;
-   GLuint serialNo;
 
    struct pipe_shader_state tgsi;
-   void *driver_shader;
 
-   /** Program prefixed with glBitmap prologue */
-   struct st_fragment_program *bitmap_program;
-   uint bitmap_sampler;
+   struct st_fp_variant *variants;
 };
 
 
 
-struct st_vp_varient_key
+/** Vertex program variant key */
+struct st_vp_variant_key
 {
+   struct st_context *st;          /**< variants are per-context */
    boolean passthrough_edgeflags;
 };
 
@@ -68,12 +103,12 @@ struct st_vp_varient_key
  * This represents a vertex program, especially translated to match
  * the inputs of a particular fragment shader.
  */
-struct st_vp_varient
+struct st_vp_variant
 {
    /* Parameters which generated this translated version of a vertex
     * shader:
     */
-   struct st_vp_varient_key key;
+   struct st_vp_variant_key key;
 
    /**
     * TGSI tokens (to later generate a 'draw' module shader for
@@ -88,9 +123,9 @@ struct st_vp_varient
    struct draw_vertex_shader *draw_shader;
 
    /** Next in linked list */
-   struct st_vp_varient *next;  
+   struct st_vp_variant *next;  
 
-   /** similar to that in st_vertex_program, but with information about edgeflags too */
+   /** similar to that in st_vertex_program, but with edgeflags info too */
    GLuint num_inputs;
 };
 
@@ -101,7 +136,6 @@ struct st_vp_varient
 struct st_vertex_program
 {
    struct gl_vertex_program Base;  /**< The Mesa vertex program */
-   GLuint serialNo, lastSerialNo;
 
    /** maps a Mesa VERT_ATTRIB_x to a packed TGSI input index */
    GLuint input_to_index[VERT_ATTRIB_MAX];
@@ -115,18 +149,41 @@ struct st_vertex_program
    ubyte output_semantic_index[VERT_RESULT_MAX];
    GLuint num_outputs;
 
-   /** List of translated varients of this vertex program.
+   /** List of translated variants of this vertex program.
     */
-   struct st_vp_varient *varients;
+   struct st_vp_variant *variants;
+};
+
+
+
+/** Geometry program variant key */
+struct st_gp_variant_key
+{
+   struct st_context *st;          /**< variants are per-context */
+   /* no other fields yet */
+};
+
+
+/**
+ * Geometry program variant.
+ */
+struct st_gp_variant
+{
+   /* Parameters which generated this translated version of a vertex */
+   struct st_gp_variant_key key;
+
+   void *driver_shader;
+
+   struct st_gp_variant *next;
 };
 
+
 /**
  * Derived from Mesa gl_geometry_program:
  */
 struct st_geometry_program
 {
    struct gl_geometry_program Base;  /**< The Mesa geometry program */
-   GLuint serialNo;
 
    /** map GP input back to VP output */
    GLuint input_map[PIPE_MAX_SHADER_INPUTS];
@@ -145,9 +202,12 @@ struct st_geometry_program
    ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
 
    struct pipe_shader_state tgsi;
-   void *driver_shader;
+
+   struct st_gp_variant *variants;
 };
 
+
+
 static INLINE struct st_fragment_program *
 st_fragment_program( struct gl_fragment_program *fp )
 {
@@ -162,9 +222,9 @@ st_vertex_program( struct gl_vertex_program *vp )
 }
 
 static INLINE struct st_geometry_program *
-st_geometry_program( struct gl_geometry_program *vp )
+st_geometry_program( struct gl_geometry_program *gp )
 {
-   return (struct st_geometry_program *)vp;
+   return (struct st_geometry_program *)gp;
 }
 
 static INLINE void
@@ -198,32 +258,43 @@ st_reference_fragprog(struct st_context *st,
 }
 
 
-extern void
-st_translate_fragment_program(struct st_context *st,
-                              struct st_fragment_program *fp);
+extern struct st_vp_variant *
+st_get_vp_variant(struct st_context *st,
+                  struct st_vertex_program *stvp,
+                  const struct st_vp_variant_key *key);
+
+
+extern struct st_fp_variant *
+st_get_fp_variant(struct st_context *st,
+                  struct st_fragment_program *stfp,
+                  const struct st_fp_variant_key *key);
+
+
+extern struct st_gp_variant *
+st_get_gp_variant(struct st_context *st,
+                  struct st_geometry_program *stgp,
+                  const struct st_gp_variant_key *key);
+
+
 
 extern void
-st_translate_geometry_program(struct st_context *st,
-                              struct st_geometry_program *stgp);
+st_release_vp_variants( struct st_context *st,
+                        struct st_vertex_program *stvp );
 
-/* Called after program string change, discard all previous
- * compilation results.
- */
 extern void
-st_prepare_vertex_program(struct st_context *st,
-                          struct st_vertex_program *stvp);
+st_release_fp_variants( struct st_context *st,
+                        struct st_fragment_program *stfp );
 
-extern struct st_vp_varient *
-st_translate_vertex_program(struct st_context *st,
-                            struct st_vertex_program *stvp,
-                            const struct st_vp_varient_key *key);
+extern void
+st_release_gp_variants(struct st_context *st,
+                       struct st_geometry_program *stgp);
 
-void
-st_vp_release_varients( struct st_context *st,
-                        struct st_vertex_program *stvp );
 
 extern void
 st_print_shaders(struct gl_context *ctx);
 
+extern void
+st_destroy_program_variants(struct st_context *st);
+
 
 #endif
index c6cf2ba061b4cceb11d159b1834e033e3e7fa457..155ea39f18c07d9537b0c45355c69329f974b81f 100644 (file)
@@ -84,6 +84,7 @@ st_texture_create(struct st_context *st,
    pt.width0 = width0;
    pt.height0 = height0;
    pt.depth0 = depth0;
+   pt.array_size = (target == PIPE_TEXTURE_CUBE ? 6 : 1);
    pt.usage = PIPE_USAGE_DEFAULT;
    pt.bind = bind;
    pt.flags = 0;
@@ -136,7 +137,7 @@ st_texture_match_image(const struct pipe_resource *pt,
  */
 GLubyte *
 st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
-                    GLuint zoffset, enum pipe_transfer_usage usage,
+                     GLuint zoffset, enum pipe_transfer_usage usage,
                      GLuint x, GLuint y, GLuint w, GLuint h)
 {
    struct pipe_context *pipe = st->pipe;
@@ -144,9 +145,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
 
    DBG("%s \n", __FUNCTION__);
 
-   stImage->transfer = pipe_get_transfer(st->pipe, pt, stImage->face,
-                                                   stImage->level, zoffset,
-                                                   usage, x, y, w, h);
+   stImage->transfer = pipe_get_transfer(st->pipe, pt, stImage->level,
+                                         stImage->face + zoffset,
+                                         usage, x, y, w, h);
 
    if (stImage->transfer)
       return pipe_transfer_map(pipe, stImage->transfer);
@@ -219,10 +220,10 @@ st_texture_image_data(struct st_context *st,
    DBG("%s\n", __FUNCTION__);
 
    for (i = 0; i < depth; i++) {
-      dst_transfer = pipe_get_transfer(st->pipe, dst, face, level, i,
-                                                 PIPE_TRANSFER_WRITE, 0, 0,
-                                                 u_minify(dst->width0, level),
-                                                  u_minify(dst->height0, level));
+      dst_transfer = pipe_get_transfer(st->pipe, dst, level, face + i,
+                                       PIPE_TRANSFER_WRITE, 0, 0,
+                                       u_minify(dst->width0, level),
+                                       u_minify(dst->height0, level));
 
       st_surface_data(pipe, dst_transfer,
                      0, 0,                             /* dstx, dsty */
@@ -230,7 +231,7 @@ st_texture_image_data(struct st_context *st,
                      src_row_stride,
                      0, 0,                             /* source x, y */
                      u_minify(dst->width0, level),
-                      u_minify(dst->height0, level));      /* width, height */
+                      u_minify(dst->height0, level));    /* width, height */
 
       pipe->transfer_destroy(pipe, dst_transfer);
 
@@ -245,14 +246,10 @@ st_texture_image_data(struct st_context *st,
 static void
 print_center_pixel(struct pipe_context *pipe, struct pipe_resource *src)
 {
-   struct pipe_subresource rect;
    struct pipe_transfer *xfer;
    struct pipe_box region;
    ubyte *map;
 
-   rect.face = 0;
-   rect.level = 0;
-
    region.x = src->width0 / 2;
    region.y = src->height0 / 2;
    region.z = 0;
@@ -260,7 +257,7 @@ print_center_pixel(struct pipe_context *pipe, struct pipe_resource *src)
    region.height = 1;
    region.depth = 1;
 
-   xfer = pipe->get_transfer(pipe, src, rect, PIPE_TRANSFER_READ, &region);
+   xfer = pipe->get_transfer(pipe, src, 0, PIPE_TRANSFER_READ, &region);
    map = pipe->transfer_map(pipe, xfer);
 
    printf("center pixel: %d %d %d %d\n", map[0], map[1], map[2], map[3]);
@@ -282,22 +279,26 @@ st_texture_image_copy(struct pipe_context *pipe,
                       struct pipe_resource *src, GLuint srcLevel,
                       GLuint face)
 {
-   GLuint width = u_minify(dst->width0, dstLevel); 
-   GLuint height = u_minify(dst->height0, dstLevel); 
-   GLuint depth = u_minify(dst->depth0, dstLevel); 
-   struct pipe_subresource dstsub, srcsub;
+   GLuint width = u_minify(dst->width0, dstLevel);
+   GLuint height = u_minify(dst->height0, dstLevel);
+   GLuint depth = u_minify(dst->depth0, dstLevel);
+   struct pipe_box src_box;
    GLuint i;
 
    assert(u_minify(src->width0, srcLevel) == width);
    assert(u_minify(src->height0, srcLevel) == height);
    assert(u_minify(src->depth0, srcLevel) == depth);
 
-   dstsub.face = face;
-   dstsub.level = dstLevel;
-   srcsub.face = face;
-   srcsub.level = srcLevel;
+   src_box.x = 0;
+   src_box.y = 0;
+   src_box.width = width;
+   src_box.height = height;
+   src_box.depth = 1;
    /* Loop over 3D image slices */
-   for (i = 0; i < depth; i++) {
+   /* could (and probably should) use "true" 3d box here -
+      but drivers can't quite handle it yet */
+   for (i = face; i < face + depth; i++) {
+      src_box.z = i;
 
       if (0)  {
          print_center_pixel(pipe, src);
@@ -305,12 +306,11 @@ st_texture_image_copy(struct pipe_context *pipe,
 
       pipe->resource_copy_region(pipe,
                                  dst,
-                                 dstsub,
+                                 dstLevel,
                                  0, 0, i,/* destX, Y, Z */
                                  src,
-                                 srcsub,
-                                 0, 0, i,/* srcX, Y, Z */
-                                 width, height);
+                                 srcLevel,
+                                 &src_box);
    }
 }
 
index f7d92c52412874ade18e6b35692e584985a5d27e..74d5518e1792211f2de8ff61b3f8dfb07e379d57 100644 (file)
@@ -28,7 +28,7 @@
 #define S_AALINE_H
 
 
-#include "main/mtypes.h"
+struct gl_context;
 
 
 extern void
index 746e456f5f493f8dde2d1a88ce2c28dddfba5a8a..e40efb1985bd2e7674f9435df4f550cf074ef6d4 100644 (file)
@@ -28,7 +28,7 @@
 #define S_AATRIANGLE_H
 
 
-#include "main/mtypes.h"
+struct gl_context;
 
 
 extern void
index 071644b64fad245672c9b43f070d9143bb43e6a6..1ad7d32952955c91494da15d62ac2b439a352d6c 100644 (file)
@@ -27,7 +27,8 @@
 #define S_ACCUM_H
 
 
-#include "main/mtypes.h"
+struct gl_context;
+struct gl_renderbuffer;
 
 
 extern void
index 7cd6d800b29b5b225d6005723bc0363f8dfcb7f2..fca209a446784ca7b785bfbf7dd9006a7f0214ba 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Mesa 3-D graphics library
  * Version:  4.1
 #define S_ALPHA_H
 
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 #include "s_span.h"
 
+struct gl_context;
 
 extern GLint
 _swrast_alpha_test( const struct gl_context *ctx, SWspan *span );
index 39a6e64ed924e7f55498083b7a6acf4e2e804918..10aaaa592c7fe6599e354d401431f0ca8eef2be4 100644 (file)
@@ -27,9 +27,9 @@
 #define S_ATIFRAGSHADER_H
 
 
-#include "main/mtypes.h"
 #include "s_span.h"
 
+struct gl_context;
 
 extern void
 _swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span );
index 1a550c445d3c60543d757858c06303393b395a2f..d61baba0f33bbcf944cacb19fc75afe2e6e7bb0f 100644 (file)
@@ -819,7 +819,16 @@ static void
 blend_general(struct gl_context *ctx, GLuint n, const GLubyte mask[],
               void *src, const void *dst, GLenum chanType)
 {
-   GLfloat rgbaF[MAX_WIDTH][4], destF[MAX_WIDTH][4];
+   GLfloat (*rgbaF)[4], (*destF)[4];
+
+   rgbaF = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+   destF = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+   if (!rgbaF || !destF) {
+      free(rgbaF);
+      free(destF);
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "blending");
+      return;
+   }
 
    if (chanType == GL_UNSIGNED_BYTE) {
       GLubyte (*rgba)[4] = (GLubyte (*)[4]) src;
@@ -883,6 +892,9 @@ blend_general(struct gl_context *ctx, GLuint n, const GLubyte mask[],
       blend_general_float(ctx, n, mask, (GLfloat (*)[4]) src,
                           (GLfloat (*)[4]) dst, chanType);
    }
+
+   free(rgbaF);
+   free(destF);
 }
 
 
index 8b06dd5031eb88c5af4a26e346e4ced328271698..69cd89e7ac4a0fce6d9f7f8582a65d05323d4828 100644 (file)
 #define S_BLEND_H
 
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 #include "s_span.h"
 
+struct gl_context;
+struct gl_renderbuffer;
+
 
 extern void
 _swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span);
index e5dae7ef8650101c1db00ef5b51f7b2306a74945..44820ac8f76f327b47d8874b4b9b4a3a1c34fff9 100644 (file)
 #define S_DEPTH_H
 
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 #include "s_span.h"
 
+struct gl_context;
+struct gl_renderbuffer;
+
 
 extern GLuint
 _swrast_depth_test_span( struct gl_context *ctx, SWspan *span);
index 4e9b5307cc7f0a4ea5da1ae3fbcd785ef4a58151..4d0666898b47d28fe07fa3c0d906df46370e49e6 100644 (file)
@@ -720,13 +720,16 @@ _swrast_DrawPixels( struct gl_context *ctx,
    if (swrast->NewState)
       _swrast_validate_derived( ctx );
 
-    pixels = _mesa_map_pbo_source(ctx, unpack, pixels);
-    if (!pixels) {
-       swrast_render_finish(ctx);
-       _mesa_set_vp_override(ctx, save_vp_override);
-       return;
-    }
+   pixels = _mesa_map_pbo_source(ctx, unpack, pixels);
+   if (!pixels) {
+      swrast_render_finish(ctx);
+      _mesa_set_vp_override(ctx, save_vp_override);
+      return;
+   }
 
+   /*
+    * By time we get here, all error checking should have been done.
+    */
    switch (format) {
    case GL_STENCIL_INDEX:
       draw_stencil_pixels( ctx, x, y, width, height, type, unpack, pixels );
@@ -734,27 +737,12 @@ _swrast_DrawPixels( struct gl_context *ctx,
    case GL_DEPTH_COMPONENT:
       draw_depth_pixels( ctx, x, y, width, height, type, unpack, pixels );
       break;
-   case GL_COLOR_INDEX:
-   case GL_RED:
-   case GL_GREEN:
-   case GL_BLUE:
-   case GL_ALPHA:
-   case GL_LUMINANCE:
-   case GL_LUMINANCE_ALPHA:
-   case GL_RGB:
-   case GL_BGR:
-   case GL_RGBA:
-   case GL_BGRA:
-   case GL_ABGR_EXT:
-      draw_rgba_pixels(ctx, x, y, width, height, format, type, unpack, pixels);
-      break;
    case GL_DEPTH_STENCIL_EXT:
-      draw_depth_stencil_pixels(ctx, x, y, width, height,
-                                type, unpack, pixels);
+      draw_depth_stencil_pixels(ctx, x, y, width, height, type, unpack, pixels);
       break;
    default:
-      _mesa_problem(ctx, "unexpected format 0x%x in _swrast_DrawPixels", format);
-      /* don't return yet, clean-up */
+      /* all other formats should be color formats */
+      draw_rgba_pixels(ctx, x, y, width, height, format, type, unpack, pixels);
    }
 
    swrast_render_finish(ctx);
index ebc3513f496c070ac6e51f1beeee0887f7d2309e..9f93b7050843cf1f438012cd59f5fa463915ec3c 100644 (file)
 #define S_FOG_H
 
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 #include "s_span.h"
 
+struct gl_context;
 
 extern GLfloat
 _swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z);
index 689d3fc82e4a79fc5adcb525803ea03731713215..62a68361769f3edb8b7859cea9f9f401da31b3db 100644 (file)
 #define S_FRAGPROG_H
 
 
-#include "main/mtypes.h"
 #include "s_span.h"
 
+struct gl_context;
+
 
 extern void
 _swrast_exec_fragment_program(struct gl_context *ctx, SWspan *span);
index 95c7fe3e1501b55145a2b12f003b8dcea9c7d329..0a3adfca5ff665ad52276f858c3e6ffb5e760e9b 100644 (file)
 #define S_LOGIC_H
 
 
-#include "main/mtypes.h"
 #include "s_span.h"
 
+struct gl_context;
+struct gl_renderbuffer;
+
 extern void
 _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
                           SWspan *span);
index 3712c82163b9813d1d52084fa1440371b90b2bf0..5124509a04910b3ef8de1e67fc663881459758df 100644 (file)
 #define S_MASKING_H
 
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 #include "s_span.h"
 
+struct gl_context;
+struct gl_renderbuffer;
+
 
 extern void
 _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
index 5e6356c0d549e14b62915a69c8a419e0f2c89c3a..9fe0752a37f1ef28f35d046f60efd49a8517a7ec 100644 (file)
@@ -476,49 +476,33 @@ _swrast_ReadPixels( struct gl_context *ctx,
       _swrast_validate_derived( ctx );
 
    /* Do all needed clipping here, so that we can forget about it later */
-   if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) {
-      /* The ReadPixels region is totally outside the window bounds */
-      swrast_render_finish(ctx);
-      return;
-   }
-
-   pixels = _mesa_map_pbo_dest(ctx, &clippedPacking, pixels);
-   if (!pixels)
-      return;
-  
-   switch (format) {
-      case GL_STENCIL_INDEX:
-        read_stencil_pixels(ctx, x, y, width, height, type, pixels,
+   if (_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) {
+
+      pixels = _mesa_map_pbo_dest(ctx, &clippedPacking, pixels);
+
+      if (pixels) {
+         switch (format) {
+         case GL_STENCIL_INDEX:
+            read_stencil_pixels(ctx, x, y, width, height, type, pixels,
+                                &clippedPacking);
+            break;
+         case GL_DEPTH_COMPONENT:
+            read_depth_pixels(ctx, x, y, width, height, type, pixels,
+                              &clippedPacking);
+            break;
+         case GL_DEPTH_STENCIL_EXT:
+            read_depth_stencil_pixels(ctx, x, y, width, height, type, pixels,
+                                      &clippedPacking);
+            break;
+         default:
+            /* all other formats should be color formats */
+            read_rgba_pixels(ctx, x, y, width, height, format, type, pixels,
                              &clippedPacking);
-         break;
-      case GL_DEPTH_COMPONENT:
-        read_depth_pixels(ctx, x, y, width, height, type, pixels,
-                           &clippedPacking);
-        break;
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_RGB:
-      case GL_LUMINANCE:
-      case GL_LUMINANCE_ALPHA:
-      case GL_RGBA:
-      case GL_BGR:
-      case GL_BGRA:
-      case GL_ABGR_EXT:
-         read_rgba_pixels(ctx, x, y, width, height,
-                          format, type, pixels, &clippedPacking);
-        break;
-      case GL_DEPTH_STENCIL_EXT:
-         read_depth_stencil_pixels(ctx, x, y, width, height,
-                                   type, pixels, &clippedPacking);
-         break;
-      default:
-        _mesa_problem(ctx, "unexpected format 0x%x in _swrast_ReadPixels", format);
-         /* don't return yet, clean-up */
+         }
+
+         _mesa_unmap_pbo_dest(ctx, &clippedPacking);
+      }
    }
 
    swrast_render_finish(ctx);
-
-   _mesa_unmap_pbo_dest(ctx, &clippedPacking);
 }
index 18e275ec8aba24243e076c7bb2800eb133a16f5a..afafbe09acf52e19079305be942770bda4f1abc6 100644 (file)
 #define S_SPAN_H
 
 
-#include "swrast.h"
+#include "main/config.h"
+#include "main/glheader.h"
+#include "main/mtypes.h"
+
+struct gl_context;
+struct gl_renderbuffer;
 
 
 /**
index 1836d074aee9ceb2610d8c6ae8188aa9264dcf25..99c44413fbe80dd3d47337744344aeffcfc1b5c9 100644 (file)
@@ -86,10 +86,28 @@ texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
    const GLfloat scaleA = (GLfloat) (1 << combine->ScaleShiftA);
    const GLuint numArgsRGB = combine->_NumArgsRGB;
    const GLuint numArgsA = combine->_NumArgsA;
-   GLfloat ccolor[MAX_COMBINER_TERMS][MAX_WIDTH][4]; /* temp color buffers */
-   GLfloat rgba[MAX_WIDTH][4];
+   float4_array ccolor[4], rgba;
    GLuint i, term;
 
+   /* alloc temp pixel buffers */
+   rgba = (float4_array) malloc(4 * n * sizeof(GLfloat));
+   if (!rgba) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
+      return;
+   }
+
+   for (i = 0; i < numArgsRGB || i < numArgsA; i++) {
+      ccolor[i] = (float4_array) malloc(4 * n * sizeof(GLfloat));
+      if (!ccolor[i]) {
+         while (i) {
+            free(ccolor[i]);
+            i--;
+         }
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
+         return;
+      }
+   }
+
    for (i = 0; i < n; i++) {
       rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]);
       rgba[i][GCOMP] = CHAN_TO_FLOAT(rgbaChan[i][GCOMP]);
@@ -163,7 +181,7 @@ texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
                const GLuint srcUnit = srcRGB - GL_TEXTURE0;
                ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
                if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
-                  return;
+                  goto end;
                argRGB[term] = get_texel_array(swrast, srcUnit);
             }
       }
@@ -253,7 +271,7 @@ texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
                const GLuint srcUnit = srcA - GL_TEXTURE0;
                ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
                if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
-                  return;
+                  goto end;
                argA[term] = get_texel_array(swrast, srcUnit);
             }
       }
@@ -411,7 +429,7 @@ texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
             rgba[i][BCOMP] = 0.0;
             rgba[i][ACOMP] = 1.0;
         }
-         return; /* no alpha processing */
+         goto end; /* no alpha processing */
       default:
          _mesa_problem(ctx, "invalid combine mode");
       }
@@ -519,6 +537,12 @@ texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
       UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][BCOMP], rgba[i][BCOMP]);
       UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][ACOMP], rgba[i][ACOMP]);
    }
+
+end:
+   for (i = 0; i < numArgsRGB || i < numArgsA; i++) {
+      free(ccolor[i]);
+   }
+   free(rgba);
 }
 
 
@@ -559,9 +583,16 @@ void
 _swrast_texture_span( struct gl_context *ctx, SWspan *span )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLfloat primary_rgba[MAX_WIDTH][4];
+   float4_array primary_rgba;
    GLuint unit;
 
+   primary_rgba = (float4_array) malloc(span->end * 4 * sizeof(GLfloat));
+
+   if (!primary_rgba) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_span");
+      return;
+   }
+
    ASSERT(span->end <= MAX_WIDTH);
 
    /*
@@ -706,4 +737,6 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
                           span->array->rgba );
       }
    }
+
+   free(primary_rgba);
 }
index 5f47ebecbf1c60ea57283c435e3e961d2863ca45..11049d86b262b2c0bab51a2a09591a83dfec3e1e 100644 (file)
 #define S_TEXCOMBINE_H
 
 
-#include "main/mtypes.h"
 #include "s_span.h"
 
+struct gl_context;
+
 extern void
 _swrast_texture_span( struct gl_context *ctx, SWspan *span );
 
index 539d878ddb46483ca497bfd877288029fb83a56d..ecc09e095fd39206d8854c4e4f7cf3b47b4c6c84 100644 (file)
@@ -27,7 +27,6 @@
 #include "main/context.h"
 #include "main/colormac.h"
 #include "main/imports.h"
-#include "main/texformat.h"
 
 #include "s_context.h"
 #include "s_texfilter.h"
index 34520f229482794cd6b0d23ae2a3135d09f0a038..69f2d80003a0187479c7a96b08d2c68868b46941 100644 (file)
 #define S_TEXFILTER_H
 
 
-#include "main/mtypes.h"
 #include "s_context.h"
 
+struct gl_context;
+struct gl_texture_object;
+
 
 extern texture_sample_func
 _swrast_choose_texture_sample_func( struct gl_context *ctx,
index 85513e1f204f0d3e9352f7ecf5f491fb7d87b051..066f18203f17d7eea63e1418f9d77282aeeff0c0 100644 (file)
@@ -34,7 +34,7 @@
 #include "main/colormac.h"
 #include "main/imports.h"
 #include "main/macros.h"
-#include "main/texformat.h"
+#include "main/mtypes.h"
 #include "program/prog_instruction.h"
 
 #include "s_aatriangle.h"
index 05110865dafa6c6032a7f5ac7056b3abc2a52b7d..a027f48269e55fb08f86c6b27974c5a9f74766ed 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef SS_TRIANGLE_H
 #define SS_TRIANGLE_H
 
-#include "main/mtypes.h"
+struct gl_context;
 
 
 void _swsetup_trifuncs_init( struct gl_context *ctx );
index b8322f35a3d64ef05eb9c712c36d55945638caae..05e665b5c3029f0c14662d36b5db5fcc6c7a8b3c 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef SS_VB_H
 #define SS_VB_H
 
-#include "main/mtypes.h"
+struct gl_context;
 
 void _swsetup_vb_init( struct gl_context *ctx );
 void _swsetup_choose_rastersetup_func( struct gl_context *ctx );
index a1853689a437a568b1a3bbf554d2e46c14787ba8..f5d8f7477aaec5e0c137cef961cd22bc51bdc229 100644 (file)
@@ -67,6 +67,8 @@ struct vp_stage_data {
    GLvector4f ndcCoords;              /**< normalized device coords */
    GLubyte *clipmask;                 /**< clip flags */
    GLubyte ormask, andmask;           /**< for clipping */
+
+   struct gl_program_machine machine;
 };
 
 
@@ -314,7 +316,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
    struct vp_stage_data *store = VP_STAGE_DATA(stage);
    struct vertex_buffer *VB = &tnl->vb;
    struct gl_vertex_program *program = ctx->VertexProgram._Current;
-   struct gl_program_machine machine;
+   struct gl_program_machine *machine = &store->machine;
    GLuint outputs[VERT_RESULT_MAX], numOutputs;
    GLuint i, j;
 
@@ -342,7 +344,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
    for (i = 0; i < VB->Count; i++) {
       GLuint attr;
 
-      init_machine(ctx, &machine, tnl->CurInstance);
+      init_machine(ctx, machine, tnl->CurInstance);
 
 #if 0
       printf("Input  %d: %f, %f, %f, %f\n", i,
@@ -375,23 +377,23 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
             check_float(data[2]);
             check_float(data[3]);
 #endif
-           COPY_CLEAN_4V(machine.VertAttribs[attr], size, data);
+           COPY_CLEAN_4V(machine->VertAttribs[attr], size, data);
         }
       }
 
       /* execute the program */
-      _mesa_execute_program(ctx, &program->Base, &machine);
+      _mesa_execute_program(ctx, &program->Base, machine);
 
       /* copy the output registers into the VB->attribs arrays */
       for (j = 0; j < numOutputs; j++) {
          const GLuint attr = outputs[j];
 #ifdef NAN_CHECK
-         check_float(machine.Outputs[attr][0]);
-         check_float(machine.Outputs[attr][1]);
-         check_float(machine.Outputs[attr][2]);
-         check_float(machine.Outputs[attr][3]);
+         check_float(machine->Outputs[attr][0]);
+         check_float(machine->Outputs[attr][1]);
+         check_float(machine->Outputs[attr][2]);
+         check_float(machine->Outputs[attr][3]);
 #endif
-         COPY_4V(store->results[attr].data[i], machine.Outputs[attr]);
+         COPY_4V(store->results[attr].data[i], machine->Outputs[attr]);
       }
 
       /* FOGC is a special case.  Fragment shader expects (f,0,0,1) */
@@ -401,14 +403,14 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
          store->results[VERT_RESULT_FOGC].data[i][3] = 1.0;
       }
 #ifdef NAN_CHECK
-      ASSERT(machine.Outputs[0][3] != 0.0F);
+      ASSERT(machine->Outputs[0][3] != 0.0F);
 #endif
 #if 0
       printf("HPOS: %f %f %f %f\n",
-             machine.Outputs[0][0], 
-             machine.Outputs[0][1], 
-             machine.Outputs[0][2], 
-             machine.Outputs[0][3]);
+             machine->Outputs[0][0], 
+             machine->Outputs[0][1], 
+             machine->Outputs[0][2], 
+             machine->Outputs[0][3]);
 #endif
    }
 
@@ -504,7 +506,7 @@ init_vp(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
    const GLuint size = VB->Size;
    GLuint i;
 
-   stage->privatePtr = MALLOC(sizeof(*store));
+   stage->privatePtr = CALLOC(sizeof(*store));
    store = VP_STAGE_DATA(stage);
    if (!store)
       return GL_FALSE;
index 252f2f7c295c4af210416b988e8198009aa02992..83b0dbcebbd384e72e7495b238e50e71fb59e347 100644 (file)
 #ifndef _TNL_VERTEX_H
 #define _TNL_VERTEX_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 #include "t_context.h"
 
+struct gl_context;
+struct tnl_clipspace;
+
 /* New mechanism to specify hardware vertices so that tnl can build
  * and manipulate them directly.  
  */
index 421ec88a4543a1ad781cc8ca1f6b357036dff8fc..70492a4353d89d6804b0da8869dc66f3bffd6935 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "main/glheader.h"
 #include "main/ffvertex_prog.h"
-#include "main/dd.h"
+#include "main/mtypes.h"
 #include "t_vp_build.h"
 
 
index 1d10ff245d96eb01040f933643f95387fccce363..e9f6de5a920cfda92359e43e2df946d5993b6ee8 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef T_VP_BUILD_H
 #define T_VP_BUILD_H
 
-#include "main/mtypes.h"
+struct gl_context;
 
 #define TNL_FIXED_FUNCTION_STATE_FLAGS (_NEW_PROGRAM |         \
                                        _NEW_LIGHT |            \
index 702efdc5ccab05b2771fbc26884efba8eebebe30..24a0c725008ca7bfe84506fa5aabcc53a3bfcd53 100644 (file)
 #ifndef _TNL_H
 #define _TNL_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
 
+struct gl_client_array;
+struct gl_context;
+struct gl_program;
 
 
 /* These are the public-access functions exported from tnl.  (A few
index 7b8da8eb8437eefbf1e5288b4d187b112a45c562..e221538bad48c672e57ec3c5e74bd9497bb6954d 100644 (file)
 #ifndef _VBO_H
 #define _VBO_H
 
-#include "main/mtypes.h"
+#include "main/glheader.h"
+
+struct gl_client_array;
+struct gl_context;
 
 struct _mesa_prim {
    GLuint mode:8;
@@ -40,7 +43,8 @@ struct _mesa_prim {
    GLuint begin:1;
    GLuint end:1;
    GLuint weak:1;
-   GLuint pad:20;
+   GLuint no_current_update:1;
+   GLuint pad:19;
 
    GLuint start;
    GLuint count;
@@ -128,42 +132,42 @@ void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func);
 
 
 void GLAPIENTRY
-_vbo_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
+_es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
 
 void GLAPIENTRY
-_vbo_Normal3f(GLfloat x, GLfloat y, GLfloat z);
+_es_Normal3f(GLfloat x, GLfloat y, GLfloat z);
 
 void GLAPIENTRY
-_vbo_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+_es_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
 
 void GLAPIENTRY
-_vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params);
+_es_Materialfv(GLenum face, GLenum pname, const GLfloat *params);
 
 void GLAPIENTRY
-_vbo_Materialf(GLenum face, GLenum pname, GLfloat param);
+_es_Materialf(GLenum face, GLenum pname, GLfloat param);
 
 void GLAPIENTRY
-_vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+_es_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
 
 void GLAPIENTRY
-_vbo_VertexAttrib1f(GLuint indx, GLfloat x);
+_es_VertexAttrib1f(GLuint indx, GLfloat x);
 
 void GLAPIENTRY
-_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values);
+_es_VertexAttrib1fv(GLuint indx, const GLfloat* values);
 
 void GLAPIENTRY
-_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
+_es_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
 
 void GLAPIENTRY
-_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values);
+_es_VertexAttrib2fv(GLuint indx, const GLfloat* values);
 
 void GLAPIENTRY
-_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+_es_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
 
 void GLAPIENTRY
-_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values);
+_es_VertexAttrib3fv(GLuint indx, const GLfloat* values);
 
 void GLAPIENTRY
-_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values);
+_es_VertexAttrib4fv(GLuint indx, const GLfloat* values);
 
 #endif
index 9992cc347396741710c482aca5a0f1709e03bd28..6656ed898169b73bd6f7fd4a9ddb71d6d187fae2 100644 (file)
@@ -209,7 +209,6 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
 
 void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state )
 {
-   _ae_invalidate_state(ctx, new_state);
    vbo_exec_invalidate_state(ctx, new_state);
 }
 
index 8d6f2a7ce6d7efe7259a39becf4d500304c5e508..2ded6ccbff27eb5116a4b7b3efc34a607d7cb496 100644 (file)
@@ -51,6 +51,7 @@
 #ifndef _VBO_CONTEXT_H
 #define _VBO_CONTEXT_H
 
+#include "main/mfeatures.h"
 #include "vbo.h"
 #include "vbo_attrib.h"
 #include "vbo_exec.h"
index 47e51f09c944f78cd9729bb2681d2dd7dab5ec7e..d56c91cd0946d3d981f084c66243e91bc1e49152 100644 (file)
@@ -34,6 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifndef __VBO_EXEC_H__
 #define __VBO_EXEC_H__
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "vbo.h"
 #include "vbo_attrib.h"
index 9b2d59f9e4ce9fad0ec7c068be9c0537e52607b8..03d6bb4aefe1602c931b822b7887627057d138bb 100644 (file)
@@ -34,6 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/bufferobj.h"
 #include "main/context.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/vtxfmt.h"
 #include "main/dlist.h"
 #include "main/eval.h"
@@ -369,8 +370,6 @@ static void vbo_exec_fixup_vertex( struct gl_context *ctx,
 }
 
 
-#if FEATURE_beginend
-
 /* 
  */
 #define ATTR( A, N, V0, V1, V2, V3 )                           \
@@ -411,7 +410,7 @@ do {                                                                \
 #include "vbo_attrib_tmp.h"
 
 
-
+#if FEATURE_beginend
 
 
 #if FEATURE_evaluators
@@ -706,30 +705,6 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
 #else /* FEATURE_beginend */
 
 
-#define ATTR( A, N, V0, V1, V2, V3 )                           \
-do {                                                           \
-   struct vbo_exec_context *exec = &vbo_context(ctx)->exec;    \
-                                                               \
-   /* FLUSH_UPDATE_CURRENT needs to be set manually */         \
-   exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;                \
-                                                               \
-   if (exec->vtx.active_sz[A] != N)                            \
-      vbo_exec_fixup_vertex(ctx, A, N);                                \
-                                                               \
-   {                                                           \
-      GLfloat *dest = exec->vtx.attrptr[A];                    \
-      if (N>0) dest[0] = V0;                                   \
-      if (N>1) dest[1] = V1;                                   \
-      if (N>2) dest[2] = V2;                                   \
-      if (N>3) dest[3] = V3;                                   \
-   }                                                           \
-} while (0)
-
-#define ERROR() _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ )
-#define TAG(x) vbo_##x
-
-#include "vbo_attrib_tmp.h"
-
 static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
 {
    /* silence warnings */
@@ -998,35 +973,35 @@ static void reset_attrfv( struct vbo_exec_context *exec )
       
 
 void GLAPIENTRY
-_vbo_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
+_es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
 {
    vbo_Color4f(r, g, b, a);
 }
 
 
 void GLAPIENTRY
-_vbo_Normal3f(GLfloat x, GLfloat y, GLfloat z)
+_es_Normal3f(GLfloat x, GLfloat y, GLfloat z)
 {
    vbo_Normal3f(x, y, z);
 }
 
 
 void GLAPIENTRY
-_vbo_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+_es_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
 {
    vbo_MultiTexCoord4f(target, s, t, r, q);
 }
 
 
 void GLAPIENTRY
-_vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
+_es_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
 {
    vbo_Materialfv(face, pname, params);
 }
 
 
 void GLAPIENTRY
-_vbo_Materialf(GLenum face, GLenum pname, GLfloat param)
+_es_Materialf(GLenum face, GLenum pname, GLfloat param)
 {
    GLfloat p[4];
    p[0] = param;
@@ -1035,57 +1010,71 @@ _vbo_Materialf(GLenum face, GLenum pname, GLfloat param)
 }
 
 
+/**
+ * A special version of glVertexAttrib4f that does not treat index 0 as
+ * VBO_ATTRIB_POS.
+ */
+static void
+VertexAttrib4f_nopos(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   if (index < MAX_VERTEX_GENERIC_ATTRIBS)
+      ATTR(VBO_ATTRIB_GENERIC0 + index, 4, x, y, z, w);
+   else
+      ERROR();
+}
+
 void GLAPIENTRY
-_vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+_es_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
-   vbo_VertexAttrib4fARB(index, x, y, z, w);
+   VertexAttrib4f_nopos(index, x, y, z, w);
 }
 
 
 void GLAPIENTRY
-_vbo_VertexAttrib1f(GLuint indx, GLfloat x)
+_es_VertexAttrib1f(GLuint indx, GLfloat x)
 {
-   vbo_VertexAttrib1fARB(indx, x);
+   VertexAttrib4f_nopos(indx, x, 0.0f, 0.0f, 1.0f);
 }
 
 
 void GLAPIENTRY
-_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values)
+_es_VertexAttrib1fv(GLuint indx, const GLfloat* values)
 {
-   vbo_VertexAttrib1fvARB(indx, values);
+   VertexAttrib4f_nopos(indx, values[0], 0.0f, 0.0f, 1.0f);
 }
 
 
 void GLAPIENTRY
-_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+_es_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
 {
-   vbo_VertexAttrib2fARB(indx, x, y);
+   VertexAttrib4f_nopos(indx, x, y, 0.0f, 1.0f);
 }
 
 
 void GLAPIENTRY
-_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values)
+_es_VertexAttrib2fv(GLuint indx, const GLfloat* values)
 {
-   vbo_VertexAttrib2fvARB(indx, values);
+   VertexAttrib4f_nopos(indx, values[0], values[1], 0.0f, 1.0f);
 }
 
 
 void GLAPIENTRY
-_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+_es_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
 {
-   vbo_VertexAttrib3fARB(indx, x, y, z);
+   VertexAttrib4f_nopos(indx, x, y, z, 1.0f);
 }
 
 
 void GLAPIENTRY
-_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values)
+_es_VertexAttrib3fv(GLuint indx, const GLfloat* values)
 {
-   vbo_VertexAttrib3fvARB(indx, values);
+   VertexAttrib4f_nopos(indx, values[0], values[1], values[2], 1.0f);
 }
 
 
 void GLAPIENTRY
-_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values)
+_es_VertexAttrib4fv(GLuint indx, const GLfloat* values)
 {
-   vbo_VertexAttrib4fvARB(indx, values);
+   VertexAttrib4f_nopos(indx, values[0], values[1], values[2], values[3]);
 }
index 94aa021ac9a93022a626c5a5c777bb58a4edc409..87f6431056113706c524cd3b4db7c25a4e8cf282 100644 (file)
@@ -29,6 +29,7 @@
 #include "main/bufferobj.h"
 #include "main/compiler.h"
 #include "main/enums.h"
+#include "main/mfeatures.h"
 #include "main/state.h"
 
 #include "vbo_context.h"
index 4e7bcddc97020f609ef2c4e3f745a164c7603c29..4343b34818092ba88602c56718640b2ef9fc41aa 100644 (file)
@@ -29,6 +29,7 @@
 #include "main/mtypes.h"
 #include "main/bufferobj.h"
 #include "main/imports.h"
+#include "main/mfeatures.h"
 
 #include "vbo_context.h"
 
index f5a407ced14f6f971861b8678778087a224bc5a0..cd827ce6c06ca438070adbb1a319a0e952042f8b 100644 (file)
@@ -34,6 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifndef VBO_SAVE_H
 #define VBO_SAVE_H
 
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "vbo.h"
 #include "vbo_attrib.h"
@@ -96,7 +97,9 @@ struct vbo_save_vertex_list {
  */
 #define VBO_SAVE_BUFFER_SIZE (8*1024) /* dwords */
 #define VBO_SAVE_PRIM_SIZE   128
-#define VBO_SAVE_PRIM_WEAK 0x40
+#define VBO_SAVE_PRIM_MODE_MASK         0x3f
+#define VBO_SAVE_PRIM_WEAK              0x40
+#define VBO_SAVE_PRIM_NO_CURRENT_UPDATE 0x80
 
 #define VBO_SAVE_FALLBACK    0x10000000
 
index 817d478e2acf41258ec2074e314747cc5d5774e4..4ee78e9e1037f9eef67b5fc5d9de198d03f496cc 100644 (file)
@@ -74,6 +74,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/enums.h"
 #include "main/eval.h"
 #include "main/macros.h"
+#include "main/mfeatures.h"
 #include "main/api_noop.h"
 #include "main/api_validate.h"
 #include "main/api_arrayelt.h"
@@ -294,26 +295,30 @@ static void _save_compile_vertex_list( struct gl_context *ctx )
    node->vertex_store->refcount++;
    node->prim_store->refcount++;
 
-
-   node->current_size = node->vertex_size - node->attrsz[0];
-   node->current_data = NULL;
-
-   if (node->current_size) {
-      /* If the malloc fails, we just pull the data out of the VBO
-       * later instead.
-       */
-      node->current_data = MALLOC( node->current_size * sizeof(GLfloat) );
-      if (node->current_data) {
-         const char *buffer = (const char *)save->vertex_store->buffer;
-         unsigned attr_offset = node->attrsz[0] * sizeof(GLfloat);
-         unsigned vertex_offset = 0;
-
-         if (node->count)
-            vertex_offset = (node->count-1) * node->vertex_size * sizeof(GLfloat);
-
-         memcpy( node->current_data,
-                 buffer + node->buffer_offset + vertex_offset + attr_offset,
-                 node->current_size * sizeof(GLfloat) );
+   if (node->prim[0].no_current_update) {
+      node->current_size = 0;
+      node->current_data = NULL;
+   } else {
+      node->current_size = node->vertex_size - node->attrsz[0];
+      node->current_data = NULL;
+     
+      if (node->current_size) {
+         /* If the malloc fails, we just pull the data out of the VBO
+          * later instead.
+          */
+         node->current_data = MALLOC( node->current_size * sizeof(GLfloat) );
+         if (node->current_data) {
+            const char *buffer = (const char *)save->vertex_store->buffer;
+            unsigned attr_offset = node->attrsz[0] * sizeof(GLfloat);
+            unsigned vertex_offset = 0;
+            
+            if (node->count)
+               vertex_offset = (node->count-1) * node->vertex_size * sizeof(GLfloat);
+         
+            memcpy( node->current_data,
+                    buffer + node->buffer_offset + vertex_offset + attr_offset,
+                    node->current_size * sizeof(GLfloat) );
+         }
       }
    }
 
@@ -397,6 +402,7 @@ static void _save_wrap_buffers( struct gl_context *ctx )
    GLint i = save->prim_count - 1;
    GLenum mode;
    GLboolean weak;
+   GLboolean no_current_update;
 
    assert(i < (GLint) save->prim_max);
    assert(i >= 0);
@@ -407,6 +413,7 @@ static void _save_wrap_buffers( struct gl_context *ctx )
                          save->prim[i].start);
    mode = save->prim[i].mode;
    weak = save->prim[i].weak;
+   no_current_update = save->prim[i].no_current_update;
    
    /* store the copied vertices, and allocate a new list.
     */
@@ -416,6 +423,7 @@ static void _save_wrap_buffers( struct gl_context *ctx )
     */
    save->prim[0].mode = mode;
    save->prim[0].weak = weak;
+   save->prim[0].no_current_update = no_current_update;
    save->prim[0].begin = 0;
    save->prim[0].end = 0;
    save->prim[0].pad = 0;
@@ -770,10 +778,11 @@ GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode )
    GLuint i = save->prim_count++;
 
    assert(i < save->prim_max);
-   save->prim[i].mode = mode & ~VBO_SAVE_PRIM_WEAK;
+   save->prim[i].mode = mode & VBO_SAVE_PRIM_MODE_MASK;
    save->prim[i].begin = 1;
    save->prim[i].end = 0;
    save->prim[i].weak = (mode & VBO_SAVE_PRIM_WEAK) ? 1 : 0;
+   save->prim[i].no_current_update = (mode & VBO_SAVE_PRIM_NO_CURRENT_UPDATE) ? 1 : 0;
    save->prim[i].pad = 0;
    save->prim[i].start = save->vert_count;
    save->prim[i].count = 0;   
@@ -934,7 +943,7 @@ static void GLAPIENTRY _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei co
 
    _ae_map_vbos( ctx );
 
-   vbo_save_NotifyBegin( ctx, mode | VBO_SAVE_PRIM_WEAK );
+   vbo_save_NotifyBegin( ctx, mode | VBO_SAVE_PRIM_WEAK | VBO_SAVE_PRIM_NO_CURRENT_UPDATE);
 
    for (i = 0; i < count; i++)
        CALL_ArrayElement(GET_DISPATCH(), (start + i));
@@ -960,7 +969,7 @@ static void GLAPIENTRY _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum
    if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj))
       indices = ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Pointer, indices);
 
-   vbo_save_NotifyBegin( ctx, mode | VBO_SAVE_PRIM_WEAK );
+   vbo_save_NotifyBegin( ctx, mode | VBO_SAVE_PRIM_WEAK | VBO_SAVE_PRIM_NO_CURRENT_UPDATE );
 
    switch (type) {
    case GL_UNSIGNED_BYTE:
index 533c150a9182b5c9aace49ccade34a2d87986c0a..d0454bf6212da8bf8d03b0c47266cbe36235fd78 100644 (file)
@@ -30,6 +30,7 @@
 #include "main/bufferobj.h"
 #include "main/context.h"
 #include "main/imports.h"
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
 #include "main/light.h"
index b1cfa9c2a8f4d49c3fddb0b8f574d1062f134f33..51e598e7e614a9ddc0f60135f70753ad3022cf22 100644 (file)
@@ -29,6 +29,7 @@
 #include "main/glheader.h"
 #include "main/enums.h"
 #include "main/imports.h"
+#include "main/mfeatures.h"
 #include "main/mtypes.h"
 #include "main/dispatch.h"
 #include "glapi/glapi.h"
index d4bda07eade9fadfc3b2063e5d59aec8124a8f5b..74e9979d3120d7d20f2943ce258e74af8dadd8fe 100644 (file)
@@ -27,7 +27,9 @@
 #define ASM_MMX_H
 
 #include "main/compiler.h"
-#include "main/mtypes.h"
+#include "main/glheader.h"
+
+struct gl_context;
 
 extern void _ASMAPI
 _mesa_mmx_blend_transparency( struct gl_context *ctx, GLuint n, const GLubyte mask[],